/* Zinvera review prototype: application styles. Colours, type and radius come from brand/brand.css
   (generated from brand/brand.json; WCAG AA checked). No inline styles anywhere (CSP style-src 'self'). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { font-size: 15px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
img, svg { max-width: 100%; }
a { text-underline-offset: 2px; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--on-primary); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* ---- top bar ---- */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .5rem 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { text-decoration: none; color: var(--heading); display: inline-flex; align-items: baseline; gap: .35rem; min-height: 44px; align-items: center; }
.wordmark { font-weight: 700; font-size: 1.25rem; letter-spacing: .01em; color: var(--heading); }
.byline { font-size: .8rem; color: var(--ok); font-weight: 600; }
.badge { font-size: .8rem; color: var(--text-muted); flex: 1 1 260px; min-width: 0; }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; margin-left: auto; }
.code { font-size: .85rem; }
.statusbar { padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
#status-line { margin: 0; padding: .35rem 0; font-size: .85rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
#status-line[data-kind="ok"] { color: var(--ok); }
#status-line[data-kind="warn"] { color: var(--sev-med); }
#status-line[data-kind="error"] { color: var(--sev-high); }

.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 1rem 16px 2rem; }
.main:focus { outline: none; }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px; padding: .45rem .9rem;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary); filter: brightness(.94); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--link); font-weight: 600; }
.btn-small { min-height: 32px; padding: .2rem .6rem; font-size: .85rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .6; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

.pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
  border: 1px solid var(--border-strong); color: var(--text); background: var(--bg); vertical-align: middle; white-space: nowrap; }
.pill-proto { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pill-accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pill-high { color: var(--sev-high); background: var(--sev-high-bg); border-color: var(--sev-high); }
.pill-med { color: var(--sev-med); background: var(--sev-med-bg); border-color: var(--sev-med); }
.pill-low { color: var(--sev-low); background: var(--sev-low-bg); border-color: var(--sev-low); }
.pill-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok); }
.pill-verify { color: var(--chip-verify); border-color: var(--chip-verify); background: var(--surface); }
.pill-mock { color: var(--mock); border-style: dashed; }

.field { display: flex; flex-direction: column; gap: .25rem; margin: 0 0 .75rem; }
.field label { font-weight: 600; }
select, input[type="text"], input[type="number"], textarea { font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: var(--radius); padding: .45rem .55rem; min-height: 44px; max-width: 100%; }
textarea { min-height: 88px; width: 100%; resize: vertical; }
.check { display: flex; gap: .6rem; align-items: flex-start; margin: .5rem 0; }
.check input { width: 22px; height: 22px; margin-top: .15rem; flex: none; accent-color: var(--primary); }
.helper { font-size: .85rem; color: var(--text-muted); margin: .2rem 0 0; }
.helper[data-kind="block"] { color: var(--sev-high); }
.helper[data-kind="warn"] { color: var(--sev-med); }

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

/* ---- banners, toasts, modal ---- */
.banners { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem .8rem; margin: .75rem 0;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); }
.banner p { margin: 0; flex: 1 1 240px; }
.banner-warn { border-color: var(--sev-med); background: var(--sev-med-bg); color: var(--text-strong); }
.banner-error { border-color: var(--sev-high); background: var(--sev-high-bg); color: var(--text-strong); }
.banner-ok { border-color: var(--ok); background: var(--ok-bg); }
.toasts { position: fixed; bottom: 16px; left: 16px; right: 16px; display: flex; flex-direction: column; align-items: center; gap: .5rem; z-index: 60; pointer-events: none; }
.toast { max-width: 560px; padding: .55rem .9rem; border-radius: var(--radius); background: var(--text-strong); color: var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.toast-warn { background: var(--sev-med-bg); color: var(--text-strong); border: 1px solid var(--sev-med); }
.overlay { position: fixed; inset: 0; background: rgba(15, 27, 45, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 80; }
.modal { background: var(--bg); color: var(--text); border-radius: var(--radius-lg); padding: 1.25rem; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; }
.modal-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }

/* ---- landing ---- */
.landing { max-width: 820px; }
.landing-head h1 { font-size: 1.8rem; }
.lede { color: var(--text-muted); font-weight: 600; }
.brief { font-size: 1.02rem; }
.labels { margin: 0; padding-left: 1.25rem; }
.labels li { margin: .3rem 0; }
.labels-compact { font-size: .85rem; }
.labels-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; }
.plain-list { padding-left: 1.25rem; }
.accept { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem 1rem; }
.about { margin: 1rem 0; }
.about summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .5rem 1rem; }
.code-line { margin-top: 1rem; }

