/* Training Desk - one stylesheet, both themes, no external fonts. */

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2330;
  --ink: #e6edf3;
  --ink-dim: #9aa7b4;
  --line: #2a3441;
  --accent: #4c9aff;
  --accent-ink: #08131f;
  --ok: #3fb950;
  --warn: #d29922;
  --bad: #f85149;
  --crit: #ff7b72;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 10px;
}

:root[data-theme="light"] {
  --bg: #f6f8fa;
  --panel: #ffffff;
  --panel2: #f0f3f6;
  --ink: #1f2328;
  --ink-dim: #5b6570;
  --line: #d8dee4;
  --accent: #0969da;
  --accent-ink: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
  --crit: #a40e26;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

code, pre, .mono { font-family: var(--mono); }
.mono { font-size: 0.92em; }
.small { font-size: 0.85em; }
.muted { color: var(--ink-dim); }
.hidden { display: none !important; }

a { color: var(--accent); }
a:hover { text-decoration: underline; }

/* --- top bar ------------------------------------------------------------- */

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand .sep { color: var(--ink-dim); }
.backlink { text-decoration: none; }
.topactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.credits { font-family: var(--mono); font-size: 0.85em; color: var(--ink-dim); }
.topup {
  font-size: 0.85em;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
}

/* --- buttons -------------------------------------------------------------- */

button { font-family: inherit; font-size: 1em; cursor: pointer; }

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 11px;
}
.ghost:hover { background: var(--panel2); }

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font-weight: 600;
}
.primary:disabled { opacity: 0.45; cursor: not-allowed; }

.big {
  background: var(--panel2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
}
.big:hover { border-color: var(--accent); }

.mini {
  background: var(--panel2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.85em;
}
.mini:hover { border-color: var(--accent); }

.linkish {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: inherit;
  text-decoration: underline;
}

/* --- layout ---------------------------------------------------------------- */

main { max-width: 1000px; margin: 0 auto; padding: 24px 20px 60px; }

.hero h1 { font-size: 1.9rem; line-height: 1.25; margin: 18px 0 10px; }
.lede { font-size: 1.05rem; color: var(--ink); max-width: 74ch; }
.herobtns { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 18px 0;
}
.card h2 { font-size: 1.15rem; margin: 0 0 10px; }
.card h3 { font-size: 1.05rem; margin: 0 0 10px; }
.count {
  font-family: var(--mono);
  font-size: 0.8em;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 9px;
  margin-left: 6px;
}

.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.labelrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.labelrow label { font-weight: 600; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row .field { flex: 1 1 240px; }

textarea, select, input[type="file"] {
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.5;
}
select { font-family: var(--sans); font-size: 0.95rem; }
textarea { resize: vertical; }
textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.dropzone { border: 1px dashed transparent; border-radius: 10px; transition: border-color 0.15s, background 0.15s; }
.dropzone.dragging { border-color: var(--accent); background: rgba(76, 154, 255, 0.06); }
.droprow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.droprow input[type="file"] { width: auto; flex: 0 1 auto; font-size: 0.8rem; padding: 4px; }

.runrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }

.rungate {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--warn);
  border-radius: 8px;
  background: rgba(210, 153, 34, 0.08);
  font-size: 0.92em;
}
.gateaction { font-weight: 600; cursor: pointer; }

/* --- prescan ---------------------------------------------------------------- */

.prescan {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--panel2);
  margin-bottom: 14px;
}
.prescan h2 { font-size: 1rem; }
.flaglist { list-style: none; padding: 0; margin: 8px 0 0; }
.flaglist li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 0.92em; }
.flaglist li:first-child { border-top: none; }
.flagid {
  display: inline-block;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  margin-right: 6px;
  font-size: 0.82em;
  color: var(--ink-dim);
}

/* --- progress ----------------------------------------------------------------- */

.progresshead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.steps { list-style: none; padding: 0; margin: 12px 0 0; }
.step { display: flex; align-items: center; gap: 10px; padding: 5px 0; color: var(--ink-dim); }
.step-ic {
  width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--line); flex: 0 0 auto;
}
.step.done { color: var(--ink); }
.step.done .step-ic { background: var(--ok); border-color: var(--ok); }
.step.live { color: var(--ink); }
.step.live .step-ic { border-color: var(--accent); background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* --- result ---------------------------------------------------------------------- */

.resulthead h2 { font-size: 1.35rem; }
.verdict {
  font-size: 1.03rem;
  border-left: 3px solid var(--line);
  padding-left: 12px;
  margin: 10px 0;
}
.verdict.posture-hardened { border-left-color: var(--ok); }
.verdict.posture-needs-hardening { border-left-color: var(--warn); }
.verdict.posture-exposed { border-left-color: var(--bad); }

.sdkstrip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
}
.sdkbox { display: flex; flex-direction: column; min-width: 78px; }
.sdkbox strong { font-size: 1.25rem; }
.sdkarrow { color: var(--ink-dim); font-size: 1.3rem; }

