/* ============================================================
   DonSem / Money Math
   Warm paper, ink, one vermilion accent. Hairlines and tabular figures.
   ============================================================ */

:root {
  --paper: #f7f2e8;
  --paper-2: #fbf8f1;
  --card: #fffdf8;
  --ink: #1b1915;
  --ink-2: #3c372e;
  --muted: #6f6859;
  --faint: #8b8272;
  --line: #e0d7c6;
  --line-2: #ece5d6;
  --accent: #c0442a;
  --accent-ink: #9c3420;
  --accent-soft: #f3ddd3;
  --moss: #2f5a45;
  --moss-2: #6f8a78;
  --amber: #c98a3c;
  --sand: #cdbb9d;
  --shadow: 0 1px 2px rgba(52, 40, 22, .04), 0 12px 28px -18px rgba(52, 40, 22, .35);
  --radius: 18px;
  --font: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", ui-monospace, "Menlo", "Consolas", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* paper grain: two very soft washes, no image request */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 70%),
    radial-gradient(700px 400px at 95% 5%, rgba(192, 68, 42, .05), rgba(192, 68, 42, 0) 70%);
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.035em; line-height: 1.18; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

::selection { background: var(--accent); color: #fff; }

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 1;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  z-index: 100;
}
.skip:focus { left: 16px; }

.num, .mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---------------- top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 242, 232, .88);
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  border-bottom: 1px solid var(--line-2);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, .12);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 17px; letter-spacing: -.04em; }
.brand-text span {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: .01em;
}
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a {
  font-size: 13px;
  color: var(--ink-2);
  padding: 7px 10px;
  border-radius: 8px;
}
.topnav a:hover { background: rgba(27, 25, 21, .05); color: var(--ink); }
.topnav a[aria-current="page"] { color: var(--accent-ink); font-weight: 700; }
.topnav .lang {
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: .04em;
  font-weight: 600;
}

/* ---------------- hero ---------------- */
.hero { padding-top: 44px; padding-bottom: 26px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 68, 42, .14);
}
.hero h1 {
  font-size: clamp(31px, 5.2vw, 50px);
  margin: 14px 0 14px;
  max-width: 15em;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
  white-space: nowrap;
}
.lede {
  max-width: 40em;
  color: var(--ink-2);
  font-size: 16.5px;
}
.lede strong { font-weight: 700; }
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.facts li {
  font-size: 12.5px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, .7);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}
.facts b { font-weight: 700; color: var(--ink); }
.facts .is-accent { border-color: rgba(192, 68, 42, .35); color: var(--accent-ink); background: var(--accent-soft); }
.facts .is-accent b { color: var(--accent-ink); }

/* ---------------- tabs ---------------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin: 26px 0 0;
}
.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 14px 6px 13px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.02em;
  transition: color .15s ease, border-color .15s ease;
}
.tab i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 700;
}
.tab[aria-selected="true"] i { color: var(--accent); }
.tab .tab-sub { display: none; }

/* ---------------- layout ---------------- */
.app { padding: 28px 0 10px; }
.panel {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr);
  gap: 26px;
  align-items: start;
}
.panel[hidden] { display: none; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.inputs { padding: 26px 26px 22px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 4px;
}
.panel-head h2 { font-size: 20px; letter-spacing: -.045em; }
.panel-head p { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.panel-head .tag {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 4px 8px;
  margin-top: 2px;
  white-space: nowrap;
}

/* ---------------- fields ---------------- */
.field { padding: 21px 0 3px; }
.field + .field { border-top: 1px solid var(--line-2); }
.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.field-head label, .field-head .flabel {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
}
.field-head .hint { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.field-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
}
.field-foot b { color: var(--ink-2); font-weight: 600; }

.input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  height: 54px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input-row:focus-within {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(192, 68, 42, .1);
}
.input-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  outline: none;
  padding: 8px 0;
  text-align: right;
}
.input-row .unit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  flex: none;
  padding-left: 2px;
}
.input-row .prefix {
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
  flex: none;
}

/* range */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  margin: 10px 0 0;
  background: transparent;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--p, 30%), var(--line) var(--p, 30%), var(--line) 100%);
}
.range::-moz-range-track {
  height: 4px; border-radius: 2px; background: var(--line);
}
.range::-moz-range-progress {
  height: 4px; border-radius: 2px; background: var(--accent);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 1px 3px rgba(52, 40, 22, .25);
}
.range::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}
.range:focus-visible { outline-offset: 6px; }

/* chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.chips button {
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -.02em;
  transition: all .14s ease;
}
.chips button:hover { border-color: var(--ink-2); }
.chips button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chips.is-fee button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
}
.chips .chip-note { font-size: 12px; color: var(--faint); align-self: center; padding-left: 4px; }

/* stepper */
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
  height: 44px;
  overflow: hidden;
}
.stepper button {
  appearance: none;
  border: 0;
  background: none;
  width: 40px;
  height: 100%;
  font-size: 18px;
  color: var(--ink-2);
  cursor: pointer;
  line-height: 1;
}
.stepper button:hover { background: rgba(27, 25, 21, .05); }
.stepper input {
  width: 46px;
  height: 100%;
  border: 0;
  border-left: 1px solid var(--line-2);
  border-right: 1px solid var(--line-2);
  background: #fff;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.pair-item { min-width: 0; }
.pair-item .input-row { min-width: 0; }
.pair-item .field-head { margin-bottom: 8px; }
.pair-item .stepper { width: 100%; justify-content: space-between; }
.pair-item .stepper input { flex: 1; }

/* switch */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 600;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  width: 44px; height: 26px; border-radius: 999px;
  background: var(--line); position: relative; flex: none;
  transition: background .16s ease;
}
.switch .track::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .16s ease;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* segmented (small option group) */
.seg-row { display: flex; flex-wrap: wrap; gap: 6px; }
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper-2);
}
.seg button {
  appearance: none;
  border: 0;
  background: none;
  padding: 9px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------- result ---------------- */
.result {
  position: sticky;
  position: -webkit-sticky;
  top: 86px;
  padding: 26px 26px 22px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, .98), rgba(255, 253, 248, .98)) padding-box,
    linear-gradient(180deg, #d9cfbc, #efe8da) border-box;
  border: 1px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.result::before {
  content: "";
  position: absolute;
  left: 26px; right: 26px; top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #d98a5f 45%, transparent);
  border-radius: 0 0 3px 3px;
}
.result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.result-top .rlabel {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.pill.is-bad {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: rgba(192, 68, 42, .25);
}
.pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--moss);
  background: rgba(47, 90, 69, .09);
  border: 1px solid rgba(47, 90, 69, .18);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.big-out {
  font-size: clamp(33px, 5.4vw, 44px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}
.big-out .cur { font-size: .5em; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.big-out .prefix { font-size: .5em; font-weight: 700; color: var(--muted); letter-spacing: 0; align-self: flex-start; margin-top: 6px; }
.big-out.is-neg { color: var(--accent-ink); }
.res-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}
.res-sub b { color: var(--ink-2); font-weight: 700; font-variant-numeric: tabular-nums; }

.donut-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 20px 0 4px;
}
.donut { width: 132px; height: 132px; flex: none; position: relative; }
.donut svg { transform: rotate(-90deg); display: block; }
.donut .center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  line-height: 1.1;
}
.donut .center b { font-size: 21px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.donut .center span { display: block; font-size: 9.5px; color: var(--muted); letter-spacing: .06em; margin-top: 2px; }
.donut-legend { flex: 1; min-width: 0; display: grid; gap: 5px; }
.donut-legend div {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--ink-2);
}
.donut-legend i {
  width: 8px; height: 8px; border-radius: 2px; flex: none;
}
.donut-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.breakdown { margin-top: 18px; border-top: 1px solid var(--line-2); }
.brow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px minmax(74px, auto);
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.brow:last-child { border-bottom: 0; }
.brow .bl { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.brow .bl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .bl em { font-style: normal; font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.brow .bar { height: 5px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.brow .bar i { display: block; height: 100%; border-radius: 3px; transition: width .35s cubic-bezier(.2,.7,.3,1); }
.brow .bv { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.brow.is-total .bar { background: transparent; }
.brow.is-total .bl { font-weight: 700; }
.brow.is-total .bv { font-weight: 800; }

.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 16px;
}
.kpi {
  background: var(--paper-2);
  padding: 12px 12px 13px;
}
.kpi span { display: block; font-size: 10.5px; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; font-weight: 600; }
.kpi b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -.04em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.kpi em { display: block; font-style: normal; font-size: 10.5px; color: var(--faint); margin-top: 3px; }
.kpi.is-pos b { color: var(--moss); }
.kpi.is-neg b { color: var(--accent-ink); }

/* stacked composition bar */
.comp { margin-top: 20px; }
.comp-bar {
  display: flex;
  height: 16px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--line-2);
  gap: 2px;
}
.comp-bar i { display: block; height: 100%; transition: width .35s cubic-bezier(.2,.7,.3,1); min-width: 0; }
.comp-bar i:first-child { border-radius: 5px 0 0 5px; }
.comp-bar i:last-child { border-radius: 0 5px 5px 0; }
.comp-key {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  margin-top: 12px;
}
.comp-key div { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.comp-key i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.comp-key b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.comp-note { font-size: 11.5px; color: var(--faint); margin-top: 10px; }

.note-box {
  margin-top: 18px;
  background: #f6f1e5;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
}
.note-box b { color: var(--ink-2); font-weight: 700; }
.note-box.is-warn { background: var(--accent-soft); border-color: rgba(192, 68, 42, .25); color: var(--accent-ink); }
.note-box.is-warn b { color: var(--accent-ink); }

.actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.btn {
  appearance: none;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  padding: 11px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .14s ease;
  flex: 1;
}
.btn:hover { border-color: var(--ink-2); background: #fff; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; border-color: #000; color: #fff; }
.btn svg { width: 15px; height: 15px; flex: none; }

/* small table inside result */
.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 14px;
}
.mini-table th {
  text-align: right;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--ink);
}
.mini-table th:first-child { text-align: left; }
.mini-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
.mini-table td:first-child { text-align: left; font-weight: 600; color: var(--ink); }
.mini-table tr.is-me td, .rate-table tr.is-me td { color: var(--accent-ink); font-weight: 700; background: rgba(192, 68, 42, .05); }
.rate-table tr.is-me td:first-child::after {
  content: " ←";
  font-size: 10px;
}
.mini-table tr.is-me td:first-child::after {
  content: " ←";
  font-size: 10px;
}

/* goal tab */
.target-big {
  display: grid;
  gap: 2px;
  text-align: center;
  padding: 4px 0 2px;
}
.slider-wrap { position: relative; }

.scenario {
  margin-top: 18px;
  border-top: 1px solid var(--line-2);
}
.scenario h3 {
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
  padding: 14px 0 4px;
}
.sc-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 12.5px;
}
.sc-row .sc-bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.sc-row .sc-bar i { display: block; height: 100%; background: var(--sand); border-radius: 3px; transition: width .35s ease; }
.sc-row b { font-variant-numeric: tabular-nums; font-weight: 700; }
.sc-row.is-hit .sc-bar i { background: var(--accent); }
.sc-row.is-hit b { color: var(--accent-ink); }
.sc-row .sc-lbl { color: var(--ink-2); }

/* ---------------- guide / content ---------------- */
.guide {
  padding: 56px 0 20px;
  border-top: 1px solid var(--line);
  margin-top: 48px;
}
.guide-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 44px 56px;
}
.guide h2 { font-size: clamp(22px, 3vw, 28px); margin-bottom: 14px; }
.guide h3 { font-size: 16.5px; margin: 26px 0 8px; letter-spacing: -.03em; }
.guide p { color: var(--ink-2); font-size: 14.5px; margin-top: 10px; }
.guide p strong { font-weight: 700; color: var(--ink); }
.guide ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 14.5px; }
.guide li { margin-top: 6px; }
.guide .sec-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: .08em;
  display: block;
  margin-bottom: 8px;
}

