/* Conductor brand layer. Tokens mirror /brand/conductor-tokens.css (deep surface). */
:root {
  --c-deep: #0E2A33;
  --c-surface: #13323C;
  --c-surface-soft: #1C4652;
  --c-border: #23434B;
  --c-border-subtle: #1A3A44;
  --c-ink: #DCEBEA;
  --c-white: #FFFFFF;
  --c-muted: #8FA3A8;
  --c-teal: #1F7A7A;
  --c-teal-bright: #3BAFB0;
  --c-mist: #DCEBEA;
  --c-sage: #2A4A53;
  --c-fog: #3D5A62;
  --c-ochre: #E8B13A;
  --c-rust: #E07A62;
  --c-grid: #1A3A44;
  --c-discharge: #DCEBEA;
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: dark;
}

body { font-family: var(--font-body); background: var(--c-deep); color: var(--c-ink); }
h1, h2, h3, .font-display { font-family: var(--font-display); letter-spacing: -0.01em; }
.font-mono, code, kbd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
::selection { background: var(--c-teal-bright); color: var(--c-deep); }
:focus-visible { outline: 2px solid var(--c-teal-bright); outline-offset: 2px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--c-deep); }
::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-fog); }

.brand-icon { width: 1.1em; height: 1.1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
.eyebrow { font: 700 11px/1.3 var(--font-body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-teal-bright); }

/* Brand bar */
.brand-bar { background: #0A2129; border-bottom: 1px solid var(--c-border); }
.brand-lockup { display: flex; align-items: center; gap: 12px; color: var(--c-white); text-decoration: none; }
.brand-lockup img { width: 34px; height: auto; display: block; }
.brand-lockup b { font: 700 19px/1 var(--font-display); letter-spacing: -0.01em; display: block; }
.brand-lockup small { font-size: 11.5px; color: var(--c-mist); display: block; margin-top: 3px; }

/* Daily brief: plain-English plan */
.brief-plan { background: var(--c-surface); border: 2px solid var(--c-teal-bright); border-radius: 12px; padding: 24px; display: grid; gap: 16px; min-width: 0; }
.brief-plan h3 { color: var(--c-white); font-size: 20px; line-height: 1.25; font-weight: 700; text-wrap: balance; }
.brief-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.brief-steps li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: baseline; color: var(--c-white); font-size: 14px; }
.brief-steps .when { font: 500 13px/1.4 var(--font-mono); color: var(--c-teal-bright); }
.brief-values { display: flex; gap: 28px; flex-wrap: wrap; border-top: 1px solid var(--c-border); padding-top: 14px; }
.brief-values div { display: grid; gap: 2px; }
.brief-values .num { font: 500 22px/1.2 var(--font-mono); color: var(--c-white); }
.brief-values small { font-size: 12px; color: var(--c-mist); }
.brief-note { font-size: 12px; color: var(--c-muted); }

.brief-chart { display: block; width: 100%; min-width: 640px; height: auto; }
.brief-chart text { font-family: var(--font-body); font-size: 11px; fill: var(--c-muted); }
.brief-chart .mono-t { font-family: var(--font-mono); }
.brief-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--c-muted); }
.brief-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.batt-strip { display: grid; grid-template-columns: repeat(var(--n, 48), 1fr); gap: 2px; min-width: 0; }
.batt-strip span { height: 22px; border-radius: 2px; background: var(--c-sage); }
.batt-strip span.c { background: var(--c-teal-bright); }
.batt-strip span.d { background: var(--c-discharge); }
.batt-axis { display: flex; justify-content: space-between; min-width: 0; font: 400 11px/1 var(--font-mono); color: var(--c-muted); margin-top: 6px; }

@media (max-width: 640px) {
  .brief-steps li { grid-template-columns: 1fr; gap: 2px; }
  .brief-plan { padding: 20px; }
}

/* Keep tab strips inside narrow screens */
div:has(> .endpoint-tab), div:has(> .persona-tab) { max-width: 100%; overflow-x: auto; scrollbar-width: none; }

/* Header ribbon: clean text, no boxes */
.ribbon .brand-icon { width: 16px; height: 16px; }

