/* ═══════════════════════════════════════════════════════════════════════
   Step 5 — Review styles. Layered on top of
   financial-statements-wizard.css (which already styles stmt-grid / stmt-row /
   stmt-cell / kind-total + the fsw-* button/footer primitives) and
   wizard-layout.css (fsw-ghost-cta / fsw-primary-cta / fsw-step-sub /
   fsw-step-error).

   New surfaces here:
     • fsw-blockers-banner   — submission-blockers warning band
     • fsw-tab / .is-active  — tab strip pills
     • rev-tabs / rev-tabpanel — tab strip layout
     • rev-loading / rev-empty / rev-tie-warning
     • rev-cfs-header        — CFS title + Recompute button row
     • rev-notes-table       — Notes tab table
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Submission-blockers banner ───────────────────────────────────────── */
.fsw-blockers-banner {
  display: flex; gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 10px;
  background: rgba(232, 180, 58, 0.10);
  border: 1px solid rgba(232, 180, 58, 0.45);
  color: var(--charcoal);
}
.fsw-blockers-icon {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-weight: 700; font-size: 13px;
  line-height: 1;
}
.fsw-blockers-body strong {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 15px;
  color: var(--navy);
  display: block;
  margin-bottom: 4px;
}
.fsw-blockers-list {
  margin: 0; padding: 0;
  font-size: var(--fs-body-sm);
  color: var(--muted);
}
.fsw-blockers-list li {
  padding: 2px 0;
}
.fsw-blockers-list li + li {
  border-top: 1px dashed rgba(232, 180, 58, 0.25);
  margin-top: 4px; padding-top: 6px;
}

/* ── Tab strip ────────────────────────────────────────────────────────── */
.rev-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 18px;
  padding: 0 4px;
}
.fsw-tab {
  background: none; border: 0;
  padding: 10px 18px;
  margin-bottom: -1px;
  font: inherit;
  font-size: var(--fs-body-sm);
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.fsw-tab:hover { color: var(--navy); }
.fsw-tab.is-active {
  color: var(--navy);
  border-bottom-color: var(--gold);
  background: var(--paper);
}

.rev-tabpanel { padding: 4px 0 8px; }

/* ── Loading + empty + tie-warning states ─────────────────────────────── */
.rev-loading {
  display: flex; align-items: center; gap: 12px;
  padding: 32px 8px;
  color: var(--muted);
}
.rev-loading-spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--hairline);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: rev-spin 720ms linear infinite;
}
@keyframes rev-spin {
  to { transform: rotate(360deg); }
}

.rev-empty {
  padding: 32px 8px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--hairline);
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}

.rev-tie-warning {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #8a2230;
  font-size: var(--fs-body-sm);
}

/* ── CFS header (title + Recompute button) ────────────────────────────── */
.rev-cfs-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.rev-cfs-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 17px;
  color: var(--navy);
}
.rev-cfs-recompute {
  padding: 8px 16px;
  font-size: var(--fs-body-sm);
}

/* ── BS/IS code+name pair styling ─────────────────────────────────────── */
.bs-code {
  display: inline-block;
  min-width: 56px;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 12px;
  color: var(--muted);
  margin-right: 10px;
}
.bs-name { color: var(--charcoal); }

/* ── Notes table ──────────────────────────────────────────────────────── */
.rev-notes-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-body-sm);
}
.rev-notes-table thead th {
  text-align: left;
  font-size: var(--fs-meta);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
}
.rev-notes-table thead th.rev-notes-num,
.rev-notes-table tbody td.rev-notes-num { width: 56px; }
.rev-notes-table thead th.rev-notes-ref,
.rev-notes-table tbody td.rev-notes-ref { width: 140px; }
.rev-notes-table thead th.rev-notes-applicable,
.rev-notes-table tbody td.rev-notes-applicable { width: 110px; text-align: center; }
.rev-notes-table thead th.rev-notes-amount,
.rev-notes-table tbody td.rev-notes-amount { text-align: right; width: 140px; }

