/* Shared interaction polish; the driver grid keeps its established geometry. */
td, input, select { font-variant-numeric: tabular-nums; }
/* 57px = the pinned header (56px bar + border); sticky pieces clear it. */
#sidenav { max-height:calc(100dvh - 57px - 2rem); }
#sidenav .sn-scroll { overflow-y:auto; min-height:0; display:flex; flex-direction:column; gap:.6rem; scrollbar-width:thin; }
#sidenav .sngrp { flex-shrink:0; }
#sidenav .tab { text-decoration:none; }
#sidenav .tab.active, #sidenav .tab.t-rev.active { color:#245817; }
#sidenav .tab.t-input { color:#805d08; }
#sidenav .tab.t-input.active { color:#674b06; }
#sidenav .tab.t-pnl.active { color:#175495; }
#sidenav .tab.t-gen.active { color:#4a3aa7; }
#sidenav .tab.t-3y.active { color:#8a174d; }
#sidenav .tab.t-input.active { color:#674b06; }
.sn-dock { flex-shrink:0; padding:.25rem; }
.sn-dock .switchie-launcher, header .switchie-launcher { width:42px; height:42px; box-shadow:none; }
.switchie-launcher[hidden] { display:none; }
/* Every tab's top toolbar stays frozen under the header (Mathew,
   2026-10-23): the case and market pills ride along on scroll. */
