/* ═══════════════════════════════════════════════════════════════════════════
   Status Page — Dark Theme
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Theme Variables) ─────────────────────────────── */
:root {
  --bg-base:       #080d14;
  --bg-surface:    #0d1420;
  --bg-card:       #101824;
  --bg-card-hover: #131e2c;
  --bg-input:      #0a1220;

  --border:        rgba(255, 255, 255, 0.07);
  --border-hover:  rgba(255, 255, 255, 0.14);

  --text-primary:  #e2e8f0;
  --text-secondary: #64748b;
  --text-muted:    #3d4f6b;
  --text-accent:   #93c5fd;

  --accent:        #3b82f6;
  --accent-glow:   rgba(59, 130, 246, 0.25);

  --green:         #10b981;
  --green-dim:     rgba(16, 185, 129, 0.18);
  --yellow:        #f59e0b;
  --yellow-dim:    rgba(245, 158, 11, 0.18);
  --red:           #ef4444;
  --red-dim:       rgba(239, 68, 68, 0.18);
  --blue:          #3b82f6;
  --blue-dim:      rgba(59, 130, 246, 0.18);
  --purple:        #8b5cf6;
  --purple-dim:    rgba(139, 92, 246, 0.18);
  --cyan:          #06b6d4;
  --cyan-dim:      rgba(6, 182, 212, 0.18);
  --amber:         #f59e0b;
  --amber-dim:     rgba(245, 158, 11, 0.18);

  /* Chart colors */
  --chart-cpu:    #3b82f6;
  --chart-ram:    #8b5cf6;
  --chart-gpu:    #10b981;
  --chart-up:     #f59e0b;
  --chart-down:   #06b6d4;

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --summary-card-height: 166px;

  --transition:   0.18s ease;
  --shadow:       0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Inter', sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }

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

/* ── Top Bar ──────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 52px;
  background: rgba(8, 13, 20, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-left  { display: flex; align-items: center; gap: 18px; }
.topbar-right { display: flex; align-items: center; gap: 20px; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.logo svg { color: var(--accent); flex-shrink: 0; }

.topbar-hostname {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.topbar-uptime,
.topbar-timestamp {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 12px;
  color: var(--text-primary);
}
.topbar-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Health Badge */
.health-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: var(--transition);
}
.health-badge.healthy  { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.health-badge.warning  { border-color: var(--yellow); background: var(--yellow-dim); color: var(--yellow); }
.health-badge.critical { border-color: var(--red); background: var(--red-dim); color: var(--red); }

.health-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Status Banner ────────────────────────────────────────────────────────── */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.status-banner.operational { background: var(--green-dim);  color: var(--green);  border-bottom: 1px solid rgba(16,185,129,0.2); }
.status-banner.degraded    { background: var(--yellow-dim); color: var(--yellow); border-bottom: 1px solid rgba(245,158,11,0.2); }
.status-banner.down        { background: var(--red-dim);    color: var(--red);    border-bottom: 1px solid rgba(239,68,68,0.2);  }

.banner-inner { display: flex; align-items: center; gap: 8px; }
.banner-icon  { display: flex; align-items: center; }

.incident-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  font-size: 13px;
  background: rgba(245, 158, 11, 0.1);
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--yellow);
  gap: 10px;
  flex-wrap: wrap;
}
.incident-type {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(245,158,11,0.2);
}

/* ── Container ────────────────────────────────────────────────────────────── */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  position: relative;
}

.section { margin-top: 28px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--red);
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--red-dim);
  animation: pulse-dot 2s infinite;
}

.count-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  min-width: 22px;
  text-align: center;
}

/* ── Loading Overlay ──────────────────────────────────────────────────────── */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 60px;
  color: var(--text-secondary);
  font-size: 13px;
}

.spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error Banner ─────────────────────────────────────────────────────────── */
.error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--red-dim);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  margin-bottom: 20px;
  color: var(--red);
  font-size: 13px;
}
.error-banner button {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--red);
  background: transparent;
  color: var(--red);
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}
.error-banner button:hover { background: var(--red-dim); }