/* ---- library ---- */
.section-head { margin-bottom: .5rem; }
.case-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.case-row { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: .6rem .8rem; }
.case-guided { border-color: var(--primary); box-shadow: inset 4px 0 0 var(--primary); }
.case-link { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; min-height: 44px; }
.case-desc { margin: 0; color: var(--text-muted); font-size: .9rem; }
.case-progress { margin: .2rem 0 0; font-size: .85rem; color: var(--ok); }

/* ---- footer ---- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: .5rem 16px 1rem; font-size: .85rem; }
.footer-labels summary { cursor: pointer; color: var(--text-muted); min-height: 44px; display: flex; align-items: center; }
.footer-links { margin: .25rem 0 0; color: var(--text-muted); }

/* ---- static pages (terms, privacy, 404) ---- */
.plain-page { display: block; }
.plain-head { padding: .75rem 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.plain { max-width: 760px; margin: 0 auto; padding: 1rem 16px 2rem; }

@media (max-width: 640px) {
  body { font-size: 15px; }
  .badge { order: 5; flex-basis: 100%; }
  .topbar-right { margin-left: 0; }
  h1 { font-size: 1.3rem; }
  .landing-head h1 { font-size: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .statusbar, .banners, .footer, .toasts, .actions, .skip { display: none !important; }
  body { background: #FFFFFF; color: #000000; }
}

/* ---- workspace ---- */
.case-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .75rem; }
.case-title { margin: 0; font-weight: 700; color: var(--heading); }
.draft-select { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; }
.workspace { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.rail ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .15rem; }
.rail a { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .25rem .6rem; border-radius: var(--radius);
  text-decoration: none; color: var(--text); font-weight: 600; }
.rail a:hover { background: var(--surface-2); }
.rail a[aria-current="page"] { background: var(--primary); color: var(--on-primary); }
.rail-n { display: inline-flex; width: 1.5rem; height: 1.5rem; align-items: center; justify-content: center; border-radius: 50%;
  border: 1px solid currentColor; font-size: .8rem; flex: none; }
.rail-count { font-weight: 400; }
.rail-scope { font-size: .8rem; color: var(--text-muted); margin: .5rem .6rem 0; }
.screen { min-width: 0; }
.headline { font-size: 1.15rem; font-weight: 700; color: var(--ok); }

.summary-strip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .8rem; margin: .5rem 0 1rem; }
.summary-strip p { margin: .15rem 0; }
.summary-strip .count { white-space: nowrap; }
.filters { margin: .5rem 0 1rem; }
.filters summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.filter-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.field-inline { flex-direction: column; min-width: 150px; }

.cards { display: grid; gap: .75rem; }
.card { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius); background: var(--bg); padding: .75rem .9rem; min-width: 0; }
.card.sev-high { border-left-color: var(--sev-high); }
.card.sev-medium { border-left-color: var(--sev-med); }
.card.sev-low { border-left-color: var(--sev-low); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.card-title { margin: 0; font-size: 1rem; flex: 1 1 260px; }
.card p { margin: .3rem 0; overflow-wrap: anywhere; }
.pills { display: flex; flex-wrap: wrap; gap: .3rem; }
.k { color: var(--text-muted); font-weight: 600; }
.lead { color: var(--text); }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.linklike { background: none; border: none; padding: 0; color: var(--link); text-decoration: underline; font: inherit; cursor: pointer; min-height: 32px; }

.doc-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .5rem 1rem; }
.doc-group h3 { margin-top: .5rem; }
.doc-list { padding-left: 1.1rem; margin: 0; }
.doc-list li { margin: .15rem 0; overflow-wrap: anywhere; }
.notes ul { padding-left: 1.1rem; }

