/* TraceVault — Professional Light / Dark Theme */

/* ─── Dark (Night) — default ─── */
:root,
[data-theme="dark"] {
  --bg-base: #020617;
  --bg-elevated: #0a1628;
  --bg-surface: #0f1d32;
  --bg-card: #0c1830;
  --bg-input: #061018;
  --bg-hover: rgba(59, 130, 246, 0.12);

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-muted: rgba(59, 130, 246, 0.2);
  --accent: #38bdf8;
  --accent-muted: rgba(56, 189, 248, 0.16);
  --indigo: #60a5fa;
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;

  --text: #dbeafe;
  --text-heading: #ffffff;
  --text-muted: #7eb0e8;
  --text-faint: #4b6a8a;

  --border: rgba(59, 130, 246, 0.2);
  --border-subtle: rgba(59, 130, 246, 0.1);
  --shadow-sm: 0 1px 0 rgba(147,197,253,0.08) inset, 0 2px 8px rgba(0,0,0,0.45);
  --shadow-md: 0 1px 0 rgba(147,197,253,0.1) inset, 0 6px 0 rgba(15,23,42,0.5), 0 16px 40px rgba(0,0,0,0.55);
  --shadow-lg: 0 1px 0 rgba(147,197,253,0.12) inset, 0 10px 0 rgba(15,23,42,0.55), 0 28px 60px rgba(0,0,0,0.65);
  --shadow-3d:
    0 1px 0 rgba(147,197,253,0.12) inset,
    0 5px 0 rgba(15,23,42,0.55),
    0 14px 36px rgba(0,0,0,0.52),
    0 0 0 1px rgba(59,130,246,0.2);

  --login-bg:
    radial-gradient(ellipse 90% 70% at 15% 10%, rgba(37,99,235,0.22), transparent 55%),
    radial-gradient(ellipse 70% 55% at 85% 85%, rgba(59,130,246,0.16), transparent 50%),
    linear-gradient(165deg, #020617 0%, #0a1628 50%, #020617 100%);
  --login-orb-1: rgba(37, 99, 235, 0.28);
  --login-orb-2: rgba(59, 130, 246, 0.22);
  --login-orb-3: rgba(30, 64, 175, 0.18);
  --star-color: rgba(147, 197, 253, 0.65);

  --sidebar-bg: linear-gradient(180deg, #020617 0%, #0a1628 35%, #0f2744 100%);
  --topbar-bg: rgba(2, 6, 23, 0.88);
  --table-head: #0c1a33;
  --scrollbar: rgba(59, 130, 246, 0.38);

  color-scheme: dark;
}

/* ─── Light (Day) ─── */
[data-theme="light"] {
  --bg-base: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-surface: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: rgba(15, 23, 42, 0.04);

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-muted: rgba(37, 99, 235, 0.08);
  --accent: #0891b2;
  --accent-muted: rgba(8, 145, 178, 0.08);
  --indigo: #4f46e5;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  --text: #334155;
  --text-heading: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --border: #e2e8f0;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.1);

  --login-bg: linear-gradient(160deg, #f8fafc 0%, #eef2f7 50%, #f1f5f9 100%);
  --login-orb-1: rgba(37, 99, 235, 0.08);
  --login-orb-2: rgba(8, 145, 178, 0.07);
  --login-orb-3: rgba(79, 70, 229, 0.06);
  --star-color: rgba(100, 116, 139, 0.25);

  --sidebar-bg: #ffffff;
  --topbar-bg: rgba(255, 255, 255, 0.95);
  --table-head: #f1f5f9;
  --scrollbar: rgba(100, 116, 139, 0.35);

  color-scheme: light;
}

:root {
  --sidebar-w: 248px;
  --topbar-h: 64px;
  --radius: 10px;
  --radius-lg: 14px;
  --font: "Outfit", "Segoe UI", system-ui, sans-serif;
  --transition: 0.2s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

.hidden { display: none !important; }

/* ─── Theme toggle ─── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  transition: all var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-muted);
}
.login-theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
}
[data-theme="dark"] .ico-sun { display: block; }
[data-theme="dark"] .ico-moon { display: none; }
[data-theme="light"] .ico-sun { display: none; }
[data-theme="light"] .ico-moon { display: block; }

/* ═══ LOGIN ═══ */
.login-screen {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--login-bg);
  transition: background var(--transition);
}

.login-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.7;
  animation: orbFloat 12s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
  transition: background var(--transition);
}
.login-orb-1 { width: 380px; height: 380px; background: var(--login-orb-1); top: -8%; left: 8%; }
.login-orb-2 { width: 320px; height: 320px; background: var(--login-orb-2); bottom: 5%; right: 8%; animation-delay: -5s; }
.login-orb-3 { width: 220px; height: 220px; background: var(--login-orb-3); top: 45%; left: 42%; animation-delay: -8s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(15px, -20px); }
}

.login-layout {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  padding: 2rem 4rem;
  max-width: 1280px;
  margin: 0 auto;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(560px, 80vh);
  padding: 2rem 2.5rem;
}
.brand-content { position: relative; }

/* Login card */
.login-card-wrap {
  perspective: 1200px;
  width: 100%;
  max-width: 420px;
  justify-self: end;
}
.login-card-glow { display: none; }

.login-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.login-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-muted);
  border: 1px solid transparent;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.login-heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--text-heading);
}
.login-sub { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 1.5rem; }