.table-wrap { overflow-x: auto; margin-top: 14px; }
.rate-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.rate-table caption {
  text-align: left;
  font-size: 11.5px;
  color: var(--faint);
  padding-bottom: 8px;
}
.rate-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1.5px solid var(--ink);
  padding: 0 8px 8px 0;
  font-weight: 600;
}
.rate-table td {
  padding: 9px 8px 9px 0;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
}
.rate-table td:last-child, .rate-table th:last-child { text-align: right; padding-right: 0; }
.rate-table td b { color: var(--ink); font-weight: 700; }

.faq { margin-top: 22px; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 15px 30px 15px 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -.025em;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
}
.faq details[open] summary::after { content: "−"; }
.faq .faq-a { padding: 0 20px 16px 0; font-size: 13.5px; color: var(--muted); line-height: 1.65; }

/* ---------------- footer ---------------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 34px 0 40px;
  margin-top: 40px;
  color: var(--muted);
  font-size: 12.5px;
}
.xlinks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 26px;
}
.xlink {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--paper-2);
  transition: all .15s ease;
}
.xlink:hover { border-color: var(--ink-2); background: #fff; }
.xlink .xmark {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
  background: var(--ink); color: #f7f2e8;
}
.xlink .xmark.is-alt { background: var(--accent); }
.xlink small { display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.xlink b { display: block; font-size: 13.5px; color: var(--ink); letter-spacing: -.02em; margin-top: 2px; }
.xlink .arrow { margin-left: auto; color: var(--faint); font-size: 16px; }

.foot-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; }
.foot-links a { font-weight: 600; color: var(--ink-2); }
.foot-disc { line-height: 1.7; max-width: 62em; }
.foot-disc p + p { margin-top: 6px; }
.copy { margin-top: 16px; font-size: 11.5px; color: var(--faint); }

/* ---------------- sticky mini bar (mobile) ---------------- */
.minibar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 45;
  background: rgba(27, 25, 21, .96);
  backdrop-filter: blur(10px);
  color: #f7f2e8;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}
