/* ═══════════════════════════════════════════════
   FaroPanel — Theme System
   Themes: dark | oled | neon | cyber
═══════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root,
[data-theme="dark"] {
  --bg-base:       #080b14;
  --bg-surface:    #0d1117;
  --bg-card:       #111827;
  --bg-card-hover: #161f2e;
  --border:        rgba(255,255,255,0.06);
  --border-hover:  rgba(99,102,241,0.4);
  --accent:        #6366f1;
  --accent2:       #06b6d4;
  --indigo:        #6366f1;
  --cyan:          #06b6d4;
  --emerald:       #10b981;
  --amber:         #f59e0b;
  --rose:          #f43f5e;
  --violet:        #8b5cf6;
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --font: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

[data-theme="oled"] {
  --bg-base:       #000000;
  --bg-surface:    #030303;
  --bg-card:       #0a0a0a;
  --bg-card-hover: #111111;
  --border:        rgba(255,255,255,0.05);
  --border-hover:  rgba(99,102,241,0.5);
  --accent:        #6366f1;
  --accent2:       #06b6d4;
  --indigo:        #6366f1;
  --cyan:          #06b6d4;
  --emerald:       #10b981;
  --amber:         #f59e0b;
  --rose:          #f43f5e;
  --violet:        #8b5cf6;
  --text-primary:   #ffffff;
  --text-secondary: #888888;
  --text-muted:     #444444;
}

[data-theme="neon"] {
  --bg-base:       #0d0015;
  --bg-surface:    #130020;
  --bg-card:       #1a0030;
  --bg-card-hover: #220040;
  --border:        rgba(255,0,200,0.15);
  --border-hover:  rgba(255,0,200,0.5);
  --accent:        #ff00c8;
  --accent2:       #b400ff;
  --indigo:        #ff00c8;
  --cyan:          #00ffe7;
  --emerald:       #00ff99;
  --amber:         #ffcc00;
  --rose:          #ff2d6b;
  --violet:        #cf6bff;
  --text-primary:   #ffe0ff;
  --text-secondary: #cc88cc;
  --text-muted:     #884488;
}

[data-theme="cyber"] {
  --bg-base:       #0a0a00;
  --bg-surface:    #0f0f00;
  --bg-card:       #161600;
  --bg-card-hover: #1e1e00;
  --border:        rgba(255,220,0,0.12);
  --border-hover:  rgba(255,220,0,0.4);
  --accent:        #ffd700;
  --accent2:       #ff6b00;
  --indigo:        #ffd700;
  --cyan:          #00e5ff;
  --emerald:       #39ff14;
  --amber:         #ff6b00;
  --rose:          #ff2d6b;
  --violet:        #bf00ff;
  --text-primary:   #fff8d6;
  --text-secondary: #a89850;
  --text-muted:     #5a5020;
}

[data-theme="arctic"] {
  --bg-base:       #0a0f1e;
  --bg-surface:    #0d1428;
  --bg-card:       #111d35;
  --bg-card-hover: #172545;
  --border:        rgba(120,200,255,0.12);
  --border-hover:  rgba(120,200,255,0.4);
  --accent:        #78c8ff;
  --accent2:       #a8d8ff;
  --indigo:        #78c8ff;
  --cyan:          #a8e6ff;
  --emerald:       #7fffbf;
  --amber:         #ffd080;
  --rose:          #ff6b8a;
  --violet:        #b8a0ff;
  --text-primary:   #e8f4ff;
  --text-secondary: #8ab4d4;
  --text-muted:     #4a7090;
}

[data-theme="matrix"] {
  --bg-base:       #000800;
  --bg-surface:    #000e00;
  --bg-card:       #001400;
  --bg-card-hover: #001e00;
  --border:        rgba(0,255,65,0.12);
  --border-hover:  rgba(0,255,65,0.4);
  --accent:        #00ff41;
  --accent2:       #00cc33;
  --indigo:        #00ff41;
  --cyan:          #00ffcc;
  --emerald:       #00ff41;
  --amber:         #aaff00;
  --rose:          #ff4141;
  --violet:        #41ff00;
  --text-primary:   #ccffcc;
  --text-secondary: #007722;
  --text-muted:     #004411;
}

[data-theme="sunset"] {
  --bg-base:       #120008;
  --bg-surface:    #1e0010;
  --bg-card:       #2a001c;
  --bg-card-hover: #360028;
  --border:        rgba(255,100,60,0.15);
  --border-hover:  rgba(255,140,80,0.5);
  --accent:        #ff6440;
  --accent2:       #ff9060;
  --indigo:        #ff6440;
  --cyan:          #ffcc60;
  --emerald:       #ff9f40;
  --amber:         #ffcc00;
  --rose:          #ff3060;
  --violet:        #df60ff;
  --text-primary:   #ffeedd;
  --text-secondary: #cc7755;
  --text-muted:     #773322;
}

[data-theme="ocean"] {
  --bg-base:       #010e18;
  --bg-surface:    #011520;
  --bg-card:       #021e2e;
  --bg-card-hover: #042840;
  --border:        rgba(0,180,200,0.12);
  --border-hover:  rgba(0,200,220,0.4);
  --accent:        #00b4c8;
  --accent2:       #00e8f0;
  --indigo:        #00b4c8;
  --cyan:          #00e8f0;
  --emerald:       #00d4a0;
  --amber:         #f0b040;
  --rose:          #ff4060;
  --violet:        #8060ff;
  --text-primary:   #d0f0ff;
  --text-secondary: #5090aa;
  --text-muted:     #284858;
}

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

html { font-size: 14px; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

#dashboard-page {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 68px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
  overflow-x: hidden;
  overflow-y: hidden;
}

.sidebar:hover {
  width: 240px;
  overflow-y: auto;
}

.sidebar-header {
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 17px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-logo {
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  margin-left: 12px;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0;
  transition: opacity 0.2s;
}

.sidebar:hover .sidebar-logo-text {
  opacity: 1;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Hide scrollbar for sidebar nav */
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 12px 16px;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item span {
  margin-left: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s;
}

