/* InspectorPrep — dark "shop floor" theme.
   Layout: fixed topbar + sidenav shell, scrolling main outlet. */

:root {
  --bg: #0d1117;
  --bg-raised: #161b22;
  --bg-sunken: #010409;
  --line: #30363d;
  --line-soft: #21262d;
  --text: #e6edf3;
  --text-dim: #8b949e;
  --text-faint: #6e7681;
  --accent: #f0883e;
  --accent-soft: rgba(240, 136, 62, 0.14);
  --blue: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --amber: #d29922;
  --purple: #bc8cff;

  --r-sm: 4px;
  --r: 8px;
  --r-lg: 14px;
  --topbar-h: 56px;
  --nav-w: 232px;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

.skip {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #111; padding: 8px 14px; border-radius: 0 0 var(--r) 0;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- Topbar ---------- */

.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 40;
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px;
  background: linear-gradient(150deg, var(--accent), #d1660a);
  color: #17110a; font-weight: 800; font-size: 12px; letter-spacing: .3px;
}
.brand-text { font-size: 15px; letter-spacing: .2px; }
.brand-text strong { color: var(--accent); font-weight: 700; }

.topbar-target { margin-left: auto; }
.target-select {
  background: var(--bg-sunken); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r); padding: 7px 10px; font: inherit; font-size: 13px; min-width: 230px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.tier-chip {
  font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(240,136,62,.35);
}
.tier-chip[data-tier="pass"] { background: rgba(63,185,80,.12); color: var(--green); border-color: rgba(63,185,80,.35); }
.tier-chip[data-tier="enterprise"] { background: rgba(188,140,255,.12); color: var(--purple); border-color: rgba(188,140,255,.35); }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #21262d; color: var(--text-dim); font-size: 11px; font-weight: 700;
  border: 1px solid var(--line);
}

.icon-btn {
  background: none; border: 1px solid transparent; color: var(--text-dim);
  font-size: 17px; padding: 5px 9px; border-radius: var(--r-sm); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }
.nav-toggle { display: none; }

/* ---------- Shell ---------- */

.shell { display: flex; padding-top: var(--topbar-h); min-height: 100%; }

/**
 * The single flow column: content, then the permanent footer notice.
 *
 * `.shell` is a flex ROW, so `#main` and the footer must share one child or
 * they lay out side by side. `min-width: 0` matters: the flex default is
 * `auto`, which refuses to shrink below the content's intrinsic width and pushes
 * the document sideways instead of narrowing.
 */
.shell-body {
  flex: 1; min-width: 0;
  margin-left: var(--nav-w);
  display: flex; flex-direction: column;
}

.sidenav {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--nav-w);
  padding: 16px 10px; background: var(--bg-raised);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto; z-index: 30;
}
.sidenav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border-radius: var(--r); color: var(--text-dim); text-decoration: none;
  font-size: 13.5px; font-weight: 500;
}
.sidenav a:hover { background: var(--bg-sunken); color: var(--text); }
.sidenav a.active {
  background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
}
.nav-ico { font-size: 14px; width: 16px; text-align: center; opacity: .9; }
/* Inline SVG icons replace the old unicode glyphs. */
svg.nav-ico { width: 17px; height: 17px; flex: none; display: block; opacity: .85; }
.sidenav a.active svg.nav-ico { opacity: 1; }
.brand-mark svg.brand-svg { display: block; color: currentColor; }

.content {
  flex: 1; min-width: 0;
  padding: 24px 26px 28px;
  max-width: 1440px; outline: none;
}

/* ---------- Page furniture ---------- */

.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0 0 5px; font-size: 21px; font-weight: 650; letter-spacing: -.2px; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 13px; }