/* ── Summary Cards Grid ───────────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  align-items: start;
}

.summary-section {
  margin-top: 0;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  height: 142px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), background var(--transition);
  cursor: default;
  overflow: hidden;
}
.summary-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  min-height: 36px;
}

.card-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-cpu  { background: var(--blue-dim);   color: var(--blue);   }
.icon-ram  { background: var(--purple-dim); color: var(--purple); }
.icon-gpu  { background: var(--green-dim);  color: var(--green);  }
.icon-disk { background: var(--amber-dim);  color: var(--amber);  }
.icon-net  { background: var(--cyan-dim);   color: var(--cyan);   }

.card-info { flex: 1; min-width: 0; }
.card-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.card-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1;
  min-height: 22px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  margin-top: 3px;
  transition: background var(--transition), box-shadow var(--transition);
}
.status-dot.healthy  { background: var(--green);  box-shadow: 0 0 8px rgba(16,185,129,0.5); }
.status-dot.warning  { background: var(--yellow); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.status-dot.critical { background: var(--red);    box-shadow: 0 0 8px rgba(239,68,68,0.5);  }
.status-dot.active   { background: var(--cyan);   box-shadow: 0 0 8px rgba(6,182,212,0.5);  }

.progress-track {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease, background-color 0.5s ease;
  background: var(--blue);
}

.card-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: auto;
  min-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Network card special layout */
.net-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  row-gap: 3px;
  column-gap: 8px;
  font-size: 11px;
  margin-bottom: 4px;
}
.net-label { color: var(--text-secondary); white-space: nowrap; }
.up-label  { color: var(--amber); }
.dn-label  { color: var(--cyan); }

#net-up-val,
#net-dn-val {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Charts Grid ──────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px 14px;
  transition: border-color var(--transition);
}
.chart-card:hover { border-color: var(--border-hover); }

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.chart-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.chart-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-cpu  { background: var(--chart-cpu);  box-shadow: 0 0 6px var(--chart-cpu); }
.dot-ram  { background: var(--chart-ram);  box-shadow: 0 0 6px var(--chart-ram); }
.dot-gpu  { background: var(--chart-gpu);  box-shadow: 0 0 6px var(--chart-gpu); }
.dot-net  { background: var(--chart-down); box-shadow: 0 0 6px var(--chart-down); }

.chart-card-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.card-value,
.chart-card-val,
.gauge-val,
#net-down,
#net-up-val,
#net-dn-val,
#topbar-uptime,
#topbar-updated {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.chart-wrap {
  height: 132px;
  position: relative;
}
.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── PM2 Section ──────────────────────────────────────────────────────────── */
.pm2-summary {
  display: flex;
  gap: 12px;
  font-size: 12px;
}
.pm2-stat { display: flex; align-items: center; gap: 5px; color: var(--text-secondary); }
.pm2-stat .dot { width: 6px; height: 6px; border-radius: 50%; }
.pm2-stat .dot.online  { background: var(--green); }
.pm2-stat .dot.stopped { background: var(--yellow); }
.pm2-stat .dot.errored { background: var(--red); }

.table-wrap { overflow-x: auto; border-radius: var(--radius); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead tr {
  background: var(--bg-surface);
}
.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }

.pm2-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.pm2-status-badge.online  { background: var(--green-dim);  color: var(--green);  }
.pm2-status-badge.stopped { background: var(--yellow-dim); color: var(--yellow); }
.pm2-status-badge.errored { background: var(--red-dim);    color: var(--red);    }
.pm2-status-badge.unknown { background: rgba(100,116,139,0.15); color: var(--text-secondary); }

/* ── Services Section ─────────────────────────────────────────────────────── */
.services-overall {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
}
.services-overall .status-dot { margin: 0; }

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

/* Loading skeleton */
.service-skeleton {
  height: 90px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.service-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color var(--transition), transform var(--transition);
}
.service-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.service-card.operational { border-left: 3px solid var(--green); }
.service-card.degraded    { border-left: 3px solid var(--yellow); }
.service-card.down        { border-left: 3px solid var(--red); }

.service-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.service-name { font-size: 13px; font-weight: 600; }

.service-status-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 10px;
}
.service-status-badge.operational { background: var(--green-dim);  color: var(--green);  }
.service-status-badge.degraded    { background: var(--yellow-dim); color: var(--yellow); }
.service-status-badge.down        { background: var(--red-dim);    color: var(--red);    }
.service-status-badge.checking    { background: rgba(100,116,139,0.1); color: var(--text-secondary); }

.service-url {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.service-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}
.service-response { font-weight: 600; }
.service-response.fast   { color: var(--green); }
.service-response.medium { color: var(--yellow); }
.service-response.slow   { color: var(--red); }

