/* KitaAgad Tax: light, neutral, charcoal. Pastel pills. Tabular numbers. */
:root {
  --bg: #f6f6f3; --surface: #ffffff; --soft: #f1f1ed; --line: #e6e5df; --line-2: #d9d8d0;
  --text: #1d1f23; --muted: #666a72; --faint: #8b8f97;
  --ink: #202328; --ink-2: #33373d; --on-ink: #ffffff;
  --mint: #dcf2e4; --mint-t: #17603a; --butter: #fbefc6; --butter-t: #75560a;
  --peach: #fddfcb; --peach-t: #873a10; --rose: #fad6dc; --rose-t: #8d1d31; --grey: #ebebe7; --grey-t: #52565d;
  --bar-mint: #6dc590; --bar-butter: #e8c34f; --bar-peach: #ee9a63; --bar-rose: #de6579;
  --radius: 12px; --shadow: 0 1px 2px rgba(29, 31, 35, .05), 0 1px 1px rgba(29, 31, 35, .03);
  --side: 232px;
  --font: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; overflow-x: hidden; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.num, td.num, th.num { text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.brand b { display: block; font-size: 15px; letter-spacing: .02em; } .brand small { color: var(--muted); font-size: 11px; display: block; margin-top: -2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.nav a:hover { background: var(--soft); }
.nav a[aria-current=page] { background: var(--ink); color: #fff; } .nav a[aria-current=page] svg { opacity: 1; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; display: grid; gap: 4px; }
.main { min-width: 0; padding: 26px 32px 60px; max-width: 1280px; width: 100%; }
.topbar { display: none; }
.tabbar { display: none; }
.sheet { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; } .page-head .sub { color: var(--muted); margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 4px; } .crumb a { text-decoration: none; } .crumb a:hover { text-decoration: underline; }

/* ---------- cards, grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; } .card-head .sub { color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 16px; } .grid .card + .card { margin-top: 0; }
.g-kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; margin-bottom: 16px; }
.stack { display: grid; gap: 16px; }
.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 22px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.kpi .meta { color: var(--muted); font-size: 12px; }
.kpi.par { background: var(--grey); border-color: transparent; }
.kpi.par.mint { background: var(--mint); } .kpi.par.butter { background: var(--butter); } .kpi.par.peach { background: var(--peach); } .kpi.par.rose { background: var(--rose); }
.kpi.par .value { font-size: 34px; font-weight: 700; } .kpi.par .label, .kpi.par .meta { color: inherit; opacity: .8; }
.kpi.par.mint { color: var(--mint-t); } .kpi.par.butter { color: var(--butter-t); } .kpi.par.peach { color: var(--peach-t); } .kpi.par.rose { color: var(--rose-t); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 550; }
.banner { background: var(--butter); color: var(--butter-t); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.banner.info { background: var(--soft); color: var(--ink-2); }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--butter); color: var(--butter-t); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }

/* ---------- pills, buttons ---------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--grey); color: var(--grey-t); }
.pill.mint { background: var(--mint); color: var(--mint-t); } .pill.butter { background: var(--butter); color: var(--butter-t); }
.pill.peach { background: var(--peach); color: var(--peach-t); } .pill.rose { background: var(--rose); color: var(--rose-t); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; } .btn.primary:hover { background: var(--ink-2); }
.btn.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn { border: 0; background: none; font-size: 24px; line-height: 1; padding: 4px 10px; cursor: pointer; color: var(--muted); border-radius: 8px; } .icon-btn:hover { background: var(--soft); }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; font-weight: 500; }
.chip[aria-pressed=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip .n { opacity: .6; margin-left: 4px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -18px; padding: 0 18px; }
.table-wrap.tall { max-height: 460px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #fafaf8; }
td a.row-link { text-decoration: none; font-weight: 550; } td a.row-link:hover { text-decoration: underline; }
tfoot td { font-weight: 650; border-top: 1px solid var(--line-2); background: #fafaf8; }
.cell-sub { color: var(--muted); font-size: 12px; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.field label { font-weight: 550; font-size: 13px; } .field .req { color: var(--rose-t); margin-left: 2px; }
input[type=text], input[type=number], input[type=date], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); }
textarea { resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input.invalid, select.invalid { border-color: #d36a7c; background: #fff8f9; }
.help { color: var(--muted); font-size: 12px; } .err { color: var(--rose-t); font-size: 12px; font-weight: 550; } .err:empty { display: none; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; } .check input { width: 18px; height: 18px; accent-color: var(--ink); }
.form-alert { background: var(--rose); color: var(--rose-t); padding: 8px 12px; border-radius: 9px; font-weight: 550; font-size: 13px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.searchbar { position: relative; } .searchbar input { padding-left: 34px; }
.searchbar svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--faint); fill: none; stroke-width: 2; stroke-linecap: round; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; } .toolbar .searchbar { flex: 1 1 260px; max-width: 420px; }
.results { display: grid; gap: 4px; margin-top: 8px; }
.result { display: flex; justify-content: space-between; gap: 12px; text-align: left; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; width: 100%; }
.result:hover, .result:focus-visible { background: var(--soft); }
.result.sel { border-color: var(--ink); background: var(--soft); }

/* ---------- bits ---------- */
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 118px; gap: 12px; align-items: center; }
.bar-track { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; min-width: 3px; } .bar-fill.current { background: var(--bar-mint); } .bar-fill.b1 { background: var(--bar-butter); } .bar-fill.b2 { background: var(--bar-peach); } .bar-fill.b3 { background: var(--bar-rose); }
.stackbar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--soft); margin: 10px 0; } .stackbar span { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; } .legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.list { display: grid; } .list-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; text-decoration: none; } .list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: #fafaf8; }
.checklist { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; } .checklist label { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; cursor: pointer; } .checklist input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ink); flex: none; }
.checklist input:checked + span { color: var(--faint); text-decoration: line-through; }
.countdown { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.countdown .big { font-size: 44px; line-height: 1; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); } .empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--muted); gap: 12px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--soft), #f8f8f5, var(--soft)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.steps { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 550; color: var(--muted); cursor: pointer; }
.step b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-size: 12px; color: var(--ink); }
.step.on { color: var(--text); border-color: var(--ink); } .step.on b { background: var(--ink); color: #fff; }
.msg { display: grid; gap: 6px; margin-bottom: 8px; } .msg > div { padding: 9px 12px; border-radius: 9px; font-size: 13px; }
.msg .e { background: var(--rose); color: var(--rose-t); } .msg .w { background: var(--butter); color: var(--butter-t); } .msg .ok { background: var(--mint); color: var(--mint-t); }
.msg small { display: block; opacity: .75; margin-top: 2px; }
.alloc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 10px; } .alloc > div { background: var(--soft); border-radius: 10px; padding: 10px 12px; } .alloc small { display: block; color: var(--muted); } .alloc b { font-size: 16px; }
.settings-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; } .settings-row:last-child { border-bottom: 0; }
.settings-row .t { font-weight: 600; } .settings-row .help { margin-top: 2px; }
.report-card { display: flex; flex-direction: column; gap: 6px; } .report-card .actions { margin-top: auto; justify-content: flex-start; }
#toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; font-weight: 550; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
#toast.show { opacity: 1; transform: translate(-50%, 0); } #toast.error { background: var(--rose-t); }

dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); color: var(--text); background: var(--surface); }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(29, 31, 35, .4); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; } .modal-head h2 { font-size: 16px; }
.modal-body { padding: 18px; }

/* ---------- print doc ---------- */
.print-only { display: none; }
.print-doc { background: var(--surface); }
.print-doc h2 { font-size: 15px; margin: 22px 0 8px; } .print-doc table { font-size: 12px; } .print-doc th, .print-doc td { padding: 5px 8px; }
.print-doc .doc-head { border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 14px; }
.print-doc .doc-head h1 { font-size: 22px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g-main { grid-template-columns: minmax(0, 1fr); } .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .app { display: block; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .topbar .brand { padding: 0; }
  .main { padding: 18px 14px 96px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 550; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer; }
  .tabbar svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[aria-current=page] { color: var(--text); }
  .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-radius: 18px 18px 0 0; padding: 14px 14px calc(76px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); }
  .sheet:not([hidden]) { display: grid; gap: 4px; }
  .sheet a { display: flex; gap: 12px; padding: 12px; border-radius: 10px; text-decoration: none; font-weight: 550; align-items: center; } .sheet a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
  .sheet a:active, .sheet a[aria-current=page] { background: var(--soft); }
  .g-kpi, .g-2, .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-kpi .kpi.par { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 21px; }
  .card { padding: 14px; } .table-wrap { margin: 0 -14px; padding: 0 14px; }
  .bar-row { grid-template-columns: 96px minmax(0, 1fr); } .bar-row .bar-val { grid-column: 1 / -1; margin-top: -6px; }
  .alloc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .countdown .big { font-size: 38px; }
  dialog.modal { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0; max-height: 92vh; }
}
@media (max-width: 420px) { .g-kpi { gap: 10px; } .kpi .value { font-size: 18px; } .kpi.par .value { font-size: 30px; } }