.rev-notes-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  color: var(--charcoal);
  vertical-align: middle;
}
.rev-notes-row.is-na td {
  color: var(--muted);
  background: rgba(15, 23, 42, 0.025);
}
.rev-notes-dash { color: var(--muted); }

.rev-notes-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rev-notes-pill.is-yes {
  background: rgba(15, 109, 79, 0.12);
  color: #0f6d4f;
}
.rev-notes-pill.is-no {
  background: rgba(15, 23, 42, 0.06);
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════════
   More ▼ tab + dropdown — ported from
   prototypes/financial-statements-wizard-tb-mvp/statement-review-ideation.html
   (lines 79-120). Consolidates Notes / Director's Report / Audit Report
   under one tab affordance.
   ═══════════════════════════════════════════════════════════════════════ */
.tab-more {
  display: inline-flex; align-items: center; gap: 6px;
}
.tab-more-chev {
  font-size: 9px;
  color: var(--muted-2);
  transition: transform 160ms ease, color 160ms ease;
}
.tab-more:hover .tab-more-chev { color: var(--navy); }
.tab-more.is-active .tab-more-chev { color: var(--navy); }
.tab-more[aria-expanded="true"] .tab-more-chev {
  transform: rotate(180deg);
  color: var(--navy);
}

.more-menu {
  position: absolute;
  top: 100%; left: 0;
  margin-top: 4px;
  min-width: 280px;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow:
    0 1px 2px rgba(26, 58, 107, 0.04),
    0 12px 32px -16px rgba(26, 58, 107, 0.18);
  z-index: 30;
}
.more-menu-item {
  width: 100%;
  padding: 10px 12px;
  border: 0; background: none;
  border-radius: 5px;
  cursor: pointer;
  color: var(--charcoal);
  font: inherit;
  font-size: var(--fs-body-sm);
  display: flex; align-items: center; gap: 10px;
  text-align: left;
}
.more-menu-item:hover { background: var(--bg-soft); color: var(--navy); }
.more-menu-item.is-active {
  background: rgba(232, 180, 58, 0.12);
  color: var(--navy);
  font-weight: 600;
}

/* Placeholder panels for not-yet-built More items. */
.placeholder-panel {
  padding: 40px 0 16px;
  text-align: center;
}
.placeholder-panel h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  color: var(--navy);
}
.placeholder-panel p {
  margin: 0 auto;
  max-width: 520px;
  color: var(--muted);
  font-size: var(--fs-body-sm);
}
.placeholder-panel .panel-pill {
  display: inline-block;
  margin-top: 16px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: var(--fs-meta);
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════════════════════════════════
   Notes to the financial statements — A4 preview + numbered sections +
   editable body + breakdown tables. Ported from
   prototypes/financial-statements-wizard-tb-mvp/statement-review-ideation.html
   (lines 152-232, 263-349, 399-440).
   ═══════════════════════════════════════════════════════════════════════ */
.rep-preview {
  display: flex; flex-direction: column;
  gap: 28px; align-items: center;
}
.rep-a4 {
  width: 760px; max-width: 100%;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 56px 64px;
  color: var(--charcoal);
  line-height: 1.55;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.06),
    0 4px 16px rgba(15, 23, 42, 0.08);
}
.rep-a4 .r-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
  color: var(--navy);
  margin: 0 0 4px;
  text-align: center;
}
.rep-a4 .r-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-body-sm);
  margin: 0 0 28px;
}

.note-section { margin: 0 0 28px; }
.note-section-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 0 0 8px;
}
.note-section-num {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 600;
  min-width: 20px;
}
.note-section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  color: var(--navy);
}
.note-clause {
  font-size: var(--fs-meta);
  color: var(--muted-2);
  letter-spacing: 0.04em;
  margin-left: auto;
}

