:root { --ink: #1b2430; --muted: #5b6776; --line: #d5dbe3; --bg: #f5f7fa; --card: #fff; --brand: #1d4e89; --accent: #f5b700; --ok: #1d7a46; --err: #b3261e; --warn: #8a5a00; }
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: .5rem; z-index: 10; }
.skip:focus { left: 0; }
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 1rem; background: var(--brand); color: #fff; }
.top a { color: #fff; text-decoration: none; }
.brand { font-weight: 700; font-size: 1.15rem; }
.top nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: center; }
.top nav a { padding: .25rem 0; border-bottom: 2px solid transparent; }
.top nav a[aria-current] { border-bottom-color: var(--accent); }
.top nav .lang { border: 1px solid rgba(255,255,255,.6); border-radius: 4px; padding: .15rem .5rem; }
.wrap { max-width: 56rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .5rem 0; }
h2 { font-size: 1.2rem; margin: 1.25rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: 1rem 0; }
.card.ok { border-color: #9bd2b1; background: #eef9f2; }
.card.notice, p.notice { border-color: #e6c870; background: #fff8e5; }
p.notice { padding: .6rem .8rem; border: 1px solid #e6c870; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.err { color: var(--err); font-weight: 600; }
.warn { color: var(--warn); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .75rem 1rem; }
label { display: block; font-weight: 600; font-size: .95rem; }
label small { display: block; font-weight: 400; }
input, select { width: 100%; margin-top: .25rem; padding: .55rem .6rem; font: inherit; border: 1px solid #aab4c0; border-radius: 6px; background: #fff; color: var(--ink); min-height: 2.6rem; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; margin: 0 .5rem 0 0; }
input[type=file] { border: 1px dashed #8a97a6; background: #fafcff; padding: .7rem; }
label.chk { font-weight: 400; display: flex; align-items: flex-start; gap: .2rem; margin: .4rem 0; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 .75rem; }
legend { font-weight: 600; padding: 0 .3rem; }
.btn { display: inline-block; padding: .65rem 1.1rem; border: 2px solid var(--brand); background: var(--brand); color: #fff; border-radius: 6px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 2.75rem; }
.btn.ghost { background: #fff; color: var(--brand); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th:first-child, td:first-child { text-align: left; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; }
table.rows td { padding: .3rem .25rem; }
table.rows input, table.rows select { margin-top: 0; }
.x { border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; min-width: 2.4rem; min-height: 2.4rem; }
tr.sur td { color: var(--muted); }
tr.tot td { font-weight: 700; border-top: 2px solid var(--ink); }
td.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.big { font-size: 1.5rem; margin: 1rem 0 .5rem; }
.big.credit strong { color: var(--ok); }
.adv { display: none; }
.adv-on .adv { display: table-cell; }
.deadlines tr.past td { color: var(--muted); }
.deadlines td:last-child, .deadlines th:last-child { text-align: left; }
.drops { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 .75rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; }
.next { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .5rem 1rem; margin: 1rem 0; }
details { border-bottom: 1px solid var(--line); padding: .5rem 0; }
summary { cursor: pointer; font-weight: 600; }
.foot { max-width: 56rem; margin: 2rem auto 1rem; padding: 0 1rem; color: var(--muted); font-size: .85rem; }
.legal { max-width: 40rem; }
.toolbar { margin: 1rem 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.ws { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
.totals { display: grid; grid-template-columns: max-content max-content; gap: .15rem 1.5rem; margin: .5rem 0 1rem; }
.totals dt { color: var(--muted); } .totals dd { margin: 0; font-weight: 700; text-align: right; }
.appendix table.app { font-size: .8rem; }
.appendix table.app td, .appendix table.app th { text-align: left; padding: .2rem .4rem; }

/* phones: the state table becomes stacked cards */
@media (max-width: 40rem) {
  .wrap { padding: .75rem; }
  h1 { font-size: 1.4rem; }
  table.rows thead { display: none; }
  table.rows, table.rows tbody, table.rows tr, table.rows td { display: block; width: 100%; }
  table.rows tr { border: 1px solid var(--line); border-radius: 8px; padding: .5rem; margin-bottom: .6rem; position: relative; }
  table.rows td { border: 0; padding: .2rem 0; text-align: left; }
  table.rows td::before { content: attr(data-label); display: block; font-size: .8rem; color: var(--muted); }
  table.rows td:last-child::before { content: none; }
  table.rows td:last-child { position: absolute; top: .1rem; right: .1rem; width: auto; }
  table.rows td.adv { display: none; }
  .adv-on table.rows td.adv { display: block; }
  table.out { font-size: .85rem; }
  table.out th, table.out td { padding: .35rem .3rem; }
}

/* printing: calculator result only, or the worksheet only (Letter and A4) */
@page { margin: 12mm; }
@media print {
  body { background: #fff; font-size: 10pt; }
  .noprint, .skip { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card, .ws { border: 0; padding: 0; margin: 0; }
  body.print-calc main > *:not(#result) { display: none !important; }
  body.print-calc #result { display: block !important; border: 0; }
  body.ws-on #flow, body.ws-on #banner, body.ws-on h1.page, body.ws-on main > h1, body.ws-on main > .lead { display: none !important; }
  .ws h1 { font-size: 15pt; margin: 0; }
  .ws h2 { font-size: 11pt; margin: .6rem 0 .2rem; }
  .ws table { font-size: 9pt; }
  .ws th, .ws td { padding: .15rem .3rem; }
  .ws .big { font-size: 13pt; margin: .4rem 0; }
  .appendix { break-before: page; }
  .appendix table.app { font-size: 8pt; }
  tr { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
[hidden] { display: none !important; }
body.ws-on main > h1, body.ws-on main > .lead { display: none; }
