/* DevCalc v13 — Modern Architectural Financial Workspace (v4 / 2026)
 * Crisp Alabaster & Deep Forest Emerald · Obsidian Slate Dark Mode
 * Zero-CDN · IBM Plex Serif + Manrope + IBM Plex Sans · WCAG AA · Desktop / Split / Mobile
 */

:root {
  color-scheme: light;
  --font-serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --font-display: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Sans", ui-monospace, "SF Mono", Menlo, monospace;

  /* Light Theme — Modern Architectural Alabaster × Deep Forest Emerald */
  --bg: #f6f7f6;
  --sidebar-bg: #f1f3f1;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-alt: #f4f6f5;
  --surface-hover: #eaeef0;
  --border: rgba(15, 23, 42, 0.09);
  --border-subtle: rgba(15, 23, 42, 0.06);
  --border-strong: rgba(15, 23, 42, 0.18);
  --input-border: rgba(15, 23, 42, 0.16);

  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;

  --accent: #0f4c3a;
  --accent-hover: #0a3629;
  --accent-ink: #ffffff;
  --accent-soft: #e6f2ee;
  --accent-ring: rgba(15, 76, 58, 0.18);

  --ok: #0d6e54;
  --ok-bg: #e8f6f1;
  --ok-border: rgba(13, 110, 84, 0.24);

  --warn: #9a5b13;
  --warn-bg: #fef6e7;
  --warn-border: rgba(154, 91, 19, 0.26);

  --bad: #b42318;
  --bad-bg: #fef0ee;
  --bad-border: rgba(180, 35, 24, 0.24);

  --chart-escrow: #0f4c3a;
  --chart-debt: #b43c24;
  --chart-llcr: #0d6e54;
  --chart-cash: #9a6513;
  --chart-grid: rgba(15, 23, 42, 0.09);

  --wf-land: #b42318;
  --wf-smr: #c84b31;
  --wf-soc: #9a6513;
  --wf-bank: #7c5828;
  --wf-tax: #64748b;

  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23475569' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.25L6 7.75L9.5 4.25'/%3E%3C/svg%3E");

  /* Refined Modern Geometry & Soft Layered Elevation */
  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-btn: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-btn-primary: 0 1px 2px rgba(15, 76, 58, 0.28), 0 4px 12px -2px rgba(15, 76, 58, 0.2);
  --shadow-sheet: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -6px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 16px 40px -8px rgba(15, 23, 42, 0.16);

  --sidebar-w: 224px;
  --ease-smooth: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 220ms;
}

[data-theme="dark"] {
  color-scheme: dark;
  /* Dark Theme — Obsidian Slate × Mint Emerald */
  --bg: #0f1211;
  --sidebar-bg: #141817;
  --surface: #181d1b;
  --surface-elevated: #1e2422;
  --surface-alt: #212725;
  --surface-hover: #28302d;
  --border: rgba(255, 255, 255, 0.09);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.18);
  --input-border: rgba(255, 255, 255, 0.16);

  --text: #f3f5f4;
  --text-secondary: #cbd2cf;
  --muted: #8f9b96;

  --accent: #5dd4b6;
  --accent-hover: #7de0c7;
  --accent-ink: #0c1714;
  --accent-soft: rgba(93, 212, 182, 0.14);
  --accent-ring: rgba(93, 212, 182, 0.24);

  --ok: #5cd1b8;
  --ok-bg: rgba(92, 209, 184, 0.12);
  --ok-border: rgba(92, 209, 184, 0.28);

  --warn: #f0be63;
  --warn-bg: rgba(240, 190, 99, 0.12);
  --warn-border: rgba(240, 190, 99, 0.28);

  --bad: #f2846f;
  --bad-bg: rgba(242, 132, 111, 0.12);
  --bad-border: rgba(242, 132, 111, 0.28);

  --chart-escrow: #5dd4b6;
  --chart-debt: #f2846f;
  --chart-llcr: #5cd1b8;
  --chart-cash: #f0be63;
  --chart-grid: rgba(255, 255, 255, 0.08);

  --wf-land: #f2846f;
  --wf-smr: #e56b52;
  --wf-soc: #f0be63;
  --wf-bank: #cfa048;
  --wf-tax: #8f9b96;

  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23cbd2cf' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.25L6 7.75L9.5 4.25'/%3E%3C/svg%3E");

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-btn-primary: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-sheet: 0 1px 3px rgba(0, 0, 0, 0.35), 0 8px 24px -6px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.58);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1211;
    --sidebar-bg: #141817;
    --surface: #181d1b;
    --surface-elevated: #1e2422;
    --surface-alt: #212725;
    --surface-hover: #28302d;
    --border: rgba(255, 255, 255, 0.09);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.18);
    --input-border: rgba(255, 255, 255, 0.16);

    --text: #f3f5f4;
    --text-secondary: #cbd2cf;
    --muted: #8f9b96;

    --accent: #5dd4b6;
    --accent-hover: #7de0c7;
    --accent-ink: #0c1714;
    --accent-soft: rgba(93, 212, 182, 0.14);
    --accent-ring: rgba(93, 212, 182, 0.24);

    --ok: #5cd1b8;
    --ok-bg: rgba(92, 209, 184, 0.12);
    --ok-border: #25574c;

    --warn: #ebb95b;
    --warn-bg: #2a2112;
    --warn-border: #634a1c;

    --bad: #f0826b;
    --bad-bg: #2f1814;
    --bad-border: #6e352a;

    --chart-escrow: #6cc9b3;
    --chart-debt: #f0826b;
    --chart-llcr: #5cd1b8;
    --chart-cash: #ebb95b;
    --chart-grid: #2a312e;

    --wf-land: #f0826b;
    --wf-smr: #e56b52;
    --wf-soc: #ebb95b;
    --wf-bank: #cfa048;
    --wf-tax: #9c978d;

    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23cdc7bc' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.25L6 7.75L9.5 4.25'/%3E%3C/svg%3E");

    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.55);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2 {
  font-family: var(--font-serif);
  margin: 0;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.24;
  font-weight: 500;
}