.note-breakdown {
  width: 100%; border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-body-sm);
  margin-top: 12px;
}
.note-breakdown thead th {
  text-align: left;
  font-size: var(--fs-meta); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: var(--muted); padding: 6px 10px;
  border-bottom: 1px solid var(--hairline);
}
.note-breakdown thead th.num { text-align: right; }
.note-breakdown tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(217, 222, 231, 0.5);
}
.note-breakdown tbody tr:last-child td { border-bottom: 0; }
.note-breakdown tbody td.num { text-align: right; }
.note-breakdown tbody td.label { color: var(--charcoal); }
.note-breakdown tfoot td {
  padding: 8px 10px;
  font-weight: 600; color: var(--navy);
  border-top: 1px solid var(--hairline);
  border-bottom: 2px solid var(--gold);
}
.note-breakdown tfoot td.num { text-align: right; }

/* Accounting-policies note — numbered sub-paragraphs (1.1, 1.2, …). */
.note-policies { margin-top: 8px; }
.note-policy { margin: 0 0 14px; }
.note-policy:last-child { margin-bottom: 0; }
.note-policy-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 4px;
}
.note-policy-num {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 12px; font-weight: 600; color: var(--muted-2);
  min-width: 30px;
}
.note-policy-title {
  font-family: var(--serif);
  font-weight: 500; font-size: 14px; color: var(--navy);
}
.note-policy-body {
  margin: 0 0 0 40px;
  font-size: var(--fs-body-sm);
  color: var(--charcoal);
  white-space: pre-wrap;
}

/* Inline-editable paragraph — textarea swap (mirrors archive +
   directors-report + auditor-report prototype). */
.r-editable {
  position: relative;
  cursor: text;
  border-radius: 4px;
  padding: 2px 6px;
  margin: 0 -6px;
  transition: background 120ms ease, box-shadow 120ms ease;
}
.r-editable:hover {
  background: rgba(232, 180, 58, 0.06);
  box-shadow: inset 0 -1px 0 rgba(232, 180, 58, 0.5);
}
.r-edit-btn {
  position: absolute;
  top: 3px; right: 4px;
  display: none;
  align-items: center; justify-content: center;
  width: 22px; height: 20px;
  font-size: 11px;
  color: var(--gold);
  background: var(--paper);
  border: 1px solid var(--gold);
  border-radius: 999px;
  cursor: pointer;
  z-index: 2;
  user-select: none;
}
.r-edit-btn:hover { background: var(--gold); color: var(--paper); }
.r-editable:hover .r-edit-btn { display: inline-flex; }
.r-editable.is-editing .r-edit-btn { display: none; }
.r-editable.is-editing {
  background: var(--paper);
  outline: 0;
  box-shadow: 0 0 0 2px var(--gold), 0 0 0 5px rgba(232, 180, 58, 0.18);
}
.r-editable textarea {
  width: 100%;
  border: 0; background: transparent;
  padding: 0;
  font: inherit;
  color: var(--charcoal);
  resize: none;
}
.r-editable textarea:focus { outline: none; }

.r-save-error {
  margin: 6px 0 0;
  font-size: var(--fs-meta);
  color: var(--danger);
}