.login-field { margin-bottom: 1rem; }
.login-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 0.8rem;
  opacity: 0.45;
  pointer-events: none;
  z-index: 1;
}

.login-field input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 0.92rem;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.login-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}
.login-field input::placeholder { color: var(--text-faint); }

.input-toggle {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  opacity: 0.45;
  padding: 0.25rem;
  z-index: 1;
}
.input-toggle:hover { opacity: 0.8; }

.btn-login {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.btn-login:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-vip-arrow { transition: transform 0.2s; }
.btn-login:hover .btn-vip-arrow { transform: translateX(3px); }

.login-err {
  color: var(--danger);
  font-size: 0.84rem;
  margin-top: 0.85rem;
  min-height: 1.2rem;
  text-align: center;
  background: rgba(239, 68, 68, 0.08);
  border-radius: 8px;
  padding: 0.35rem;
}
.login-err:empty { background: none; padding: 0; }

.login-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.secure-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.pulse { animation: pulseDot 1.5s infinite; }

/* ═══ APP SHELL ═══ */
#app {
  display: flex;
  min-height: 100vh;
  background: var(--bg-base);
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  transition: background var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  color: #fff;
}
.sidebar-brand strong { display: block; color: var(--text-heading); font-size: 0.92rem; }
.sidebar-brand small { color: var(--text-muted); font-size: 0.7rem; }

.sidebar-nav { flex: 1; padding: 0.65rem 0.55rem; overflow-y: auto; }
.sidebar-nav a, .logout-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem;
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 2px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 500;
  transition: all var(--transition);
  border: 1px solid transparent;
}
.nav-icon { font-size: 0.72rem; width: 1.1rem; text-align: center; opacity: 0.65; }
.sidebar-nav a:hover, .logout-link:hover {
  background: var(--bg-hover);
  color: var(--text-heading);
}
.sidebar-nav a.active {
  background: var(--primary-muted);
  color: var(--primary);
  border-color: transparent;
  box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar-nav a.active .nav-icon { opacity: 1; }

.sidebar-footer { padding: 0; border-top: none; }
.sidebar-footer .logout-link { margin: 0 0.55rem 0.65rem; }
.logout-link { color: var(--danger) !important; }
.logout-link:hover { background: rgba(239, 68, 68, 0.08) !important; }

.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-base);
}

