/* Headliner, a FEAT product. FEAT charter tokens (kit FEAT-charte, palette.css),
   Engine universe accent. Light only: FEAT has no dark mode.
   Fonts are self-hosted (SIL OFL 1.1, licences in /fonts/OFL-*.txt). */
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-italic-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-italic-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/fonts/inter-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/fonts/inter-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  color-scheme: light;
  /* FEAT base */
  --navy: #1F2562; --cream: #EDF0CC; --mustard: #E8B530; --card: #F5F5F0;
  --navy-soft: rgba(31,37,98,.6); --navy-line: rgba(31,37,98,.12);
  /* Engine universe */
  --engine: #E8450A; --engine-2: #F4863F;
  /* Semantic tokens used below */
  --bg: var(--card);                  /* surfaces: cards, panels, nav */
  --bg-alt: var(--cream);             /* page background, insets, hovers */
  --field: #FFFFFF;                   /* form fields */
  --fg: var(--navy);
  --fg-muted: rgba(31,37,98,.7);      /* navy-soft raised from .6 to .7 for AA on cream (5.1:1) */
  --accent: var(--engine);            /* decorative accent: rules, active states, progress */
  --accent-2: var(--engine-2);
  --accent-strong: #C23C09;           /* Engine accent darkened: button fill, white text 5.3:1 */
  --accent-press: #A3320B;            /* pressed / error text, 6.4:1 on card */
  --on-accent: #FFFFFF;
  --line: var(--navy-line);
  --border-strong: rgba(31,37,98,.28);
  --border-field: rgba(31,37,98,.52); /* 3.2:1 on white, WCAG 1.4.11 */
  /* Status (AA on card and cream) */
  --ok: #2E6B4F; --ok-bg: rgba(46,107,79,.12);
  --warn: #7A5000; --warn-bg: rgba(232,181,48,.24);
  --danger: #A3320B; --danger-bg: rgba(232,69,10,.10);
  --radius-card: 24px; --radius-form: 20px; --radius-btn: 8px; --radius-pill: 999px;
  --shadow: 0 2px 12px rgba(31,37,98,.04);
  --shadow-hover: 0 8px 24px rgba(31,37,98,.08);
  --ring: 0 0 0 3px rgba(31,37,98,.08);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { background: var(--bg-alt); }
body { margin: 0; background: var(--bg-alt); color: var(--fg); font: 400 16px/1.5 var(--font-sans); -webkit-font-smoothing: antialiased; }
.wrap { max-width: 560px; margin: 0 auto; padding: 64px 16px; }
.rule { display: block; width: 64px; height: 3px; background: var(--accent); border-radius: var(--radius-pill); margin-bottom: 18px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); margin: 0 0 12px; }
h1, h2 { font-family: var(--font-serif); font-weight: 400; letter-spacing: -.005em; }
h1 { font-size: 48px; line-height: 1.05; margin: 0 0 32px; }
h2 { font-size: 28px; line-height: 1.15; margin: 0 0 16px; }
.card { background: var(--bg); padding: 32px; display: grid; gap: 16px; border-radius: var(--radius-card); box-shadow: var(--shadow); }
form.card { border-radius: var(--radius-form); }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
input { font: inherit; padding: 12px 14px; border: 1px solid var(--border-field); border-radius: var(--radius-btn); background: var(--field); color: var(--fg); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fg); box-shadow: var(--ring); }
button { font: inherit; font-weight: 500; padding: 12px 24px; border: 0; border-radius: var(--radius-btn); background: var(--accent-strong); color: var(--on-accent); cursor: pointer; justify-self: start; transition: background-color .15s, box-shadow .15s; }
button:hover { background: var(--accent-press); box-shadow: var(--shadow-hover); }
button:active { background: var(--accent-press); box-shadow: none; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; box-shadow: var(--ring); }
#msg { color: var(--accent-press); min-height: 1.5em; }

/* Login */
.auth-logo { display: block; width: 200px; max-width: 60%; height: auto; margin: 0 0 32px; }
#auth-head h1 { font-size: 64px; margin: 0 0 8px; }
.promise { font-family: var(--font-serif); font-style: italic; font-size: 24px; line-height: 1.25; margin: 0 0 32px; }

/* ---- Dashboard (same tokens; 8px spacing scale) ---- */
[hidden] { display: none !important; }
h3 { font-family: var(--font-serif); font-size: 22px; font-weight: 400; line-height: 1.2; margin: 24px 0 8px; }
h4 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; }
a { color: var(--fg); text-underline-offset: 3px; }
a:hover { color: var(--accent-press); }
.muted { color: var(--fg-muted); font-size: 14px; margin: 0; }
.error { color: var(--accent-press); }
button.secondary { background: transparent; color: var(--fg); border: 1px solid var(--border-strong); padding: 8px 16px; }
button.secondary:hover { background: var(--field); border-color: var(--fg); box-shadow: none; }
button.secondary:active { background: var(--bg-alt); }
button:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
select, textarea { font: inherit; padding: 12px 14px; border: 1px solid var(--border-field); border-radius: var(--radius-btn); background: var(--field); color: var(--fg); width: 100%; }
textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
input[type=number], input[type=file] { width: 100%; }
input[type=checkbox], input[type=radio] { padding: 0; width: 16px; height: 16px; accent-color: var(--accent-strong); }