/* Floating ✦ / ✓ / ✕ strip beneath an active editable paragraph. */
.rewrite-pop {
  position: fixed;
  display: flex; align-items: stretch; gap: 0;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.16);
  z-index: 100;
}
.rewrite-pop[hidden] { display: none; }
.rewrite-pop button {
  padding: 6px 10px;
  font: inherit;
  font-size: var(--fs-meta);
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.04em;
  background: none;
  border: 0;
  cursor: pointer;
}
.rewrite-pop button:first-child { border-radius: 999px 0 0 999px; }
.rewrite-pop button:last-child  { border-radius: 0 999px 999px 0; }
.rewrite-pop button:hover:not(:disabled) {
  background: rgba(232, 180, 58, 0.12);
}
.rewrite-pop button:disabled { cursor: default; opacity: 0.55; }
.rewrite-pop .sparkle { color: var(--gold); font-size: 12px; }
.rewrite-pop .pop-divider { width: 1px; background: var(--hairline); }
.rewrite-pop button.pop-ai {
  width: 36px; padding: 6px 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.rewrite-pop button.pop-confirm {
  width: 36px; padding: 6px 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--success); font-size: 14px;
}
.rewrite-pop button.pop-confirm:hover {
  background: rgba(46, 139, 87, 0.10);
}
.rewrite-pop button.pop-discard {
  width: 36px; padding: 6px 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--danger); font-size: 13px;
}
.rewrite-pop button.pop-discard:hover {
  background: rgba(184, 34, 53, 0.08);
}

/* Clickable note-number chip rendered in the middle "Note" column of
   each BS/IS TopLevel row. */
.stmt-note-ref {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 11px; font-weight: 600;
  color: var(--navy); cursor: pointer;
  width: 22px; height: 22px;
  border: 0; background: none;
  border-radius: 4px;
  transition: background 120ms ease;
}
.stmt-note-ref:hover { background: rgba(232, 180, 58, 0.12); }

/* ── PPE roll-forward schedule ─────────────────────────────────────── */
.note-breakdown.ppe-schedule { font-size: 12px; }
.note-breakdown.ppe-schedule .period-head {
  background: var(--bg-soft);
  text-align: center;
  border-bottom: 1px solid var(--hairline);
}
.note-breakdown.ppe-schedule .derived-head {
  background: rgba(232, 180, 58, 0.06);
}
.note-breakdown.ppe-schedule td.editable-cell { padding: 0; }
.note-breakdown.ppe-schedule td.editable-cell input {
  border: 0; background: transparent;
  width: 100%; padding: 6px 8px;
  font: inherit; font-size: 12px;
  font-variant-numeric: tabular-nums; text-align: right;
  color: var(--charcoal);
}
.note-breakdown.ppe-schedule td.editable-cell input:hover {
  background: rgba(232, 180, 58, 0.06);
}
.note-breakdown.ppe-schedule td.editable-cell input:focus {
  outline: none; background: rgba(232, 180, 58, 0.18);
}
.note-breakdown.ppe-schedule td.derived {
  background: rgba(232, 180, 58, 0.04);
  font-weight: 600; color: var(--navy);
}
.note-breakdown.ppe-schedule input.ppe-asset-class,
.note-breakdown.share-capital-schedule input.share-cap-class {
  border: 0; background: transparent;
  width: 100%; padding: 6px 8px;
  font: inherit; font-size: 12px;
  color: var(--charcoal);
}
.note-breakdown.ppe-schedule input.ppe-asset-class:focus,
.note-breakdown.share-capital-schedule input.share-cap-class:focus {
  outline: none; background: rgba(232, 180, 58, 0.18);
}

/* Share-capital schedule reuses the PPE editable-cell + derived styling
   via the shared .note-breakdown selectors above. */
.note-breakdown.share-capital-schedule { font-size: 12px; }
.note-breakdown.share-capital-schedule .period-head {
  background: var(--bg-soft);
  text-align: center;
  border-bottom: 1px solid var(--hairline);
}
.note-breakdown.share-capital-schedule .derived-head {
  background: rgba(232, 180, 58, 0.06);
}
.note-breakdown.share-capital-schedule td.editable-cell { padding: 0; }
.note-breakdown.share-capital-schedule td.editable-cell input {
  border: 0; background: transparent;
  width: 100%; padding: 6px 8px;
  font: inherit; font-size: 12px;
  font-variant-numeric: tabular-nums; text-align: right;
  color: var(--charcoal);
}
.note-breakdown.share-capital-schedule td.editable-cell input:hover {
  background: rgba(232, 180, 58, 0.06);
}
.note-breakdown.share-capital-schedule td.editable-cell input:focus {
  outline: none; background: rgba(232, 180, 58, 0.18);
}
.note-breakdown.share-capital-schedule td.derived {
  background: rgba(232, 180, 58, 0.04);
  font-weight: 600; color: var(--navy);
}

