/* VarianceIQ (demo for Strides GCC, a fictional retailer). Mobile first, light and dark.
   Look and feel adapted from AdminKit (MIT licence, (c) 2020-2024 AdminKit Authors, https://adminkit.io):
   its colours, Inter type, cards, navigation and tables, recreated here without Bootstrap.
   Inter is served from /fonts (SIL Open Font License, see fonts/Inter-LICENSE.txt). */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2"); }
:root {
  color-scheme: light;
  --bg: #f5f7fb; --surface: #ffffff; --surface-2: #f1f4f9; --border: #dee2e6;
  --text: #212529; --text-2: #495057; --text-3: #6c757d;
  --accent: #3b7ddd; --accent-ink: #ffffff; --accent-soft: #e6effb;
  --good: #1a7f37; --warn: #9a6700; --crit: #c42b2b; --info: #2a6fcf;
  --good-soft: #e1f5ee; --warn-soft: #fff4d9; --crit-soft: #fbe4e6; --info-soft: #e6effb;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --grid: #e9ecef; --axis: #adb5bd;
  --nav-bg: #222e3c; --nav-text: #e9ecef; --nav-muted: #a3adb8; --nav-active: #2b3947;
  --radius: 6px; --shadow: 0 0 .875rem 0 rgba(33, 37, 41, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #19212b; --surface: #222e3c; --surface-2: #2a3846; --border: #354657;
    --text: #eef1f4; --text-2: #c2ccd6; --text-3: #95a3b1;
    --accent: #6aa5f5; --accent-ink: #0f1722; --accent-soft: #233a57;
    --good: #4cc26a; --warn: #e0b040; --crit: #ef6b6b; --info: #6aa5f5;
    --good-soft: #1d3a2e; --warn-soft: #3d3420; --crit-soft: #452628; --info-soft: #233a57;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --grid: #2f3d4c; --axis: #6f7f8f;
    --nav-bg: #141b23; --nav-text: #e9ecef; --nav-muted: #8d99a6; --nav-active: #222e3c; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #19212b; --surface: #222e3c; --surface-2: #2a3846; --border: #354657;
  --text: #eef1f4; --text-2: #c2ccd6; --text-3: #95a3b1;
  --accent: #6aa5f5; --accent-ink: #0f1722; --accent-soft: #233a57;
  --good: #4cc26a; --warn: #e0b040; --crit: #ef6b6b; --info: #6aa5f5;
  --good-soft: #1d3a2e; --warn-soft: #3d3420; --crit-soft: #452628; --info-soft: #233a57;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  --grid: #2f3d4c; --axis: #6f7f8f;
  --nav-bg: #141b23; --nav-text: #e9ecef; --nav-muted: #8d99a6; --nav-active: #222e3c; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Inter", "Helvetica Neue", Arial, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, select, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.4rem; font-weight: 600; } h2 { font-size: 1.05rem; font-weight: 600; } h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
.muted { color: var(--text-2); } .small { font-size: .85rem; } .tiny { font-size: .78rem; color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }

/* Layout */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
/* Page frame, after AdminKit: a dark sidebar beside the page. Laptop: open by default, folds away with the
   menu button (remembered). Phone (under 900 px): the sidebar slides in over the page. */
.sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 260px; background: var(--nav-bg); color: var(--nav-text);
  overflow-y: auto; z-index: 45; padding: 20px 18px 24px; display: flex; flex-direction: column; gap: 6px; transition: transform .2s ease; }
.sidebar .brand { color: #fff; text-decoration: none; margin: 0 0 14px; }
.sidebar .brand span { color: var(--nav-muted); }
.nav-h { margin: 14px 4px 6px; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--nav-muted); }
.ctx { display: flex; flex-direction: column; gap: 10px; }
.ctx label { font-size: .75rem; color: var(--nav-muted); display: flex; flex-direction: column; gap: 4px; }
.ctx select { width: 100%; background: var(--nav-active); color: var(--nav-text); border: 1px solid transparent; }
.ctx select:focus-visible { outline-color: #8ab4f8; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 9px 12px; border-radius: 4px; color: var(--nav-muted);
  cursor: pointer; font-size: .9rem; border-left: 3px solid transparent; }
.nav-item:hover, .nav-item:focus-visible { background: var(--nav-active); color: #fff; }
.nav-item:focus-visible { outline: 2px solid #8ab4f8; outline-offset: -2px; }
.nav-foot { margin-top: auto; padding: 16px 4px 0; font-size: .75rem; color: var(--nav-muted); overflow-wrap: anywhere; }
.page { margin-left: 260px; min-width: 0; transition: margin .2s ease; }
header.top { background: var(--surface); box-shadow: 0 0 2rem 0 rgba(33, 37, 41, .1); position: sticky; top: 0; z-index: 20; }
.topbar { display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 22px; }
.burger { all: unset; box-sizing: border-box; width: 40px; height: 40px; border-radius: 6px; cursor: pointer; display: grid; place-items: center; }
.burger span, .burger span::before, .burger span::after { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 1px; position: relative; content: ""; }
.burger span::before { position: absolute; top: -7px; } .burger span::after { position: absolute; top: 7px; }
.burger:hover { background: var(--surface-2); } .burger:focus-visible { outline: 2px solid var(--accent); }
.top-user { color: var(--text-3); }
.nav-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 44; }
body.nav-folded .sidebar { transform: translateX(-100%); }
body.nav-folded .page { margin-left: 0; }
@media (max-width: 899px) {
  .page { margin-left: 0; }
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 2rem rgba(0, 0, 0, .3); }
  body.nav-open .sidebar { transform: none; }
  .top-user { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .page { transition: none; } }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); flex: none; }