.prose p { margin: 10px 0; }
.delta {
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(76, 154, 255, 0.07);
  font-size: 0.92em;
}
.warnline {
  border: 1px solid var(--warn);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(210, 153, 34, 0.09);
}
.warnline ul { margin: 6px 0 0; padding-left: 18px; }
.warnline li { margin: 2px 0; word-break: break-word; }

/* --- settings patch table ---------------------------------------------------------- */

.patchwrap { margin: 10px 0; }
.patch td { vertical-align: top; }
.patch td.mono { white-space: nowrap; }
.patch td:nth-child(3), .patch td:nth-child(4) {
  min-width: 180px;
  word-break: break-word;
  white-space: pre-wrap;
}
.patch td:nth-child(4) { color: var(--ok, var(--ink)); }

/* --- hops -------------------------------------------------------------------------- */

.hop { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 10px; background: var(--panel2); }
.hop-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hop-badge {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 8px;
  font-weight: 600;
}
.hop-theme { font-weight: 600; }
.hop ul { margin: 8px 0 0; padding-left: 22px; }
.hop ul.watch { color: var(--ink-dim); }

/* --- findings ------------------------------------------------------------------------ */

.finding {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--panel2);
}
.finding.pri-critical { border-left-color: var(--crit); }
.finding.pri-high { border-left-color: var(--bad); }
.finding.pri-medium { border-left-color: var(--warn); }
.finding.pri-low { border-left-color: var(--line); }
.finding header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.fid { font-weight: 700; }
.fres { color: var(--ink-dim); font-size: 0.88em; }
.ftags { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.tag {
  font-family: var(--mono);
  font-size: 0.74em;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 8px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.finding p { margin: 7px 0; }

.tag.ctl-present { color: var(--ok); border-color: var(--ok); }
.tag.ctl-weak { color: var(--warn); border-color: var(--warn); }
.tag.ctl-missing { color: var(--bad); border-color: var(--bad); }
.tag.ctl-unknown { color: var(--ink-dim); }
.snipwrap { position: relative; margin-top: 10px; }
.snipwrap .mini { position: absolute; top: 6px; right: 6px; }
pre.snippet, pre.bigpre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre;
  margin: 0;
}
pre.bigpre { max-height: 480px; overflow-y: auto; }

/* --- coverage ----------------------------------------------------------------------- */

.covlist { list-style: none; padding: 0; margin: 8px 0 0; }
.covlist li { padding: 5px 0; border-top: 1px solid var(--line); font-size: 0.9em; }
.covlist li:first-child { border-top: none; }
.covmark { display: inline-block; width: 20px; font-weight: 700; }
.covmark.yes { color: var(--ok); }
.covmark.no { color: var(--warn); }
.covmark.missed { color: var(--bad); }
.covnote { color: var(--ink-dim); }

/* --- inventory ------------------------------------------------------------------------ */

.tablewrap { overflow-x: auto; }
table.inv { width: 100%; border-collapse: collapse; font-size: 0.9em; min-width: 560px; }
table.inv th, table.inv td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.inv th { color: var(--ink-dim); font-weight: 600; font-size: 0.85em; }

.focus { padding: 7px 0; border-top: 1px solid var(--line); }
.focus:first-child { border-top: none; }

.exportrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }

/* --- history ------------------------------------------------------------------------- */

.history { list-style: none; padding: 0; margin: 0 0 10px; }
.history li { border-top: 1px solid var(--line); }
.history li:first-child { border-top: none; }
.histbtn {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--ink);
  padding: 9px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.histbtn:hover { background: var(--panel2); }
.histtitle { font-weight: 600; }
.histmeta { color: var(--ink-dim); }
.histload { margin: 0 0 10px 4px; }

.explain p { max-width: 78ch; }

/* --- footer + toasts -------------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 20px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.9em;
}
.foot p { margin: 6px 0; max-width: 80ch; margin-left: auto; margin-right: auto; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: min(440px, calc(100vw - 32px)); }
.toast {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
  font-size: 0.92em;
  transition: opacity 0.5s;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--bad); }
.toast.gone { opacity: 0; }
.toast a { margin-left: 8px; font-weight: 600; }

/* --- docs pages ---------------------------------------------------------------------- */