h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.28;
  font-weight: 600;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-alt);
  padding: 1px 5px;
  border: 1px solid var(--border-subtle);
}

.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;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  z-index: 1000;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { left: 12px; }

.num,
.num-nowrap {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.num { text-align: right; }

.eyebrow {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-text {
  font-size: 12px;
  color: var(--muted);
}

.hint-line {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

/* =========================================================================
 * APP SHELL — Architectural Left Rail + Main Drafting Canvas
 * ========================================================================= */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 16px;
  gap: 8px;
  z-index: 40;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar-brand {
  padding: 2px 4px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 7px;
  line-height: 1.1;
}

.ver-tag {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  letter-spacing: 0.04em;
}

.brand-sub {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding: 8px 6px 2px;
}

.tabs-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tab-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast) var(--ease-smooth);
}

.tab-btn[hidden] {
  display: none;
}

.tab-num {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.tab-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.tab-btn.is-active {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

.tab-btn.is-active .tab-num {
  color: var(--accent);
}

.tab-btn.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 2px;
}

.sidebar-workspace {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-action-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth);
}
.nav-action-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-subtle);
  color: var(--text);
}

.nav-action-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* =========================================================================
 * MAIN COLUMN & DISCIPLINED TOP TOOLBAR
 * ========================================================================= */
.app-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  view-transition-name: deal-header;
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 11px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
}

.topbar-deal {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}

.deal-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 310px;
  max-width: 340px;
  min-width: 210px;
}

#preset-select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 36px;
  min-height: 36px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.role-picker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.role-picker-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

#role-mode-select {
  width: auto;
  min-width: 118px;
  height: 36px;
  min-height: 36px;
  font-size: 12.5px;
  font-weight: 600;
  background-color: var(--surface-alt);
  border-color: var(--border);
  color: var(--text);
}

.topbar-switches {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 11px;
  min-height: 28px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth), box-shadow var(--dur-fast) var(--ease-smooth);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active {
  background: var(--surface-elevated);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1), 0 0 0 1px rgba(15, 23, 42, 0.04);
}
[data-theme="dark"] .seg-btn.is-active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.actions-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.actions-bar .btn-secondary {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}
.actions-bar .btn-secondary:hover {
  background: var(--surface-hover);
  border-color: transparent;
  color: var(--text);
}
.actions-bar .btn-secondary.btn-needs-save {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: var(--warn);
}

.topbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

.status-strip {
  border-top: 1px solid var(--border-subtle);
  background: transparent;
}

.status-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 5px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11.5px;
}

.status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill,
.dirty-pill,
.scenario-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.status-pill { background: var(--ok-bg); color: var(--ok); border: 1px solid transparent; }
.status-pill.is-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.status-pill.is-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.dirty-pill { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.scenario-chip { background: var(--surface-alt); color: var(--text-secondary); border: 1px solid var(--border-subtle); }

/* =========================================================================
 * UNIFIED MODERN BUTTON & FORM CONTROL SYSTEM
 * ========================================================================= */
.btn {
  appearance: none;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.15;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: var(--shadow-btn);
  transition: background var(--dur-fast) var(--ease-smooth),
    border-color var(--dur-fast) var(--ease-smooth),
    color var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-fast) var(--ease-smooth),
    transform var(--dur-fast) var(--ease-smooth);
}
.btn:active { transform: translateY(0.5px); }
.btn-sm { min-height: 34px; padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn-ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: var(--shadow-btn-primary);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: transparent;
  transform: translateY(-0.5px);
}

.btn-secondary {
  background: var(--surface-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn-director {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  box-shadow: none;
  font-weight: 600;
}
.btn-director:hover {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-director[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-btn-primary);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-danger {
  background: var(--bad);
  border-color: transparent;
  color: #ffffff;
}
[data-theme="dark"] .btn-danger { color: #0f1211; }

.btn-needs-save {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
}
.btn-needs-save:hover {
  border-color: var(--warn);
  filter: brightness(0.97);
}

.pill-btn {
  appearance: none;
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  min-height: 30px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast) var(--ease-smooth);
}
.pill-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

input[type="text"],
input[type="number"],
input[type="search"],
select {
  font-family: var(--font-sans);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background-color: var(--surface-elevated);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  min-height: 34px;
  line-height: 1.3;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease-smooth), background-color var(--dur-fast) var(--ease-smooth);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
  padding: 0 32px 0 11px;
  height: 34px;
  line-height: 32px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

@supports (appearance: base-select) {
  select,
  select::picker(select) {
    appearance: base-select;
  }
  select {
    background-image: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 0 11px;
    line-height: 1.25;
  }
  select::picker-icon {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin-inline-start: auto;
    background: var(--select-arrow) no-repeat center / 12px 12px;
    transition: transform var(--dur-fast) var(--ease-smooth);
  }
  select:open::picker-icon {
    transform: rotate(180deg);
  }
  select::picker(select) {
    background-color: var(--surface-elevated);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 4px;
    box-shadow: var(--shadow-md);
    font-family: var(--font-sans);
    font-size: 13px;
  }
  select option {
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    color: var(--text);
    cursor: pointer;
  }
  select option:hover,
  select option:focus-visible {
    background-color: var(--surface-hover);
  }
  select option:checked {
    background-color: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
  }
  select option::checkmark {
    color: var(--accent);
  }
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input.is-invalid,
select.is-invalid,
input.field-invalid,
select.field-invalid {
  border-color: var(--bad);
  background-color: var(--bad-bg);
}

.field-error-msg,
.error-msg {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--bad);
  font-weight: 600;
}

/* =========================================================================
 * MAIN CONTAINER & ARCHITECTURAL SHEETS (Hairline Registration)
 * ========================================================================= */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 52px;
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.tab-panel[hidden] { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sheet);
  container-type: inline-size;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.card-head h2 {
  font-size: 19px;
}
.card-head h3 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 500;
}

.card-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-muted {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px 10px;
}

/* =========================================================================
 * EXECUTIVE DOSSIER — VERDICT STRIP + MONOLITHIC KPI LEDGER BAND
 * ========================================================================= */
.executive-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
}

.verdict-hero {
  border-left: 4px solid var(--ok);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.verdict-hero.verdict-warn { border-left-color: var(--warn); }
.verdict-hero.verdict-bad { border-left-color: var(--bad); }

.verdict-main {
  flex: 1 1 420px;
  min-width: 0;
}

.verdict-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.verdict-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--ok);
  flex-shrink: 0;
}
.verdict-warn .verdict-dot { background: var(--warn); }
.verdict-bad .verdict-dot { background: var(--bad); }

