/* 526 Penrose pro forma — styles.
   Color roles come from the validated dataviz reference palette; the chart
   body is written against roles so light/dark swap in one place. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface-1: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --series-1: #2a78d6; /* blue */
  --series-2: #eb6834; /* orange */
  --series-3: #1baf7a; /* aqua */
  --series-4: #eda100; /* yellow */
  --delta-good: #006300;
  --delta-bad: #d03b3b;
  --seq-100: #cde2fb;
  --seq-150: #b7d3f6;
  --seq-200: #9ec5f4;
  --seq-250: #86b6ef;
  --seq-300: #6da7ec;
  --seq-350: #5598e7;
  --seq-400: #3987e5;
  --accent: #2a78d6;
  --danger: #d03b3b;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05);
}

/* Dark tokens are attribute-driven: a tiny inline script in index.html stamps
   data-theme on <html> before first paint (saved choice, else OS scheme), and
   the toggle button flips it. No prefers-color-scheme var block needed. */
:root[data-theme="dark"] {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface-1: #1a1a19;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --delta-good: #0ca30c;
    --delta-bad: #e66767;
    /* Sequential steps re-anchored for the dark surface (darker = shallower). */
    --seq-100: #184f95;
    --seq-150: #1c5cab;
    --seq-200: #256abf;
    --seq-250: #2a78d6;
    --seq-300: #3987e5;
    --seq-350: #5598e7;
    --seq-400: #6da7ec;
    --accent: #3987e5;
    --danger: #e66767;
    --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 64px;
}

/* ------------------------------------------------------------- header --- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.brand { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.brand-sub { font-weight: 500; font-size: 15px; color: var(--text-muted); margin-left: 6px; }

/* Investor orientation strip above the photos — what the page is, and what
   each assumption group controls. Card treatment mirrors the video strip. */
