/* Coach Brain member PWA — Editorial Minimal (DESIGN.md locked tokens).
   Mobile-first phone PWA. Light-only: DESIGN.md's locked token set is light;
   dark is not defined there, so we do not invent it. */

:root {
  --bg-base: #FFFFFF;
  --bg-subtle: #FAFAFA;
  --bg-muted: #F4F4F5;
  --fg-base: #09090B;
  --fg-muted: #52525B;
  --fg-subtle: #71717A;
  --border: #E4E4E7;
  --accent: #4F46E5;

  --grad-peach: linear-gradient(135deg, #FFF4EC 0%, #FEE7D6 100%);
  --grad-mint: linear-gradient(135deg, #ECFDF3 0%, #D1F4DD 100%);
  --grad-sky: linear-gradient(135deg, #EEF4FF 0%, #DCE7FF 100%);
  --grad-lavender: linear-gradient(135deg, #F3EEFF 0%, #E2D6FB 100%);
  --grad-rose: linear-gradient(135deg, #FFF1F4 0%, #FDDDE3 100%);
  --grad-pulse: linear-gradient(90deg, #FAFAFA 0%, #F3EEFF 50%, #FAFAFA 100%);

  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Fraunces", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-subtle);
  color: var(--fg-base);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; }

/* ---------- app shell ---------- */
.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar .who {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-subtle);
}

.screen { padding: 20px; display: none; }
.screen.active { display: block; }

/* ---------- login ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px;
  max-width: 640px;
  margin: 0 auto;
}
.auth-hero {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.auth-sub { color: var(--fg-muted); margin-bottom: 28px; }

form { margin: 0; }
.field { margin-bottom: 16px; }
label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
/* C-031: date/number/time were never styled — only email/password were — so the goal
   modal has been rendering browser-default controls against DESIGN.md's "inputs 38px,
   1px border, accent focus ring". Adding `time` to that list would have made the new
   field the only styled one in the modal, so the rule now covers every type the modal
   actually uses. */
input[type="date"], input[type="number"], input[type="time"] {
  width: 100%; height: 38px; padding: 0 10px;
  font-family: var(--font-mono); font-size: 14px;
  color: var(--fg-base); background: var(--bg-base);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none;
}
/* Free text, in the modal shape DESIGN.md specifies (38px, 1px border, accent focus ring).
   There was NO `input[type="text"]` rule at all until C-035 — the rule above covers date /
   number / time, so the goal modal's "Tên giải" and the new injury's "Đau ở đâu?" were both
   falling back to the browser's default ~170px box. Body font, not mono: this is prose the
   athlete types, not a machine-shaped value. */
input[type="text"] {
  width: 100%; height: 38px; padding: 0 10px;
  font-family: var(--font-body); font-size: 15px;
  color: var(--fg-base); background: var(--bg-base);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  outline: none;
}

.hint { margin-top: 6px; font-size: 12px; color: var(--fg-subtle); }

input[type="email"], input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--fg-base);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-body);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}
.btn-primary { background: var(--fg-base); color: #fff; }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: var(--bg-base); color: var(--fg-base); border-color: var(--border); }
.btn-ghost:active { background: var(--bg-muted); }
.btn:disabled { opacity: 0.5; cursor: default; }

.auth-toggle {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
}
.auth-toggle a { color: var(--accent); cursor: pointer; text-decoration: none; }

.notice {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--fg-muted);
}
.notice.error { background: var(--grad-rose); border-color: #FDDDE3; color: #9F1239; }
.notice.hidden { display: none; }

/* ---------- pulse strip ---------- */
.pulse {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: baseline;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--grad-pulse);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.pulse .metric { display: flex; flex-direction: column; }
.pulse .metric .val {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.pulse .metric .val.mono { font-family: var(--font-mono); font-size: 18px; }
.pulse .metric .lbl {
  font-size: 11px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- sync banner ---------- */
.sync-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  margin-bottom: 16px;
  color: var(--fg-muted);
}
.sync-banner.ok { background: var(--bg-subtle); }
.sync-banner.stale { background: var(--grad-peach); border-color: #FEE7D6; color: #9A3412; }
.sync-banner .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sync-banner.ok .dot { background: #16A34A; }
.sync-banner.stale .dot { background: #EA580C; }
.sync-banner .reconnect { margin-left: auto; color: var(--accent); font-weight: 500; }
.sync-banner time { font-family: var(--font-mono); }

/* ---------- section ---------- */
.section { margin-bottom: 22px; }
.section > h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

/* ---------- hero action cards ---------- */
.hero-cards { display: grid; gap: 12px; }
.hero-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  transition: transform 0.1s, box-shadow 0.1s;
}
.hero-card:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(9,9,11,0.06); }
.hero-card.lavender { background: var(--grad-lavender); }
.hero-card.sky { background: var(--grad-sky); }
.hero-card .hc-title { font-family: var(--font-serif); font-size: 19px; font-weight: 600; }
.hero-card .hc-sub { font-size: 13px; color: var(--fg-muted); }

/* ---------- decision card ---------- */
.decision {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-base);
}
.decision .verdict {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.decision .verdict .word {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.decision .reason { color: var(--fg-muted); font-size: 14px; }
.decision .caps {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-muted);
}
.decision .caps span strong { color: var(--fg-base); }

/* tier badge */
.tier {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.tier.A { background: var(--grad-rose); border-color: #FDDDE3; color: #9F1239; }
.tier.B { background: var(--grad-mint); border-color: #D1F4DD; color: #166534; }
.tier.C { background: var(--grad-sky); border-color: #DCE7FF; color: #3730A3; }

/* ---------- rows / lists ---------- */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-base);
}
.row .row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .row-title { font-weight: 500; }
.row .row-sub { font-size: 12px; color: var(--fg-subtle); font-family: var(--font-mono); }
.row .row-val { font-family: var(--font-mono); font-size: 13px; color: var(--fg-muted); text-align: right; white-space: nowrap; }
.row .row-date { font-family: var(--font-mono); font-size: 12px; color: var(--fg-subtle); }

/* correlations */
.corr .row-title { font-weight: 400; font-size: 14px; }
.corr .r-val { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.corr .r-val.pos { color: #166534; }
.corr .r-val.neg { color: #9F1239; }

/* ---------- empty state ---------- */
.empty {
  padding: 22px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  color: var(--fg-subtle);
  font-size: 14px;
  background: var(--bg-subtle);
}

/* ---------- modal (check-in) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9,9,11,0.4);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-backdrop.active { display: flex; }
.modal {
  width: 100%;
  max-width: 640px;
  background: var(--bg-base);
  border-radius: 18px 18px 0 0;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 641px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 18px; }
}
.modal .m-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.modal .m-title { font-family: var(--font-serif); font-size: 22px; font-weight: 600; }
.modal .m-close {
  border: none; background: none; cursor: pointer;
  color: var(--fg-subtle); width: 32px; height: 32px; border-radius: 8px;
}
.modal .m-close:hover { background: var(--bg-muted); }
.modal .m-sub { color: var(--fg-muted); font-size: 13px; margin-bottom: 18px; }

.q { margin-bottom: 20px; }
.q .q-text { font-weight: 500; margin-bottom: 10px; }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-base);
  font-size: 14px;
  transition: border-color 0.1s, background 0.1s;
}
.opt:hover { background: var(--bg-muted); }
.opt.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); background: var(--bg-base); }
.opt .opt-pen { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); }

/* Sticky so the primary action stays reachable while the form scrolls under it — with a goal
   that has a verdict panel the modal overflows by ~136px even on a desktop viewport, and far
   more on a phone. `z-index` is not decoration: a sticky element with no stacking order can be
   painted over by later siblings that create their own context, which is how a pinned savebar
   ends up invisible on exactly the screens that need it most. */
.savebar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 8px -20px -20px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg-base);
  border-top: 1px solid var(--border);
}

.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; flex: none; }
.center-note { text-align: center; color: var(--fg-subtle); font-size: 13px; padding: 40px 0; }
.foot { text-align: center; color: var(--fg-subtle); font-size: 12px; padding: 18px 0 28px; }
.foot a { color: var(--accent); cursor: pointer; }

/* ---------- injury banner (C-018) ---------- */
.injury-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
  background: var(--bg-subtle);
  color: var(--fg-muted);
}
.injury-banner.hidden { display: none; }
.injury-banner strong { color: var(--fg-base); font-weight: 500; }
.injury-banner .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; }
.injury-banner.active { background: var(--grad-peach); border-color: #FEE7D6; color: #9A3412; }
.injury-banner.active .dot { background: #EA580C; }
.injury-banner.active strong { color: #7C2D12; }
.injury-banner.clear .dot { background: #16A34A; }

/* ---------- injury card (C-034) ---------- */
/* Replaces the read-only C-018 banner. Deliberately NOT a gradient hero: DESIGN.md keeps
   gradients for hero surfaces, and a permanent alarm-coloured block at the top of the page
   stops being read after the second day. */
.injury-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-base);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.injury-card.hidden { display: none; }
.injury-card .ic-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 10px;
}
.injury-card .ic-title {
  font-family: var(--font-serif); font-size: 17px; font-weight: 600; color: var(--fg-base);
}
.injury-card .ic-head .link-btn { padding: 0; flex: none; }
.injury-card .ic-sub { font-size: 13px; line-height: 1.55; color: var(--fg-muted); }
.injury-card .ic-grid { display: grid; gap: 6px; }
.injury-card .ic-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.injury-card .ic-line .k { color: var(--fg-muted); flex: none; }
.injury-card .ic-line .v { color: var(--fg-base); text-align: right; }
/* The red flags are the one line here that must not be skimmed past — it is the "go to a
   doctor now" list, so it carries the same alarm colour C-033 gave the race-day warning. */
.injury-card .ic-line.flag .k, .injury-card .ic-line.flag .v { color: #9F1239; }
.injury-card .ic-note {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  font-size: 13px; line-height: 1.55; color: var(--fg-muted);
}
.injury-card .ic-foot { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--fg-subtle); }
.injury-card .ic-saved {
  margin-top: 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--grad-mint); border: 1px solid #D1F4DD;
  font-size: 12px; line-height: 1.5; color: #166534;
}
/* ---------- injury list, healed rows, history (C-035) ---------- */
.injury-list .injury-card + .injury-card { margin-top: 10px; }
.past-head {
  margin: 16px 0 8px; font-size: 12px; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: var(--fg-subtle);
}
.past-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-subtle); font-size: 13px;
}
.past-row + .past-row { margin-top: 8px; }
.past-row.clickable { cursor: pointer; }
.past-row.clickable:hover { background: var(--bg-muted); }
.past-row .pr-site { color: var(--fg-muted); }
.past-row .pr-when { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); flex: none; }

.hist { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border); }
.hist .hist-head {
  font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
  color: var(--fg-subtle); margin-bottom: 8px;
}
.hist .hist-empty { font-size: 13px; color: var(--fg-subtle); }
.hist .hist-row {
  display: flex; gap: 12px; align-items: baseline;
  padding: 6px 0; font-size: 13px; line-height: 1.5;
}
.hist .hist-row + .hist-row { border-top: 1px solid var(--border); }
.hist .h-when { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); flex: none; width: 116px; }
.hist .h-what { color: var(--fg-muted); }

.injury-what {
  font-size: 13px; line-height: 1.55; color: var(--fg-muted);
  padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
}
#injury-form textarea, #injury-new-form textarea {
  width: 100%; padding: 10px 12px; font-family: var(--font-body); font-size: 15px;
  color: var(--fg-base); background: var(--bg-base);
  border: 1px solid var(--border); border-radius: 10px; resize: vertical;
}
#injury-form textarea:focus, #injury-new-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* The healed-confirm says three things about what changes; a one-line confirm-row would
   squeeze that into a strip nobody reads, so this variant stacks text above the buttons. */