.brand b { display: block; font-size: .95rem; } .brand span { display: block; font-size: .78rem; color: var(--text-2); }
/* The top bar shows the brand only when the sidebar (which carries it) is folded away, or on a phone. */
.brand.top-brand { display: none; color: inherit; text-decoration: none; }
body.nav-folded .brand.top-brand { display: flex; }
@media (max-width: 899px) { .brand.top-brand { display: flex; } }
main { padding: 18px 0 96px; }
footer.foot { border-top: 1px solid var(--border); padding: 16px 0 90px; font-size: .8rem; color: var(--text-3); }

/* Controls */
select, input[type=text], input[type=email], input[type=number], textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 40px; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
select:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--crit); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: .85rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; min-height: 36px; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--accent-soft); color: var(--text); font-weight: 600; }

/* Cards */
.card { background: var(--surface); border: 0; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 14px; }
.grid.four { grid-template-columns: 1fr 1fr; }
@media (min-width: 720px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.four { grid-template-columns: repeat(4, 1fr); } .grid.three { grid-template-columns: repeat(3, 1fr); } }

/* Stat tiles */
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.tile .v { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .l { font-size: .8rem; color: var(--text-2); }
.tile .d { font-size: .75rem; color: var(--text-3); margin-top: 2px; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
/* An earlier record that a later one replaced (Activity on the item page). */
.list > li.replaced { color: var(--text-3); } .list > li.replaced b { font-weight: 500; }
.replaced-tag { font-size: .78rem; font-weight: 600; }
.item-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 4px; text-decoration: none; color: inherit; align-items: center; }
.item-row:hover { background: var(--surface-2); }
.item-row .t { font-weight: 600; }
.item-row .sub { font-size: .82rem; color: var(--text-2); }
.item-row .r { text-align: right; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.open { background: var(--info-soft); color: var(--info); }
.badge.resolved { background: var(--good-soft); color: var(--good); }
.badge.escalated { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.neutral { background: var(--surface-2); color: var(--text-2); }
.badge.q-clean { background: var(--good-soft); color: var(--good); }
.badge.q-incomplete { background: var(--warn-soft); color: var(--warn); }
.badge.q-data_unavailable { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.delta-neg { color: var(--crit); font-weight: 600; } .delta-pos { color: var(--info); font-weight: 600; }

/* Item detail */
.numbers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .numbers { grid-template-columns: repeat(4, 1fr); } }
.path-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.path-card.top { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.path-head { display: flex; gap: 10px; align-items: flex-start; }
.path-rank { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.conf { font-size: .8rem; color: var(--text-2); }
.conf b { color: var(--text); }
.meter { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-top: 4px; max-width: 160px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.evidence { margin: 10px 0 0; padding-left: 18px; font-size: .88rem; }
.checks { margin: 8px 0 0; padding-left: 20px; font-size: .88rem; }
.checks li { margin: 2px 0; }
details > summary { cursor: pointer; font-weight: 600; font-size: .9rem; margin-top: 8px; }
.finding-opts { display: grid; gap: 6px; margin: 10px 0; }
.finding-opts label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.finding-opts label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.finding-opts .owner { font-size: .75rem; color: var(--text-3); display: block; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: .88rem; }
.notice.warn { background: var(--warn-soft); } .notice.good { background: var(--good-soft); } .notice.info { background: var(--info-soft); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { border-collapse: collapse; width: 100%; font-size: .88rem; }
table.t th, table.t td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t th { font-size: .75rem; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
.inline-bar { height: 8px; border-radius: 0 4px 4px 0; background: var(--s1); min-width: 2px; }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: var(--text-2); font-size: 12px; }
.chart .gridline { stroke: var(--grid); }
.chart .axis { stroke: var(--axis); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--text-2); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: .8rem; box-shadow: 0 4px 16px rgba(0,0,0,.12); z-index: 5; min-width: 140px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 8px 4px; border-top: 1px solid var(--border); cursor: pointer; }
.rank-row:first-child { border-top: 0; }
.rank-row:hover { background: var(--surface-2); }
.rank-top { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.rank-bar { height: 10px; background: var(--s1); border-radius: 0 4px 4px 0; min-width: 2px; }
.rank-findings { padding: 4px 0 6px 14px; }
.rank-findings .rank-bar { background: var(--s1); opacity: .55; height: 7px; }

/* Overlay */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; max-width: 520px; width: 100%; padding: 22px; max-height: 90vh; overflow: auto; }
.steps-dots { display: flex; gap: 6px; margin-bottom: 12px; }
.steps-dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--border); }
.steps-dots i.on { background: var(--accent); }
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 30; box-shadow: 0 4px 14px rgba(0,0,0,.18); border-radius: 999px; }
.toast { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 60; font-size: .9rem; max-width: 90vw; }

/* Sign-in */
.signin { max-width: 420px; margin: 8vh auto; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: .8rem; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.crumbs { font-size: .85rem; margin-bottom: 10px; }
.empty { text-align: center; padding: 30px 10px; color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 560px) { .fab { min-height: 36px; padding: 6px 12px; font-size: .85rem; } }
.rank-top .num { white-space: nowrap; }

/* v3: evidence labels, statuses, checklist, allocations */
.badge.recorded { background: var(--info-soft); color: var(--info); }
.badge.reviewed { background: var(--good-soft); color: var(--good); }
.badge.cannot_determine { background: var(--surface-2); color: var(--text-2); }
.chip { display: inline-flex; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.chip.direct { color: var(--good); } .chip.suggestive { color: var(--warn); } .chip.unexpl { color: var(--text-2); }
.chip.ev-supported { color: var(--good); } .chip.ev-partly_supported { color: var(--warn); } .chip.ev-reported { color: var(--text-2); }
.path-tests { margin: 8px 0 0; font-size: .86rem; display: grid; gap: 2px; }
.path-tests b { font-weight: 600; }
.past { font-size: .8rem; color: var(--text-2); margin-top: 4px; }
.steps { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.steps li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: .88rem; padding: 6px 0; border-top: 1px solid var(--border); }
.steps select { font-size: .8rem; padding: 4px 6px; }
.steps .st-done { color: var(--good); } .steps .st-na, .steps .st-unavailable { color: var(--text-3); }
.pre { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: .88rem; }
.pre .ok::before { content: "✓ "; color: var(--good); } .pre .warn::before { content: "! "; color: var(--warn); font-weight: 700; } .pre .blocked::before { content: "✕ "; color: var(--crit); font-weight: 700; }
.contra { margin: 6px 0 0; padding-left: 18px; font-size: .82rem; color: var(--text-2); }
/* Record step: tap cards for the causes, a panel under the grid for the details (tap chips, a units stepper).
   Three or more columns on a tablet, two on a phone, never a sideways scroll. Every tap target is at least 44 px. */
.cause-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
@media (max-width: 560px) { .cause-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.cause-card { all: unset; box-sizing: border-box; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 10px; align-content: start;
  min-height: 44px; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
  cursor: pointer; overflow-wrap: anywhere; }
.cause-card:hover { background: var(--surface-2); }
.cause-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cause-card[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.cause-icon { color: var(--accent); display: grid; place-items: start center; padding-top: 1px; }
.cause-text { display: grid; gap: 2px; font-size: .9rem; min-width: 0; }
.cause-text b { font-weight: 600; }
.cause-card .badge { grid-column: 1 / -1; justify-self: start; }
@media (max-width: 560px) { .cause-card { grid-template-columns: minmax(0, 1fr); padding: 10px; } }
.pick-h { margin: 0 0 8px; }
.cause-panel { margin-top: 10px; border: 1px solid var(--accent); border-radius: 8px; padding: 14px; background: var(--surface-2); display: grid; gap: 10px; min-width: 0; }
.cause-panel input[type=text] { width: 100%; }
.cause-pick.other-way { border-left: 3px solid var(--warn); padding-left: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tap-chip { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text); cursor: pointer; font-size: .88rem; overflow-wrap: anywhere; }
.tap-chip:hover { border-color: var(--accent); }
.tap-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tap-chip[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.tap-chip:disabled { opacity: .55; cursor: not-allowed; }
.stepper { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stepper .btn { min-width: 52px; min-height: 52px; padding: 0; font-size: 1.4rem; font-weight: 700; }
.stepper input[type=number] { width: 84px; min-height: 52px; text-align: center; font-size: 1.15rem; }
.link-btn { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: .9rem; }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rec-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; }
.rec-item .btn { min-height: 44px; }
.alloc-sum { font-size: .9rem; font-variant-numeric: tabular-nums; }
.alloc-sum.bad { color: var(--crit); font-weight: 700; }
.split-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.split-bar > i { display: block; height: 100%; }
.split-bar .e { background: var(--accent); } .split-bar .r { background: var(--good); } .split-bar .u { background: var(--surface-2); }
.def { font-size: .72rem; color: var(--text-3); margin-top: 4px; line-height: 1.35; }
.grid.five { grid-template-columns: 1fr 1fr; }
@media (min-width: 720px) { .grid.five { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .grid.five { grid-template-columns: repeat(5, 1fr); } }
.rank-row .split-bar { height: 8px; margin: 4px 0 2px; }
.split-bar { box-shadow: inset 0 0 0 1px var(--border); }
.legend.tiny i { height: 8px; box-shadow: inset 0 0 0 1px var(--border); }
/* Excel-style filter tables */
.grid-bar { gap: 8px; margin-bottom: 8px; align-items: center; }
.grid-t th { position: relative; white-space: nowrap; }
.grid-t th button.gh { all: unset; cursor: pointer; font: inherit; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; padding: 2px 4px; border-radius: 4px; }
.grid-t th button.gh:hover, .grid-t th button.gh:focus-visible { background: var(--surface-2); outline: 2px solid var(--accent); outline-offset: 1px; }
.grid-t th button.gh.on { color: var(--accent); }
.grid-t th button.gh .fi { font-size: .7em; opacity: .7; }
.grid-t th.n button.gh { flex-direction: row-reverse; }
.grid-t td.sel, .grid-t th.sel, .t td.sel, .t th.sel { width: 32px; text-align: center; }
.grid-t tr.link-row { cursor: pointer; }
.grid-t tr.link-row:hover td { background: var(--surface-2); }
.gpanel { position: absolute; z-index: 30; top: 100%; left: 0; min-width: 240px; max-width: 300px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); padding: 12px; display: flex; flex-direction: column; gap: 8px; font-weight: 400; white-space: normal; text-align: left;
  text-transform: none; letter-spacing: normal; font-size: .9rem; color: var(--text); }
.grid-t th.n .gpanel { left: auto; right: 0; }
.gpanel input[type=number], .gpanel input[type=search], .gpanel select { width: 100%; }
.gpanel .row input[type=number] { flex: 1; min-width: 0; }
.glist { max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.glist label { display: flex; gap: 6px; align-items: center; }
@media (min-width: 641px) { .table-wrap:has(.gpanel) { overflow: visible; } }
.badge.not_investigated { background: var(--surface-2); color: var(--text-2); }
@media (max-width: 640px) { .gpanel { position: fixed; left: 12px !important; right: 12px !important; top: auto; bottom: 12px; max-width: none; } }
.grid-t td.wide { min-width: 190px; }

/* The hidden attribute always wins, even on elements whose class sets a display. */
[hidden] { display: none !important; }

/* Folded sections on the item page: one summary line, open for the full content. */
details.fold > summary { list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; font-weight: 400; font-size: inherit; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2, details.fold > summary h3 { margin: 0; }
.fold-line { flex: 1 1 240px; min-width: 0; font-size: .85rem; color: var(--text-2); }
.fold-cue { margin-left: auto; font-size: .85rem; font-weight: 600; color: var(--accent); }
.fold-cue::before { content: "Open"; }
details.fold[open] > summary .fold-cue::before { content: "Close"; }
details.fold[open] > summary .fold-line { display: none; }
.fold-body { margin-top: 12px; }
.pre .how { margin: 2px 0 0 14px; }

/* Lists fit a 1280 px laptop: tighter cells, headers and long text wrap. Phones scroll inside the table. */
.grid-t { font-size: .84rem; }
table.grid-t th, table.grid-t td { padding: 6px 5px; }
.grid-t th { white-space: normal; vertical-align: bottom; }
.grid-t td { overflow-wrap: break-word; }
.grid-t .chip, .grid-t .badge { white-space: normal; text-align: center; }
.grid-t td.wide { min-width: 150px; }
@media (min-width: 900px) { .grid-t td.wide { min-width: 0; } }

/* Walkthrough tour: the target is outlined and the rest of the screen dims; the card points at it. */
.overlay.tour { display: block; padding: 0; }
body.touring .fab { display: none; }
.overlay.tour:not(.spot) { display: grid; place-items: center; padding: 16px; }
.overlay.tour.spot { background: transparent; }
.tour-ring { position: fixed; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 3px var(--accent), 0 0 0 8px var(--accent-soft), 0 0 0 9999px rgba(0, 0, 0, .5);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; }
.tour-card { overflow: visible; max-height: none; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.tour-body { position: relative; }
.tour-tip { position: absolute; width: 16px; height: 16px; background: var(--surface); transform: rotate(45deg); border-radius: 2px; }
.tour-tip.up { top: -8px; } .tour-tip.down { bottom: -8px; }
.tour-tip.left { left: -8px; } .tour-tip.right { right: -8px; }
.tour-text { margin-bottom: 14px; }
.tour-list { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 8px; font-size: .9rem; }
.tour-list li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; align-items: start; }
.tour-list .chip { justify-self: start; white-space: normal; }
@media (max-width: 480px) { .tour-list li { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
@media (prefers-reduced-motion: reduce) { .tour-ring { transition: none; } }

/* Pareto chart (leadership): names in text ink with a surface halo so the cumulative line never cuts through them. */
.chart .pareto text.name { fill: var(--text); font-size: 13px; }
.chart .pareto text.num { fill: var(--text-2); font-variant-numeric: tabular-nums; }
.chart .pareto text.halo { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .pareto .ref { stroke: var(--axis); }
.chart .pareto .sel { fill: var(--surface-2); }
.chart .pareto rect.hit { cursor: pointer; outline: none; }
.chart .pareto rect.hit:focus-visible { stroke: var(--accent); stroke-width: 2px; }
.rank-findings { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
/* The Pareto chart scrolls sideways inside its card when the causes need more room (phones); the page never does. */
.chart-scroll { overflow-x: auto; }
.chart .pareto text.name { font-size: 12px; }
.chart .pareto text.share { fill: var(--text-3); font-size: 11px; }
.overlay.tour:not(.spot) .tour-card { max-height: calc(100vh - 32px); overflow: auto; }  /* short screens: the centred card scrolls */

/* Learning: what the app learned from your answers and from approved lessons. Text stays in text ink. */
.learned { border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; }
.learned ul { margin: 6px 0 0; padding-left: 18px; font-size: .9rem; }
.learned-h { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.chip.learned-chip { color: var(--accent); background: var(--surface); }
.learned-note { margin-top: 6px; font-size: .85rem; color: var(--text-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.proposal { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.proposal .meta { font-size: .8rem; color: var(--text-3); }
.lesson-editor { border: 2px solid var(--accent); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.lesson-editor input[type=text] { width: 100%; }

/* AdminKit look: borderless tiles, uppercase card titles in muted ink, compact controls. */
.tile { border: 0; box-shadow: var(--shadow); padding: 16px 18px; }
.tile .l { font-weight: 600; color: var(--text-3); }
.btn { border-radius: 4px; font-weight: 500; }
.btn.primary { box-shadow: 0 1px 2px rgba(59, 125, 221, .25); }
select, input[type=text], input[type=email], input[type=number], textarea { border-radius: 4px; border-color: var(--border); }
.path-card { border-color: var(--border); box-shadow: var(--shadow); }
.notice { border-radius: 4px; }
.brand-mark { background: var(--accent); border-radius: 6px; }

/* Block 2: next step and assignee panel, follow-up actions */
.work-panel { padding: 12px 16px; font-size: .9rem; }
.work-panel select { min-width: 220px; max-width: 100%; }
.action-row { border-top: 1px solid var(--border); padding: 10px 0; display: grid; gap: 2px; }
.action-row:first-of-type { border-top: 0; }

/* Guided journey panel: small, bottom right above the feedback button; along the bottom on a phone. */
.journey { position: fixed; right: 16px; bottom: 68px; z-index: 35; width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .22); }
.journey h3 { margin: 0; font-size: 1rem; }
.journey .steps-dots { margin-bottom: 0; }
.journey-h { gap: 8px; flex-wrap: nowrap; }
.journey-text { margin: 0; font-size: .9rem; }
body.journey-on main { padding-bottom: 300px; }
body.touring .journey { display: none; }
@media (max-width: 560px) {
  .journey { left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 50vh; overflow: auto; }
  body.journey-on .fab { display: none; }
}