.verdict-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok);
}
.verdict-warn .verdict-code {
  border-color: var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
}
.verdict-bad .verdict-code {
  border-color: var(--bad-border);
  background: var(--bad-bg);
  color: var(--bad);
}

.verdict-main h2 {
  font-size: 22px;
  font-weight: 500;
  margin: 2px 0 4px;
}

.verdict-reason {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.verdict-target-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
  min-width: 210px;
}

.verdict-target-box strong {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.5vw, 22px);
  font-weight: 700;
  color: var(--text);
}

.verdict-discount-note {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.verdict-discount-note.is-bad { color: var(--bad); }
.verdict-discount-note.is-ok { color: var(--ok); }

.target-margin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.target-margin-pills {
  display: inline-flex;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 2px;
}

.tm-pill {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1.3;
  transition: background var(--dur-fast) var(--ease-smooth), color var(--dur-fast) var(--ease-smooth);
}
.tm-pill:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.tm-pill.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Continuous Monolithic KPI Ledger Band (4 columns separated by 1px hairlines) */
.hero-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--border);
  gap: 1px;
}

.cf-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--border);
  border-top: 1px solid var(--border);
  gap: 1px;
}

.cf-kpi-item {
  background: var(--surface-alt);
  padding: 12px 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cf-kpi-item strong {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}

/* =========================================================================
 * DIRECTOR THESIS CARD — Deal Interest Score (0–100) + Planned Sales Prices
 * ========================================================================= */
.thesis-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 24px;
  align-items: start;
}

.thesis-score-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 20px;
  border-right: 1px solid var(--border-subtle);
  min-width: 0;
}

.score-hero-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-ring-box {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
}
.score-ring-box svg {
  width: 84px;
  height: 84px;
  display: block;
}

.score-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.score-grade-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

.score-thesis-text {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.drivers-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.driver-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.driver-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.driver-head strong {
  color: var(--text);
  font-weight: 600;
}

.driver-bar-svg {
  width: 100%;
  height: 7px;
  display: block;
}

.thesis-bank-strip {
  padding: 9px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.thesis-sales-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.sales-price-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.price-tile {
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.price-tile-accent {
  background: var(--accent-soft);
  border-color: color-mix(in oklab, var(--accent) 28%, transparent);
}

.price-tile-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.price-tile strong {
  font-family: var(--font-display);
  font-size: clamp(15px, 1.35vw, 18px);
  font-weight: 700;
  color: var(--text);
}
.price-tile-accent strong {
  color: var(--accent);
}

.sp-meta-line {
  margin: 0;
  line-height: 1.45;
}

.levers-box {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.levers-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.lever-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  flex-wrap: wrap;
}

.lever-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.lever-copy strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.lever-copy span {
  font-size: 11.5px;
  color: var(--muted);
}

.lever-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.lever-val {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.lever-val.is-ok { color: var(--ok); }
.lever-val.is-warn { color: var(--warn); }
.lever-val.is-bad { color: var(--bad); }

.hero-kpi-card {
  background: var(--surface);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  transition: background var(--dur-fast) var(--ease-smooth);
}
.hero-kpi-card:hover { background: var(--surface-elevated); }

.hero-kpi-val {
  font-family: var(--font-display);
  font-size: clamp(22px, 1.9vw, 28px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text);
}

.hero-kpi-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
}
.hero-kpi-sub b { color: var(--text); font-weight: 600; }

/* =========================================================================
 * UNIFIED ANALYTICAL CHART STAGE (1 Museum-Grade Chart + Switcher)
 * ========================================================================= */
.card-hero-chart .card-head > div:first-child {
  flex: 1 1 320px;
  min-width: 0;
}

.chart-stage-switcher {
  display: flex;
  width: 100%;
  border-bottom: 1px solid var(--border);
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.chart-tab-btn {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 12px 9px;
  min-height: 36px;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast) var(--ease-smooth), background var(--dur-fast) var(--ease-smooth);
}
.chart-tab-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}
.chart-tab-btn.is-active {
  color: var(--accent);
  font-weight: 700;
  border-bottom-color: var(--accent);
  background: transparent;
}

.chart-stage-panel[hidden] {
  display: none;
}

.chart-stage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.editorial-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px;
  align-items: start;
}

.chart-box {
  width: 100%;
  min-height: 280px;
  position: relative;
}

.chart-box-hero {
  min-height: 320px;
}

.chart-box svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.cf-hit-area {
  cursor: crosshair;
}

.chart-legend-inline {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.leg-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
}
.leg-escrow { background: var(--chart-escrow); }
.leg-debt { background: var(--chart-debt); }
.leg-llcr { background: var(--chart-llcr); }
.leg-cash { background: var(--chart-cash); }

.cf-scrubber-output {
  display: block;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
 * RISK LIST & DETAILED KPI LEDGER
 * ========================================================================= */
.risk-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid var(--border-subtle);
}

.risk-chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  font-size: 12.5px;
  line-height: 1.45;
}
.risk-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--accent);
}
.risk-chip.sev-high,
.risk-chip.sev-critical {
  background: var(--bad-bg);
  color: var(--text);
}
.risk-chip.sev-high::before,
.risk-chip.sev-critical::before { background: var(--bad); }