.confirm-row.stack { display: block; }
.confirm-row.stack span { display: block; margin-bottom: 10px; line-height: 1.55; }
.confirm-row .confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- section head with an action ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.link-btn {
  border: none; background: none; cursor: pointer;
  color: var(--accent); font-family: var(--font-body); font-size: 13px; font-weight: 500;
  padding: 0 0 10px;
}

/* ---------- chips (session status, race priority, data sources) ---------- */
.chip {
  display: inline-flex; align-items: center;
  margin-left: 8px; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 999px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  color: var(--fg-muted); background: var(--bg-base);
  white-space: nowrap;
}
.chip.st-done { background: var(--grad-mint); border-color: #D1F4DD; color: #166534; }
.chip.st-partial { background: var(--grad-sky); border-color: #DCE7FF; color: #3730A3; }
.chip.st-missed { background: var(--grad-peach); border-color: #FEE7D6; color: #9A3412; }
.chip.st-pending { background: var(--bg-muted); }
.chip.prio-A { background: var(--grad-lavender); border-color: #E2D6FB; color: #4C1D95; }
.chip.src { margin-left: 0; margin-right: 6px; background: var(--bg-muted); }
/* C-031 — the feasibility verdict (C-029's four values), same treatment as the session
   status chips above so the surface stays one system. */
.chip.vd-realistic { background: var(--grad-mint); border-color: #D1F4DD; color: #166534; }
.chip.vd-ambitious { background: var(--grad-peach); border-color: #FEE7D6; color: #9A3412; }
.chip.vd-unrealistic { background: var(--grad-rose); border-color: #FDDDE3; color: #9F1239; }
.chip.vd-unknown { background: var(--bg-muted); }

/* ---------- goal assessment panel + "what the plan builds toward" (C-031) ---------- */
.assess {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  padding: 14px; margin-bottom: 18px;
}
.assess.hidden { display: none; }
.assess .a-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.assess .a-word { font-family: var(--font-serif); font-size: 19px; font-weight: 600; }
/* the verdict carries its colour on the word itself here, so the chip beside it is
   redundant and was dropped — same palette as the chips, one statement instead of two. */
.assess .a-word.vd-realistic { color: #166534; }
.assess .a-word.vd-ambitious { color: #9A3412; }
.assess .a-word.vd-unrealistic { color: #9F1239; }
.assess .a-word.vd-unknown { color: var(--fg-muted); }
/* C-037 — waiting for a recompute. Muted on purpose: it is the absence of a judgement, not a
   judgement, and it must not read with the weight of the three verdict words above. */
.assess .a-word.vd-pending { color: var(--fg-subtle); }
.assess .a-grid { display: grid; gap: 6px; margin-bottom: 10px; }
.assess .a-line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.assess .a-line .k { color: var(--fg-muted); }
.assess .a-line .v { font-family: var(--font-mono); color: var(--fg-base); text-align: right; }
.assess .a-advice { font-size: 13px; line-height: 1.55; color: var(--fg-muted); }
.assess .a-stamp {
  margin-top: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle);
}

/* ---------- the plan's own notes, and the race-day warning (C-033) ---------- */
.p-note { margin-top: 6px; font-size: 12px; line-height: 1.5; color: var(--fg-subtle); }
/* reuses the injury-banner treatment rather than inventing a second alert language */
.p-note.warn {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 8px; padding: 10px 12px;
  border: 1px solid #FDDDE3; border-radius: var(--radius-sm);
  background: var(--grad-rose); color: #9F1239;
}
.p-note.warn .dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 5px; background: #9F1239;
}
.p-note.warn .warn-text { font-weight: 500; }

.toward { font-size: 13px; color: var(--fg-muted); margin: -4px 0 10px; }
.toward.hidden { display: none; }
.toward strong { color: var(--fg-base); font-weight: 500; }
.toward time, .toward .t { font-family: var(--font-mono); }

/* ---------- form / cadence card (C-015 §5.5) ---------- */
.form-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--bg-base);
}
.form-card.warn { border-color: #FEE7D6; background: var(--grad-peach); }
.form-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.form-title { font-family: var(--font-serif); font-size: 17px; font-weight: 600; }
.form-card.warn .form-title { color: #9A3412; }
.form-nums { font-family: var(--font-mono); font-size: 13px; color: var(--fg-muted); margin-top: 8px; }
.form-nums strong { color: var(--fg-base); }
.form-note { font-size: 13px; color: var(--fg-muted); line-height: 1.5; margin-top: 8px; }
.form-card.warn .form-note { color: #7C2D12; }
.form-note.muted { color: var(--fg-subtle); font-size: 12px; padding: 0 2px; }

/* ---------- ask the coach (C-018) ---------- */
.thread { display: flex; flex-direction: column; gap: 12px; max-height: 46vh; overflow-y: auto; }
.thread:empty::before {
  content: "Chưa có câu hỏi nào. Chọn một gợi ý bên dưới hoặc tự nhập.";
  color: var(--fg-subtle); font-size: 13px;
}
.bubble {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 92%;
}
.bubble.me { align-self: flex-end; background: var(--bg-muted); border-color: var(--bg-muted); }
.bubble.coach { align-self: flex-start; background: var(--bg-base); }
.bubble.thinking { color: var(--fg-subtle); }
.bubble-text { white-space: pre-wrap; }
.bubble-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border);
}
.bubble-tools-lbl { font-size: 11px; color: var(--fg-subtle); margin-right: 4px; }
.ask-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip-btn {
  border: 1px solid var(--border); background: var(--bg-base); cursor: pointer;
  border-radius: 999px; padding: 7px 12px;
  font-family: var(--font-body); font-size: 12.5px; color: var(--fg-muted);
}
.chip-btn:hover { background: var(--bg-muted); }
.ask-bar { display: flex; gap: 8px; }
.ask-bar input {
  flex: 1; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px; background: var(--bg-base); color: var(--fg-base);
}
.ask-bar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); }
.ask-bar .btn { width: auto; padding: 0 18px; }

/* ---------- select (goal priority) ---------- */
select {
  width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px;
  background: var(--bg-base); color: var(--fg-base);
}
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,70,229,0.12); }

/* ---------- goals: editable rows, past section, delete (C-022) ---------- */
.goal-row { cursor: pointer; }
.goal-row:hover { background: var(--bg-muted); }
.goal-row.past { opacity: 0.62; }
.past-head {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-subtle);
  margin: 16px 0 6px;
}
.link-btn.danger { color: #9F1239; padding: 0; }
.btn-danger { background: #9F1239; color: #fff; border-color: #9F1239; }
.savebar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.savebar-row .btn { width: auto; padding: 0 20px; }
.savebar-row .link-btn.hidden { display: none; }
.confirm-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-top: 12px;
  border: 1px solid #FDDDE3; border-radius: var(--radius);
  background: var(--grad-rose); color: #9F1239; font-size: 14px;
}
.confirm-row.hidden { display: none; }
.confirm-row span { flex: 1; }
.confirm-row .btn { width: auto; height: 34px; padding: 0 14px; font-size: 13px; }

/* ---------- recompute (C-040) ---------- */
.recompute-note {
  margin-bottom: 10px; padding: 8px 10px; border-radius: 10px;
  background: var(--bg-subtle); border: 1px solid var(--border);
  font-size: 12px; line-height: 1.5; color: var(--fg-muted);
}
.recompute-note.hidden { display: none; }
.recompute-note.error { background: var(--grad-rose); border-color: #FDDDE3; color: #9F1239; }
#recompute-btn[disabled] { color: var(--fg-subtle); cursor: default; }
.sync-banner .sync-hint { font-size: 12px; line-height: 1.45; }
