    :root {
      --bg: #f5f6f8;
      --surface: #ffffff;
      --surface2: #f0f2f5;
      --surface3: #fafbfc;
      --border: #e1e4e8;
      --border-light: #edf0f2;
      --text: #1b2533;
      --text2: #586069;
      --text3: #8b949e;
      --primary: #2563eb;
      --primary-hover: #1d4ed8;
      --primary-bg: #eff6ff;
      --primary-border: #bfdbfe;
      --green: #16a34a;
      --green-bg: #f0fdf4;
      --green-text: #15803d;
      --green-border: #bbf7d0;
      --red: #dc2626;
      --red-bg: #fef2f2;
      --red-border: #fecaca;
      --orange: #d97706;
      --orange-bg: #fffbeb;
      --orange-border: #fde68a;
      --purple: #7c3aed;
      --purple-bg: #f5f3ff;
      --purple-border: #ddd6fe;
      --sidebar-w: 224px;
      --sidebar-collapsed: 48px;
      --topbar-h: 48px;
      --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
      --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
      --shadow-lg: 0 4px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.06);
      --radius: 6px;
      --radius-lg: 8px;
      --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-mono: 'Roboto Mono', 'Consolas', 'Monaco', monospace;
      --backdrop: blur(0px);
    }
    [data-theme="dark"] {
      --bg: #06080d;
      --surface: rgba(18, 22, 33, 0.5);
      --surface2: rgba(30, 36, 51, 0.65);
      --surface3: rgba(45, 53, 72, 0.55);
      --border: rgba(255, 255, 255, 0.07);
      --border-light: rgba(255, 255, 255, 0.03);
      --text: #f8fafc;
      --text2: #94a3b8;
      --text3: #64748b;
      --primary: #8b5cf6;
      --primary-hover: #a78bfa;
      --primary-bg: rgba(139, 92, 246, 0.15);
      --primary-border: rgba(139, 92, 246, 0.35);
      --green: #10b981;
      --green-bg: rgba(16, 185, 129, 0.1);
      --green-text: #34d399;
      --green-border: rgba(16, 185, 129, 0.25);
      --red: #f43f5e;
      --red-bg: rgba(244, 63, 94, 0.1);
      --red-border: rgba(244, 63, 94, 0.25);
      --orange: #f59e0b;
      --orange-bg: rgba(245, 158, 11, 0.1);
      --orange-border: rgba(245, 158, 11, 0.25);
      --purple: #d946ef;
      --purple-bg: rgba(217, 70, 239, 0.1);
      --purple-border: rgba(217, 70, 239, 0.25);
      --shadow-sm: 0 4px 12px rgba(0,0,0,0.5);
      --shadow: 0 12px 24px rgba(0,0,0,0.7);
      --shadow-lg: 0 24px 48px rgba(0,0,0,0.8);
      --backdrop: blur(16px);
    }

    * { margin: 0; padding: 0; box-sizing: border-box; }

    body {
      font-family: var(--font);
      background: var(--bg);
      color: var(--text);
      height: 100vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      font-size: 13px;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      letter-spacing: -0.006em;
    }

    /* ── TOP BAR ──────────────────────────────────────────────── */
    .topbar {
      height: var(--topbar-h);
      background: var(--surface);
      backdrop-filter: var(--backdrop);
      -webkit-backdrop-filter: var(--backdrop);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      padding: 0 12px;
      gap: 6px;
      z-index: 200;
      flex-shrink: 0;
    }
    .hamburger {
      width: 32px; height: 32px;
      border: none; background: transparent;
      cursor: pointer; border-radius: var(--radius);
      display: flex; align-items: center; justify-content: center;
      color: var(--text2); transition: all 0.12s;
      flex-shrink: 0;
    }
    .hamburger:hover { background: var(--surface2); color: var(--text); }

    .topbar-brand {
      display: flex; align-items: center; gap: 8px;
      padding: 0 6px; min-width: 140px;
    }
    .brand-icon {
      width: 26px; height: 26px;
      background: linear-gradient(135deg, #2563eb, #3b82f6);
      border-radius: var(--radius);
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .brand-text { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.02em; }
    .brand-sub { font-size: 10px; color: var(--text3); font-weight: 400; letter-spacing: 0.02em; }

    .search-wrap {
      flex: 1; max-width: 480px; margin: 0 12px; position: relative;
    }
    .search-input {
      width: 100%; height: 32px;
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 0 32px 0 32px;
      font-size: 12px; background: var(--surface2); color: var(--text);
      outline: none; transition: all 0.12s; cursor: pointer; font-family: var(--font);
    }
    .search-input:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
    .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); pointer-events: none; }
    .search-kbd {
      position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
      font-size: 10px; color: var(--text3); background: var(--surface);
      padding: 1px 5px; border-radius: 3px; font-family: var(--font-mono); pointer-events: none;
      border: 1px solid var(--border);
    }

    .topbar-spacer { flex: 1; }
    .topbar-actions { display: flex; align-items: center; gap: 2px; }

    .live-badge {
      display: flex; align-items: center; gap: 5px;
      font-size: 11px; color: var(--green-text); padding: 0 10px;
      font-weight: 500; background: var(--green-bg); border-radius: 100px;
      padding: 3px 10px; border: 1px solid var(--green-border);
    }
    .live-dot {
      width: 6px; height: 6px; border-radius: 50%;
      background: var(--green); animation: pulse 2s ease-in-out infinite;
    }
    @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

    .icon-btn {
      width: 32px; height: 32px;
      border: none; background: transparent;
      cursor: pointer; border-radius: var(--radius);
      display: flex; align-items: center; justify-content: center;
      color: var(--text3); position: relative; transition: all 0.12s;
    }
    .icon-btn:hover { background: var(--surface2); color: var(--text2); }
    .notif-dot {
      position: absolute; top: 5px; right: 5px;
      width: 6px; height: 6px; border-radius: 50%;
      background: var(--red); border: 1.5px solid var(--surface);
    }

    .avatar-btn {
      width: 28px; height: 28px;
      background: linear-gradient(135deg, #2563eb, #7c3aed);
      border-radius: 50%; border: none;
      color: white; font-size: 11px; font-weight: 600;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: opacity 0.12s; flex-shrink: 0;
      font-family: var(--font);
    }
    .avatar-btn:hover { opacity: 0.85; }

    /* ── DROPDOWN ──────────────────────────────────────────────── */
    .dropdown { position: relative; }
    .dropdown-menu {
      display: none; position: absolute; right: 0; top: calc(100% + 4px);
      background: var(--surface); border: 1px solid var(--border);
      backdrop-filter: var(--backdrop);
      -webkit-backdrop-filter: var(--backdrop);
      border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
      min-width: 200px; z-index: 500; overflow: hidden;
    }
    .dropdown-menu.open { display: block; animation: fadeUp 0.1s ease-out; }
    @keyframes fadeUp { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }
    .dd-header { padding: 10px 12px 2px; font-size: 10px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
    .dd-user { padding: 4px 12px 10px; }
    .dd-name { font-size: 13px; font-weight: 600; }
    .dd-email { font-size: 11px; color: var(--text2); margin-top: 1px; }
    .dd-divider { height: 1px; background: var(--border); margin: 0; }
    .dd-item {
      display: flex; align-items: center; gap: 8px;
      padding: 8px 12px; font-size: 13px; cursor: pointer;
      transition: all 0.08s; color: var(--text); font-weight: 400;
    }
    .dd-item:hover { background: var(--surface2); }
    .dd-item.danger { color: var(--red); }

    /* ── APP BODY ──────────────────────────────────────────────── */
    .app-body { display: flex; flex: 1; overflow: hidden; }

    /* ── SIDEBAR ───────────────────────────────────────────────── */
    .sidebar {
      width: var(--sidebar-w);
      background: var(--surface);
      backdrop-filter: var(--backdrop);
      -webkit-backdrop-filter: var(--backdrop);
      border-right: 1px solid var(--border);
      display: flex; flex-direction: column;
      flex-shrink: 0; overflow-x: hidden; overflow-y: auto;
      transition: width 0.2s ease;
      z-index: 100;
      padding-top: 6px;
    }
    .sidebar.collapsed { width: var(--sidebar-collapsed); }

    .nav-section { padding: 2px 0; }
    .nav-section-label {
      font-size: 10px; font-weight: 600; text-transform: uppercase;
      color: var(--text3); padding: 14px 16px 5px;
      letter-spacing: 0.06em; white-space: nowrap;
      transition: opacity 0.2s;
    }
    .sidebar.collapsed .nav-section-label { opacity: 0; }

    .nav-item {
      display: flex; align-items: center; gap: 10px;
      padding: 0 12px; height: 32px; margin: 1px 8px;
      cursor: pointer; border-radius: var(--radius);
      color: var(--text2); font-weight: 400;
      transition: all 0.08s;
      white-space: nowrap; overflow: hidden; position: relative;
      font-size: 13px;
    }
    .nav-item:hover { background: var(--surface2); color: var(--text); }
    .nav-item.active {
      background: var(--primary-bg); color: var(--primary); font-weight: 500;
    }
    .nav-icon {
      width: 18px; height: 18px;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .nav-item.active .nav-icon { color: var(--primary); }
    .nav-label { font-size: 13px; transition: opacity 0.2s; }
    .sidebar.collapsed .nav-label { opacity: 0; pointer-events: none; }
    .nav-tooltip {
      display: none; position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
      background: var(--text); color: var(--bg);
      font-size: 11px; padding: 4px 8px; border-radius: var(--radius);
      white-space: nowrap; pointer-events: none; z-index: 500; margin-left: 8px;
      font-weight: 500; box-shadow: var(--shadow-lg);
    }
    .nav-tooltip::before {
      content: ''; position: absolute; right: 100%; top: 50%; transform: translateY(-50%);
      border: 4px solid transparent; border-right-color: var(--text);
    }
    .sidebar.collapsed .nav-item:hover .nav-tooltip { display: block; }

    .nav-divider { height: 1px; background: var(--border-light); margin: 6px 16px; }

    /* ── MAIN ──────────────────────────────────────────────────── */
    .main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

    .crumb-bar {
      height: 36px; padding: 0 20px;
      border-bottom: 1px solid var(--border);
      background: var(--surface);
      display: flex; align-items: center; justify-content: space-between;
      flex-shrink: 0;
    }
    .crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); }
    .crumb-sep { color: var(--text3); }
    .crumb-current { color: var(--text); font-weight: 500; }
    .crumb-sub { font-size: 11px; color: var(--text3); }

    .content { flex: 1; padding: 20px; overflow-y: auto; overflow-x: hidden; }

    /* ── STAT CARDS ────────────────────────────────────────────── */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 12px; margin-bottom: 20px;
    }
    .stat-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 16px 18px;
      display: flex; align-items: flex-start; gap: 14px;
      transition: all 0.12s;
      cursor: pointer;
      box-shadow: var(--shadow-sm);
    }
    .stat-card:hover { border-color: var(--primary-border); box-shadow: var(--shadow); }
    .stat-icon {
      width: 36px; height: 36px; border-radius: var(--radius);
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .stat-icon.blue { background: var(--primary-bg); color: var(--primary); border: 1px solid var(--primary-border); }
    .stat-icon.green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
    .stat-icon.orange { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-border); }
    .stat-icon.purple { background: var(--purple-bg); color: var(--purple); border: 1px solid var(--purple-border); }
    [data-theme="dark"] .stat-icon.blue { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-border); }
    [data-theme="dark"] .stat-icon.green { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
    [data-theme="dark"] .stat-icon.orange { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-border); }
    [data-theme="dark"] .stat-icon.purple { background: var(--purple-bg); color: var(--purple); border-color: var(--purple-border); }
    .stat-body { flex: 1; min-width: 0; }
    .stat-label { font-size: 11px; font-weight: 500; color: var(--text3); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
    .stat-value { font-size: 24px; font-weight: 600; color: var(--text); line-height: 1.2; margin-bottom: 2px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
    .stat-trend { font-size: 11px; color: var(--text3); font-weight: 400; }

    /* ── CHARTS ROW ────────────────────────────────────────────── */
    .charts-row {
      display: grid;
      grid-template-columns: 2fr 1fr;
      gap: 12px; margin-bottom: 20px;
    }

    /* ── CARDS ─────────────────────────────────────────────────── */
    .card {
      background: var(--surface);
      backdrop-filter: var(--backdrop);
      -webkit-backdrop-filter: var(--backdrop);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      overflow: hidden;
      box-shadow: var(--shadow-sm);
    }
    .card-header {
      padding: 12px 16px;
      border-bottom: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between;
      background: var(--surface3);
    }
    .card-title {
      font-size: 12px; font-weight: 600; color: var(--text2);
      display: flex; align-items: center; gap: 6px;
      text-transform: uppercase; letter-spacing: 0.04em;
    }
    .card-title svg { color: var(--text3); }
    .card-body { padding: 16px; }
    .card-link { font-size: 12px; color: var(--primary); cursor: pointer; font-weight: 500; transition: color 0.1s; }
    .card-link:hover { color: var(--primary-hover); text-decoration: underline; }

    /* ── RESOURCE METERS ───────────────────────────────────────── */
    .res-row {
      display: flex; align-items: center; gap: 12px;
      padding: 10px 0; border-bottom: 1px solid var(--border-light);
    }
    .res-row:last-child { border-bottom: none; }
    .res-icon { color: var(--text3); flex-shrink: 0; }
    .res-label { font-size: 12px; flex: 1; color: var(--text2); font-weight: 500; min-width: 50px; }
    .res-bar-wrap { width: 120px; }
    .res-bar { height: 4px; background: var(--surface2); border-radius: 2px; overflow: hidden; }
    .res-fill { height: 100%; background: var(--primary); border-radius: 2px; transition: width 0.5s ease; }
    .res-fill.warn { background: var(--orange); }
    .res-fill.danger { background: var(--red); }
    .res-val { font-size: 12px; font-weight: 600; color: var(--text); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 11px; }

    /* ── SERVICE HEALTH CARDS ──────────────────────────────────── */
    .health-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px; margin-bottom: 20px;
    }
    .health-card {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm);
    }
    .health-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
    .health-svc-icon {
      width: 32px; height: 32px; border-radius: var(--radius);
      display: flex; align-items: center; justify-content: center;
    }
    .health-svc-icon.ok { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
    .health-svc-icon.err { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
    .health-svc-name { font-size: 13px; font-weight: 600; }
    .health-svc-sub { font-size: 11px; color: var(--text2); margin-top: 1px; }

    /* ── TABLES ────────────────────────────────────────────────── */
    .table-card {
      background: var(--surface); border: 1px solid var(--border);
      backdrop-filter: var(--backdrop);
      -webkit-backdrop-filter: var(--backdrop);
      border-radius: var(--radius-lg);
      overflow: hidden; margin-bottom: 20px;
      box-shadow: var(--shadow-sm);
    }
    .table-toolbar {
      padding: 10px 16px; border-bottom: 1px solid var(--border);
      display: flex; align-items: center; justify-content: space-between; gap: 8px;
      background: var(--surface3);
    }
    .tbl-search {
      height: 30px; border: 1px solid var(--border); border-radius: var(--radius);
      padding: 0 10px; font-size: 12px;
      background: var(--surface); color: var(--text); outline: none;
      width: 220px; transition: all 0.12s; font-family: var(--font);
    }
    .tbl-search:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
    table { width: 100%; border-collapse: collapse; }
    th {
      text-align: left; padding: 8px 14px;
      font-size: 11px; font-weight: 600;
      border-bottom: 1px solid var(--border);
      background: var(--surface3); color: var(--text3); white-space: nowrap;
      text-transform: uppercase; letter-spacing: 0.04em;
    }
    td {
      padding: 9px 14px; font-size: 13px;
      border-bottom: 1px solid var(--border-light);
      color: var(--text); vertical-align: middle;
    }
    tr:last-child td { border-bottom: none; }
    tbody tr { transition: background 0.06s; }
    tbody tr:hover td { background: var(--surface2); }

    /* ── BADGES ────────────────────────────────────────────────── */
    .badge {
      font-size: 11px; font-weight: 500; padding: 2px 8px;
      border-radius: 100px; display: inline-flex; align-items: center; gap: 3px;
    }
    .badge.ok { background: var(--green-bg); color: var(--green-text); border: 1px solid var(--green-border); }
    .badge.err { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
    .badge.warn { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-border); }
    .badge.neutral { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }

    /* ── BUTTONS ───────────────────────────────────────────────── */
    .btn {
      display: inline-flex; align-items: center; gap: 6px;
      background: var(--primary); color: white;
      border: none; padding: 6px 14px;
      font-size: 12px; font-weight: 500; font-family: var(--font);
      border-radius: var(--radius); cursor: pointer; transition: all 0.12s;
      letter-spacing: 0.01em; box-shadow: var(--shadow-sm);
    }
    .btn:hover { background: var(--primary-hover); box-shadow: var(--shadow); }
    .btn-sm { padding: 4px 10px; font-size: 11px; }
    .btn-outline { background: var(--surface); color: var(--text2); border: 1px solid var(--border); box-shadow: none; }
    .btn-outline:hover { background: var(--surface2); border-color: var(--text3); color: var(--text); box-shadow: none; }
    .btn-outline.active { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-border); }
    .btn-ghost { background: transparent; color: var(--primary); border: none; box-shadow: none; }
    .btn-ghost:hover { background: var(--primary-bg); box-shadow: none; }
    .btn-danger { background: var(--red); }
    .btn-danger:hover { background: #b91c1c; }

    /* ── PAGES ─────────────────────────────────────────────────── */
    .page { display: none; }
    .page.active { display: block; }

    .page-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border-light);
    }
    .page-title { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
    .page-subtitle { font-size: 12px; color: var(--text2); margin-top: 2px; font-weight: 400; }
    .page-desc { font-size: 12px; color: var(--text3); margin-top: 2px; }
    .page-actions { display: flex; gap: 6px; align-items: center; }

    /* ── MODALS ────────────────────────────────────────────────── */
    .modal-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.5);
      z-index: 1000; align-items: center; justify-content: center;
      backdrop-filter: blur(2px);
    }
    .modal-overlay.open { display: flex; }
    .modal {
      background: var(--surface); border: 1px solid var(--border);
      backdrop-filter: var(--backdrop);
      -webkit-backdrop-filter: var(--backdrop);
      width: 480px; max-width: 95vw; border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg); animation: modalIn 0.15s ease-out;
    }
    @keyframes modalIn { from{opacity:0;transform:scale(0.97)} to{opacity:1;transform:scale(1)} }
    .modal-header {
      padding: 16px 16px 12px;
      display: flex; align-items: center; justify-content: space-between;
      border-bottom: 1px solid var(--border);
    }
    .modal-header h3 { font-size: 14px; font-weight: 600; }
    .modal-body { padding: 16px; }
    .modal-footer {
      padding: 12px 16px; border-top: 1px solid var(--border);
      display: flex; justify-content: flex-end; gap: 6px;
      background: var(--surface3);
    }
    .close-btn {
      width: 28px; height: 28px; border: none; background: transparent;
      cursor: pointer; border-radius: var(--radius);
      display: flex; align-items: center; justify-content: center;
      color: var(--text3); transition: all 0.12s;
    }
    .close-btn:hover { background: var(--surface2); color: var(--text2); }
    .form-group { margin-bottom: 14px; }
    .form-label { display: block; font-size: 11px; font-weight: 500; margin-bottom: 4px; color: var(--text2); }
    .form-input {
      width: 100%; height: 34px;
      border: 1px solid var(--border); border-radius: var(--radius);
      padding: 0 10px; font-size: 13px;
      background: var(--surface); color: var(--text);
      font-family: var(--font); outline: none; transition: all 0.12s;
    }
    .form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }

    /* ── TOASTS ────────────────────────────────────────────────── */
    .toast-stack { position: fixed; bottom: 16px; right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 6px; }
    .toast-item {
      background: var(--text); border: none;
      border-radius: var(--radius); box-shadow: var(--shadow-lg);
      padding: 10px 14px; display: flex; align-items: center; gap: 10px;
      min-width: 280px; max-width: 380px; font-size: 13px; color: var(--bg);
      animation: toastIn 0.2s ease-out;
    }
    [data-theme="dark"] .toast-item { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
    @keyframes toastIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
    .toast-ico {
      width: 20px; height: 20px; border-radius: var(--radius);
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    }
    .toast-ico.ok { background: rgba(22,163,74,0.2); color: #22c55e; }
    .toast-ico.err { background: rgba(220,38,38,0.2); color: #f87171; }
    .toast-msg { flex: 1; font-weight: 400; }

    /* ── LOG VIEWER ────────────────────────────────────────────── */
    .log-win {
      background: #0f1117; color: #d4d4d4;
      font-family: var(--font-mono);
      font-size: 12px; line-height: 1.6;
      padding: 14px; height: 380px; overflow: auto;
      border-radius: var(--radius);
      border: 1px solid var(--border);
    }
    .log-line { padding: 1px 0; white-space: pre-wrap; word-break: break-all; }
    .log-err { color: #f87171; }
    .log-warn { color: #fbbf24; }
    .log-ok { color: #4ade80; }
    .log-ts { color: #6e7681; }

    /* ── COMMAND PALETTE ───────────────────────────────────────── */
    .pal-overlay {
      display: none; position: fixed; inset: 0;
      background: rgba(0,0,0,0.5);
      z-index: 4000; align-items: flex-start; justify-content: center; padding-top: 80px;
      backdrop-filter: blur(2px);
    }
    .pal-overlay.open { display: flex; }
    .palette {
      background: var(--surface); border: 1px solid var(--border);
      border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
      width: 540px; max-width: 95vw; animation: modalIn 0.1s ease-out; overflow: hidden;
    }
    .pal-input-wrap { position: relative; }
    .pal-input {
      width: 100%; height: 42px; border: none;
      border-bottom: 1px solid var(--border);
      padding: 0 16px 0 40px;
      font-size: 13px; background: transparent; color: var(--text);
      font-family: var(--font); outline: none;
    }
    .pal-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text3); }
    .pal-list { padding: 4px; max-height: 360px; overflow-y: auto; }
    .pal-item {
      display: flex; align-items: center; gap: 10px;
      padding: 8px 10px; border-radius: var(--radius);
      cursor: pointer; transition: background 0.08s;
    }
    .pal-item:hover, .pal-item.sel { background: var(--surface2); }
    .pal-ico { width: 28px; height: 28px; border-radius: var(--radius); background: var(--surface2); display: flex; align-items: center; justify-content: center; color: var(--text2); flex-shrink: 0; }
    .pal-item.sel .pal-ico, .pal-item:hover .pal-ico { background: var(--primary-bg); color: var(--primary); }
    .pal-name { font-size: 13px; font-weight: 500; }
    .pal-desc { font-size: 11px; color: var(--text3); }
    .pal-item.sel .pal-desc, .pal-item:hover .pal-desc { color: var(--text2); }
    .pal-foot {
      padding: 8px 14px; border-top: 1px solid var(--border);
      font-size: 11px; color: var(--text3);
      display: flex; gap: 12px; background: var(--surface3);
    }
    .pal-foot kbd { background: var(--surface2); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; font-family: var(--font-mono); font-size: 10px; }

    /* ── UPLOAD ZONE ───────────────────────────────────────────── */
    .upload-zone {
      border: 1px dashed var(--border); border-radius: var(--radius-lg);
      padding: 40px 20px; text-align: center; cursor: pointer;
      transition: all 0.12s; background: var(--surface3); margin-bottom: 20px;
    }
    .upload-zone:hover { border-color: var(--primary); background: var(--primary-bg); }
    .upload-zone h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
    .upload-zone p { font-size: 12px; color: var(--text2); }

    /* ── EMPTY STATE ───────────────────────────────────────────── */
    .empty-state { text-align: center; padding: 40px 20px; color: var(--text2); }
    .empty-state svg { opacity: 0.25; margin-bottom: 12px; }
    .empty-state h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
    .empty-state p { font-size: 12px; }

    /* ── MONO ──────────────────────────────────────────────────── */
    .mono { font-family: var(--font-mono); font-size: 12px; }

    /* ── SCROLLBAR ─────────────────────────────────────────────── */
    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--text3); }

    /* ── RESPONSIVE ────────────────────────────────────────────── */
    @media (max-width: 1100px) {
      .stats-grid { grid-template-columns: repeat(2,1fr); }
      .charts-row { grid-template-columns: 1fr; }
      .health-grid { grid-template-columns: 1fr; }
    }
    @media (max-width: 700px) {
      .stats-grid { grid-template-columns: 1fr; }
      .topbar-brand { min-width: 0; }
      .brand-text, .brand-sub { display: none; }
    }

    /* ── RELAY MONITOR ─────────────────────────────────────────── */
    .relay-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
    @media (max-width: 1100px) { .relay-cards { grid-template-columns: repeat(2, 1fr); } }
    @media (max-width: 700px) { .relay-cards { grid-template-columns: 1fr; } }

    .relay-card {
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
      backdrop-filter: var(--backdrop);
      -webkit-backdrop-filter: var(--backdrop);
      padding: 14px 16px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
    }
    .relay-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
    .relay-card-name { font-size: 12px; font-weight: 600; text-transform: capitalize; }
    .circuit-badge {
      font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 100px;
    }
    .circuit-badge.closed { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
    .circuit-badge.open { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
    .circuit-badge.half_open { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-border); }

    .relay-health-bar { height: 4px; background: var(--surface2); border-radius: 2px; margin: 10px 0 8px; overflow: hidden; }
    .relay-health-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease, background 0.3s; }

    .relay-metric { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); margin-top: 4px; }
    .relay-metric-val { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

    /* Flow Diagram */
    .flow-container {
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
      padding: 16px; margin-bottom: 20px; overflow-x: auto; box-shadow: var(--shadow-sm);
    }
    .flow-container h3 { font-size: 13px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

    .flow-svg { width: 100%; min-width: 700px; height: 240px; }
    .flow-node-rect { rx: 6; ry: 6; stroke-width: 1; transition: fill 0.3s, stroke 0.3s; }
    .flow-node-text { font-size: 11px; font-weight: 500; fill: var(--text); font-family: var(--font); }
    .flow-node-sub { font-size: 9px; fill: var(--text2); font-family: var(--font); }
    .flow-path-line { stroke-width: 1.5; fill: none; stroke-dasharray: 6 3; }
    .flow-dot {
      r: 3; fill: var(--primary);
      animation: flowMove 2.5s linear infinite;
    }
    @keyframes flowMove { 0% { offset-distance: 0%; } 100% { offset-distance: 100%; } }
    @keyframes flowPulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

    /* Failover Feed */
    .failover-chain-pills { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; }
    .fc-pill {
      font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 100px;
      display: inline-flex; align-items: center; gap: 3px; white-space: nowrap;
    }
    .fc-pill.fail { background: var(--red-bg); color: var(--red); }
    .fc-pill.ok { background: var(--green-bg); color: var(--green); }
    .fc-arrow { color: var(--text3); font-size: 10px; }

    /* Relay bottom row */
    .relay-bottom { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; }
    @media (max-width: 1100px) { .relay-bottom { grid-template-columns: 1fr; } }

    /* ═══ CARDS GRID UTIL ═══════════════════════════════════════════════════ */
    .cards-grid { display: grid; }

    /* ═══ MOBILE RESPONSIVE ═══════════════════════════════════════════════════ */
    @media (max-width: 768px) {
      .sidebar {
        position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
        width: 240px; transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 300; box-shadow: none;
      }
      .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
      }
      .sidebar.collapsed {
        width: 240px; transform: translateX(-100%);
      }
      .sidebar.collapsed.mobile-open { transform: translateX(0); }
      .sidebar.collapsed .nav-label { opacity: 1; pointer-events: auto; }
      .sidebar.collapsed .nav-section-label { opacity: 1; }

      .sidebar-backdrop {
        display: none; position: fixed; inset: 0; top: var(--topbar-h);
        background: rgba(0,0,0,0.4); z-index: 250;
      }
      .sidebar-backdrop.visible { display: block; }

      .topbar { padding: 0 8px; }
      .topbar-brand { min-width: 0; }
      .brand-text, .brand-sub { display: none; }
      .search-wrap { display: none; }
      .search-kbd { display: none; }
      .live-badge { display: none; }

      .content { padding: 12px; }
      .crumb-bar { padding: 0 12px; height: 32px; }
      .crumb-sub, #bc-sub { display: none; }

      .page-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
      .page-title { font-size: 15px; }
      .page-actions { width: 100%; flex-wrap: wrap; }

      .stats-grid { grid-template-columns: 1fr !important; gap: 8px; }
      .stat-card { padding: 12px 14px; gap: 10px; }
      .stat-icon { width: 32px; height: 32px; }
      .stat-value { font-size: 20px; }

      .charts-row { grid-template-columns: 1fr !important; }

      .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
      .table-card table { min-width: 500px; }
      .tbl-search { width: 140px; }
      .tbl-search:focus { width: 180px; }

      .relay-cards { grid-template-columns: 1fr !important; }
      .relay-bottom { grid-template-columns: 1fr !important; }
      .health-grid { grid-template-columns: 1fr !important; }

      .anl-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; }
      .anl-charts-row { grid-template-columns: 1fr !important; }
      .anl-domain-grid { grid-template-columns: 1fr !important; }

      .modal { width: 95vw; max-width: 95vw; }
      .modal-body { padding: 12px 14px; }
      .modal-header { padding: 14px 14px 10px; }
      .modal-footer { padding: 10px 14px; }
      .modal-form-grid { grid-template-columns: 1fr !important; }

      .flow-svg { min-width: 500px; height: 180px; }
      .flow-container { padding: 12px; }

      .toast-stack { right: 8px; left: 8px; bottom: 12px; }
      .toast-item { min-width: 0; max-width: 100%; }

      .card-header { padding: 8px 12px; }
      .card-body { padding: 12px; }
      .card-title { font-size: 11px; }

      .log-win { height: 260px; padding: 10px; font-size: 11px; }

      .palette { width: 95vw; }
      .pal-overlay { padding-top: 50px; }
    }

    @media (max-width: 400px) {
      .anl-kpi-grid { grid-template-columns: 1fr !important; }
      .stat-value { font-size: 18px; }
      .content { padding: 8px; }
    }

    /* ─── PAGE LOADING SPINNER ─────────────────────────────────────────── */
    .page-loader {
      display: flex; align-items: center; justify-content: center;
      padding: 60px 0; gap: 10px; color: var(--text3); font-size: 13px;
    }
    .page-loader .spin {
      width: 18px; height: 18px; border: 2px solid var(--border);
      border-top-color: var(--primary); border-radius: 50%;
      animation: loader-spin 0.6s linear infinite;
    }
    @keyframes loader-spin { to { transform: rotate(360deg); } }
