/* =============================================================================
 * PBI Desk - one stylesheet, both themes, system fonts only, no remote assets.
 *
 *   1.  Design tokens (dark default, light override)
 *   2.  Base elements + utilities
 *   3.  Top bar
 *   4.  Lane bar (Inspect / Fix / Present)
 *   5.  Buttons + focus
 *   6.  Layout, hero, cards
 *   7.  Form controls, drop zone, meter, notices, gates
 *   8.  Prescan - the free in-browser reader's own output
 *   9.  Progress steps
 *   10. Result head: lane chip, verdict, headline, facts, handoff
 *   11. Chips - every vocabulary the script can emit
 *   12. Findings
 *   13. Lane panes: measures, artifacts, code blocks, assumptions
 *   14. Tables
 *   15. History, footer, toasts
 *   16. Docs pages (api.html, tokens.html)
 *   17. Responsive
 *   18. Print
 *   19. Reduced motion
 *
 * The theme is written by /theme.js onto <html> as data-theme="dark" or
 * data-theme="light" before first paint. Every colour used anywhere in this
 * file is a custom property declared in BOTH themes, so an attribute flip is
 * total and nothing is left unreadable on one side.
 *
 * The accent is a deep amber/gold, matching the favicon and the social card.
 * It is deliberately confined to interface chrome - the active lane tab, the
 * primary button, links and the focus ring - so it never has to be told apart
 * from a severity chip at a glance.
 * ========================================================================== */

/* -----------------------------------------------------------------------------
 * 1. Design tokens
 * -------------------------------------------------------------------------- */

:root {
  --bg: #14171c;
  --panel: #1b1f26;
  --panel2: #232832;
  --code-bg: #0e1116;
  --chip-bg: #1e232b;
  --ink: #e9edf3;
  --ink-dim: #a2abb8;
  --ink-faint: #808a97;
  --line: #323945;
  --line-soft: #272d37;

  --accent: #e8a33d;
  --accent-ink: #1d1401;
  --accent-wash: rgba(232, 163, 61, 0.13);
  --accent-soft: rgba(232, 163, 61, 0.34);

  --ok: #48c46c;
  --ok-ink: #04140a;
  --ok-wash: rgba(72, 196, 108, 0.13);

  --warn: #d98e2e;
  --warn-ink: #1a1102;
  --warn-wash: rgba(217, 142, 46, 0.14);

  --bad: #f4695f;
  --bad-ink: #1e0604;
  --bad-wash: rgba(244, 105, 95, 0.14);

  --crit: #ff5f52;
  --crit-ink: #250503;
  --crit-wash: rgba(255, 95, 82, 0.18);

  --info: #7fa8d6;
  --info-ink: #06101c;
  --info-wash: rgba(127, 168, 214, 0.13);

  --shadow: rgba(0, 0, 0, 0.45);

  --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;
  --radius-sm: 6px;
  --pill: 20px;
}

/* theme.js always writes an explicit attribute, so dark is restated here as
 * well as being the bare :root default. */
:root[data-theme="dark"] {
  --bg: #14171c;
  --panel: #1b1f26;
  --panel2: #232832;
  --code-bg: #0e1116;
  --chip-bg: #1e232b;
  --ink: #e9edf3;
  --ink-dim: #a2abb8;
  --ink-faint: #808a97;
  --line: #323945;
  --line-soft: #272d37;
  --accent: #e8a33d;
  --accent-ink: #1d1401;
  --accent-wash: rgba(232, 163, 61, 0.13);
  --accent-soft: rgba(232, 163, 61, 0.34);
  --ok: #48c46c;
  --ok-ink: #04140a;
  --ok-wash: rgba(72, 196, 108, 0.13);
  --warn: #d98e2e;
  --warn-ink: #1a1102;
  --warn-wash: rgba(217, 142, 46, 0.14);
  --bad: #f4695f;
  --bad-ink: #1e0604;
  --bad-wash: rgba(244, 105, 95, 0.14);
  --crit: #ff5f52;
  --crit-ink: #250503;
  --crit-wash: rgba(255, 95, 82, 0.18);
  --info: #7fa8d6;
  --info-ink: #06101c;
  --info-wash: rgba(127, 168, 214, 0.13);
  --shadow: rgba(0, 0, 0, 0.45);
}