.risk-chip.sev-medium {
  background: var(--warn-bg);
  color: var(--text);
}
.risk-chip.sev-medium::before { background: var(--warn); }

.risk-chip strong { font-weight: 600; color: var(--text); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sheet);
  padding: 16px 18px;
  min-width: 0;
}

.kpi-card h3 {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.kpi-card dl {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-card dl > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 3px 12px;
}

.kpi-card dt {
  font-size: 12.5px;
  color: var(--text-secondary);
  min-width: 0;
  flex: 1 1 155px;
}

.kpi-card dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  margin-left: auto;
}

.kpi-strong { color: var(--accent); font-weight: 700; }

/* =========================================================================
 * DIRECTOR READ-ONLY BANNER & ROLE VISIBILITY
 * ========================================================================= */
.director-banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text);
}
.director-banner[hidden] { display: none; }

body[data-role="director"] .director-hide {
  display: none !important;
}

body[data-role="land"] .role-finance-only {
  display: none !important;
}

/* =========================================================================
 * PARAMETER SOLVER & CALLOUTS
 * ========================================================================= */
.solver-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.solver-grid label,
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 0;
}

.solver-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.callout {
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  font-size: 12.5px;
}
.callout-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); font-weight: 500; }
.callout-bad { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad); font-weight: 500; }
.callout-info { background: var(--accent-soft); border-color: var(--border); color: var(--text); }

/* =========================================================================
 * INPUTS WORKBENCH — SPLIT PANE + SMOOTH ACCORDIONS
 * ========================================================================= */
.inputs-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.inputs-toolbar h2 { font-size: 21px; }

.inputs-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  gap: 22px;
  align-items: start;
}

.inputs-main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.inputs-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}
.compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Sticky Live Inspector */
.live-inspector {
  position: sticky;
  top: 106px;
}

.live-inspector-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.live-hero-num {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.live-hero-num strong {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

.live-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.live-metrics-grid > div {
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.live-metrics-grid span {
  font-size: 11px;
  color: var(--muted);
}

.live-metrics-grid strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* Smooth <details> Accordions (modern-web-guidance) */
details.adv-accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  interpolate-size: allow-keywords;
}

details.adv-accordion > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 20px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  transition: background var(--dur-fast) var(--ease-smooth);
}
details.adv-accordion > summary::-webkit-details-marker { display: none; }
details.adv-accordion > summary:hover { background: var(--surface-hover); }
details.adv-accordion > summary::after {
  content: "▸";
  font-size: 12px;
  color: var(--muted);
  transition: transform var(--dur-base) var(--ease-smooth);
}
details.adv-accordion[open] > summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
details.adv-accordion[open] > summary::after {
  transform: rotate(90deg);
}

details.adv-accordion::details-content {
  block-size: 0;
  opacity: 0;
  overflow: clip;
  transition: block-size var(--dur-base) var(--ease-smooth),
    opacity var(--dur-base) var(--ease-smooth),
    content-visibility var(--dur-base) allow-discrete;
}
details.adv-accordion[open]::details-content {
  block-size: auto;
  opacity: 1;
}

details.adv-accordion .form-grid,
details.adv-accordion .adv-body,
details.adv-accordion .details-body {
  padding: 18px 20px 20px;
}

/* =========================================================================
 * RESPONSIVE TABLES (modern-web-guidance: sticky headers + sticky col 1)
 * ========================================================================= */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  container-type: inline-size;
  -webkit-overflow-scrolling: touch;
}

.cf-table-wrap {
  max-block-size: min(560px, 72dvh);
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table thead th.num { text-align: right; }

.data-table tbody td,
.data-table tbody th,
.data-table tfoot td,
.data-table tfoot th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody td:first-child,
.data-table tbody th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: inset -1px 0 0 var(--border-subtle);
}
.data-table tfoot td:first-child,
.data-table tfoot th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface-alt);
  box-shadow: inset -1px 0 0 var(--border);
}
.data-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: inset -1px 0 0 var(--border);
}

.data-table tbody tr:hover td,
.data-table tbody tr:hover th {
  background: var(--surface-hover);
}

.data-table tbody tr.row-total td {
  background: var(--surface-alt);
  font-weight: 700;
  border-top: 1.5px solid var(--border);
}
.data-table tbody tr.row-total td:first-child {
  background: var(--surface-alt);
}
.data-table tbody tr.row-positive td.num-emphasis { color: var(--ok); }
.data-table tbody tr.row-negative td.num-emphasis { color: var(--bad); }

.cf-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.data-table tfoot td,
.data-table tfoot th {
  background: var(--surface-alt);
  font-weight: 700;
  border-top: 2px solid var(--border);
  border-bottom: 0;
  text-align: left;
  white-space: nowrap;
}
.data-table tfoot td.num,
.data-table tfoot th.num {
  text-align: right;
}

