/* Practice: the brand book's look (docs/brand/brand-book.html). Tokens first, then the page base, cards, messages, forms.
   Pieces (keys, tags, pips, avatar, icons) are in brand.css; the app frame (sidebar, top bars) in frame.css.
   TOKENS: use the brand names in new CSS. The old names below are aliases that keep older CSS working.
     new code        old alias (do not use in new code)
     --paper         --surface        --mist  --page, --soft        --line-2  --line2        --faint  --line3
     --ink           --accent (ink: links, active, bars)            --stuck-ink  --no        --pass-ink  --ok
     --going-ink     --wait (a waiting or hint tint)                --r-s  --r-sm            --r-l  --r-lg
   Yellow (--sun) is only the next move: a key fill with ink text, never text colour, never a status. */
:root {
  /* brand: ink and neutrals */
  --ink: #16132D; --ink-2: #2B2748; --ink-3: #423E66; --muted: #5B5873; --faint: #8D8AA6;
  --paper: #FFFFFF; --mist: #F4F3FA; --mist-2: #ECEAF5; --line: #E3E1EE; --line-2: #CDCADF;
  /* brand: sun, the next move only */
  --sun: #FFC933; --sun-hi: #FFD75E; --sun-edge: #DB9A00; --sun-soft: #FFF4CF; --sun-ink: #5C4100;
  /* brand: status (a colour, an icon and a word) */
  --pass: #12A871; --pass-ink: #0A6B48; --pass-soft: #E2F6ED;
  --stuck: #FF5B45; --stuck-ink: #B42C18; --stuck-soft: #FFEAE6;
  --going: #3D5AFE; --going-ink: #2A3FC4; --going-soft: #E9EDFF;
  /* brand: type, shape, edge */
  --display: 'Gabarito', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --text: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --r-s: 8px; --r: 12px; --r-l: 18px; --r-xl: 28px; --edge: 4px;

  /* aliases for the old names (same meaning, brand values) */
  --page: var(--mist); --surface: var(--paper); --soft: var(--mist); --line2: var(--line-2); --line3: var(--faint);
  --accent: var(--ink); --accent-ink: #fff; --accent-hover: var(--ink-2); --accent-soft: var(--mist-2); --accent-line: var(--line-2);
  --ok: var(--pass-ink); --ok-bg: var(--pass-soft); --ok-line: #A9E2CB;
  --no: var(--stuck-ink); --no-bg: var(--stuck-soft); --no-line: #FFC4BA;
  --wait: var(--going-ink); --wait-bg: var(--going-soft); --wait-line: #C5CFFF;
  --font: var(--text);
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 30px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: var(--r-s); --r-lg: var(--r-l); --r-pill: 999px;
  --shadow: none; --shadow-lg: 0 12px 32px rgba(22, 19, 45, .2);
  --ring: 0 0 0 3px var(--going-soft);
  --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--mist); color: var(--ink); font: 400 var(--fs-md)/1.5 var(--text); -webkit-font-smoothing: antialiased; }
h1 { font: 800 var(--fs-2xl)/1.1 var(--display); letter-spacing: -.015em; margin: var(--s1) 0 var(--s2); }
h2 { font: 700 var(--fs-lg)/1.25 var(--display); margin: 0 0 var(--s2); }
h3 { font: 700 var(--fs-sm)/1.3 var(--display); margin: var(--s5) 0 var(--s2); }
p { margin: 0 0 var(--s3); }
a { color: var(--ink); text-underline-offset: 2px; }
a:hover { color: var(--ink-3); }
code { font: var(--fs-sm) var(--mono); }
.dim { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.ic { vertical-align: -3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--going); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* loading: a quiet spinner */
.loading { display: flex; align-items: center; justify-content: center; gap: var(--s3); padding: var(--s7) var(--s4); color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.wrap { max-width: 1120px; margin: 0 auto; padding: var(--s5) var(--s5) var(--s7); }
.wrap.wide { padding-top: var(--s4); }
.center { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.pane { animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-h { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s5); margin-bottom: var(--s4); }
.page-h h1 { margin-bottom: var(--s1); }
.crumbs { display: flex; flex-wrap: nowrap; align-items: center; gap: 0 var(--s2); min-width: 0; font-size: var(--fs-sm); margin-bottom: var(--s2); color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 32px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs > * { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .sep { color: var(--faint); flex: 0 0 auto; }
.crumbs > :last-child { flex: 0 0 auto; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.crumbs span:last-child:not(.sep) { color: var(--ink); }
.goal { color: var(--muted); max-width: 70ch; margin-bottom: var(--s3); }
.meta { color: var(--muted); font-size: var(--fs-sm); margin: 0 0 var(--s3); }

/* cards: white, one hairline, big radius, no shadow */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: 22px; margin-bottom: var(--s4); }
.card > h2:first-child { margin-bottom: var(--s3); }
.card.narrow { max-width: 520px; margin: var(--s6) auto; }

/* messages: a note (neutral), a banner (good news), an alert (error), an empty state */
.note { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-l); padding: var(--s4) var(--s5); color: var(--muted); margin-top: var(--s4); }
.note.bad, .alert { background: var(--stuck-soft); border: 1px solid var(--no-line); color: var(--stuck-ink); border-radius: var(--r); padding: var(--s3) var(--s4); margin-top: var(--s3); font-weight: 600; }
.banner { display: flex; align-items: center; gap: var(--s2); border-radius: var(--r-l); padding: var(--s3) var(--s4); margin-bottom: var(--s4); font-weight: 600; }
.banner.ok { background: var(--pass-soft); color: var(--pass-ink); border: 1px solid var(--ok-line); }
.empty { text-align: center; padding: var(--s6) var(--s4); background: var(--paper); border: 1px dashed var(--line-2); border-radius: var(--r-l); margin-top: var(--s4); }
.empty h2 { margin-bottom: var(--s1); }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto var(--s4); }
.empty .btn { margin-top: var(--s1); }
.tablewrap > .empty { margin: 0; border: 0; }

/* forms */
.fld { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-sm); color: var(--ink); font-weight: 600; flex: 1 1 200px; }
.fld > span { color: var(--muted); font-weight: 600; font-size: var(--fs-sm); }
.fld input, .fld select, .input { min-height: var(--tap); padding: var(--s2) var(--s3); border: 1.5px solid var(--line-2); border-radius: var(--r); background: var(--paper); color: var(--ink); font: var(--fs-md) var(--text); width: 100%; }
.fld input::placeholder { color: var(--faint); }
.fld input:hover, .fld select:hover { border-color: var(--faint); }
.fld input:focus-visible, .fld select:focus-visible { border-color: var(--going); outline: 3px solid var(--going); outline-offset: 0; }
.fld .hint { font-weight: 400; font-size: var(--fs-xs); color: var(--muted); }
