/* ---------- Design tokens ---------- */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --accent: #1e3a8a;
  --accent-hover: #172e6e;
  --accent-soft: #eef2ff;
  --negative: #b42318;
  --negative-soft: #fef3f2;
  --positive: #067647;
  --warning-soft: #fffaeb;
  --warning-border: #fedf89;
  --warning-text: #93370d;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; }
button, input { font: inherit; color: inherit; }

.loading { text-align: center; margin-top: 120px; color: var(--text-3); font-size: 16px; }
.error-box {
  max-width: 760px; margin: 60px auto; padding: 20px 24px;
  background: var(--negative-soft); border: 1px solid #fecdca; border-radius: var(--radius); color: #7a271a;
}
.error-box h2 { font-size: 18px; margin-bottom: 8px; }

/* ---------- Top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: 0.5px;
}
.brand-title { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.brand-sub { color: var(--text-3); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.data-pill {
  font-size: 12px; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px;
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: 8px; padding: 8px 14px; font-weight: 550; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: var(--surface); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.button-group { display: flex; gap: 8px; flex-wrap: wrap; }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 260px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 24px rgba(16,24,40,0.12);
}
.menu-list button {
  display: block; width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.menu-list button:hover, .menu-list button:focus-visible { background: var(--surface-2); }
.menu-list strong { display: block; font-size: 13px; font-weight: 600; }
.menu-list small { display: block; font-size: 12px; color: var(--text-3); }
.btn-small { padding: 4px 10px; font-size: 12px; }
.link-btn {
  background: none; border: none; padding: 2px 4px; color: var(--text-3); cursor: pointer; font-size: 12px; font-weight: 500;
}
.link-btn:hover { color: var(--text); text-decoration: underline; }
button:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- Layout ---------- */
.page { max-width: 1320px; margin: 0 auto; padding: 20px 24px 40px; display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2, .section-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.card-sub { color: var(--text-3); font-size: 12px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }

.workspace { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: stretch; }
.editor { align-self: start; }
.charts { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
/* The dues chart grows to line up with the bottom of the editor. */
.charts .grow { flex: 1; display: flex; flex-direction: column; }
.charts .grow .chart-box { flex: 1; min-height: 260px; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 380px; }
.chart-caption { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .topbar { position: static; }
  .menu-list { left: 0; right: auto; max-width: calc(100vw - 32px); }
  .topbar-inner, .page { padding-left: 16px; padding-right: 16px; }
  .data-pill { display: none; }
  .chart-box.tall { height: 300px; }
  .chart-box { height: 220px; }
}

/* ---------- Form fields ---------- */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.input-affix {
  display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); overflow: hidden; flex-shrink: 0;
}
.input-affix:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-affix input {
  border: none; outline: none; width: 64px; padding: 6px 8px; text-align: right;
  font-variant-numeric: tabular-nums; font-weight: 600; background: transparent;
}
.input-affix.wide input { width: 84px; }
.input-affix.full { display: flex; width: 100%; }
.input-affix.full input { width: 100%; }
.affix { padding: 0 8px; color: var(--text-3); font-size: 12px; background: var(--surface-2); align-self: stretch; display: flex; align-items: center; }
.affix.pre { border-right: 1px solid var(--border); }
.affix.post { border-left: 1px solid var(--border); }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.segmented button {
  border: none; background: transparent; padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 550;
  color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,0.1); }