.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--border); border-radius: var(--radius); margin: .5rem 0; }
.table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.table th, .table td { padding: .35rem .55rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table thead th { background: var(--surface); position: sticky; top: 0; }
.table tbody th[scope="row"] { position: sticky; left: 0; background: var(--bg); font-weight: 600; }
.table td.num, .table th.num { text-align: right; }
.table td.diff { background: var(--sev-med-bg); color: var(--text-strong); font-weight: 700; }
.draft-val { color: var(--sev-med); font-weight: 600; }
#not-evaluated { border: 1px solid var(--border); }
.ledger-entity { border-top: 1px solid var(--border); padding-top: .5rem; margin-top: 1rem; }
.ledger-entity h2 { margin-top: .25rem; }
.footnote { font-size: .85rem; color: var(--text-muted); }
.sale { background: var(--surface); border-radius: var(--radius); padding: .25rem .75rem; }
.pinned-8879 { border: 1px solid var(--sev-high); border-radius: var(--radius); padding: .5rem .8rem; margin-bottom: 1rem; }

/* ---- drawer ---- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15, 27, 45, .45); z-index: 70; display: flex; justify-content: flex-end; }
.drawer { background: var(--bg); color: var(--text); width: min(1000px, 100%); height: 100%; overflow-y: auto; padding: 1rem 1.25rem 2rem;
  box-shadow: -4px 0 16px rgba(0, 0, 0, .2); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; position: sticky; top: -1rem;
  background: var(--bg); padding-top: .25rem; z-index: 1; }
.drawer-head h2 { margin: 0; font-size: 1.2rem; }
.drawer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin: .75rem 0; }
.drawer-col { min-width: 0; }
.ref { border: 1px solid var(--border); border-radius: var(--radius); padding: .4rem .6rem; margin: .4rem 0; }
.ref-bad { border-color: var(--sev-high); }
.ref-line { display: flex; align-items: baseline; gap: .4rem; margin: 0; }
.ref-label { font-weight: 600; overflow-wrap: anywhere; }
.dots { flex: 1; border-bottom: 1px dotted var(--border-strong); min-width: 1rem; }
.ref-view summary { cursor: pointer; font-size: .85rem; color: var(--link); min-height: 32px; display: flex; align-items: center; }
.kv { border-collapse: collapse; width: 100%; font-size: .85rem; table-layout: fixed; }
.kv th { width: 62%; }
.kv th, .kv td { padding: .2rem .4rem; border-bottom: 1px solid var(--border); text-align: left; overflow-wrap: anywhere; }
.kv td { text-align: right; }
.kv tr.hl { background: var(--sev-med-bg); outline: 2px solid var(--sev-med); outline-offset: -2px; }
.kv tr.hl th, .kv tr.hl td { color: var(--text-strong); font-weight: 700; }
.doc { margin-bottom: .5rem; }
.doc-head { margin: .3rem 0; overflow-wrap: anywhere; }
.cites { padding-left: 1.1rem; }
.detail { white-space: pre-wrap; font-size: .8rem; background: var(--surface); padding: .5rem; border-radius: var(--radius); overflow-x: auto; }

/* ---- forms: radios, dispositions ---- */
.radios { border: none; padding: 0; margin: .4rem 0; display: flex; flex-wrap: wrap; gap: .25rem .9rem; }
.radios legend { font-weight: 600; padding: 0; margin-bottom: .2rem; width: 100%; }
.radio { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; }
.radio input { width: 20px; height: 20px; accent-color: var(--primary); }
.disp { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .9rem; }
.scales { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.status-disp { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; border-top: 1px dashed var(--border); margin-top: .5rem; padding-top: .4rem; }
.status-disp input[type="text"] { flex: 1 1 200px; }
.first-pass { max-width: 760px; }
.missed { margin-top: 1.5rem; }
.missed summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.mock-row .btn { border-style: dashed; }
.next-card { border: 1px solid var(--primary); border-radius: var(--radius); padding: .5rem .9rem; margin-top: 1rem; }
.label-strip { background: var(--sev-med-bg); border: 1px solid var(--sev-med); border-radius: var(--radius); padding: .4rem .7rem; color: var(--text-strong); }

@media (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--border);
    padding: .2rem .25rem; overflow-x: auto; }
  .rail ol { flex-direction: row; gap: .1rem; }
  .rail a { flex-direction: column; gap: 0; font-size: .7rem; padding: .2rem .4rem; white-space: nowrap; }
  .rail-scope { display: none; }
  .rail-count { display: none; }
  .main { padding-bottom: 5rem; }
  .drawer { padding: .75rem 16px 2rem; }
}