.sidebar:hover .nav-item span {
  opacity: 1;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(99,102,241,0.1);
  color: var(--indigo);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.view-container {
  flex: 1;
  padding: 0;
  overflow-y: auto;
}

.page { min-height: 100vh; }
.hidden { display: none !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ═══════════════════ LOGIN ═══════════════════ */
#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.12) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(6,182,212,0.1) 0%, transparent 50%),
              var(--bg-base);
}

.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: float 8s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: var(--indigo); top: -100px; left: -100px; }
.orb-2 { width: 300px; height: 300px; background: var(--cyan); bottom: -50px; right: 10%; animation-delay: -3s; }
.orb-3 { width: 200px; height: 200px; background: var(--violet); top: 40%; right: 20%; animation-delay: -6s; }

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -20px) scale(1.05); }
  66% { transform: translate(-15px, 10px) scale(0.98); }
}

.login-card {
  position: relative;
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(20px);
  box-shadow: 0 25px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.1);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.login-brand {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 0.9rem; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }

.input-wrapper { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.input-wrapper input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 12px 14px 12px 42px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input-wrapper input:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.input-wrapper input::placeholder { color: var(--text-muted); }

.login-error {
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.3);
  border-radius: var(--radius-sm);
  color: #fb7185;
  font-size: 0.85rem;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.btn-login {
  width: 100%;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 13px;
  position: relative;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  margin-top: 6px;
}
.btn-login:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(99,102,241,0.4); }
.btn-login:active { transform: translateY(0); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ── Audit Table ────────────────────────────────────── */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.audit-table th {
  text-align: left;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.audit-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.audit-table tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

.audit-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-neutral { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }

/* ── Toasts ─────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.btn-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════ HEADER ═══════════════════ */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,11,20,0.85);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
}

.header-left { display: flex; align-items: center; gap: 20px; }
.header-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.05rem; font-weight: 700;
  background: linear-gradient(135deg, var(--indigo), var(--cyan));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.header-info-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.header-chip {
  display: flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 0.82rem; font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
}
.os-chip { color: var(--text-secondary); font-family: var(--mono); font-size: 0.75rem; }
.temp-chip { color: var(--amber); font-size: 0.78rem; }

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}
.status-dot.connected { background: var(--emerald); box-shadow: 0 0 8px var(--emerald); animation: pulse-dot 2s infinite; }
.status-dot.disconnected { background: var(--rose); }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.5} }

.header-right { display: flex; align-items: center; gap: 16px; }