/* Service log */
.service-log-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.service-log-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.service-log {
  padding: 8px 0;
  max-height: 140px;
  overflow-y: auto;
}
.log-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: background var(--transition);
}
.log-entry:hover { background: rgba(255,255,255,0.02); }
.log-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.log-dot.operational { background: var(--green); }
.log-dot.degraded    { background: var(--yellow); }
.log-dot.down        { background: var(--red); }
.log-time { color: var(--text-muted); font-size: 11px; margin-left: auto; white-space: nowrap; }

/* ── System Info Cards ────────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.info-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.info-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.temp-title {
  margin-bottom: 0;
}

.temp-unit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.temp-unit-btn {
  border: 0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}

.temp-unit-btn:hover {
  color: var(--text-primary);
}

.temp-unit-btn.is-active {
  color: #dbeafe;
  background: rgba(59, 130, 246, 0.2);
}

.info-rows { display: flex; flex-direction: column; gap: 8px; }

.info-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; padding-bottom: 0; }
.info-key { color: var(--text-secondary); flex-shrink: 0; width: 90px; }
.info-val { color: var(--text-primary); font-weight: 500; word-break: break-word; }

/* Temperature gauges */
.gauge-group { display: flex; gap: 20px; margin-top: 16px; }

.temp-gauge { flex: 1; }
.gauge-label { font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; }
.gauge-val   { font-size: 20px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.3px; }

.gauge-bar-track {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.gauge-bar-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease, background-color 0.5s ease;
  background: var(--blue);
}

.empty-state-small {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
}

.temp-charts {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.temp-chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px 8px;
}

.temp-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.temp-chart-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
}

.temp-chart-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.temp-chart-wrap {
  height: 104px;
}

.temp-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Empty States ─────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.empty-state svg { color: var(--text-muted); margin-bottom: 4px; }
.empty-state p { font-size: 14px; font-weight: 500; }
.empty-state small { font-size: 12px; color: var(--text-muted); max-width: 300px; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  margin: 2rem 0 10px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  background: linear-gradient(90deg, #101721 0%, #090f18 100%);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.footer-left {
  color: var(--text-secondary);
  font-size: 1rem;
}

.footer-right {
  display: flex;
  gap: 1.2rem;
}

.footer-icon {
  width: 28px;
  height: 28px;
  vertical-align: middle;
  transition: transform 0.18s ease;
}

.footer-icon:hover {
  transform: scale(1.12);
}

.footer-right a {
  display: inline-flex;
  align-items: center;
}

/* Brand colors (non-dark/light dependent) */
.footer-icon[src*="bluesky"] {
  filter: invert(31%) sepia(98%) saturate(1200%) hue-rotate(180deg);
}
.footer-icon[src*="discord"] {
  filter: brightness(0) saturate(100%) invert(56%) sepia(74%) saturate(6335%)
    hue-rotate(224deg) brightness(96%) contrast(97%);
}
.footer-icon[src*="linkedin"] {
  filter: invert(34%) sepia(91%) saturate(745%) hue-rotate(173deg);
}
.footer-icon[src*="twitch"] {
  filter: brightness(0) saturate(100%) invert(40%) sepia(58%) saturate(4143%)
    hue-rotate(239deg) brightness(98%) contrast(101%);
}
.footer-icon[src*="youtube"] {
  filter: invert(16%) sepia(94%) saturate(7491%) hue-rotate(353deg);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .topbar { padding: 0 14px; }
  .topbar-timestamp { display: none; }
  .container { padding: 16px 14px 30px; }
  .charts-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .chart-wrap { height: 118px; }
  .info-card-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .temp-charts {
    grid-template-columns: 1fr;
  }
  .footer-content {
    gap: 0.8rem;
    justify-content: center;
  }
  .footer-right {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 500px) {
  .topbar-uptime { display: none; }
  .logo span { display: none; }
  .data-table th:nth-child(n+5),
  .data-table td:nth-child(n+5) { display: none; }
  #card-gpu {
    height: 158px;
  }
  #gpu-sub {
    white-space: normal;
    line-height: 1.25;
    min-height: 30px;
    overflow: hidden;
    text-overflow: clip;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .footer-left {
    width: 100%;
    font-size: 0.9rem;
  }
  .footer-icon {
    width: 24px;
    height: 24px;
  }
}

/* ── Utility Animations ───────────────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section { animation: fade-in 0.3s ease; }

/* ── Light Theme ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --bg-base:       #f1f5f9;
  --bg-surface:    #e2e8f0;
  --bg-card:       #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input:      #f1f5f9;

  --border:        rgba(0, 0, 0, 0.09);
  --border-hover:  rgba(0, 0, 0, 0.18);

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-accent:    #2563eb;

  --accent:        #2563eb;
  --accent-glow:   rgba(37, 99, 235, 0.2);

  --green-dim:     rgba(16, 185, 129, 0.12);
  --yellow-dim:    rgba(245, 158, 11, 0.12);
  --red-dim:       rgba(239, 68, 68, 0.12);
  --blue-dim:      rgba(37, 99, 235, 0.10);
  --purple-dim:    rgba(139, 92, 246, 0.10);
  --cyan-dim:      rgba(6, 182, 212, 0.10);
  --amber-dim:     rgba(245, 158, 11, 0.10);
}

[data-theme="light"] .topbar {
  background: rgba(241, 245, 249, 0.92);
}

[data-theme="light"] .footer {
  background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 100%);
}

[data-theme="light"] .data-table thead tr {
  background: var(--bg-surface);
}

[data-theme="light"] .footer-icon[src*="bluesky"],
[data-theme="light"] .footer-icon[src*="discord"],
[data-theme="light"] .footer-icon[src*="linkedin"],
[data-theme="light"] .footer-icon[src*="twitch"],
[data-theme="light"] .footer-icon[src*="youtube"] {
  opacity: 0.75;
}

/* ── Theme Toggle Button ──────────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* ── Section Collapse ─────────────────────────────────────────────────────── */
.section-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.section-toggle:hover { color: var(--text-secondary); border-color: var(--border-hover); }
.section-toggle svg { transition: transform 0.25s ease; }
.section.collapsed .section-toggle svg { transform: rotate(-90deg); }

.section-body {
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.25s ease;
  max-height: 2000px;
  opacity: 1;
}
.section.collapsed .section-body {
  max-height: 0;
  opacity: 0;
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Summary Grid — flexible for 5 or 6 cards ────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  align-items: start;
}

/* ── Battery Card ─────────────────────────────────────────────────────────── */
.icon-battery { background: var(--green-dim); color: var(--green); }

.battery-level-wrap {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
[data-theme="light"] .battery-level-wrap { background: rgba(0,0,0,0.07); }

.battery-level-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease, background-color 0.5s ease;
  background: var(--green);
}

.battery-charging-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--yellow);
  vertical-align: middle;
}