.check-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check-row input { margin-top: 2px; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.check-row strong { font-weight: 600; font-size: 13px; }

/* ---------- Shared assumptions ---------- */
.assumption-grid { display: grid; grid-template-columns: 1.1fr repeat(3, 1fr); gap: 0; }
.assumption { padding: 0 20px; border-left: 1px solid var(--border); }
.assumption:first-child { padding-left: 0; border-left: none; }
.assumption:last-child { padding-right: 0; }
.big-number { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.source { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.source summary { cursor: pointer; }
.source p { margin: 6px 0 0; line-height: 1.4; }
@media (max-width: 1000px) {
  .assumption-grid { grid-template-columns: 1fr 1fr; gap: 18px 0; }
  .assumption:nth-child(3) { padding-left: 0; border-left: none; }
}
@media (max-width: 640px) {
  .assumption-grid { grid-template-columns: 1fr; }
  .assumption { padding: 0; border-left: none; }
}

/* ---------- Scenario cards ---------- */
.scenario-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .scenario-cards { grid-template-columns: minmax(0, 1fr); } }
.scenario-card {
  position: relative; text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 12px; cursor: pointer;
  border-top: 4px solid var(--c); transition: box-shadow 0.15s, border-color 0.15s;
}
.scenario-card:hover { box-shadow: 0 4px 10px rgba(16,24,40,0.08); }
.scenario-card.selected { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 4px 12px rgba(16,24,40,0.08); }
.scenario-name { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; }
.scenario-name .editing { font-size: 11px; font-weight: 600; color: var(--c); text-transform: uppercase; letter-spacing: 0.04em; margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.plan-summary { color: var(--text-2); font-size: 12px; margin: 4px 0 12px; min-height: 18px; }
.first-year {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 12px; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.fy-label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.fy-value { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pct-chip {
  font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.pct-chip.warn { background: var(--warning-soft); color: var(--warning-text); border: 1px solid var(--warning-border); }
.pct-chip.flat { background: #f2f4f7; color: var(--text-2); }
.fy-vs { font-size: 12px; color: var(--text-3); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.metrics dt { font-size: 11px; color: var(--text-3); font-weight: 500; }
.metrics dd { margin: 1px 0 0; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.metrics dd small { font-size: 11px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.metrics dd.neg { color: var(--negative); }
.metrics dd.pos { color: var(--positive); }
.card-foot { display: flex; align-items: center; gap: 4px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); min-height: 34px; }
.badge {
  font-size: 11px; font-weight: 600; border-radius: 999px; padding: 2px 8px; margin-right: auto;
  background: var(--warning-soft); color: var(--warning-text); border: 1px solid var(--warning-border);
}
.badge.ok { background: #ecfdf3; color: var(--positive); border-color: #abefc6; }
.scenario-add {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: transparent; cursor: pointer;
  color: var(--text-2); font-weight: 550; min-height: 180px; display: grid; place-items: center; text-align: center; padding: 16px;
}
.scenario-add:hover { background: var(--surface); color: var(--text); border-color: var(--text-3); }
.scenario-add .plus { font-size: 22px; display: block; margin-bottom: 4px; }
.scenario-add small { display: block; color: var(--text-3); font-weight: 400; margin-top: 2px; }

/* ---------- Editor ---------- */
.editor { border-top: 4px solid var(--c); }
.editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.name-field { position: relative; flex: 1; min-width: 0; display: flex; }
.name-input {
  flex: 1; min-width: 0; border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 34px 7px 10px;
  font-size: 16px; font-weight: 650; background: var(--surface);
}
.name-input::placeholder { font-weight: 400; color: var(--text-3); }
.name-input:hover { border-color: var(--text-3); }
.name-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.name-pencil { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; font-size: 14px; }
.card-foot .badge { margin-right: auto; }
.editor-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.editor-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); font-weight: 650; margin-bottom: 12px; }
.borrow-fields { margin-top: 14px; }
.loan-afford { border-radius: 6px; padding: 8px 10px; margin: -2px -2px 8px; font-size: 12.5px; line-height: 1.45; }
.loan-afford strong { display: block; margin-bottom: 2px; }
.loan-afford.ok { background: #ecfdf3; color: var(--positive); border: 1px solid #abefc6; }
.loan-afford.bad { background: var(--negative-soft); color: #7a271a; border: 1px solid #fecdca; }
.loan-afford.bad strong { color: var(--negative); }
.loan-afford .fine { margin-top: 4px; font-size: 12px; color: var(--text-2); }
.card-alert {
  margin: -4px 0 10px; padding: 6px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--negative-soft); color: var(--negative); border: 1px solid #fecdca;
}
.loan-status { border-radius: 6px; padding: 8px 10px; margin: -2px -2px 8px; font-size: 12.5px; line-height: 1.45; }
.loan-status.ok { background: #ecfdf3; color: var(--positive); border: 1px solid #abefc6; font-weight: 600; }
.loan-status.warn { background: var(--warning-soft); color: #4e1d09; border: 1px solid var(--warning-border); }
.loan-status.warn strong { color: var(--warning-text); display: block; margin-bottom: 2px; }
.nowrap { white-space: nowrap; }
.fix-label { margin-top: 8px; font-weight: 600; color: var(--warning-text); }
.fix-list { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin-top: 6px; }
.fix-btn { text-align: left; white-space: normal; background: var(--surface); }
.borrow-fields .two-up { margin-bottom: 10px; }
.borrow-actions { display: flex; justify-content: flex-end; margin: 2px 0 10px; }
.pct-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.pct-row .input-affix input { width: 58px; }
.schedule-intro { margin: 0 0 8px; }
.effective {
  font-size: 12px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; margin-top: 4px;
}
.effective strong { color: var(--text); }

.schedule-wrap { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.schedule { width: 100%; border-collapse: collapse; font-size: 12px; }
.schedule th {
  position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--text-2);
  padding: 6px 8px; border-bottom: 1px solid var(--border); z-index: 1;
}
.schedule td { padding: 3px 8px; border-bottom: 1px solid #f2f4f7; }
.schedule tr:last-child td { border-bottom: none; }
.schedule input {
  width: 58px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 3px 6px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.schedule .na { color: var(--text-3); font-style: italic; }
.schedule .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

.sa-grid { display: grid; grid-template-columns: 1fr 88px; gap: 8px 10px; align-items: end; }
.sa-grid .sa-label { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--text-2); margin-top: 4px; }
.sa-grid .sa-label:first-child { margin-top: 0; }
.mini-label { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 3px; }

/* ---------- Share-as-image dialog ---------- */
.image-dialog {
  width: min(980px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 20px 22px; border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 24px 48px rgba(16,24,40,0.2); color: var(--text); background: var(--surface);
}
.image-dialog::backdrop { background: rgba(16,24,40,0.45); }
.image-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { font-size: 17px; }
.image-dialog .panel-note { margin: 0; }
.icon-btn { border: none; background: none; font-size: 16px; color: var(--text-3); cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.image-preview {
  position: relative; overflow: auto; min-height: 200px; max-height: 60vh; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px;
}
.image-preview img { display: block; width: 100%; height: auto; border-radius: 6px; box-shadow: 0 1px 3px rgba(16,24,40,0.12); }
.image-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); background: rgba(245,246,248,0.7); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Welcome / help ---------- */
.welcome-dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 22px 24px;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 24px 48px rgba(16,24,40,0.2);
  color: var(--text); background: var(--surface);
}
.welcome-dialog::backdrop { background: rgba(16,24,40,0.45); }
.welcome-dialog[open] { display: flex; flex-direction: column; gap: 12px; }
#welcome-title:focus { outline: none; }
.welcome-intro { margin: 0; color: var(--text-2); font-size: 14px; }
.welcome-steps { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.welcome-steps li {
  counter-increment: step; position: relative; padding-left: 38px; font-size: 13.5px; color: var(--text-2); line-height: 1.5;
}
.welcome-steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center;
}
.welcome-steps strong { display: block; color: var(--text); font-size: 14px; margin-bottom: 1px; }
.welcome-steps em { font-style: normal; font-weight: 600; color: var(--text); }
.welcome-dialog .fine-print { margin: 4px 0 0; }
.btn-icon { display: inline-flex; align-items: center; gap: 6px; }
.help-icon { flex-shrink: 0; color: var(--text-2); }

/* ---------- Project overrides ---------- */
.changes-banner {
  display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 14px; background: var(--warning-soft); border: 1px solid var(--warning-border);
  border-left: 4px solid #f79009; border-radius: 8px;
}
.cb-title { font-weight: 650; color: var(--warning-text); font-size: 13px; }
.changes-banner ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; color: #4e1d09; }
.cb-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cb-impact { margin: 8px 0 0; font-size: 13px; color: #4e1d09; }
.covered-badge {
  margin-left: 8px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px;
}
tr.covered td { color: var(--text-3); }
tr.covered input { opacity: 0.5; }
tr.category-row.has-edits td:first-child { box-shadow: inset 4px 0 0 #f79009; }
tr.category-row.has-edits .edited-badge { display: inline-block; }
.tab-badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: #f79009;
  color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.cost-cell { white-space: nowrap; }
.cost-affix input { width: 104px; font-weight: 500; }
.study-note { display: none; margin-left: 8px; font-size: 12px; color: var(--warning-text); white-space: nowrap; }
.edited-badge {
  display: none; margin-left: 8px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: #fff; background: #f79009; border-radius: 4px; padding: 1px 6px; vertical-align: 1px;
}
tr.overridden td { background: var(--warning-soft) !important; }
tr.overridden td:first-child { box-shadow: inset 4px 0 0 #f79009; }
tr.overridden .study-note { display: inline; }
tr.overridden .edited-badge { display: inline-block; }
tr.overridden .cost-affix { border-color: #f79009; }
tr.overridden .cost-affix input { font-weight: 700; color: var(--warning-text); }
.undo-cost { font-size: 12px; padding: 0; color: var(--warning-text); text-decoration: underline; vertical-align: baseline; }
tr.muted td.name-cell { text-decoration: none; }
tr.muted td.name-cell .pname { text-decoration: line-through; }

/* ---------- Dues breakdown ---------- */
.breakdown { --reserve: #1e3a8a; --operating: #c3cad5; --operating-strong: #98a4b5; }
.breakdown-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.year-pick { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.year-pick select {
  font: inherit; font-weight: 600; color: var(--text); padding: 5px 8px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface);
}
.breakdown-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; align-items: start; }
@media (max-width: 1000px) { .breakdown-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; } }
.hero-number { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero-number small { font-size: 15px; font-weight: 500; color: var(--text-3); margin-left: 4px; letter-spacing: 0; }
.stackbar-wrap { position: relative; margin: 18px 0 12px; }
.stackbar { display: flex; gap: 2px; height: 40px; }
.stackbar .seg {
  height: 100%; min-width: 3px; background: var(--operating); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; cursor: default; transition: filter 0.1s;
}
.stackbar .seg:first-child { border-radius: 4px 0 0 4px; }
.stackbar .seg:last-child { border-radius: 0 4px 4px 0; }
.stackbar .seg.reserve { background: var(--reserve); color: #fff; }
.stackbar .seg.active { filter: brightness(0.88); }
.bd-tooltip {
  position: absolute; bottom: calc(100% + 8px); transform: translateX(-50%); background: var(--text); color: #fff;
  font-size: 12px; padding: 6px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 5;
}
.bd-tooltip b { font-weight: 600; }
.bd-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bd-split div { border-left: 3px solid var(--operating-strong); padding-left: 10px; }
.bd-split div.reserve { border-left-color: var(--reserve); }
.bd-split .k { font-size: 12px; color: var(--text-2); font-weight: 600; }
.bd-split .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bd-split .v small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.bd-split .n { font-size: 12px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.bd-short { margin-top: 10px; font-size: 13px; color: var(--negative); font-weight: 600; }

.breakdown-list { font-size: 13px; }
.bd-head, .bd-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.4fr) 76px 54px; align-items: center; gap: 12px; }
.bd-head > div { white-space: nowrap; }
@media (max-width: 640px) {
  .bd-head, .bd-row { grid-template-columns: minmax(0, 1fr) 76px 48px; gap: 10px; }
  .bd-track, .bd-head > div:nth-child(2), .bd-row.total > div:nth-child(2) { display: none; }
}
.bd-head { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 8px 6px; border-bottom: 1px solid var(--border); }
.bd-row { padding: 6px 8px; border-bottom: 1px solid #f2f4f7; border-radius: 6px; }
.bd-row.hover, .bd-row.clickable:hover { background: var(--surface-2); }
.bd-row.clickable { cursor: pointer; }
.bd-row.group { font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; padding-top: 12px; border-bottom: none; }
.bd-row.item { font-size: 12px; color: var(--text-2); padding-top: 4px; padding-bottom: 4px; }
.bd-row.item .bd-name { padding-left: 20px; }
.bd-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.bd-name span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-name .caret { flex-shrink: 0; }
.bd-sub { grid-column: 1 / -1; font-size: 11px; color: var(--text-3); margin-top: -2px; }
.bd-track { height: 10px; }
.bd-fill { height: 100%; background: var(--operating-strong); border-radius: 0 4px 4px 0; min-width: 2px; }
.bd-fill.reserve { background: var(--reserve); }
.bd-row.item .bd-fill { background: var(--operating); height: 70%; margin-top: 1.5px; }
.bd-amt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bd-pct { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
.bd-row.item .bd-amt { font-weight: 500; }
.bd-row.neg .bd-amt { color: var(--negative); }
.bd-row.total { font-weight: 700; border-bottom: none; border-top: 1px solid var(--border-strong); border-radius: 0; margin-top: 2px; }
.bd-row.total .bd-pct { font-weight: 500; }

/* ---------- Callout ---------- */
.callout { background: var(--warning-soft); border: 1px solid var(--warning-border); border-radius: var(--radius); padding: 14px 18px; }
.callout-title { font-weight: 650; color: var(--warning-text); margin-bottom: 6px; }
.callout ul { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.callout li { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: #4e1d09; }
.callout li .dot { position: relative; top: 1px; }
.callout li b { white-space: nowrap; }
.fine-print { font-size: 11px; color: var(--text-3); margin: 8px 0 0; }

/* ---------- Tabs and tables ---------- */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--border); margin: -4px -20px 16px; padding: 0 20px; overflow-x: auto; overflow-y: hidden; }
.tab {
  border: none; background: none; padding: 10px 12px; font-weight: 550; color: var(--text-3); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel-note { color: var(--text-2); font-size: 13px; margin: 0 0 12px; max-width: 900px; }
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-toolbar .panel-note { margin: 0; }

.table-scroll { max-height: 520px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.table-scroll.tall { max-height: 600px; }
.table-scroll.auto { max-height: none; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2);
  font-size: 12px; font-weight: 600; text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 8px 12px; border-bottom: 1px solid #f2f4f7; vertical-align: middle; }
.data-table tbody tr:hover td { background: #fcfcfd; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.center { text-align: center !important; }
.neg { color: var(--negative); }
.total-row td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); border-bottom: none; }

.compare-table th.scn { min-width: 190px; width: 26%; }
.compare-table td.wrap { white-space: normal; font-size: 12px; color: var(--text-2); }
.compare-table th.scn span { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 13px; }
.compare-table td:first-child { color: var(--text-2); }
.compare-table tr.group td { background: var(--surface-2); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); padding-top: 10px; }
.compare-table td.best { font-weight: 700; }

.group-row td { background: var(--surface-2) !important; font-weight: 650; color: var(--text); }
.group-row .group-sub { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 8px; }
.defer-input {
  width: 60px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 6px; text-align: center;
}
.op-check { width: 16px; height: 16px; accent-color: var(--accent); }
tr.muted td { color: var(--text-3); }
.project-note { display: block; font-size: 11px; color: var(--text-3); }
tr.muted .project-note { text-decoration: none; }

.category-row { cursor: pointer; }
.category-row td { font-weight: 600; }
.detail-row td { font-size: 12px; color: var(--text-2); }
.detail-row td:first-child { padding-left: 34px; }
.caret { display: inline-block; width: 14px; color: var(--text-3); transition: transform 0.15s; }
.caret.rotate { transform: rotate(90deg); }
.up { color: var(--negative); }
.down { color: var(--positive); }

.yearly-table td, .yearly-table th { font-size: 12px; padding: 7px 10px; }
.yearly-table td.neg { font-weight: 600; }
.yearly-table .projects-cell { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-3); }

.footer { text-align: center; font-size: 12px; color: var(--text-3); }

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