.topbar {
  height: auto;
  min-height: var(--topbar-h);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  border-bottom: 1px solid var(--border);
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  min-height: var(--topbar-h);
}
.license-banner {
  width: 100%;
  padding: 0.45rem 1.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.license-banner.license-warn { background: rgba(234, 179, 8, 0.15); color: #ca8a04; }
.license-banner.license-danger { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.license-status-box {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.license-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem 1rem;
}
.license-status-grid span { display: block; font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.license-status-grid strong { font-size: 0.88rem; color: var(--text-heading); }
.license-status-wide { grid-column: 1 / -1; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.panel-head .panel-title { margin: 0; }
.brand-logo { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.brand-icon { font-size: 1.1rem; line-height: 1; }
.mono { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.75rem; word-break: break-all; }
#licenseJson { width: 100%; min-height: 8rem; font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.78rem; }
.topbar h1 { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--text-heading); }
.topbar-sub { margin: 0.1rem 0 0; font-size: 0.78rem; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
}
[data-theme="light"] .status-pill {
  background: rgba(22, 163, 74, 0.08);
  border-color: rgba(22, 163, 74, 0.2);
}
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
}
.user-name { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-heading); }
.user-role {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.main-content { flex: 1; padding: 1.25rem 1.5rem 2rem; overflow: auto; }

/* Dashboard */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.25rem;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--primary));
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon { font-size: 1.3rem; margin-bottom: 0.35rem; color: var(--card-accent, var(--primary)); }
.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-heading);
  margin-top: 0.2rem;
}
.stat-card.blue { --card-accent: var(--primary); }
.stat-card.teal { --card-accent: var(--accent); }
.stat-card.green { --card-accent: var(--success); }
.stat-card.indigo { --card-accent: var(--indigo); }

.dash-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.dash-hero h2 { margin: 0 0 0.4rem; font-size: 1.3rem; font-weight: 700; color: var(--text-heading); }
.dash-hero p { margin: 0; font-size: 0.88rem; color: var(--text-muted); line-height: 1.55; }
.dash-hero-badges { display: flex; flex-direction: column; gap: 0.35rem; flex-shrink: 0; }
.hero-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin: 0.85rem 0;
}

.dash-subtitle {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.stat-card .stat-sub {
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.dash-gauge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.dash-gauge-grid-disks {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.dash-gauge {
  padding: 0.65rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.dash-gauge-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.dash-gauge-head strong {
  font-size: 0.95rem;
  color: var(--text-heading);
}

.dash-gauge-track {
  height: 8px;
  background: var(--bg-muted, rgba(255, 255, 255, 0.06));
  border-radius: 999px;
  overflow: hidden;
}

.dash-gauge-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

.dash-gauge-sub {
  margin-top: 0.35rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.35;
  word-break: break-word;
}

.dash-gauge-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dash-gauge-meta strong {
  font-size: 1.25rem;
  color: var(--text-heading);
}

.dash-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 200px;
}

.dash-bar-row {
  display: grid;
  grid-template-columns: minmax(72px, 110px) 1fr minmax(64px, 80px);
  gap: 0.5rem;
  align-items: center;
  font-size: 0.75rem;
}

.dash-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-heading);
  font-weight: 500;
}

.dash-bar-track {
  height: 10px;
  background: var(--bg-muted, rgba(255, 255, 255, 0.06));
  border-radius: 999px;
  overflow: hidden;
}

.dash-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  min-width: 2px;
}

.dash-bar-val {
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.dash-storage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.dash-storage-card {
  padding: 0.85rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.dash-storage-card.accent {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.dash-storage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dash-storage-head strong {
  font-size: 1rem;
  color: var(--text-heading);
}

.dash-storage-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dash-storage-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.28rem 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
}

.dash-storage-list li:first-child {
  border-top: none;
}

.dash-storage-list em {
  font-style: normal;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.flow-diagram-compact .flow-step {
  padding: 0.45rem 0.6rem;
}

.flow-diagram-compact .flow-line {
  height: 6px;
}

.flow-diagram { display: flex; flex-direction: column; }
.flow-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}
.flow-step.highlight { border-color: var(--primary); background: var(--primary-muted); }
.flow-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.flow-step.highlight .flow-num { background: var(--primary); }
.flow-step strong { display: block; font-size: 0.82rem; color: var(--text-heading); }
.flow-step small { font-size: 0.7rem; color: var(--text-muted); }
.flow-line {
  width: 2px; height: 10px;
  background: var(--border);
  margin-left: 1.2rem;
}

.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.qa-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  color: var(--text);
  text-align: left;
  transition: all var(--transition);
}
.qa-card span:first-child { font-size: 1.1rem; color: var(--primary); }
.qa-card strong { font-size: 0.82rem; color: var(--text-heading); }
.qa-card small { font-size: 0.7rem; color: var(--text-muted); }
.qa-card:hover { border-color: var(--primary); background: var(--primary-muted); }

.status-list { display: flex; flex-direction: column; gap: 0.4rem; }
.status-row {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.75rem;
  background: var(--bg-surface);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}
.status-row .sr-name { font-weight: 600; font-size: 0.82rem; color: var(--text-heading); }
.status-row .sr-meta { font-size: 0.7rem; color: var(--text-muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; margin-right: 0.45rem; flex-shrink: 0; }
.status-dot.ok { background: var(--success); }
.status-dot.warn { background: var(--warning); }
.status-dot.off { background: var(--text-faint); }
.status-row-left { display: flex; align-items: center; }

.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.65rem;
}
.cap-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--bg-surface);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--transition);
}
.cap-item:hover { border-color: var(--border); }
.cap-item > span { font-size: 1.15rem; color: var(--primary); flex-shrink: 0; }
.cap-item strong { display: block; font-size: 0.85rem; margin-bottom: 0.2rem; color: var(--text-heading); }
.cap-item p { margin: 0; font-size: 0.76rem; color: var(--text-muted); line-height: 1.45; }