:root[data-theme="light"] {
  --bg: #f7f6f3;
  --panel: #ffffff;
  --panel2: #f1efe9;
  --code-bg: #f4f2ed;
  --chip-bg: #ffffff;
  --ink: #1e2126;
  --ink-dim: #55606d;
  --ink-faint: #6d7784;
  --line: #d8d4cb;
  --line-soft: #e8e4dc;
  --accent: #8a5300;
  --accent-ink: #ffffff;
  --accent-wash: rgba(138, 83, 0, 0.12);
  --accent-soft: rgba(138, 83, 0, 0.45);
  --ok: #17703a;
  --ok-ink: #ffffff;
  --ok-wash: rgba(23, 112, 58, 0.10);
  --warn: #b3541e;
  --warn-ink: #ffffff;
  --warn-wash: rgba(179, 84, 30, 0.10);
  --bad: #c0362c;
  --bad-ink: #ffffff;
  --bad-wash: rgba(192, 54, 44, 0.09);
  --crit: #93130c;
  --crit-ink: #ffffff;
  --crit-wash: rgba(147, 19, 12, 0.10);
  --info: #3f5f86;
  --info-ink: #ffffff;
  --info-wash: rgba(63, 95, 134, 0.09);
  --shadow: rgba(30, 33, 38, 0.16);
}

/* -----------------------------------------------------------------------------
 * 2. Base elements + utilities
 * -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  /* nothing in this app may scroll the page sideways: every wide thing below
   * carries its own scroller. This is the belt to that braces. */
  overflow-x: hidden;
}

h1, h2, h3, h4 { overflow-wrap: break-word; }
h1 { font-size: 1.9rem; line-height: 1.25; margin: 14px 0 10px; }

p { overflow-wrap: break-word; }

code, pre, .mono { font-family: var(--mono); }
.mono { font-size: 0.92em; overflow-wrap: break-word; }
.small { font-size: 0.85em; }
.muted { color: var(--ink-dim); }

/* the JS toggles this on nearly every panel - it must always win */
.hidden { display: none !important; }

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

em { font-style: italic; }
strong { font-weight: 600; }

p code, li code, td code, th code, .lede code, dd code {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 0.88em;
  overflow-wrap: break-word;
}

.sep { color: var(--ink-faint); }

/* -----------------------------------------------------------------------------
 * 3. 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: 30;
  min-width: 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.brand strong { white-space: nowrap; }
.backlink { text-decoration: none; white-space: nowrap; }
.backlink:hover { text-decoration: underline; }

.topactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.credits {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--ink-dim);
  white-space: nowrap;
}
.topup {
  font-size: 0.85em;
  padding: 4px 10px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.topup:hover { border-color: var(--accent); text-decoration: none; }

/* -----------------------------------------------------------------------------
 * 4. Lane bar - five lanes over one project, grouped into three stages.
 *
 * The stage labels (Inspect / Fix / Present) are part of the instrument and are
 * visible before sign-in, so they are plain markup rather than a hover state.
 * The bar WRAPS rather than scrolling: each group is a grid whose stage label
 * spans the full row, so on a narrow viewport a group drops to one tab per line
 * and every one of the five tabs stays on screen at 360px.
 * -------------------------------------------------------------------------- */

.lanebar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px 22px;
  padding: 12px 20px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.lanegroup {
  position: relative;
  display: grid;
  /* exactly two columns: no stage holds more than two lanes, and auto-fit would
   * otherwise open a phantom third column and strand the pair on the left */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 8px;
  align-content: start;
  flex: 2 1 19rem;
  min-width: 0;
}
.lanebar > .lanegroup:last-child { flex: 1 1 11rem; }

/* the drawn stage chevron - no unicode, no image, so nothing can fail to load */
.lanegroup + .lanegroup::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 60%;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--line);
  border-top: 2px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
}

.lanestage {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-left: 2px;
  white-space: nowrap;
}

/* a stage holding a single lane lets that lane span the whole group */
.lanestage + .lanetab:last-child { grid-column: 1 / -1; }

.lanetab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  min-width: 0;
  text-align: left;
  background: var(--panel2);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px 9px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.lanetab strong {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  overflow-wrap: break-word;
  min-width: 0;
}
.lanetab span {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--ink-dim);
  overflow-wrap: break-word;
  min-width: 0;
}
.lanetab:hover {
  background: var(--bg);
  border-color: var(--accent-soft);
  border-left-color: var(--accent);
}
/* the active lane has to be unmistakable, and it has to stay unmistakable in
 * the light theme where a translucent wash over white is nearly the same value
 * as the inactive surface. So it carries five signals, not one: the accent
 * wash, a 3px accent rule down the left edge, an accent border, an inset accent
 * ring, and a heavier label. */
.lanetab.active {
  background: var(--accent-wash);
  border-color: var(--accent-soft);
  border-left-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
  color: var(--ink);
}
.lanetab.active strong { font-weight: 700; color: var(--ink); }
.lanetab.active span { color: var(--ink); }
.lanetab:disabled { opacity: 0.5; cursor: not-allowed; }

/* -----------------------------------------------------------------------------
 * 5. Buttons + focus
 * -------------------------------------------------------------------------- */

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

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  text-decoration: none;
  white-space: nowrap;
}
.ghost:hover { background: var(--panel2); border-color: var(--accent); text-decoration: none; }
.ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 11px 22px;
  font-weight: 700;
}
.primary:hover { filter: brightness(1.07); }
.primary:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