.doc { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }
.doc h1 { font-size: 1.7rem; }
.doc h2 { font-size: 1.2rem; margin-top: 30px; }
.doc h3 { font-size: 1rem; margin-top: 22px; }
.doc p, .doc li { max-width: 80ch; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.9em; margin: 12px 0; }
.doc th, .doc td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--ink-dim); }
.doc code { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 0.88em; }
.doc pre code { background: none; border: none; padding: 0; }
.doc pre { overflow-x: auto; max-width: 100%; }
@media (max-width: 700px) { .doc table { display: block; overflow-x: auto; } }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 0; }
.tab {
  background: var(--panel2);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 5px 12px;
  font-size: 0.85em;
}
.tab.active { background: var(--bg); color: var(--ink); font-weight: 600; }
.codegroup pre { border-radius: 0 8px 8px 8px; margin-top: 0; }
.codegroup pre[hidden] { display: none; }

.tokenrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.tokenbox {
  flex: 1 1 320px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
  min-height: 44px;
}
.statebox { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--panel2); margin: 12px 0; }

@media (max-width: 620px) {
  .hero h1 { font-size: 1.5rem; }
  .ftags { margin-left: 0; }
  main, .doc { padding: 16px 14px 48px; }
}

@media print {
  .topbar, .toasts, .exportrow, form, .prescan, #progressPanel, #historyZone, .herobtns, .foot { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; break-inside: avoid; }
}

/* --- shared fleet additions: verdict, badge and list styles ------------------------- */

.verdict.rd-modern { border-left-color: var(--ok); }
.verdict.rd-partial { border-left-color: var(--warn); }
.verdict.rd-legacy { border-left-color: var(--bad); }

.findhead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.findhead code { font-weight: 700; }
.findhead strong { font-size: 0.95em; }
.flabel { color: var(--ink-dim); font-weight: 600; }

.badge {
  font-family: var(--mono);
  font-size: 0.74em;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 8px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.badge.st-pass { color: var(--ok); border-color: var(--ok); }
.badge.st-fail { color: var(--bad); border-color: var(--bad); }
.badge.st-partial { color: var(--warn); border-color: var(--warn); }
.badge.st-unknown { color: var(--ink-dim); }
.badge.b-priority.v-critical { color: var(--crit); border-color: var(--crit); }
.badge.b-priority.v-high { color: var(--bad); border-color: var(--bad); }
.badge.b-priority.v-medium { color: var(--warn); border-color: var(--warn); }
.badge.b-risk.v-high, .badge.b-effort.v-high { color: var(--bad); border-color: var(--bad); }
.badge.b-risk.v-medium, .badge.b-effort.v-medium { color: var(--warn); border-color: var(--warn); }
.badge.b-phase { color: var(--accent); border-color: var(--line); }
.badge.diff-still-open { color: var(--warn); border-color: var(--warn); }
.badge.diff-new { color: var(--accent); border-color: var(--accent); }

.reslist { list-style: none; padding: 0; margin: 8px 0 0; }
.reslist li {
  padding: 5px 0;
  border-top: 1px solid var(--line);
  font-size: 0.88em;
  color: var(--ink-dim);
}
.reslist li:first-child { border-top: none; }

.covlist li.cov-ok code { color: var(--ok); }
.covlist li.cov-aside code { color: var(--warn); }
.covlist li.cov-missed code { color: var(--bad); }
.covlist li.cov-missed { color: var(--ink); }

.focusitem { padding: 9px 0; border-top: 1px solid var(--line); }
.focusitem:first-child { border-top: none; }
.focusitem p { margin: 5px 0 0; color: var(--ink-dim); }
.focusitem code { font-size: 0.8em; color: var(--ink-dim); }

.history li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 2px;
}
.history li .mini { margin-left: auto; }

/* --- shared fleet additions: lanes, grids, charts, badges -------------------------- */
.lanes { display: flex; gap: 10px; margin: 18px 0 14px; flex-wrap: wrap; }
.lane { flex: 1 1 220px; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line, #3a3f4b);
  background: var(--card, transparent); color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; }