.info-banner {
  display: flex;
  gap: 0.85rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.85rem;
  background: var(--primary-muted);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-lg);
}
.info-banner.cyan { border-left-color: var(--accent); background: var(--accent-muted); }
.info-banner.green { border-left-color: var(--success); background: rgba(34, 197, 94, 0.08); }
.info-banner.purple { border-left-color: var(--indigo); background: rgba(99, 102, 241, 0.08); }
.info-banner.accent { border-left-color: var(--accent); background: var(--accent-muted); }
.info-banner-icon {
  font-size: 1.25rem;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated);
  border-radius: 10px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.info-banner strong { display: block; font-size: 0.9rem; margin-bottom: 0.25rem; color: var(--text-heading); }
.info-banner p { margin: 0; font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.info-banner em { color: var(--primary); font-style: normal; font-size: 0.76rem; }

.panel-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; gap: 0.75rem; flex-wrap: wrap; }
.panel-head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.panel-title { margin: 0 0 0.85rem; font-size: 1rem; font-weight: 700; color: var(--text-heading); }
.panel-head .panel-title { margin-bottom: 0; }

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.65rem;
  align-items: end;
}
.filter-row-wide {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem 1rem;
}
.filter-group.filter-datetime {
  grid-column: span 2;
  min-width: 300px;
}
.datetime-inputs {
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
}
.datetime-inputs input[type="date"] {
  flex: 1.35;
  min-width: 150px;
  font-size: 0.9rem;
  padding: 0.6rem 0.75rem;
}
.datetime-inputs input[type="time"] {
  flex: 1;
  min-width: 130px;
  font-size: 0.9rem;
  padding: 0.6rem 0.75rem;
}
.radius-sync-panel { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--border); }
.sync-log-view {
  margin: 0.65rem 0 0;
  padding: 0.75rem 0.85rem;
  max-height: 220px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.search-progress {
  height: 4px;
  margin: 0.85rem 0 0.5rem;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.search-progress-bar {
  height: 100%;
  width: 35%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #22d3ee);
  animation: search-progress-slide 1.1s ease-in-out infinite;
}
@keyframes search-progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.filter-group label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}
.filter-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: flex-end; max-width: 100%; }
.filter-group.filter-wide { grid-column: 1 / -1; }
.sub-pager { margin-top: 0.75rem; align-items: center; grid-template-columns: auto 1fr auto; }

input, select, textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.86rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-muted);
}

.btn-primary, .btn-secondary {
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: none;
  font-family: var(--font);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-faint); }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }
.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #b91c1c; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }

.table-meta { font-size: 0.8rem; color: var(--text-muted); margin: 0.65rem 0; }
.rep-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-right: 0.5rem; }
.rep-presets-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.rep-empty-row td {
  text-align: center;
  padding: 1.25rem 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
.rep-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.5rem 0 0.65rem;
}
.rep-page-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 10rem;
}
.rep-page-jump,
.rep-page-size {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.rep-page-jump input {
  width: 4.5rem;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
}
.rep-page-size select {
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
}

/* ─── Log Search — professional 3D layout ─── */
.rep-page { display: flex; flex-direction: column; gap: 1rem; }
.rep-hero {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--border);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15), 0 12px 32px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.06);
}
.rep-hero h2 { margin: 0 0 0.35rem; font-size: 1.35rem; color: var(--text-heading); }
.rep-hero p { margin: 0; font-size: 0.85rem; color: var(--text-muted); max-width: 42rem; }
.rep-hero-stats { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.rep-stat-pill {
  display: flex; flex-direction: column; gap: 0.15rem;
  padding: 0.55rem 1rem; min-width: 6.5rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 3px 0 rgba(0,0,0,0.12), 0 6px 16px rgba(0,0,0,0.18);
}
.rep-stat-pill.accent {
  border-color: rgba(6, 182, 212, 0.45);
  background: linear-gradient(180deg, rgba(6,182,212,0.12) 0%, var(--bg-elevated) 100%);
}
.rep-stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }
.rep-stat-pill strong { font-size: 1.05rem; color: var(--text-heading); }
.rep-filter-card { box-shadow: var(--shadow-md); }
.rep-filter-card .panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.rep-filter-card .panel-title { margin: 0; }
.rep-nat-filter label { color: var(--accent); }
.rep-results-card {
  padding: 0;
  overflow: hidden;
  box-shadow: 0 6px 0 rgba(0,0,0,0.12), 0 20px 48px rgba(0,0,0,0.35);
  border: 1px solid var(--border);
}
.rep-results-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}
.rep-info { margin: 0; }
.rep-results-bar .rep-pagination { margin: 0; }
.rep-pppoe-toggle-wrap { display: flex; flex-direction: column; justify-content: flex-end; gap: 0.2rem; min-width: 10rem; }
.rep-pppoe-toggle {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  cursor: pointer; user-select: none;
}
.rep-pppoe-toggle input { width: 1rem; height: 1rem; accent-color: var(--accent); cursor: pointer; }
.filter-hint { font-size: 0.68rem; color: var(--text-muted); line-height: 1.2; }
.rep-col-legend {
  display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.65rem;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint);
}
.legend-item { display: flex; align-items: center; gap: 0.35rem; }
.legend-item.lg-nat { color: var(--accent); font-weight: 600; }
.legend-item i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; background: var(--text-faint); }
.lg-nat i { background: var(--accent); box-shadow: 0 0 8px rgba(6,182,212,0.5); }
.lg-time i { background: #6366f1; }
.lg-user i { background: #22c55e; }
.lg-src i { background: #3b82f6; }
.lg-dst i { background: #f59e0b; }
.lg-meta i { background: #64748b; }
.rep-table-wrap {
  max-height: 62vh;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.25), 0 4px 12px rgba(0,0,0,0.15);
  background: var(--bg-base);
}
.rep-table-3d { font-size: 0.79rem; }
.rep-table-3d thead th {
  top: 0; z-index: 2;
  padding: 0.7rem 0.65rem;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--table-head) 100%);
  box-shadow: 0 2px 0 var(--border), 0 4px 12px rgba(0,0,0,0.2);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.rep-table-3d thead th.grp-nat {
  background: linear-gradient(180deg, rgba(6,182,212,0.2) 0%, var(--table-head) 100%);
  color: var(--accent);
  border-bottom-color: rgba(6,182,212,0.4);
}
.rep-table-3d tbody tr.rep-row {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  border-bottom: 1px solid var(--border-subtle);
}
.rep-table-3d tbody tr.rep-row:nth-child(even) { background: rgba(255,255,255,0.02); }
.rep-table-3d tbody tr.rep-row:hover {
  background: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  position: relative; z-index: 1;
}
.rep-table-3d td { padding: 0.55rem 0.65rem; vertical-align: middle; }
.rep-table-3d td.col-nat {
  background: rgba(6, 182, 212, 0.04);
  border-left: 1px solid rgba(6, 182, 212, 0.08);
  border-right: 1px solid rgba(6, 182, 212, 0.08);
}
.rep-table-3d .cell-ip {
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: 0.76rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
}
.rep-table-3d .cell-nat-badge {
  display: inline-block;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.76rem; font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  color: #0e7490;
  background: linear-gradient(180deg, rgba(6,182,212,0.25) 0%, rgba(6,182,212,0.12) 100%);
  border: 1px solid rgba(6,182,212,0.35);
  box-shadow: 0 2px 0 rgba(6,182,212,0.2), 0 4px 8px rgba(0,0,0,0.15);
}
[data-theme="dark"] .rep-table-3d .cell-nat-badge { color: #67e8f9; }
.rep-table-3d .cell-nat-port {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 600; color: var(--accent);
}
.rep-table-3d .cell-empty { color: var(--text-faint); opacity: 0.5; }
.rep-table-3d td.col-time { white-space: nowrap; font-size: 0.74rem; color: var(--text-muted); }
.rep-table-3d td.col-app { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-table-3d td.col-bytes { font-variant-numeric: tabular-nums; text-align: right; font-size: 0.74rem; }

.table-wrap, .table-container {
  overflow: auto;
  max-height: 65vh;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.data-table, .table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
}
.data-table th, .table-container th {
  position: sticky;
  top: 0;
  background: var(--table-head);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table td, .table-container td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}
.data-table tbody tr:hover, .table-container tbody tr:hover {
  background: var(--bg-hover);
}

.doc-list details {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.45rem;
}
.doc-list summary {
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-heading);
  list-style: none;
}
.doc-list summary::-webkit-details-marker { display: none; }
.doc-list pre {
  margin: 0;
  padding: 0.9rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  border-top: 1px solid var(--border);
  background: var(--bg-input);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

.health-pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.health-pill.ok { color: var(--success); border-color: rgba(34, 197, 94, 0.35); background: rgba(34, 197, 94, 0.08); }
.health-pill.warn { color: #d97706; border-color: rgba(217, 119, 6, 0.35); background: rgba(217, 119, 6, 0.08); }
.health-pill.off { color: var(--text-muted); opacity: 0.75; }

.tv-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.tv-modal.hidden { display: none; }
.tv-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); }
.tv-modal-panel {
  position: relative;
  width: min(720px, 100%);
  max-height: min(85vh, 900px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.tv-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.tv-modal-head h3 { margin: 0; font-size: 1rem; color: var(--text-heading); }
.tv-modal-body { padding: 1rem 1.1rem 1.1rem; color: var(--text); }
.tv-modal-body .table-meta { color: var(--text-muted); }
.live-error {
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.45;
}
[data-theme="light"] .live-error {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.06);
}
.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
}
.live-stat {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.live-stat small { display: block; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.2rem; }
.live-stat strong { font-size: 0.95rem; color: var(--text-heading); word-break: break-word; }
.live-section { margin-top: 0.85rem; }
.live-section h4 { margin: 0 0 0.5rem; font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ─── Live Monitor page ─── */
.live-page { animation: fadeIn 0.35s ease; }
.live-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.1rem 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(56,189,248,0.08), rgba(16,185,129,0.06));
}
.live-hero-left h2 { margin: 0 0 0.2rem; font-size: 1.25rem; color: var(--text-heading); }
.live-hero-left p { margin: 0; font-size: 0.82rem; color: var(--text-muted); }
.live-pulse-wrap { display: flex; align-items: center; gap: 0.85rem; }
.live-pulse-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-faint);
  box-shadow: 0 0 0 0 rgba(52,211,153,0);
}
.live-pulse-dot.on {
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52,211,153,0.55);
  animation: livePulse 1.6s ease infinite;
}
.live-pulse-dot.off { background: #64748b; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,0.55); }
  70% { box-shadow: 0 0 0 10px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}
.live-hero-stats { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.live-stat-pill {
  min-width: 6.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  text-align: center;
}
.live-stat-pill span {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.live-stat-pill strong { font-size: 1.05rem; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.live-stat-pill.accent { border-color: rgba(34,211,238,0.35); background: rgba(34,211,238,0.08); }
.live-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}
.live-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.live-side { display: flex; flex-direction: column; gap: 1rem; }
.live-flow-panel { padding: 0; overflow: hidden; }
.live-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.85rem 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.live-panel-head-left { display: flex; align-items: center; gap: 0.55rem; }
.live-panel-head .panel-title { margin: 0; }
.live-panel-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.live-source-badge {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.live-source-badge.live {
  border-color: rgba(52,211,153,0.4);
  background: rgba(52,211,153,0.12);
  color: #34d399;
}
.live-source-badge.db {
  border-color: rgba(56,189,248,0.35);
  background: rgba(56,189,248,0.1);
  color: #38bdf8;
}
.live-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.live-toggle input { accent-color: var(--accent); }
.live-updated { font-size: 0.72rem; color: var(--text-muted); }
.live-table-wrap {
  max-height: 28rem;
  overflow: auto;
  padding: 0.5rem 0.75rem 0.75rem;
}
.live-flow-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.live-flow-table thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 0.45rem 0.5rem;
  text-align: left;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.live-flow-table td { padding: 0.45rem 0.5rem; vertical-align: middle; border-bottom: 1px solid rgba(255,255,255,0.04); }
.live-flow-row { transition: background 0.25s ease; }
.live-flow-row:hover { background: rgba(56,189,248,0.06); }
.live-flow-row.live-row-new {
  animation: liveRowFlash 1.2s ease;
  background: rgba(52,211,153,0.12);
}
@keyframes liveRowFlash {
  0% { background: rgba(52,211,153,0.35); }
  100% { background: rgba(52,211,153,0.04); }
}
.live-flow-table .col-arrow { color: var(--text-faint); text-align: center; width: 1.5rem; }
.live-flow-table .col-time { white-space: nowrap; font-size: 0.72rem; color: var(--text-muted); }
.live-flow-table .col-bytes { text-align: right; font-variant-numeric: tabular-nums; }
.live-flow-table .col-app { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-flow-table .col-bras { max-width: 6.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; }
.live-flow-table .col-dir { font-size: 0.68rem; color: var(--text-muted); text-align: center; }
.live-dir { font-weight: 600; color: var(--accent); }
.live-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.live-chip-list { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.live-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.74rem;
}
.live-chip strong { color: var(--text-heading); font-weight: 600; }
.live-chip em { font-style: normal; color: var(--accent); font-variant-numeric: tabular-nums; }
.live-activity-feed { display: flex; flex-direction: column; gap: 0.55rem; max-height: 18rem; overflow: auto; }
.live-activity-item {
  display: flex;
  gap: 0.55rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.live-activity-icon {
  width: 1.6rem; height: 1.6rem; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; flex-shrink: 0;
  background: rgba(148,163,184,0.15);
}
.live-activity-icon.ok { background: rgba(52,211,153,0.18); color: #34d399; }
.live-activity-icon.warn { background: rgba(251,191,36,0.18); color: #fbbf24; }
.live-activity-icon.off { background: rgba(239,68,68,0.15); color: #f87171; }
.live-activity-title { font-size: 0.78rem; font-weight: 600; color: var(--text-heading); }
.live-activity-msg { font-size: 0.72rem; color: var(--text); margin-top: 0.1rem; line-height: 1.35; }
.live-activity-meta { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.2rem; }
.live-router-list { display: flex; flex-direction: column; gap: 0.45rem; max-height: 12rem; overflow: auto; }
.live-router-row {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  background: var(--bg-elevated);
}

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; padding: 1.25rem; justify-items: center; }
  .login-brand { padding: 1rem; min-height: auto; }
  .login-devix-strip { margin-top: 1rem; }
  .login-devix-tagline { display: none; }
  .login-hero-features { flex-wrap: wrap; }
  .login-card-wrap { max-width: 100%; justify-self: center; }
  .dash-grid-2 { grid-template-columns: 1fr; }
  .live-layout { grid-template-columns: 1fr; }
  .live-bottom-grid { grid-template-columns: 1fr; }
  .dash-hero { flex-direction: column; }
  .dash-hero-badges { flex-direction: row; flex-wrap: wrap; }
  .quick-actions, .cap-grid { grid-template-columns: 1fr; }
  .sidebar { width: 60px; }
  .sidebar-brand div, .sidebar-nav a span:not(.nav-icon), .sidebar-brand small { display: none; }
  .co-brand-powered--footer .co-brand-powered-text { display: none; }
  .co-brand-powered--footer { justify-content: center; padding: 0.55rem 0.35rem; }
  .sidebar-nav a, .logout-link { justify-content: center; padding: 0.65rem; }
  .topbar-sub, .status-pill { display: none; }
}