.big {
  background: var(--panel2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 16px;
  max-width: 100%;
  overflow-wrap: break-word;
  white-space: normal;
}
.big:hover { border-color: var(--accent); }

/* one focus treatment for everything that can take focus */
a:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.lanetab:focus-visible { outline-offset: 3px; }

/* -----------------------------------------------------------------------------
 * 6. Layout, hero, cards
 * -------------------------------------------------------------------------- */

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

.hero h1 { margin-top: 6px; }
.lede { font-size: 1.05rem; color: var(--ink); max-width: 74ch; }
.herobtns { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 8px; }
.disclaimer { color: var(--ink-faint); max-width: 74ch; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 18px 0;
  min-width: 0;
}
.card h2 { font-size: 1.15rem; margin: 0 0 10px; }
.card h3 { font-size: 1.02rem; margin: 0 0 10px; }
.card > ol, .card > ul { margin: 8px 0 0; padding-left: 20px; }
.card > ol li, .card > ul li { margin: 6px 0; max-width: 82ch; overflow-wrap: break-word; }

.cardhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-width: 0;
}
.cardhead > h2, .cardhead > h3 { margin: 0; flex: 1 1 12rem; min-width: 0; }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; }
.btnrow.exports { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.btnrow.handoff {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.count {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 400;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: var(--pill);
  padding: 1px 9px;
  margin-left: 6px;
  white-space: nowrap;
  vertical-align: middle;
}
/* a count the script has not filled in yet must not paint as an empty pill */
.count:empty { display: none; }

.pane { display: block; margin-top: 20px; min-width: 0; }
.pane:first-of-type { margin-top: 14px; }
.pane > h3 { margin-bottom: 8px; }

.lanepane { display: block; min-width: 0; }

.twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 22px;
  align-items: start;
  min-width: 0;
}
.twocol > .pane { min-width: 0; }

.bullets { margin: 6px 0 0; padding-left: 20px; }
.bullets li { margin: 5px 0; max-width: 82ch; overflow-wrap: break-word; }
.bullets:empty { display: none; }

/* -----------------------------------------------------------------------------
 * 7. Form controls, drop zone, meter, notices, gates
 * -------------------------------------------------------------------------- */

.field { margin-bottom: 16px; min-width: 0; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.field > p { margin: 6px 0 8px; max-width: 82ch; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; min-width: 0; }
.row > * { min-width: 0; }

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

.dropzone {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel2);
  font-size: 0.9em;
  color: var(--ink-dim);
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
}
.dropzone > span { flex: 1 1 14rem; min-width: 0; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-wash); color: var(--ink); }
.dropzone input[type="file"] {
  width: auto;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  font-size: 0.78rem;
  padding: 4px;
  background: transparent;
  border-color: transparent;
}
.filelabel {
  flex: 0 0 auto;
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
}

.filterlabel { font-weight: 600; font-size: 0.9em; }

.meterrow {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 4px 0 12px;
  min-width: 0;
}
.meterrow > span { flex: 1 1 18rem; min-width: 0; }

/* a neutral advisory line - the script uses it for clip warnings, partial
 * results and behaviour notes, so it stays informative rather than alarming */
.notice {
  margin: 10px 0 0;
  padding: 9px 12px;
  font-size: 0.92em;
  color: var(--ink);
  border: 1px solid var(--warn);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--warn-wash);
  overflow-wrap: break-word;
}
.notice:empty { display: none; }

/* the "you need to sign in / top up before this will run" line */
.gate {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 0.92em;
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-sm);
  background: var(--accent-wash);
  overflow-wrap: break-word;
}
.gate:empty { display: none; }
.gateaction { font-weight: 700; margin-left: 6px; white-space: nowrap; }

#form .primary { margin-top: 14px; }

/* -----------------------------------------------------------------------------
 * 8. Prescan - the free in-browser reader's own output
 * -------------------------------------------------------------------------- */

#prescanBody > h3 {
  font-size: 0.95rem;
  margin: 18px 0 8px;
  color: var(--ink-dim);
  font-weight: 600;
  letter-spacing: 0.02em;
}
#prescanBody > h3:first-child { margin-top: 8px; }
#prescanBody > p { margin: 6px 0; max-width: 82ch; }

/* the counted severity strip above the reader's flag list */
.sevrow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin: 10px 0;
  min-width: 0;
}

.findings { margin-top: 10px; min-width: 0; }
.findings > p { margin: 6px 0; }

/* -----------------------------------------------------------------------------
 * 9. Progress steps
 * -------------------------------------------------------------------------- */

.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);
  min-width: 0;
}
.stepdot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: transparent;
}
.steplabel { min-width: 0; overflow-wrap: break-word; }

.step.done { color: var(--ink); }
.step.done .stepdot { background: var(--ok); border-color: var(--ok); }
.step.active { color: var(--ink); font-weight: 600; }
.step.active .stepdot {
  background: var(--accent);
  border-color: var(--accent);
  animation: pbid-pulse 1.1s ease-in-out infinite;
}
.step.todo { color: var(--ink-dim); }
.step.todo .stepdot { background: transparent; border-color: var(--line); }