.data-table-dense td,
.data-table-dense th {
  padding: 7px 10px;
  font-size: 12.5px;
}

.data-table-editable input,
.data-table-editable select {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 12.5px;
  min-width: 72px;
}
.data-table-editable select {
  min-width: 160px;
  height: 32px;
  line-height: 1.25;
  padding: 0 28px 0 9px;
  background-position: right 9px center;
}
.data-table-editable select.soc-mode-select {
  min-width: 214px;
}
.data-table-editable select.soc-pf-select {
  min-width: 158px;
}
@supports (appearance: base-select) {
  .data-table-editable select {
    padding: 0 9px;
    background-image: none;
  }
}
.data-table-editable .stage-name-input {
  min-width: 185px;
}
.data-table-editable .extra-name-input {
  min-width: 230px;
}
.data-table-editable select.extra-kind-select {
  min-width: 132px;
}

.preset-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.preset-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.social-balance-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.extra-social-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.extra-social-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.extra-social-empty {
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}

.compare-delta-pos {
  color: var(--ok);
  font-weight: 600;
}

.compare-delta-neg {
  color: var(--bad);
  font-weight: 600;
}

.notes-field-wrap {
  margin-top: 12px;
}

.notes-field-wrap textarea {
  width: 100%;
  margin-top: 4px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-elevated);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.45;
}

.notes-field-wrap textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.print-memo-notes {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed #c8c1b4;
  font-size: 11px;
  line-height: 1.4;
}

.jv-mezz-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 11px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text);
}
.jv-mezz-strip[hidden] { display: none; }
.jv-mezz-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-variant-numeric: tabular-nums;
}

/* Badges & Provenance Layers */
.ovr-cell-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.layer-norm_base { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.layer-computed_lookup { background: var(--accent-soft); color: var(--accent); border-color: var(--border); }
.layer-user_override { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }

.heat-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.heat-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.heat-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }

/* =========================================================================
 * MATRIX HEATMAP & SOCIAL / TP
 * ========================================================================= */
.matrix-price-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.matrix-price-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.matrix-price-grid input {
  width: 96px;
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12.5px;
}

.matrix-table td {
  padding: 4px;
}

.heatmap-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 68px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-smooth), border-color var(--dur-fast) var(--ease-smooth);
}
.heatmap-btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.heatmap-btn.is-current {
  border: 2px solid var(--accent);
  font-weight: 700;
}

.tp-mini-wrap { margin-top: 14px; }
.tp-summary {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.tp-warnings {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--warn);
  font-size: 12.5px;
}

/* =========================================================================
 * TOP-LAYER MODALS (<dialog> with @starting-style & overscroll-behavior)
 * ========================================================================= */
.modal-dialog {
  width: min(740px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: var(--shadow-md);
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(8px) scale(0.99);
  transition: opacity var(--dur-base) var(--ease-smooth),
    transform var(--dur-base) var(--ease-smooth),
    display var(--dur-base),
    overlay var(--dur-base);
  transition-behavior: allow-discrete;
}

.modal-dialog[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@starting-style {
  .modal-dialog[open] {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

.modal-dialog::backdrop {
  background: rgba(17, 19, 18, 0.52);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-smooth),
    display var(--dur-base),
    overlay var(--dur-base);
  transition-behavior: allow-discrete;
}
.modal-dialog[open]::backdrop {
  opacity: 1;
}
@starting-style {
  .modal-dialog[open]::backdrop {
    opacity: 0;
  }
}

.modal-dialog-lg { width: min(1080px, calc(100vw - 24px)); }
.modal-dialog-sm { width: min(440px, calc(100vw - 24px)); }

.modal-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--surface-alt);
  z-index: 2;
}
.modal-head h2 { font-size: 18px; }

.modal-body {
  padding: 20px 22px;
  overflow-y: auto;
  max-height: calc(100dvh - 104px);
  overscroll-behavior: contain;
}

.projects-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.35fr);
  gap: 18px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-bar input,
.filter-bar select { flex: 1 1 130px; }

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.proj-item,
.sc-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.proj-item.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.passport-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
  margin-bottom: 14px;
}
.passport-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  min-width: 0;
}

.dd-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 14px;
}

.dd-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) 136px minmax(140px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  font-size: 12.5px;
}

.ns-candidates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.ns-cand-btn {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.ns-cand-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.np-subtabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.np-view[hidden] { display: none; }
.revisions-card { margin-top: 14px; }
.empty-note { color: var(--muted); font-size: 13px; padding: 12px 0; }
.file-btn { cursor: pointer; }

/* =========================================================================
 * VIEW TRANSITIONS & REDUCED MOTION (modern-web-guidance)
 * ========================================================================= */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 170ms;
    animation-timing-function: var(--ease-smooth);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
  details.adv-accordion::details-content,
  .modal-dialog,
  .modal-dialog::backdrop {
    transition: none;
  }
}

/* =========================================================================
 * CONTAINER QUERIES & RESPONSIVE BREAKPOINTS (Desktop >= 1024px, Tablet, Mobile)
 * ========================================================================= */
