:root {
  --paper: #F5F6F8;
  --surface: #FFFFFF;
  --ink: #171C26;
  --muted: #576070;
  --line: #D6DBE3;
  --brand: #1B3F72;
  --brand-soft: #E3EBF6;
  --stamp: #6A2C91;          /* passport-stamp ink */
  --stamp-soft: #F2E8F8;
  --amber: #9A6200;
  --amber-soft: #FBF0D9;
  --red: #A8322D;
  --red-soft: #F8E3E1;
  --bar: #16325A;
  --on-bar: #FFFFFF;
  --btn-hover: #12294A;
  --radius: 10px;
  --step: 1.25;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #11151C; --surface: #19202A; --ink: #E6EAF0; --muted: #A5AEBD; --line: #333C4A;
  --brand: #8DB4F0; --brand-soft: #1D2C44; --stamp: #CDA4EB; --stamp-soft: #34233F;
  --amber: #E8B45A; --amber-soft: #3A2F18; --red: #F08A84; --red-soft: #3D2120;
  --bar: #14294A; --on-bar: #FFFFFF; --btn-hover: #A9C6F5; color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #11151C; --surface: #19202A; --ink: #E6EAF0; --muted: #A5AEBD; --line: #333C4A;
  --brand: #8DB4F0; --brand-soft: #1D2C44; --stamp: #CDA4EB; --stamp-soft: #34233F;
  --amber: #E8B45A; --amber-soft: #3A2F18; --red: #F08A84; --red-soft: #3D2120;
  --bar: #14294A; --on-bar: #FFFFFF; --btn-hover: #A9C6F5; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}
a { color: var(--brand); text-underline-offset: 2px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--stamp); outline-offset: 2px; border-radius: 4px; }

h2 { font-size: 1.75rem; line-height: 1.15; margin: 0 0 .4rem; letter-spacing: -.01em; }
h3 { font-size: 1.15rem; margin: 0 0 .3rem; }
.lede { color: var(--muted); max-width: 62ch; margin: 0 0 1.5rem; }
.hint { color: var(--muted); font-size: .92rem; margin: .25rem 0 .75rem; max-width: 64ch; }
.muted { color: var(--muted); }
.fine { font-size: .92rem; color: var(--muted); }

/* header */
.top { background: var(--bar); color: var(--on-bar); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { color: var(--on-bar); text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.brand svg { width: 26px; height: 26px; }
.top-note { opacity: .85; font-size: .9rem; }

/* verdict — the answer up top */
.verdict { padding: 36px 0 28px; }
.verdict .q { color: var(--muted); margin: 0 0 6px; font-size: 1rem; }
.verdict .a { font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.05; font-weight: 700; margin: 0; letter-spacing: -.02em; max-width: 18ch; }
.verdict.ok .a { color: var(--brand); }
.verdict.warn .a { color: var(--amber); }
.verdict.wait .a { color: var(--ink); }
.verdict .sub { margin: 12px 0 0; max-width: 60ch; color: var(--muted); }
.verdict .tally { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; font-size: .95rem; }
.verdict .tally span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); display: inline-block; }
.dot.ok { background: var(--brand); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--red); }

/* steps */
.steps { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); margin-bottom: 24px; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps button {
  font: inherit; font-size: .98rem; background: none; border: 0; padding: 12px 12px 10px; color: var(--muted);
  border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 8px;
}
.steps button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); font-weight: 700; }
.steps .n { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; display: inline-grid; place-items: center; font-size: .78rem; font-weight: 700; }
.steps .n.done { background: var(--brand); border-color: var(--brand); color: var(--surface); }
.steps .news-tab { margin-left: auto; }

.panel { padding-bottom: 48px; }
.block { margin: 28px 0; }

