/* ==========================================================================
   Terminal theme (Update 44) — hand-written part.
   theme-modes.css (generated) re-colours every existing rule for
   html[data-theme="dark"] / html[data-theme="light"]; this file sets the
   Terminal identity on top: mono type, square corners, amber accents,
   and the 🌙/☀️ switch.
   ========================================================================== */

/* ---------- shared by both modes ---------- */
html[data-theme] {
  /* Update 45: calm, rounded Nunito for reading; JetBrains Mono only for numbers (keeps the terminal feel) */
  --font-ui: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-lg: 6px; --r-md: 4px; --r-sm: 3px; --radius: 4px;
  --amber: #FFB000; --amber-deep: #E09B00;
}
html[data-theme] body, html[data-theme] button, html[data-theme] input, html[data-theme] select, html[data-theme] textarea { font-family: var(--font-ui); }
html[data-theme] body { line-height: 1.6; letter-spacing: .005em; -webkit-font-smoothing: antialiased; }
html[data-theme] :is(h1, h2, h3, h4, .section-title, .hero-title, .brand-title, .auth-title) { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em; }
html[data-theme] :is(.card-sub, p, small) { line-height: 1.6; }
html[data-theme] .note-live-editor-text { font-family: var(--font-ui); line-height: 1.75; }
/* numbers stay terminal-style */
html[data-theme] :is(.dashboard-kpi strong, .hero-today strong, .pb-stats strong, .adm-kpis strong, .stat-card strong, .mono, .chal-count strong, .chal-stats strong, .analysis-kpis strong, .risk-limit-card strong, .chal-dash-num, .xp-badge, .comp-board .num, .adm-table .num, .history-summary strong) { font-family: var(--font-num); }
html[data-theme] .card, html[data-theme] .dashboard-kpi, html[data-theme] .dashboard-hero { border-radius: var(--r-lg); }
/* main action stays bright amber with black text in both modes */
html[data-theme] .btn-cta, html[data-theme] .btn-primary { background: var(--amber) !important; color: #0A0A0A !important; border-color: var(--amber) !important; }
html[data-theme] .btn-cta:hover, html[data-theme] .btn-primary:hover { background: #FFC233 !important; box-shadow: 0 0 0 1px rgba(255,176,0,.5), 0 8px 20px -10px rgba(255,176,0,.7) !important; }
html[data-theme] .btn-danger { border-radius: var(--r-sm); }
/* numbers read like a terminal */
html[data-theme] :is(.dashboard-kpi strong, .hero-today strong, .pb-stats strong, .adm-kpis strong) { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ---------- DARK ---------- */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #000000; --ink-2: #141414; --ink-3: #FFB000; --ink-tint: #141414; --ink-line: #2A2A2A;
  --purple: #FFB000; --purple-deep: #E09B00; --purple-soft: #FFC94D;
  --marigold: #FFB000; --marigold-deep: #E09B00; --marigold-tint: #1F1800;
  --paper: #000000; --surface: #0A0A0A; --line: #262626; --text: #E6E6E6; --muted: #8C8C8C;
  --profit: #00E676; --loss: #FF4D4D;
  --indigo: #E6E6E6; --indigo-dark: #000000; --indigo-light: #141414;
  --emerald: #00E676; --emerald-light: #04170D; --emerald-border: #0F3D24;
  --rose: #FF4D4D; --rose-light: #1A0707; --rose-border: #4A1414;
  --amber-light: #1F1800; --amber-border: #4A3700;
  --slate-900: #E6E6E6; --slate-700: #C2C2C2; --slate-500: #8C8C8C; --slate-400: #6B6B6B; --slate-200: #262626; --slate-100: #141414; --slate-50: #000000;
  --shadow-1: none; --shadow-2: 0 12px 30px -16px rgba(0,0,0,.9);
}
html[data-theme="dark"] body { background: #000; color: var(--text); }
html[data-theme="dark"] .app-header { background: #000 !important; box-shadow: inset 0 -1px 0 var(--amber) !important; }
html[data-theme="dark"] .card, html[data-theme="dark"] .dashboard-kpi { box-shadow: none; }
html[data-theme="dark"] :is(.section-title, .hero-title) { color: var(--amber); }
html[data-theme="dark"] .dashboard-kpi strong { color: #FFFFFF; }
html[data-theme="dark"] .dashboard-hero.dashboard-hero-ink { background: #050505 !important; border: 1px solid var(--amber); }
html[data-theme="dark"] .dashboard-hero-ink::before, html[data-theme="dark"] .dashboard-hero-ink::after { display: none; }
html[data-theme="dark"] .chal-hero, html[data-theme="dark"] .adm-head { background: #050505 !important; border: 1px solid #2A2A2A; }
@media (min-width: 701px) {
  html[data-theme="dark"] .side-nav { background: #000 !important; border: 1px solid #262626 !important; box-shadow: none !important; border-radius: var(--r-lg); }
  html[data-theme="dark"] .side-item { color: #BDBDBD; }
  html[data-theme="dark"] .side-item:hover { background: #141414; color: #fff; }
  html[data-theme="dark"] .side-pill { background: var(--amber) !important; box-shadow: none !important; border-radius: var(--r-sm); }
  html[data-theme="dark"] .side-item.active, html[data-theme="dark"] .side-item.active:hover { color: #000; }
  html[data-theme="dark"] .side-item.active::before { background: var(--amber); }
}
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { background: #0A0A0A; color: var(--text); border-color: #333; }
html[data-theme="dark"] ::placeholder { color: #6B6B6B; }
html[data-theme="dark"] ::selection { background: rgba(255,176,0,.3); }
html[data-theme="dark"] .mobile-tab-nav { background: rgba(0,0,0,.94) !important; border-top: 1px solid #262626 !important; }
html[data-theme="dark"] .mobile-tab-btn { color: #9A9A9A; }
html[data-theme="dark"] .mobile-tab-btn.active { color: var(--amber); background: #141414; }
html[data-theme="dark"] img.note-img, html[data-theme="dark"] .note-live-image-wrap img { background: #111; }

/* ---------- LIGHT (white) ---------- */
html[data-theme="light"] {
  color-scheme: light;
  --ink: #0A0A0A; --ink-2: #1F1F1F; --ink-3: #9A6400; --ink-tint: #FFF8E6; --ink-line: #F0E2C0;
  --purple: #FFB000; --purple-deep: #9A6400; --purple-soft: #FFC94D;
  --marigold: #FFB000; --marigold-deep: #E09B00; --marigold-tint: #FFF6D6;
  --paper: #F6F6F4; --surface: #FFFFFF; --line: #DEDCD6; --text: #111111; --muted: #5F5F5F;
  --indigo: #1F1F1F; --indigo-dark: #0A0A0A; --indigo-light: #FFF8E6;
}
html[data-theme="light"] .app-header { background: #0A0A0A !important; box-shadow: inset 0 -2px 0 var(--amber) !important; }
html[data-theme="light"] .dashboard-hero.dashboard-hero-ink { background: #0A0A0A !important; border: 1px solid #0A0A0A; }
html[data-theme="light"] .dashboard-hero-ink::after { display: none; }
html[data-theme="light"] .chal-hero, html[data-theme="light"] .adm-head { background: #0A0A0A !important; }
html[data-theme="light"] .card { box-shadow: none; }
@media (min-width: 701px) {
  html[data-theme="light"] .side-nav { background: #0A0A0A !important; border-color: #0A0A0A !important; }
  html[data-theme="light"] .side-pill { background: var(--amber) !important; }
}
html[data-theme="light"] .mobile-tab-btn.active { color: #0A0A0A; background: #FFF3CF; }

/* ---------- the switch ---------- */
.theme-switch { display: inline-flex; align-items: center; gap: .35rem; height: 2rem; padding: 0 .65rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.06); color: #fff; font: inherit; font-size: .74rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.theme-switch:hover { border-color: var(--amber, #FFB000); color: var(--amber, #FFB000); }
.theme-switch .ts-ico { font-size: .95rem; line-height: 1; }
html[data-theme] .theme-switch { border-radius: var(--r-sm); }
@media (max-width: 700px) { .theme-switch .ts-label { display: none; } .theme-switch { padding: 0 .5rem; } }
/* colour change is animated, except for people who asked for less motion */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease !important; }
@media (prefers-reduced-motion: reduce) { html.theme-anim, html.theme-anim * { transition: none !important; } }
.auth-theme-switch { position: absolute; top: max(1rem, env(safe-area-inset-top, 0px)); right: 1rem; z-index: 2; }

/* ---------- fixes found while auditing ---------- */
/* --slate-300 was never defined, so session cards took the text colour as their border */
html[data-theme="dark"] { --slate-300: #3A3A3A; }
html[data-theme="light"] { --slate-300: #CFCCC4; --slate-400: #767676; }
/* Session Analysis: the four day numbers sit side by side again (they were stacked) */
.analysis-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
@media (max-width: 700px) { .analysis-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* mono letters are wider: keep the sidebar labels inside the panel */
@media (min-width: 701px) {
  html[data-theme] .side-item { font-size: .9rem; }
}
/* login screen: quiet amber light at the top, not a flood */
html[data-theme="dark"] #auth-screen { background: radial-gradient(55% 45% at 50% 0%, rgba(255,176,0,.10), transparent 70%), #000 !important; }
html[data-theme="light"] #auth-screen { background: radial-gradient(55% 45% at 50% 0%, rgba(255,176,0,.16), transparent 70%), #F4F4F1 !important; }
html[data-theme="light"] .auth-card { border: 1px solid #DEDCD6; box-shadow: 0 20px 50px -30px rgba(0,0,0,.35); }
html[data-theme="dark"] .auth-card { border: 1px solid #2A2A2A; }
html[data-theme="light"] .auth-theme-switch { color: #111; border-color: #CFCCC4; background: #fff; }
html[data-theme] .btn-install { color: #0A0A0A !important; }