@container (max-width: 560px) {
  .form-grid,
  .solver-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1279px) {
  .hero-kpi-row,
  .cf-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Compact Tablet / Narrow Window (< 1024px): Clean 2-Row Top Chrome (NOT 7 stacked rows!) */
@media (max-width: 1023px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-main {
    min-width: 0;
    max-width: 100%;
  }

  .sidebar {
    position: relative;
    height: auto;
    min-width: 0;
    max-width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    padding: 10px 20px 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "brand workspace cta"
      "tabs tabs tabs";
    align-items: center;
    gap: 10px 12px;
    overflow: hidden;
  }

  .topbar {
    position: static;
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .sidebar-brand {
    grid-area: brand;
    padding: 0;
    border-bottom: 0;
    margin: 0;
  }

  .brand-sub,
  .sidebar-section-label,
  .sidebar-divider {
    display: none;
  }

  .sidebar-workspace {
    grid-area: workspace;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
  }

  .sidebar-footer {
    grid-area: cta;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  .sidebar-footer .btn-block {
    width: auto;
    min-height: 34px;
    padding: 6px 12px;
    font-size: 12.5px;
  }

  .tabs-bar {
    grid-area: tabs;
    min-width: 0;
    max-width: 100%;
    border-top: 1px solid var(--border-subtle);
    padding-top: 2px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
  }

  .tabs-list {
    flex-direction: row;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0;
    gap: 2px;
    -webkit-overflow-scrolling: touch;
  }
  .tabs-list::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 0 0 auto;
    padding: 8px 10px 9px;
    min-height: 36px;
    font-size: 12.2px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--muted);
  }
  .tab-btn:hover {
    background: var(--surface-alt);
    color: var(--text);
  }
  .tab-btn.is-active {
    background: transparent;
    border-color: transparent;
    border-bottom-color: var(--accent);
    color: var(--accent);
    box-shadow: none;
  }
  .tab-btn.is-active::before {
    display: none;
  }

  .chart-tab-btn {
    padding: 7px 9px 8px;
    font-size: 12px;
    min-height: 34px;
  }

  .nav-action-btn {
    width: auto;
    flex: 0 0 auto;
    min-height: 32px;
    padding: 5px 9px;
    gap: 5px;
    font-size: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
  }
  .nav-action-btn:hover {
    background: var(--surface-hover);
    border-color: transparent;
    color: var(--text);
  }
  .nav-action-label {
    gap: 5px;
  }
  .nav-action-btn .btn-ico {
    width: 13px;
    height: 13px;
  }
  .nav-action-btn .nav-count {
    padding: 1px 6px;
    font-size: 10.5px;
    border-radius: 999px;
  }

  .charts-grid,
  .editorial-split,
  .thesis-grid,
  .inputs-workbench,
  .projects-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .thesis-score-col {
    padding-right: 0;
    padding-bottom: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
  }

  .live-inspector {
    position: static;
    order: -1;
  }
  .live-inspector-card {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
  }
  .live-head {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
    gap: 8px;
  }
  .live-hero-num {
    padding: 0;
    margin: 0;
    border: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .live-hero-num strong {
    font-size: 18px;
  }
  .live-metrics-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .live-metrics-grid > div {
    padding: 0;
    border: 0;
    background: transparent;
  }
  .live-foot {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  .live-foot .btn-block {
    width: auto;
  }
  .inputs-main-col {
    min-width: 0;
  }

  .container {
    padding: 18px 18px 40px;
  }
  .topbar-inner,
  .status-inner {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* Split-pane (680px..960px): hide numeric tab prefixes so all 6 tabs fit cleanly on 1 row */
@media (min-width: 680px) and (max-width: 960px) {
  .tab-btn .tab-num {
    display: none;
  }
  .tab-btn {
    padding: 8px 8px 9px;
    font-size: 12px;
  }
}

/* Mobile (< 680px): Single-column breathable layout, >= 44px touch targets, 0 overflow */
@media (max-width: 679px) {
  .sidebar {
    padding: 10px 14px 0;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand cta"
      "workspace workspace"
      "tabs tabs";
    gap: 8px;
  }
  .sidebar-workspace {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding-bottom: 2px;
  }
  .sidebar-workspace .nav-action-btn {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    justify-content: space-between;
  }
  .tabs-bar {
    margin: 0 -14px;
    padding-left: 14px;
    padding-right: 14px;
  }
  .topbar {
    position: static;
    background: var(--bg);
  }
  .topbar-inner {
    padding: 10px 14px;
    gap: 8px;
  }
  .status-inner {
    padding: 5px 14px;
  }
  .actions-bar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
  .actions-bar .btn {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 12px;
  }
  .actions-bar .btn-secondary {
    background: var(--surface);
    border-color: var(--border);
  }
  .actions-bar #btn-director-brief { order: 1; grid-column: span 3; }
  .actions-bar #btn-print-report { order: 2; grid-column: span 3; }
  .actions-bar #btn-quick-save { order: 3; grid-column: span 3; }
  .actions-bar #btn-export-xlsx { order: 4; grid-column: span 3; }
  .actions-bar #btn-recalc { order: 5; grid-column: span 2; }
  .actions-bar #btn-export-json { order: 6; grid-column: span 2; }
  .actions-bar #btn-theme { order: 7; grid-column: span 2; }
  .live-inspector-card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .live-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .live-foot .btn-block {
    width: 100%;
  }
  #meta-summary {
    display: none;
  }
  .container {
    padding: 14px 12px 32px;
  }
  .card {
    padding: 16px 14px;
  }
  .verdict-hero {
    padding: 16px 14px;
  }
  .verdict-target-box {
    width: 100%;
    min-width: 0;
  }
  .hero-kpi-row,
  .cf-kpi-strip,
  .sales-price-trio {
    grid-template-columns: minmax(0, 1fr);
  }
  .cf-kpi-item {
    padding: 10px 14px;
  }
  .hero-kpi-card {
    padding: 16px 14px;
  }
  .hero-kpi-val {
    font-size: 22px;
  }
  .deal-picker {
    max-width: none;
    width: 100%;
    flex: 1 1 100%;
  }
  #preset-select,
  #role-mode-select {
    min-height: 44px;
    height: 44px;
    line-height: 42px;
  }
  .role-picker {
    width: 100%;
  }
  #role-mode-select {
    flex: 1 1 auto;
  }
  .topbar-deal,
  .topbar-switches {
    width: 100%;
  }
  .segmented {
    flex: 1 1 auto;
  }
  .seg-btn {
    flex: 1 1 50%;
    min-height: 40px;
  }
  .topbar-sep {
    display: none;
  }
  .btn,
  .btn-sm,
  .sidebar-footer .btn-block,
  .tab-btn,
  .pill-btn,
  .chart-tab-btn,
  .heatmap-btn {
    min-height: 40px;
  }
  .chart-box,
  .chart-box-hero {
    min-height: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .chart-box svg {
    min-width: 540px;
  }
  .chart-box-hero svg {
    min-width: 660px;
  }
  .form-grid,
  .solver-grid,
  .compact-grid,
  .passport-grid,
  .dd-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================================
 * WAVE 9: USER GUIDE & FEEDBACK INBOX MODALS
 * ========================================================================= */
.guide-view,
.fb-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.guide-view[hidden],
.fb-view[hidden] {
  display: none;
}

.guide-steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.guide-step-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
}

.guide-step-num {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  background: var(--accent);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.guide-step-card h3,
.guide-formula-card h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.guide-step-card p {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.guide-step-card p:last-child {
  margin-bottom: 0;
}

.guide-note {
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 4px;
}

.guide-formula-grid,
.guide-norms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.guide-formula-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guide-formula-grid > .guide-formula-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.formula-code {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  color: var(--accent);
  overflow-x: auto;
}

.guide-bullets {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  line-height: 1.48;
  color: var(--text-secondary);
}

.guide-report-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.guide-report-cta strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 2px;
}

.fb-message-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.fb-message-label textarea {
  width: 100%;
  resize: vertical;
  min-height: 108px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
}

.fb-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.fb-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.fb-snapshot-preview {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: var(--surface-alt);
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.fb-filter-bar {
  align-items: center;
  flex-wrap: wrap;
}

.fb-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-block-size: min(460px, 58dvh);
  overflow-y: auto;
  padding-right: 2px;
}

.fb-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fb-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.fb-card-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fb-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-secondary);
}

.fb-pill-formula { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.fb-pill-ux { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.fb-pill-feature { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.fb-pill-status-new { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.fb-pill-status-reviewed { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.fb-pill-status-resolved { border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }

.fb-card-meta {
  font-size: 11.5px;
  color: var(--muted);
}

.fb-card-message {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.fb-card-snap {
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--surface-alt);
  border-radius: 6px;
  padding: 6px 10px;
  font-variant-numeric: tabular-nums;
}

.fb-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--border-subtle);
}

.fb-card-actions select {
  max-width: 170px;
  padding: 4px 28px 4px 9px;
  font-size: 12px;
}

.nav-count.has-unread {
  background: var(--bad);
  color: #ffffff;
  border-color: var(--bad);
}

@media (max-width: 780px) {
  .guide-formula-grid,
  .guide-norms-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media screen {
  [hidden] {
    display: none !important;
  }
}

#scenarios-table td,
#scenarios-table th,
#social-table td,
#social-table th {
  padding: 7px 8px;
  font-size: 12.2px;
}

/* =========================================================================
 * WAVE 10 (v4.1): PRESET EXPLAINER, DEAL INSIGHTS, LIVE BANK SLIDERS & CF
 * ========================================================================= */
.preset-explainer-strip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 24px 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
  background: transparent;
}

.preset-explainer-label {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.preset-explainer-text {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.insights-shares-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.share-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.share-chip.is-profit {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.insights-summary-banner {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 14px;
}

.insights-summary-banner.is-warn {
  background: var(--warn-bg);
  border-left-color: var(--warn);
}

.insights-summary-banner.is-bad {
  background: var(--bad-bg);
  border-left-color: var(--bad);
}

.insights-bullets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.insight-card {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--ok);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.insight-card.tone-warn {
  border-left-color: var(--warn);
}

.insight-card.tone-bad {
  border-left-color: var(--bad);
}

.insight-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.insight-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.insight-title {
  font-size: 12.8px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.insight-detail {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* Live Deal Sliders & Bankability Control Panel */
.sliders-llcr-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented-compact .seg-btn {
  padding: 4px 10px;
  font-size: 12px;
}

.sliders-live-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.sl-metric {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sl-metric-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.sl-metric-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.sl-metric-val.is-ok { color: var(--ok); }
.sl-metric-val.is-warn { color: var(--warn); }
.sl-metric-val.is-bad { color: var(--bad); }

.deal-sliders-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  margin-bottom: 16px;
}

.slider-ctrl {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.slider-ctrl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.slider-ctrl-head label {
  font-size: 12.2px;
  font-weight: 600;
  color: var(--text);
}

.slider-ctrl-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.slider-ctrl input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
  height: 20px;
}

.slider-ctrl-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.slider-ctrl-meta span:nth-child(2) {
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sliders-bank-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.sliders-actions-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.sliders-actions-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-alt);
  color: var(--text);
}

/* Executive Cash Flow Grouping & Tie-Check Bar */
.cf-tie-check-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 9px 13px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cf-tie-check-bar.is-warn {
  border-color: var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
}

.data-table tr.cf-group-row td {
  background: var(--surface-alt);
  color: var(--accent);
  font-size: 11.2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 7px 10px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table tr.cf-row-owner-total td {
  background: var(--accent-soft);
  font-weight: 700;
  color: var(--text);
  border-top: 1.5px solid var(--accent);
}

@media (max-width: 1120px) {
  .deal-sliders-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sliders-live-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .preset-explainer-strip {
    padding: 6px 14px 8px;
    font-size: 11.5px;
  }
  .deal-sliders-grid,
  .sliders-live-strip,
  .insights-bullets-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sliders-bank-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .sliders-actions-btns .btn {
    flex: 1 1 auto;
  }
}

/* =========================================================================
 * WAVE 11 (v4.2): EXPRESS ANALYSIS, SITE-FIT SP/PZZ, DOM.RF SALES & EXPORT
 * ========================================================================= */
.express-split {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.28fr);
  gap: 18px;
  align-items: start;
}

#express-ladder-table {
  table-layout: fixed;
  width: 100%;
}

#express-ladder-table th,
#express-ladder-table td {
  padding: 7px 6px;
  font-size: 12px;
  white-space: normal;
  word-break: break-word;
}

#express-ladder-table th:nth-child(1),
#express-ladder-table td:nth-child(1) {
  width: 44%;
}

#express-ladder-table th:nth-child(2),
#express-ladder-table td:nth-child(2) {
  width: 21%;
}

#express-ladder-table th:nth-child(3),
#express-ladder-table td:nth-child(3) {
  width: 17%;
  white-space: nowrap;
}

#express-ladder-table th:nth-child(4),
#express-ladder-table td:nth-child(4) {
  width: 18%;
  white-space: nowrap;
}

#sitefit-variants-table th,
#sitefit-variants-table td {
  padding: 7px 8px;
  font-size: 12.2px;
}

.express-inputs-col,
.express-output-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.inline-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
}