.card {
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-title { margin: 0 0 4px; font-size: 14px; font-weight: 650; letter-spacing: .1px; }
.card-sub { margin: 0 0 14px; color: var(--text-faint); font-size: 12px; }

.grid { display: grid; gap: 16px; }
/* Grid items default to a min-content floor, so one wide child widens the whole
   track and the page. Every direct child opts out. */
.grid > *, .split-main > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-main { grid-template-columns: minmax(0, 1fr) 340px; }

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-main, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .sidenav { transform: translateX(-100%); transition: transform .18s ease; }
  .sidenav.open { transform: none; }
  .content { margin-left: 0; padding: 18px 14px 60px; }
  .grid-2, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Buttons / chips ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--bg-sunken); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #484f58; background: #12161c; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #17110a; font-weight: 650; }
.btn-primary:hover { background: #ff9d52; border-color: #ff9d52; }
.btn-lg { padding: 12px 20px; font-size: 14px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-accept { border-color: rgba(63,185,80,.5); color: var(--green); }
.btn-reject { border-color: rgba(248,81,73,.5); color: var(--red); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 650; letter-spacing: .3px; text-transform: uppercase;
  background: var(--bg-sunken); color: var(--text-dim); border: 1px solid var(--line);
}
.pill-pass { background: rgba(63,185,80,.12); color: var(--green); border-color: rgba(63,185,80,.35); }
.pill-fail { background: rgba(248,81,73,.12); color: var(--red); border-color: rgba(248,81,73,.35); }
.pill-warn { background: rgba(210,153,34,.12); color: var(--amber); border-color: rgba(210,153,34,.35); }
.pill-info { background: rgba(88,166,255,.12); color: var(--blue); border-color: rgba(88,166,255,.35); }

.clause-ref {
  font-family: var(--mono); font-size: 11.5px; color: var(--blue);
  background: rgba(88,166,255,.08); border: 1px solid rgba(88,166,255,.25);
  padding: 1px 6px; border-radius: var(--r-sm); white-space: nowrap;
}

/* ---------- Tri-part meter ---------- */

/**
 * Three dials rather than one averaged bar.
 *
 * The product's central claim is that the exam is scored per section, so a
 * single averaged bar would contradict it visually. Each dial carries the
 * per-section minimum as a tick, so "how far above the line am I" is legible
 * without reading a number.
 */
.dials {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; margin: 4px 0 14px;
}
.dial-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }

.dial { width: 100%; max-width: 118px; height: auto; display: block; overflow: visible; }
.dial-track { fill: none; stroke: var(--bg-sunken); stroke-width: 9; stroke-linecap: round; }
.dial-fill { fill: none; stroke-width: 9; stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.dial-tick { stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; opacity: .55; }

.dial-pass .dial-fill { stroke: var(--green); }
.dial-fail .dial-fill { stroke: var(--red); }
.dial-neutral .dial-fill { stroke: var(--blue); }
.dial-neutral .dial-track { stroke: var(--bg-sunken); }

.dial-value {
  font-family: var(--mono); font-size: 17px; font-weight: 700; fill: var(--text);
}
.dial-pass .dial-value { fill: var(--green); }
.dial-fail .dial-value { fill: var(--red); }

.dial-label { font-size: 12.5px; font-weight: 650; color: var(--text); }
.dial-sub { font-size: 10.5px; color: var(--text-faint); }

/* Detail rows under the dials carry what a 118px dial cannot. */
.part-detail { border-top: 1px solid var(--line-soft); }
.part-detail-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft);
}
.part-detail-row:last-child { border-bottom: none; }
.part-detail-name { font-size: 12.5px; color: var(--text-dim); }
.part-detail-pct {
  font-family: var(--mono); font-size: 13.5px; font-weight: 700; color: var(--text-faint);
}
.part-detail-pct.pass { color: var(--green); }
.part-detail-pct.fail { color: var(--red); }
.part-detail-meta { font-size: 11px; color: var(--text-faint); min-width: 168px; text-align: right; }

@media (max-width: 520px) {
  .dials { gap: 6px; }
  .part-detail-meta { min-width: 0; }
  .part-detail-row { flex-wrap: wrap; gap: 4px 8px; }
}

