  :root {
    --bg: #F4F7F8;
    --surface: #FFFFFF;
    --text: #1A1C1E;
    --text-muted: #6B7379;
    --accent: #2589F5;
    --accent-soft: #E8F1FE;
    --danger: #FF5A5F;
    --warn: #FFB648;
    --success: #34C759;
    --border: #EDEFF1;
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --shadow-soft: 0 4px 20px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.03);
    --shadow-pop: 0 10px 30px rgba(16, 24, 40, 0.08);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
  }

  body.dark-mode {
    --bg: #0F1419;
    --surface: #1A1F2E;
    --text: #FAFBFC;
    --text-muted: #A0A8B0;
    --border: #2A3038;
  }

  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body { height: 100%; margin: 0; }
  body {
    font-family: 'Urbanist', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s var(--ease), color 0.3s var(--ease);
  }

  .app {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 88px 1fr;
    overflow: hidden;
    transition: grid-template-columns 0.4s var(--ease);
  }

  .app.sidebar-expanded {
    grid-template-columns: 260px 1fr;
  }

  /* ===== SIDEBAR ===== */
  .sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 4px;
    transition: all 0.4s var(--ease);
    overflow-y: auto;
    overflow-x: hidden;
  }

  .app.sidebar-expanded .sidebar {
    align-items: stretch;
    padding: 12px 10px;
    gap: 2px;
  }

  .logo {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2589F5 0%, #1a6fd0 100%);
    display: grid; place-items: center;
    color: white; font-weight: 800; font-size: 20px;
    margin: 0 auto 20px;
    box-shadow: 0 6px 16px rgba(37, 137, 245, 0.35);
    flex-shrink: 0;
    transition: all 0.4s var(--ease);
  }

  .app.sidebar-expanded .logo {
    width: calc(100% - 8px);
    margin: 0 4px 12px;
    border-radius: 12px;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 12px;
    gap: 12px;
    height: 50px;
  }

  .logo-text {
    display: none;
    font-size: 18px;
    font-weight: 800;
    color: var(--accent-soft);
    white-space: nowrap;
  }

  .app.sidebar-expanded .logo-text {
    display: block;
  }

  .sidebar-label {
    display: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    padding: 12px 16px 6px;
    width: 100%;
    box-sizing: border-box;
  }

  .app.sidebar-expanded .sidebar-label {
    display: block;
  }

  .nav-btn {
    width: 54px; height: 54px;
    border-radius: 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    position: relative;
    flex-shrink: 0;
  }

  .app.sidebar-expanded .nav-btn {
    width: calc(100% - 8px);
    height: 46px;
    border-radius: 12px;
    padding: 0 14px;
    justify-content: flex-start;
    gap: 14px;
    margin: 0 4px;
  }

  .nav-btn:hover { background: var(--bg); transform: translateY(-2px); }
  .nav-btn:active { transform: scale(0.94); }

  .app.sidebar-expanded .nav-btn:hover {
    background: rgba(37, 137, 245, 0.08);
    transform: none;
  }

  .nav-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
  }

  .app.sidebar-expanded .nav-btn.active {
    background: linear-gradient(90deg, rgba(37, 137, 245, 0.12) 0%, transparent 100%);
    border-left: none;
    color: var(--accent);
  }

  .nav-btn i { width: 22px; height: 22px; flex-shrink: 0; }

  .nav-label {
    display: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    flex: 1;
  }

  .app.sidebar-expanded .nav-label {
    display: block;
  }

  .nav-spacer { flex: 1; }

  .sidebar-toggle {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    flex-shrink: 0;
  }

  .app.sidebar-expanded .sidebar-toggle {
    width: calc(100% - 8px);
    border-radius: 12px;
    justify-content: flex-start;
    padding: 0 14px;
    height: 46px;
    margin: 0 4px;
    gap: 14px;
  }

  .sidebar-toggle:hover { background: var(--bg); }
  
  .sidebar-toggle i { width: 22px; height: 22px; flex-shrink: 0; transition: transform 0.4s var(--ease); }
  
  .app.sidebar-expanded .sidebar-toggle i { transform: rotate(180deg); }
  
  .sidebar-toggle-label {
    display: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
  }
  
  .app.sidebar-expanded .sidebar-toggle-label {
    display: block;
  }

  /* ===== MAIN ===== */
  .main {
    overflow-y: auto;
    padding: 36px 44px 60px;
    scroll-behavior: smooth;
  }
  .main::-webkit-scrollbar { width: 8px; }
  .main::-webkit-scrollbar-thumb { background: #dde2e5; border-radius: 10px; }

  .page { display: none; animation: fadeUp 0.45s var(--ease); }
  .page.active { display: block; }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* ===== HEADER ===== */
  .page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 16px;
  }
  .hello h1 {
    font-size: 34px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.03em;
  }
  .hello p {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
  }
  .header-actions {
    display: flex;
    gap: 10px;
  }
  .icon-btn {
    width: 48px; height: 48px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: grid; place-items: center;
    cursor: pointer;
    color: var(--text);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
    position: relative;
  }
  .icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
  .icon-btn:active { transform: scale(0.95); }
  .icon-btn i { width: 20px; height: 20px; }
  .icon-btn.notif-badge::after {
    content: '';
    position: absolute;
    top: 6px; right: 6px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--danger);
  }

  .primary-btn {
    background: var(--text);
    color: white;
    border: none;
    padding: 0 22px;
    height: 48px;
    border-radius: 16px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    transition: transform 0.3s var(--ease);
  }
  .primary-btn:hover { transform: translateY(-2px); }
  .primary-btn:active { transform: scale(0.96); }
  .primary-btn i { width: 18px; height: 18px; }

  /* ===== ROOM PILLS ===== */
  .room-scroller {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .room-scroller::-webkit-scrollbar { display: none; }
  .room-pill {
    border: none;
    background: var(--surface);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s var(--ease);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .room-pill.active {
    background: var(--text);
    color: white;
    border-color: var(--text);
  }
  .room-pill:hover:not(.active) { background: #eef2f4; }

  /* ===== SUMMARY STRIP ===== */
  .summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
  }
  .summary-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.3s var(--ease);
  }
  .summary-card:hover { transform: translateY(-3px); }
  .summary-icon {
    width: 44px; height: 44px;
    border-radius: 14px;
    display: grid; place-items: center;
    flex-shrink: 0;
  }
  .summary-icon i { width: 20px; height: 20px; }
  .summary-icon.blue { background: #E8F1FE; color: #2589F5; }
  .summary-icon.orange { background: #FFF1E0; color: #FF9A3D; }
  .summary-icon.green { background: #E6F8EC; color: #34C759; }
  .summary-icon.purple { background: #F0ECFE; color: #7C5CFA; }
  .summary-card .meta { font-size: 13px; color: var(--text-muted); margin-bottom: 2px; }
  .summary-card .value { font-size: 17px; font-weight: 700; }

  /* ===== SECTION TITLES ===== */
  .section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 8px 0 16px;
  }
  .section-title h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
  }
  .section-title a {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
  }

  /* ===== LAYOUT TOGGLE ===== */
  .layout-toggle {
    display: flex;
    gap: 6px;
  }
  .layout-btn {
    width: 36px; height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    display: grid; place-items: center;
    cursor: pointer;
    transition: all 0.3s var(--ease);
  }
  .layout-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
  }
  .layout-btn i { width: 16px; height: 16px; }

  /* ===== DEVICE CARDS (GRID) ===== */
  .device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
  }
  .device-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 22px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
    position: relative;
    overflow: hidden;
    cursor: pointer;
  }
  .device-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 85% -10%, var(--glow, transparent) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s var(--ease);
    pointer-events: none;
  }
  .device-card.on::before { opacity: 1; }
  .device-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-pop); }

  .dev-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
  .dev-icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    background: var(--bg);
    display: grid; place-items: center;
    color: var(--text-muted);
    transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
  }
  .dev-icon i { width: 22px; height: 22px; }
  .device-card.on .dev-icon {
    background: var(--accent-color, var(--accent));
    color: white;
    animation: bubble 0.5s var(--ease);
  }
  @keyframes bubble {
    0% { transform: scale(1); }
    40% { transform: scale(1.15); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
  }

  .dev-name {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
  }
  .dev-room {
    font-size: 13px;
    color: var(--text-muted);
    margin: 2px 0 0;
  }
  .dev-status {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
  }
  .device-card.on .dev-status { color: var(--accent-color, var(--accent)); font-weight: 600; }

  .dev-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
  }

  /* ===== DEVICE LIST (LIST VIEW) ===== */
  .device-list {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 8px;
    box-shadow: var(--shadow-soft);
    display: none;
  }

  .device-list.show {
    display: block;
  }

  .device-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 18px;
    align-items: center;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    transition: background 0.3s var(--ease);
  }
  .device-row:hover { background: var(--bg); }
  .device-row + .device-row { border-top: 1px solid var(--border); }
  .device-row:hover + .device-row,
  .device-row:has(+ .device-row:hover) { border-top-color: transparent; }
  .row-icon {
    width: 44px; height: 44px;
    border-radius: 13px;
    background: var(--bg);
    display: grid; place-items: center;
    color: var(--text-muted);
  }
  .row-icon i { width: 20px; height: 20px; }
  .row-main .name { font-weight: 600; font-size: 15px; margin: 0; }
  .row-main .meta { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }
  .status-dot {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 13px;
    color: var(--dot-color, var(--text-muted));
    font-weight: 600;
  }
  .status-dot::before {
    content: '';
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--dot-color, var(--text-muted));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot-color, #999) 18%, transparent);
  }

  /* ===== SAMSUNG-STYLE TOGGLE ===== */
  .switch { position: relative; display: inline-block; }
  .switch input { opacity: 0; width: 0; height: 0; position: absolute; }
  .switch label {
    display: block;
    width: 52px;
    height: 30px;
    background: #D8DEE2;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.3s var(--ease);
    position: relative;
  }
  .switch label::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 24px; height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    transition: transform 0.3s var(--ease), background 0.3s var(--ease);
  }
  .switch input:checked + label { background: var(--accent-color, var(--accent)); }
  .switch input:checked + label::after { transform: translateX(22px); }
  .switch label:active::after { width: 28px; }

  /* ===== SEARCH & FILTER ===== */
  .search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
  }
  /* ===== CUSTOM DROPDOWN ===== */
  .dropdown-wrapper {
    position: relative;
    display: inline-block;
  }
  .dropdown-trigger {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s var(--ease);
    height: 44px;
    min-width: 140px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .dropdown-trigger:hover { border-color: var(--accent); }
  .dropdown-trigger.active { 
    border-color: var(--accent); 
    box-shadow: 0 0 0 3px var(--accent-soft); 
  }
  .dropdown-trigger i { width: 16px; height: 16px; transition: transform 0.3s var(--ease); }
  .dropdown-trigger.open i { transform: rotate(180deg); }

  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-top: 8px;
    min-width: 100%;
    max-width: 280px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    z-index: 50;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.3s var(--ease);
    overflow: hidden;
  }
  .dropdown-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .dropdown-option {
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    transition: background 0.2s var(--ease);
    display: block;
  }
  .dropdown-option:hover { background: var(--bg); }
  .dropdown-option.selected { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .dropdown-option + .dropdown-option { border-top: 1px solid var(--border); }

  /* ===== CATEGORY SECTION ===== */
  .category-section {
    margin-bottom: 32px;
  }

  /* ===== NOTIFICATIONS ===== */
  .notif-container {
    max-width: 720px;
  }
  .notif-group {
    margin-bottom: 24px;
  }
  .notif-group-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 0 12px;
    letter-spacing: 0.05em;
  }
  .notif-list {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
  }
  .notif-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: background 0.3s var(--ease);
    cursor: pointer;
  }
  .notif-item:last-child { border-bottom: none; }
  .notif-item:hover { background: var(--bg); }
  .notif-item.unread { background: var(--accent-soft); }
  .notif-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
  }
  .notif-icon i { width: 20px; height: 20px; }
  .notif-icon.info { background: #E8F1FE; color: #2589F5; }
  .notif-icon.warning { background: #FFF1E0; color: #FF9A3D; }
  .notif-icon.success { background: #E6F8EC; color: #34C759; }
  .notif-icon.error { background: #FFE6E7; color: #FF5A5F; }
  .notif-body {
    flex: 1;
  }
  .notif-title {
    font-weight: 600;
    font-size: 14px;
    margin: 0 0 2px;
  }
  .notif-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
  }
  .notif-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
  }
  .notif-action {
    display: flex;
    gap: 8px;
    margin-top: 10px;
  }
  .notif-btn {
    background: var(--bg);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease);
  }
  .notif-btn:hover { background: var(--border); }
  .notif-btn.primary {
    background: var(--accent);
    color: white;
  }
  .notif-btn.primary:hover { background: #1a6fd0; }

  /* ===== ROUTINES ===== */
  .routine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
  }
  .routine-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 22px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.3s var(--ease);
  }
  .routine-card:hover { transform: translateY(-4px); }
  .routine-emoji {
    width: 52px; height: 52px;
    border-radius: 16px;
    display: grid; place-items: center;
    font-size: 26px;
    background: var(--bg);
  }
  .routine-card h3 { margin: 0; font-size: 17px; font-weight: 700; }
  .routine-card p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
  .routine-card .run-btn {
    align-self: flex-start;
    background: var(--text);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600; font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    margin-top: 4px;
    transition: transform 0.3s var(--ease);
  }
  .routine-card .run-btn:active { transform: scale(0.95); }

  /* ===== ROUTINE BUILDER ===== */
  .builder {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 30px;
    box-shadow: var(--shadow-soft);
    max-width: 880px;
  }
  .builder h2 {
    font-size: 22px; font-weight: 700; margin: 0 0 6px;
  }
  .builder > p.sub {
    color: var(--text-muted); font-size: 14px; margin: 0 0 26px;
  }
  .flow-step {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    position: relative;
  }
  .flow-step + .flow-step { margin-top: 14px; }
  .step-badge {
    width: 44px; height: 44px;
    border-radius: 14px;
    display: grid; place-items: center;
    font-weight: 800;
    flex-shrink: 0;
    color: white;
  }
  .step-badge.if { background: linear-gradient(135deg, #2589F5, #1a6fd0); }
  .step-badge.then { background: linear-gradient(135deg, #7C5CFA, #5a3dd6); }
  .step-badge i { width: 20px; height: 20px; }
  .step-connector {
    width: 44px;
    display: flex;
    justify-content: center;
    padding: 4px 0;
  }
  .step-connector::before {
    content: '';
    width: 2px;
    height: 24px;
    background: repeating-linear-gradient(to bottom, #CBD1D5 0, #CBD1D5 4px, transparent 4px, transparent 8px);
  }
  .step-body {
    flex: 1;
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
  }
  .step-body h3 {
    margin: 0 0 4px;
    font-size: 15px; font-weight: 700;
  }
  .step-body .hint { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; }

  .chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
  .chip {
    background: white;
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    transition: all 0.3s var(--ease);
  }
  .chip i { width: 15px; height: 15px; color: var(--text-muted); }
  .chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
  .chip.selected {
    background: var(--text); color: white; border-color: var(--text);
  }
  .chip.selected i { color: white; }

  .dropdown-container {
    display: grid;
    gap: 10px;
  }
  .mini-dropdown {
    background: white;
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s var(--ease);
  }
  .mini-dropdown:hover { border-color: var(--accent); }
  .mini-dropdown:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

  .selected-box {
    margin-top: 14px;
    padding: 14px 16px;
    background: white;
    border-radius: var(--radius-md);
    border: 1px dashed #CBD1D5;
    display: flex; align-items: center; gap: 12px;
    font-size: 14px;
    color: var(--text-muted);
  }
  .selected-box.filled { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 600; }
  .selected-box i { width: 18px; height: 18px; }

  .builder-footer {
    display: flex; gap: 12px; justify-content: flex-end;
    margin-top: 24px;
  }
  .ghost-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0 22px;
    height: 46px;
    border-radius: 14px;
    font-family: inherit; font-weight: 600; font-size: 14px;
    cursor: pointer;
    transition: background 0.3s var(--ease);
  }
  .ghost-btn:hover { background: var(--bg); }

  /* ===== MENU VIEW ===== */
  .menu-container {
    padding-top: 20px;
    max-width: 720px;
  }
  .profile-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    margin-bottom: 28px;
  }
  .avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFB648, #FF5A5F);
    display: grid; place-items: center;
    color: white; font-weight: 800; font-size: 24px;
    flex-shrink: 0;
  }
  .profile-card .info h3 { margin: 0; font-size: 18px; font-weight: 700; }
  .profile-card .info p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
  .profile-card .edit-btn {
    background: var(--bg);
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-left: auto;
    transition: all 0.3s var(--ease);
  }
  .profile-card .edit-btn:hover { background: var(--border); }

  .menu-list {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
  }
  .menu-item {
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 22px 24px;
    cursor: pointer;
    transition: background 0.3s var(--ease);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
    color: var(--text);
  }
  .menu-item + .menu-item { border-top: 1px solid var(--border); }
  .menu-item:hover { background: var(--bg); }
  .menu-item .ic {
    width: 44px; height: 44px;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid; place-items: center;
  }
  .menu-item .ic i { width: 20px; height: 20px; }
  .menu-item .label { font-weight: 600; font-size: 15px; }
  .menu-item .desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; font-weight: 400; }
  .menu-item .chev { color: var(--text-muted); }

  /* ===== SETTINGS PAGES ===== */
  .settings-page {
    display: none;
  }
  .settings-page.active {
    display: block;
  }
  .settings-form {
    max-width: 720px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 30px;
    box-shadow: var(--shadow-soft);
  }
  .form-group {
    display: grid;
    gap: 8px;
    margin-bottom: 24px;
  }
  .form-group label {
    font-weight: 600;
    font-size: 14px;
  }
  .form-group input,
  .form-group select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    transition: all 0.3s var(--ease);
  }
  .form-group input:focus,
  .form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
  }
  .form-group input::placeholder { color: var(--text-muted); }
  .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
  }

  .theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  .theme-option {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  .theme-option.active {
    border-color: var(--accent);
    background: var(--accent-soft);
  }
  .theme-option .preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
  }
  .theme-light .preview { background: #F4F7F8; border: 1px solid #EDEFF1; }
  .theme-dark .preview { background: #1A1F2E; border: 1px solid #2A3038; }
  .theme-option label {
    font-weight: 600;
    font-size: 14px;
  }

  .font-size-slider {
    display: flex;
    gap: 12px;
    align-items: center;
  }
  .font-size-slider input {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    padding: 0;
  }
  .font-size-slider input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: all 0.3s var(--ease);
  }
  .font-size-slider input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    transition: all 0.3s var(--ease);
  }
  .font-size-display {
    font-weight: 600;
    min-width: 50px;
  }

  /* ===== MODAL ===== */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.45);
    backdrop-filter: blur(6px);
    display: grid; place-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
    z-index: 100;
    padding: 20px;
  }
  .modal-backdrop.open { opacity: 1; pointer-events: auto; }
  .modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    padding: 32px;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.4s var(--ease);
    box-shadow: 0 30px 80px rgba(0,0,0,0.2);
  }
  .modal-backdrop.open .modal { transform: scale(1) translateY(0); }
  .modal h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
  .modal > p.sub { margin: 0 0 24px; color: var(--text-muted); font-size: 14px; }

  .pair-state { text-align: center; padding: 10px 0 20px; }
  .radar {
    width: 120px; height: 120px;
    margin: 0 auto 22px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: grid; place-items: center;
    position: relative;
  }
  .radar::before, .radar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    animation: pulse 2.2s var(--ease) infinite;
  }
  .radar::after { animation-delay: 1.1s; }
  @keyframes pulse {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
  }
  .radar i { width: 44px; height: 44px; color: var(--accent); }

  .found-device {
    display: none;
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    animation: fadeUp 0.4s var(--ease);
  }
  .found-device.show { display: flex; }
  .found-device .ic {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--accent);
    color: white;
    display: grid; place-items: center;
  }
  .found-device .nm { font-weight: 700; font-size: 14px; }
  .found-device .mt { font-size: 12px; color: var(--text-muted); }

  .modal-footer {
    display: flex; gap: 10px; justify-content: flex-end;
  }

  /* ===== TOAST ===== */
  .toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 14px 22px;
    border-radius: 16px;
    font-weight: 600; font-size: 14px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    opacity: 0;
    transition: all 0.4s var(--ease);
    z-index: 200;
    display: inline-flex; align-items: center; gap: 10px;
  }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  .toast i { width: 18px; height: 18px; color: var(--success); }

    .search-bar input{
      width: 50%;
      padding: 10px;
      border-radius: 20px;
    }
    .filroom{
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
    }
  /* ===== RESPONSIVE ===== */
  @media (max-width: 900px) {
    .app { grid-template-columns: 76px 1fr; }
    .main { padding: 28px 24px 50px; }
    .hello h1 { font-size: 28px; }
    .device-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
    .device-card { padding: 18px; border-radius: 24px; }
  }
  @media (max-width: 620px) {
    .app { grid-template-columns: 1fr; grid-template-rows: 1fr 72px; }
    .sidebar {
      order: 2;
      flex-direction: row;
      padding: 10px 16px;
      border-right: none;
      border-top: 1px solid var(--border);
      gap: 4px;
      justify-content: space-around;
    }
    .app.sidebar-expanded { grid-template-columns: 1fr; }
    .app.sidebar-expanded .sidebar {
      flex-direction: row;
    }
    .logo { display: none; }
    .nav-spacer { display: none; }
    .nav-btn { width: 52px; height: 52px; border-radius: 16px; }
    .app.sidebar-expanded .nav-btn { width: auto; height: 52px; }
    .main { order: 1; padding: 24px 18px 30px; }
    .hello h1 { font-size: 24px; }
    .header-actions .primary-btn span { display: none; }
    .primary-btn { padding: 0 14px; }

    .summary-grid {
      grid-template-columns: 1fr 1fr;
    }
    .summary-card {
    align-items: flex-start;
    }
    .device-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .sidebar-toggle {
      display: none;
    }
    .search-bar{
      flex-direction: column;
    }
    .search-bar input{
      width: 100%;
      padding: 10px;
      border-radius: 20px;
    }
    .filroom{
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
  }