.intro-strip {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.in-head h2 { font-size: 17px; margin: 0 0 6px; }
.in-head p { margin: 0; color: var(--text-secondary); font-size: 13.5px; max-width: 92ch; }
.in-head b, .in-foot b { color: var(--text-primary); font-weight: 650; }
.in-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.in-card {
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.in-card h3 {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.in-card p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.in-card p b { color: var(--text-primary); font-weight: 650; display: block; margin-bottom: 2px; }
.in-foot { margin: 12px 0 0; font-size: 12.5px; color: var(--text-muted); max-width: 100ch; }
@media (max-width: 860px) { .in-grid { grid-template-columns: 1fr; } }

/* Full-span hero photo + highlights carousel. */
.ph-tile {
  position: relative;
  padding: 0;
  border: 0;
  background: var(--surface-1);
  cursor: zoom-in;
  overflow: hidden;
  min-height: 0;
}
.ph-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: filter 0.15s ease;
}
.ph-tile:hover img, .ph-tile:focus-visible img { filter: brightness(1.07); }
.ph-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.photo-hero-full { margin-bottom: 16px; }
.hero-full { display: block; width: 100%; border-radius: 16px; }
.hero-full img { height: clamp(260px, 44vw, 470px); }

.photo-carousel { position: relative; margin-bottom: 16px; }
.pc-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.pc-track::-webkit-scrollbar { display: none; }
.pc-track .ph-tile { flex: 0 0 236px; height: 148px; border-radius: 12px; scroll-snap-align: start; }
.pc-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.pc-prev { left: -9px; }
.pc-next { right: -9px; }
.pc-nav:hover { border-color: var(--accent); }
@media (max-width: 700px) {
  .pc-track .ph-tile { flex-basis: 168px; height: 118px; }
  .pc-nav { display: none; } /* touch scroll */
}

/* Listing facts strip under the mosaic — price, stat run, address. */
.listing-facts { display: flex; flex-direction: column; gap: 4px; margin-bottom: 22px; }
.lf-main { display: flex; align-items: baseline; gap: 8px 18px; flex-wrap: wrap; }
.lf-price { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.lf-chip {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  vertical-align: 3px;
  margin-left: 2px;
}
.lf-stats { list-style: none; display: flex; gap: 0 14px; margin: 0; padding: 0; font-size: 14.5px; color: var(--text-secondary); flex-wrap: wrap; }
.lf-stats li b { color: var(--text-primary); font-weight: 650; }
.lf-stats li + li::before { content: '·'; margin-right: 14px; color: var(--text-muted); }
.lf-addr { font-size: 14px; color: var(--text-secondary); }
.lf-tagline { font-size: 12.5px; color: var(--text-muted); margin: 3px 0 0; max-width: 62ch; }

/* Video tour inlay: player left, CTA right; stacks on small screens. */
.video-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 1fr;
  gap: 20px;
  align-items: center;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.vs-player {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.vs-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.vs-cta h2 { font-size: 17px; margin: 0 0 6px; }
.vs-cta p { margin: 0 0 12px; color: var(--text-secondary); font-size: 13.5px; }
.vs-btn { text-decoration: none; display: inline-block; }
.vs-cta .vs-sub { font-size: 11.5px; color: var(--text-muted); margin: 8px 0 0; }
@media (max-width: 860px) { .video-strip { grid-template-columns: 1fr; } }

/* Contact-ownership CTA band. */
.contact-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  flex-wrap: wrap;
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--series-1) 10%, var(--surface-1)),
    color-mix(in srgb, var(--series-3) 8%, var(--surface-1))
  );
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  margin-bottom: 22px;
}
.cs-copy h2 { font-size: 17px; margin: 0 0 4px; }
.cs-copy p { margin: 0; color: var(--text-secondary); font-size: 13.5px; max-width: 56ch; }
.cs-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.cs-btn { text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.h-ico { margin-right: 7px; }

.db-status { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.db-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.db-status.ok .dot { background: #0ca30c; }
.db-status.bad .dot { background: var(--danger); }

/* ------------------------------------------------------------- layout --- */

.layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.panel + .panel { margin-top: 20px; }
.panel h2 { font-size: 15px; font-weight: 650; margin: 0 0 12px; }
.panel h3 {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 18px 0 8px;
}
.panel h3:first-of-type { margin-top: 0; }

.main-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.main-col .panel + .panel { margin-top: 0; }

/* --------------------------------------------------------------- form --- */

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--text-secondary); }
.field .input-wrap { position: relative; display: flex; align-items: center; }
.field input, .field select {
  width: 100%;
  padding: 6px 8px;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field .unit {
  position: absolute;
  right: 8px;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
}
.field input.has-unit { padding-right: 26px; }

.unit-row { display: grid; grid-template-columns: 1fr 110px 28px; gap: 8px; margin-bottom: 8px; align-items: center; }
.unit-row input { padding: 6px 8px; font: inherit; color: var(--text-primary); background: var(--page); border: 1px solid var(--border); border-radius: 6px; width: 100%; }
.unit-row .remove-unit {
  border: none; background: none; color: var(--text-muted); font-size: 16px;
  cursor: pointer; padding: 2px; border-radius: 4px; line-height: 1;
}
.unit-row .remove-unit:hover { color: var(--danger); background: var(--page); }

button.btn {
  font: inherit;
  font-weight: 550;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
}
button.btn:hover { border-color: var(--accent); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.small { padding: 4px 10px; font-size: 12.5px; }
button.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------------------------------------------------------- KPI tiles --- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
}
.kpi .kpi-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.kpi .kpi-value { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.kpi .kpi-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.kpi .kpi-value.good { color: var(--delta-good); }
.kpi .kpi-value.bad { color: var(--delta-bad); }

/* -------------------------------------------------------------- charts --- */

.chart-block h2 { margin-bottom: 2px; }
.chart-note { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; }
.chart-svg { width: 100%; height: auto; display: block; }

/* Path-to-positive strip under the cash-flow chart. Status is carried by the
   leading text and border, not color alone. */
.break-even {
  margin-top: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  border-left: 3px solid var(--baseline);
  background: color-mix(in srgb, var(--surface-1) 92%, var(--text-primary) 8%);
  border-radius: 0 6px 6px 0;
}
.break-even.ok { border-left-color: var(--delta-good); }
.break-even.warn { border-left-color: var(--delta-bad); }
.break-even b { color: var(--text-primary); }
.break-even .be-note { display: block; margin-top: 2px; color: var(--text-muted); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font-size: 12px; color: var(--text-secondary); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend.legend-rows { flex-direction: column; gap: 4px; }
.legend .legend-line { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.legend .legend-title { font-weight: 650; color: var(--text-muted); min-width: 58px; }

.chart-tooltip {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  background: var(--surface-1);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  padding: 8px 10px;
  font-size: 12px;
  max-width: 260px;
  display: none;
}
.chart-tooltip .tt-title { font-weight: 650; margin-bottom: 4px; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tooltip .tt-row .v { font-variant-numeric: tabular-nums; font-weight: 550; }

/* -------------------------------------------------------------- tables --- */

.table-scroll { overflow-x: auto; }
table.data {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  text-align: right;
  padding: 5px 10px;
  border-bottom: 1px solid var(--grid);
  white-space: nowrap;
}
table.data th {
  color: var(--text-secondary);
  font-weight: 550;
  border-bottom: 1px solid var(--baseline);
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td.neg { color: var(--delta-bad); }
table.data tr.total-row td { font-weight: 650; border-top: 1px solid var(--baseline); }

/* --------------------------------------------------------- sensitivity --- */

.sens-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1100px) { .sens-wrap { grid-template-columns: 1fr; } }

table.sens { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; width: 100%; }
table.sens th, table.sens td { padding: 5px 8px; text-align: right; border: 1px solid var(--surface-1); }
table.sens th { color: var(--text-secondary); font-weight: 550; }
table.sens td { color: var(--text-primary); }
table.sens td.base-cell { outline: 2px solid var(--text-primary); outline-offset: -2px; font-weight: 650; }
.sens-title { font-size: 13px; font-weight: 650; margin: 0 0 2px; }
.sens-sub { font-size: 11.5px; color: var(--text-muted); margin: 0 0 8px; }

/* ----------------------------------------------------------- scenarios --- */

.scenario-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.scenario-bar input[type="text"] {
  font: inherit; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--page); color: var(--text-primary); min-width: 160px;
}
.kind-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.kind-toggle button {
  font: inherit; font-size: 12.5px; border: none; background: var(--surface-1);
  color: var(--text-secondary); padding: 5px 10px; cursor: pointer;
}
.kind-toggle button + button { border-left: 1px solid var(--border); }
.kind-toggle button.active { background: var(--accent); color: #fff; }

.scenario-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.scenario-row {
  display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--page); font-size: 13px;
}
.scenario-row .s-name { font-weight: 600; }
.scenario-row .s-kind {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
}
.scenario-row .s-meta {
  color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums;
  /* Never let flex strangle this into a one-character column — when space is
     tight the whole chip wraps to its own line instead. */
  white-space: nowrap;
}
.scenario-row .s-actions { margin-left: auto; display: flex; gap: 6px; }
.scenario-row .s-actions button {
  font: inherit; font-size: 12px; border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-primary); border-radius: 6px; padding: 3px 9px; cursor: pointer;
}
.scenario-row .s-actions button:hover { border-color: var(--accent); }
.scenario-row .s-actions button.danger:hover { border-color: var(--danger); color: var(--danger); }
.scenario-row .s-lock { font-size: 12px; align-self: center; cursor: help; opacity: 0.75; }
.scenario-row label.cmp { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; color: var(--text-secondary); }

.empty-note { color: var(--text-muted); font-size: 13px; }
.api-error {
  background: color-mix(in srgb, var(--danger) 10%, var(--surface-1));
  border: 1px solid var(--danger);
  color: var(--text-primary);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-top: 10px;
  display: none;
}

/* -------------------------------------------------------------- comps --- */

.comp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.comp-chip {
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.comp-chip b { color: var(--text-primary); font-weight: 650; }
table.data td.addr { white-space: normal; min-width: 170px; }
.addr-sub { font-size: 11px; color: var(--text-muted); font-variant-numeric: normal; }
.comps-foot { margin: 10px 0 0; }

/* ------------------------------------------------------------- photos --- */

.photo-featured {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--page);
}
.photo-featured img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.photo-featured:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.photo-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.photo-thumbs button {
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: none;
}
.photo-thumbs button.active { border-color: var(--accent); }
.photo-thumbs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.photo-thumbs img {
  display: block;
  width: 96px;
  height: 64px;
  object-fit: cover;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img {
  max-width: min(94vw, 1536px);
  max-height: 90vh;
  border-radius: 8px;
}
.lightbox button {
  position: absolute;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
}
.lightbox button:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox .lb-close { top: 18px; right: 18px; }
.lightbox .lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

@media print {
  .photo-featured { border-color: #ddd; max-width: 420px; }
  .photo-featured img { aspect-ratio: 3 / 2; }
}

/* -------------------------------------------------------------- toast --- */

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text-primary); color: var(--page);
  border-radius: 8px; padding: 9px 16px; font-size: 13px; z-index: 50;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* -------------------------------------------------------------- print --- */

@media print {
  /* Force the light token set regardless of the chosen theme — paper is
     white. Matches the attribute selector so it outranks a forced dark. */
  :root, :root[data-theme="dark"] {
    color-scheme: light;
    --page: #ffffff;
    --surface-1: #ffffff;
    --text-primary: #0b0b0b;
    --text-secondary: #52514e;
    --text-muted: #898781;
    --grid: #e1e0d9;
    --baseline: #c3c2b7;
    --border: rgba(11, 11, 11, 0.15);
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --delta-good: #006300;
    --delta-bad: #d03b3b;
    --seq-100: #cde2fb;
    --seq-150: #b7d3f6;
    --seq-200: #9ec5f4;
    --seq-250: #86b6ef;
    --seq-300: #6da7ec;
    --seq-350: #5598e7;
    --seq-400: #3987e5;
    --accent: #2a78d6;
    --danger: #d03b3b;
    --shadow: none;
  }
  body { background: #fff; }
  .app { max-width: none; padding: 0; }
  .layout { display: block; }
  .assumptions-col, .header-actions, .scenario-panel, .no-print { display: none !important; }
  .panel, .kpi { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .main-col { gap: 12px; }
  .listing-facts { margin-bottom: 12px; }
  /* Paper cannot scroll: release the overflow containers and let the
     12-column schedule shrink and wrap to fit the page box. */
  .table-scroll { overflow: visible; }
  table.data { font-size: 9.5px; }
  table.data th, table.data td { white-space: normal; padding: 3px 6px; }
  /* Browsers strip CSS backgrounds by default in print; the sensitivity
     heatmap and legend swatches are meaningless without them. */
  table.sens td, .legend .swatch {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* ------------------------------------------------- mobile gutters/padding --- */

@media (max-width: 700px) {
  .app { padding: 14px 14px 48px; }
  .layout { gap: 14px; }
  .panel { padding: 14px; }
  .panel + .panel { margin-top: 14px; }
  .main-col { gap: 14px; }
  .lf-price { font-size: 24px; }

  /* Save bar stacks: full-width name, equal-width kind toggle, full button. */
  .scenario-bar input[type="text"] { flex: 1 1 100%; min-width: 0; }
  .kind-toggle { display: flex; width: 100%; }
  .kind-toggle button { flex: 1 1 0; text-align: center; padding: 7px 4px; }
  .scenario-bar .btn.primary { width: 100%; }

  /* Scenario cards: name+kind on top, metrics line, compare+actions below. */
  .scenario-row { display: grid; grid-template-columns: 1fr auto; row-gap: 7px; padding: 10px 12px; }
  .scenario-row .s-name { grid-column: 1; grid-row: 1; min-width: 0; }
  .scenario-row .s-kind { grid-column: 2; grid-row: 1; justify-self: end; align-self: center; }
  .scenario-row .s-meta { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
  .scenario-row label.cmp { grid-column: 1; grid-row: 3; }
  .scenario-row .s-actions { grid-column: 2; grid-row: 3; margin-left: 0; justify-self: end; }

  /* Sensitivity grids: tighter cells so label + 5 columns fit the viewport. */
  table.sens { font-size: 11px; }
  table.sens th, table.sens td { padding: 4px 5px; }
  table.sens thead th:first-child { font-size: 10px; line-height: 1.25; max-width: 74px; }
  table.sens tbody th { white-space: nowrap; }
}