/* ═══════════════════════════════════════════════════════════════════════
   Engagement (audit/compilation) + Directors report tabs — A4 preview
   sections, drawer rail + slide-in panels, segmented controls, basis card,
   add-ons, section roster, directors register, employees grid, Co-Pilot.
   Ported 1:1 from the report styles in
   prototypes/financial-statements-wizard-tb-mvp/statement-review-ideation.html
   (~L351-615, 785-903) + styles.css (~L649-734). Reuses the global tokens
   (input.css :root) — the semantic status tokens below fill the gaps that
   :root doesn't expose (and also colour the shared rewrite-pop confirm/discard).
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --success:    #2e8b57;
  --success-bg: rgba(46, 139, 87, 0.10);
  --warning:    #c8862a;
  --warning-bg: rgba(232, 180, 58, 0.12);
  --danger:     #b82235;
  --danger-bg:  rgba(184, 34, 53, 0.06);
}

/* ── A4 report sections (shared by both report previews) ───────────────── */
.rep-a4 .r-section { margin: 0 0 22px; }
.rep-a4 .r-section h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  color: var(--navy);
  margin: 0 0 8px;
  display: flex; align-items: baseline; gap: 8px;
}
.rep-a4 .r-section h3 .r-section-num {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: var(--fs-mono);
}
.rep-a4 .r-section p { margin: 0 0 10px; font-size: var(--fs-body-sm); }
.rep-a4 .r-bullets { margin: 0 0 10px; padding-left: 0; list-style: none; }
.rep-a4 .r-bullets li {
  position: relative; padding-left: 18px; margin: 2px 0; font-size: var(--fs-body-sm);
}
.rep-a4 .r-bullets li::before {
  content: "·"; position: absolute; left: 6px; top: -2px;
  color: var(--gold); font-size: 20px; line-height: 1;
}

/* Per-paragraph provenance pill + reset link (below an editable body). */
.r-para-wrap { position: relative; }
.r-para-meta {
  display: flex; align-items: center; gap: 10px;
  margin: 2px 0 8px;
}
.r-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em;
}
.r-pill.is-edited { background: var(--gold-bg); color: var(--navy); }
.r-pill.is-ai     { background: var(--success-bg); color: var(--success); }
.r-reset-link {
  border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--fs-meta);
  color: var(--muted); text-decoration: underline;
}
.r-reset-link:hover { color: var(--navy); }
.r-ai-note {
  margin: 4px 0 0;
  font-size: var(--fs-meta);
  color: var(--warning);
}

/* Approval / signature block. */
.r-approval { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--hairline); }
.r-approval-preamble { margin: 0 0 26px; font-size: 13px; }
.r-sig-row { display: grid; gap: 32px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.r-sig-block { display: flex; flex-direction: column; gap: 4px; }
.r-sig-line { display: block; border-top: 1px solid var(--charcoal); width: 100%; max-width: 280px; margin-bottom: 4px; }
.r-sig-name { font-weight: 700; color: var(--charcoal); font-size: 14px; }
.r-sig-role { color: var(--charcoal); font-size: 13px; }
.r-sig-meta { color: var(--muted); font-size: 12px; }
.r-sig-footer { margin-top: 18px; font-size: 13px; color: var(--muted); }

/* Spinner inside the ✦ chip / suggest chip / co-pilot drafting bubble. */
.pop-ai-spin {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid var(--hairline);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: rev-spin 720ms linear infinite;
  vertical-align: middle;
}

/* ── Right rail + slide-in drawer (both report tabs) ───────────────────── */
.right-rail {
  position: fixed;
  top: 101px; right: 4px;
  width: 30px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-2);
  box-shadow:
    0 1px 2px rgba(26, 58, 107, 0.04),
    0 12px 32px -16px rgba(26, 58, 107, 0.18);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 10;
}
.right-rail-tab {
  flex: 0 0 auto;
  padding: 18px 0;
  display: inline-flex; flex-direction: row; align-items: center; gap: 8px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font: inherit;
  font-size: var(--fs-meta);
  letter-spacing: 0.06em;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  background: transparent;
  user-select: none;
  transition: background 120ms ease, color 120ms ease;
}
.right-rail-tab:not(:last-child) { border-bottom: 1px solid var(--muted-2); }
.right-rail-tab:hover { background: var(--bg-soft); color: var(--navy); }
.right-rail-tab.is-active {
  background: var(--bg-soft);
  color: var(--navy);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--gold);
}
.right-rail-tab .rail-glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; color: var(--navy);
  writing-mode: horizontal-tb; transform: rotate(180deg);
}