.nav { background: var(--bg-alt); border-bottom: 1px solid var(--line); }
.nav-inner { max-width: 1120px; margin: 0 auto; padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; }
.wordmark { font-family: var(--font-serif); font-size: 30px; font-weight: 400; line-height: 1; }
.by { display: inline-flex; align-items: baseline; gap: 6px; font-size: 12px; color: var(--fg-muted); }
.by img { display: block; height: 16px; width: auto; align-self: center; }
.nav-links { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.nav-link { font-weight: 500; text-decoration: none; }
.nav-link:hover { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent-2); text-decoration-thickness: 2px; }
.nav-link[aria-current=page] { font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; }
.who { color: var(--fg-muted); font-size: 14px; }

main.wide { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; }
main.wide h1 { font-size: 44px; margin: 16px 0 24px; }
.panel { background: var(--bg); padding: 32px; margin-bottom: 24px; border-radius: var(--radius-card); box-shadow: var(--shadow); }
.panel > h2 { padding-top: 14px; position: relative; font-size: 28px; }
.panel > h2::before { content: ""; position: absolute; top: 0; left: 0; width: 32px; height: 3px; border-radius: var(--radius-pill); background: var(--accent); }
.panel .panel { padding: 0; margin: 0; border-radius: 0; box-shadow: none; }
.stack { display: grid; gap: 16px; max-width: 560px; }
.row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.row.between { justify-content: space-between; align-items: flex-start; }
.form-msg { margin: 0; min-height: 1.45em; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-btn); margin: 0; padding: 8px 16px 16px; display: grid; gap: 8px; }
legend { font-size: 14px; font-weight: 600; padding: 0 8px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check:has(input:disabled) { color: var(--fg-muted); }
.checks { display: grid; gap: 8px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); padding: 8px 16px 8px 0; border-bottom: 1px solid var(--border-strong); }
td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td, tr.clickable:focus-visible td { background: var(--bg-alt); }