.express-soc-box {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.express-hero-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.exp-kpi {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.exp-kpi-accent {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.exp-kpi-lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.exp-kpi-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.exp-kpi-accent .exp-kpi-val {
  color: var(--accent);
}

.sf-inputs-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.sf-sp-strip {
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  padding: 9px 13px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 12.2px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.sf-sp-strip strong {
  color: var(--text);
}

.data-table td.sf-val-neg {
  color: var(--bad);
  background: var(--bad-bg);
  font-weight: 700;
}

.data-table td.sf-val-ok {
  color: var(--ok);
  font-weight: 600;
}

.domrf-dynamics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-alt);
}

.modal-dialog-md {
  width: min(680px, calc(100vw - 28px));
}

.export-presets-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.export-checks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.export-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  cursor: pointer;
  font-size: 12.6px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.export-check-item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.export-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.export-modal-actions {
  margin-top: 12px;
}

/* =========================================================================
 * AUTH PAGE (/login & /invite/<token>) + SIDEBAR USER & ADMIN MODAL
 * ========================================================================= */
.auth-page-body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-shell {
  width: 100%;
  max-width: 440px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.auth-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-field input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
}

.auth-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.sidebar-user-card {
  margin: 8px 12px 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sidebar-user-meta strong {
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-invite-card {
  margin-bottom: 14px;
}

.admin-invite-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-invite-actions {
  margin-top: 12px;
}

.admin-invite-url-box {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-invite-url-box input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

/* =========================================================================
 * INTERACTIVE ONBOARDING SPOTLIGHT TOUR (ProkCalc)
 * ========================================================================= */
.tour-highlight {
  position: relative;
  z-index: 950;
  border-radius: var(--radius-sm);
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 0 8px rgba(15, 76, 58, 0.22),
    0 0 0 9999px rgba(15, 23, 42, 0.44);
  transition: box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1), transform 0.25s ease;
}

.tour-card {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 980;
  width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.12);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: tourFadeUp 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.tour-card[hidden] {
  display: none;
}

.tour-card.is-step-swap {
  animation: tourStepPulse 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tourFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tourStepPulse {
  from {
    opacity: 0.72;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tour-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tour-step-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tour-step-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.tour-step-body {
  margin: 0;
  font-size: 13.2px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.tour-dots {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
}

.tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--border-strong);
  transition: width 0.25s ease, background-color 0.25s ease;
}

.tour-dot.is-active {
  width: 22px;
  background: var(--accent);
}

.tour-dot.is-done {
  background: var(--accent);
  opacity: 0.45;
}

.tour-dont-show {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding-top: 2px;
}

.tour-dont-show input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.tour-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .tour-highlight,
  .tour-card,
  .tour-card.is-step-swap,
  .tour-dot {
    animation: none;
    transition: none;
  }
}

@media (max-width: 1120px) {
  .express-split {
    grid-template-columns: minmax(0, 1fr);
  }
  .sf-inputs-grid,
  .domrf-dynamics-grid,
  .admin-invite-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .express-hero-strip,
  .sf-inputs-grid,
  .domrf-dynamics-grid,
  .admin-invite-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================================
 * PRINT — MULTI-PAGE INVESTMENT COMMITTEE MEMORANDUM
 * ========================================================================= */
.print-only { display: none; }

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }
  body {
    background: #ffffff;
    color: #15181c;
    font-size: 11px;
  }
  .sidebar,
  .topbar,
  .skip-link,
  .btn,
  .pill-btn,
  .actions-bar,
  .chart-stage-switcher,
  .director-banner,
  .live-inspector,
  dialog {
    display: none !important;
  }
  .app-shell {
    display: block;
  }
  .container {
    max-width: none;
    padding: 0;
  }
  .print-only {
    display: block !important;
  }
  .chart-stage-panel[hidden] {
    display: block !important;
    margin-top: 16px;
    break-inside: avoid;
  }
  .print-memo-header {
    border-bottom: 2px solid #153e35;
    padding-bottom: 8px;
    margin-bottom: 12px;
  }
  .print-memo-title-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
  }
  .print-memo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 16px;
    margin-top: 6px;
    font-size: 10.5px;
  }
  .tab-panel[hidden] {
    display: none !important;
  }
  .card,
  .kpi-card,
  .executive-sheet {
    break-inside: avoid;
    border-color: #c5bdb0;
  }
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
