:root {
  --bg: #ffffff;
  --panel: #eef4fb;
  --panel-strong: #d7e7f4;
  --surface: #ffffff;
  --fg: #34495e;
  --heading: #1f3244;
  --muted: #5b6b7d;
  --line: #dfe6ee;
  --brand: #116a9e;
  --cta: #3d5af1;
  --cta-hover: #2f49d6;
  --cta-text: #3d5af1;
  --cta-fg: #ffffff;
  --badge-bg: #fde047;
  --badge-fg: #3a3000;
  --good: #117a4b;
  --warn-bg: #fff6d6;
  --warn: #8a5a00;
  --err: #b3261e;
  --shadow: 0 1px 3px rgba(31, 50, 68, .08), 0 6px 18px rgba(31, 50, 68, .06);
  --radius: 4px;
  --radius-lg: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1720; --panel: #15212d; --panel-strong: #1b2b3a; --surface: #16202a;
    --fg: #d7e0ea; --heading: #f1f5f9; --muted: #93a4b6; --line: #263545;
    --brand: #5aa9da; --cta: #4a64f5; --cta-hover: #3b55e6; --cta-text: #8fa2ff; --cta-fg: #ffffff;
    --badge-bg: #facc15; --badge-fg: #2b2300; --good: #4cc38a;
    --warn-bg: #2a2210; --warn: #f0c35a; --err: #f2867e;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1720; --panel: #15212d; --panel-strong: #1b2b3a; --surface: #16202a;
  --fg: #d7e0ea; --heading: #f1f5f9; --muted: #93a4b6; --line: #263545;
  --brand: #5aa9da; --cta: #4a64f5; --cta-hover: #3b55e6; --cta-text: #8fa2ff; --cta-fg: #ffffff;
  --badge-bg: #facc15; --badge-fg: #2b2300; --good: #4cc38a;
  --warn-bg: #2a2210; --warn: #f0c35a; --err: #f2867e;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { color: var(--heading); line-height: 1.25; }
h1 { font-size: 2rem; margin: 12px 0 12px; }
h2 { font-size: 1.2rem; margin: 0; }
h3 { font-size: 1rem; margin: 18px 0 6px; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--brand); text-decoration: none; font-size: 1.05rem; }
.brand-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--brand); color: #fff; font-size: 1rem; }
.toplinks { display: flex; align-items: center; gap: 18px; font-size: .92rem; }
.toplinks a:not(.btn) { color: var(--fg); text-decoration: none; font-weight: 500; }
.toplinks a:not(.btn):hover { color: var(--brand); }

/* buttons */
.btn, button {
  display: inline-block; font: inherit; font-size: .9rem; font-weight: 700; line-height: 1.2;
  padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--cta);
  background: var(--cta); color: var(--cta-fg); cursor: pointer; text-decoration: none;
}
.btn:hover, button:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-small { padding: 8px 14px; }
.btn-large { font-size: 1.1rem; padding: 12px 32px; font-weight: 600; }
.btn-ghost, button.btn-ghost { background: transparent; color: var(--cta-text); border-color: var(--cta-text); }
.btn-ghost:hover, button.btn-ghost:hover { background: var(--panel); color: var(--cta-text); }
button.link { background: none; border: 0; color: var(--muted); padding: 0 4px; font-weight: 500; text-decoration: underline; font-size: .85rem; }
button.link:hover { color: var(--brand); background: none; }
button:disabled, button:disabled:hover { opacity: .5; cursor: not-allowed; background: var(--cta); border-color: var(--cta); }

/* intro */
.intro { background: var(--panel); border-bottom: 1px solid var(--line); padding: 40px 0 44px; }
.intro-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; }
.badge { display: inline-block; background: var(--badge-bg); color: var(--badge-fg); font-weight: 700; font-size: .8rem; padding: 3px 10px; border-radius: 99px; }
.lede { font-size: 1.08rem; margin: 0 0 22px; max-width: 34em; }
.intro-note { margin: 12px 0 0; font-size: .88rem; color: var(--muted); }
.rule-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px 22px; border-top: 4px solid var(--brand); }
.rule-card h2 { font-size: 1rem; margin-bottom: 10px; }
.rule-card dl { margin: 0; }
.rule-card dl div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rule-card dt { color: var(--fg); }
.rule-card dd { margin: 0; font-weight: 700; color: var(--heading); text-align: right; }
.rule-card dd.free { color: var(--good); }
.rule-card p { margin: 10px 0 0; }

/* trust cards */
.trust { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: -1px; padding-top: 28px; padding-bottom: 8px; }
.trust-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); }
.trust-card h3 { margin: 8px 0 4px; }
.trust-card p { margin: 0; font-size: .92rem; }
.trust-icon { font-size: 1.4rem; }

/* tool */
.tool { padding-top: 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.step-no { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: .9rem; flex: none; }
.hint { color: var(--muted); margin: 0 0 8px; }
.segment { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; margin: 12px 0; background: var(--panel); }
.segment-head { display: flex; gap: 8px; align-items: center; }
.segment-head input { flex: 1; min-width: 0; font-weight: 600; }
.drop { display: block; border: 2px dashed var(--panel-strong); background: var(--surface); border-radius: var(--radius-lg); padding: 18px; text-align: center; color: var(--muted); margin-top: 10px; cursor: pointer; }
.drop strong { color: var(--cta-text); }
.drop.over { border-color: var(--cta); color: var(--fg); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.file .name { overflow-wrap: anywhere; }
.status { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.status.ready { color: var(--good); }
.status.error, .status.check { color: var(--warn); }
input, select {
  font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px; max-width: 100%;
}
input:focus, select:focus, button:focus-visible, .btn:focus-visible, summary:focus-visible { outline: 2px solid var(--cta); outline-offset: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.field label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.field select, .field input { width: 100%; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: .92rem; }
.errors { color: var(--err); margin: 10px 0; padding-left: 18px; }
.notice { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: var(--radius); margin: 10px 0; }

/* results */
.headline-box { background: var(--panel); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 14px 16px; margin: 8px 0 12px; }
.headline-fee { font-size: 1.9rem; font-weight: 800; color: var(--heading); line-height: 1.1; }
.headline-box p { margin: 6px 0 0; }
.table-scroll { overflow-x: auto; margin: 8px 0; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; font-variant-numeric: tabular-nums; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--panel); }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
tr.seg td { font-weight: 600; }
tr.sub td:first-child { padding-left: 24px; color: var(--muted); }
tr.total td { font-weight: 800; color: var(--heading); border-top: 2px solid var(--heading); }
ul.drivers { padding-left: 18px; }
ul.drivers li { margin: 4px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.out { white-space: pre-wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 8px 0; }

/* faq and footer */
.faq { padding: 24px 16px 8px; }
.faq h2 { margin-bottom: 10px; }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--heading); }
.faq details p { margin: 8px 0 0; }
.footer { margin-top: 32px; background: var(--panel); border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 18px 0; }
.footer p { margin: 0; }

@media (max-width: 760px) {
  h1 { font-size: 1.6rem; }
  .intro { padding: 28px 0 32px; }
  .intro-grid, .trust { grid-template-columns: 1fr; }
  .toplinks a:not(.btn) { display: none; }
  .btn-large { width: 100%; text-align: center; }
  .headline-fee { font-size: 1.6rem; }
}
@media print {
  .topbar, .intro, .trust, .faq, .footer, .no-print, button, .btn, .drop, #step-files .hint, #step-confirm { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; padding: 0; }
}