.tripart { display: grid; gap: 14px; }
.part-row { display: grid; gap: 6px; }
.part-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.part-head .part-id {
  font-weight: 800; font-size: 11px; letter-spacing: .6px;
  width: 20px; height: 20px; display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--text-dim);
}
.part-head .part-name { font-weight: 600; }
.part-head .part-book { color: var(--text-faint); font-size: 11px; }
.part-head .spacer { flex: 1; }
.part-head .part-pct { font-family: var(--mono); font-weight: 700; font-size: 14px; }

.bar { height: 8px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; border: 1px solid var(--line-soft); }
.bar > i { display: block; height: 100%; border-radius: 999px; transition: width .35s ease; }
.bar-fail > i { background: var(--red); }
.bar-warn > i { background: var(--amber); }
.bar-pass > i { background: var(--green); }
.bar-neutral > i { background: var(--blue); }

.threshold-tick { position: relative; height: 0; }
.threshold-tick::before {
  content: ""; position: absolute; top: -11px; height: 13px; width: 2px;
  background: var(--text-faint); left: 72%;
}

.readiness-verdict {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--bg-sunken); font-size: 13px;
}
.readiness-verdict[data-state="pass"] { border-color: rgba(63,185,80,.4); background: rgba(63,185,80,.08); }
.readiness-verdict[data-state="fail"] { border-color: rgba(248,81,73,.4); background: rgba(248,81,73,.08); }
.readiness-verdict strong { font-weight: 700; }
.readiness-verdict .hint { color: var(--text-dim); }

/* ---------- Stat tiles ---------- */

.stat { background: var(--bg-sunken); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 13px 14px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); font-weight: 650; }
.stat-value { font-family: var(--mono); font-size: 24px; font-weight: 700; line-height: 1.25; margin-top: 3px; }
.stat-value small { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.stat-foot { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }

.streak-dots { display: flex; gap: 4px; margin-top: 8px; }
.streak-dots i { width: 11px; height: 11px; border-radius: 3px; background: var(--line-soft); }
.streak-dots i.on { background: var(--accent); }

/* ---------- Lists ---------- */

.list { display: grid; gap: 9px; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  background: var(--bg-sunken); border: 1px solid var(--line-soft); border-radius: var(--r);
}
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-size: 13px; font-weight: 600; }
.list-row .s { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12.5px; }
.kv:last-child { border-bottom: none; }
.kv dt { color: var(--text-dim); }
/*
 * A long value — an email address, a plan name — must wrap rather than push the
 * page sideways. `min-width: 0` lets the flex child actually shrink, which it
 * will not do otherwise: a flex item's default `min-width: auto` refuses to go
 * below its content, so a 30-character email is enough to overflow a 320px
 * viewport with no other element at fault.
 */
.kv dd { margin: 0; font-family: var(--mono); min-width: 0; overflow-wrap: anywhere; }

/* ---------- Heatmap ---------- */

.heatmap { display: grid; gap: 3px; }
.hm-row { display: grid; grid-template-columns: 130px repeat(7, minmax(0, 1fr)); gap: 3px; align-items: center; }
.hm-label { font-size: 11.5px; color: var(--text-dim); padding-right: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-cell { height: 24px; border-radius: 3px; display: grid; place-items: center; font-size: 10px; font-family: var(--mono); font-weight: 650; color: #0d1117; }
.hm-scale { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 11px; color: var(--text-faint); }
.hm-scale i { width: 20px; height: 10px; border-radius: 2px; display: block; }

/* ---------- Part B lab layout ----------
   The three-column grid is the right shape on a wide screen, but it used to
   have no breakpoint at all: below ~1030px the middle column collapsed to
   zero width and the specimen viewport — the entire point of the screen —
   became invisible while the two side panels stayed on screen. */

.lab {
  display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; background: var(--bg-raised); min-height: 620px;
  grid-template-columns: 232px minmax(0, 1fr) 300px;
}

/* Two columns: specimen viewport keeps a usable width, panels drop below. */
@media (max-width: 1180px) {
  .lab { grid-template-columns: 210px minmax(0, 1fr); }
  .lab > .lab-col:last-child {
    grid-column: 1 / -1;
    border-right: none;
    border-top: 1px solid var(--line);
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px;
  }
}

/* One column. Viewport first, because nothing works without it. */
@media (max-width: 820px) {
  .lab { grid-template-columns: 1fr; min-height: 0; }
  .lab > .lab-col { border-right: none; border-bottom: 1px solid var(--line); }
  .lab > .lab-viewport { order: -1; border-bottom: 1px solid var(--line); }
  .lab > .lab-col:last-child {
    grid-column: auto;
    grid-template-columns: 1fr;
    border-top: none;
  }
  .lab-stage { padding: 8px; }
}

/* ---------- Part B lab components ---------- */

.lab-objective {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg-raised); padding: 14px 16px; margin-bottom: 14px;
}
.lab-obj-main { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.lab-obj-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-faint); font-weight: 700; flex: none;
}
.lab-obj-text { font-size: 13.5px; line-height: 1.55; margin: 0; flex: 1 1 320px; }