.minibar .mb-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: rgba(247, 242, 232, .65); }
.minibar .mb-value { font-size: 21px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.minibar .mb-value small { font-size: 12px; font-weight: 600; opacity: .7; margin-left: 2px; }
.minibar a {
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(247, 242, 232, .3);
  border-radius: 999px;
  padding: 7px 12px;
  white-space: nowrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 92px;
  transform: translate(-50%, 12px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 60;
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- legal pages ---------------- */
.doc { max-width: 760px; padding: 40px 0 20px; }
.doc h1 { font-size: clamp(28px, 4vw, 38px); margin-bottom: 10px; }
.doc .updated { font-size: 12px; color: var(--faint); font-family: var(--mono); }
.doc h2 { font-size: 19px; margin: 34px 0 8px; }
.doc h3 { font-size: 15.5px; margin: 22px 0 6px; }
.doc p, .doc li { color: var(--ink-2); font-size: 14.5px; margin-top: 9px; }
.doc ul { padding-left: 20px; }
.doc .lead { font-size: 16px; color: var(--ink); }
.doc .lang-switch { display: flex; gap: 8px; margin: 18px 0 0; }
.doc .box {
  margin-top: 20px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------------- responsive ---------------- */
@media (max-width: 960px) {
  .panel { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .result { position: relative; top: auto; }
  .guide-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .hero { padding-top: 30px; padding-bottom: 14px; }
  .topnav a:not(.lang) { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  body { padding-bottom: 76px; }
  .wrap { padding: 0 16px; }
  .topbar .wrap { height: 56px; }
  .brand-mark { width: 27px; height: 27px; font-size: 15px; border-radius: 7px; }
  .brand-text b { font-size: 15.5px; }
  .brand-text span { font-size: 10.5px; }
  .topnav .lang { border-left: 0; padding-left: 0; margin-left: 0; }

  .hero { padding-top: 22px; padding-bottom: 6px; }
  .hero h1 { font-size: 26px; margin: 9px 0 8px; line-height: 1.22; }
  .lede { font-size: 13.8px; line-height: 1.58; }
  .facts { gap: 6px; margin-top: 13px; }
  .facts li { font-size: 11.5px; padding: 4px 10px; }
  .tabs { margin-top: 16px; }

  .tabs { margin-top: 20px; grid-template-columns: repeat(3, 1fr); }
  .tab { flex-direction: column; gap: 2px; font-size: 12.5px; padding: 11px 4px 10px; align-items: center; justify-content: center; }
  .tab i { font-size: 9.5px; }
  .tab .tab-label { text-align: center; line-height: 1.2; }

  .app { padding-top: 18px; }
  .panel > .card[style*="grid-column"] { padding: 20px 16px !important; }
  .inputs, .result { padding: 20px 18px 18px; }
  .panel-head h2 { font-size: 17.5px; }
  .panel-head p { font-size: 11.5px; }
  .panel-head .tag { display: none; }

  .field { padding-top: 18px; }
  .field-head label { font-size: 13.5px; }
  .input-row { height: 50px; padding: 0 12px; }
  .input-row input { font-size: 20px; }

  .result::before { left: 18px; right: 18px; }
  .big-out { font-size: 34px; }
  .donut-row { gap: 14px; }
  .donut { width: 108px; height: 108px; }
  .donut .center b { font-size: 18px; }
  .brow { grid-template-columns: minmax(0, 1fr) 46px auto; gap: 8px; font-size: 12.5px; }
  .brow .bl em { display: none; }
  .kpi b { font-size: 16.5px; }
  .kpi { padding: 10px 10px 11px; }
  .kpi span { font-size: 9.5px; }
  .kpi em { font-size: 9.5px; }
  .actions { gap: 6px; }
  .btn { padding: 11px 8px; font-size: 12px; }
  .btn svg { width: 14px; height: 14px; }
  .comp-key { grid-template-columns: 1fr; gap: 4px; }

  .rate-table { min-width: 0; font-size: 12px; }
  .rate-table th { font-size: 9.5px; padding: 0 6px 7px 0; }
  .rate-table td { padding: 8px 6px 8px 0; word-break: keep-all; }
  .rate-table td:last-child, .rate-table th:last-child { padding-right: 0; }
  #pay-table-wrap { min-width: 0; }
  #pay-table-wrap th:nth-child(3), #pay-table-wrap td:nth-child(3),
  #pay-table-wrap th:nth-child(4), #pay-table-wrap td:nth-child(4) { display: none; }

  .minibar { display: flex; }
  .guide { padding-top: 36px; margin-top: 30px; }
  .xlinks { grid-template-columns: 1fr; }
  .doc { padding-top: 26px; }
}

@media (min-width: 961px) {
  .minibar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

@media print {
  .topbar, .minibar, .actions, .tabs, .site-foot, .guide { display: none; }
  body { background: #fff; }
  .card, .result { box-shadow: none; }
}