@keyframes pbid-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* -----------------------------------------------------------------------------
 * 10. Result head: lane chip, verdict, headline, facts, summary
 * -------------------------------------------------------------------------- */

#result { scroll-margin-top: 90px; }

.reshead {
  display: flex;
  align-items: baseline;
  gap: 8px 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.reshead h2 { font-size: 1.35rem; margin: 2px 0 0; flex: 1 1 14rem; min-width: 0; }

.headline {
  font-size: 1.14rem;
  line-height: 1.45;
  font-weight: 500;
  color: var(--ink);
  margin: 12px 0 4px;
  max-width: 70ch;
  overflow-wrap: break-word;
}
.headline:empty { display: none; }

.summary { margin: 12px 0 0; max-width: 82ch; }
.summary:empty { display: none; }

/* the wrapping strip of small stat tiles */
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 4px;
  min-width: 0;
}
.fact {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 8.5rem;
  min-width: 0;
  padding: 8px 11px;
  background: var(--panel2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.factlabel {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
}
.factvalue {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: break-word;
  min-width: 0;
}
.factvalue:empty::before { content: "-"; color: var(--ink-faint); font-weight: 400; }

#runMeta { margin: 12px 0 0; }

/* -----------------------------------------------------------------------------
 * 11. Chips
 *
 * One geometry, many vocabularies. Rank is never carried by hue alone: the
 * ladder also moves through fill -> heavy outline -> outline -> plain -> dashed
 * and through font-weight 700 -> 700 -> 600 -> 500 -> 500, so the order stays
 * legible to a reader who cannot separate the two reds, and on paper where the
 * colour is gone entirely.
 * -------------------------------------------------------------------------- */

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  line-height: 1.7;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  padding: 0 8px;
  color: var(--ink-dim);
  background: var(--chip-bg);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: baseline;
}
.chip:empty { display: none; }

/* --- severity: the ladder described above ---------------------------------- */
.chip.sev-blocker {
  color: var(--crit-ink);
  background: var(--crit);
  border: 2px solid var(--crit);
  font-weight: 700;
  padding: 0 8px;
}
.chip.sev-high {
  color: var(--bad);
  background: var(--bad-wash);
  border: 2px solid var(--bad);
  font-weight: 700;
}
.chip.sev-medium {
  color: var(--warn);
  background: var(--warn-wash);
  border: 1px solid var(--warn);
  font-weight: 600;
}
.chip.sev-low {
  color: var(--ink-dim);
  background: var(--chip-bg);
  border: 1px solid var(--line);
  font-weight: 500;
}
.chip.sev-info {
  color: var(--info);
  background: var(--info-wash);
  border: 1px dashed var(--info);
  font-weight: 500;
}
:root[data-theme="light"] .chip.sev-high,
:root[data-theme="light"] .chip.sev-medium,
:root[data-theme="light"] .chip.sev-info { font-weight: 700; }

/* --- lane, plain descriptors ----------------------------------------------- */
.chip.lane {
  color: var(--accent);
  background: var(--accent-wash);
  border-color: var(--accent-soft);
  letter-spacing: 0.12em;
  font-weight: 700;
}
.chip.area,
.chip.role,
.chip.path,
.chip.gain {
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
}
.chip.fid {
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  font-weight: 700;
  border-style: dashed;
}
.chip.path { font-size: 0.68em; }

/* --- four shared tones, then every vocabulary mapped onto them --------------
 *
 * GOOD  solid-outlined green, weight 700
 * WARN  solid-outlined amber, weight 600
 * BAD   solid-outlined red, weight 700
 * VOID  dashed neutral-blue, weight 500 - "there was nothing here to judge",
 *       which is a different statement from "this is bad" and must not read
 *       as one.
 * ------------------------------------------------------------------------- */

.chip.ok,
.chip.st-pass,
.chip.keep-as-is,
.chip.rel-ok,
.chip.pv-ok,
.chip.dec-keep,
.chip.shape-star,
.chip.gain-large,
.chip.v-sound,
.chip.v-within-budget,
.chip.v-optimised,
.chip.v-ready-to-apply,
.chip.v-ship-ready {
  color: var(--ok);
  background: var(--ok-wash);
  border: 1px solid var(--ok);
  font-weight: 700;
}

.chip.aside,
.chip.keep-change,
.chip.rel-risky,
.chip.pv-busy,
.chip.dec-change,
.chip.dec-rebind,
.chip.shape-snowflake,
.chip.shape-flat,
.chip.gain-moderate,
.chip.v-needs-rework,
.chip.v-over-budget,
.chip.v-partially-optimised,
.chip.v-needs-decision {
  color: var(--warn);
  background: var(--warn-wash);
  border: 1px solid var(--warn);
  font-weight: 600;
}

.chip.st-fail,
.chip.keep-remove,
.chip.rel-wrong,
.chip.pv-needs-rework,
.chip.dec-remove,
.chip.shape-ambiguous,
.chip.v-not-a-model {
  color: var(--bad);
  background: var(--bad-wash);
  border: 2px solid var(--bad);
  font-weight: 700;
}

.chip.st-na,
.chip.st-unknown,
.chip.dec-merge,
.chip.shape-galaxy,
.chip.gain-readability-only,
.chip.v-no-capture,
.chip.v-no-measures-found,
.chip.v-no-report-layout,
.chip.v-not-authorable {
  color: var(--info);
  background: var(--info-wash);
  border: 1px dashed var(--info);
  font-weight: 500;
}

.chip.gain-small,
.chip.gain-none {
  color: var(--ink-dim);
  background: var(--chip-bg);
  border: 1px solid var(--line);
  font-weight: 500;
}

/* light theme paints these on white, where a 500 weight in a mid tone is the
 * first thing to go soft - lift every outlined chip a step */
:root[data-theme="light"] .chip.st-na,
:root[data-theme="light"] .chip.st-unknown,
:root[data-theme="light"] .chip.dec-merge,
:root[data-theme="light"] .chip.shape-galaxy,
:root[data-theme="light"] .chip.gain-readability-only,
:root[data-theme="light"] .chip.gain-small,
:root[data-theme="light"] .chip.gain-none,
:root[data-theme="light"] .chip.v-no-capture,
:root[data-theme="light"] .chip.v-no-measures-found,
:root[data-theme="light"] .chip.v-no-report-layout,
:root[data-theme="light"] .chip.v-not-authorable { font-weight: 700; }

/* --- bottleneck cause: a classification, not a ranking ---------------------
 * These sit in the same table row as a severity, so they stay deliberately
 * quiet - one neutral geometry, told apart by border style and letterform
 * rather than by shouting. */
.chip.cat-dax,
.chip.cat-model,
.chip.cat-visual,
.chip.cat-refresh,
.chip.cat-gateway,
.chip.cat-unknown {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel2);
  border: 1px solid var(--line);
}
.chip.cat-dax { border-left: 3px solid var(--accent); }
.chip.cat-model { border-left: 3px solid var(--info); }
.chip.cat-visual { border-left: 3px solid var(--ok); }
.chip.cat-refresh { border-left: 3px solid var(--warn); }
.chip.cat-gateway { border-left: 3px solid var(--bad); }
.chip.cat-unknown { border-style: dashed; color: var(--ink-dim); }

