:root { --muted: var(--ink-2); --new: var(--brand); --old: var(--gold); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 40px 20px 32px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 28px; align-items: start; }
h1 { font: 600 clamp(28px, 4.5vw, 40px)/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 8px; }
h1 .fy { font-size: .5em; color: var(--brand); font-family: var(--sans); font-weight: 600; letter-spacing: 0; margin-left: 6px; }
.subtitle { color: var(--muted); margin: 0 0 20px; max-width: 62ch; }
.hint { font-size: 13px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.btn-secondary { background: var(--card); border: 1px solid var(--line); color: var(--ink); padding: 8px 16px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-head { padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; }
.card-head h2 { margin: 0; font: 600 18px var(--serif); }
.card-head.collapsible { cursor: pointer; user-select: none; }
.card-head.collapsible:hover h2 { color: var(--brand); }
.chev { color: var(--muted); transition: transform .15s ease; }
.card-head.open .chev { transform: rotate(180deg); }
.card-body { padding: 4px 18px 18px; }
.card-body.hidden { display: none; }

.grid { display: grid; gap: 12px 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; margin: 0; }
.field .help { cursor: help; color: var(--brand); font-size: 12px; }
input, select { width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }

.result-col { position: sticky; top: 16px; }
.results { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; }
.verdict { border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: var(--brand); color: var(--brand-ink); }
.verdict.old { background: var(--gold); color: #fff; }
.verdict-main { font: 600 20px var(--serif); }
.verdict-sub { font-size: 13px; opacity: .92; margin-top: 2px; }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.regime-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.regime-card.win { border-color: var(--brand); background: var(--brand-soft); }
.rc-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rc-tax { font: 600 24px var(--serif); margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.rc-sub { font-size: 11px; color: var(--muted); }
.rc-line { font-size: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

.mini-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
table.breakdown { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.breakdown th, table.breakdown td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
table.breakdown th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
table.breakdown .num { text-align: right; }
table.breakdown tr.strong td { font-weight: 700; background: var(--bg-2); }

/* monthly grids */
.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.mgrid { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
table.mgrid th, table.mgrid td { padding: 3px 4px; }
table.mgrid thead th { color: var(--muted); font-weight: 600; font-size: 11px; text-align: center; }
table.mgrid thead th.rowlab { text-align: left; }
table.mgrid th.rowlab { position: sticky; left: 0; background: var(--card); z-index: 2; text-align: left; font-weight: 600; font-size: 12px; white-space: nowrap; padding-right: 10px; min-width: 150px; }
table.mgrid td.tot, table.mgrid th.tot { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; padding-left: 10px; min-width: 74px; }
input.mcell { width: 76px; padding: 5px 6px; border-radius: 6px; font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
input.mcell.manual { border-color: var(--ink-2); background: var(--bg-2); font-weight: 600; }
.gridhint { color: var(--muted); font-size: 12px; margin-top: 8px; }
.field.note { font-size: 12px; color: var(--muted); background: var(--bg-2); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; }

table.msum { border-collapse: collapse; font-size: 11.5px; min-width: 100%; font-variant-numeric: tabular-nums; }
table.msum th, table.msum td { padding: 5px 7px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.msum thead th { color: var(--muted); font-weight: 600; font-size: 10.5px; }
table.msum td:first-child, table.msum th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); font-weight: 600; }
table.msum tr.strong td { font-weight: 700; background: var(--bg-2); }
table.msum tr.strong td:first-child { background: var(--bg-2); }
table.msum .tot { font-weight: 700; }

.warn { margin-top: 12px; padding: 10px 12px; background: var(--warn-bg); border: 1px solid var(--warn); border-radius: 10px; font-size: 12.5px; color: var(--warn); }
.note-line { margin-top: 8px; font-size: 12px; color: var(--muted); }
.panel-note { font-size: 13px; line-height: 1.55; background: var(--bg-2); border-radius: 10px; padding: 10px 12px; }
.panel-note b { font-variant-numeric: tabular-nums; }
.fine { margin-top: 6px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.btn-link { background: none; border: 0; padding: 0; margin-top: 6px; color: var(--brand); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
table.breakdown.adv { margin-top: 8px; }
table.breakdown .pct { color: var(--muted); font-size: 11px; }
.prev-emp { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 12px; }
.add-emp { margin-top: 12px; }
.disclaimer { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.foot { padding: 8px 20px 56px; color: var(--muted); font-size: 13px; }
.foot a { color: var(--brand); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .result-col { position: static; order: -1; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .cols-2, .cols-3 { grid-template-columns: 1fr; } }