.right-drawer {
  position: fixed;
  top: 101px; right: 42px;
  width: min(420px, 80vw);
  max-height: min(560px, calc(100vh - 140px));
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-2);
  box-shadow: -10px 0 28px rgba(15, 23, 42, 0.10);
  display: flex; flex-direction: column;
  z-index: 9;
  transform: translateX(0);
  transition: transform 220ms ease;
}
.right-drawer[hidden] { display: none; }
.right-drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
}
.right-drawer-head h3 {
  margin: 0;
  font-family: var(--serif); font-weight: 500; font-size: 18px; color: var(--navy);
}
.right-drawer-close {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 4px 10px;
  font: inherit; font-size: var(--fs-meta);
  color: var(--muted);
  background: var(--paper);
  cursor: pointer;
}
.right-drawer-close:hover { color: var(--navy); border-color: var(--gold); }
.right-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 12px;
}

/* ── Drawer shared building blocks ─────────────────────────────────────── */
.drawer-intro { font-size: var(--fs-body-sm); color: var(--muted); line-height: 1.5; margin: 0 0 4px; }
.drawer-foot  { font-size: var(--fs-meta); color: var(--muted); display: flex; align-items: flex-start; gap: 4px; padding: 8px 0 0; }
.drawer-foot .glyph, .drawer-foot .data-glyph { color: var(--gold); }

.drw-section {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
}
.drw-section:last-of-type { border-bottom: 0; padding-bottom: 0; }
.drw-section input[type="text"],
.drw-section input[type="number"],
.drw-section select {
  border: 1px solid var(--hairline);
  border-radius: 8px; padding: 8px 12px;
  background: var(--paper); color: var(--charcoal);
  width: 100%; font: inherit;
}
.drw-section input:focus, .drw-section select:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg);
}
.drw-field-label {
  font-size: var(--fs-meta); text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted); font-weight: 600;
}
.drw-field-hint { font-size: var(--fs-meta); color: var(--muted-2); }

/* Segmented control. */
.segmented {
  display: inline-flex; background: var(--bg-soft);
  border: 1px solid var(--hairline); border-radius: var(--r-1);
  padding: 3px; gap: 2px; flex-wrap: wrap; width: fit-content;
}
.segmented button {
  padding: 6px 12px; border-radius: 6px;
  font-size: var(--fs-body-sm); font-weight: 500;
  color: var(--charcoal); background: none; border: 0; cursor: pointer; font: inherit;
}
.segmented button:hover:not(.is-active):not(:disabled) { background: var(--paper); }
.segmented button.is-active { background: var(--navy); color: var(--paper); }
.segmented button:disabled { opacity: 0.45; cursor: not-allowed; }
.segmented.is-readonly button { cursor: default; }