/* --- the headline verdict chip: bigger than the rest ----------------------- */
.chip.verdict {
  font-size: 0.78em;
  letter-spacing: 0.08em;
  padding: 1px 11px;
  flex: 0 0 auto;
}
/* a bare .verdict, should anything ever emit one without .chip */
.verdict { font-weight: 700; }
.verdict:empty { display: none; }

/* -----------------------------------------------------------------------------
 * 12. Findings - the reader's own flags and the lane's structured findings
 *     share one card shape.
 * -------------------------------------------------------------------------- */

.finding {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: var(--panel2);
  min-width: 0;
}
.finding:last-child { margin-bottom: 0; }

.finding.sev-blocker { border-left-color: var(--crit); }
.finding.sev-high { border-left-color: var(--bad); }
.finding.sev-medium { border-left-color: var(--warn); }
.finding.sev-low { border-left-color: var(--line); }
.finding.sev-info { border-left-color: var(--info); border-left-style: dashed; }

.findinghead {
  display: flex;
  align-items: baseline;
  gap: 6px 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  min-width: 0;
}
.findinghead .chip { flex: 0 0 auto; }

.findingwhat {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  max-width: 82ch;
}
.findingobj {
  margin: 4px 0 0;
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}
.findingwhy {
  margin: 6px 0 0;
  font-size: 0.94em;
  color: var(--ink-dim);
  max-width: 82ch;
}

/* -----------------------------------------------------------------------------
 * 13. Lane panes: measure cards, TMDL artifacts, code blocks, assumptions
 * -------------------------------------------------------------------------- */

.measure,
.artifact {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--panel2);
  min-width: 0;
}
.measure:last-child,
.artifact:last-child { margin-bottom: 0; }

.artifact { border-left-color: var(--accent); }

/* the expected gain, read off the card's left rule as well as its chip */
.measure.gain-large { border-left-color: var(--ok); border-left-width: 5px; }
.measure.gain-moderate { border-left-color: var(--ok); }
.measure.gain-small { border-left-color: var(--line); }
.measure.gain-readability-only { border-left-color: var(--info); border-left-style: dashed; }
.measure.gain-none { border-left-color: var(--line-soft); border-left-style: dotted; }

