:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --panel: #101115;
  --card: #15161b;
  --card-2: #1b1c23;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f3f3f7;
  --soft: #b2b3be;
  --muted: #7c7e8c;
  --accent: #74ff52;
  --accent-soft: rgba(116, 255, 82, 0.12);
  --accent-border: rgba(116, 255, 82, 0.28);
  --accent-text: #c9ffad;
  --accent-ink: #111f0b;
  --blue: #6aa9ff;
  --blue-soft: rgba(106, 169, 255, 0.14);
  --amber: #f7c56b;
  --amber-soft: rgba(247, 197, 107, 0.14);
  --coral: #f28b82;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-w: 228px;
  --topbar-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(640px 260px at 58% -40px, rgba(116, 255, 82, 0.055), transparent 72%),
    var(--bg);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }

/* Floating toast */
.toast {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: calc(50% + var(--sidebar-w) / 2);
  transform: translateX(-50%) translateY(-8px);
  z-index: 300;
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  border-radius: 999px;
  background: #1d1f26;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  color: #f4f4f8;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms var(--ease);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Brand mark */
.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(116, 255, 82, 0.22);
  overflow: hidden;
}
.brand-mark svg { width: 100%; height: 100%; display: block; }

/* Login view */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.login-brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.login-brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field span {
  font-size: 12.5px;
  color: var(--soft);
  font-weight: 500;
}
.field input {
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #0f1014;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(116, 255, 82, 0.14);
}
.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--soft);
  cursor: pointer;
}
.check-label input { accent-color: var(--accent); }
.login-env-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  font-weight: 500;
}
.login-error {
  margin: -4px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(242, 139, 130, 0.12);
  border: 1px solid rgba(242, 139, 130, 0.28);
  color: var(--coral);
  font-size: 12.5px;
}
.login-submit {
  width: 100%;
  height: 40px;
  margin-top: 2px;
}
.login-footnote {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  text-wrap: pretty;
}

/* Main shell */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--line);
}
.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-copy strong {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.25;
}
.brand-copy span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.nav-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 14px;
  overflow-y: auto;
}
.nav-group-label {
  padding: 10px 10px 5px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.nav-group-label:first-child { padding-top: 2px; }

.nav-item {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}
.nav-item svg {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: 0.85;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
}
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.nav-item.active svg { color: var(--accent); opacity: 1; }
.nav-pill {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
}

.sidebar-footer {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.source-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.status-dot.is-mock {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(247, 197, 107, 0.5);
}
.status-dot.is-live {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(116, 255, 82, 0.55);
}
.source-status-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.source-status-copy strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.source-status-copy small {
  font-size: 11px;
  color: var(--muted);
}
.sidebar-action-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--soft);
  font: inherit;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.sidebar-action-btn svg { width: 14px; height: 14px; }
.sidebar-action-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
  color: var(--text);
}

/* Workspace & topbar */
.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--topbar-h);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(11, 12, 14, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
.mobile-menu-btn { display: none; }
.page-heading { min-width: 0; }
.page-heading h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.page-heading p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-wrap: pretty;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* Segmented control (fixed widths to prevent jitter) */
.segmented {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  gap: 2px;
}
.segmented button {
  min-width: 60px;
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.segmented button:hover:not(.active) { color: var(--text); }
.segmented button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Buttons (stable fixed min-width & height) */
.btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}
.btn-primary {
  min-width: 104px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: #89ff6c; }
.btn-secondary {
  background: var(--card);
  border-color: var(--line-strong);
  color: #e6e7ef;
}
.btn-secondary:hover:not(:disabled) {
  background: var(--card-2);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}
.btn:disabled { opacity: 0.6; cursor: wait; }
.refresh-btn { min-width: 104px; }
.btn-icon { width: 14px; height: 14px; flex: none; }
.refresh-btn.is-busy .btn-icon { animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--soft);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 140ms ease, background-color 140ms ease;
}
.link-btn:hover { color: var(--accent-text); background: rgba(255, 255, 255, 0.05); }

/* Content layout */
.content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 28px 36px;
}
.view-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 16px;
}
.card-head > div:first-child {
  min-width: 0;
  flex: 1 1 240px;
}
.card-head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
}
.card-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-wrap: pretty;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kpi-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
}
.kpi-card.kpi-online {
  border-color: rgba(116, 255, 82, 0.22);
  background: linear-gradient(180deg, rgba(116, 255, 82, 0.055) 0%, var(--card) 58%);
}
.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.kpi-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--soft);
  font-weight: 500;
}
.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(116, 255, 82, 0.55);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(116, 255, 82, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(116, 255, 82, 0); }
  100% { box-shadow: 0 0 0 0 rgba(116, 255, 82, 0); }
}
.kpi-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}
.kpi-badge.is-live {
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
}
.kpi-delta {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi-delta.is-up {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.kpi-delta.is-down {
  background: rgba(242, 139, 130, 0.14);
  color: var(--coral);
}
.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.kpi-value {
  font-size: 29px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.kpi-unit {
  font-size: 12px;
  color: var(--muted);
}
.kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.kpi-meta { color: var(--soft); }

/* Pills */
.pill-accent {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
  white-space: nowrap;
}
.pill-amber {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--amber-soft);
  color: var(--amber);
  white-space: nowrap;
}
.pill-coral {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(242, 139, 130, 0.14);
  color: var(--coral);
  border: 1px solid rgba(242, 139, 130, 0.25);
  white-space: nowrap;
}

/* Trend Chart */
.chart-controls { display: flex; align-items: center; gap: 8px; }
.legend-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: #101116;
  border: 1px solid var(--line);
}
.legend-pill {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--soft);
  font: inherit;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}
