:root {
  --font: 'Satoshi', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --radius: 10px;

  --bg: #F7F6F2;
  --surface: #FBFBF9;
  --surface-2: #F1EFE9;
  --border: #D4D1CA;
  --border-strong: #B9B6AE;
  --text: #28251D;
  --muted: #66655F;
  --primary: #01696F;
  --primary-hover: #0C4E54;
  --on-primary: #FFFFFF;
  --primary-tint: #E1EEEE;
  --error: #A12C7B;
  --warning: #964219;
  --success: #437A22;
  --highlight: #FFF2B8;
  --shadow: 0 1px 2px rgba(40, 37, 29, 0.06);

  --tx-bg: #FEF3E6; --tx-border: #EBA563; --tx-fg: #8A4500; --tx-solid: #B45309;
  --td-bg: #FDECEC; --td-border: #E08A8A; --td-fg: #9B1C1C; --td-solid: #B91C1C;
  --tf-bg: #EAF5E4; --tf-border: #8CC27A; --tf-fg: #2F6B1A; --tf-solid: #2F7D1F;
}

[data-theme='dark'] {
  --bg: #171614;
  --surface: #1C1B19;
  --surface-2: #232220;
  --border: #393836;
  --border-strong: #55534F;
  --text: #CDCCCA;
  --muted: #9C9A95;
  --primary: #4F98A3;
  --primary-hover: #6FB1BB;
  --on-primary: #10201F;
  --primary-tint: #1E2E30;
  --error: #D163A7;
  --warning: #E0905F;
  --success: #6DAA45;
  --highlight: #4A4220;
  --shadow: none;

  --tx-bg: #2A1F12; --tx-border: #8A5A26; --tx-fg: #F5B56B; --tx-solid: #B45309;
  --td-bg: #2C1717; --td-border: #8A3A3A; --td-fg: #F09A9A; --td-solid: #B91C1C;
  --tf-bg: #182715; --tf-border: #4F7A3F; --tf-fg: #9FD487; --tf-solid: #2F7D1F;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
}
h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--s6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: var(--s3); color: var(--primary); }
.logo { width: 36px; height: 36px; flex: none; }
.brand h1 { font-size: var(--text-lg); font-weight: 700; color: var(--text); line-height: 1.2; }
.brand-sub { font-size: var(--text-sm); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: var(--s2); }

.btn {
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 7px 12px; font-size: var(--text-sm); font-weight: 500; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.banner {
  display: flex; align-items: center; gap: var(--s3);
  margin: var(--s4) var(--s6) 0; padding: var(--s3) var(--s4);
  background: var(--primary-tint); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: var(--text-sm);
}
.banner[hidden] { display: none; }
.banner-x { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 6px; }

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6);
  padding: var(--s6); max-width: 1480px; margin: 0 auto;
}
@media (min-width: 1100px) {
  .layout { grid-template-columns: 420px minmax(0, 1fr); align-items: start; }
}
.col-left, .col-right { display: flex; flex-direction: column; gap: var(--s6); min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s5); box-shadow: var(--shadow); min-width: 0;
}
.card-head { margin-bottom: var(--s4); }
.card-head.row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); flex-wrap: wrap; }
.card h2 { font-size: var(--text-lg); font-weight: 700; display: flex; align-items: center; gap: var(--s2); line-height: 1.3; }
.step {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font-size: var(--text-xs); font-weight: 700; flex: none;
}
.hint { font-size: var(--text-sm); color: var(--muted); margin-top: var(--s1); }
.hint.small { font-size: var(--text-xs); margin-top: var(--s3); }

