/* pal.expert — theme_03: Swiss Grid Technical Ledger
   Tokens: bg #f4f4f0 · surface #ffffff · ink #111111 · accent #d9381e · muted #4b5563
   Helvetica Neue/Arial, tight uppercase headers, tabular-nums grid. Zero external assets. */

:root {
  --bg: #f4f4f0;
  --surface: #ffffff;
  --ink: #111111;
  --accent: #d9381e;
  --muted: #4b5563;
  --line: #111111;
  --hairline: #d6d6cf;
  --ok: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}
code, pre, .g-val, .g-unit, .receipt-sha, input, select, textarea, table {
  font-family: var(--mono);
}
table { font-variant-numeric: tabular-nums; }
code { color: var(--accent); font-size: 0.92em; }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #ffffff; padding: 8px 14px; z-index: 10;
}
.skip-link:focus { left: 8px; top: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- top bar: hairline grid header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 0 20px; height: 56px;
  background: var(--surface); border-bottom: 2px solid var(--ink);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-mark {
  font-weight: 700; font-size: 0.95rem; letter-spacing: 0.22em;
  color: var(--ink); border-left: 6px solid var(--accent); padding-left: 10px;
}
.brand-sub {
  color: var(--muted); font-size: 0.72rem; letter-spacing: 0.14em;
  text-transform: uppercase;
}
.topnav { display: flex; flex-wrap: wrap; gap: 0; }
.topnav a {
  color: var(--ink); text-decoration: none; font-size: 0.78rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 6px 12px; border-left: 1px solid var(--hairline);
}
.topnav a:hover { color: var(--accent); background: var(--bg); }

/* ---------- disclosure strip (above the fold) ---------- */
.disclosure-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.82rem;
  padding: 10px 20px;
  border-top: 4px solid var(--accent);
}
.disclosure-strip strong { color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  max-width: 1080px; margin: 0 auto; padding: 64px 20px 40px;
  border-bottom: 1px solid var(--hairline);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.05;
  text-transform: uppercase; margin: 0 0 20px;
}
.hero h1::after {
  content: ""; display: block; width: 72px; height: 6px;
  background: var(--accent); margin-top: 18px;
}
.lede { color: var(--muted); font-size: 1.05rem; max-width: 64ch; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 0; margin-top: 24px; }
.chip {
  font-family: var(--mono); font-size: 0.72rem;
  border: 1px solid var(--ink); color: var(--ink);
  background: var(--surface); padding: 4px 12px; margin-right: -1px;
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ---------- workbench: 12-col Swiss grid deck ---------- */
.workbench { max-width: 1280px; margin: 0 auto; padding: 32px 20px 56px; }
.deck {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 0;
  border: 1px solid var(--ink);
  background: var(--surface);
}
.pane { padding: 0; }
.pane-input { border-right: 1px solid var(--ink); }
.pane-output { padding: 0 24px 24px; }

.pane-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
  margin: 20px 0 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center; gap: 8px;
}
.pane-title::before {
  content: attr(data-n, "");
  color: var(--accent); font-family: var(--mono); font-weight: 400;
}
.pane-title:first-child { margin-top: 0; }