/* ── Swap Bar (secondary bar in RAM card) ─────────────────────────────────── */
.swap-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.swap-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
  width: 34px;
}
.swap-track {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
[data-theme="light"] .swap-track { background: rgba(0,0,0,0.07); }
.swap-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  background: var(--purple);
  transition: width 0.5s ease;
  opacity: 0.6;
}

/* ── Per-Core CPU Heatmap ─────────────────────────────────────────────────── */
.core-heatmap-section {
  margin-top: 12px;
}
.core-heatmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.core-heatmap-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.core-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.core-cell {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: default;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}
.core-cell:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.core-cell-bg {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  transition: background var(--transition);
}
.core-cell-num {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: relative;
  z-index: 1;
}
.core-cell-pct {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  z-index: 1;
  font-variant-numeric: tabular-nums;
}

/* ── Fullscreen Chart Overlay ─────────────────────────────────────────────── */
#fullscreen-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 900;
  backdrop-filter: blur(4px);
}
#fullscreen-overlay.active { display: block; }

.chart-card.is-fullscreen {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 950;
  width: min(92vw, 1100px);
  max-height: 90vh;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.chart-card.is-fullscreen .chart-wrap {
  height: calc(90vh - 100px);
}

.chart-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.chart-expand-btn:hover { color: var(--text-primary); border-color: var(--border-hover); }

/* ── Keyboard Shortcuts Modal ─────────────────────────────────────────────── */
#shortcuts-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#shortcuts-modal.active { display: flex; }

.shortcuts-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.shortcuts-box {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  width: min(400px, 90vw);
  box-shadow: var(--shadow);
}

.shortcuts-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shortcuts-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.shortcuts-close:hover { color: var(--text-primary); }

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}
.shortcut-row:last-child { border-bottom: none; }

.shortcut-key {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--border-hover);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 1px 0 var(--border-hover);
}

/* ── Responsive Updates ───────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .core-cell { width: 46px; height: 46px; }
}
@media (max-width: 500px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .core-cell { width: 42px; height: 42px; }
}
