:root {
  --bg: #f4f3ee; --card: #fff; --ink: #1d2733; --muted: #5d6874; --line: #e3e1d9;
  --navy: #22313f; --navy-2: #34475a; --green: #1f7a5a; --green-dark: #165c44; --green-soft: #e7f3ee;
  --red: #b3261e; --warn-bg: #fff6e0; --warn-line: #e0b23c;
  --shadow: 0 1px 2px rgba(29,39,51,.06), 0 4px 14px rgba(29,39,51,.07); --radius: 12px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.5; overflow-wrap: break-word; }
a { color: var(--green-dark); }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

.top { background: var(--navy); color: #fff; padding: 12px 0; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 18px; }
.brand { color: #fff; text-decoration: none; font-weight: 650; font-size: 17px; letter-spacing: -.01em; display: inline-flex; align-items: center; gap: 8px; }
.brand img { width: 26px; height: 26px; }
.brand b { color: #8fe0bd; }
.top nav { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 14px; }
.top nav a { color: #d5dde5; text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.top nav a:hover, .top nav a[aria-current] { color: #fff; border-bottom-color: #8fe0bd; }
.crumbs { font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.crumbs a { color: var(--muted); }

h1 { font-size: clamp(27px, 5vw, 40px); line-height: 1.12; letter-spacing: -.02em; margin: 22px 0 8px; }
.lede { font-size: 18px; color: var(--muted); margin: 0 0 20px; max-width: 700px; }
h2 { font-size: clamp(20px, 3vw, 24px); margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 18px 0 8px; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.tool { border-top: 4px solid var(--green); }
.prose p, .prose li { max-width: 760px; }
.prose ul, .prose ol { padding-left: 20px; }

/* forms */
.calc .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 14px; }
.calc label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
.calc label.wide { grid-column: 1 / -1; }
.calc label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 14px; }
.calc input, .calc select, .calc textarea { font: inherit; font-size: 16px; padding: 9px 11px; border-radius: 9px; border: 1.5px solid #d3d0c6; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.calc input[type="checkbox"] { width: 18px; height: 18px; }
.calc input:focus, .calc select:focus, .calc textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,122,90,.18); }
.inp { position: relative; display: flex; align-items: center; }
.inp i { position: absolute; right: 11px; font-style: normal; color: var(--muted); pointer-events: none; font-size: 14px; }
.inp i.pre { left: 11px; right: auto; }
.inp i.pre + input { padding-left: 24px; }
fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
legend { font-weight: 700; font-size: 15px; margin-bottom: 8px; padding: 0; }
.rows .row { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.4fr auto; gap: 8px; margin-bottom: 8px; align-items: end; }
.rows.units .row { grid-template-columns: .7fr 1.4fr 1fr 1fr 1fr .9fr .9fr auto; }
.rows.charges .row { grid-template-columns: 1.1fr 1fr 2fr auto; }
.rows .row label { font-size: 12px; }
.btn, .rows button { font: inherit; font-size: 14px; font-weight: 600; border-radius: 999px; padding: 7px 14px; cursor: pointer; border: 1.5px solid var(--line); background: #fff; color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.rows button[data-del] { padding: 7px 10px; line-height: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }

/* results */
.results { margin-top: 18px; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 12px; }
.totals div { background: #f5f4ef; border-radius: 10px; padding: 12px 14px; }
.totals .main { background: var(--green-soft); outline: 2px solid var(--green); }
.totals b { display: block; font-size: clamp(21px, 4.5vw, 30px); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.totals span { font-size: 13px; color: var(--muted); }
.work, .cap, .rule { font-size: 15px; margin: 8px 0; }
.rule { padding: 10px 12px; border-left: 4px solid var(--green); background: var(--green-soft); border-radius: 0 9px 9px 0; }
.cite { display: inline-block; font-size: 12px; color: var(--muted); }
.bad { color: var(--red); font-weight: 600; }
.ok { color: var(--green-dark); font-weight: 600; }
.warn { padding: 10px 12px; background: var(--warn-bg); border-left: 4px solid var(--warn-line); border-radius: 0 9px 9px 0; font-size: 15px; }
.note, .hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.tip { margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid var(--green); background: var(--green-soft); border-radius: 0 9px 9px 0; font-size: 15px; }

/* tables */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ref, .ledger { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.ref th, .ref td, .ledger th, .ledger td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ref thead th, .ledger thead th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.ref { min-width: 520px; }
.ref.kv { min-width: 0; }
.ref.kv th { width: 34%; }
.ref.kv td { overflow-wrap: anywhere; }
.ref td small, .ref th small { color: var(--muted); }
.ledger { min-width: 560px; }
.ledger .n { text-align: right; white-space: nowrap; }
.ledger tr.pay td { color: var(--green-dark); }
.ledger tr.fee td { color: var(--red); }
.ledger tfoot th { border-top: 2px solid var(--ink); }
.filter { font: inherit; font-size: 16px; padding: 8px 11px; border-radius: 9px; border: 1.5px solid #d3d0c6; width: 100%; max-width: 320px; margin-bottom: 10px; }

/* documents (ledger, receipt, letters) */
.doc, .receipt, .letter { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 8px; }
.doc-head h3 { margin: 0; font-size: 22px; }
.doc-head p, .doc-meta p { margin: 2px 0; font-size: 14px; }
.doc-bal { font-size: 17px; margin: 12px 0 0; }
.sign { margin-top: 26px; font-size: 14px; }
.sig-line { display: grid; grid-template-columns: 2fr 2fr 1fr; gap: 16px; margin-top: 34px; }
.sig-line span { border-top: 1px solid var(--ink); padding-top: 4px; font-size: 12px; color: var(--muted); }
.receipt { max-width: 640px; }
.rc-head { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); margin-bottom: 10px; }
.rc-head h3 { margin: 0 0 6px; font-size: 22px; }
.rc-head p { margin: 0 0 6px; text-align: right; font-size: 14px; }
.rc-line { margin: 6px 0; }
.rc-words { margin: 0 0 6px; font-style: italic; color: var(--muted); font-size: 14px; }
.rc-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; font-size: 14px; }
.rc-grid p { margin: 4px 0; }
.rc-note { font-size: 14px; }
.rc-sign { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 26px; font-size: 14px; }
.rc-sign .line { border-top: 1px solid var(--ink); min-width: 180px; padding-top: 3px; color: var(--muted); font-size: 12px; }
.cut { text-align: center; color: #9aa3ad; font-size: 12px; margin: 14px 0; overflow: hidden; white-space: nowrap; }
.letter { max-width: 700px; font-size: 15px; }
.letter .lt { border-collapse: collapse; min-width: 260px; margin: 6px 0 12px; }
.letter .lt td { padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); }
.letter .lt .n { text-align: right; }
.letter .lt tr.t td { font-weight: 700; border-bottom: 2px solid var(--ink); }
.letter .sig { margin-top: 30px; }

/* monetization */
.ad-slot { margin: 0 0 20px; min-height: 0; }
.ad-slot:empty { display: none; }
.aff { border: 1.5px dashed #c9c5b9; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px; background: #fbfaf6; font-size: 15px; }
.aff .lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.soon { border-left: 4px solid var(--navy-2); background: #eef1f4; padding: 12px 14px; border-radius: 0 9px 9px 0; font-size: 15px; margin: 0 0 20px; }

/* lists, faq, footer */
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 650; }
.faq p { margin: 8px 0 2px; color: #333c45; }
.links { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 16px; }
.states { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 14px; font-size: 15px; }
.disclaim { font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 14px; }
.status-verify { display: inline-block; font-size: 11px; font-weight: 700; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 6px; padding: 0 6px; color: #7a5a00; }
footer { font-size: 13px; color: var(--muted); padding: 10px 16px 40px; }
footer a { color: var(--muted); }
.fcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 24px; padding: 8px 0; }
.fcols b { display: block; color: var(--ink); margin: 10px 0 4px; }
.fcols .links { display: block; }
.fcols .links li { margin: 3px 0; }

@media (max-width: 640px) {
  .panel { padding: 15px; }
  .top nav { font-size: 13px; }
  .rows .row, .rows.units .row, .rows.charges .row { grid-template-columns: 1fr 1fr; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
  .rows .row button[data-del] { justify-self: start; }
  .sig-line { grid-template-columns: 1fr; gap: 22px; }
}

@media print {
  @page { margin: 14mm; }
  body { background: #fff; }
  body.printing > *:not(main), body.printing main > *:not(.print-host) { display: none !important; }
  body.printing .print-host > *:not(.print-me):not(:has(.print-me)) { display: none !important; }
  body.printing .print-host, body.printing .print-host * { box-shadow: none !important; }
  body.printing .panel { padding: 0; border: 0; }
  .doc, .receipt, .letter { border: 0; padding: 0; }
  .receipt { border: 1px solid #000; padding: 14px; page-break-inside: avoid; }
  .tw { overflow: visible; }
  .ledger, .ref { min-width: 0; font-size: 12px; }
  a { color: inherit; text-decoration: none; }
}