/* Plan + accuracy row */
.brief-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
.brief-acc { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 8px; padding: 24px; display: grid; gap: 16px; align-content: start; min-width: 0; }
.brief-acc h3 { color: var(--c-white); font-size: 17px; font-weight: 700; margin-top: 6px; }
.acc-list { display: grid; gap: 14px; }
.acc-row { display: grid; grid-template-columns: 104px 1fr; gap: 12px; align-items: baseline; }
.acc-row .num { font: 400 24px/1.2 var(--font-mono); color: var(--c-teal-bright); }
.acc-row p { font-size: 13px; color: var(--c-muted); margin: 0; }
.acc-row p b { color: var(--c-white); font-weight: 600; display: block; }

/* 24-hour KPI strip: one bordered row, divided cells, clean type */
.kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 8px; }
.kpi { padding: 20px 22px; display: grid; gap: 4px; align-content: start; border-left: 1px solid var(--c-border-subtle); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-label { font-size: 13px; color: var(--c-muted); }
.kpi-num { font: 400 28px/1.15 var(--font-mono); color: var(--c-white); font-variant-numeric: tabular-nums; }
.kpi-num small { font-size: 13px; color: var(--c-muted); margin-left: 4px; }
.kpi-note { font-size: 13px; color: var(--c-muted); }
.kpi-note.kpi-gap { color: var(--c-rust); font-weight: 600; }

@media (max-width: 900px) {
  .brief-top { grid-template-columns: minmax(0, 1fr); }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--c-border-subtle); }
}
@media (max-width: 560px) {
  .kpi { padding: 16px; }
  .kpi-num { font-size: 22px; }
}

/* View tabs in the top bar, underlined like the preview */
.tabs-row { border-top: 1px solid var(--c-border); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs .tab { appearance: none; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--c-mist); font: 500 14px/1 var(--font-body); padding: 14px 14px 12px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; transition: color 120ms, border-color 120ms; }
.tabs .tab .brand-icon { width: 16px; height: 16px; color: var(--c-muted); }
.tabs .tab:hover { color: var(--c-white); }
.tabs .tab[aria-selected="true"] { color: var(--c-white); border-bottom-color: var(--c-teal-bright); }
.tabs .tab[aria-selected="true"] .brand-icon { color: var(--c-teal-bright); }

/* ---------------------------------------------------------------------------
   Light theme: follows the OS setting. The top bar stays deep in both themes.
   --------------------------------------------------------------------------- */
@media (prefers-color-scheme: light) {
  :root {
    --c-deep: #F6F8F7;
    --c-surface: #FFFFFF;
    --c-surface-soft: #DCEBEA;
    --c-border: #C4C6C5;
    --c-border-subtle: #E4E6E5;
    --c-ink: #14262C;
    --c-white: #0E2A33;
    --c-muted: #4A5A60;
    --c-teal-bright: #1F7A7A;
    --c-mist: #4A5A60;
    --c-sage: #C9D6D5;
    --c-fog: #B0BCBB;
    --c-ochre: #D49A1E;
    --c-rust: #9A3F2C;
    --c-grid: #E4E6E5;
    --c-discharge: #0E2A33;
    color-scheme: light;
  }
  /* Charts drawn with fixed dark-theme colours in js/conductor.js and js/daily-brief.js */
  svg [stroke="#23434B"], svg [stroke="#1A3A44"] { stroke: #E4E6E5; }
  svg [stroke="#0E2A33"], svg [stroke="#13323C"] { stroke: #FFFFFF; }
  svg [fill="#13323C"] { fill: #FFFFFF; }
  svg [fill="#8FA3A8"] { fill: #4A5A60; }
  svg [fill="#DCEBEA"] { fill: #0E2A33; }
  svg [stroke="#DCEBEA"] { stroke: #0E2A33; }
  svg [stroke="#3BAFB0"] { stroke: #1F7A7A; }
  svg [fill="#E07A62"] { fill: #9A3F2C; }
  svg [stroke="#E07A62"] { stroke: #9A3F2C; }
  svg [stroke="#E8B13A"] { stroke: #D49A1E; }
  svg [fill="#8DB4CC"] { fill: #557A92; }
  .brief-plan { border-color: #1F7A7A; }
}
/* Re-assert the deep tokens inside the top bar */
.theme-dark {
  --c-deep: #0E2A33; --c-surface: #13323C; --c-surface-soft: #1C4652; --c-border: #23434B; --c-border-subtle: #1A3A44;
  --c-ink: #DCEBEA; --c-white: #FFFFFF; --c-muted: #8FA3A8; --c-teal-bright: #3BAFB0; --c-mist: #DCEBEA;
  color-scheme: dark;
}