.header-stat {
  display: flex; flex-direction: column; align-items: flex-end; gap: 2px;
}
.header-stat-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.header-stat-value { font-family: var(--mono); font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.header-stat-value.emerald { color: var(--emerald); }

.btn-logout {
  background: rgba(244,63,94,0.1);
  border: 1px solid rgba(244,63,94,0.2);
  border-radius: var(--radius-sm);
  color: #fb7185;
  cursor: pointer;
  padding: 7px 10px;
  transition: background 0.2s, transform 0.15s;
  display: flex; align-items: center;
}
.btn-logout:hover { background: rgba(244,63,94,0.2); transform: translateY(-1px); }

/* ═══════════════════ MAIN LAYOUT ═══════════════════ */
.main-content {
  padding: 24px;
  display: flex; flex-direction: column; gap: 20px;
  width: 100%;
}

.grid-row { 
  display: grid; 
  gap: 20px; 
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); 
}
.row-2 { grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); }
.row-1 { grid-template-columns: 1fr; }

.section-divider {
  display: flex; align-items: center; gap: 16px; margin: 16px 0 8px;
}
.section-divider span {
  font-size: 0.85rem; font-weight: 600; text-transform: uppercase;
  color: var(--text-secondary); letter-spacing: 0.1em;
}
.section-divider hr {
  flex: 1; border: none; height: 1px; background: linear-gradient(90deg, var(--border), transparent);
}

/* ═══════════════════ CARDS ═══════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
}

.mem-row { 
  display: flex; 
  justify-content: space-between; 
  font-size: 0.82rem; 
  gap: 10px;
  margin-bottom: 4px;
}

/* ── Pulse Alert ───────────────────────────────────── */
@keyframes alertPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 15px 5px rgba(239, 68, 68, 0.2); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
}

.pulse-alert {
  animation: alertPulse 1.5s infinite !important;
  border-color: var(--rose) !important;
}

/* ── Hardware Card ─────────────────────────────────── */
.card-hardware .hw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.card-hardware .hw-item {
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ── Webhook Status Row ─────────────────────────────── */
.wh-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.03);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}


.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.4), transparent);
  opacity: 0; transition: opacity 0.3s;
}

.card:hover::before { opacity: 1; }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em;
}
.card-title svg { opacity: 0.7; }

.card-badge {
  font-size: 0.75rem; font-weight: 600; font-family: var(--mono);
  padding: 3px 10px; border-radius: 99px;
}
.badge-cpu { background: rgba(99,102,241,0.15); color: var(--indigo); border: 1px solid rgba(99,102,241,0.3); }
.badge-mem { background: rgba(139,92,246,0.15); color: var(--violet); border: 1px solid rgba(139,92,246,0.3); }
.badge-proc { background: rgba(6,182,212,0.12); color: var(--cyan); border: 1px solid rgba(6,182,212,0.25); }

/* ── Gauge ── */
.gauge-container {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  margin: 8px auto 16px;
  width: 100%;
  width: 160px; height: 160px;
}
.gauge-value {
  position: absolute;
  display: flex; align-items: baseline; gap: 2px;
}
.gauge-value span:first-child { font-size: 2rem; font-weight: 700; font-family: var(--mono); }
.gauge-unit { font-size: 0.85rem; color: var(--text-secondary); }

/* ── Mini chart ── */
.mini-chart { width: 100%; display: block; }
.mini-chart-label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Cores ── */
.cores-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 6px; margin-top: 14px;
}
.core-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.core-bar-wrap {
  width: 100%; height: 36px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px; overflow: hidden;
  display: flex; align-items: flex-end;
}
.core-bar {
  width: 100%; background: linear-gradient(180deg, var(--indigo), var(--cyan));
  border-radius: 4px; transition: height 0.4s ease;
}
.core-label { font-size: 0.6rem; color: var(--text-muted); font-family: var(--mono); }

