:root {
  --ink: #12241C;
  --secondary: #55645C;
  --muted: #8A958D;
  --bg: #F7F7F2;
  --card: #FFFFFF;
  --brand: #23407A;
  --brand-dark: #182E58;
  --accent: #C99A3B;
  --border: rgba(18, 36, 28, 0.08);
  --border-strong: rgba(18, 36, 28, 0.16);
  --good-bg: #E9F3EC;
  --good-fg: #0A6B34;
  --warn-bg: #FEF3D9;
  --warn-fg: #8A5A00;
  --bad-bg: #FBEAE8;
  --bad-fg: #B23A3A;
  --neutral-bg: #EDEDE8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

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

.h-font { font-family: 'Space Grotesk', system-ui, sans-serif; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--brand);
  min-height: 100vh;
  box-sizing: border-box;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  align-self: flex-start;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 28px 8px;
}
.brand-mark .box {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.brand-mark .box span { color: var(--brand); font-weight: 700; font-size: 15px; }
.brand-mark .name { font-weight: 600; font-size: 17px; color: #FAF9F5; }

.navitem {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; color: rgba(250,249,245,0.72); cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; font-family: inherit;
}
.navitem:hover { color: #FAF9F5; }
.navitem.active { background: rgba(255,255,255,0.12); color: #FAF9F5; font-weight: 600; }
.navitem svg { flex: 0 0 auto; }

.sidebar-spacer { flex: 1; }

.sidebar-profile {
  border-top: 1px solid rgba(255,255,255,0.12); margin-top: 12px; padding-top: 16px;
  display: flex; align-items: center; gap: 10px; padding-left: 8px;
}
.sidebar-profile .avatar {
  width: 30px; height: 30px; border-radius: 999px; background: rgba(255,255,255,0.14);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.sidebar-profile .avatar span { color: #FAF9F5; font-size: 12px; font-weight: 600; }
.sidebar-profile .who { display: flex; flex-direction: column; }
.sidebar-profile .who .name { color: #FAF9F5; font-size: 13px; font-weight: 500; }
.sidebar-profile .who .role { color: rgba(250,249,245,0.55); font-size: 12px; }

.main { flex: 1; min-height: 100vh; padding: 28px 40px; display: flex; flex-direction: column; gap: 20px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-good { background: var(--good-bg); color: var(--good-fg); }
.pill-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill-bad { background: var(--bad-bg); color: var(--bad-fg); }
.pill-neutral { background: var(--neutral-bg); color: var(--secondary); }

.btn-primary, .btn-ghost {
  border-radius: 8px; padding: 11px 18px; font-family: 'IBM Plex Sans', sans-serif; font-weight: 600;
  font-size: 13px; cursor: pointer; border: 1px solid transparent;
}
.btn-primary { background: var(--brand); color: #FAF9F5; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: #FFFFFF; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--brand); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--secondary); }
.field input, .field select {
  font-family: 'IBM Plex Sans', sans-serif; font-size: 14px; padding: 11px 13px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: #FFFFFF; color: var(--ink);
}

table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 0 12px 10px 12px; }
td { font-size: 13px; padding: 10px 12px; border-top: 1px solid var(--border); }

.tabbtn {
  border: none; background: none; font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; font-size: 13px;
  padding: 9px 16px; border-radius: 8px; cursor: pointer; color: var(--secondary);
}
.tabbtn.active { background: var(--brand); color: #FAF9F5; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-tile { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.stat-tile .label { font-size: 12px; color: var(--muted); }
.stat-tile .value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.error-text { color: var(--bad-fg); font-size: 13px; }
.hint-text { color: var(--muted); font-size: 12px; }

.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg);
}
.login-card { width: 380px; padding: 40px; display: flex; flex-direction: column; gap: 20px; }

/* Shared layout helpers for the app pages */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-title { font-size: 20px; font-weight: 700; margin: 0; }
.section-sub { font-size: 13px; color: var(--secondary); margin: 2px 0 0 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
/* Long option labels (responses, engagements) must not widen a form past its dialog. */
.grid-2 > *, .grid-3 > * { min-width: 0; }
.field select { width: 100%; }
.row { display: flex; align-items: center; gap: 10px; }
.tabs-row { display: flex; gap: 6px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.table-wrap { overflow-x: auto; }
.card-pad { padding: 20px 22px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(18,36,28,0.45); display: flex;
  align-items: center; justify-content: center; z-index: 60; padding: 24px;
}
.modal-card { width: 480px; max-width: 100%; max-height: 88vh; overflow: auto; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.icon-btn { border: none; background: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 4px; }
.icon-btn:hover { color: var(--ink); }
.breakdown-list { display: flex; flex-direction: column; gap: 0; }
.breakdown-row { display: flex; justify-content: space-between; font-size: 13px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.breakdown-row:last-child { border-bottom: none; }
.breakdown-row.total { font-weight: 700; font-size: 14px; padding-top: 12px; }
.net-highlight { font-size: 30px; font-weight: 700; color: var(--brand); font-family: 'Space Grotesk', sans-serif; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.spinner-text { color: var(--muted); font-size: 13px; padding: 20px; }
.link-back { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }

/* ---- BookTrove v2 additions ------------------------------------------------ */
.sidebar { overflow-y: auto; max-height: 100vh; padding-bottom: 16px; }
.nav-group { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: rgba(250,249,245,0.45); padding: 14px 12px 4px; font-weight: 600; }
.navitem { padding: 8px 12px; font-size: 13.5px; }
.navitem .count { margin-left: auto; background: var(--accent); color: var(--brand); border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.company-switch { margin: 0 4px 10px; }
.company-switch select { width: 100%; background: rgba(255,255,255,0.1); color: #FAF9F5; border: 1px solid rgba(255,255,255,0.18); border-radius: 8px; padding: 8px; font-family: inherit; font-size: 13px; }
.company-switch select option { color: var(--ink); }
.company-switch .lbl { font-size: 11px; color: rgba(250,249,245,0.55); padding: 0 2px 4px; }
.main { min-width: 0; }
.btn-sm { padding: 7px 12px !important; font-size: 12.5px !important; }
.btn-danger { background: #fff; color: var(--bad-fg); border: 1px solid rgba(178,58,58,.35); border-radius: 8px; padding: 11px 18px; font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-link { border: none; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: 0; font: inherit; font-size: 13px; }
.btn-link:hover { color: var(--accent); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .field { flex-direction: row; align-items: center; gap: 6px; }
.toolbar input, .toolbar select { font-family: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #FAFAF6; }
tr.r-header td { font-weight: 700; background: #FAFAF6; }
tr.r-subtotal td { font-weight: 600; border-top: 1px solid var(--border-strong); }
tr.r-total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.r-muted td { color: var(--muted); }
tr.r-warn td { background: #FFF9EC; }
.field textarea { font-family: inherit; font-size: 14px; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--border-strong); min-height: 70px; }
.field input[type=checkbox] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink); }
.check input { width: 16px; height: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.modal-card.wide { width: 920px; }
.modal-card.xwide { width: 1180px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }
.lines-table input, .lines-table select { width: 100%; font-family: inherit; font-size: 13px; padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: #fff; min-width: 0; }
.lines-table td { padding: 6px 4px; vertical-align: top; }
.lines-table th { padding: 0 4px 8px; }
.totals-box { margin-left: auto; width: 320px; }
.toast-host { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: 420px; }
.toast.bad { background: var(--bad-fg); }
.toast.good { background: var(--good-fg); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; font-family: 'Space Grotesk', sans-serif; }
.kpi .sub { font-size: 12px; color: var(--secondary); }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 170px; padding-top: 10px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars .pair { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.bars .b { width: 16px; border-radius: 4px 4px 0 0; }
.bars .b.in { background: var(--brand); }
.bars .b.out { background: var(--accent); }
.bars .lbl { font-size: 11px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--secondary); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.task { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.task:last-child { border-bottom: none; }
.aging { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.aging div { background: var(--bg); border-radius: 8px; padding: 8px; font-size: 12px; }
.aging b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--muted); }
.report-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.report-link { display: block; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.report-link small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.report-table td { padding: 7px 12px; }
.report-notes { font-size: 12px; color: var(--secondary); margin-top: 10px; }
.perm-matrix select { padding: 5px 6px; font-size: 12px; border-radius: 6px; border: 1px solid var(--border-strong); }
.banner { padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.banner.warn { background: var(--warn-bg); color: var(--warn-fg); }
.banner.info { background: var(--good-bg); color: var(--good-fg); }
.banner.bad { background: var(--bad-bg); color: var(--bad-fg); }
.banner.good { background: var(--good-bg); color: var(--good-fg); }
.tree { list-style: none; margin: 0; padding-left: 18px; border-left: 1px solid var(--border); }
.tree > li { margin: 6px 0; overflow-wrap: anywhere; }
.diff-line { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; padding: 1px 6px; }
.diff-line.add { background: var(--good-bg); }
.diff-line.del { background: var(--bad-bg); text-decoration: line-through; }
.likert { display: flex; flex-wrap: wrap; gap: 6px; }
/* v3: search, accessibility and small screens */
.side-search { margin: 0 4px 10px; }
.side-search input { width: 100%; background: rgba(255,255,255,0.08); color: #FAF9F5; border: 1px solid rgba(255,255,255,0.18); border-radius: 8px; padding: 7px 9px; font-family: inherit; font-size: 12.5px; }
.side-search input::placeholder { color: rgba(250,249,245,0.5); }
:focus-visible { outline: 2px solid var(--accent, #C96442); outline-offset: 2px; }
tr.clickable:focus-visible { outline-offset: -2px; }
.check-list div { padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.check-list .st { min-width: 72px; }
.panel-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 8px; top: 8px; z-index: 1000; background: #fff; padding: 8px 12px; border-radius: 8px; }
@media (max-width: 900px) {
  .panel-split { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .main { padding: 14px 10px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  .toolbar { flex-wrap: wrap; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal-card, .modal-card.wide { width: calc(100vw - 16px); max-width: none; max-height: 92vh; }
  .kv { grid-template-columns: 110px 1fr; }
  .aging { grid-template-columns: repeat(2, 1fr); }
  .nav-group { display: none; }
  .sidebar .navitem { padding: 8px 10px; }
}
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; min-height: auto; position: static; max-height: none; }
  .main { padding: 18px 16px; }
  .grid-2, .grid-3, .grid-4, .stat-grid { grid-template-columns: 1fr; }
  .grid-2 > *, .grid-3 > *, .grid-4 > * { grid-column: auto !important; min-width: 0; }
  .totals-box { width: 100%; }
}
@media print {
  .sidebar, .no-print, .toast-host { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { border: none; }
}

/* v4: collapsible navigation on small screens, focus rings, warn toasts, checklist and health */
.nav-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-toggle { display: none; background: none; border: 1px solid rgba(255,255,255,0.25); color: #FAF9F5; border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; align-self: flex-start; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toast.warn { background: var(--warn-bg); color: var(--warn-fg); }
.score-ring { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; font-weight: 700; font-size: 20px; border: 6px solid var(--border); }
.score-ring.good { border-color: #3C8D5A; } .score-ring.warn { border-color: #D9A21B; } .score-ring.bad { border-color: #C0442C; }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.check-row:last-child { border-bottom: none; }
.check-row .grow { flex: 1; min-width: 0; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--border); font-size: 12px; }
.scan-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-block; margin-bottom: 8px; }
  .sidebar { padding: 12px 12px; }
  .sidebar .brand-mark { padding-bottom: 10px; }
  .sidebar:not(.nav-open) .nav-body { display: none; }
  .sidebar { position: sticky; top: 0; z-index: 40; }
  button, .btn-primary, .btn-ghost, .navitem, select, input { min-height: 40px; }
  input[type=checkbox] { min-height: 0; }
}

/* --- AuditTrove: engagement file ------------------------------------------------ */
.eng-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.eng-title { flex: 1 1 420px; min-width: 0; }
.eng-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; }
.phase-steps { list-style: none; display: flex; gap: 4px; padding: 0; margin: 12px 0 8px; flex-wrap: wrap; counter-reset: ph; }
.phase-steps li { flex: 1 1 110px; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px; background: var(--neutral-bg); border-radius: 6px; counter-increment: ph; }
.phase-steps li::before { content: counter(ph) ". "; }
.phase-steps li.done { background: var(--good-bg); color: var(--good-fg); }
.phase-steps li.current { background: var(--brand); color: #fff; }
.eng-tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--border-strong); margin: 6px 0 16px; }
.eng-tabs a { padding: 9px 12px; font-size: 13px; font-weight: 600; color: var(--secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.eng-tabs a.active { color: var(--brand); border-bottom-color: var(--accent); }
.eng-tabs a:hover { color: var(--brand); }
.signbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sign-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; background: var(--good-bg); color: var(--good-fg); }
.sign-chip.sign-partner { background: #E6ECF7; color: var(--brand); }
.sign-chip.sign-eqr { background: #F3EAF9; color: #6B2F8A; }
.sign-chip.sign-stale { background: var(--warn-bg); color: var(--warn-fg); }
.signmini { display: inline-flex; gap: 2px; }
.signmini .sm { font-size: 10px; font-weight: 700; padding: 2px 4px; border-radius: 4px; background: var(--neutral-bg); color: var(--muted); }
.signmini .sm.on { background: var(--good-bg); color: var(--good-fg); }
.note-card { border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 10px; font-size: 13px; background: #fff; display: flex; flex-direction: column; gap: 4px; }
.note-card.note-cleared { border-left-color: var(--good-fg); opacity: 0.8; }
.note-card.note-responded { border-left-color: var(--brand); }
.note-resp { background: var(--bg); border-radius: 6px; padding: 6px 8px; }
.form-doc { display: flex; flex-direction: column; gap: 14px; }
.q-section { min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; background: #fff; }
.q-section legend { font-weight: 700; font-size: 14px; padding: 0 6px; color: var(--brand); }
.q.q-flag { background: var(--warn-bg); border-radius: 8px; padding: 6px 8px; }
.flag-text { font-size: 12px; color: var(--warn-fg); font-weight: 600; }
.req { color: var(--bad-fg); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; background: #fff; cursor: pointer; font-weight: 500; color: var(--ink); }
.seg-opt:has(input:checked) { border-color: var(--brand); background: #E6ECF7; }
.gate-list { display: flex; flex-direction: column; gap: 6px; }
.gate { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--border); }
.gate .mark { font-weight: 700; width: 18px; text-align: center; }
.gate.ok .mark { color: var(--good-fg); }
.gate.no .mark { color: var(--bad-fg); }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.kpi .v { font-size: 22px; font-weight: 700; font-family: 'Space Grotesk', system-ui, sans-serif; }
.kpi .l { font-size: 12px; color: var(--muted); font-weight: 600; }
.letter { max-width: 780px; margin: 0 auto; background: #fff; padding: 40px 48px; border: 1px solid var(--border); border-radius: 8px; line-height: 1.55; font-size: 14px; }
.letter h1 { font-size: 20px; } .letter h2 { font-size: 15px; margin: 18px 0 6px; }
.letter table { width: 100%; border-collapse: collapse; margin: 8px 0; } .letter td, .letter th { border: 1px solid var(--border-strong); padding: 6px 8px; font-size: 13px; }
@media (max-width: 720px) { .eng-meta { align-items: flex-start; } .letter { padding: 20px 16px; } }
@media print { .eng-tabs, .phase-steps, .no-print { display: none !important; } .letter { border: 0; padding: 0; } }

/* firm pages */
.fp-prog { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fp-progress { display: inline-block; width: 80px; height: 6px; background: var(--neutral-bg); border-radius: 99px; overflow: hidden; }
.fp-progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.fp-overdue { color: var(--bad-fg); font-weight: 600; white-space: nowrap; }
.fp-list { display: flex; flex-direction: column; }
.fp-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; align-items: flex-start; }
.fp-item:last-child { border-bottom: none; }
.fp-item .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fp-h2 { margin: 0; font-size: 16px; }
.fp-chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--neutral-bg); color: var(--secondary); white-space: nowrap; margin: 1px 2px 1px 0; }
.fp-chip.firm { background: #E6ECF7; color: var(--brand); }
.fp-chip.risk { background: var(--bad-bg); color: var(--bad-fg); }
.fp-chip.off { text-decoration: line-through; }
.fp-proc-text { min-width: 260px; max-width: 620px; line-height: 1.45; }
.fp-area-head { margin: 18px 0 4px; font-size: 15px; color: var(--brand); }
.kpi-link { color: inherit; display: block; }
.kpi-link:hover .kpi { border-color: var(--brand); }
.fp-json { white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--bg); padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; margin: 0; }
.fp-secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; background: var(--neutral-bg); padding: 10px; border-radius: 8px; word-break: break-all; }
.fp-req { border: 1px solid var(--border-strong); border-radius: 10px; padding: 14px 16px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.fp-req.overdue { border-left: 4px solid var(--bad-fg); }
.fp-req.sentback { border-left: 4px solid var(--accent); }
.fp-req h3 { margin: 0; font-size: 15px; }
.fp-req .field textarea { min-height: 60px; }
.fp-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.fp-filters .field input, .fp-filters .field select { padding: 8px 10px; font-size: 13px; min-width: 0; }
.field textarea, .field input, .field select { max-width: 100%; }
.fp-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.fp-print-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 980px; width: 100%; margin: 0 auto; }
.fp-report { max-width: 980px; width: 100%; margin: 0 auto; background: #fff; padding: 28px 32px; border: 1px solid var(--border); border-radius: 8px; }
.fp-report h1 { font-size: 20px; margin: 0 0 4px; }
.fp-report h2 { font-size: 15px; margin: 22px 0 6px; color: var(--brand); }
.fp-report td, .fp-report th { font-size: 12.5px; vertical-align: top; }
.letter .fp-sign { margin-top: 22px; display: flex; flex-direction: column; gap: 2px; }
.letter ul { padding-left: 22px; }
@media (max-width: 720px) { .fp-report { padding: 16px 12px; } .fp-proc-text { min-width: 200px; } }
@media print {
  body.fp-print .app-shell { display: block; }
  body.fp-print .main { padding: 0; gap: 0; }
  body.fp-print .fp-print-bar, body.fp-print .skip-link { display: none !important; }
  .fp-report { border: 0; padding: 0; max-width: none; }
  .fp-report .table-wrap { overflow: visible; }
  .fp-report tr { break-inside: avoid; }
}

/* engagement pages B */
.eb-as { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: #E6ECF7; color: var(--brand); margin: 0 2px 2px 0; cursor: default; }
.eb-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
.eb-checks legend { font-size: 12px; font-weight: 600; color: var(--secondary); padding: 0 4px; }
.eb-checks.col { flex-direction: column; flex-wrap: nowrap; max-height: 320px; overflow: auto; }
.eb-checks .check { font-weight: 400; align-items: flex-start; }
.eb-checks .check input { margin-top: 2px; flex: 0 0 auto; }
.eb-prog { display: flex; align-items: center; gap: 8px; min-width: 0; }
.eb-prog .eb-bar { flex: 1; }
.eb-bar { height: 7px; background: var(--neutral-bg); border-radius: 999px; overflow: hidden; min-width: 40px; }
.eb-bar > i { display: block; height: 100%; background: var(--good-fg); border-radius: 999px; }
.eb-bar.warn > i { background: #D9A21B; }
.eb-bar.bad > i { background: var(--bad-fg); }
.eb-areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 8px; }
.eb-area { text-align: left; border: 1px solid var(--border-strong); background: #fff; border-radius: 10px; padding: 8px 10px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--ink); }
.eb-area:hover { border-color: var(--brand); }
.eb-area.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #F3F6FB; }
.eb-area .n { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eb-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.eb-wide-cell { min-width: 260px; max-width: 520px; }
.eb-sub { font-size: 12px; color: var(--muted); }
.eb-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.eb-badge { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--neutral-bg); color: var(--secondary); white-space: nowrap; }
.eb-badge.bad { background: var(--bad-bg); color: var(--bad-fg); }
.eb-badge.warn { background: var(--warn-bg); color: var(--warn-fg); }
.eb-badge.good { background: var(--good-bg); color: var(--good-fg); }
.eb-badge.info { background: #E6ECF7; color: var(--brand); }
details.eb-more > summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--brand); }
.eb-grid td { padding: 5px 6px; vertical-align: middle; }
.eb-grid th { padding: 0 6px 8px; }
.eb-grid input:not([type=checkbox]), .eb-grid select { font-family: inherit; font-size: 12.5px; padding: 6px 7px; border: 1px solid var(--border-strong); border-radius: 6px; background: #fff; min-width: 0; width: 100%; }
.eb-grid input.num { text-align: right; min-width: 110px; }
.eb-grid input:not([type=checkbox]):not(.num) { min-width: 150px; }
.eb-grid select { min-width: 104px; }
.eb-grid select.r-pass { background: var(--good-bg); color: var(--good-fg); }
.eb-grid select.r-fail { background: var(--bad-bg); color: var(--bad-fg); }
.eb-grid tr.eb-dev td { background: #FFF6F4; }
.eb-grid tr.eb-dim td { color: var(--muted); }
.eb-meter { position: relative; height: 16px; background: var(--neutral-bg); border-radius: 8px; margin: 26px 0 8px; }
.eb-meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; background: var(--good-fg); max-width: 100%; }
.eb-meter .fill.warn { background: #D9A21B; }
.eb-meter .fill.bad { background: var(--bad-fg); }
.eb-meter .mark { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); }
.eb-meter .mark span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 11px; white-space: nowrap; color: var(--secondary); font-weight: 600; padding-bottom: 2px; }
.eb-meter .mark.end span { transform: translateX(-100%); }
.eb-meter .mark.start span { transform: none; left: 0; }
.eb-meter .mark.end span { left: 2px; }
.eb-meter .mark.below span { bottom: auto; top: 100%; padding: 2px 0 0; }
.eb-meter { margin-bottom: 26px; }
.eb-kpis .kpi { min-width: 0; }
.eb-kpis .v { overflow-wrap: anywhere; }
@media (max-width: 720px) { .eb-kpis { grid-template-columns: 1fr 1fr; } .eb-kpis .v { font-size: 18px; } }
@media (max-width: 480px) { .eb-kpis { grid-template-columns: 1fr; } }
.eb-para { border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #FCFCFA; }
.eb-doc { max-width: none; padding: 28px 32px; }
.eb-doc h1 { margin-top: 0; }
.eb-doc .eb-sign { margin: 10px 0 14px; line-height: 1.5; }
.eb-doc .table-wrap table td, .eb-doc .table-wrap table th { border: 1px solid var(--border-strong); padding: 5px 8px; }
.eb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.eb-head h2 { margin: 0; font-size: 17px; }
.eb-lines td.acc { min-width: 220px; }
.eb-total-row td { font-weight: 700; border-top: 2px solid var(--ink); }
.eb-cards { display: flex; flex-direction: column; gap: 8px; }
.eb-kam { border: 1px solid var(--border-strong); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.eb-kam.off { opacity: 0.6; }
.eb-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.eb-filters .tabbtn { border: 1px solid var(--border-strong); background: #fff; }
.eb-filters .tabbtn.active { border-color: var(--brand); background: var(--brand); color: #FAF9F5; }
.eb-hbar { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; gap: 8px; align-items: center; font-size: 13px; padding: 5px 0; }
.eb-mini { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--secondary); }
.eb-sticky-foot { position: sticky; bottom: 0; background: #fff; padding: 10px 0 2px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; z-index: 2; }
/* Adjustment lines on phones: the account on its own row, debit and credit side by side under it. */
@media (max-width: 560px) {
  .eb-lines thead { display: none; }
  .eb-lines tbody tr, .eb-lines tfoot tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
  .eb-lines tbody td, .eb-lines tfoot td { padding: 0; border: 0; }
  .eb-lines td.acc, .eb-lines tfoot td:first-child { grid-column: 1 / -1; min-width: 0; }
}
@media (max-width: 720px) {
  .eb-doc { padding: 16px 12px; }
  .eb-hbar { grid-template-columns: 1fr; gap: 3px; }
  .eb-wide-cell { min-width: 200px; }
  .eb-areas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* engagement pages A */
.ea-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ea-split > * { min-width: 0; }
.ea-h2 { font-size: 16px; font-weight: 700; margin: 0; }
.ea-h3 { font-size: 14px; font-weight: 700; margin: 8px 0 2px; color: var(--brand); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
a.kpi.ea-kpi { color: var(--ink); display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
a.kpi.ea-kpi:hover { border-color: var(--brand); }
.kpi.ea-bad .v { color: var(--bad-fg); }
.kpi.ea-warn .v { color: var(--warn-fg); }
.ea-ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.ea-isa { font-weight: 400; opacity: .85; }
.ea-detail { color: var(--bad-fg); font-size: 12.5px; }
.ea-kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 6px 12px; font-size: 13px; }
.ea-kv > span:nth-child(odd) { color: var(--muted); }
.ea-kv > span { overflow-wrap: anywhere; }
.ea-chip { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--neutral-bg); color: var(--secondary); font-size: 11px; font-weight: 700; margin: 1px 3px 1px 0; white-space: nowrap; }
.ea-chip.bad { background: var(--bad-bg); color: var(--bad-fg); }
.ea-chip.warn { background: var(--warn-bg); color: var(--warn-fg); }
.ea-chip.good { background: var(--good-bg); color: var(--good-fg); }
.ea-table td { vertical-align: top; }
.ea-table select, .ea-table input { font-family: inherit; font-size: 12.5px; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: #fff; max-width: 230px; }
.ea-table select.ea-changed { border-color: var(--accent); background: #FFF6E0; }
.ea-table th.ea-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.ea-table th .ea-sort { border: none; background: none; font: inherit; color: inherit; cursor: pointer; padding: 0; }
.ea-table th[aria-sort="ascending"] .ea-sort::after { content: " ▲"; font-size: 9px; }
.ea-table th[aria-sort="descending"] .ea-sort::after { content: " ▼"; font-size: 9px; }
tr.ea-total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.ea-flagged td { background: #FFF6E5; }
tr.ea-sub td { font-size: 12.5px; color: var(--secondary); background: #FCFCF9; }
tr.ea-sub td:first-child { padding-left: 26px; }
.ea-wrap-text { max-width: 360px; min-width: 150px; overflow-wrap: break-word; }
.ea-clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ea-details > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--brand); padding: 4px 0; }
.ea-details[open] > summary { margin-bottom: 10px; }
.ea-spectrum { display: grid; grid-template-columns: repeat(3, 20px); grid-template-rows: repeat(3, 20px); gap: 3px; flex: 0 0 auto; }
.ea-spectrum span { border-radius: 4px; }
.ea-spectrum .lv-low { background: #E3EFE6; }
.ea-spectrum .lv-moderate { background: #FBE9BF; }
.ea-spectrum .lv-high { background: #F5CFC9; }
.ea-spectrum .on { outline: 2px solid var(--ink); outline-offset: 1px; }
.ea-spec-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.ea-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; }
.ea-checks .check { align-items: flex-start; }
.ea-checks.ea-wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ea-checks .check small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; line-height: 1.35; }
.ea-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ea-fieldset legend { font-size: 12px; font-weight: 700; color: var(--secondary); padding: 0 4px; }
.ea-preview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ea-list { max-height: 48vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.ea-list .ea-row { display: flex; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; align-items: flex-start; cursor: pointer; }
.ea-list .ea-row:last-child { border-bottom: none; }
.ea-list .ea-row input { margin-top: 3px; flex: 0 0 auto; }
.ea-list .ea-row .grow { flex: 1; min-width: 0; }
.ea-savebar { position: sticky; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--border); padding: 10px 0 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.q.q-missing { box-shadow: inset 3px 0 0 var(--bad-fg); padding-left: 8px; }
.ea-wpnav { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.ea-title-input { font-family: 'Space Grotesk', system-ui, sans-serif; font-size: 18px; font-weight: 700; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 8px; width: 100%; max-width: 640px; }
.ea-num-input { width: 120px; text-align: right; }
.ea-filters > * { max-width: 100%; min-width: 0; }
.ea-filters select { text-overflow: ellipsis; }
.ea-specific { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, 1.5fr) auto; gap: 8px; align-items: end; }
@media (max-width: 900px) {
  .ea-split, .ea-preview { grid-template-columns: minmax(0, 1fr); }
  .ea-specific { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .ea-kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .ea-kv > span:nth-child(odd) { margin-top: 6px; }
  .ea-specific { grid-template-columns: minmax(0, 1fr); }
}
.eb-para .eb-in { font-family: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; width: 100%; }
.eb-para .eb-in:disabled { background: var(--bg); color: var(--ink); }
/* end engagement pages B */
/* firm pages: small-screen fixes */
.main .toolbar select, .main .toolbar input { max-width: 100%; min-width: 0; }
.fp-form fieldset { min-width: 0; }
.fp-form select { max-width: 100%; min-width: 0; }
.fp-main-cell { min-width: 150px; }
.fp-nowrap { white-space: nowrap; }
.fp-req .note-resp { font-size: 13px; }
/* group audit page (eng-group.html, ISA 600) — gr-* */
.gr-cov-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 12px; align-items: center; }
.gr-cov-label { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.gr-cov-bar { display: block; width: 100%; height: 22px; background: var(--neutral-bg); border-radius: 4px; }
.gr-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--secondary); }
.gr-leg { display: inline-flex; align-items: center; gap: 6px; }
.gr-leg i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: 0 0 auto; }
.gr-cell { min-width: 140px; }
.gr-fs { border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 14px 14px; margin: 0; min-width: 0; }
.gr-fs legend { font-size: 13px; font-weight: 600; color: var(--secondary); padding: 0 4px; }
.gr-fs .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.gr-fs .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gr-fs .field select, .gr-fs .field input { min-width: 0; max-width: 100%; }
.gr-line { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: end; }
.gr-cline { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, .9fr); gap: 8px; align-items: end; }
.gr-line .field select, .gr-cline .field select, .gr-cline .field input { min-width: 0; max-width: 100%; }
tbody tr.gr-sel td { background: #F1F4F9; }
.gr-ws { font-size: 12.5px; }
.gr-ws td, .gr-ws th { white-space: nowrap; }
.gr-ws td.gr-cell { white-space: normal; }
@media (max-width: 720px) {
  .gr-cov-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .gr-fs .grid-2, .gr-fs .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .gr-line, .gr-cline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-bottom: 8px; border-bottom: 1px solid var(--border); }
  .gr-line > :first-child, .gr-cline > :first-child { grid-column: 1 / -1; }
}
/* end group audit page */
/* === significant accounts (RA-S) — js/sigacc.js, prefix sa- === */
.sa-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sa-h3 { font-size: 15px; font-weight: 700; margin: 0; }
.sa-matline { gap: 6px; }
.sa-move { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.sa-mp-in { width: 70px; font-family: inherit; font-size: 13px; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border-strong); text-align: right; }
.sa-scroll { position: relative; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: 10px; }
.sa-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sa-grid { min-width: 1280px; }
.sa-grid th { padding-top: 10px; white-space: nowrap; }
.sa-grid td { padding: 8px 10px; }
.sa-grid .sa-c0 { width: 30px; padding-right: 0; }
.sa-grid .sa-name { min-width: 210px; max-width: 300px; }
.sa-grid .sa-detc { min-width: 170px; }
.sa-grid .sa-expc { min-width: 130px; }
.sa-grid .sa-acts { white-space: nowrap; }
.sa-grid tr.sa-sig td:nth-child(2) { box-shadow: inset 3px 0 0 var(--bad-fg); }
.sa-grid tr.sa-need td:nth-child(2) { box-shadow: inset 3px 0 0 var(--accent); }
.sa-grid tr.sa-acc td { background: #FCFCF9; font-size: 12.5px; }
.sa-grid tr.sa-acc td.sa-name { padding-left: 24px; }
.sa-hit { background: #FEF3D9 !important; }
.sa-hit-strong { background: #FBE0DB !important; font-weight: 700; }
.sa-exp { border: 1px solid var(--border-strong); background: #fff; border-radius: 6px; width: 24px; height: 24px; cursor: pointer; font-size: 12px; line-height: 1; color: var(--brand); }
.sa-why summary { cursor: pointer; font-size: 12px; color: var(--brand); display: inline; }
.sa-why ul, .sa-reasons { margin: 4px 0 0; padding-left: 18px; font-size: 12px; color: var(--secondary); }
.sa-det { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sa-legend { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.sa-sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--border-strong); vertical-align: middle; }
.sa-panels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.sa-panels > * { min-width: 0; }
.sa-rt .sa-rname { min-width: 180px; }
.sa-heat { position: relative; width: auto; border-collapse: separate; border-spacing: 3px; }
.sa-heat th { font-size: 11.5px; padding: 2px 4px; text-align: center; color: var(--secondary); }
.sa-heat th[scope="row"] { text-align: left; white-space: nowrap; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.sa-heat .sa-hn { color: var(--muted); font-weight: 400; }
.sa-heat td { width: 30px; height: 26px; padding: 0; border: none; text-align: center; font-size: 11px; font-weight: 700; border-radius: 4px; }
.sa-h-na { background: transparent; }
.sa-h-no { background: #F3F3EE; color: var(--muted); }
.sa-h-low { background: #E3EFE6; color: var(--good-fg); }
.sa-h-moderate { background: #FBE9BF; color: var(--warn-fg); }
.sa-h-high { background: #F5CFC9; color: var(--bad-fg); }
.sa-h-significant { background: var(--bad-fg); color: #fff; }
.sa-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; }
.sa-facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sa-facts strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sa-qi { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; font-size: 13px; max-width: 520px; }
.sa-matrix { min-width: 980px; }
.sa-matrix th[scope="row"] { font-size: 13px; color: var(--ink); font-weight: 400; min-width: 170px; max-width: 240px; padding: 8px 10px; }
.sa-matrix tr.sa-off th[scope="row"] { color: var(--muted); }
.sa-facs { display: flex; gap: 8px; flex-wrap: nowrap; min-width: 250px; }
.sa-matrix select { width: auto; }
.sa-matrix td { vertical-align: middle; }
.sa-fac { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--secondary); white-space: nowrap; }
.sa-note { width: 150px; }
.sa-qual .check small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 900px) {
  .sa-panels { grid-template-columns: minmax(0, 1fr); }
  .sa-facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sa-move { margin-left: 0; }
}
/* === end significant accounts === */
/* === industry packs and methodology updates (ip-*) === */
.ip-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ip-pick { text-align: left; border: 1px solid var(--border-strong); background: #fff; border-radius: 10px; padding: 10px 12px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--ink); }
.ip-pick:hover { border-color: var(--brand); }
.ip-pick.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #F4F7FC; }
.ip-pick .hint-text { overflow-wrap: anywhere; }
.ip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ip-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--secondary); }
.ip-h3 { margin: 0 0 6px; font-size: 14px; }
.ip-ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 4px; }
.ip-cols > * { min-width: 0; }
.ip-codes summary { cursor: pointer; margin-top: 4px; }
.ip-codes div { margin-top: 4px; }
.ip-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; font-size: 13px; }
.ip-facts > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.ip-notes summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--secondary); }
.ip-notes[open] summary { margin-bottom: 6px; }
.ip-version { font-size: 13px; }
.ip-plan { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ip-plan details summary { cursor: pointer; }
.ip-scroll { max-height: 220px; overflow: auto; margin-top: 4px; }
@media (max-width: 900px) {
  .ip-facts { grid-template-columns: minmax(0, 1fr); }
  .ip-cols { grid-template-columns: minmax(0, 1fr); }
}
/* === end industry packs === */
/* data analytics (eng-analytics.html) */
.da-sum { font-size: 13px; color: var(--secondary); }
.da-hash { overflow-wrap: anywhere; word-break: break-all; }
.da-link > .field { min-width: 0; }
.da-link select { width: 100%; max-width: 100%; min-width: 0; }
.da-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 12px; }
.da-tests { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.da-test { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.da-test .hint-text { flex: 1; }
.da-weights { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 14px; }
.da-w { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; border-bottom: 1px solid var(--border); padding: 4px 0; }
.da-w > span { display: flex; flex-direction: column; min-width: 0; }
.da-w .hint-text { font-size: 11.5px; }
.da-w input { width: 64px; text-align: right; padding: 5px 6px; border: 1px solid var(--border-strong); border-radius: 6px; font: inherit; }
.da-chart { width: 100%; height: auto; display: block; }
.da-chart .da-ax { font-size: 10px; fill: var(--secondary); }
.da-chart .da-grid { stroke: var(--border); stroke-width: 1; }
.da-chart .da-bar { fill: var(--brand); opacity: .85; }
.da-chart .da-bar.hot { fill: var(--bad-fg); }
.da-chart .da-bar[role="button"] { cursor: pointer; }
.da-chart .da-bar[role="button"]:hover, .da-chart .da-bar:focus { opacity: 1; outline: none; stroke: var(--accent); stroke-width: 2; }
.da-chart .da-bar2 { fill: var(--accent); opacity: .8; }
.da-chart .da-exp { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.da-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--secondary); }
.da-legend i { display: inline-block; width: 12px; height: 10px; margin-right: 5px; vertical-align: middle; border-radius: 2px; }
.da-legend .da-l-bar { background: var(--brand); }
.da-legend .da-l-hot { background: var(--bad-fg); }
.da-legend .da-l-bar2 { background: var(--accent); }
.da-legend .da-l-exp { background: var(--accent); height: 3px; }
.da-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.da-cols2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; }
.da-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; max-height: 260px; overflow: auto; }
.da-score { display: inline-block; width: 60px; height: 6px; background: var(--neutral-bg); border-radius: 3px; margin-right: 6px; vertical-align: middle; overflow: hidden; }
.da-score span { display: block; height: 100%; background: var(--bad-fg); }
.da-why { font-size: 12.5px; min-width: 220px; }
.da-why div + div { margin-top: 2px; }
@media (max-width: 800px) { .da-cols, .da-cols2 { grid-template-columns: minmax(0, 1fr); } }
/* end data analytics */
/* financial statements (eng-fs) — prefix fsd- */
.fsd-opts summary { cursor: pointer; }
.fsd-grid .check { align-self: end; }
.fsd-tie-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fsd-checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 16px; font-size: 13px; }
.fsd-checks li { display: flex; gap: 6px; align-items: flex-start; }
.fsd-checks li.ok > span:first-child { color: var(--good-fg); font-weight: 700; }
.fsd-checks li.bad > span:first-child { color: var(--bad-fg); font-weight: 700; }
.fsd-st, .fsd-noteblk { border-bottom: 1px solid var(--border); padding-bottom: 18px; }
.fsd-st:last-child, .fsd-noteblk:last-child { border-bottom: none; }
.fsd-st + .fsd-st { padding-top: 6px; }
.fsd-st-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.fsd-st-head h3 { margin: 0; font-size: 17px; }
.fsd-st-head h4 { margin: 0; font-size: 14px; }
.fsd-st-head p { margin: 2px 0 8px; }
.fsd-stmt { font-variant-numeric: tabular-nums; }
.fsd-stmt td.num, .fsd-stmt th.num { white-space: nowrap; min-width: 96px; }
.fsd-stmt .fsd-note { text-align: center; width: 56px; }
.fsd-stmt tr.r-header td { background: transparent; }
.fsd-stmt tr.r-total td.num { border-bottom: 3px double var(--ink); }
.fsd-matrix td.num, .fsd-matrix th.num { min-width: 88px; font-size: 12.5px; }
.fsd-noteblk:focus { outline: 2px solid var(--brand); outline-offset: 4px; }
.fsd-prose p { margin: 6px 0; font-size: 13.5px; line-height: 1.55; max-width: 78ch; }
.fsd-pol { margin: 8px 0 0 12px; }
.fsd-filters input[type=search] { min-width: 200px; flex: 1 1 200px; }
.fsd-bulk { flex-wrap: wrap; }
.fsd-bulk select { max-width: 100%; min-width: 0; }
.fsd-maptable select { max-width: 260px; min-width: 150px; }
.fsd-maptable td.num { white-space: nowrap; }
.fsd-maptable tr.fsd-unm td { background: #FFF6F3; }
.fsd-maptable tr.fsd-chg td { background: #F2F6FC; }
.fsd-accname { min-width: 160px; }
.fsd-edit input, .fsd-edit select { width: 100%; min-width: 90px; }
.fsd-items { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; }
@media (max-width: 720px) {
  .fsd-maptable select { min-width: 130px; }
  .fsd-st-head h3 { font-size: 15.5px; }
}
/* end financial statements */

/* ---- Engagement kinds (review, compilation, agreed-upon procedures, ISA 800/805) — prefix ek- ---- */
.ek-kind { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--neutral-bg); color: var(--secondary); white-space: nowrap; vertical-align: 1px; }
.ek-wrap { white-space: normal; overflow-wrap: anywhere; min-width: 12rem; max-width: 42rem; }
.ek-fixed { padding: 10px 12px; border-radius: 10px; background: var(--neutral-bg); display: grid; gap: 4px; }
@media (max-width: 640px) { .ek-wrap { min-width: 9rem; } }

/* ---- Notifications, email preferences and settings — prefix nt- ---- */
.nt-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.navitem .count[hidden] { display: none; }
.nt-list { display: flex; flex-direction: column; }
.nt-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.nt-item:last-child { border-bottom: none; }
.nt-dot { flex: 0 0 8px; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; }
.nt-unread .nt-dot { background: var(--accent); }
.nt-high.nt-unread .nt-dot { background: var(--bad-fg); }
.nt-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.nt-title { margin: 0; font-size: 14px; font-weight: 500; }
.nt-unread .nt-title { font-weight: 700; }
.nt-body { font-size: 13px; color: var(--secondary); margin-top: 2px; }
.nt-meta { margin-top: 4px; font-size: 12px; }
.nt-act { flex: 0 0 auto; }
.nt-prefs { display: grid; gap: 10px; }
.nt-pref { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0; min-width: 0; }
.nt-pref legend { padding: 0 4px; font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; max-width: 100%; }
.nt-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.nt-status { display: grid; gap: 6px; font-size: 13px; }
.nt-portal-new { margin-bottom: 12px; }
@media (max-width: 640px) {
  .nt-item { flex-wrap: wrap; }
  .nt-act { margin-left: 18px; }
}
/* end notifications */

/* ---- AI assistance (drafts for professional review) — prefix ai- ---- */
.ai-draft { border: 1px dashed var(--accent); border-radius: 10px; padding: 10px 12px; background: #FFFCF5; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ai-draft-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.ai-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 5px; background: var(--warn-bg); color: var(--warn-fg); white-space: nowrap; }
.ai-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.5; color: var(--ink); max-height: 420px; overflow: auto; }
.ai-actions { flex-wrap: wrap; }
.ai-points { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.ai-points li > div { overflow-wrap: anywhere; }
.ai-inline { display: flex; flex-direction: column; gap: 6px; }
.ai-inline > button { align-self: flex-start; }
.ai-ack { align-items: flex-start; line-height: 1.45; }
.ai-ack input { margin-top: 2px; flex: none; }
.ai-span2 { grid-column: span 2; }
.ai-filters { flex-wrap: wrap; }
.ai-filters input, .ai-filters select { max-width: 100%; min-width: 0; }
.ai-clip { max-width: 22rem; overflow-wrap: anywhere; white-space: normal; }
.ai-hash { font-size: 11px; overflow-wrap: anywhere; }
.ai-details > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--brand); padding: 4px 0; }
.ai-details[open] > summary { margin-bottom: 8px; }
.ai-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 720px) { .ai-span2 { grid-column: auto; } .ai-clip { max-width: 14rem; } }
/* end AI assistance */

/* ---- Evidence linked to figures, tickmarks, cross-references and the binder (v3) — prefixes ev-, bd-, .textLayer ---- */
.ev-aff { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; padding: 1px 5px; min-height: 18px; border: 1px solid var(--border-strong); border-radius: 6px; background: #fff; color: var(--secondary); font: 600 10.5px/1.2 'IBM Plex Sans', system-ui, sans-serif; cursor: pointer; vertical-align: middle; white-space: nowrap; max-width: 150px; overflow: hidden; }
.ev-aff:hover, .ev-aff:focus-visible { border-color: var(--brand); color: var(--brand); outline: none; box-shadow: 0 0 0 2px rgba(22,48,90,.18); }
.ev-aff.ev-empty { opacity: .28; border-style: dashed; }
tr:hover .ev-aff.ev-empty, .q:hover .ev-aff.ev-empty, .ev-aff.ev-empty:focus-visible { opacity: 1; }
.field.q > .ev-aff { align-self: flex-start; margin: 4px 0 0; }
.ev-tk { font-weight: 700; font-size: 12px; line-height: 1; }
.ev-tk-big { font-size: 16px; min-width: 18px; display: inline-block; text-align: center; }
.ev-clip { display: inline-flex; align-items: center; gap: 1px; color: var(--good-fg); }
.ev-clip.ev-bad { color: var(--bad-fg); }
.ev-xchip { background: var(--neutral-bg); border-radius: 4px; padding: 0 4px; color: var(--brand); overflow: hidden; text-overflow: ellipsis; max-width: 70px; }
.ev-warn { background: var(--warn-bg); color: var(--warn-fg); border-radius: 50%; width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.ev-pop { display: grid; gap: 14px; }
.ev-fig { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 12px; background: var(--neutral-bg); border-radius: 10px; flex-wrap: wrap; }
.ev-figval { font: 700 18px 'Space Grotesk', system-ui, sans-serif; color: var(--brand); font-variant-numeric: tabular-nums; }
.ev-sec h3 { margin: 0 0 6px; font-size: 14px; font-family: 'Space Grotesk', system-ui, sans-serif; }
.ev-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.ev-list li { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; font-size: 13px; padding: 6px 0; border-top: 1px solid var(--border); }
.ev-list li:first-child { border-top: 0; }
.ev-grow { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; }
.ev-acts { display: inline-flex; gap: 8px; align-items: center; }
.ev-stale { display: block; color: var(--warn-fg); background: var(--warn-bg); border-radius: 6px; padding: 2px 6px; font-size: 12px; margin-top: 3px; width: fit-content; }
.ev-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 6px; }
.ev-lbl { display: grid; gap: 3px; font-size: 12px; font-weight: 600; color: var(--secondary); min-width: 0; }
.ev-lbl input, .ev-lbl select { font: inherit; font-weight: 400; font-size: 13px; color: var(--ink); padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; max-width: 100%; min-width: 0; }
.ev-xrefs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0; font-size: 13px; }
.ev-xref { display: inline-flex; align-items: center; gap: 2px; background: #EEF2F8; border: 1px solid rgba(22,48,90,.14); border-radius: 999px; padding: 2px 8px; font-size: 12px; max-width: 100%; overflow-wrap: anywhere; }
.ev-xref a { color: var(--brand); font-weight: 600; }
.ev-xref .icon-btn { font-size: 12px; padding: 0 2px; }
.ev-legend summary { cursor: pointer; font-size: 12.5px; color: var(--secondary); }
.ev-legend ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; columns: 2 220px; }
.ev-legend-strip, .ev-legend-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12px; color: var(--secondary); }
.ev-legend-strip { margin-top: 14px; padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; background: #fff; }
.ev-legend-strip b, .ev-legend-inline b { font-size: 13px; }
/* document viewer */
.ev-viewer { position: fixed; inset: 0; z-index: 900; background: #EEF0EC; display: flex; flex-direction: column; }
.ev-vbar { display: flex; gap: 8px 10px; align-items: flex-end; flex-wrap: wrap; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--border-strong); }
.ev-vtitle { flex: 1 1 240px; min-width: 0; font-size: 14px; align-self: center; overflow-wrap: anywhere; }
.ev-vval { font: 700 15px 'Space Grotesk', system-ui, sans-serif; color: var(--brand); margin-left: 6px; font-variant-numeric: tabular-nums; }
.ev-vfile select { max-width: 320px; }
.ev-up { cursor: pointer; }
.ev-zoom { display: inline-flex; gap: 4px; }
.ev-mode { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; align-self: center; }
.ev-vmain { flex: 1; display: flex; min-height: 0; }
.ev-vside { width: 300px; flex: 0 0 300px; overflow: auto; padding: 12px 14px; background: #fff; border-right: 1px solid var(--border); display: grid; gap: 12px; align-content: start; font-size: 13px; }
.ev-vdoc { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ev-page { position: relative; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); flex: 0 0 auto; }
.ev-page canvas, .ev-page img { display: block; }
.ev-overlay { position: absolute; inset: 0; z-index: 3; cursor: crosshair; touch-action: none; }
.ev-selecting .ev-overlay { pointer-events: none; }
.ev-selecting .ev-overlay .ev-cand { pointer-events: auto; }
.ev-cand { position: absolute; min-height: 0; min-width: 0; border: 2px solid #C99A3B; background: rgba(201,154,59,.28); border-radius: 3px; cursor: pointer; padding: 0; }
.ev-cand:hover, .ev-cand:focus-visible { background: rgba(201,154,59,.5); outline: 2px solid var(--brand); }
.ev-linkbox { position: absolute; border: 2px solid var(--good-fg); background: rgba(10,107,52,.10); border-radius: 3px; pointer-events: none; }
.ev-linkbox span { position: absolute; top: -17px; left: -2px; font: 700 10px/1 'IBM Plex Sans', sans-serif; color: #fff; background: var(--good-fg); padding: 3px 5px; border-radius: 4px 4px 0 0; white-space: nowrap; }
.ev-linkbox.ev-differs { border-color: var(--bad-fg); background: rgba(178,58,58,.10); }
.ev-linkbox.ev-differs span { background: var(--bad-fg); }
.ev-linkbox.ev-na { border-color: var(--secondary); background: rgba(85,100,92,.08); }
.ev-linkbox.ev-na span { background: var(--secondary); }
.ev-linkbox.ev-stalebox { border-style: dashed; }
.ev-pendbox { position: absolute; border: 2px solid var(--brand); background: rgba(22,48,90,.14); border-radius: 3px; pointer-events: none; }
.ev-dragbox { position: absolute; border: 1.5px dashed var(--brand); background: rgba(22,48,90,.08); pointer-events: none; }
.ev-cands ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 3px; max-height: 220px; overflow: auto; }
.ev-pend { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: #FAFBF8; }
@media (max-width: 760px) {
  .ev-vmain { flex-direction: column; }
  .ev-vside { width: auto; flex: 0 0 auto; max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .ev-vdoc { padding: 8px; }
  .ev-vfile select { max-width: 100%; }
  .ev-vfile { flex: 1 1 100%; }
}
/* PDF.js text layer (from pdf_viewer.css, trimmed) */
.textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 1; --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; --font-height: 0; font-size: calc(var(--text-scale-factor) * var(--font-height)); --scale-x: 1; --rotate: 0deg; transform: rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv)); }
.textLayer .markedContent { display: contents; }
.textLayer ::selection { background: rgba(0, 0, 255, 0.25); }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
/* binder */
.bd-opts { flex-wrap: wrap; }
.bd-bar { height: 8px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; max-width: 520px; }
.bd-bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.bd-hash { font-size: 11px; overflow-wrap: anywhere; word-break: break-all; }
/* end evidence & binder */

/* ---- Live collaboration (presence, chat, safe merge — js/collab.js) prefix lv-; offline working (js/offline.js, offline.html) prefix ol- ---- */
.lv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 8px 0 2px; padding: 6px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); font-size: 12.5px; }
.lv-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.lv-slot:empty { display: none; }
.ol-slot { margin-left: auto; }
.lv-avs { display: inline-flex; }
.lv-av { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700; border: 2px solid var(--card); margin-left: -4px; flex: none; }
.lv-avs .lv-av:first-child { margin-left: 0; }
.lv-av.ed { background: var(--accent); }
.lv-names { color: var(--secondary); overflow-wrap: anywhere; }
.lv-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad-fg); color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.lv-wp { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px !important; }
.lv-here:empty { display: none; }
.lv-hereline { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.lv-hereline .lv-av { margin-left: 0; }
.lv-wpchat summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--brand); }
.lv-wpchat[open] summary { margin-bottom: 8px; }
.lv-chatp { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.lv-note { margin: 0; font-size: 12px; color: var(--secondary); background: var(--neutral-bg); border-radius: 8px; padding: 6px 10px; }
.lv-msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.lv-chatp.compact .lv-msgs { max-height: 260px; }
.lv-msg { padding: 7px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); max-width: 92%; }
.lv-msg.mine { align-self: flex-end; background: #EEF2F8; }
.lv-meta { font-size: 12px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.lv-meta time { color: var(--muted); }
.lv-acts { margin-left: auto; }
.lv-acts button { border: none; background: none; padding: 0; color: var(--brand); font-size: 12px; cursor: pointer; text-decoration: underline; font-family: inherit; }
.lv-body { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.lv-at { color: var(--brand); font-weight: 600; }
.lv-at.me { background: var(--warn-bg); color: var(--warn-fg); border-radius: 4px; padding: 0 2px; }
.lv-compose { display: flex; flex-direction: column; gap: 6px; }
.lv-compose textarea { font-family: inherit; font-size: 14px; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border-strong); resize: vertical; width: 100%; }
.lv-ctools { justify-content: space-between; }
.lv-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.lv-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 100vw; background: var(--card); box-shadow: -8px 0 30px rgba(20, 32, 46, 0.18); z-index: 60; display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.lv-dr-head { display: flex; justify-content: space-between; align-items: center; }
.lv-dr-head h2 { margin: 0; font-size: 18px; }
.lv-dr-sel { font-family: inherit; font-size: 13px; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; width: 100%; }
.lv-dr-body { flex: 1; min-height: 0; overflow-y: auto; }
.lv-drawer .lv-msgs { max-height: none; }
.lv-cf { border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; margin: 0; }
.lv-cf legend { font-weight: 600; font-size: 13.5px; padding: 0 4px; }
.lv-cfgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lv-pick { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.lv-pick:has(input:checked) { border-color: var(--brand); background: #EEF2F8; }
.lv-pick > span { display: flex; flex-direction: column; min-width: 0; }
.lv-val { display: block; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 160px; overflow-y: auto; }
.ol-state { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 12px; }
.ol-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good-fg); }
.ol-state.off { color: var(--warn-fg); }
.ol-state.off::before { background: var(--warn-fg); }
.ol-note { flex-basis: 100%; color: var(--warn-fg); font-size: 12px; }
.ol-ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--secondary); display: flex; flex-direction: column; gap: 4px; }
.ol-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.ol-acts { white-space: nowrap; }
@media (max-width: 720px) {
  .ol-slot { margin-left: 0; }
  .lv-cfgrid { grid-template-columns: minmax(0, 1fr); }
  .lv-drawer { width: 100vw; padding: 12px; }
  .ol-acts { white-space: normal; }
}

/* ---- Working paper versions, spreadsheet and document papers — prefixes sh- (sheet), dc- (document), pp- (paper page), vh- (version history) ---- */
.sh-wrap .sr-only, .dc-wrap .sr-only, .vh-card .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; }
.sh-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sh-toolbar { flex-wrap: wrap; gap: 4px; }
.sh-toolbar select { padding: 4px 6px; font-size: 12.5px; min-width: 0; max-width: 150px; }
.sh-tbtn, .dc-tbtn { min-width: 30px; padding-left: 8px; padding-right: 8px; }
.sh-tbtn.on, .dc-tbtn.on { background: var(--neutral-bg); border-color: var(--brand); }
.sh-group, .dc-group { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.sh-fbar { display: flex; gap: 6px; align-items: center; }
.sh-name { min-width: 72px; font: 600 12.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--secondary); padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--neutral-bg); text-align: center; }
.sh-formula { flex: 1; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.sh-scroll { position: relative; overflow: auto; max-height: 62vh; min-height: 220px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; outline: none; }
.sh-scroll:focus-visible { box-shadow: 0 0 0 2px var(--brand); }
.sh-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; font-variant-numeric: tabular-nums; }
.sh-table th, .sh-table td { height: 24px; padding: 0 6px; font-size: 12.5px; line-height: 23px; border-right: 1px solid #E5E7E3; border-bottom: 1px solid #E5E7E3; border-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
.sh-table thead th { position: sticky; top: 0; z-index: 3; background: #F1F2EE; color: var(--secondary); font-weight: 600; text-align: center; padding: 0 4px; }
.sh-table th.sh-rowh { position: sticky; left: 0; z-index: 2; background: #F1F2EE; color: var(--muted); font-weight: 500; text-align: right; padding-right: 6px; }
.sh-table th.sh-corner { left: 0; z-index: 4; }
.sh-table tr.sh-frozen td, .sh-table tr.sh-frozen th { position: sticky; top: var(--sh-top); z-index: 2; background: #FAFAF7; }
.sh-table tr.sh-frozen th.sh-rowh { z-index: 3; }
.sh-table td { cursor: cell; color: var(--ink); background: #fff; }
.sh-table td.sh-al-r { text-align: right; } .sh-table td.sh-al-c { text-align: center; } .sh-table td.sh-al-l { text-align: left; }
.sh-table td.sh-b { font-weight: 700; } .sh-table td.sh-i { font-style: italic; }
.sh-table td.sh-err { color: var(--bad-fg); }
.sh-table td.sh-link { background-image: linear-gradient(225deg, var(--accent) 6px, transparent 6px); }
.sh-table td.sh-kept { background-color: #FFF8E6; }
.sh-table td.sh-sel { background-color: #E8EEF8; }
.sh-table td.sh-act { box-shadow: inset 0 0 0 2px var(--brand); }
.sh-colh { position: relative; }
.sh-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 5; }
.sh-input { position: absolute; z-index: 6; border: 2px solid var(--brand); border-radius: 0; padding: 0 5px; font-size: 12.5px; background: #fff; box-sizing: border-box; font-family: inherit; }
.sh-tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sh-tab { border: 1px solid var(--border-strong); background: #fff; border-radius: 0 0 6px 6px; padding: 4px 12px; font-size: 12.5px; cursor: pointer; color: var(--secondary); }
.sh-tab.active { background: var(--brand); color: #FAF9F5; border-color: var(--brand); }
.sh-msg:empty, .sh-totals:empty { display: none; }
.sh-totcard { padding: 12px 14px; }
.sh-list { margin: 4px 0 6px; padding-left: 18px; font-size: 12.5px; }
.sh-list .sh-ok { color: var(--good-fg); } .sh-list .sh-bad { color: var(--bad-fg); font-weight: 600; }
.dc-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dc-toolbar { flex-wrap: wrap; gap: 4px; position: sticky; top: 0; z-index: 4; background: var(--card); padding: 4px 0; }
.dc-toolbar select { padding: 4px 6px; font-size: 12.5px; }
.dc-editor, .dc-view { min-height: 260px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 14px 18px; background: #fff; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; outline: none; }
.dc-view { min-height: 0; }
.dc-editor:focus { box-shadow: 0 0 0 2px var(--brand); }
.dc-editor[contenteditable="false"] { background: #FCFCFA; }
.dc-editor h1, .dc-view h1 { font-size: 21px; margin: 14px 0 6px; } .dc-editor h2, .dc-view h2 { font-size: 17px; margin: 12px 0 4px; } .dc-editor h3, .dc-view h3 { font-size: 15px; font-style: italic; margin: 10px 0 4px; }
.dc-editor p, .dc-view p { margin: 0 0 8px; }
.dc-editor ul, .dc-editor ol, .dc-view ul, .dc-view ol { margin: 0 0 8px; padding-left: 24px; }
.dc-editor li[data-lv="1"], .dc-view li[data-lv="1"] { margin-left: 22px; } .dc-editor li[data-lv="2"], .dc-view li[data-lv="2"] { margin-left: 44px; }
.dc-editor li[data-lv="3"], .dc-view li[data-lv="3"] { margin-left: 66px; } .dc-editor li[data-lv="4"], .dc-view li[data-lv="4"] { margin-left: 88px; }
.dc-table { border-collapse: collapse; margin: 6px 0 10px; width: 100%; max-width: 100%; }
.dc-table td, .dc-table th { border: 1px solid var(--border-strong); padding: 4px 8px; font-size: 13px; vertical-align: top; min-width: 40px; }
.dc-table th { background: #F1F2EE; text-align: left; color: var(--ink); font-size: 13px; font-weight: 700; }
.dc-editor a, .dc-view a { text-decoration: underline; }
.dc-hint:empty { display: none; }
.pp-actions { justify-content: flex-end; }
.pp-import { cursor: pointer; }
.pp-conflict { border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 12px; margin: 0; }
.pp-conflict legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.pp-choice { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 4px 0; overflow-wrap: anywhere; }
.vh-card > summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; }
.vh-card > summary::-webkit-details-marker { display: none; }
.vh-card > summary::before { content: "▸"; color: var(--muted); }
.vh-card[open] > summary::before { content: "▾"; }
.vh-body { margin-top: 10px; }
.vh-compare { flex-wrap: wrap; gap: 6px; }
.vh-compare select { padding: 4px 6px; font-size: 12.5px; }
.vh-table td { vertical-align: top; }
.vh-acts { white-space: nowrap; }
.vh-sign { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: var(--good-bg); color: var(--good-fg); }
.vh-sign.old { background: var(--neutral-bg); color: var(--muted); text-decoration: line-through; }
.vh-before { color: var(--bad-fg); } .vh-after { color: var(--good-fg); }
.vh-sheet table { font-size: 12px; } .vh-sheet td, .vh-sheet th { padding: 3px 8px; white-space: nowrap; } .vh-sheet td.vh-b { font-weight: 700; }
.vh-qa { margin: 0; display: grid; gap: 2px 0; } .vh-qa dt { font-weight: 600; font-size: 13px; margin-top: 6px; } .vh-qa dd { margin: 0; font-size: 13px; white-space: pre-wrap; }
@media (max-width: 720px) {
  .sh-scroll { max-height: 55vh; }
  .sh-toolbar select { max-width: 120px; }
  .vh-acts { white-space: normal; }
}
/* end working paper versions and papers */

/* ---- Practice management: scheduling, timesheets, WIP & billing (pm-) ---- */
.pm-c0 { background: #DCE6F5; } .pm-c1 { background: #E3F1E5; } .pm-c2 { background: #FBEBD0; } .pm-c3 { background: #EFE0F3; }
.pm-c4 { background: #D8F0EE; } .pm-c5 { background: #F7DEDC; } .pm-c6 { background: #E9ECD2; } .pm-c7 { background: #E4E0F5; }
.pm-leave { background: #E2E2DA; }
.pm-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--border-strong); }
.pm-overdot { background: #fff; border: 2px solid var(--bad-fg); }
.pm-plan { border-collapse: collapse; font-size: 12px; }
.pm-plan th, .pm-plan td { padding: 3px 4px; text-align: center; border-bottom: 1px solid var(--border); }
.pm-plan th.pm-person { text-align: left; white-space: nowrap; font-weight: 600; min-width: 130px; position: sticky; left: 0; background: #fff; z-index: 1; color: var(--ink); }
.pm-plan td.pm-cell { min-width: 30px; height: 30px; font-variant-numeric: tabular-nums; cursor: default; border-left: 1px solid #fff; }
.pm-plan td.pm-cell[role="button"] { cursor: pointer; }
.pm-plan td.pm-cell[role="button"]:hover, .pm-plan td.pm-cell:focus { outline: 2px solid var(--brand); outline-offset: -2px; }
.pm-plan td.pm-over { box-shadow: inset 0 0 0 2px var(--bad-fg); color: var(--bad-fg); font-weight: 700; }
.pm-plan td.pm-tent { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.55) 0 4px, transparent 4px 8px); }
.pm-we { background: #F3F3EE; color: var(--muted); }
.pm-link { border: none; background: none; padding: 0; color: var(--brand); font-size: 11px; cursor: pointer; text-decoration: underline; }
.pm-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; margin-top: 10px; color: var(--secondary); }
.pm-ts { font-size: 13px; }
.pm-ts th, .pm-ts td { padding: 5px 6px; vertical-align: top; }
.pm-ts .pm-rowlabel { min-width: 180px; max-width: 280px; overflow-wrap: anywhere; }
.pm-ts input.pm-h { width: 58px; padding: 4px 5px; text-align: right; font-variant-numeric: tabular-nums; }
.pm-ts tr.pm-locked td { background: #FAFAF7; color: var(--secondary); }
.pm-subtabs { margin-bottom: 4px; }
@media (max-width: 720px) {
  .pm-ts .pm-rowlabel { min-width: 130px; }
  .pm-plan th.pm-person { min-width: 100px; }
  .pm-rparams { grid-template-columns: 1fr; }
}
/* end practice management */

/* ---------------------------------------------------------------- PracticeTrove */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .section-title { margin: 0 0 4px; }
.chip.isqm { background: #E4EFE9; color: var(--brand); font-size: 11px; font-weight: 600; vertical-align: middle; }
.reg-title { margin: 0 0 4px; font-size: 18px; }
.reg-toolbar select { max-width: 220px; }
.reg-form .field textarea { min-height: 70px; }
.ro-val { font-size: 13px; padding: 6px 0; }
.ref { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; color: var(--secondary); white-space: nowrap; }
.reg-history { font-size: 12.5px; }
.reg-history ul { margin: 6px 0 0; padding-left: 18px; }
.reg-history li { margin-bottom: 4px; }
.toast.warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid #F0D48A; }
.multi-pick { overflow: auto; border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 10px; display: flex; flex-direction: column; gap: 4px; background: #fff; }
.multi-pick .check { font-weight: 400; }
.kpi-good { border-left: 4px solid var(--good-fg); }
.kpi-warn { border-left: 4px solid #E0A800; }
.kpi-bad { border-left: 4px solid var(--bad-fg); }
.kpi-info { border-left: 4px solid var(--border-strong); }
.heat-wrap { display: inline-block; }
.heat-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
table.heat { border-collapse: separate; border-spacing: 3px; font-size: 11px; }
table.heat td { width: 54px; height: 38px; text-align: center; border-radius: 6px; font-weight: 700; font-size: 15px; color: #1b1b1b; }
table.heat td.h-low { background: #DDEFE3; }
table.heat td.h-med { background: #FCE9B8; }
table.heat td.h-high { background: #F6C9C3; }
table.heat td.has { cursor: pointer; outline: 2px solid rgba(0,0,0,.08); }
table.heat td.has:hover, table.heat td.has:focus { outline: 2px solid var(--brand); }
table.heat th { font-weight: 500; color: var(--muted); padding: 2px 6px; white-space: nowrap; }
table.heat th.heat-l { text-align: right; }
table.heat th.heat-e { text-align: center; max-width: 60px; white-space: normal; line-height: 1.15; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.comp-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.comp-card h3 { margin: 0; font-size: 14px; }
.comp-card .nums { display: flex; gap: 12px; font-size: 12.5px; color: var(--secondary); flex-wrap: wrap; }
.gap-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.gap-list li { font-size: 13px; padding: 7px 10px; border-radius: 8px; background: var(--neutral-bg); display: flex; gap: 8px; align-items: flex-start; }
.gap-list li.bad { background: var(--bad-bg); color: var(--bad-fg); }
.gap-list li.warn { background: var(--warn-bg); color: var(--warn-fg); }
.gap-list li button { margin-left: auto; white-space: nowrap; }
.matrix { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--border); padding: 7px 8px; vertical-align: top; text-align: left; }
.matrix th { background: var(--neutral-bg); font-weight: 600; position: sticky; top: 0; }
.matrix .comp-row td { background: #E4EFE9; font-weight: 700; color: var(--brand); }
.matrix ul { margin: 0; padding-left: 16px; }
.score { display: inline-block; min-width: 28px; text-align: center; border-radius: 6px; padding: 1px 6px; font-weight: 700; font-size: 12px; }
.score.high { background: #F6C9C3; color: #7d1d14; }
.score.medium { background: #FCE9B8; color: #6b4a00; }
.score.low { background: #DDEFE3; color: #0b5b2c; }
.why-list { display: flex; flex-direction: column; gap: 8px; }
.why-list .why { display: flex; gap: 8px; align-items: center; }
.why-list .why span { width: 70px; font-weight: 600; font-size: 12.5px; color: var(--secondary); }
.fishbone { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fishbone .bone { border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px; background: #fff; }
.fishbone .bone h4 { margin: 0 0 6px; font-size: 13px; }
.cl-sec { margin: 10px 0 4px; font-weight: 700; font-size: 13.5px; color: var(--brand); }
.cl-item { display: grid; grid-template-columns: 1fr 190px; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cl-item .res { display: flex; gap: 6px; }
.cl-item textarea { grid-column: 1 / -1; min-height: 38px; font-size: 12.5px; }
.doc { background: #fff; max-width: 980px; }
.doc h1 { font-size: 26px; margin: 0 0 4px; }
.doc h2 { font-size: 18px; margin: 26px 0 8px; border-bottom: 2px solid var(--brand); padding-bottom: 4px; color: var(--brand); }
.doc h3 { font-size: 14.5px; margin: 16px 0 6px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0 12px; }
.doc th, .doc td { border: 1px solid #d9ddd9; padding: 5px 7px; text-align: left; vertical-align: top; }
.doc th { background: #EEF2EF; }
.doc p { font-size: 13px; line-height: 1.5; }
.policy-body { white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; }
.policy-edit { width: 100%; min-height: 380px; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12.5px; }
.tab-host { margin-top: 12px; }
@media print {
  .sidebar, .no-print, .toast-host, .skip-link { display: none !important; }
  .main { padding: 0 !important; }
  .card { border: none !important; }
  .doc { max-width: none; }
  .doc h2 { page-break-after: avoid; }
  .doc table { page-break-inside: auto; }
  .doc tr { page-break-inside: avoid; }
}
@media (max-width: 800px) { .fishbone { grid-template-columns: 1fr; } .cl-item { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .heat-wrap { max-width: 100%; overflow-x: auto; }
  table.heat td { width: 40px; height: 32px; font-size: 13px; }
  table.heat th.heat-l { white-space: normal; max-width: 70px; }
  .comp-grid { grid-template-columns: 1fr; }
  .page-head .toolbar { flex-wrap: wrap; }
}
.gap-list li > a.btn-ghost, .gap-list li > a.btn-primary, .gap-list li > button { margin-left: auto; white-space: nowrap; }
.mp-filter { width: 100%; margin-bottom: 4px; padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: 8px; font: inherit; font-size: 12.5px; }

/* --- v3: AI assistance (drafts always labelled; never saved automatically) -------------------- */
.ai-draft { border: 1px dashed var(--accent); border-radius: 10px; padding: 10px 12px; background: #FFFCF5; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ai-draft-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.ai-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 5px; background: var(--warn-bg); color: var(--warn-fg); white-space: nowrap; }
.ai-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.5; color: var(--ink); max-height: 420px; overflow: auto; }
.ai-actions { flex-wrap: wrap; }
.ai-points { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.ai-points li > div { overflow-wrap: anywhere; }
.ai-inline { display: flex; flex-direction: column; gap: 6px; }
.ai-inline > .toolbar { flex-wrap: wrap; }
.ai-btn::before { content: "✦ "; color: var(--accent); }
.ai-ack { align-items: flex-start; line-height: 1.45; }
.ai-ack input { margin-top: 2px; flex: none; }
.ai-span2 { grid-column: span 2; }
.ai-filters { flex-wrap: wrap; }
.ai-filters input, .ai-filters select { max-width: 100%; min-width: 0; }
.ai-clip { max-width: 22rem; overflow-wrap: anywhere; white-space: normal; }
.ai-hash { font-size: 11px; overflow-wrap: anywhere; }
.ai-details > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--brand); padding: 4px 0; }
.ai-details[open] > summary { margin-bottom: 8px; }
.ai-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ai-narrative [contenteditable] { outline: 1px dashed var(--accent); outline-offset: 4px; white-space: pre-wrap; }
.ai-narrative [contenteditable]:focus { outline: 2px solid var(--brand); }
@media (max-width: 720px) { .ai-span2 { grid-column: auto; } .ai-clip { max-width: 14rem; } }
@media print { .ai-draft, .ai-inline, .ai-btn { display: none !important; } .ai-narrative [contenteditable] { outline: none; } }

/* --- v3: offline working ------------------------------------------------------------------------ */
.ol-banner { margin-bottom: 12px; overflow-wrap: anywhere; }
.ol-banner .ol-link { margin-left: 6px; }
.ol-state { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 12px; }
.ol-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good-fg); }
.ol-state.off { color: var(--warn-fg); }
.ol-state.off::before { background: var(--warn-fg); }
.ol-ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--secondary); display: flex; flex-direction: column; gap: 4px; }
.ol-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.ol-check input { margin-top: 3px; flex: none; }
.ol-acts { white-space: nowrap; }
.ol-cf th[scope=row] { text-transform: capitalize; white-space: nowrap; }
.ol-cf td { overflow-wrap: anywhere; max-width: 22rem; }
@media (max-width: 720px) { .ol-acts { white-space: normal; } }

/* Release 23: wide tables scroll inside their box on a phone, and print in full. */
@media print { .table-wrap { overflow: visible !important; } }

/* PracticeTrove: calendar, due today, letter */
.fp-today { color: var(--warn-fg); font-weight: 600; white-space: nowrap; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-cell { min-height: 92px; border: 1px solid var(--border); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 2px; background: var(--card); min-width: 0; }
.cal-empty { background: transparent; border-style: dashed; }
.cal-today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-day { font-size: 12px; font-weight: 600; color: var(--secondary); }
.cal-item { all: unset; cursor: pointer; font-size: 11px; line-height: 1.3; padding: 2px 4px; border-radius: 4px; background: var(--neutral-bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cal-item:hover, .cal-item:focus-visible { outline: 2px solid var(--brand); }
.cal-late { background: var(--bad-bg); color: var(--bad-fg); }
.cal-done { color: var(--muted); text-decoration: line-through; }
.cal-more { font-size: 11px; text-align: left; }
@media (max-width: 760px) { .cal-grid { grid-template-columns: 1fr; } .cal-head, .cal-empty { display: none; } .cal-cell { min-height: 0; } }
.letter-page { max-width: 760px; margin: 0 auto; background: #fff; padding: 48px 56px; border: 1px solid var(--border); border-radius: 10px; font-size: 14.5px; line-height: 1.6; }
.letter-page .lh { border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 28px; }
.letter-page .lh .nm { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 700; color: var(--brand); }
.letter-page .body p { margin: 0 0 12px; white-space: pre-wrap; }
.letter-page .lf { border-top: 1px solid var(--border); margin-top: 32px; padding-top: 8px; font-size: 11.5px; color: var(--muted); }
@media print { .sidebar, .no-print, .skip-link { display: none !important; } .main { padding: 0 !important; } .letter-page { border: 0; padding: 0; max-width: none; } }

/* Dates and numbers keep to one line in tables. */
.fp-nowrap, .nowrap, .fp-overdue, .fp-today { white-space: nowrap; }

/* On a phone, tables become one card per row (each cell labelled with its column). */
@media (max-width: 640px) {
  .table-wrap table thead { display: none; }
  .table-wrap table, .table-wrap table tbody, .table-wrap table tr, .table-wrap table td { display: block; width: 100%; }
  .table-wrap table tr { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: var(--card, #fff); }
  .table-wrap table td { border: 0; padding: 3px 0; text-align: left; }
  .table-wrap table td[data-label] { display: grid; grid-template-columns: 38% minmax(0, 1fr); gap: 8px; }
  .table-wrap table td.num { text-align: left; }
  .table-wrap table td[data-label]::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--muted); }
  .table-wrap table td[data-label=""] { grid-template-columns: 1fr; }
  .table-wrap table td[data-label=""]::before { display: none; }
  .table-wrap table.report-table tr { padding: 6px 10px; }
}
@media (max-width: 640px) { .table-wrap table td .cv { min-width: 0; } .table-wrap table td .cv .pill { justify-self: start; } }
