:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --ink: #17231c;
  --muted: #5c6b62;
  --line: #dfe5de;
  --brand: #1f7a4d;
  --brand-ink: #ffffff;
  --brand-soft: #e3f3ea;
  --accent: #d9822b;
  --warn-bg: #fff4e0;
  --warn-ink: #7a4a05;
  --best-bg: #dff3e6;
  --focus: #1457d9;
  --a: #1f7a4d; --b: #2a6fb0; --c: #b4561f; --d: #7a4aa8; --e: #8a7a14;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 28, .06), 0 4px 14px rgba(20, 40, 28, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101713; --surface: #18221c; --ink: #e8efe9; --muted: #9db0a3; --line: #2a382f;
    --brand: #4cc08a; --brand-ink: #08160e; --brand-soft: #1b3326;
    --warn-bg: #3a2c10; --warn-ink: #f2cf8a; --best-bg: #1d3a2a; --focus: #7aa7ff;
    --a: #4cc08a; --b: #6aa9e6; --c: #e58a54; --d: #b98ae0; --e: #cdbb4a;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(1100px, 100% - 32px); margin-inline: auto; }

/* Header */
.site { background: var(--surface); border-bottom: 1px solid var(--line); }
.site .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 0; }
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.logo span { color: var(--brand); }
.regions { display: flex; gap: 4px; flex-wrap: wrap; }
.regions a {
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); min-height: 36px; display: inline-flex; align-items: center;
}
.regions a.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Hero */
.hero { padding: 28px 0 12px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.15; letter-spacing: -.02em; }
.hero p { margin: 0 0 12px; color: var(--muted); max-width: 62ch; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.pills li { background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: .85rem; padding: 4px 12px; border-radius: 999px; }
#autonote { margin: 8px 0 0; font-size: .9rem; color: var(--muted); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin: 16px 0 12px; }
.seg { display: inline-flex; align-items: center; gap: 0; flex-wrap: wrap; }
.seg-l { font-size: .85rem; color: var(--muted); margin-right: 10px; font-weight: 600; }
.seg button {
  font: inherit; font-weight: 600; font-size: .92rem; padding: 8px 16px; min-height: 40px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); margin-left: -1px;
}
.seg button:first-of-type { border-radius: 10px 0 0 10px; margin-left: 0; }
.seg button:last-of-type { border-radius: 0 10px 10px 0; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); position: relative; z-index: 1; }
.opts { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-size: .9rem; min-height: 32px; }
.taxnote { font-size: .85rem; color: var(--muted); }
#taxbox { gap: 8px; }
.tax { width: 90px; }

/* Verdict */
.verdict {
  background: var(--surface); border: 2px solid var(--brand); border-radius: var(--radius);
  padding: 16px 18px; margin: 0 0 16px; box-shadow: var(--shadow);
}
.verdict.empty { border-color: var(--line); color: var(--muted); }
.verdict .big { display: block; font-size: 1.35rem; font-weight: 800; color: var(--brand); margin-bottom: 2px; }
.save { margin-top: 6px; }
.rank { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.rank li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg); }
.rank li.top { background: var(--best-bg); font-weight: 600; }
.rank .rv { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.warn, .note { margin-top: 10px; padding: 8px 12px; border-radius: 10px; font-size: .9rem; }
.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note { background: var(--brand-soft); }

/* Cards */
.cards { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: grid; gap: 10px; align-content: start; }
.card-h { display: flex; align-items: center; gap: 8px; }
.badge { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; color: #fff; font-weight: 800; font-size: .85rem; flex: none; }
.b0 { background: var(--a); } .b1 { background: var(--b); } .b2 { background: var(--c); } .b3 { background: var(--d); } .b4 { background: var(--e); }
.dark .badge { color: #08160e; }
@media (prefers-color-scheme: dark) { .badge { color: #08160e; } }
.name { flex: 1; min-width: 0; border: 0; border-bottom: 1px dashed var(--line); background: transparent; font: inherit; font-weight: 600; color: var(--ink); padding: 4px 2px; }
.name::placeholder { color: var(--muted); font-weight: 400; }
.icon { border: 1px solid var(--line); background: var(--surface); color: var(--muted); width: 34px; height: 34px; border-radius: 8px; font-size: 1.2rem; cursor: pointer; line-height: 1; }
.icon:disabled { opacity: .35; cursor: not-allowed; }
.f { display: grid; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.f[hidden] { display: none; }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-height: 42px; width: 100%; min-width: 0; font-size: 16px; }
input:focus, select:focus { border-color: var(--brand); }
.inp { display: flex; align-items: stretch; min-width: 0; }
.inp input { border-radius: 10px; flex: 1; }
.inp .pre { display: inline-flex; align-items: center; padding: 0 10px; background: var(--bg); border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; color: var(--muted); }
.inp .pre + input { border-radius: 0 10px 10px 0; }
.inp .pre.post { border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; }
.inp input:has(+ .post) { border-radius: 10px 0 0 10px; }
.inp select { width: auto; max-width: 48%; margin-left: 6px; flex: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 420px) { .row3 { grid-template-columns: 1fr 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: .85rem; padding: 5px 10px; min-height: 32px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--brand); }
details { border-top: 1px solid var(--line); padding-top: 8px; }
details > summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--brand); min-height: 28px; }
details[open] > summary { margin-bottom: 10px; }
details .row2, details .row3 { margin-bottom: 8px; }
.headline { margin-top: 2px; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); font-size: 1.05rem; }
.headline strong { font-size: 1.3rem; }
.muted { color: var(--muted); font-size: .88rem; font-weight: 400; }
.hint { color: var(--muted); font-size: .82rem; margin: 4px 0 0; }

/* Actions */
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0 24px; }
.btn { font: inherit; font-weight: 600; padding: 10px 16px; min-height: 42px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Table */
.tablewrap h2, .info h2 { font-size: 1.2rem; margin: 0 0 10px; }
.scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 460px; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); font-size: .92rem; white-space: nowrap; }
th[scope="row"] { text-align: left; font-weight: 600; color: var(--muted); position: sticky; left: 0; background: var(--surface); }
thead th { text-align: right; vertical-align: bottom; }
thead th .badge { margin-right: 6px; }
.th-n { display: inline-block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; font-weight: 600; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
td.best { background: var(--best-bg); font-weight: 700; color: var(--brand); }
td.na { color: var(--muted); }

/* Info + footer */
.info { margin: 36px 0; display: grid; gap: 20px; }
.info .grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.info .tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.info .tile h3 { margin: 0 0 6px; font-size: 1rem; }
.info .tile p { margin: 0; color: var(--muted); font-size: .92rem; }
.page { padding: 24px 0 40px; max-width: 760px; }
.page h1 { letter-spacing: -.02em; }
footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 40px; }
footer .wrap { padding: 20px 0 28px; display: grid; gap: 8px; font-size: .88rem; color: var(--muted); }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
noscript p { background: var(--warn-bg); color: var(--warn-ink); padding: 12px; border-radius: 10px; }
@media (prefers-reduced-motion: no-preference) { .verdict, .headline { transition: background .2s; } }
