:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --text: #12202e;
  --text-secondary: #536171;
  --text-muted: #6b7785;
  --text-disabled: #98a2ae;
  --text-on-primary: #ffffff;
  --border: #e3e7ec;
  --border-soft: #e8ecf1;
  --border-strong: #cfd6de;
  --divider: #eef2f6;
  --hover: #eef1f4;
  /* Surface ladder (light) */
  --surface-header: #fafbfc;
  --surface-inset: #f8fafc;
  --surface-interactive: #ffffff;
  --surface-elevated: #ffffff;
  --surface-row-hover: rgba(15, 23, 42, 0.03);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
  /* Brand teal — nafeproxys.online (nafe-teal #14B8A6) */
  --primary: #14b8a6;
  --primary-hover: #0ea5a4;
  --primary-active: #0d9488;
  --primary-soft: rgba(20, 184, 166, 0.1);
  --primary-text: #0f766e;
  --primary-border: rgba(20, 184, 166, 0.28);
  --ok: #15803d;
  --ok-soft: #f0faf3;
  --ok-text: #166534;
  --warn: #b45309;
  --warn-soft: #fff7ed;
  --warn-text: #9a3412;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-text: #b91c1c;
  --info: #14b8a6;
  --info-soft: rgba(20, 184, 166, 0.08);
  --neutral: #64748b;
  --neutral-soft: #f1f5f9;
  --font: Inter, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --fs-12: 12px;
  --fs-13: 13px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-18: 18px;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-overlay: 0 12px 32px -16px rgba(18, 32, 46, 0.35);
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 56px;
  --topbar-h: 52px;
  --topbar-border: #e2e8f0;
  --topbar-line: #e8ecf1;
  --topbar-chip: #f8fafc;
  --topbar-elevated: #ffffff;
  --topbar-muted: #64748b;
  --content-pad: 16px;
  --z-sidebar: 40;
  --z-topbar: 30;
  --z-overlay: 50;
  --z-menu: 60;
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);
  --control-h: 32px;
  --input-bg: #ffffff;
  --input-placeholder: var(--text-muted);
  --backdrop: rgba(15, 23, 42, 0.36);
}

@media (min-width: 1024px) {
  :root { --content-pad: 24px; }
}

/*
  Dark theme — surfaces/borders/text from nafeproxys.online (nafe.bg / nafe.surface).
  Primary actions stay brand teal. Light (:root) unchanged.
  Ladder: #0B1220 canvas → recessed → #0F172A cards → elevated modals.
*/
html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0b1220;
  --surface-muted: #0d1526;
  --surface: #0f172a;
  --surface-elevated: #131c31;
  --hover: #152238;
  --selected: rgba(20, 184, 166, 0.12);
  --surface-header: #0d1526;
  --surface-inset: #0b1220;
  --surface-interactive: #131c31;
  --surface-row-hover: rgba(255, 255, 255, 0.04);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35);

  --border-soft: rgba(255, 255, 255, 0.06);
  --border: #1f2937;
  --border-strong: #374151;
  --divider: #1f2937;

  /* Text ladder: primary → secondary → muted → disabled (~95% / ~78% / ~66% / ~42%) */
  --text: #f4f6f8;
  --text-secondary: #c4ceda;
  --text-muted: #9fb0c0;
  --text-disabled: #5c6778;
  --text-on-primary: #ffffff;

  --primary: #14b8a6;
  --primary-hover: #2dd4bf;
  --primary-active: #0ea5a4;
  --primary-soft: rgba(20, 184, 166, 0.12);
  --primary-text: #2dd4bf;
  --primary-border: rgba(20, 184, 166, 0.3);

  --ok: #32c675;
  --ok-soft: rgba(50, 198, 117, 0.12);
  --ok-text: #32c675;
  --warn: #e6a23c;
  --warn-soft: rgba(230, 162, 60, 0.12);
  --warn-text: #e6a23c;
  --danger: #e15858;
  --danger-soft: rgba(225, 88, 88, 0.1);
  --danger-text: #e86464;
  --info: #2dd4bf;
  --info-soft: rgba(20, 184, 166, 0.12);
  --neutral: #9fb0c0;
  --neutral-soft: rgba(148, 163, 184, 0.1);

  --input-bg: #0b1220;
  --input-placeholder: #8fa3b8;
  --backdrop: rgba(7, 14, 26, 0.78);

  --topbar-elevated: #0b1220;
  --topbar-chip: #0f172a;
  --topbar-line: #1f2937;
  --topbar-border: #1f2937;
  --topbar-muted: #9fb0c0;

  --shadow-overlay: 0 16px 48px rgba(0, 0, 0, 0.55);
  --focus-ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}