.badge { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; line-height: 1.4; padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); color: var(--fg); background: transparent; }
.badge-running, .badge-leased { background: var(--fg); border-color: var(--fg); color: var(--card); }
.badge-completed, .badge-done { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.badge-paused, .badge-paused_cost_cap, .badge-blocked { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.badge-failed { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.badge-cancelled, .badge-pending { color: var(--fg-muted); }

progress { width: 100%; height: 8px; margin: 16px 0 8px; appearance: none; border: 0; border-radius: var(--radius-pill); overflow: hidden; background: var(--bg-alt); display: block; }
progress::-webkit-progress-bar { background: var(--bg-alt); border-radius: var(--radius-pill); }
progress::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-pill); }
progress::-moz-progress-bar { background: var(--accent); border-radius: var(--radius-pill); }
.counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; margin: 16px 0; }
.counts dt, .meta dt { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-muted); }
.counts dd { margin: 0; font-family: var(--font-serif); font-size: 44px; font-weight: 400; line-height: 1.1; font-variant-numeric: tabular-nums; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 16px 0 0; }
.meta dd { margin: 0; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.pager { margin-top: 16px; }
.detail { border-top: 3px solid var(--accent); margin-top: 24px; padding-top: 16px; }
.detail h3 { margin: 0 0 8px; }
.detail pre { white-space: pre-wrap; word-break: break-word; font: inherit; background: var(--bg-alt); border-radius: var(--radius-btn); padding: 16px; margin: 0; }
.detail ol { margin: 0; padding-left: 24px; }

@media (max-width: 640px) {
  .wrap { padding: 32px 16px; }
  .card, .panel { padding: 16px; }
  h1, main.wide h1 { font-size: 36px; }
  #auth-head h1 { font-size: 48px; }
  .promise { font-size: 20px; }
  .panel > h2 { font-size: 24px; }
  .counts dd { font-size: 36px; }
  .nav-links { gap: 16px; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  td { border: 0; padding: 4px 0; }
  td[data-label]:not([data-label=""])::before { content: attr(data-label) "\00a0: "; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-muted); }
}
main.wide > p.muted { margin-bottom: 24px; }
.ci { color: var(--fg-muted); font-size: 12px; white-space: nowrap; }

/* ---- Human spot check ---- */
.spot h3 { margin: 0; }
.answer-text { white-space: pre-wrap; word-break: break-word; font: inherit; background: var(--bg-alt); border-radius: var(--radius-btn); padding: 16px; margin: 16px 0 8px; }
.answer-text.clamp { max-height: calc(8 * 1.45em + 32px); overflow: hidden; }
.judge { margin: 16px 0; }
.label-form { display: grid; gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.label-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.label-form input[type=text] { width: 100%; }
.label-form fieldset { max-width: 320px; }
select:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Recommendations ---- */
.badge-sev-high { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.badge-sev-medium { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.badge-sev-low { color: var(--fg-muted); }
.badge-prio { background: var(--fg); border-color: var(--fg); color: var(--card); }
.findings { list-style: none; margin: 0; padding: 0; }
.findings li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.reco-list { display: grid; gap: 16px; }
.reco.card { padding: 24px; gap: 8px; border: 1px solid var(--line); background: var(--field); border-radius: var(--radius-form); transition: box-shadow .15s; }
.reco.card:hover { box-shadow: var(--shadow-hover); }
.reco p, .reco h4, .reco ol { margin: 0; }
.journey { font-size: 13px; line-height: 2; }
.journey-label { font-weight: 600; margin-right: 4px; }
.journey-step { white-space: nowrap; }
.journey .chip { display: inline-block; padding: 1px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); font-size: 12px; line-height: 1.5; }
.journey-arrow { color: var(--accent-strong); font-weight: 300; }
.reco-title { font-size: 16px; font-weight: 600; }
.reco ol { padding-left: 24px; }
.reco-ctl { align-items: flex-end; }
.reco-ctl select { width: auto; padding: 8px 12px; }
.reco input[type=text] { flex: 1 1 240px; }
.reco-hidden { padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---- Exports and evolution ---- */
.exports { margin: 16px 0; font-size: 14px; }
.exports ul { list-style: none; margin: 8px 0 0; padding: 0; }
.exports li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.badge-sig { background: var(--fg); border-color: var(--fg); color: var(--card); white-space: nowrap; }

/* Column headers: words wrap between words only, never inside a word. */
th { word-break: keep-all; overflow-wrap: normal; hyphens: none; vertical-align: bottom; }
.th-inner { display: inline-flex; align-items: flex-start; gap: 6px; }
.th-label { min-width: 0; }
.th-help { flex: none; width: 18px; height: 18px; padding: 0; margin-top: -1px; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: transparent; color: var(--fg-muted); font-size: 11px; font-weight: 600; line-height: 16px; letter-spacing: 0; text-transform: none; cursor: help; }
.th-help:hover, .th-help:focus-visible { color: var(--fg); border-color: var(--fg); background: var(--bg-alt); box-shadow: none; }
#col-tip { position: fixed; z-index: 1000; padding: 10px 12px; border-radius: var(--radius-btn); box-shadow: var(--shadow-hover); background: var(--fg); color: var(--card); font-size: 13px; font-weight: 400; line-height: 1.45; letter-spacing: 0; text-transform: none; pointer-events: none; }
#col-tip[hidden] { display: none; }
.table-block { margin-bottom: 8px; }
.table-legend { margin-top: 8px; font-size: 13px; color: var(--fg-muted); }
.table-legend summary { cursor: pointer; font-weight: 600; width: max-content; }
.table-legend dl { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: 6px 16px; margin: 12px 0 4px; }
.table-legend dt { font-weight: 600; color: var(--fg); }
.table-legend dd { margin: 0; }
@media (max-width: 640px) { .table-legend dl { grid-template-columns: 1fr; } .table-legend dd { margin-bottom: 8px; } }

/* Wide metric tables fit the panel: interval under the value, tighter gutters. */
.table-wrap td .ci { display: block; margin-top: 2px; }
th { padding-right: 12px; }
td { padding-right: 12px; }

/* Tables of 8 columns or more become labelled cards before they would need a
   horizontal scroll (the definitions stay reachable in the legend below). */
@media (max-width: 1100px) {
  .table-wrap.wide table, .table-wrap.wide tbody, .table-wrap.wide tr, .table-wrap.wide td { display: block; }
  .table-wrap.wide thead { display: none; }
  .table-wrap.wide tr { border-bottom: 1px solid var(--line); padding: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; }
  .table-wrap.wide td { border: 0; padding: 4px 0; }
  .table-wrap.wide td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .table-wrap.wide td[data-label]:not([data-label=""])::before { content: attr(data-label) "\00a0: "; display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-muted); }
  .table-wrap.wide td:first-child::before { display: none; }
}
.key-actions { display: grid; gap: 8px; min-width: 260px; }
.key-actions input[type=password] { min-width: 180px; }

/* Perception map: cell tint by net polarity, derived from the palette
   (green status for positive, Engine accent for negative, mustard for mixed). */
:root { --pol-pos: rgba(46,107,79,.14); --pol-pos-strong: rgba(46,107,79,.28); --pol-neg: rgba(232,69,10,.12); --pol-neg-strong: rgba(232,69,10,.26); --pol-mix: rgba(232,181,48,.30); }
.pol { display: inline-block; min-width: 4.5em; padding: 2px 8px; border-radius: var(--radius-pill); text-align: right; font-variant-numeric: tabular-nums; }
.pol-pos { background: var(--pol-pos); } .pol-pos-strong { background: var(--pol-pos-strong); }
.pol-neg { background: var(--pol-neg); } .pol-neg-strong { background: var(--pol-neg-strong); }
.pol-mix { background: var(--pol-mix); }