.measurehead {
  display: flex;
  align-items: baseline;
  gap: 6px 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-width: 0;
}
.measurehead strong {
  font-size: 1.02rem;
  font-weight: 700;
  flex: 1 1 12rem;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.measurehead .chip { flex: 0 0 auto; }

.measure > p,
.artifact > p { margin: 8px 0 0; max-width: 82ch; }

/* the named anti-pattern */
.pattern {
  font-family: var(--mono);
  font-size: 0.85em;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--warn);
  overflow-wrap: anywhere;
}

/* a labelled code block: DAX before/after, or a TMDL definition. Scrolls
 * inside itself so the page never moves sideways. */
.codewrap { margin: 10px 0 0; min-width: 0; }
.codelabel {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 3px;
}
pre.code {
  margin: 0;
  padding: 11px 12px;
  max-width: 100%;
  max-height: 32rem;
  background: var(--code-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  tab-size: 2;
}

.assume {
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--panel2);
  min-width: 0;
}
.assume:last-child { margin-bottom: 0; }
.assume > p { margin: 4px 0 0; max-width: 82ch; }
.assume > p:first-child { margin-top: 0; }
.assumetext { font-weight: 600; color: var(--ink); }

/* -----------------------------------------------------------------------------
 * 14. Tables
 *
 * The widest grid here is twelve columns, so the wrap is the scroller: it takes
 * both axes, which lets the head stay put while a long capture is read, and it
 * guarantees the document body itself never gains a horizontal scrollbar.
 * The vertical cap only engages once a table is genuinely taller than it.
 * -------------------------------------------------------------------------- */

.tablewrap {
  max-width: 100%;
  max-height: min(72vh, 46rem);
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

table.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.88em;
  min-width: 42rem;
}
table.grid th,
table.grid td {
  text-align: left;
  padding: 7px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: break-word;
}
table.grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel2);
  color: var(--ink-dim);
  font-weight: 700;
  font-size: 0.84em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover td { background: var(--panel2); }
/* break-word, not anywhere: an object name keeps its min-content width so the
 * column is sized to hold it, and the wrap above scrolls if that makes the
 * table wide. Splitting Sales[Amount] across two lines to save 40px is not a
 * trade this app should make. */
table.grid td.mono { font-family: var(--mono); font-size: 0.94em; overflow-wrap: break-word; }
table.grid td .chip { max-width: none; }

/* a captured visual, or a bottleneck, that is over the budget you set */
table.grid tr.over td { background: var(--bad-wash); }
table.grid tr.over:hover td { background: var(--bad-wash); }
table.grid tr.over td:first-child {
  box-shadow: inset 3px 0 0 var(--bad);
  font-weight: 700;
}

/* a relationship that exists but is not active - present, but not carrying
 * filter, so it is set back rather than removed */
table.grid tr.inactive td { color: var(--ink-dim); font-style: italic; }
table.grid tr.inactive td:first-child { box-shadow: inset 3px 0 0 var(--line); }

/* -----------------------------------------------------------------------------
 * 15. History, footer, toasts
 * -------------------------------------------------------------------------- */

#historyList > p { margin: 8px 0 0; }

.histrow {
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  min-width: 0;
}
.histrow:first-child { border-top: none; padding-top: 6px; }
.histrow > p { margin: 4px 0 0; max-width: 82ch; }
.histrow .btnrow { margin-top: 8px; }

.histhead {
  display: flex;
  align-items: baseline;
  gap: 6px 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.histhead strong { flex: 1 1 14rem; min-width: 0; overflow-wrap: break-word; }
.histhead .chip { flex: 0 0 auto; }

#historyFilter { flex: 0 1 12rem; }

.foot {
  border-top: 1px solid var(--line);
  padding: 22px 20px 30px;
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.9em;
}
.foot p { margin: 8px auto; max-width: 82ch; }
.foot a { color: var(--accent); }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(28rem, calc(100vw - 2rem));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: 0 8px 26px var(--shadow);
  font-size: 0.92em;
  overflow-wrap: break-word;
  animation: pbid-toast-in 0.22s ease-out both;
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--bad); }
.toast.gone { opacity: 0; transform: translateY(6px); }
.toast a { margin-left: 8px; font-weight: 700; }

@keyframes pbid-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* -----------------------------------------------------------------------------
 * 16. Docs pages - api.html and tokens.html share the app shell
 * -------------------------------------------------------------------------- */

/* api.html carries its own small inline <style> AFTER the link to this file, so
 * at equal specificity the page wins. Every rule below that has to override one
 * of those is written one step more specific on purpose - `body .doc x` beats
 * `.doc x`, `.doc .tabs .tab` beats `.doc .tab`. Nothing here is more specific
 * than it needs to be to land. */

body .doc {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  min-width: 0;
}
.doc h1 { font-size: 1.7rem; line-height: 1.25; }
body .doc h2 { font-size: 1.2rem; margin-top: 34px; }
body .doc h3 { font-size: 1.02rem; margin-top: 22px; }
body .doc p, body .doc li { max-width: 82ch; overflow-wrap: break-word; }
.doc section { min-width: 0; }