.lane strong { font-size: 1.02rem; }
.lane.active { border-color: var(--accent, #7aa2ff); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #7aa2ff) 35%, transparent); }
.lane:focus-visible { outline: 3px solid var(--accent, #7aa2ff); outline-offset: 2px; }
.row.four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px) { .row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .row.four { grid-template-columns: 1fr; } }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pair input { min-width: 0; }
.field input[type="text"], .field input[type="date"], .field select { width: 100%; box-sizing: border-box; min-width: 0; }
.chart { margin: 10px 0 12px; }
.chart svg { width: 100%; height: auto; display: block; max-width: 100%; }
.chart .grid { stroke: var(--line, #3a3f4b); stroke-width: 1; }
.chart .band-dark { fill: color-mix(in srgb, var(--accent, #7aa2ff) 10%, transparent); }
.chart .band-twi { fill: color-mix(in srgb, #f0a050 12%, transparent); }
.chart .floor { stroke: #e06c75; stroke-dasharray: 4 4; stroke-width: 1; }
.chart .moon { stroke: #d8c26a; stroke-width: 2.5; stroke-dasharray: 6 4; fill: none; }
.chart .target { stroke-width: 2; fill: none; }
.chart text { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; fill: var(--muted, #98a0b0); }
.chart .lbl { fill: currentColor; }
table.facts td, table.sched td { vertical-align: top; }
table.sched td.why { max-width: 28ch; }
.badge.ok { background: color-mix(in srgb, #4caf7d 22%, transparent); color: #4caf7d; }
.badge.bad { background: color-mix(in srgb, #e06c75 22%, transparent); color: #e06c75; }
.badge.warn { background: color-mix(in srgb, #f0a050 22%, transparent); color: #f0a050; }
.status-observable { color: #4caf7d; } .status-marginal { color: #f0a050; } .status-unobservable { color: #e06c75; }
.reconrow { display: grid; grid-template-columns: minmax(0, 12ch) 1fr; gap: 6px 12px; padding: 6px 0; border-bottom: 1px solid var(--line, #3a3f4b); }
.reconrow .mono { word-break: break-word; }
.labelrow select { max-width: 12rem; }
@media (max-width: 480px) { .herobtns .big { width: 100%; } .exportrow .mini { flex: 1 1 45%; } }

/* ---- shared fleet additions: columns, warnings, statement, status colours ---- */
.subhead { font-size: 1rem; margin: 18px 0 6px; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.threecol { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 760px) { .twocol, .threecol { grid-template-columns: 1fr; } }
.warnbox { border: 1px solid color-mix(in srgb, #e0a050 55%, transparent); border-radius: 10px; padding: 6px 12px; margin: 8px 0; background: color-mix(in srgb, #e0a050 8%, transparent); }
.warnbox p { margin: 6px 0; }
details.adjust { margin: 6px 0 12px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; }
details.adjust summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
details.adjust[open] summary { margin-bottom: 8px; }
.statement p { font-size: 1.02rem; line-height: 1.55; }
.prose .status-ok, .prose .status-bad, .prose .status-warn { text-transform: capitalize; }
.status-ok { color: var(--ok, #4cc38a); }
.status-bad { color: var(--bad, #e06c75); }
.status-warn { color: #e0a050; }
.status-muted { color: var(--muted); }
td.status-ok, td.status-bad, td.status-warn, td.status-muted { font-weight: 600; white-space: nowrap; }
tr.hl td { background: color-mix(in srgb, var(--accent, #7aa2ff) 12%, transparent); font-weight: 600; }
td.arm { font-weight: 600; }
td.arm-0 { color: #7aa2ff; } td.arm-1 { color: #e0a050; } td.arm-2 { color: #4cc38a; } td.arm-3 { color: #d17ae0; } td.arm-4 { color: #e06c75; } td.arm-5 { color: #6ad0d6; }
.chart .powerline { stroke: var(--accent, #7aa2ff); stroke-width: 2.5; fill: none; }
.chart .chosen { stroke: #4cc38a; stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .target { stroke: #e0a050; stroke-dasharray: 6 4; }
.chart text.tick { fill: var(--muted); }
.chart text.right { text-anchor: end; }
.chart text.mid { text-anchor: middle; }
.verdict-defensible, .verdict-sound { color: var(--ok, #4cc38a); }
.verdict-defensible_with_changes, .verdict-fixable { color: #e0a050; }
.verdict-not_defensible, .verdict-rework { color: var(--bad, #e06c75); }
.histmeta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.verdict.verdict-defensible, .verdict.verdict-sound { border-left-color: var(--ok, #4cc38a); }
.verdict.verdict-defensible_with_changes, .verdict.verdict-fixable { border-left-color: #e0a050; }
.verdict.verdict-not_defensible, .verdict.verdict-rework { border-left-color: var(--bad, #e06c75); }
/* Grid items default to min-width:auto, so a table with a min-width inside a grid track forces
 * the track - and the card - wider than the viewport; the .tablewrap scroller never engages.
 * Found by the 375 px live check on release 2. */
.twocol > div, .threecol > div { min-width: 0; }
.twocol table.inv, #layoutFacts table.inv { min-width: 0; }
.prescan, .result, .card { max-width: 100%; }

/* ---- Training Desk additions ---- */
.weekgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.weekgrid .field { margin-bottom: 0; min-width: 0; }
.weekgrid select { padding: 8px 6px; }
@media (max-width: 720px) { .weekgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 420px) { .weekgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.checkfield { display: flex; align-items: flex-end; padding-bottom: 8px; }
.checkfield label { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.checkfield input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.verdict-ready, .verdict-hold { color: var(--ok, #4cc38a); }
.verdict-ready_with_changes, .verdict-cut, .verdict-add, .verdict-wait { color: #e0a050; }
.verdict-not_advisable, .verdict-end_phase { color: var(--bad, #e06c75); }
.verdict.verdict-ready, .verdict.verdict-hold { border-left-color: var(--ok, #4cc38a); }
.verdict.verdict-ready_with_changes, .verdict.verdict-cut, .verdict.verdict-add, .verdict.verdict-wait { border-left-color: #e0a050; }
.verdict.verdict-not_advisable, .verdict.verdict-end_phase { border-left-color: var(--bad, #e06c75); }
.row.four .field, .row .field { min-width: 0; }
.field .pair select { width: 100%; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* --- Training Desk additions ---------------------------------------------------------------------- */
.flags { list-style: none; padding: 0; margin: 0.5rem 0 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; }
.flags li.flag { padding: 0.35rem 0.6rem; border-left: 3px solid #e0a050; background: color-mix(in srgb, #e0a050 8%, transparent); border-radius: 4px; font-size: 0.92rem; }
.flags li.flag .mono { color: #e0a050; margin-right: 0.35rem; }
.flags li.flag-acwr_spike, .flags li.flag-acwr_ewma_spike, .flags li.flag-monotony, .flags li.flag-plateau, .flags li.flag-monotony_uniform, .flags li.flag-extreme_volume, .flags li.flag-illness, .flags li.flag-red_flag_symptom { border-left-color: var(--bad, #e06c75); background: color-mix(in srgb, var(--bad, #e06c75) 8%, transparent); }
.flags li.flag-acwr_spike .mono, .flags li.flag-acwr_ewma_spike .mono, .flags li.flag-monotony .mono, .flags li.flag-plateau .mono, .flags li.flag-monotony_uniform .mono, .flags li.flag-extreme_volume .mono, .flags li.flag-illness .mono, .flags li.flag-red_flag_symptom .mono { color: var(--bad, #e06c75); }
.flags li.muted { padding: 0.2rem 0; }
.chart .bar { fill: var(--accent, #7aa2ff); opacity: 0.85; }
.chart .bar-proj { fill: var(--accent, #7aa2ff); opacity: 0.35; stroke: var(--accent, #7aa2ff); stroke-dasharray: 3 2; }
.chart .band-ok { stroke: var(--ok, #4cc38a); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.7; }
.chart .band-bad { stroke: var(--bad, #e06c75); stroke-width: 1; stroke-dasharray: 4 3; opacity: 0.8; }
.chart .dot { fill: #e0a050; }
.chart .powerline { stroke: #e0a050; }
.verdict-progressing, .verdict-build { color: var(--ok, #4cc38a); }
.verdict-plateaued, .verdict-undertraining, .verdict-deload, .verdict-rebuild { color: #e0a050; }
.verdict-overreaching { color: var(--bad, #e06c75); }
.verdict-insufficient_data { color: var(--muted, #8a93a6); }
.verdict.verdict-progressing, .verdict.verdict-build { border-left-color: var(--ok, #4cc38a); }
.verdict.verdict-plateaued, .verdict.verdict-undertraining, .verdict.verdict-deload, .verdict.verdict-rebuild { border-left-color: #e0a050; }
.verdict.verdict-overreaching { border-left-color: var(--bad, #e06c75); }
.verdict.verdict-insufficient_data { border-left-color: var(--muted, #8a93a6); }
.dropzone.over { outline: 2px dashed var(--accent, #7aa2ff); outline-offset: 2px; }
.inv.facts td, .inv.facts th, .inv.sched td, .inv.sched th { min-width: 0; overflow-wrap: anywhere; }
.twocol > *, .threecol > *, .row > .field { min-width: 0; }