/* form controls */
.field { margin: 0 0 18px; }
.field label, .row label span { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.field.inline { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.field.inline label { width: 100%; margin: 0; }
input[type=date], input[type=text], input[type=email], select {
  font: inherit; font-size: 1rem; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); min-height: 46px; width: 100%; max-width: 420px;
}
input:focus, select:focus { border-color: var(--stamp); outline: none; box-shadow: 0 0 0 3px var(--stamp-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); flex: none; }

.rows { display: grid; gap: 10px; margin-bottom: 12px; }
.row {
  display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; position: relative; grid-template-columns: 1fr 1fr;
}
.row.perm label:first-child { grid-column: 1 / -1; }
.row.trip .grow { grid-column: 1 / -1; }
.row label { min-width: 0; }
.row input, .row select { max-width: none; }
.row.flag { border-color: var(--red); background: var(--red-soft); }
.row .x { position: absolute; top: 6px; right: 6px; border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; width: 36px; height: 36px; border-radius: 50%; }
.row .x:hover { background: var(--paper); color: var(--red); }
.row.perm label:first-child { padding-right: 36px; }
.row .note { grid-column: 1 / -1; font-size: .88rem; color: var(--muted); margin: -2px 0 0; }
.row .note.bad { color: var(--red); }
@media (min-width: 720px) {
  .row.perm { grid-template-columns: 2fr 1fr 1fr 36px; align-items: end; }
  .row.perm label:first-child { grid-column: auto; padding-right: 0; }
  .row.trip { grid-template-columns: 1fr 1fr 2fr 36px; align-items: end; }
  .row.trip .grow { grid-column: auto; }
  .row .x { position: static; }
}

.btn {
  font: inherit; font-weight: 700; font-size: .98rem; border-radius: 8px; padding: 10px 16px; min-height: 44px;
  border: 1.5px solid var(--brand); background: var(--brand); color: var(--surface); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn.ghost { background: var(--surface); color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.link { background: none; border: 0; color: var(--brand); text-decoration: underline; padding: 10px 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }

/* eligibility checks */
.checks { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.checks li { display: grid; grid-template-columns: 28px 1fr; gap: 4px 10px; padding: 14px 16px; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--surface); font-weight: 700; font-size: .85rem; margin-top: 1px; }
.checks .ok .ic { background: var(--brand); }
.checks .warn .ic { background: var(--amber); }
.checks .bad .ic { background: var(--red); }
.checks .d { grid-column: 2; color: var(--muted); font-size: .93rem; }
.callout { border-left: 4px solid var(--amber); background: var(--amber-soft); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 14px 0; }
.callout.bad { border-color: var(--red); background: var(--red-soft); }
.callout.good { border-color: var(--brand); background: var(--brand-soft); }

/* identity */
.ticks { display: grid; gap: 8px; margin-bottom: 20px; }
.tick { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.tick input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.tick .pts { margin-left: auto; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.tick:has(input:checked) .pts { color: var(--brand); }
.meter-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.meter { height: 12px; background: var(--paper); border-radius: 6px; overflow: hidden; margin: 8px 0; border: 1px solid var(--line); }
.meter i { display: block; height: 100%; background: var(--stamp); transition: width .25s ease; }
.meter.full i { background: var(--brand); }

/* residence — the stamps */
.stamps { display: flex; flex-wrap: wrap; gap: 26px 14px; margin: 24px 0 8px; padding-bottom: 14px; }
.stamp {
  --c: var(--line);
  width: 104px; height: 104px; border-radius: 50%; border: 3px dashed var(--c); display: grid; place-content: center; text-align: center;
  color: var(--muted); background: var(--surface); font: inherit; cursor: pointer; padding: 6px; position: relative;
  transition: transform .2s ease, border-color .2s ease;
}
.stamp .yr { font-weight: 700; font-size: .95rem; line-height: 1.1; }
.stamp .pt { font-size: .8rem; margin-top: 4px; }
.stamp.claimed { --c: var(--stamp); color: var(--stamp); border-style: dashed; }
.stamp.done {
  --c: var(--stamp); border-style: double; border-width: 5px; background: var(--stamp-soft); color: var(--stamp);
  transform: rotate(-7deg);
}
.stamp.done .pt::before { content: "✓ "; }
.stamp.req::after { content: "Required"; position: absolute; bottom: -24px; left: 50%; transform: translateX(-50%); background: var(--paper); font-size: .72rem; color: var(--muted); padding: 0 4px; }
.stamp.off { opacity: .55; border-style: dotted; }
.stamp:hover { transform: rotate(-3deg); }
.stamp.done:hover { transform: rotate(-9deg); }
@media (prefers-reduced-motion: reduce) { .stamp, .stamp.done, .stamp:hover { transition: none; transform: none; } }
.stamps-note { font-size: .93rem; color: var(--muted); margin: 18px 0 24px; }

.year { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
.year summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.year summary::-webkit-details-marker { display: none; }
.year summary .t { font-weight: 700; }
.year summary .s { margin-left: auto; font-weight: 700; font-size: .93rem; }
.year.ok summary .s { color: var(--brand); }
.year.short summary .s { color: var(--amber); }
.year .body { padding: 0 16px 16px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--paper); }
.doc .lbl { flex: 1; font-size: .95rem; }
.doc .lbl small { color: var(--muted); display: block; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 8px; overflow: hidden; }
.stepper button { font: inherit; width: 38px; height: 38px; border: 0; background: var(--paper); cursor: pointer; font-size: 1.15rem; }
.stepper output { width: 34px; text-align: center; font-weight: 700; }
.badge { font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--stamp-soft); color: var(--stamp); }
.badge.sup { background: var(--paper); color: var(--muted); }
.legend { font-size: .93rem; color: var(--muted); margin-top: 24px; }

/* checklist */
.group { margin: 0 0 22px; }
.group h3 { margin-bottom: 8px; }
.item { display: flex; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; }
.item input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); flex: none; }
.item small { display: block; color: var(--muted); }
.item:has(input:checked) .tx { text-decoration: line-through; color: var(--muted); }
.progress { font-weight: 700; margin-bottom: 14px; }

/* news */
.news { list-style: none; padding: 0; margin: 12px 0 32px; }
.news li { padding: 16px 0; border-top: 1px solid var(--line); }
.news li:first-child { border-top: 0; }
.news a { font-weight: 700; font-size: 1.08rem; color: var(--ink); text-decoration: none; }
.news a:hover { color: var(--brand); text-decoration: underline; }
.news time { display: block; color: var(--muted); font-size: .9rem; margin-bottom: 2px; }
.news p { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }
.news .tag { color: var(--brand); font-weight: 700; font-size: .85rem; }
.subscribe { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.sub-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.sub-row input { flex: 1 1 220px; }
#subMsg { margin: 6px 0 0; font-weight: 700; }

/* footer */
.foot { border-top: 1px solid var(--line); padding: 24px 0 48px; font-size: .9rem; color: var(--muted); }
.foot p { max-width: 72ch; }

/* back / next */
.stepnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.stepnav .next { margin-left: auto; }

/* phones */
@media (max-width: 600px) {
  .top-note { display: none; }
  .verdict { padding: 24px 0 20px; }
  .steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; overflow: visible; }
  .steps button { flex-direction: column; gap: 4px; padding: 8px 2px; font-size: .78rem; line-height: 1.2; white-space: normal; text-align: center; justify-content: flex-start; }
  .steps .news-tab { margin-left: 0; justify-content: center; }
  .stamps { gap: 26px 10px; }
  .stamp { width: 92px; height: 92px; }
}

[hidden] { display: none !important; }

@media print {
  .top, .steps, .verdict, .toolbar, .foot, .stepnav, .panel:not(#tab-checklist) { display: none !important; }
  #tab-checklist { display: block !important; }
  body { background: #fff; font-size: 12pt; }
  .item { border: 0; padding: 4px 0; break-inside: avoid; }
}
