/* cphr.css: the shared style sheet for C1 and B9 code (C1-21; EVE_DESIGN_v2_final.html, locked).
   Load it first, before any page's own sheet. docs/STYLE_GUIDE.md says how to use it.

   Modes: dark by default; the phone's appearance setting (prefers-color-scheme)
   chooses light. data-mode="dark" or data-mode="light" on <html> forces one
   (screenshots and tests only).

   Token names are the design's, exactly. Status text colours (--g-t, --a-t,
   --r-t) are for text on --bg or --card only: in light mode green and amber
   on --panel fall under 4.5:1. --track is decoration only and carries no
   meaning on its own.

   Fonts: IBM Plex Sans 400, 500, 600 and JetBrains Mono 400, from this site
   only (fonts/, Q90 DECIDED by Nick, COMMAND_182): the .woff2 files of the
   pinned Fontsource packages, under the SIL Open Font License 1.1
   (fonts/OFL.txt). Nothing is loaded from anywhere else. font-display: swap
   shows the system stack below until a file has arrived. */

@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }


:root {
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- tokens: dark (default) ---- */
:root, :root[data-mode="dark"] {
  color-scheme: dark;
  --bg: #0A1020; --card: #121A2C; --panel: #1B2438; --line: #2E3A54;
  --fg: #F3F5F8; --muted: #94A0B4; --track: #2E3A54; --tabind: #FFC928;
  --accent: #FFC928; --onaccent: #0A1020;
  --g: #3CCB7F; --a: #F2A33A; --r: #FF6B5E;
  --g-t: #3CCB7F; --a-t: #F2A33A; --r-t: #FF6B5E;
  /* derived, not design tokens: the light-mode borders and the segmented control */
  --edge: transparent; --seg-ground: var(--card); --seg-on: var(--panel);
}
/* ---- tokens: light ---- */
@media (prefers-color-scheme: light) {
  :root:not([data-mode="dark"]) {
    color-scheme: light;
    --bg: #F3F5F8; --card: #FFFFFF; --panel: #E7EBF1; --line: #D5DAE3;
    --fg: #0A1020; --muted: #4A5568; --track: #D5DAE3; --tabind: #0A1020;
    --accent: #FFC928; --onaccent: #0A1020;
    --g: #17804A; --a: #A65A00; --r: #C4352B;
    --g-t: #17804A; --a-t: #A65A00; --r-t: #C4352B;
    --edge: var(--line); --seg-ground: var(--panel); --seg-on: var(--card);
  }
}
:root[data-mode="light"] {
  color-scheme: light;
  --bg: #F3F5F8; --card: #FFFFFF; --panel: #E7EBF1; --line: #D5DAE3;
  --fg: #0A1020; --muted: #4A5568; --track: #D5DAE3; --tabind: #0A1020;
  --accent: #FFC928; --onaccent: #0A1020;
  --g: #17804A; --a: #A65A00; --r: #C4352B;
  --g-t: #17804A; --a-t: #A65A00; --r-t: #C4352B;
  --edge: var(--line); --seg-ground: var(--panel); --seg-on: var(--card);
}

[hidden] { display: none !important; }

/* ---- type ---- */
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
.title { font-size: 30px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0; }
.name17 { font-size: 17px; font-weight: 500; }
.secondary-text, .muted { color: var(--muted); }
.small { font-size: 13px; }
.lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.figure, .mono { font-family: var(--mono); }
.g-t { color: var(--g-t); } .a-t { color: var(--a-t); } .r-t { color: var(--r-t); }

/* ---- page frame: one column, at most 720 px ---- */
.cphr-page { max-width: 720px; margin: 0 auto; padding: 0 20px 112px; }
.topline { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 16px 0 20px; flex-wrap: wrap; }
.topline .date { color: var(--muted); font-size: 15px; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 17px; color: var(--fg); text-decoration: none; margin: 4px 0 8px; }
.subline { color: var(--muted); font-size: 14px; margin: 4px 0 20px; }

/* ---- card ---- */
.card { background: var(--card); border: 1px solid var(--edge); border-radius: 16px; padding: 16px; margin: 0 0 12px; }

/* ---- buttons: primary (the one accent on a screen), secondary, outline, link ---- */
.btn { font: inherit; font-size: 16px; font-weight: 500; min-height: 48px; min-width: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid transparent; background: var(--panel); color: var(--fg); cursor: pointer; display: inline-flex; align-items: center;
  justify-content: center; text-decoration: none; text-align: center; }
.btn.block { width: 100%; }
.btn.pri { background: var(--accent); color: var(--onaccent); font-weight: 600; }
.btn.sec { background: var(--panel); color: var(--fg); }
.btn.out { background: transparent; border-color: var(--line); color: var(--fg); }
.btn.out.sel, .btn.out[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-link { background: none; border: 0; color: var(--muted); font: inherit; font-size: 15px; min-height: 44px; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; }
.pair { display: flex; gap: 8px; margin: 0 0 12px; } .pair > .btn { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* ---- list row (64 px) and disclosure row ---- */
.listrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 64px; padding: 12px 0;
  border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.listrow .nm { font-size: 17px; font-weight: 500; }
.listrow .rs { font-size: 14px; color: var(--muted); }
.chev { color: var(--muted); font-size: 20px; padding-left: 12px; }
.disc { display: flex; justify-content: space-between; align-items: center; min-height: 52px; border-top: 1px solid var(--line);
  font-size: 16px; color: var(--fg); text-decoration: none; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0;
  padding: 0; font-family: inherit; cursor: pointer; }
.disc .chev { padding-left: 0; }

/* ---- segmented control ---- */
.seg { display: flex; background: var(--seg-ground); border: 1px solid var(--edge); border-radius: 10px; padding: 3px; margin: 0 0 16px; }
.seg > a, .seg > button { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; }
.seg > .on, .seg > [aria-current="page"] { background: var(--seg-on); color: var(--fg); font-weight: 600; }

/* ---- search field ---- */
.searchfield { height: 44px; border-radius: 12px; background: var(--card); border: 1px solid var(--edge); color: var(--fg); padding: 0 14px; font: inherit; font-size: 16px; }

/* ---- bottom tab bar (phone) ---- */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 3; display: flex; justify-content: space-around; background: var(--bg);
  border-top: 1px solid var(--line); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.tabbar a { flex: 1; min-height: 56px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted);
  text-decoration: none; border-top: 2px solid transparent; margin-top: -1px; }
.tabbar a.on, .tabbar a[aria-current="page"] { color: var(--fg); font-weight: 600; border-top-color: var(--tabind); }

/* ---- sticky compact bar ---- */
.compact { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; align-items: center; gap: 12px; padding: 8px 0 10px;
  border-bottom: 1px solid var(--line); }
.compact .t { font-size: 17px; font-weight: 600; }

/* ---- bottom sheet ---- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 720px; margin: 0 auto; max-height: 90vh; overflow-y: auto;
  background: var(--card); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line);
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); }
.grab { width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet .sheet-title { font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; border-top: 1px solid var(--line);
  font-size: 16px; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; color: var(--fg); font-family: inherit;
  padding: 0; text-align: left; cursor: pointer; }
.opt .muted { font-size: 14px; }
.opt.sel, .opt[aria-checked="true"] { font-weight: 600; }
.mini { display: flex; gap: 8px; } .mini .btn { min-height: 44px; padding: 0 16px; font-size: 15px; }

/* ---- ring and mix dots ---- */
.ring { display: block; flex: 0 0 auto; }
.ringbox { display: block; flex: 0 0 auto; }
.ring .rn { fill: var(--fg); font-family: var(--sans); }
.ring .rs2 { fill: var(--muted); font-family: var(--sans); }
.hero { display: flex; gap: 20px; align-items: center; margin: 0 0 24px; }
.hero .big { font-size: 22px; font-weight: 600; }
.mix { font-size: 13px; color: var(--muted); white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 4px 0 6px; }
.mix .dot:first-child { margin-left: 0; }
.dot.g { background: var(--g); } .dot.a { background: var(--a); } .dot.r { background: var(--r); }

/* ---- team card and broker row ---- */
.tcard .thead { display: flex; gap: 14px; align-items: center; }
.tcard .thead > .tmain { flex: 1; min-width: 0; }
.tcard .tname { font-size: 17px; font-weight: 600; color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.tcard .tfig { font-size: 15px; }
.tcard .fold { min-width: 44px; min-height: 44px; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
.brow { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.brow .bn { flex: 1; min-width: 0; }
.brow .nm { font-size: 16px; font-weight: 500; }
.teamgrid { display: block; }
@media (min-width: 1024px) {
  .teamgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
  .teamgrid > .card { margin: 0; }
}

/* ---- message panel ---- */
.msgpanel .msgtext { margin: 0 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msgpanel .subj { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.msgpanel textarea.msgedit { width: 100%; min-height: 160px; border: 2px solid var(--fg); border-radius: 12px; padding: 12px; font: inherit;
  font-size: 16px; background: var(--card); color: var(--fg); margin: 0 0 12px; }
.msgpanel input.msgsubject { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; font: inherit;
  background: var(--card); color: var(--fg); margin: 0 0 8px; }

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.tcard a.chev { text-decoration: none; display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; justify-content: center; }