/* Docs tables are the one thing here that can be genuinely wider than a 360px
 * viewport, so each becomes its own horizontal scroller. `display: block` on a
 * table leaves the rows to an anonymous shrink-to-fit table box inside it: the
 * table still fills the column when it is wide, and scrolls inside this box
 * instead of pushing the document when it will not fit. */
body .doc table,
body .doc .lanecard table,
.card table:not(.grid) {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9em;
  margin: 12px 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
body .doc th, body .doc td,
.card table:not(.grid) th, .card table:not(.grid) td {
  text-align: left;
  padding: 7px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: break-word;
}
body .doc th, .card table:not(.grid) th {
  color: var(--ink-dim);
  font-weight: 700;
  font-size: 0.9em;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line);
}

body .doc code {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.88em;
  overflow-wrap: break-word;
}
body .doc pre,
body .doc .lanecard pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  max-width: 100%;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.55;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  tab-size: 2;
}
body .doc pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 1em;
}

/* an aside the reader is meant to stop at */
body .doc .callout,
.callout {
  border: 1px solid var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-wash);
  padding: 12px 16px;
  margin: 16px 0;
  min-width: 0;
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout h2, .callout h3 { margin-top: 0; font-size: 1rem; }

/* one worked example, or one lane's output contract */
body .doc .lanecard,
.lanecard {
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px 16px;
  margin: 16px 0;
  min-width: 0;
}
.lanecard > :first-child { margin-top: 0; }
.lanecard > :last-child { margin-bottom: 0; }
.lanecard h3, .lanecard h4 { margin-top: 0; }

/* the language switcher over each code group */
.codegroup { margin: 16px 0; min-width: 0; }
.doc .codegroup .tabs,
.tabs {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin: 0;
  min-width: 0;
}
.doc .tabs .tab,
.tab {
  background: var(--panel2);
  color: var(--ink-dim);
  cursor: pointer;
  border: 1px solid var(--line);
  border-bottom-color: transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding: 5px 12px;
  font-size: 0.84em;
  margin-bottom: -1px;
}
.doc .tabs .tab:hover,
.tab:hover { color: var(--ink); background: var(--bg); }
/* the selected language: accent text, a lifted surface, and a heavier label */
.doc .tabs .tab.active,
.tab.active {
  background: var(--code-bg);
  color: var(--accent);
  font-weight: 700;
  border-color: var(--line);
  border-bottom-color: var(--code-bg);
}
body .doc .codegroup pre,
.codegroup pre { border-radius: 0 8px 8px 8px; margin-top: 0; }
.codegroup pre[hidden] { display: none; }
pre[data-lang] { display: block; }
pre[data-lang][hidden] { display: none; }

/* tokens.html: the masked token, shown large enough to read back */
#tokenBox.mono.big {
  display: block;
  width: 100%;
  text-align: left;
  white-space: normal;
  word-break: break-all;
  background: var(--code-bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: 0.95rem;
  cursor: default;
}
#stateDetail { word-break: break-all; }

/* -----------------------------------------------------------------------------
 * 17. Responsive - checked at 360, 768 and 1440.
 *
 * The rule everywhere is the same: wide content keeps its own scroller, the
 * flex containers wrap, and every one of them carries min-width: 0 so a long
 * unbroken token cannot push the document sideways.
 * -------------------------------------------------------------------------- */

@media (max-width: 860px) {
  .twocol { grid-template-columns: 1fr; gap: 0 0; }
  .lanebar { gap: 12px 20px; padding: 12px 16px 14px; }
  table.grid { min-width: 36rem; }
}