/* ---------- print ---------- */
@page { size: A4; margin: 20mm 14mm 18mm; @bottom-right { content: 'Page ' counter(page) ' of ' counter(pages); font: 9pt 'Hanken Grotesk', sans-serif; color: #666; } @bottom-left { content: 'KitaAgad Tax'; font: 9pt 'Hanken Grotesk', sans-serif; color: #999; } }
@media print {
  body { background: #fff; font-size: 11pt; }
  .sidebar, .topbar, .tabbar, .sheet, .no-print, #toast, dialog { display: none !important; }
  .app { display: block; } .main { padding: 0; max-width: none; }
  .print-only { display: block; }
  .print-run { position: fixed; top: -14mm; left: 0; right: 0; display: flex; justify-content: space-between; font-size: 9pt; color: #555; border-bottom: 1px solid #bbb; padding-bottom: 3px; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-doc h2 { break-after: avoid; } .print-doc section { break-before: page; } .print-doc section.first { break-before: auto; }
  tr { break-inside: avoid; } thead { display: table-header-group; }
  th { position: static; }
  .table-wrap, .table-wrap.tall { overflow: visible; max-height: none; margin: 0; padding: 0; }
  .pill { border: 1px solid #ccc; background: #fff !important; color: #000 !important; }
}

/* ---------- KitaAgad Tax additions ---------- */
.brand-mark { background: linear-gradient(145deg, #23272d, #1d6f5f); }
.g-kpi.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
a.chip { text-decoration: none; display: inline-block; }
.chip[aria-current=page] { background: var(--ink); color: #fff; border-color: var(--ink); }
.form-lines td.line { color: var(--muted); font-weight: 600; width: 72px; white-space: nowrap; }
.form-lines tr.total td { font-weight: 700; background: var(--soft); }
.copy-btn { border: 1px solid var(--line-2); background: var(--surface); border-radius: 7px; padding: 2px 8px; font-size: 12px; cursor: pointer; }
.copy-btn.done { background: var(--mint); color: var(--mint-t); border-color: transparent; }
.locked { border: 1px dashed var(--line-2); background: var(--soft); border-radius: var(--radius); padding: 18px; }
.locked b { display: block; margin-bottom: 4px; }
.verify { display: inline-block; font-size: 11px; font-weight: 600; color: var(--butter-t); background: var(--butter); border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.source { color: var(--faint); font-size: 12px; }
.meter { height: 12px; background: var(--soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter > span { display: block; height: 100%; background: var(--bar-mint); border-radius: 999px; }
.meter.watch > span { background: var(--bar-butter); } .meter.crossed > span { background: var(--bar-rose); }
.regime-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.regime { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.regime.best { border-color: var(--mint-t); box-shadow: 0 0 0 2px var(--mint); }
.regime .total { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.reveal { background: var(--mint); color: var(--mint-t); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.reveal .big { font-size: 26px; font-weight: 750; display: block; letter-spacing: -.02em; }
pre.dat { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 12px; overflow-x: auto; white-space: pre; }
.disclaimer { color: var(--faint); font-size: 12px; margin: 22px 0 8px; max-width: 760px; }
@media (max-width: 860px) {
  .g-kpi.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .regime-grid { grid-template-columns: 1fr; }
}
.reveal.warn { background: var(--butter); color: var(--butter-t); }
@media (max-width: 520px) {
  .form-lines { font-size: 13px; }
  .form-lines td.line { width: 40px; }
  .form-lines th:first-child, .form-lines td.line { padding-right: 4px; }
}

/* ---------- BIR-layout forms: the printed faces (bir-face.js) ----------
   Greyscale only (#000 #444 #D9D9D9 #E8E8E8 #fff). Self-drawn: no emblem, no stamp artwork, no machine-readable marks.
   One .bf-bfs per form page, on the form's own paper. Every class carries the bf- prefix so nothing here can touch the app. */
@page folio { size: 8.5in 13in; margin: 0; @bottom-left { content: none } @bottom-right { content: none } }
@page letter { size: 8.5in 11in; margin: 0; @bottom-left { content: none } @bottom-right { content: none } }
@page legal { size: 8.5in 14in; margin: 0; @bottom-left { content: none } @bottom-right { content: none } }
@page a4 { size: A4; margin: 0; @bottom-left { content: none } @bottom-right { content: none } }
.bf, .bf * { box-sizing: border-box; }
.bf-bfs { position: relative; background: #fff; color: #000; overflow: hidden; margin: 0 auto 18px; box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.08);
  font-family: Arial, Helvetica, sans-serif; font-size: 10.5px; line-height: 1.12; break-after: page; break-inside: avoid; text-align: left }
.bf-bfs.bf-folio { page: folio; width: 8.5in; height: 13in }
.bf-bfs.bf-letter { page: letter; width: 8.5in; height: 11in }
.bf-bfs.bf-legal { page: legal; width: 8.5in; height: 14in }
.bf-bfs.bf-a4 { page: a4; width: 210mm; height: 297mm }
.bf-bfs > .bf-pg { position: absolute; inset: .35in; display: flex; flex-direction: column; min-height: 0 }

/* ---------------------------------------------------------------- face: masthead */
.bf-bff .bf-mtop { flex: none; display: flex; align-items: stretch; justify-content: space-between; height: 34px; margin-bottom: 3px }
.bf-bff .bf-mtop .bf-biruse { width: 92px; border: 1px solid #000; display: grid; grid-template-columns: 1fr 1fr; font-size: 8.5px; line-height: 1.1; background: #E8E8E8 }
.bf-bff .bf-mtop .bf-biruse div { padding: 2px 3px } .bf-bff .bf-mtop .bf-biruse div + div { background: #fff; border-left: 1px solid #000 }
.bf-bff .bf-mtop .bf-rep { text-align: center; font-weight: 700; font-size: 10px; line-height: 1.2; align-self: center }
.bf-bff .bf-mtop .bf-gap { width: 92px }
.bf-bff .bf-frame { flex: 1; min-height: 0; border: 1.5px solid #000; display: flex; flex-direction: column }
.bf-bff .bf-band { flex: none; border-top: 1px solid #000; min-height: 0; position: relative }
.bf-bff .bf-mmain { flex: none; display: flex; min-height: 72px }
.bf-bff .bf-mmain .bf-mno { width: 118px; flex: none; border-right: 1px solid #000; text-align: center; padding: 4px 3px; font-size: 9.5px; display: flex; flex-direction: column; justify-content: center; gap: 1px }
.bf-bff .bf-mmain .bf-mno b.bf-n { font-size: 24px; line-height: 1; letter-spacing: -.5px }
.bf-bff .bf-mmain .bf-mno b.bf-p { font-size: 9.5px }
.bf-bff .bf-mmain .bf-mt { flex: 1; text-align: center; padding: 6px 6px 3px; display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0 }
.bf-bff .bf-mmain .bf-mt h1 { margin: 0; font-size: 19px; line-height: 1.05; font-weight: 700; white-space: pre-line }
.bf-bff .bf-mmain .bf-mt .bf-s { font-weight: 700; font-size: 10.5px; white-space: pre-line }
.bf-bff .bf-mmain .bf-mt .bf-i { font-size: 8px; font-style: italic; line-height: 1.15 }
.bf-bff .bf-mmain .bf-mc { width: 182px; flex: none; border-left: 1px solid #000; display: flex; align-items: flex-end; justify-content: flex-end; padding: 2px 4px; font-size: 9.5px }
.bf-bff.bf-compact .bf-mmain { min-height: 60px }
.bf-bff.bf-compact .bf-mmain .bf-mno { padding: 3px 2px; font-size: 9px; line-height: 1.05 }
.bf-bff.bf-compact .bf-mmain .bf-mno b.bf-n { font-size: 22px }
.bf-bff.bf-compact .bf-frame { flex: none }
.bf-bff.bf-compact .bf-mmain .bf-mt h1 { font-size: 17px }

/* ---------------------------------------------------------------- face: bands and cells */
.bf-bff .bf-bar { background: #D9D9D9; font-weight: 700; font-size: 10.5px; height: 15px; display: flex; align-items: center; padding: 0 4px; letter-spacing: .1px }
.bf-bff .bf-bar .bf-t { flex: 1; text-align: center; white-space: nowrap }
.bf-bff .bf-bar .bf-nt { flex: none; max-width: 40%; font-size: 6.4px; font-style: italic; font-weight: 700; text-align: right; line-height: 1.05 }
.bf-bff .bf-bar.bf-left .bf-t { text-align: left }
.bf-bff .bf-bar.bf-sm { background: #E8E8E8; font-weight: 400; height: 15px }
.bf-bff .bf-bar.bf-sm .bf-t { text-align: left; font-weight: 700 }
.bf-bff .bf-row { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)) }
.bf-bff .bf-row.bf-tot { background: #E8E8E8 }
.bf-bff .bf-row.bf-head { background: #E8E8E8; font-weight: 700 }
.bf-bff .bf-row.bf-head .bf-cell { justify-content: center; text-align: center }
.bf-bff .bf-cell { border-left: 1px solid #000; min-width: 0; min-height: 0; overflow: hidden; padding: 1px 3px; display: flex; align-items: center; gap: 4px; position: relative }
.bf-bff .bf-cell:first-child { border-left: 0 }
.bf-bff .bf-cell.bf-stack { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 1px; padding-top: 1px }
.bf-bff .bf-cell.bf-kids { padding: 0; gap: 0; align-items: stretch }
.bf-bff .bf-cell.bf-kids.bf-col { flex-direction: column }
.bf-bff .bf-cell.bf-kids.bf-col > .bf-cell { border-left: 0; border-top: 1px solid #000; flex: 1 1 0 }
.bf-bff .bf-cell.bf-kids.bf-col > .bf-cell:first-child { border-top: 0 }
.bf-bff .bf-cell.bf-kids.bf-rw { flex-direction: row }
.bf-bff .bf-cell.bf-kids.bf-rw > .bf-cell { border-left: 1px solid #000; flex: 1 1 0 }
.bf-bff .bf-cell.bf-kids.bf-rw > .bf-cell:first-child { border-left: 0 }
.bf-bff .bf-cell.bf-c { justify-content: center; text-align: center }
.bf-bff .bf-cell.bf-r { justify-content: flex-end; text-align: right }
.bf-bff .bf-cell.bf-bold { font-weight: 700 }
.bf-bff .bf-cell.bf-top { align-items: flex-start }
.bf-bff .bf-lh { line-height: 1.12; min-width: 0 }
.bf-bff .bf-lh .bf-no { font-weight: 700; font-size: 11px; margin-right: 3px }
.bf-bff .bf-lh .bf-lb { font-size: 10.5px }
.bf-bff .bf-cell.bf-nw .bf-lh { white-space: nowrap }
.bf-bff .bf-lh .bf-pre { margin-right: 3px }
.bf-bff .bf-lh .bf-sb { font-size: 8px; font-style: italic; font-weight: 400 }
.bf-bff .bf-lh .bf-sb.bf-n { font-size: 7.4px }
.bf-bff .bf-lh.bf-big .bf-lb { font-size: 11px }
.bf-bff .bf-ul { display: inline-block; width: 128px; border-bottom: 1px solid #000; height: 9px; vertical-align: baseline }
.bf-bff .bf-ul.bf-s { width: 52px }
.bf-bff .bf-row.bf-dn .bf-amt, .bf-bff .bf-row.bf-dn .bf-blank-amt { min-height: 13px; line-height: 13px; font-size: 11.5px }
.bf-bff .bf-row.bf-dn .bf-amt.bf-cents .bf-dot { line-height: 13px }
.bf-bff .bf-row.bf-dn .bf-cell { padding-top: 0; padding-bottom: 0 }
.bf-bff .bf-bx { flex: 1 1 auto; min-width: 0; align-self: stretch; display: flex; align-items: center }
.bf-bff .bf-cell.bf-stack > .bf-bx { align-self: stretch; flex: 1 1 auto }

.bf-bff .bf-cell.bf-shade { background: #D9D9D9 }
.bf-bff .bf-row.bf-hsm .bf-cell { font-size: 7px; line-height: 1.05; padding: 1px 2px; font-weight: 700 }
.bf-bff .bf-row.bf-hsm .bf-lb { font-size: 7px } .bf-bff .bf-row.bf-hsm .bf-sb { font-size: 6.6px; font-weight: 400; font-style: normal }
.bf-bff .bf-row.bf-fnote .bf-cell { font-size: 8px; border-left: 0; align-items: center } .bf-bff .bf-row.bf-fnote .bf-lb { font-size: 8px }
.bf-bff .bf-cell.bf-sm .bf-line, .bf-bff .bf-cell.bf-sm .bf-amt { font-size: 9.5px; line-height: 13px; letter-spacing: 0; min-height: 0; padding: 0 2px }
.bf-bff .bf-cell.bf-sm .bf-line { background: none; font-size: 8.5px; line-height: 9.5px }
.bf-bff .bf-cell.bf-sm { padding: 1px 1px }

/* boxes */
.bf-bff .bf-chars { display: flex; border: 1px solid #000; height: 16px; background: #fff; flex: none }
.bf-bff .bf-chars .bf-ch { flex: 1 1 0; min-width: 0; text-align: center; font: 700 12px/14px "Courier New", Courier, monospace; background: linear-gradient(#555, #555) left bottom / 1px 5px no-repeat }
.bf-bff .bf-chars .bf-ch:first-child { background: none }
.bf-bff .bf-chars .bf-sp { flex: none; width: 11px; background: #D9D9D9; text-align: center; font: 700 12px/14px "Courier New", Courier, monospace; border-left: 1px solid #000; border-right: 1px solid #000 }
.bf-bff .bf-chars .bf-gp { flex: none; width: 5px; border-left: 1px solid #000 }
.bf-bff .bf-line { border: 1px solid #000; width: 100%; min-height: 17px; padding: 0 2px; font: 700 12px/16px "Courier New", Courier, monospace; letter-spacing: .8px; white-space: pre-wrap; word-break: normal; overflow-wrap: anywhere; overflow: hidden;
  background: linear-gradient(90deg, #777 1px, transparent 1px) 0 100% / 8px 5px repeat-x }
.bf-bff .bf-line.bf-l2 { min-height: 34px }
.bf-bff .bf-amt { flex: 1; align-self: stretch; display: flex; justify-content: flex-end; align-items: center; border: 1px solid #000; padding: 0 3px; font: 700 12px/14px "Courier New", Courier, monospace; min-height: 14px; white-space: nowrap; overflow: hidden;
  background: linear-gradient(90deg, #888 1px, transparent 1px) 100% 100% / 12px 4px repeat-x }
.bf-bff .bf-amt.bf-cents { padding: 0; gap: 0; background: none }
.bf-bff .bf-amt.bf-cents .bf-pe { flex: 1; text-align: right; padding-right: 3px; min-width: 0 }
.bf-bff .bf-amt.bf-cents .bf-dot { flex: none; width: 10px; align-self: stretch; background: #D9D9D9; text-align: center; border-left: 1px solid #000; border-right: 1px solid #000; line-height: 14px }
.bf-bff .bf-amt.bf-cents .bf-ce { flex: none; width: 28px; padding-left: 4px; text-align: left }
.bf-bff .bf-blank-amt { flex: 1; align-self: stretch; border: 1px solid #000; min-height: 14px }
.bf-bff .bf-rate { display: flex; align-items: center; gap: 2px; flex: 1; align-self: stretch }
.bf-bff .bf-rate .bf-amt { flex: 1 }
.bf-bff .bf-chk { display: flex; flex-wrap: wrap; align-items: center; gap: 1px 12px; min-width: 0 }
.bf-bff .bf-chk.bf-grid { display: grid; gap: 2px 8px; align-items: center }
.bf-bff .bf-opt { display: inline-flex; align-items: flex-start; gap: 4px; min-width: 0; line-height: 1.1 }
.bf-bff .bf-opt .bf-tx { font-size: 10.5px } .bf-bff .bf-opt .bf-tx.bf-sm { font-size: 8.6px } .bf-bff .bf-opt .bf-tx i { font-size: 7.6px }
.bf-bff .bf-sq { flex: none; margin-top: 0; width: 11px; height: 11px; border: 1px solid #000; position: relative; background: #fff }
.bf-bff .bf-opt.bf-on .bf-sq::before, .bf-bff .bf-opt.bf-on .bf-sq::after { content: ""; position: absolute; left: 50%; top: -2px; width: 1.6px; height: 14px; background: #000; transform-origin: center }
.bf-bff .bf-opt.bf-on .bf-sq::before { transform: translateX(-50%) rotate(45deg) } .bf-bff .bf-opt.bf-on .bf-sq::after { transform: translateX(-50%) rotate(-45deg) }
.bf-bff .bf-opt.bf-on .bf-sq { overflow: hidden }

/* declaration, signature, payment, stamp, foot */
.bf-bff .bf-decl { background: #E8E8E8; font-size: 7.6px; line-height: 1.18; padding: 2px 4px; text-align: justify }
.bf-bff .bf-sign { display: flex }
.bf-bff .bf-sign .bf-sg { flex: 1; display: flex; flex-direction: column; border-left: 1px solid #000; min-width: 0 }
.bf-bff .bf-sign .bf-sg:first-child { border-left: 0 }
.bf-bff .bf-sign .bf-sg .bf-top { font-size: 9.5px; padding: 1px 4px }
.bf-bff .bf-sign .bf-sg .bf-sp { flex: 1 }
.bf-bff .bf-sign .bf-sg .bf-cap { text-align: center; font-size: 8.4px; line-height: 1.12; padding: 2px 6px 2px; border-top: 1px solid #000; margin: 0 14px }
.bf-bff .bf-sign.bf-hasbg .bf-sg .bf-cap { margin: 0; border-top: 1px solid #000; background: #E8E8E8 }
.bf-bff .bf-pay { display: grid }
.bf-bff .bf-pay .bf-pc { border-left: 1px solid #000; min-width: 0; min-height: 0; overflow: hidden; padding: 1px 3px; display: flex; align-items: center; border-top: 1px solid #000 }
.bf-bff .bf-pay .bf-pc:nth-child(-n+5) { border-top: 0 }
.bf-bff .bf-pay .bf-pc.bf-h { background: #E8E8E8; font-weight: 700; justify-content: center; text-align: center; font-size: 10.5px; line-height: 1.05 }
.bf-bff .bf-pay .bf-pc.bf-l { border-left: 0; font-size: 10.5px }
.bf-bff .bf-pay .bf-pc .bf-no { font-weight: 700; margin-right: 3px; font-size: 11px }
.bf-bff .bf-pay .bf-pc .bf-sb { font-size: 8px; font-style: italic }
.bf-bff .bf-pay .bf-pc .bf-chars { width: 100% }
.bf-bff .bf-stamp { display: flex; flex: 1 1 auto; min-height: 50px }
.bf-bff .bf-stamp .bf-sl { flex: 1.3; padding: 2px 4px; font-size: 8.4px; border-right: 1px solid #000 }
.bf-bff .bf-stamp .bf-sr { flex: 1; padding: 2px 4px; font-size: 8.4px; text-align: center; font-style: italic }
.bf-bff .bf-foot { flex: none; font-size: 8.8px; line-height: 1.18; padding: 3px 2px 0; display: flex; flex-direction: column; gap: 1px }
.bf-bff .bf-foot p { margin: 0 }
.bf-bff .bf-foot .bf-ind { padding-left: 14px }

/* static tables on the form (tax rates, ATC list) */
.bf-bff .bf-tbls { display: flex; gap: 8px; padding: 0 }
.bf-bff .bf-tbl { flex: 1; min-width: 0; border: 1px solid #000; border-top: 0; font-size: 7.8px }
.bf-bff .bf-tbls .bf-tbl { border-top: 1px solid #000 }
.bf-bff .bf-tbl .bf-tt { background: #D9D9D9; font-weight: 700; padding: 1px 4px; font-size: 9px; border-bottom: 1px solid #000 }
.bf-bff .bf-tbl .bf-th { display: grid; background: #E8E8E8; font-weight: 700; text-align: center; border-bottom: 1px solid #000 }
.bf-bff .bf-tbl .bf-tr { display: grid; border-top: 1px solid #aaa; align-items: center }
.bf-bff .bf-tbl .bf-tr > div, .bf-bff .bf-tbl .bf-th > div { padding: 1px 3px; min-width: 0; line-height: 1.12; overflow: hidden }
.bf-bff .bf-tbl .bf-tr > div + div, .bf-bff .bf-tbl .bf-th > div + div { border-left: 1px solid #000 }
.bf-bff .bf-tbls.bf-tight { gap: 0 } .bf-bff .bf-tbls.bf-tight .bf-tbl { font-size: 7.5px }
.bf-bff .bf-tbls.bf-tight .bf-tbl .bf-tr { align-items: stretch }
.bf-bff .bf-tbls.bf-tight .bf-tbl .bf-tr > div { display: flex; align-items: center }
.bf-bff .bf-tbls.bf-tight .bf-tbl .bf-tr > div.bf-c { justify-content: center } .bf-bff .bf-tbls.bf-tight .bf-tbl .bf-tr > div.bf-r { justify-content: flex-end } .bf-bff .bf-tbls.bf-tight .bf-tbl + .bf-tbl { border-left: 0 }
.bf-bff .bf-tbl .bf-th > div { white-space: pre-line }
.bf-bff .bf-tbl .bf-na { background: #D9D9D9 }
.bf-bff .bf-tbl .bf-tr > div.bf-in { padding-left: 9px }
.bf-bff .bf-tbl .bf-tr.bf-sp { display: block; font-weight: 700; background: #E8E8E8; padding: 0 3px }
.bf-bff .bf-tbl .bf-tr.bf-pl > div { border-left: 0 }
.bf-bff .bf-tbl .bf-r { text-align: right } .bf-bff .bf-tbl .bf-c { text-align: center }
.bf-bff .bf-tbl .bf-tr:first-of-type { border-top: 0 }

.bf-bff .bf-own { position: absolute; left: 0; right: 0; bottom: -.27in; margin: 0; font-size: 7.4px; color: #444; font-style: italic; line-height: 1.2; text-align: center }

/* the Forms screen: toolbar, preview stage */
.bf-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.bf-bar .bf-grow { flex: 1; }
.bf-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
.bf-stage { overflow: auto; background: #E8E8E5; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 10px 2px; max-height: 82vh; }
.bf-stage .bf-zoom { width: max-content; margin: 0 auto; }
.bf-fit .bf-stage { overflow-x: hidden; }
.bf-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; background: var(--surface); }
.bf-seg button { border: 0; background: transparent; padding: 5px 14px; font-size: 13px; font-weight: 500; cursor: pointer; }
.bf-seg button[aria-pressed=true] { background: var(--ink); color: #fff; }
@media (max-width: 760px) { .bf-stage { max-height: 74vh; padding: 10px 4px 2px; } .bf-bar .btn { justify-content: center; } }

/* printing a face: the app steps aside, #bf-print (a child of body) is the only thing on the paper */
#bf-print { display: none; }
@media print {
  body.printing-face > *:not(#bf-print) { display: none !important; }
  body.printing-face #bf-print { display: block; }
  body.printing-face { background: #fff; font-size: 10.5px; }
  #bf-print .bf-bfs { margin: 0; box-shadow: none; }
  #bf-print .bf-bfs:last-child { break-after: auto; }
  #bf-print .bf-zoom { zoom: 1 !important; width: auto; }
  .bf, .bf * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* brand-mark v2 */
.brand-mark { width: 36px; height: 36px; background: none !important; box-shadow: none !important; border-radius: 0; padding: 0; flex: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