/* input deck */
.pane-input fieldset {
  border: 0; border-bottom: 1px solid var(--hairline);
  padding: 14px 18px; margin: 0;
}
.pane-input legend {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent);
  padding: 0 0 8px;
}
.pane-input label {
  display: block; font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: 10px 0;
}
.pane-input input, .pane-input select, .pane-input textarea {
  width: 100%; margin-top: 4px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--hairline); border-radius: 0;
  padding: 8px 10px; font-size: 0.85rem;
}
.pane-input input:focus, .pane-input select:focus, .pane-input textarea:focus {
  border-color: var(--ink); outline: none;
}
.pane-input textarea { resize: vertical; min-height: 190px; font-size: 0.75rem; }
.row { display: flex; gap: 0; margin-top: 10px; flex-wrap: wrap; }
.row button { flex: 1; }
button {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--ink); color: #ffffff; border: 0;
  padding: 10px 14px; cursor: pointer;
}
button + button { border-left: 1px solid var(--hairline); }
button:hover { background: var(--accent); color: #ffffff; }
button.ghost {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--hairline); border-top: 0;
}
button.ghost:hover { background: var(--accent); color: #ffffff; border-color: var(--accent); }

/* telemetry */
.gauges {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0; margin: 16px 0 18px;
  border: 1px solid var(--ink);
}
.gauge {
  background: var(--surface); border-right: 1px solid var(--hairline);
  padding: 12px 14px; display: flex; flex-direction: column;
}
.gauge:last-child { border-right: 0; }
.g-label { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.g-val { font-size: 1.45rem; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.g-unit { font-size: 0.72rem; color: var(--muted); }
.g-val.warn { color: var(--accent); }

#chart { width: 100%; height: auto; display: block; background: var(--surface);
  border: 1px solid var(--ink); }

/* sensitivity table */
.sens-wrap { overflow-x: auto; border: 1px solid var(--ink); }
.sens-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.sens-table th {
  background: var(--ink); color: #ffffff; text-align: left;
  font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 8px 10px; font-weight: 400;
}
.sens-table td { padding: 7px 10px; border-top: 1px solid var(--hairline); }
.sens-table tr.zero-row td { background: var(--bg); font-weight: 700; }
.sens-table td:last-child { color: var(--muted); }

/* audit + notes */
.audit, .notes { list-style: none; margin: 0 0 8px; padding: 0; }
.audit li, .notes li {
  font-family: var(--mono); font-size: 0.78rem;
  padding: 8px 10px; margin-bottom: 0;
  border: 1px solid var(--hairline); border-left: 3px solid var(--hairline);
  background: var(--surface);
}
.audit li + li, .notes li + li { border-top: 0; }
.audit li.pass { border-left-color: var(--ok); }
.audit li.fail { border-left-color: var(--accent); }
.audit .sev { color: var(--muted); margin-left: 8px; font-size: 0.68rem; text-transform: uppercase; }
.notes li { color: var(--muted); border-left-color: var(--ink); }

/* receipt */
.receipt { margin-top: 8px; border: 1px solid var(--ink); }
.receipt pre {
  background: var(--bg); border-bottom: 1px solid var(--hairline);
  padding: 12px; overflow-x: auto; font-size: 0.7rem; color: var(--accent);
  max-height: 260px; overflow-y: auto; margin: 0;
}
.receipt-sha { font-size: 0.72rem; color: var(--muted); word-break: break-all; padding: 10px 12px; margin: 0; }

/* ---------- sections ---------- */
.section {
  max-width: 1080px; margin: 0 auto; padding: 40px 20px 56px;
  border-bottom: 1px solid var(--hairline);
}
.section h2 {
  font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em;
  text-transform: uppercase; margin: 0 0 16px;
  border-bottom: 2px solid var(--ink); padding-bottom: 8px;
}
.section p { color: var(--muted); max-width: 70ch; }

.dataset-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0; border: 1px solid var(--ink); background: var(--surface);
}
.dataset-card {
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 16px; cursor: pointer;
}
.dataset-card:hover { background: var(--bg); }
.dataset-card h3 { margin: 0 0 6px; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; }
.dataset-card p { margin: 0; font-size: 0.75rem; color: var(--muted); font-family: var(--mono); }
.dataset-card .apply {
  display: inline-block; margin-top: 10px; font-size: 0.7rem;
  color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase;
}

/* ---------- footer ---------- */
.footer {
  border-top: 2px solid var(--ink); background: var(--surface);
  padding: 28px 20px; text-align: center; color: var(--muted); font-size: 0.8rem;
}
.footer-nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 0; margin-top: 12px; }
.footer-nav a {
  color: var(--muted); text-decoration: none; font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 12px; border-left: 1px solid var(--hairline);
}
.footer-nav a:first-child { border-left: 0; }
.footer-nav a:hover { color: var(--accent); }

/* ---------- legal pages ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 48px 20px 64px; }
.legal h1 {
  font-size: 1.9rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: -0.01em; border-bottom: 2px solid var(--ink); padding-bottom: 10px;
}
.legal h2 {
  font-size: 0.85rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; margin-top: 34px; color: var(--ink);
}
.legal p, .legal li { color: var(--muted); }
.legal a { color: var(--accent); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .deck { grid-template-columns: 1fr; }
  .pane-input { border-right: 0; border-bottom: 1px solid var(--ink); }
  .topbar { height: auto; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px 20px; position: static; }
  .topnav { width: 100%; }
  .topnav a { flex: 1; text-align: center; border-left: 0; border-top: 1px solid var(--hairline); }
}