@media (max-width: 620px) {
  main { padding: 16px 14px 48px; }
  .doc { padding: 16px 14px 48px; }
  .topbar { padding: 10px 14px; }
  .hero h1 { font-size: 1.5rem; }
  .doc h1 { font-size: 1.4rem; }
  .lede { font-size: 1rem; }
  .headline { font-size: 1.06rem; }
  .reshead h2 { font-size: 1.18rem; }
  .card { padding: 14px; }
  .lanecard, .callout { padding: 12px 13px; }
  .herobtns .big { flex: 1 1 100%; }
  .fact { flex: 1 1 7.5rem; }
  .lanebar { padding: 10px 14px 12px; gap: 10px 18px; }
  .lanegroup { flex: 1 1 100%; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
  .lanebar > .lanegroup:last-child { flex: 1 1 100%; }
  .lanegroup + .lanegroup::before { display: none; }
  .lanetab span { font-size: 0.78rem; }
  .tablewrap { max-height: min(66vh, 34rem); }
  table.grid { min-width: 32rem; font-size: 0.84em; }
  pre.code { font-size: 0.76rem; }
  .doc pre, .lanecard pre { font-size: 0.76rem; }
}

@media (max-width: 420px) {
  .topbar { gap: 8px; padding: 9px 12px; }
  .topactions { gap: 6px; }
  .credits { font-size: 0.8em; }
  .hero h1 { font-size: 1.32rem; }
  .lanebar { padding: 9px 12px 11px; }
  .lanegroup { grid-template-columns: 1fr; }
  .lanetab { padding: 7px 10px 8px; }
  .lanetab strong { font-size: 0.93rem; }
  .finding, .measure, .artifact { padding: 10px 12px; }
  .fact { flex: 1 1 100%; }
  .btnrow .ghost { flex: 1 1 auto; }
  .toasts { right: 10px; bottom: 10px; left: 10px; max-width: none; }
  table.grid { min-width: 28rem; }
}

/* -----------------------------------------------------------------------------
 * 18. Print
 *
 * The Print button on the result panel gets exactly this. Everything you cannot
 * act on from paper goes: the chrome, the form, the history, every control.
 * The tables un-scroll so nothing is clipped at the page edge, and the whole
 * thing is forced to black on white - which is why the severity ladder carries
 * border weight as well as colour.
 * -------------------------------------------------------------------------- */

@media print {
  .topbar,
  .lanebar,
  .toasts,
  .dropzone,
  .herobtns,
  .btnrow,
  .meterrow,
  .filterlabel,
  .gate,
  form,
  #form,
  #historyZone,
  #progressPanel,
  #dropZone,
  button,
  select,
  input,
  textarea,
  .foot { display: none !important; }

  html, body {
    background: #fff !important;
    color: #000 !important;
    overflow-x: visible;
  }
  body { font-size: 11pt; line-height: 1.4; }
  main, .doc { max-width: none; padding: 0; }

  .card, .lanecard, .callout {
    background: #fff !important;
    border: 1px solid #bbb !important;
    break-inside: avoid;
    page-break-inside: avoid;
    margin: 10pt 0;
    padding: 10pt;
  }
  .hero { break-after: avoid; page-break-after: avoid; }
  .pane, .lanepane { display: block; }

  .finding, .measure, .artifact, .assume, .fact, .histrow {
    background: #fff !important;
    border-color: #bbb !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  h1, h2, h3, h4, p, li, td, th, strong, .headline, .summary, .factvalue,
  .findingwhat, .assumetext { color: #000 !important; }
  .muted, .findingwhy, .findingobj, .factlabel, .codelabel, .lanestage,
  .pattern { color: #333 !important; }

  pre.code, .doc pre, .lanecard pre {
    background: #f5f5f5 !important;
    border-color: #bbb !important;
    color: #000 !important;
    white-space: pre-wrap;
    overflow: visible;
    max-height: none;
    break-inside: avoid;
  }
  code { background: #f5f5f5 !important; border-color: #ccc !important; color: #000 !important; }

  /* every chip loses its colour, so rank has to survive on weight and rule */
  .chip, .count {
    color: #000 !important;
    background: #fff !important;
    border: 1px solid #888 !important;
  }
  .chip.sev-blocker,
  .chip.sev-high,
  .chip.st-fail,
  .chip.rel-wrong,
  .chip.keep-remove,
  .chip.pv-needs-rework,
  .chip.dec-remove,
  .chip.shape-ambiguous,
  .chip.v-not-a-model {
    border: 2px solid #000 !important;
    font-weight: 700 !important;
  }
  .chip.sev-blocker { text-decoration: underline; }
  .chip.sev-info, .chip.st-na, .chip.st-unknown {
    border-style: dashed !important;
    font-weight: 500 !important;
  }

  /* the tables must not be clipped at the paper edge */
  .tablewrap {
    overflow: visible !important;
    max-height: none !important;
    border: none;
  }
  /* the docs tables are horizontal scrollers on screen; on paper they have to
   * become real tables again or the right-hand columns are lost at the margin */
  table.grid,
  body .doc table,
  body .doc .lanecard table,
  .card table:not(.grid) {
    display: table !important;
    min-width: 0 !important;
    width: 100%;
    font-size: 9pt;
    overflow: visible !important;
    table-layout: fixed;
  }
  body .doc td, body .doc th { overflow-wrap: anywhere; }
  table.grid thead th {
    position: static;
    background: #fff !important;
    color: #000 !important;
    border-bottom: 1px solid #888 !important;
  }
  table.grid th, table.grid td,
  .doc th, .doc td { border-bottom-color: #ddd !important; }
  table.grid tbody tr:hover td { background: #fff !important; }
  table.grid tr.over td { background: #fff !important; font-weight: 700; }
  table.grid tr.over td:first-child { box-shadow: none; }
  table.grid tr.inactive td { color: #333 !important; box-shadow: none; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; page-break-inside: avoid; }

  a { color: #000 !important; text-decoration: none; }
  .hidden { display: none !important; }
}

/* -----------------------------------------------------------------------------
 * 19. Reduced motion
 * -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
  .step.active .stepdot { opacity: 1; }
  .toast { opacity: 1; transform: none; }
  .toast.gone { opacity: 0; transform: none; }
}

