/* Black Security design tokens. Components must consume tokens rather than hard-coded theme colors. */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:#080a11; --surface:#10131e; --surface-2:#151a28; --surface-3:#1c2232;
  --line:rgba(173,187,220,.12); --line-strong:rgba(173,187,220,.2);
  --text:#f3f5fc; --muted:#a0aac0; --purple:#8b5cf6; --purple-2:#a78bfa;
  --blue:#60a5fa; --green:#34d399; --orange:#fb923c; --red:#fb7185; --cyan:#67e8f9;
  --radius:18px; --shadow:0 20px 70px rgba(0,0,0,.26);
  font-family:Inter,"Segoe UI",Tahoma,Arial,sans-serif;
}

/* LIGHT MODE IS A SEPARATE PALETTE: no dark surface colors leak into this theme. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:#f5f7fc; --surface:#ffffff; --surface-2:#eef2f8; --surface-3:#e2e8f2;
  --line:#dbe2ee; --line-strong:#bac5d7;
  --text:#172033; --muted:#56627a; --purple:#6840c8; --purple-2:#5630b3;
  --blue:#1d4ed8; --green:#047857; --orange:#9a4d0a; --red:#be123c; --cyan:#0e7490;
  --radius:18px; --shadow:0 16px 44px rgba(30,41,59,.10);
}

html, body { background:var(--bg); color:var(--text); }
body { transition:background-color .18s ease,color .18s ease; }

/* Surfaces */
.sidebar,.topbar,.panel,.module-card,.stat-card,.guild-card,.settings-panel,
.preview-window,.preview-stats>div,.preview-panel,.steps-grid article,.faq-grid details,
.final-cta,.search-box,.invite-banner,.server-current,.security-status,
.empty-state,.loading-card,.toast,.feature-card,.details-modal {
  background-color:var(--surface); color:var(--text); border-color:var(--line);
}

/* Form controls share one predictable contrast system in both themes. */
input:not([type="checkbox"]):not([type="radio"]),select,textarea,
.field input,.field select,.search-box input {
  background:var(--surface-2); color:var(--text); border-color:var(--line-strong);
}
input::placeholder,textarea::placeholder,.search-box input::placeholder { color:var(--muted); opacity:1; }
option { background:var(--surface); color:var(--text); }

.nav-item { color:var(--muted); }
.nav-item:hover { background:var(--surface-2); color:var(--text); }
.nav-item.active { color:var(--purple); background:color-mix(in srgb,var(--purple) 10%,var(--surface)); border-color:color-mix(in srgb,var(--purple) 26%,transparent); }
.button.outline,.icon-button { background:var(--surface); color:var(--text); border-color:var(--line-strong); }
.button.ghost { background:color-mix(in srgb,var(--purple) 9%,var(--surface)); color:var(--purple); }
.data-table th { background:var(--surface-2); color:var(--muted); }
.data-table td,.health-row b,.health-row span,.field>span,.inline-check { color:var(--text); }
.module-title p,.page-heading p,.panel-header p,.guild-id,.setting-row small,.muted-text,.empty-state p { color:var(--muted); }
.steps-section { background:var(--surface-2); }
.preview-body,.main-column,.main-content { color:var(--text); }
.details-modal { background:var(--surface); color:var(--text); }
.bar-track { background:var(--surface-3); }

/* Prevent hard-coded dark-mode colors from creating white-on-white or black-on-black in light mode. */
:root[data-theme="light"] body:before { opacity:.08; }
:root[data-theme="light"] .invite-banner { background:var(--surface-2); }
:root[data-theme="light"] .state-present { color:var(--green); background:color-mix(in srgb,var(--green) 10%,var(--surface)); }
:root[data-theme="light"] .state-missing { color:var(--orange); background:color-mix(in srgb,var(--orange) 10%,var(--surface)); }
:root[data-theme="light"] .guild-card-bottom,:root[data-theme="light"] .setting-row,:root[data-theme="light"] .data-table td { border-color:var(--line); }
:root[data-theme="light"] .live-indicator { color:var(--green); }
:root[data-theme="light"] .sidebar-open::before { background:rgba(20,28,45,.24); }

/* Layout direction follows the active language, without altering theme colors. */
html[dir="ltr"] .breadcrumb,html[dir="ltr"] .nav-item,html[dir="ltr"] .sidebar,html[dir="ltr"] .topbar { direction:ltr; }
html[dir="ltr"] .nav-item { text-align:left; }
html[dir="ltr"] .guild-card-bottom,html[dir="ltr"] .header-actions { direction:ltr; }