/* ---- your view (optional) panel, debrief, research ---- */
.oq-row { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .9rem; margin: .6rem 0; display: grid; gap: .35rem; }
.oq-row input[type="text"], .oq-row select, .oq-row textarea { width: 100%; }
.oq-q { margin: 0; overflow-wrap: anywhere; }
.debrief textarea { width: 100%; }
.research .table td, .research .table th { white-space: nowrap; }
.research #missed-list li { overflow-wrap: anywhere; }

/* ---- QC cycle 1 fixes ---- */
[hidden] { display: none !important; } /* the attribute must win over .btn's display (QCB-P1-004) */
.help-menu { position: relative; }
.help-menu summary { list-style: none; cursor: pointer; }
.help-menu summary::-webkit-details-marker { display: none; }
.help-list { position: absolute; right: 0; top: 100%; z-index: 40; margin: .25rem 0 0; padding: .4rem 0; list-style: none; min-width: 260px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.help-list li a, .help-list li button { display: flex; align-items: center; min-height: 44px; padding: .25rem .9rem; width: 100%; text-align: left; }
.help-list li a:hover, .help-list li button:hover { background: var(--surface-2); }
.drawer { overflow-x: hidden; }
.drawer-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 1rem; align-items: start; }
.drawer-main { min-width: 0; }
.drawer-aside { position: sticky; top: 3.25rem; max-height: calc(100vh - 4.5rem); overflow-y: auto; }
.drawer-aside .disp { padding: .4rem .75rem; }
.drawer-cols { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
@media (max-width: 900px) {
  .drawer-body { grid-template-columns: minmax(0, 1fr); }
  .drawer-aside { position: static; max-height: none; order: -1; } /* the verdict first on a narrow screen */
}
#continue-top { margin-top: .5rem; }

/* ---- T2b: planning preview (screen 7) ---- */
.label-planning { margin: .25rem 0 .75rem; }
.notice { font-size: .9rem; color: var(--text-muted); border-left: 3px solid var(--accent); padding-left: .6rem; }
.told summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 2px solid var(--border); margin: .75rem 0 1rem; }
.tab { min-height: 44px; padding: .35rem .8rem; border: 1px solid var(--border); border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.tab-locked { opacity: .6; border-style: dashed; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .5rem; margin: .5rem 0 1rem; }
.tile { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: .5rem .7rem; min-width: 0; }
.tile p { margin: 0; overflow-wrap: anywhere; }
.tile-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.tile-value { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--heading); }
.tile-sub { font-size: .8rem; color: var(--text-muted); }
.chip { display: inline-block; padding: 0 .4rem; border-radius: var(--radius); font-size: .72rem; font-weight: 700; border: 1px solid var(--border-strong);
  white-space: nowrap; vertical-align: baseline; }
.chip-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-bg); }
.chip-est { color: var(--sev-med); border-color: var(--sev-med); background: var(--sev-med-bg); }
.chip-client { color: var(--primary); border-color: var(--primary); background: var(--surface); }
.chip-drafted { color: var(--text-strong); border-style: dashed; background: var(--surface); }
.chip-grey { color: var(--text-muted); background: var(--surface); }
.chip-verify { color: var(--chip-verify); border-color: var(--chip-verify); background: var(--surface); }
.segs { display: inline-flex; flex-wrap: wrap; gap: .25rem; margin: .4rem 0; }
.segs .btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.gate-rows { list-style: none; padding: 0; display: grid; gap: .6rem; }
.gate { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius); padding: .5rem .8rem; }
.gate-ok { border-left-color: var(--ok); }
.gate-open { border-left-color: var(--sev-med); }
.card.opp .card-head { align-items: baseline; }
.opp-value { margin: 0; }
.card.imp-tax-at-stake { border-left-color: var(--sev-high); }
.card.imp-savings, .card.imp-refund-amended- { border-left-color: var(--ok); }
.card.imp-penalty-avoided { border-left-color: var(--sev-med); }
.collapsed { margin: .75rem 0; }
.collapsed summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.impact-line { margin: .5rem 0; }
.request { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: .4rem .7rem; margin: .4rem 0; }
.copy { white-space: pre-wrap; margin: 0; font-family: var(--font-mono); font-size: .85rem; }
.plan-disp textarea, .missing-opp textarea, .tab-feedback textarea { width: 100%; }
.tab-feedback { border-top: 1px solid var(--border); margin-top: 1.5rem; padding-top: .5rem; max-width: 760px; }
.strip-parts { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding: 0; list-style: none; margin: .25rem 0; font-size: .9rem; }
.table caption { text-align: left; font-weight: 700; padding: .4rem .55rem; color: var(--heading); }
.table tr.total th, .table tr.total td { font-weight: 700; border-top: 2px solid var(--border-strong); }
.rule-cell { min-width: 260px; font-size: .85rem; }
.waterfall { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .3rem; max-width: 640px; }
.waterfall li { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 90px; gap: .5rem; align-items: center; }
.waterfall progress { width: 100%; height: 14px; accent-color: var(--ok); }
.waterfall li.total { font-weight: 700; border-top: 1px solid var(--border); padding-top: .2rem; }
.side-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: .4rem .8rem; background: var(--surface); margin: .75rem 0; }
.memo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: 1rem; align-items: start; }
.memo-paper { background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 1rem 1.25rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08); min-width: 0; }
.memo-title { font-size: 1.15rem; margin-top: .25rem; }
.memo-check { border: 1px solid var(--border); border-radius: var(--radius); padding: .5rem .8rem; background: var(--surface); }
.in-plan { margin-left: .35rem; }
@media (max-width: 860px) {
  .memo-grid { grid-template-columns: minmax(0, 1fr); }
  .waterfall li { grid-template-columns: minmax(0, 1fr) 80px; }
  .waterfall progress { grid-column: 1 / -1; grid-row: 2; }
}