.legend-pill.active {
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
}
.dot-accent, .dot-blue, .dot-coral {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-accent { background: var(--accent); }
.dot-blue { background: var(--blue); }
.dot-coral { background: var(--coral); }

.chart-stage {
  position: relative;
  width: 100%;
  height: 276px;
}
.trend-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-dasharray: 3 4;
}
.chart-axis-text {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart-crosshair {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.chart-tooltip {
  position: absolute;
  top: 10px;
  pointer-events: none;
  min-width: 162px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(21, 22, 28, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
  font-size: 12px;
  z-index: 10;
}
.chart-tooltip-title {
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.chart-tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 3px;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.chart-tooltip-row strong { color: #fff; font-weight: 600; }

/* 2-col grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* Horizontal bar lists */
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.bar-list.is-compact { gap: 11px; }
.bar-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bar-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.bar-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
}
.bar-tag {
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.bar-nums {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bar-nums strong { color: #fff; font-weight: 600; }
.bar-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(116, 255, 82, 0.72), var(--accent));
  transition: width 320ms var(--ease);
}
.bar-fill.is-blue {
  background: linear-gradient(90deg, rgba(106, 169, 255, 0.65), var(--blue));
}
.bar-fill.is-amber {
  background: linear-gradient(90deg, rgba(247, 197, 107, 0.68), var(--amber));
}
.bar-fill.is-coral {
  background: linear-gradient(90deg, rgba(242, 139, 130, 0.72), var(--coral));
}
.bar-fill.is-muted {
  background: rgba(255, 255, 255, 0.28);
}

/* Generation Summary & Region Pills */
.perf-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.perf-stat {
  padding: 12px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.perf-stat span {
  font-size: 12px;
  color: var(--soft);
}
.perf-stat strong {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.perf-stat strong.is-accent { color: var(--accent-text); }
.perf-stat strong.is-coral { color: var(--coral); }
.perf-stat small {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.region-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.card-head .region-pills { margin-bottom: 0; }
.region-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.region-pill strong { color: #fff; font-weight: 600; }

.rate-tag {
  display: inline-block;
  min-width: 48px;
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rate-tag.is-good { color: var(--accent-text); }
.rate-tag.is-warn { color: var(--amber); }
.rate-tag.is-high { color: var(--coral); }

.mini-divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

/* Releases Table */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  color: var(--text);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table th.num, .data-table td.num { text-align: right; }
.table-bar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 130px;
}
.table-bar-cell .bar-track { flex: 1; }
.table-bar-cell span { width: 42px; text-align: right; color: var(--soft); font-size: 12px; }

/* Hardware Donut & GPU grid */
.donut-layout {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 6px 4px;
}
.donut-wrap {
  position: relative;
  width: 176px;
  height: 176px;
  flex: none;
}
.donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-center strong {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.donut-center span {
  font-size: 12px;
  color: var(--muted);
}
.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}
.donut-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}
.donut-legend-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.donut-legend-left i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}
.donut-legend-right {
  font-variant-numeric: tabular-nums;
  color: var(--soft);
  font-size: 12.5px;
}
.donut-legend-right strong { color: #fff; margin-right: 6px; }

.env-split h3 {
  margin: 0 0 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--soft);
}
.gpu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}

/* Settings page */
.kv-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.kv-row span { color: var(--soft); white-space: nowrap; }
.kv-row code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 12px;
  color: #e4e6f0;
  overflow-wrap: anywhere;
  text-align: right;
}
.text-accent { color: var(--accent-text); font-weight: 500; }

.setting-rows {
  display: flex;
  flex-direction: column;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:first-child { padding-top: 2px; }
.setting-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.setting-row strong {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
}
.setting-row small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.select-input {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #101116;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  outline: none;
}
.text-input-sm {
  width: 112px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.text-input-sm:focus {
  border-color: var(--accent);
}
.empty-state {
  padding: 24px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex: none;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: background-color 160ms ease;
}
.switch span::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); background: #0f1b0a; }
.card-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.privacy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.privacy-box {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}
.privacy-box.is-allow { border-color: rgba(116, 255, 82, 0.2); }
.privacy-box.is-deny { border-color: rgba(242, 139, 130, 0.2); }
.privacy-box h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
}
.privacy-box.is-allow h3 { color: var(--accent-text); }
.privacy-box.is-deny h3 { color: var(--coral); }
.privacy-box ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--soft);
}
.privacy-box code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 11.5px;
  color: #e4e6f0;
}

/* Responsive */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  z-index: 35;
}

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .gpu-grid, .privacy-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 10px;
  }
}

@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .toast { left: 50%; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 200ms var(--ease);
  }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .donut-layout { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 540px) {
  .toast { top: 126px; }
  .kpi-grid, .kpi-grid-3, .perf-summary-grid { grid-template-columns: 1fr; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .segmented button { min-width: 52px; padding: 0 8px; font-size: 12px; }
  .chart-controls { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
