/* theme.css — the portal's light theme, and the Light/Dark toggle.
 *
 * Every rule here is scoped to :root[data-theme="light"], which theme.js sets
 * unless a reader has chosen dark (light is the default). Dark is untouched: with
 * data-theme="dark" nothing below applies except the toggle's own styles at the
 * bottom.
 *
 * The palette is not written here. theme.js derives it from the tenant's
 * light_base, dark_base and accent_color and sets it inline as --lt-* on <html>;
 * this file maps the two token families the portal already has onto it:
 *   - the home page (index.html): --bg, --surface*, --border*, --text, --muted*
 *   - every other screen (copied from the brand-screen mockup): --ink, --panel*,
 *     --line*, --fg*, and the four state hues
 * :root[data-theme] outranks the pages' own :root blocks, so the order of the
 * stylesheets does not matter for the tokens.
 *
 * Accent: --accent is the dark_base action colour in light mode (theme.js), so
 * every link, button and active state that already reads --accent turns navy
 * with no rule here. The tenant's accent survives as --lt-hl, used only where
 * it is not text and not behind light text: the active-tab mark, the tenant
 * badge, the "you" chip, the own-row highlight.
 */

/* ── tokens ──────────────────────────────────────────────────────────────── */
:root[data-theme="light"]{
  color-scheme:light;

  /* the brand screens */
  --ink:var(--lt-bg); --panel:var(--lt-panel); --panel-2:var(--lt-panel-2);
  --line:var(--lt-line); --line-soft:var(--lt-line-soft);
  --fg:var(--lt-fg); --fg-2:var(--lt-fg-2); --fg-3:var(--lt-fg-3);
  --fg-4:var(--lt-fg-4); --dim:var(--lt-dim);
  --amber:var(--lt-amber); --clay:var(--lt-clay); --sage:var(--lt-sage); --violet:var(--lt-violet);

  /* the home page */
  --bg:var(--lt-bg); --bg-2:var(--lt-input);
  --surface:var(--lt-panel); --surface-2:var(--lt-panel-2); --surface-3:var(--lt-raised);
  --border:var(--lt-line); --border-strong:var(--lt-line-strong);
  --text:var(--lt-fg); --muted:var(--lt-fg-2); --muted-2:var(--lt-fg-3);
  --ok:var(--lt-ok); --warn:var(--lt-warn);

  /* Until the page script has set it inline from the tenant. */
  --accent:var(--lt-act); --accent-soft:var(--lt-act-soft);
}

/* ── breathing room ─────────────────────────────────────────────────────────
   Same layout, same fonts: only the space inside and between the blocks grows,
   by a few pixels each, and the body copy gets a little more leading. */
[data-theme="light"] body{line-height:1.6}
[data-theme="light"] .shell main section{margin-top:40px}
[data-theme="light"] .lanes,
[data-theme="light"] .states,
[data-theme="light"] .cat,
[data-theme="light"] .cad,
[data-theme="light"] .contrast,
[data-theme="light"] .pairs{gap:16px}
[data-theme="light"] .lane{padding:17px 18px}
[data-theme="light"] .st{padding:18px 19px}
[data-theme="light"] .cat .c,
[data-theme="light"] .cad .c{padding:17px 19px}
[data-theme="light"] .contrast .side{padding:19px 21px}
[data-theme="light"] .pair > div{padding:15px 18px}
[data-theme="light"] .fp{padding:18px 0}
[data-theme="light"] .totals{padding:15px 18px}
[data-theme="light"] .angle{padding:19px 21px}

[data-theme="light"] .page-head{margin-bottom:36px}
[data-theme="light"] .plan-strip{padding:24px 28px}
[data-theme="light"] .actions,
[data-theme="light"] .report-grid{gap:22px}
[data-theme="light"] .action-card,
[data-theme="light"] .starthere{padding:30px 28px 28px}
[data-theme="light"] .report-card{padding:26px 26px 24px}

/* ── shared chrome: top bar and rail ─────────────────────────────────────── */
/* The current page: navy text on a faint navy ground, marked by the tenant's
   accent. The accent bar is the only place the rail shows the tenant colour. */
[data-theme="light"] .rail a.on{background:var(--lt-act-soft);border-left-color:var(--lt-hl)}
[data-theme="light"] .rail a:not(.off):hover{background:var(--lt-act-soft)}
[data-theme="light"] .top .home{background:var(--lt-input)}
[data-theme="light"] .top .home:hover{background:var(--lt-act-soft)}
/* The tenant badge, in the tenant's colour. */
[data-theme="light"] .who{background:var(--lt-hl-fill);border-color:var(--lt-hl-fill);color:var(--lt-hl-ink)}

/* ── links that wore the mockup's amber ─────────────────────────────────────
   Navy, with a soft navy underline in place of the dark-only #4A3A25. */
[data-theme="light"] .st .go,
[data-theme="light"] .fp .go,
[data-theme="light"] .reportout .go,
[data-theme="light"] .more{color:var(--accent);border-bottom-color:var(--lt-act-line)}
[data-theme="light"] .ev .path{color:var(--accent)}
[data-theme="light"] .pageout a:hover{color:var(--accent);border-color:var(--lt-act-line)}
/* brand.js writes this one inline. */
[data-theme="light"] a[style*="--amber"]{color:var(--accent)!important}