/* ---- T4: D1 logo in the header. CSS backgrounds, so only the variant on screen is fetched (a display:none element
   never loads its background); light/dark by theme, the monogram on narrow screens. ---- */
.brand { gap: 0; }
.brand .logo, .brand .mark { display: block; background-repeat: no-repeat; background-position: left center; background-size: contain; }
.brand .logo { width: 120px; height: 40px; background-image: url("brand/logo-light.svg"); }
.brand .mark { display: none; width: 36px; height: 36px; background-image: url("brand/mark.svg"); }
:root[data-theme="dark"] .brand .logo { background-image: url("brand/logo-dark.svg"); }
:root[data-theme="dark"] .brand .mark { background-image: url("brand/mark-dark.svg"); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .logo { background-image: url("brand/logo-dark.svg"); }
  :root:not([data-theme="light"]) .brand .mark { background-image: url("brand/mark-dark.svg"); }
}
@media (forced-colors: active) { .brand .logo, .brand .mark { forced-color-adjust: none; } }
@media (max-width: 600px) {
  .topbar { padding: .25rem 12px; gap: .25rem .5rem; }
  .brand .logo { display: none; }
  .brand .mark { display: block; }
  .badge { order: 10; flex-basis: 100%; font-size: .75rem; }
  .code { display: none; }
  .topbar-right .btn { min-height: 44px; padding: .25rem .5rem; }
  .main { padding: .75rem 12px 5rem; }
  h1 { font-size: 1.3rem; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; }
  .tab { white-space: nowrap; }
}
/* ---- T4: guided tour (non-modal coach marks) ---- */
.tour { position: fixed; right: 16px; bottom: 16px; z-index: 75; width: min(400px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto;
  background: var(--bg); color: var(--text); border: 2px solid var(--primary); border-radius: var(--radius-lg); padding: .75rem 1rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.tour h2 { margin: 0 0 .4rem; font-size: 1.05rem; }
.tour .labels { font-size: .8rem; }
.tour-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.tour-target { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: var(--radius); }
@media (max-width: 860px) { .tour { bottom: 5rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* ---- T4: print (review notes on Findings / Sign-off, the planning memo) ---- */
@media print {
  .topbar, .statusbar, .banners, .rail, .footer, .toasts, .skip, .tour, .tabs, .actions, .filters, .tab-feedback,
  .help-menu, .case-head select, .memo-check, form, .drawer-overlay, .btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .main { max-width: none; padding: 0; }
  .workspace { display: block; }
  .card, .memo-paper, .table-wrap { break-inside: avoid; box-shadow: none; border-color: #999; }
  .memo-grid { display: block; }
  .label-strip, .label-planning { border: 1px solid #000; background: #fff; color: #000; }
  a { color: #000; text-decoration: none; }
  .table thead th, .table tbody th[scope="row"] { position: static; }
}