/* ── Memory details ── */
.mem-details { display: flex; flex-direction: column; gap: 8px; }
.mem-row { display: flex; justify-content: space-between; font-size: 0.82rem; }
.mem-row span:first-child { color: var(--text-secondary); }
.mem-row span:last-child { font-family: var(--mono); font-weight: 500; }
.mem-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Network ── */
.net-iface {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.net-iface-name {
  font-size: 0.75rem; font-weight: 600; font-family: var(--mono);
  color: var(--cyan); margin-bottom: 8px;
}
.net-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.net-stat { display: flex; flex-direction: column; gap: 2px; }
.net-stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }
.net-stat-value { font-family: var(--mono); font-size: 0.85rem; font-weight: 600; }
.net-down { color: var(--emerald); }
.net-up { color: var(--amber); }
.net-ip { font-size: 0.7rem; color: var(--text-muted); font-family: var(--mono); margin-top: 4px; }
.net-legend { display: flex; gap: 12px; margin-top: 8px; font-size: 0.72rem; color: var(--text-secondary); align-items: center; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ── Disks ── */
.disk-list { display: flex; flex-direction: column; gap: 14px; }
.disk-item {}
.disk-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.disk-mount { font-family: var(--mono); font-size: 0.82rem; font-weight: 500; }
.disk-mount--card { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.disk-usage { font-size: 0.72rem; color: var(--text-secondary); font-family: var(--mono); font-weight: 600; }
.disk-usage.warn { color: var(--amber); }

.card-disk {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}
.disk-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.disk-drive-wrap {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background: radial-gradient(circle at 30% 25%, rgba(99,102,241,0.12), transparent 55%),
    rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.disk-drive-icon {
  width: 56px;
  height: 56px;
  display: block;
  opacity: 0.95;
}
.disk-card-headtext {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 2px;
}
.disk-card-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.disk-device-pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.22);
  border-radius: 99px;
  padding: 3px 10px;
  letter-spacing: 0.02em;
}
.disk-fs-line {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.disk-metric { display: flex; flex-direction: column; gap: 6px; }
.disk-metric-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.disk-metric-val { font-family: var(--mono); font-weight: 600; font-size: 0.72rem; }
.disk-metric-na { color: var(--text-muted); font-weight: 500; }

.disk-bar-wrap--sm { height: 6px; }
.disk-bar-wrap--disabled { opacity: 0.45; }

.disk-bar-wrap {
  height: 8px; background: rgba(255,255,255,0.07);
  border-radius: 99px; overflow: hidden;
}
.disk-bar {
  height: 100%; border-radius: 99px;
  transition: width 0.6s ease;
  background: linear-gradient(90deg, var(--indigo), var(--cyan));
}
.disk-bar.warn { background: linear-gradient(90deg, var(--amber), #ef4444); }
.disk-sub { display: flex; justify-content: space-between; margin-top: 2px; font-size: 0.68rem; color: var(--text-muted); font-family: var(--mono); }

/* ── Jellyfin ── */
.docker-stat { font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; font-family: var(--mono); }
.docker-stat.running { background: rgba(16,185,129,0.12); color: var(--emerald); border: 1px solid rgba(16,185,129,0.25); }
.docker-stat.stopped { background: rgba(244,63,94,0.12); color: var(--rose); border: 1px solid rgba(244,63,94,0.25); }

.docker-ports { display: flex; flex-wrap: wrap; gap: 6px; }
.docker-port-tag {
  font-size: 0.68rem; font-family: var(--mono);
  background: rgba(6,182,212,0.1); color: var(--cyan);
  border: 1px solid rgba(6,182,212,0.2); border-radius: 6px;
  padding: 4px 8px;
}

.cpu-temp-block { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

.jf-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border);
}
.btn-jf {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.btn-jf:hover:not(:disabled) { background: rgba(255,255,255,0.09); border-color: var(--border-hover); }
.btn-jf:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-jf-amber { color: var(--amber); background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.25); }
.btn-jf-rose { color: #fb7185; background: rgba(244,63,94,0.1); border-color: rgba(244,63,94,0.25); }
.btn-jf-primary { color: var(--emerald); background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.28); }

.card-audit .card-header { margin-bottom: 10px; }
.btn-audit-refresh {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  cursor: pointer;
}
.btn-audit-refresh:hover { color: var(--text-primary); border-color: var(--border-hover); }

.card-notify-settings .card-header { margin-bottom: 10px; }
.notify-help {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 12px;
}
.notify-help code { font-size: 0.72rem; color: var(--cyan); }
.notify-input {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  color: var(--text-primary);
  margin-bottom: 12px;
}
.notify-input:focus {
  outline: none;
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.notify-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.notify-status { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

/* ── Process List ── */
.proc-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.proc-table th { text-align: left; font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.proc-table td { padding: 10px 12px; font-size: 0.82rem; border-bottom: 1px solid rgba(255,255,255,0.03); }
.proc-name { font-weight: 600; color: var(--text-primary); }
.proc-user { font-size: 0.72rem; color: var(--text-muted); font-family: var(--mono); }
.proc-val { font-family: var(--mono); font-weight: 500; }

/* ── Threshold Sliders ── */
.threshold-item { margin-bottom: 20px; }
.threshold-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.threshold-label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.threshold-val { font-family: var(--mono); font-size: 0.9rem; color: var(--indigo); font-weight: 700; }
.threshold-slider {
  width: 100%; height: 6px; background: rgba(255,255,255,0.07); border-radius: 99px; outline: none;
  -webkit-appearance: none; appearance: none; cursor: pointer;
}
.threshold-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; background: var(--indigo); border-radius: 50%;
  box-shadow: 0 0 10px rgba(99,102,241,0.4); transition: transform 0.1s;
}
.threshold-slider::-webkit-slider-thumb:hover { transform: scale(1.1); }

@media (max-width: 768px) {
  .sidebar {
    width: 0;
    position: fixed;
    height: 100vh;
  }
  .sidebar.mobile-open {
    width: 240px;
  }
  .sidebar:hover { width: 0; }
  .sidebar.mobile-open:hover { width: 240px; }
  .sidebar .nav-item span { opacity: 1; }
  .sidebar-logo-text { opacity: 1; }
}

/* ── Theme Picker ──────────────────────────────────── */
.theme-picker { position: relative; }
.theme-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-secondary); transition: all 0.2s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 160px; box-shadow: var(--shadow); z-index: 1000;
}
.theme-dropdown.hidden { display: none; }
.theme-option {
  background: transparent; border: none; padding: 8px 12px;
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-primary); font-size: 0.85rem;
  text-align: left; transition: background 0.15s;
}
.theme-option:hover { background: var(--bg-card-hover); }
.theme-option.active { background: rgba(99,102,241,0.15); color: var(--accent); font-weight: 600; }

/* ── Terminal View ──────────────────────────────────── */







/* ── Backup View ──────────────────────────────────── */
.backup-job-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
  transition: border-color 0.2s;
}
.backup-job-card:hover { border-color: var(--border-hover); }
.backup-job-name { font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.backup-job-meta { font-size: 0.78rem; color: var(--text-muted); font-family: var(--mono); margin-top: 4px; }
.backup-status { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.backup-status.success { background: rgba(16,185,129,0.15); color: #10b981; }
.backup-status.error { background: rgba(244,63,94,0.15); color: #f43f5e; }
.backup-status.pending { background: rgba(99,102,241,0.15); color: var(--indigo); }
.backup-status.running { background: rgba(245,158,11,0.15); color: var(--amber); }

/* ── APT Package List ──────────────────────────────── */
.apt-pkg-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-radius: var(--radius-sm); font-family: var(--mono); font-size: 0.8rem;
  background: var(--bg-base); margin-bottom: 4px; color: var(--text-secondary);
}
.apt-pkg-item span { color: var(--cyan); }

/* ── Terminal & Backups Views ────────────────────────── */
#view-terminal {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 60px);
  padding: 16px;
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
#view-terminal.hidden {
  display: none !important;
}
#terminal-container {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #080b14;
  border-radius: 8px;
}
#terminal-container .xterm {
  height: 100% !important;
  width: 100% !important;
  padding: 4px;
}
#terminal-container .xterm-screen {
  height: 100% !important;
}
#terminal-container .xterm-viewport {
  overflow-y: auto !important;
}
#view-backups {
  overflow-y: auto;
  height: calc(100vh - 60px);
  padding: 24px;
  box-sizing: border-box;
}

/* ── Responsive Mobile ────────────────────────── */
.sidebar-mobile-actions {
  display: none;
  padding: 16px 12px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

@media (max-width: 900px) {
  .sidebar-mobile-actions {
    display: block;
  }
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    width: 260px !important;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* Extra bottom padding so content clears Safari bottom bar (≈83px) + extra */
    padding-bottom: 280px;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  }
  /* Overlay behind sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
  }
  .sidebar-overlay.active {
    display: block;
  }
  /* Block body scroll when menu is open */
  body.sidebar-open {
    overflow: hidden;
  }
  .mobile-menu-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  .grid-row {
    grid-template-columns: 1fr !important;
  }
  .header {
    padding: 12px 16px;
  }
  .mobile-header-right {
    display: flex !important;
  }
  .main-content {
    padding: 16px;
  }
  .header-stat {
    display: none !important;
  }
  .header-right {
    display: none !important;
  }
  .header-chip.os-chip, .header-chip.temp-chip {
    display: none !important;
  }
  .card {
    padding: 16px;
  }
}
/* -- Modal (Snake) ------------------------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(5px);
}
.modal.hidden {
  display: none !important;
}