/* ── state chips and banners: dark-only literals, re-derived ─────────────── */
[data-theme="light"] .e-live,
[data-theme="light"] .s-approved{border-color:var(--lt-sage-line);background:var(--lt-sage-bg)}
[data-theme="light"] .e-part,
[data-theme="light"] .s-in_review{border-color:var(--lt-amber-line);background:var(--lt-amber-bg)}
[data-theme="light"] .s-revision_requested{border-color:var(--lt-clay-line);background:var(--lt-clay-bg)}
[data-theme="light"] .flash.err{border-color:var(--lt-clay-line);background:var(--lt-clay-bg)}
[data-theme="light"] .tag.cutflag{border-color:var(--lt-clay-line)}
[data-theme="light"] .angle.opens:hover,
[data-theme="light"] .tg:hover{border-color:var(--lt-line-strong)}

/* position.html: the brand's own row and its "you" chip. */
[data-theme="light"] .gap-row.self{background:var(--lt-hl-soft)}
[data-theme="light"] .you{background:var(--lt-hl-fill);color:var(--lt-hl-ink)}

/* board.html: the enlarged still keeps its dark surround, so its caption stays
   light. */
[data-theme="light"] .zoom-cap{color:#fff}

/* ── home page ───────────────────────────────────────────────────────────── */
/* A calm ground: the page colour, flat, with no glow and no grain. */
[data-theme="light"] body::before{background:var(--lt-bg)}
[data-theme="light"] body::after{display:none}
[data-theme="light"] .login-card{background:var(--lt-panel);box-shadow:0 24px 60px -32px color-mix(in srgb,var(--lt-fg) 35%,transparent)}
[data-theme="light"] .login-err{color:var(--lt-clay)}
/* The active tab: navy text, an underline in the tenant's accent. */
[data-theme="light"] .navlinks button.on{box-shadow:inset 0 -2px 0 var(--lt-hl)}
[data-theme="light"] .action-card::before{background:var(--lt-hl)}
[data-theme="light"] .badge.s-revision_requested{color:var(--lt-rev);background:var(--lt-rev-bg);border-color:var(--lt-rev-line)}

/* ── text: black, with grey for labels and metadata ───────────────────────
   The tokens do most of it: --fg and --fg-2 (--text and --muted on the home
   page) are #000, --fg-3 (--muted-2) is the label grey. These rules move the
   handful of elements whose token does not match what they are: sentences that
   sat on the label grey, figures that inherited it from their caption, labels
   that sat on a prose token, and links and buttons that took the text colour
   rather than the action colour. */

/* Sentences and figures that were on the label grey. */
[data-theme="light"] .note,
[data-theme="light"] .note b,
[data-theme="light"] .datause,
[data-theme="light"] .cad .c p,
[data-theme="light"] .totals div b{color:var(--fg)}

/* Labels and metadata that were on a prose token. */
[data-theme="light"] .angle .fmt,
[data-theme="light"] .bhead .tag,
[data-theme="light"] .ln b,
[data-theme="light"] .boards .m,
[data-theme="light"] .report-card .et,
[data-theme="light"] .stamp[style*="--fg-2"]{color:var(--fg-3)!important}

/* Figures that wore the accent: black like every other figure. */
[data-theme="light"] .stat .n .accent,
[data-theme="light"] .stat .n.accent{color:var(--fg)}

/* Links and buttons: navy. */
[data-theme="light"] .top .home,
[data-theme="light"] .pageout a,
[data-theme="light"] .navlinks button,
[data-theme="light"] .btn.secondary,
[data-theme="light"] .btn.ghost{color:var(--accent)}
[data-theme="light"] .signout{color:var(--accent)!important}
[data-theme="light"] .top .theme-toggle{color:var(--accent)}

/* ── the toggle ─────────────────────────────────────────────────────────────
   On the home page it is one of the nav buttons and takes their styles. On
   every other screen it is dressed like the ← Portal control beside it, in the
   quiet line colour rather than the accent, since it is a preference and not a
   way somewhere. Both themes. */
.theme-toggle{display:inline-flex;align-items:center;gap:6px;cursor:pointer}
.theme-toggle svg{flex:none}
.top .theme-toggle{font-family:var(--mono);font-size:11px;color:var(--fg);background:var(--ink);
  border:1px solid var(--line);border-radius:3px;padding:3px 9px;line-height:1.5}
.top .theme-toggle:hover{border-color:var(--fg-3)}
.theme-toggle:focus-visible{outline:2px solid var(--accent,var(--amber));outline-offset:2px}
/* Phones: icon only (the label stays for screen readers) and as little padding
   as a tap target allows. Both bars were already wider than a 390px screen
   before the toggle; this keeps what it adds to that as small as it can be. */
@media (max-width:560px){
  .theme-toggle{gap:0}
  .theme-toggle .tt-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  .navlinks .theme-toggle{padding:8px 6px}
  .top .theme-toggle{padding:4px 5px}
}