.save-toolbar, .content .card.toolbar { position:sticky; top:calc(57px + .5rem); z-index:40; box-shadow:0 3px 8px #1326300a; }
input.is-dirty, select.is-dirty { border-color:#b8860b; box-shadow:0 0 0 1px #b8860b33; }
.plan-create { margin:.6rem 0; }
.plan-create > summary { display:inline-block; cursor:pointer; color:#376715; font-weight:600; font-size:.82rem; padding:.3rem .55rem; border:1px solid var(--border); border-radius:6px; }
.plan-create[open] > summary { margin-bottom:.6rem; background:var(--accent-soft); }
.plan-create-actions { display:flex; gap:1rem; flex-wrap:wrap; align-items:flex-start; }
.plan-create-actions:has(details[open]) { display:block; }
.plan-create .row > label { flex-wrap:wrap; max-width:100%; }
.plan-create input, .plan-create select { max-width:100%; }
.plan-table { table-layout:fixed; }
table.plan-table th, table.plan-table td { white-space:normal; overflow-wrap:anywhere; }
.plan-table th.col-label, .plan-table th.col-assum { width:auto; min-width:0; }
.plan-table input, .plan-table select { width:100% !important; min-width:0; max-width:100%; font-size:.78rem; padding:.25rem; }
.plan-table .rf-edit { width:100%; }
.plan-table td:last-child { width:6.2rem; white-space:normal !important; }
.plan-table td:last-child button { margin:.15rem .45rem .15rem 0; }
/* Headcount plan (2026-10-19): Role, Heads, Department, Geo, Start,
   Annual, Fully loaded, Recruiter, Source, actions — sums to 100%. */
.hc-plan th:nth-child(1) { width:15%; }
.hc-plan th:nth-child(2) { width:6%; }
.hc-plan th:nth-child(3) { width:12%; }
.hc-plan th:nth-child(4) { width:6%; }
.hc-plan th:nth-child(5) { width:16%; }
.hc-plan th:nth-child(6), .hc-plan th:nth-child(7) { width:10%; }
.hc-plan th:nth-child(8) { width:9%; }
.hc-plan th:nth-child(9) { width:7%; }
.hc-plan th:nth-child(10) { width:9%; }
.plan-table [data-debt-term][hidden] { display:none; }
[data-debt-term][hidden] { display:none; }
.forecast-start { border-left:2px solid #8dbb68; }
.total-row td { border-top-color:#a8b5a1; }

.numeric { text-align:right; white-space:nowrap; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
button:focus-visible, a:focus-visible, summary:focus-visible, th.sortable:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
button:disabled { cursor:default; opacity:.55; }
.general-save { display:grid; grid-template-columns:minmax(0,1fr) auto; }
.general-save > .general-actions { grid-column:1; grid-row:2; gap:.35rem; min-width:0; }
.general-save > #savemodelbtn { grid-column:2; grid-row:1 / 3; }
.version-table { table-layout:fixed; width:100%; }
.version-table th:nth-child(1) { width:3.2rem; }
.version-table th:nth-child(2) { width:32%; }
.version-table th:nth-child(3) { width:10rem; }
.version-table td { overflow-wrap:anywhere; vertical-align:top; }
.version-by { font-size:.73rem; color:var(--muted); margin-top:.25rem; }
.version-primary { display:flex; gap:.3rem .8rem; flex-wrap:wrap; align-items:center; }
.version-primary a { white-space:nowrap; }
.row-menu { margin-top:.35rem; font-size:.78rem; }
.row-menu > summary { cursor:pointer; color:var(--muted); }
.row-menu form { margin:.25rem .7rem 0 0; }
.mapping-filters { margin:.5rem 0 1rem; }
table.mapping-table td:first-child { white-space:normal; overflow-wrap:anywhere; }
.mapping-table .stage-sub { padding-left:.6rem; }
.mapping-table td:first-child .hide-row { float:right; }
.blk-t { background:none; border:0; padding:0 .1rem; font:inherit; }
.mtd-controls { display:flex; gap:.5rem .8rem; align-items:center; flex-wrap:wrap; margin-top:.65rem; font-size:.78rem; }
.mtd-baseline { display:flex; gap:.4rem; align-items:center; margin-left:auto; min-width:0; max-width:100%; }
.mtd-baseline select { width:17rem; max-width:100%; min-width:0; font-size:.78rem; text-overflow:ellipsis; }
.mtd-baseline label { white-space:nowrap; }
.mtd-projected { font-weight:600; }
.variance-flat { color:var(--muted); font-weight:400; }
.mtd-section { scroll-margin-top:calc(57px + 1rem); }
.mtd-grid td:first-child { white-space:normal; }
.mtd-grid th.col-label { min-width:0; }
.admin-tabs { display:flex; gap:.4rem; flex-wrap:wrap; }
.admin-tabs [aria-selected=true] { background:var(--accent-soft); color:#245817; }
.admin-card, .content .admin-card:has(table) { width:100%; min-width:0; max-width:100%; }
.admin-card table { table-layout:fixed; width:100%; }
.admin-card th { white-space:normal; }
.admin-card td { overflow-wrap:anywhere; }
.connection-table th:nth-child(1) { width:35%; }
.connection-table th:nth-child(2) { width:16%; }
.connection-table th:nth-child(3) { width:26%; }
.connection-table .numeric { white-space:normal; }
.source-actions { text-align:right; }
.source-actions form { margin:.2rem .15rem !important; max-width:100%; }
.source-actions .chip { display:inline-block; margin:.2rem 0; }
.source-meta, .user-meta { font-size:.76rem; font-weight:400; color:var(--muted); }
.source-meta summary, .user-meta summary { cursor:pointer; }
.source-meta div, .user-meta div { margin:.3rem 0; overflow-wrap:anywhere; }
.user-meta summary { color:var(--text); font-size:.82rem; }
.user-meta summary { list-style:none; position:relative; padding-left:.9rem; overflow-wrap:anywhere; }
/* Escaped code points: immune to file-encoding mishaps (2026-10-20,
   a raw ▸ written as ANSI rendered "â–¸" in front of every email). */
.user-meta summary::before { content:'\25B8'; position:absolute; left:0; }
.user-meta[open] summary::before { content:'\25BE'; }
.user-filters { margin:.8rem 0; }
.user-table th:first-child { width:26%; }
.user-table th:nth-child(2) { width:10%; }
.user-table th:last-child { width:8%; }
.user-table select { width:100%; min-width:0; font-size:.78rem; padding:.3rem; }
.user-table form.inline { width:100%; }
.user-table td.pill-state { white-space:normal; }
.admin-card > .toolbar { align-items:flex-start; }
.admin-card #refreshdetail { max-width:36rem; overflow-wrap:anywhere; }
#source-link-dialog { width:36rem; max-width:calc(100vw - 2rem); border:1px solid var(--border); border-radius:10px; padding:1.25rem; color:var(--text); }
#source-link-dialog::backdrop { background:#13263050; }
.dialog-field { display:flex; flex-direction:column; gap:.5rem; font-size:.82rem; }
.dialog-actions { margin-top:1rem; justify-content:flex-end; }
#source-link-unlink { margin-right:auto; }
[data-admin-panel][hidden], tr[hidden] { display:none !important; }
.nav-toggle, .nav-backdrop { display:none; }
@media (max-width:1199px) {
  .shell { display:block; }
  .shell:not(.nosn) > .nav-toggle { display:inline-flex; position:sticky; top:calc(57px + .5rem); z-index:85; margin:.5rem 0; background:var(--card); }
  #sidenav { display:none; position:fixed; top:calc(57px + 6rem); bottom:1rem; left:1.25rem; width:15rem; max-height:calc(100dvh - 57px - 7rem); z-index:80; background:var(--bg); padding:.5rem; border:1px solid var(--border); border-radius:10px; }
  #sidenav.nav-open { display:flex; }
  .nav-backdrop:not([hidden]) { display:block; position:fixed; inset:0; z-index:70; background:#13263050; }
  .save-toolbar, .content .card.toolbar { top:calc(57px + 3.5rem); }
  .shell.nosn .save-toolbar, .shell.nosn .content .card.toolbar { top:calc(57px + .5rem); }
  .plan-table td:nth-child(n+3) { overflow-wrap:normal; }
  .plan-table .rf-view[data-format=money], .plan-table td:last-child button { white-space:nowrap; }
  .mtd-section { scroll-margin-top:calc(57px + 3.5rem); }
}

/* Walkthrough refinements: dense, aligned input surfaces and quieter rates. */
.input-surface { width:100%; min-width:0; }
.content .input-surface .card { width:100%; min-width:0; max-width:100%; padding:1rem 1.25rem; margin-bottom:1rem; }
.input-surface .card > h1, .input-surface .card > h2,
.input-surface details.cardfold > summary { margin-bottom:.8rem !important; }
.input-surface table { width:100%; }
.input-surface table th { font-size:.68rem; letter-spacing:.035em; padding:.5rem .65rem; color:var(--muted); border-bottom:1px solid var(--border); }
.input-surface table td { padding:.5rem .65rem; }
.input-surface table.drv-grid tr { height:2.9rem; }
.input-surface .drv-grid .proj { background:#f0f6e4; }
.input-surface .drv-grid .col-label { width:16rem; }
.input-surface table.drv-grid .col-assum { width:19rem; min-width:19rem; }
.input-surface table.drv-grid .col-drv { width:17rem; }
.input-surface input:not([type=checkbox]):not([type=hidden]), .input-surface select { border-radius:5px; min-height:1.9rem; border-color:#d5decf; }
.input-surface .drv-grid select:not(.ra-mode) { max-width:100%; }
.input-surface .mapping-table select { width:100% !important; max-width:18rem; }
.input-surface .mapping-table td { vertical-align:middle; }
.input-surface .mapping-table td:first-child { font-weight:500; padding-left:.65rem; }
.input-surface .mapping-filters { padding:.2rem 0 .5rem; gap:1rem; }
.input-surface .mapping-filters input[type=search] { width:19rem; max-width:100%; }
.input-surface .mapping-pending td:first-child { box-shadow:inset 3px 0 #b8860b; }
.input-surface .gtm-map-grid td:nth-child(2), .input-surface .gtm-map-grid td:nth-child(3) { font-variant-numeric:tabular-nums; }
.input-surface .plan-table td { padding:.65rem .45rem; }
.input-surface .plan-table td .rf-view { line-height:1.5; }
.input-surface .plan-create > summary { background:var(--card); margin:.3rem 0 .6rem; }
.input-surface .plan-create .row { display:grid; grid-template-columns:repeat(auto-fit,minmax(10rem,1fr)); gap:.7rem 1rem; align-items:end; }
.input-surface .plan-create .row > label { display:flex; flex-direction:column; align-items:stretch; gap:.35rem; font-size:.75rem; margin:0 !important; }
.input-surface .plan-create .row > label input, .input-surface .plan-create .row > label select { width:100% !important; min-width:0 !important; }
.input-surface .plan-create .row > button { justify-self:end; margin:0; }
.model-range-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(10rem,1fr)); gap:1rem; width:100%; }
.model-range-grid label, .compensation-controls label { display:flex; flex-direction:column; align-items:stretch; gap:.45rem; font-size:.75rem; margin:0 !important; }
.model-range-grid input { width:100%; }
.compensation-controls { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; padding:.75rem 0 1rem; margin-bottom:.5rem; border-bottom:1px solid var(--border); }
.compensation-controls input.att { width:6rem !important; text-align:right; }
.input-surface .general-actions { gap:.6rem; margin-top:.35rem; }
.input-surface .general-actions .btn { padding:.35rem .55rem; }
.rate-row td { color:var(--muted); font-size:.74rem; font-weight:400; padding-top:.15rem !important; padding-bottom:.35rem !important; }
.rate-row td:first-child { font-weight:400; padding-left:1.25rem; }
.rate-row td.proj { background:#f4f8ed; }
.revenue-walk table.mo-grid { table-layout:fixed; }
.revenue-walk table.mo-grid th:first-child { min-width:16rem; width:16rem; }
.revenue-walk table.mo-grid th:not(:first-child) { min-width:6rem; width:6rem; }

.input-surface .hc-plan th:nth-child(2), .input-surface .hc-plan th:nth-child(8), .input-surface .hc-plan th:nth-child(9) { white-space:nowrap; font-size:.62rem; letter-spacing:0; padding-left:.3rem; padding-right:.3rem; }
.hc-plan th:nth-child(4) { width:7%; }
.hc-plan th:nth-child(9) { width:6%; }
.input-surface .seasonality-grid { table-layout:fixed; width:100%; }
.input-surface .seasonality-grid th:first-child { width:5rem; min-width:0; }
.input-surface .seasonality-grid th:not(:first-child) { width:auto; min-width:0; }
.input-surface .seasonality-grid td, .input-surface .seasonality-grid th { padding:.45rem .2rem; }
.input-surface .seasonality-grid input.att { width:100%; min-width:0; }
.input-surface .overlay-new { display:grid; grid-template-columns:repeat(auto-fit,minmax(9rem,1fr)); gap:.7rem 1rem; padding:.8rem; }
.input-surface .overlay-new input, .input-surface .overlay-new select { width:100% !important; min-width:0 !important; max-width:100%; }
.input-surface .overlay-new button { justify-self:end; }
.input-surface .overlay-box .freeze table { table-layout:fixed; width:100%; }
.input-surface .overlay-box .freeze table th:first-child { width:4rem; min-width:0; }
.input-surface .overlay-box .freeze table th:not(:first-child) { width:auto; min-width:0; }
.input-surface .overlay-box .freeze table td, .input-surface .overlay-box .freeze table th { padding:.4rem .15rem; font-size:.67rem; }
.input-surface .overlay-box .freeze input.att { width:100%; min-width:0; font-size:.74rem; padding:.3rem .1rem; }

/* Each segment owns its mode and value; neither spills into the next. */
.revenue-inputs .ra-grid [data-case]:not([hidden]) { display:flex; flex-direction:column; align-items:center; gap:.25rem; }
.revenue-inputs table.ra-grid th:not(:first-child) { white-space:normal; }
.revenue-inputs table.ra-grid td { white-space:normal; vertical-align:middle; }
.revenue-inputs table.ra-grid select.ra-mode { max-width:100%; }
.revenue-inputs table.ra-grid .ra-show { min-width:0; }
/* Creation fields remain readable at desktop and compact widths. */
.input-surface .partner-create-grid { display:grid; grid-template-columns:minmax(14rem,2fr) repeat(3,minmax(7rem,1fr)); gap:1rem; align-items:end; }
.partner-create-grid > label { display:flex; flex-direction:column; align-items:stretch; gap:.4rem; font-size:.75rem; }
.partner-create-grid > label input, .partner-create-grid > label select { width:100% !important; min-width:0 !important; max-width:100%; }
.partner-create-grid > .btn { grid-column:4; justify-self:end; }
.partner-create-grid > .pill-state { align-self:center; }
.mapping-empty { color:var(--muted); font-size:.82rem; margin:.75rem 0 0; }
.mapping-empty[hidden] { display:none; }
.input-surface [data-debt-term][hidden] { display:none !important; }
@media (max-width:700px) {
  .input-surface .partner-create-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .partner-create-grid > .btn { grid-column:2; }
}

/* Reader context: labels and keys, without explanatory paragraphs. */
.view-label { align-self:center; color:var(--muted); font-size:.7rem; margin-right:.3rem; }
.caseview, .casetoggle, .mktoggle { align-items:center; }
.grid-state-key { display:inline-flex; align-items:center; gap:.75rem; margin-right:auto; color:var(--muted); font-size:.7rem; font-weight:400; }
.grid-state-key span::before { content:''; display:inline-block; width:.7rem; height:.7rem; border:1px solid var(--border); margin-right:.3rem; vertical-align:-1px; }
.grid-state-key .key-actual::before { background:var(--card); }
.grid-state-key .key-forecast::before { background:#edf6de; border-color:#a9c482; }
.summary-totals th:first-child, .summary-totals td:first-child { width:23rem; min-width:23rem; max-width:23rem; white-space:normal; }
.summary-totals td:not(:first-child), .summary-totals th:not(:first-child) { min-width:6.5rem; }
.summary-totals .revenue-subtotal td { font-weight:500; }
.cash-balance td { font-weight:700; border-top:2px solid #a8b5a1; }
.cash-balance td:first-child { color:var(--text); }
.mtd-grid th { white-space:normal; }
#sidenav .sngrp .tab { white-space:normal; overflow-wrap:anywhere; line-height:1.35; }
#sidenav .sn-scroll { overflow-x:hidden; }
.grid-state-key .key-mixed::before, .freeze table tr:first-child th.period-mixed { background:repeating-linear-gradient(135deg,#edf6de,#edf6de 5px,#fff 5px,#fff 10px); }
.grid-state-key [hidden] { display:none; }
.ra-read { display:inline-flex; gap:.6rem; align-items:baseline; max-width:100%; white-space:normal; }
.ra-read-value, .comp-value { color:var(--text); font-weight:600; }
.ra-read-basis { font-size:.72rem; }
.ra-grid .ra-read { flex-direction:column; align-items:center; gap:.15rem; }

/* Compact page head (Mathew, 2026-11-19: "shrink sticky headers"): title,
   model context and Save controls share one short row on desktop and
   wrap under each other on narrow screens; every control stays put. */
.ph { margin-right:auto; display:flex; align-items:baseline; flex-wrap:wrap; gap:.05rem .75rem; min-width:0; max-width:100%; }
.ph h1, .card .ph h1, .content .card.toolbar > h1 { margin:0; font-size:1.02rem; line-height:1.3; }
.content .card.toolbar > h1 { margin-right:auto; }
.ph .ph-ctx { margin:0; font-size:.76rem; line-height:1.3; white-space:nowrap; }
.content .card.toolbar, .content .input-surface .card.toolbar { padding:.45rem .9rem; gap:.35rem .65rem; margin-bottom:.75rem; justify-content:flex-end; }
.content .card.toolbar > .btn:not(.small), .content .card.toolbar > form > .btn:not(.small) { padding:.3rem .8rem; font-size:.84rem; }
.content .card.toolbar > .toolbar { gap:.35rem .65rem; }
.save-status:empty { display:none; }
.save-status { font-size:.74rem; color:var(--muted); white-space:nowrap; }
.save-status.is-unsaved { color:var(--warn); font-weight:600; }
@media (max-width:760px) {
  .ph { flex-direction:column; gap:0; }
  .ph .ph-ctx { white-space:normal; }
  .content .card.toolbar, .content .input-surface .card.toolbar { padding:.4rem .65rem; }
}
/* On compact screens the Navigation button rides inside the page head
   instead of stacking a second sticky bar above it. */
@media (max-width:1199px) {
  .content .card.toolbar > .nav-toggle { display:inline-flex; position:static; margin:0; order:-1; }
  .shell.nav-in-head .save-toolbar, .shell.nav-in-head .content .card.toolbar { top:calc(57px + .5rem); }
}

/* Changed inputs only (Mathew, 2026-11-19). */
.change-count { font-size:.74rem; font-weight:600; color:var(--warn); white-space:nowrap; }
.co-toggle { font:inherit; font-size:.74rem; line-height:1.2; padding:.16rem .55rem; border-radius:999px; border:1px solid var(--border); background:var(--card); color:var(--muted); cursor:pointer; white-space:nowrap; }
.co-toggle[aria-pressed=true] { background:var(--warn-soft); border-color:var(--warn-line); color:var(--warn); font-weight:600; }
.change-count[hidden], .co-toggle[hidden], [data-co-hidden] { display:none !important; }

/* Needs review (Mathew, 2026-11-19): one compact status for missing
   rates, unmapped accounts and incomplete sources; it walks the rows. */
.review-chip { display:inline-flex; align-items:center; gap:.3rem; font:inherit; font-size:.74rem; font-weight:600; line-height:1.2; padding:.16rem .55rem; border-radius:999px; border:1px solid var(--warn-line); background:var(--warn-soft); color:var(--warn); cursor:pointer; text-decoration:none; white-space:nowrap; vertical-align:middle; }
.review-chip:hover { border-color:var(--warn); }
.review-chip b { font-weight:700; }
.review-chip .rv-pos { font-weight:400; opacity:.8; }
.review-chip .rv-pos[hidden] { display:none; }
tr.review-hit > td, tr.review-hit > th { background:var(--warn-soft) !important; }
tr.review-hit > :first-child { box-shadow:inset 3px 0 var(--warn); }
.review-hit:not(tr) { outline:2px solid var(--warn); outline-offset:2px; border-radius:4px; }
[data-review-item] { scroll-margin-top:calc(57px + 5rem); }
.comm-metric.comm-metric-chip { justify-content:center; align-items:flex-start; }

/* Find page (Mathew, 2026-11-19). */
.sn-find { flex-shrink:0; }
.sn-find input { width:100%; padding:.32rem .55rem; font-size:.8rem; border-radius:6px; }
#sidenav .sn-miss { display:none !important; }
#sidenav .tab.sn-cur { background:var(--accent-soft); outline:1px solid var(--accent); outline-offset:-1px; }
.sn-none { margin:.2rem .3rem; font-size:.78rem; color:var(--muted); }
.sn-none[hidden] { display:none; }

/* Export chooser (Mathew, 2026-11-19): one Export button per page. */
.xp { position:relative; display:inline-block; }
.xp > summary { list-style:none; }
.xp > summary::-webkit-details-marker { display:none; }
.xp > summary::after { content:" \25BE"; font-size:.7em; }
.xp-pop { position:absolute; right:0; top:calc(100% + .35rem); z-index:95; width:max-content; min-width:15rem; max-width:min(22rem, calc(100vw - 2rem)); background:var(--card); border:1px solid var(--border); border-radius:8px; box-shadow:0 6px 20px rgba(0,0,0,.12); padding:.6rem .7rem; display:flex; flex-direction:column; gap:.45rem; font-size:.8rem; font-weight:400; text-align:left; color:var(--text); white-space:normal; }
.xp-pop.xp-left { right:auto; left:0; }
.xp-ctx { display:grid; grid-template-columns:auto minmax(0,1fr); gap:.15rem .7rem; margin:0; }
.xp-ctx dt, .xp-pop legend { color:var(--muted); font-size:.66rem; font-weight:600; text-transform:uppercase; letter-spacing:.05em; align-self:center; }
.xp-ctx dd { margin:0; font-weight:600; overflow-wrap:anywhere; }
.xp-ctx select { padding:.15rem .4rem; font-size:.78rem; }
.xp-ctx [hidden] { display:none; }
.xp-pop fieldset { border:0; border-top:1px solid var(--border); margin:0; padding:.4rem 0 0; display:flex; flex-direction:column; gap:.15rem; min-width:0; }
.xp-pop fieldset[hidden] { display:none; }
.xp-pop legend { padding:0; margin-bottom:.15rem; }
.xp .xp-pop fieldset label { display:flex; flex-direction:row; gap:.4rem; align-items:center; cursor:pointer; white-space:nowrap; font-size:.8rem; color:var(--text); }
.xp .xp-pop input[type=radio] { margin:0; min-height:0 !important; }
.xp-pop .xp-go { align-self:flex-end; }