/* ---------- inputs ---------- */
.cat-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.cat { padding: var(--s4) 0; border-bottom: 1px solid var(--border); }
.cat-top { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.cat-name { font-weight: 700; font-size: var(--text-base); }
.tag {
  margin-left: auto; font-size: var(--text-xs); font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.tag.taxable { background: var(--tx-solid); color: #fff; }
.tag.deferred { background: var(--td-solid); color: #fff; }
.tag.free { background: var(--tf-solid); color: #fff; }
.tag option { background: var(--surface); color: var(--text); }
.tax-select {
  font-size: var(--text-xs); border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  padding: 2px 4px; cursor: pointer; color: var(--muted);
}

.pair { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s3); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-size: var(--text-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.field-note { font-size: var(--text-xs); color: var(--muted); }
.input-wrap {
  display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--bg); padding: 0 10px; min-height: 40px; transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.input-wrap input {
  border: 0; background: transparent; width: 100%; min-width: 0; padding: 8px 0; outline: none;
  font-variant-numeric: tabular-nums;
}
.input-wrap .prefix, .input-wrap .suffix { color: var(--muted); font-size: var(--text-sm); flex: none; }
.input-wrap .prefix { margin-right: 4px; }
.input-wrap .suffix { margin-left: 4px; }
.input-wrap input[type='number'] { -moz-appearance: textfield; appearance: textfield; }
.input-wrap input[type='number']::-webkit-outer-spin-button,
.input-wrap input[type='number']::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.ov-toggle {
  margin-top: var(--s3); display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; padding: 4px 0; cursor: pointer; color: var(--primary);
  font-size: var(--text-sm); font-weight: 700;
}
.ov-toggle:hover { color: var(--primary-hover); }
.ov-toggle .chev { transition: transform 0.15s; display: inline-block; }
.ov-toggle[aria-expanded='true'] .chev { transform: rotate(90deg); }
.ov-count {
  background: var(--primary); color: var(--on-primary); border-radius: 999px; font-size: var(--text-xs);
  min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px;
}
.ov-panel { margin-top: var(--s2); padding: var(--s3); background: var(--surface-2); border-radius: 8px; border: 1px solid var(--border); }
.ov-panel[hidden] { display: none; }
.ov-help { font-size: var(--text-xs); color: var(--muted); margin-bottom: var(--s3); }
.ov-head, .ov-row { display: grid; grid-template-columns: 1fr 1fr 1fr 32px; gap: var(--s2); align-items: center; }
.ov-head { font-size: var(--text-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; }
.ov-row { margin-bottom: var(--s2); }
.ov-row .input-wrap { min-height: 36px; padding: 0 8px; background: var(--surface); }
.ov-row .input-wrap input { padding: 5px 0; }
.ov-msg { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--warning); margin-top: -2px; }
.ov-del {
  width: 32px; height: 32px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1;
}
.ov-del:hover { background: var(--surface); border-color: var(--border); color: var(--error); }
.ov-add { margin-top: 2px; }

.total-row { display: flex; justify-content: space-between; padding: var(--s4) 0 0; font-size: var(--text-base); }

.assump-grid { display: grid; gap: var(--s4); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s4); }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s4) var(--s5); box-shadow: var(--shadow);
}
.kpi .k-label { font-size: var(--text-sm); color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi .k-value { font-size: var(--text-xl); font-weight: 700; margin-top: 4px; line-height: 1.2; }
.kpi .k-sub { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.kpi.total { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.kpi.total .k-label, .kpi.total .k-sub { color: var(--on-primary); opacity: 0.85; }

/* ---------- chart ---------- */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.chart-wrap { position: relative; height: 400px; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.legend-item {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); cursor: pointer; font-size: var(--text-sm);
}
.legend-item:hover { background: var(--surface-2); }
.legend-item[aria-pressed='false'] { opacity: 0.45; }
.legend-item[aria-pressed='false'] .l-name { text-decoration: line-through; }
.legend-item .l-val { color: var(--muted); font-size: var(--text-xs); }
.legend-key { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); align-items: center; color: var(--muted); }
.key { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- tables ---------- */
.table-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.table-scroll.tall { max-height: 540px; }
.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--text-sm); }
.tbl th, .tbl td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
.tbl th { background: var(--surface-2); font-weight: 700; font-size: var(--text-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; position: sticky; top: 0; z-index: 2; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .name-cell { display: inline-flex; align-items: center; gap: 8px; }
.tbl tr.grp td { background: var(--surface-2); font-weight: 700; text-align: left; }
.tbl tr.grp td .g-desc { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: var(--text-xs); }
.tbl tr.sub td { font-weight: 700; background: var(--surface); border-bottom: 1px solid var(--border-strong); }
.tbl tr.grand td { font-weight: 700; background: var(--primary); color: var(--on-primary); border-bottom: 0; }
.tbl td.num-pos { color: var(--success); }
.tbl td.num-neg { color: var(--error); }
.tbl tr.grand td.num-pos, .tbl tr.grand td.num-neg { color: var(--on-primary); }
.muted { color: var(--muted); }

.yearly th:nth-child(1), .yearly td:nth-child(1),
.yearly th:nth-child(2), .yearly td:nth-child(2) { position: sticky; background: var(--surface); text-align: center; }
.yearly th:nth-child(1), .yearly td:nth-child(1) { left: 0; min-width: 56px; z-index: 1; }
.yearly th:nth-child(2), .yearly td:nth-child(2) { left: 56px; min-width: 76px; z-index: 1; border-right: 1px solid var(--border); }
.yearly th:nth-child(1), .yearly th:nth-child(2) { z-index: 3; background: var(--surface-2); }
.yearly tr.retire td { background: var(--highlight); }
.yearly tr.retire td:nth-child(1), .yearly tr.retire td:nth-child(2) { background: var(--highlight); }
.yearly th.tot, .yearly td.tot { border-left: 1px solid var(--border-strong); font-weight: 700; }
.yearly th .th-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: baseline; }
.ov-cell { text-decoration: underline; text-decoration-style: dotted; text-decoration-thickness: 2px; text-underline-offset: 4px; color: var(--primary); font-weight: 700; }

.impact {
  margin-bottom: var(--s4); padding: var(--s3) var(--s4); border-radius: 8px; background: var(--primary-tint);
  border: 1px solid var(--border); font-size: var(--text-sm);
}
.impact[hidden] { display: none; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { border: 0; background: var(--surface); padding: 7px 12px; font-size: var(--text-sm); cursor: pointer; font-weight: 500; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.is-on { background: var(--primary); color: var(--on-primary); }
.table-controls { display: flex; gap: var(--s2); flex-wrap: wrap; }

.empty { padding: var(--s8); text-align: center; color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: var(--text-xs); padding: var(--s4) var(--s6) var(--s8); }

@media (max-width: 640px) {
  .topbar { padding: var(--s3) var(--s4); flex-wrap: wrap; }
  .brand-sub { display: none; }
  .layout { padding: var(--s4); gap: var(--s4); }
  .banner { margin: var(--s3) var(--s4) 0; }
  .card { padding: var(--s4); }
  .chart-wrap { height: 320px; }
  .top-actions .btn { padding: 6px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

select.tag { border: 0; cursor: pointer; padding: 3px 6px; margin-left: auto; font-family: inherit; }

/* Same-origin embed mode used by dimeguard.com. The standalone app keeps its
   original header and footer when opened without ?embed=1. */
.is-embedded body { background: transparent; }
.is-embedded .topbar,
.is-embedded .foot { display: none; }
.is-embedded .layout {
  max-width: none;
  padding: 0;
}
.is-embedded .banner {
  max-width: none;
  margin: var(--s3) 0 0;
}

select.tag:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.chart-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted);
  font-size: var(--text-sm); pointer-events: none; padding: var(--s6);
}

#summaryTable th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
#summaryTable th, #summaryTable td { padding: 9px 10px; }
#summaryTable th:first-child, #summaryTable td:first-child { min-width: 170px; }

/* ---------- tax groups ---------- */
.taxable { --g-bg: var(--tx-bg); --g-border: var(--tx-border); --g-fg: var(--tx-fg); --g-solid: var(--tx-solid); }
.deferred { --g-bg: var(--td-bg); --g-border: var(--td-border); --g-fg: var(--td-fg); --g-solid: var(--td-solid); }
.free { --g-bg: var(--tf-bg); --g-border: var(--tf-border); --g-fg: var(--tf-fg); --g-solid: var(--tf-solid); }
.cat-list { border-top: 0; gap: var(--s4); }
.grp-box { background: var(--g-bg); border: 1.5px solid var(--g-border); border-radius: var(--radius); padding: 0 var(--s4); }
.grp-box > header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--g-border); }
.grp-title { font-weight: 700; color: var(--g-fg); font-size: var(--text-base); display: flex; align-items: center; gap: 8px; }
.grp-title::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--g-solid); }
.grp-desc { font-size: var(--text-xs); color: var(--g-fg); opacity: 0.9; text-align: right; }
.grp-box .cat { border-bottom: 1px solid var(--g-border); }
.grp-box .cat:last-child { border-bottom: 0; }
.grp-box .input-wrap { background: var(--surface); }
.grp-box .ov-panel { background: var(--surface); }
.grp-box .ov-row .input-wrap { background: var(--bg); }
.grp-empty { padding: var(--s3) 0; font-size: var(--text-sm); color: var(--g-fg); }
.pair + .pair { margin-top: var(--s3); }
.cat-note { font-size: var(--text-xs); color: var(--muted); margin-top: var(--s2); }
.floor-note { font-size: var(--text-xs); margin-top: var(--s2); padding: 6px 10px; border-radius: 6px; background: var(--surface); border: 1px dashed var(--tf-border); color: var(--tf-fg); }
.floor-note[hidden] { display: none; }
.tax-ov { margin-top: calc(-1 * var(--s2)); }
.tax-ov .ov-toggle { margin-top: 0; }

.kpi { border-left: 4px solid var(--g-solid, var(--border)); }
.kpi.total { border-left-color: var(--primary); }

.tbl tr.grp td { background: var(--g-bg); color: var(--g-fg); border-bottom: 1px solid var(--g-border); }
.tbl tr.grp td .g-desc { color: var(--g-fg); opacity: 0.85; }
.tbl tr.pen td { font-style: normal; }
.tbl tr.pen td .pen-note { display: block; font-size: var(--text-xs); color: var(--muted); }
.yearly .th-tax { text-transform: none; font-weight: 700; color: var(--g-fg); }
.floor-cell { color: var(--tf-fg); font-weight: 700; background: var(--tf-bg); }

.pension-sec { margin-top: var(--s6); }
.pension-sec h3 { font-size: var(--text-base); font-weight: 700; margin: 0; }
.pension-sec .table-scroll { margin-top: var(--s3); }
.tbl.pension tbody tr { cursor: pointer; }
.tbl.pension tbody tr:hover td { background: var(--surface-2); }
.tbl.pension tr.sel td { background: var(--td-bg); font-weight: 700; }
.tbl.pension td:first-child label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.tbl.pension input[type=radio] { accent-color: var(--td-solid); width: 16px; height: 16px; }
.best-tag { font-size: var(--text-xs); font-weight: 700; color: var(--tf-fg); background: var(--tf-bg); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
.grp-title { white-space: nowrap; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.tbl.pension th { white-space: normal; line-height: 1.25; vertical-align: bottom; }
.tbl.pension th, .tbl.pension td { padding: 9px 10px; }

/* ---------- v3: withdrawals, dialog ---------- */
.check.small { font-size: var(--text-sm); margin-top: 4px; }
.field-note.warn { color: var(--warning); font-weight: 700; }
.chart-wrap.short { height: 300px; }
.legend.static { margin-top: var(--s3); }
.legend.static .legend-item { cursor: default; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.plan-note { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.plan-note .pn { border: 1px solid var(--border); border-radius: 8px; padding: var(--s3) var(--s4); background: var(--surface-2); }
.plan-note .pn-l { font-size: var(--text-xs); color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.plan-note .pn-v { font-size: var(--text-lg); font-weight: 700; margin-top: 2px; }
.plan-note .pn-s { font-size: var(--text-xs); color: var(--muted); }
.plan-note .pn.bad .pn-v { color: var(--error); }
.plan-note .pn.good .pn-v { color: var(--success); }
.link-btn { border: 0; background: none; padding: 0; margin-left: 8px; color: var(--primary); font-weight: 700; font-size: var(--text-xs); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--primary-hover); }
.cat .link-btn { margin-left: 0; margin-top: var(--s2); font-size: var(--text-sm); display: inline-block; }
.rmd-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.03em; color: var(--td-fg); background: var(--td-bg); border: 1px solid var(--td-border); border-radius: 4px; padding: 0 4px; margin-left: 4px; vertical-align: 1px; }
.yearly tr.pstart td { box-shadow: inset 0 -2px 0 var(--td-solid); }
.yearly tr.short td { color: var(--error); }
.yearly td.age, .yearly th.age { font-weight: 700; }
.wd th:nth-child(1), .wd td:nth-child(1) { min-width: 56px; }
td.paid { color: var(--muted); font-style: normal; font-size: var(--text-xs); }

.dlg { border: 1px solid var(--border); border-radius: 12px; padding: 0; background: var(--surface); color: var(--text); width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.dlg::backdrop { background: rgba(23, 22, 20, 0.5); }
.dlg-head { display: flex; justify-content: space-between; gap: var(--s4); align-items: flex-start; padding: var(--s5) var(--s5) var(--s3); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 5; }
.dlg-head h2 { font-size: var(--text-lg); font-weight: 700; }
.dlg-head .icon-btn { font-size: 22px; line-height: 1; flex: none; }
.dlg-body { padding: var(--s4) var(--s5) var(--s5); }
.auto-opt { display: flex; gap: 10px; align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid var(--border); border-radius: 8px; margin-bottom: var(--s3); cursor: pointer; font-size: var(--text-sm); }
.auto-opt.on { background: var(--primary-tint); border-color: var(--primary); }
.auto-opt input { accent-color: var(--primary); width: 16px; height: 16px; margin-top: 2px; }
.rec-tag { font-size: var(--text-xs); font-weight: 700; color: var(--on-primary); background: var(--primary); border-radius: 999px; padding: 1px 7px; margin-left: 6px; }
@media (max-width:640px){ .plan-note{grid-template-columns:1fr 1fr;} .plan-note .pn{padding:10px 12px} }

/* ---------- v4: inflation, remove, focus ---------- */
.infl { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.infl-rate { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-sm); font-weight: 700; color: var(--primary); cursor: text; }
.infl-rate.off { color: var(--muted); }
.inline-num { width: 3.4em; border: 0; border-bottom: 1.5px dashed currentColor; background: transparent; padding: 0 2px; font-weight: 700; color: inherit; text-align: right; -moz-appearance: textfield; appearance: textfield; }
.inline-num::-webkit-outer-spin-button, .inline-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.inline-num:focus { outline: none; border-bottom-style: solid; background: var(--primary-tint); border-radius: 3px 3px 0 0; }

.rm-btn { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 6px; font-size: var(--text-xs); font-weight: 700; padding: 3px 8px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.rm-btn:hover { color: var(--error); border-color: var(--error); }
.cat.is-removed .rm-btn { color: var(--on-primary); background: var(--primary); border-color: var(--primary); }
.cat.is-removed > :not(.cat-top) { opacity: 0.4; pointer-events: none; }
.cat.is-removed .cat-name { text-decoration: line-through; color: var(--muted); }
.cat .removed-note { display: none; font-size: var(--text-xs); color: var(--error); font-weight: 700; margin: -4px 0 var(--s2); opacity: 1 !important; pointer-events: auto !important; }
.cat.is-removed .removed-note { display: block; }
.cat-top .tag { margin-left: auto; }

.whatif { border: 1.5px solid var(--error); background: color-mix(in srgb, var(--error) 8%, var(--surface)); border-radius: var(--radius); padding: var(--s4) var(--s5); display: flex; gap: var(--s4); flex-wrap: wrap; align-items: center; justify-content: space-between; }
.whatif[hidden] { display: none; }
.whatif .wi-text { font-size: var(--text-sm); flex: 1 1 420px; }
.whatif .wi-text strong { font-weight: 700; }
.whatif .wi-grid { display: flex; gap: var(--s5); flex-wrap: wrap; margin-top: var(--s2); }
.whatif .wi-item .l { font-size: var(--text-xs); color: var(--muted); }
.whatif .wi-item .v { font-weight: 700; }
.whatif .wi-item .v .was { font-weight: 400; color: var(--muted); font-size: var(--text-xs); margin-left: 4px; }

.focus-info { min-height: 36px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: var(--text-sm); padding: 6px 10px; border-radius: 8px; border: 1px dashed var(--border); margin-bottom: var(--s2); }
.focus-info.on { border-style: solid; border-color: var(--fc, var(--primary)); background: var(--surface-2); }
.focus-info .f-sw { width: 26px; height: 4px; border-radius: 2px; }
.focus-info .f-name { font-weight: 700; }
.focus-info .btn { padding: 3px 10px; margin-left: auto; }
#mainChart { cursor: pointer; }

/* ---------- v5: rental property ---------- */
.static-tag { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: var(--text-xs); font-weight: 700; color: #fff; background: var(--tx-solid, #B45309); margin-left: auto; }
.cat select:not(.tag) { width: 100%; border: 0; background: transparent; font: inherit; color: inherit; padding: 0; }
.prop-box { margin-top: var(--s3); border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: var(--s3); font-size: var(--text-xs); }
.prop-box .pb-title { font-weight: 700; font-size: var(--text-sm); margin-bottom: 6px; }
.prop-box .pb-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px dashed var(--border); }
.prop-box .pb-row span:last-child { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.prop-box .pb-row.neg span:last-child { color: var(--error); }
.prop-box .pb-row.strong span { font-weight: 700; color: var(--primary); }
.prop-box .pb-sale { margin: 8px 0 0; line-height: 1.5; }
.sale-tag { background: var(--primary) !important; color: #fff !important; }
tr.sold td { background: color-mix(in srgb, var(--primary) 9%, transparent); }
.field[hidden] { display: none !important; }
.sell-pair:not(:has([data-sellage]:not([hidden]))) { grid-template-columns: 1fr; }
.pair[hidden] { display: none !important; }
.cat > .field { display: flex; flex-direction: column; margin: var(--s3) 0; }