.lab-summary {
  margin: 10px 0 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55;
  padding-left: 10px; border-left: 2px solid var(--line);
}

.lab-steps { display: flex; gap: 8px; list-style: none; margin: 12px 0 0; padding: 0; flex-wrap: wrap; }
.lab-steps li {
  font-size: 11.5px; color: var(--text-faint); padding: 4px 10px 4px 8px;
  border: 1px solid var(--line-soft); border-radius: 999px; background: var(--bg-sunken);
}
.lab-steps li.done { color: var(--green); border-color: rgba(63,185,80,.4); background: rgba(63,185,80,.08); }

.lab-head-count {
  float: right; font-family: var(--mono); letter-spacing: 0;
  color: var(--text-faint); font-weight: 600;
}

.spec-tick {
  display: inline-block; margin-left: 6px; color: var(--green); font-weight: 700;
}

.lab-nav {
  border-top: 1px solid var(--line); padding: 9px 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-raised);
}
.lab-pos { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.lab-progress {
  display: flex; align-items: center; gap: 8px; flex: 1 1 100%;
  margin-top: 2px; min-width: 0;
}
.lab-progress .bar { flex: 1; }

.tool-item .grow { display: flex; flex-direction: column; min-width: 0; }
.tool-item .tool-name { font-weight: 600; }
.tool-item .tool-reads { font-size: 10.5px; color: var(--text-faint); }
.tool-item.fits { border-color: rgba(63,185,80,.35); }

.measure-assist {
  margin-top: 16px; padding: 12px; border-radius: var(--r);
  border: 1px solid var(--line-soft); background: var(--bg-sunken);
}
.measure-assist-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.lab-warn-inline { color: var(--amber); font-weight: 650; }

.field-hint { font-size: 11px; color: var(--text-faint); line-height: 1.5; margin: 6px 0 0; }

/* Lab elements: stage, status line, specimen list, gauges, limits. */
.lab-col { padding: 15px; border-right: 1px solid var(--line); background: var(--bg-sunken); overflow-y: auto; }
.lab-col:last-child { border-right: none; background: var(--bg-raised); }
.lab-col-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); font-weight: 700; margin-bottom: 10px; }
.lab-viewport { position: relative; background: #0a0e13; display: flex; flex-direction: column; min-width: 0; }
.lab-stage { flex: 1; display: grid; place-items: center; padding: 12px; position: relative; }
.lab-stage svg { width: 100%; height: 100%; max-height: 560px; touch-action: none; cursor: crosshair; }
.lab-status {
  border-top: 1px solid var(--line); padding: 8px 12px; font-family: var(--mono);
  font-size: 12px; color: var(--text-dim); background: var(--bg-sunken);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.lab-status b { color: var(--accent); }

.spec-item {
  display: block; width: 100%; text-align: left; padding: 9px 10px; margin-bottom: 6px;
  background: var(--bg-raised); border: 1px solid var(--line-soft); border-radius: var(--r);
  color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
}
.spec-item:hover { border-color: #484f58; }
.spec-item.active { border-color: var(--accent); background: var(--accent-soft); }
.spec-item .t { font-weight: 600; display: block; }
.spec-item .s { color: var(--text-faint); font-size: 10.5px; }

/*
 * The "N more specimens" row.
 *
 * Styled as a dashed, recessed row rather than a disabled specimen button, so it
 * reads as a gate and not as a specimen that failed to load.
 */
.spec-locked {
  display: block; width: 100%; text-align: left; padding: 9px 10px; margin-bottom: 6px;
  background: transparent; border: 1px dashed var(--line-soft); border-radius: var(--r);
  color: var(--text-faint); font: inherit; font-size: 12px; cursor: pointer;
}
.spec-locked:hover { border-color: var(--accent); color: var(--text); }
.spec-locked .t { font-weight: 600; display: block; }
.spec-locked .s { display: block; font-size: 10.5px; color: var(--text-faint); }

/*
 * The Free / Pro comparison table.
 *
 * A real table, not a two-column card grid, because the reader's question is
 * "which of these do I lose" and that is a row-by-row question. The Pro column
 * carries the emphasis — it is the one being sold — but the Free column is not
 * greyed out, because it is not a lesser product, it is a smaller one.
 */
.version-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.version-table th, .version-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
.version-table thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.version-table tbody th { font-weight: 500; color: var(--text-dim); width: 46%; }
.version-table td.yes { color: var(--green); font-weight: 600; white-space: nowrap; }
.version-table td.no { color: var(--text-faint); white-space: nowrap; }
.version-table [data-col="pro"] { background: var(--accent-soft); }
.version-table caption {
  caption-side: bottom; padding-top: 10px; text-align: left;
  font-size: 11.5px; color: var(--text-faint); line-height: 1.5;
}

.tool-item {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 9px 10px; margin-bottom: 6px; border-radius: var(--r);
  background: var(--bg-raised); border: 1px solid var(--line-soft);
  color: var(--text); font: inherit; font-size: 12px; cursor: grab;
}
.tool-item:hover { border-color: #484f58; }
.tool-item.active { border-color: var(--blue); background: rgba(88,166,255,.1); }
.tool-item .glyph { font-size: 16px; width: 20px; text-align: center; }

.field { margin-bottom: 11px; }
.field label { display: block; font-size: 11.5px; color: var(--text-dim); margin-bottom: 4px; }
.field input, .field select {
  width: 100%; padding: 8px 10px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--bg-sunken); color: var(--text); font: inherit; font-size: 13px;
}
.field input.mono { font-family: var(--mono); }

.measure-readout {
  display: flex; align-items: baseline; gap: 8px; padding: 11px 12px; border-radius: var(--r);
  background: var(--bg-sunken); border: 1px solid var(--line); margin-bottom: 12px;
}
.measure-readout .num { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--accent); }
.measure-readout .unit { color: var(--text-dim); font-size: 12px; }
.measure-readout .lbl { margin-left: auto; font-size: 11px; color: var(--text-faint); text-align: right; }

.limit-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-bottom: 12px; }
.limit-table th, .limit-table td { padding: 5px 7px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.limit-table th { color: var(--text-faint); text-transform: uppercase; letter-spacing: .4px; font-size: 10px; font-weight: 700; }
.limit-table td.num { font-family: var(--mono); text-align: right; }
.limit-table tr.over td { color: var(--red); font-weight: 650; }
.limit-table tr.ok td:last-child { color: var(--green); }

.notice {
  display: flex; gap: 9px; padding: 10px 12px; border-radius: var(--r); font-size: 12px;
  border: 1px solid rgba(210,153,34,.35); background: rgba(210,153,34,.09); color: #e3c37a;
}
.notice strong { color: var(--amber); }
.notice.info { border-color: rgba(88,166,255,.35); background: rgba(88,166,255,.08); color: #a9cdf9; }
.notice.info strong { color: var(--blue); }

/* ---------- Practice ---------- */

.mode-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.mode-card {
  text-align: left; padding: 15px; border-radius: var(--r-lg); cursor: pointer;
  background: var(--bg-sunken); border: 1px solid var(--line); color: var(--text);
  font: inherit; display: flex; flex-direction: column; gap: 5px;
}
.mode-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.mode-card .ico { font-size: 20px; }
.mode-card .t { font-weight: 650; font-size: 13.5px; }
.mode-card .s { font-size: 11.5px; color: var(--text-faint); line-height: 1.45; }

.q-stem { font-size: 15px; line-height: 1.6; margin: 0 0 16px; }
.q-opts { display: grid; gap: 9px; }
.q-opt {
  display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--bg-sunken); cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--text); text-align: left; width: 100%;
}
.q-opt:hover:not(:disabled) { border-color: #484f58; }
.q-opt .key {
  font-family: var(--mono); font-weight: 700; font-size: 12px; flex: none;
  width: 22px; height: 22px; display: grid; place-items: center; border-radius: var(--r-sm);
  background: var(--bg-raised); border: 1px solid var(--line); color: var(--text-dim);
}
.q-opt[aria-pressed="true"] { border-color: var(--blue); background: rgba(88,166,255,.08); }
.q-opt.correct { border-color: var(--green); background: rgba(63,185,80,.1); }
.q-opt.correct .key { background: var(--green); color: #06180a; border-color: var(--green); }
.q-opt.incorrect { border-color: var(--red); background: rgba(248,81,73,.1); }
.q-opt.incorrect .key { background: var(--red); color: #1a0605; border-color: var(--red); }
.q-opt:disabled { cursor: default; }

.explain {
  margin-top: 16px; padding: 14px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--bg-sunken);
}
.explain h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); }
.explain p { margin: 0 0 10px; font-size: 13px; line-height: 1.6; }
.explain .why { font-size: 12.5px; color: var(--text-dim); }
.explain .why b { color: var(--text); }

.q-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 12px; color: var(--text-dim); }
.q-progress .bar { flex: 1; }
.timer { font-family: var(--mono); font-weight: 700; }
.timer.urgent { color: var(--red); }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-sunken); color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer;
  /* Code names run to 40 characters. Without a cap a single chip is wider than
     a phone and pushes the page sideways. */
  max-width: 100%; min-width: 0;
  display: inline-flex; align-items: center; gap: 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip:hover { border-color: #484f58; color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---------- Tables ---------- */

/**
 * A card that holds a data table becomes its own scroll container on narrow
 * screens. Roster, mock and results tables have a fixed column set and cannot
 * reflow, so without this they widen the whole document.
 *
 * `:has()` keeps this to one rule instead of wrapping nine tables at their call
 * sites. No `min-width` on the table itself — an `overflow-x: auto` container
 * already floors at zero for grid sizing, whereas a min-width propagates
 * upward and re-creates the page overflow it was meant to prevent.
 */
.table-wrap { overflow-x: auto; }

@media (max-width: 900px) {
  .card:has(> table.data) { overflow-x: auto; }
}

table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th {
  text-align: left; padding: 8px 10px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-faint); border-bottom: 1px solid var(--line); font-weight: 700;
}
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tbody tr:hover { background: var(--bg-sunken); }
table.data .num { font-family: var(--mono); text-align: right; }
table.data .who { display: flex; align-items: center; gap: 9px; }
table.data .who .av {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg-raised); border: 1px solid var(--line); font-size: 10px;
  font-weight: 700; color: var(--text-dim); flex: none;
}