/* Section roster (Directors Sections drawer). */
.section-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 4px; }
.section-row {
  display: grid; grid-template-columns: 32px 1fr auto;
  gap: 8px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--hairline);
  border-radius: var(--r-1); background: var(--paper); font-size: var(--fs-body-sm);
}
.section-row.is-required { background: var(--bg-soft); }
.section-row .toggle {
  position: relative; width: 30px; height: 16px;
  border-radius: 999px; background: var(--hairline);
  flex-shrink: 0; transition: background 120ms; cursor: pointer;
}
.section-row .toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); transition: transform 120ms;
}
.section-row.is-on .toggle { background: var(--navy); }
.section-row.is-on .toggle::after { transform: translateX(14px); }
.section-row.is-required .toggle { background: var(--success); cursor: not-allowed; }
.section-row.is-required .toggle::after { transform: translateX(14px); }
.section-row .label { display: flex; align-items: center; gap: 6px; color: var(--charcoal); min-width: 0; }
.section-row .label .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-row .label .num { display: inline-block; min-width: 18px; color: var(--muted-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.section-row .badge { font-size: 9px; font-weight: 700; letter-spacing: 0.10em; text-transform: uppercase; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--hairline); padding: 2px 6px; border-radius: 999px; }
.section-row .badge.req { color: var(--success); background: var(--success-bg); border-color: var(--success); }

/* Employees inline editor (under the Employees row). */
.section-inline-editor {
  border: 1px solid var(--navy); border-top: 0;
  border-radius: 0 0 var(--r-1) var(--r-1);
  background: var(--paper); padding: 12px 14px; margin-top: -6px;
  display: flex; flex-direction: column; gap: 10px;
}
.inline-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-row.two-col { align-items: flex-start; }
.inline-label { flex: 1; font-size: var(--fs-body-sm); color: var(--charcoal); font-weight: 500; }
.inline-toggle { position: relative; width: 30px; height: 16px; border-radius: 999px; background: var(--hairline); flex-shrink: 0; transition: background 120ms; cursor: pointer; }
.inline-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); transition: transform 120ms; }
.inline-toggle.is-on { background: var(--navy); }
.inline-toggle.is-on::after { transform: translateX(14px); }
.inline-hint { margin: 0; font-size: var(--fs-meta); color: var(--muted); line-height: 1.5; }
.inline-field { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.inline-field .drw-field-label { font-size: 10px; }
.inline-field input[type="number"] { border: 1px solid var(--hairline); border-radius: 6px; padding: 6px 8px; font: inherit; font-size: var(--fs-body-sm); font-variant-numeric: tabular-nums; text-align: right; width: 100%; }
.inline-field input[type="number"]:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }

/* Monthly headcount grid. */
.monthly-grid {
  display: grid; grid-template-columns: 1fr 70px 70px;
  gap: 2px 6px; font-size: var(--fs-body-sm); margin-top: 4px;
}
.monthly-grid .monthly-head { font-size: var(--fs-meta); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; padding: 4px 6px; }
.monthly-grid .monthly-head.num { text-align: right; }
.monthly-grid .monthly-month { color: var(--charcoal); padding: 0 6px; display: flex; align-items: center; }
.monthly-grid .monthly-cell { border: 1px solid var(--hairline); border-radius: 4px; padding: 4px 6px; font-variant-numeric: tabular-nums; text-align: right; background: var(--paper); color: var(--charcoal); font: inherit; font-size: var(--fs-body-sm); }
.monthly-grid .monthly-cell:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.monthly-grid .monthly-total-label { color: var(--navy); font-weight: 600; padding: 6px 6px 4px; border-top: 1px solid var(--hairline); }
.monthly-grid .monthly-total { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); padding: 6px 6px 4px; border-top: 1px solid var(--hairline); }

/* Directors register (Directors drawer). */
.director-list { display: flex; flex-direction: column; gap: 8px; margin: 4px 0; }
.director-card {
  border: 1px solid var(--hairline); border-radius: var(--r-1);
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; background: var(--paper);
}
.director-card.is-resigned { opacity: 0.6; }
.director-card .dcard-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }

/* Add-ons list (Auditor Add-ons drawer). */
.addon-list { display: flex; flex-direction: column; gap: 6px; }
.addon-item { border: 1px solid var(--hairline); border-radius: var(--r-1); background: var(--paper); overflow: hidden; }
.addon-item.is-on { border-color: var(--navy); }
.addon-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  cursor: pointer; width: 100%; background: none; border: 0; font: inherit; text-align: left;
}
.addon-toggle {
  position: relative; flex-shrink: 0; width: 30px; height: 16px;
  border-radius: 999px; background: var(--hairline); transition: background 120ms;
}
.addon-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); transition: transform 120ms; }
.addon-item.is-on .addon-toggle { background: var(--navy); }
.addon-item.is-on .addon-toggle::after { transform: translateX(14px); }
.addon-head-label { font-size: var(--fs-body-sm); font-weight: 500; color: var(--charcoal); }
.addon-item.is-on .addon-head-label { color: var(--navy); }
.addon-body { max-height: 0; overflow: hidden; transition: max-height 200ms ease; }
.addon-item.is-on .addon-body { max-height: 160px; }
.addon-body textarea { display: block; width: 100%; padding: 8px 12px; border: 0; border-top: 1px solid var(--hairline); font: inherit; font-size: var(--fs-body-sm); resize: none; background: var(--bg-soft); color: var(--charcoal); }
.addon-body textarea:focus { outline: none; background: var(--paper); }

/* Basis card (modified opinion in the Report drawer). */
.basis-card { border: 1px solid var(--warning); border-radius: var(--r-1); padding: 12px 14px; background: var(--warning-bg); display: flex; flex-direction: column; gap: 8px; }
.basis-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.basis-card-title { font-size: var(--fs-body-sm); font-weight: 600; color: var(--charcoal); }
.basis-hint { margin: 0; font-size: var(--fs-meta); color: var(--muted); line-height: 1.5; }
.suggest-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--gold); border-radius: 999px; font-size: var(--fs-meta); font-weight: 600; color: var(--gold); background: var(--paper); cursor: pointer; font: inherit; }
.suggest-chip:hover:not(:disabled) { background: var(--gold-bg); }
.suggest-chip:disabled { opacity: 0.6; cursor: default; }
.suggest-chip .sparkle { font-size: 11px; }
.suggest-area { border: 1px solid var(--hairline); border-radius: 6px; padding: 8px 10px; font: inherit; font-size: var(--fs-body-sm); resize: vertical; width: 100%; min-height: 80px; background: var(--paper); color: var(--charcoal); }
.suggest-area:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }

/* Co-Pilot thread + chips. */
.copilot-thread { display: flex; flex-direction: column; gap: 10px; }
.copilot-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: var(--fs-body-sm);
  line-height: 1.45;
}
.copilot-bubble.role-assistant {
  align-self: flex-start;
  background: var(--bg-soft);
  color: var(--charcoal);
  border-bottom-left-radius: 2px;
}
.copilot-bubble.role-user {
  align-self: flex-end;
  background: var(--navy);
  color: var(--paper);
  border-bottom-right-radius: 2px;
}
.copilot-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.copilot-chip {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--paper);
  color: var(--navy);
  font: inherit; font-size: var(--fs-meta);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.copilot-chip:hover:not(:disabled) { background: var(--gold-bg); border-color: var(--gold); }
.copilot-chip:disabled { opacity: 0.6; cursor: default; }

/* The A4 report previews sit clear of the fixed rail/drawer. */
.rev-tabpanel .rep-preview { padding-right: 44px; }

@media (max-width: 1024px) {
  .right-rail   { top: auto; }
  .right-drawer { right: 42px; width: min(360px, 80vw); }
  .rev-tabpanel .rep-preview { padding-right: 0; }
}