/* ---------- Checklist ---------- */

.check { display: grid; gap: 8px; }
.check-row {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px; border-radius: var(--r);
  border: 1px solid var(--line-soft); background: var(--bg-sunken); font-size: 13px;
}
.check-row.done { border-color: rgba(63,185,80,.35); background: rgba(63,185,80,.06); }
.check-row .box {
  flex: none; width: 19px; height: 19px; border-radius: var(--r-sm); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 12px; margin-top: 1px; color: transparent;
}
.check-row.done .box { background: var(--green); border-color: var(--green); color: #06180a; }
.check-row .grow { flex: 1; }
.check-row .req { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }

.progress-line { display: flex; align-items: center; gap: 11px; font-size: 12.5px; color: var(--text-dim); }
.progress-line .bar { flex: 1; }

/* ---------- OJT log ---------- */

.ojt-head { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.ojt-head .field { margin-bottom: 0; width: 130px; }

.signature-box {
  margin-top: 9px; padding: 9px 11px; border: 1px dashed var(--line); border-radius: var(--r);
  font-family: var(--mono); font-size: 11.5px; color: var(--text-faint);
}

/* ---------- Toasts ---------- */

.toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  padding: 11px 15px; border-radius: var(--r); font-size: 13px;
  background: var(--bg-raised); border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(1,4,9,.6); max-width: 340px;
  animation: toast-in .18s ease;
}
.toast[data-kind="ok"] { border-color: rgba(63,185,80,.45); }
.toast[data-kind="err"] { border-color: rgba(248,81,73,.45); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- unaffiliation notice, pricing, footer ---------- */

.legal-gate {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 9, 13, .92); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px; overflow-y: auto;
}
.legal-gate-panel {
  max-width: 620px; width: 100%;
  background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.gate-title { font-size: 17px; margin: 0 0 10px; }
.gate-lead { font-size: 13.5px; line-height: 1.6; color: var(--text-dim); margin: 0 0 14px; }
.gate-points { margin: 0 0 14px; padding-left: 20px; }
.gate-points li { font-size: 13px; line-height: 1.6; margin-bottom: 8px; }
.gate-fine {
  font-size: 11.5px; color: var(--text-faint); line-height: 1.55; margin: 0;
  padding-top: 12px; border-top: 1px solid var(--line-soft);
}

.price-block {
  display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap;
  padding: 16px; border-radius: var(--r);
  background: var(--bg-sunken); border: 1px solid var(--line-soft);
  margin-bottom: 12px;
}
.price-main { display: flex; align-items: baseline; gap: 2px; flex: none; }
.price-cur { font-size: 18px; color: var(--text-dim); font-weight: 600; }
.price-val { font-size: 42px; font-weight: 700; color: var(--accent); line-height: 1; font-family: var(--mono); }
.price-suffix { font-size: 12px; color: var(--text-faint); margin-left: 4px; }
.price-side { flex: 1 1 260px; }
.price-note { font-size: 12.5px; color: var(--text-dim); line-height: 1.55; margin-bottom: 6px; }
.price-honest {
  font-size: 12px; color: var(--amber); line-height: 1.55; margin-top: 8px;
  padding-top: 8px; border-top: 1px dashed var(--line);
}
.price-fine { font-size: 11.5px; color: var(--text-faint); line-height: 1.6; margin: 10px 0 0; }

.app-foot {
  margin: 0; padding: 14px 26px 40px;
  border-top: 1px solid var(--line-soft);
  max-width: 1440px; width: 100%;
}
.foot-notice { font-size: 11.5px; color: var(--text-faint); line-height: 1.6; margin: 0 0 4px; }
.foot-meta { font-size: 11px; color: var(--text-faint); margin: 0; }
.foot-meta a { color: var(--blue); }

.tier-chip.pending { border-color: var(--amber); color: var(--amber); }

/* Long code identifiers, file paths and clause references must never widen the
   document — they wrap instead. */
.content, .content * { overflow-wrap: break-word; }

@media (max-width: 760px) {
  .app-foot { margin-left: 0; padding: 14px 14px 60px; }
  .content { padding: 18px 14px 24px; }
  .shell-body { margin-left: 0; }
  .legal-gate-panel { padding: 20px 18px; }
  .price-val { font-size: 34px; }
}

/* ---------- Study guide ---------- */

.guide-row {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-sunken); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 13px 15px; margin-bottom: 9px;
  color: var(--text); font: inherit;
}
.guide-row:hover { border-color: var(--accent); }
.guide-row[aria-pressed="true"] { background: rgba(63,185,80,.05); }

.guide-row-title {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 14px; font-weight: 650; margin-bottom: 4px;
}
.guide-row-blurb { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.guide-row-meta { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.guide-p { font-size: 14px; line-height: 1.68; margin: 0 0 14px; }
.guide-list { margin: 0 0 14px; padding-left: 20px; }
.guide-list li { font-size: 13.5px; line-height: 1.6; margin-bottom: 7px; }

.guide-table-wrap { overflow-x: auto; margin-bottom: 14px; }
.guide-table-wrap table.data { min-width: 480px; }

.callout {
  border-radius: var(--r); padding: 13px 15px; margin-bottom: 12px;
  border: 1px solid var(--line); background: var(--bg-sunken);
}
.callout-title { font-size: 12.5px; font-weight: 700; margin-bottom: 5px; }
.callout-text { font-size: 13px; line-height: 1.62; color: var(--text-dim); }

.callout[data-kind="trap"] { border-color: rgba(248,81,73,.4); background: rgba(248,81,73,.07); }
.callout[data-kind="trap"] .callout-title { color: #ff8a82; }
.callout[data-kind="note"] { border-color: rgba(88,166,255,.35); background: rgba(88,166,255,.06); }
.callout[data-kind="note"] .callout-title { color: var(--blue); }
.callout[data-kind="warn"] { border-color: rgba(210,153,34,.4); background: rgba(210,153,34,.07); }
.callout[data-kind="warn"] .callout-title { color: var(--amber); }

.formula {
  border: 1px solid var(--line-soft); border-radius: var(--r);
  background: var(--bg-sunken); padding: 14px; margin-bottom: 14px;
}
.formula-expr {
  font-family: var(--mono); font-size: 14px; color: var(--accent);
  padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px dashed var(--line);
}
.formula-vars { margin: 0; font-size: 12.5px; }
.formula-vars > div { display: flex; gap: 10px; padding: 3px 0; }
.formula-vars dt { font-family: var(--mono); color: var(--blue); flex: none; min-width: 120px; }
.formula-vars dd { margin: 0; color: var(--text-dim); }
.formula-result { margin-top: 10px; font-size: 12.5px; color: var(--text); }
.formula-note {
  margin-top: 10px; font-size: 11.5px; color: var(--text-faint);
  font-style: italic; line-height: 1.55;
}

.example {
  border: 1px solid var(--line-soft); border-radius: var(--r);
  background: var(--bg-sunken); padding: 14px; margin-bottom: 14px;
}
.example-title { font-size: 13px; font-weight: 650; margin-bottom: 8px; }
.example ol { margin: 10px 0 0; padding-left: 20px; }
.example li { font-size: 13px; line-height: 1.6; margin-bottom: 8px; }

/* ---------- SVG specimen styling ---------- */

.base-metal { fill: #2b333c; stroke: #454e59; stroke-width: 1; }
.weld-metal { fill: #4a5663; stroke: #6e7d8c; stroke-width: 1.2; }
.defect-mark { fill: rgba(248,81,73,.55); stroke: #ff8a82; stroke-width: 1.2; }
.defect-mark.ok { fill: rgba(63,185,80,.4); stroke: #6ee787; }
.caliper-line { stroke: var(--blue); stroke-width: 2; }
.caliper-jaw { stroke: var(--blue); stroke-width: 2.4; }
.caliper-text { fill: #58a6ff; font: 600 13px var(--mono); }

/* Engineering dimension lines: witness, arrow, figure. */
.dim-witness { stroke: rgba(110,118,129,.5); stroke-width: 1; }
.dim-line { stroke: rgba(139,148,158,.7); stroke-width: 1; }
.dim-arrow { fill: rgba(139,148,158,.8); }
.dim-text { fill: #8b949e; font: 10.5px var(--mono); }
.guide-line { stroke: rgba(88,166,255,.35); stroke-width: 1; stroke-dasharray: 4 4; }
.hit-outline { fill: none; stroke: #ffd33d; stroke-width: 2; }

/* Convex and concave faces are drawn as part of the weld outline rather than
   as a discrete red mark, because a Hi-Lo reads crown height relative to the
   base metal — there is no separate location to point at. They are called out
   with a label and a guide line instead. */
.face-note { font: 600 10.5px var(--mono); fill: var(--amber); }
.face-guide { stroke: var(--amber); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; }