/* Токены — ТЗ §8: фон #F8F9FB, текст #203044, акцент #355F91, positive #237A68, attention #B57A24, muted #687789.
   Сетка 8 px, цели касания ≥44 px, WCAG 2.2 AA. */
@font-face { font-family: "Inter"; src: url("vendor/inter-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url("vendor/inter-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; src: url("vendor/inter-cyrillic.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

:root {
  --bg: #F8F9FB; --surface: #FFFFFF; --text: #203044; --accent: #355F91; --accent-weak: #E7EEF6;
  --positive: #237A68; --positive-weak: #E3F1EC; --attention: #8F5F17; --attention-src: #B57A24; --attention-weak: #F7EEDF;
  --danger: #A3392F; --danger-weak: #F6E5E3; --muted: #5E6C7D; --line: #DDE2E8; --line-strong: #C3CBD5;
  --radius: 8px; --shadow: 0 1px 2px rgba(32,48,68,.06), 0 2px 8px rgba(32,48,68,.05);
  --font: "Inter", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 24px; line-height: 32px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 18px; line-height: 24px; margin: 24px 0 8px; font-weight: 650; }
h3 { font-size: 15px; margin: 16px 0 8px; font-weight: 650; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 16px; z-index: 100; }
.skip:focus { left: 8px; }

/* Layout */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 0 24px; min-height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent); display: inline-block; position: relative; }
.brand-mark::after { content: ""; position: absolute; inset: 7px; border: 2px solid #fff; border-radius: 50%; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--radius); color: var(--text);
  text-decoration: none; font-weight: 500; }
.nav a[aria-current="page"] { background: var(--accent-weak); color: var(--accent); }
.nav a:hover { background: #EEF1F5; }
.top-right { display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
footer { max-width: 1280px; margin: 0 auto; padding: 16px 24px 40px; color: var(--muted); font-size: 13px; }

/* Controls */
button, .btn { font: inherit; min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 550; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #2C5282; }
button.ghost { border-color: transparent; background: transparent; }
button.danger { color: var(--danger); border-color: #E2B8B3; }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--text); min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--surface); width: 100%; }
textarea { min-height: 96px; resize: vertical; }
label { display: block; font-weight: 550; margin-bottom: 4px; }
.field { margin-bottom: 16px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px; align-items: end; }
.grid-filters .field { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-width: 44px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.lang-switch select { width: auto; min-width: 72px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 600; margin-bottom: 8px; font-size: 16px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 8px; background: var(--surface); cursor: pointer; font-weight: 450; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.choice input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--accent); }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.banner { display: flex; gap: 8px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); background: var(--accent-weak);
  border: 1px solid #C9D7E8; margin-bottom: 16px; font-size: 14px; }
.banner.warn { background: var(--attention-weak); border-color: #E9D2AC; }
.banner.err { background: var(--danger-weak); border-color: #E8C3BE; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi b { display: block; font-size: 24px; line-height: 32px; font-variant-numeric: tabular-nums; }

/* Table */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 13px; background: #FBFCFD; position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover { background: #F6F8FB; }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td a.rowlink { font-weight: 600; text-decoration: none; color: var(--text); }
td a.rowlink:hover { color: var(--accent); text-decoration: underline; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 8px 0; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line-strong); background: #F3F5F8; color: var(--text); white-space: nowrap; line-height: 20px; }
.badge.pos { background: var(--positive-weak); border-color: #B9DCD0; color: #1B5F51; }
.badge.att { background: var(--attention-weak); border-color: #E6CB9C; color: var(--attention); }
.badge.neg { background: var(--danger-weak); border-color: #E6BDB7; color: var(--danger); }
.badge.acc { background: var(--accent-weak); border-color: #C3D3E7; color: var(--accent); }
.badge.outline { background: transparent; border-style: dashed; }
.src-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Stage ribbon */
.ribbon { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 16px 0 4px; }
.ribbon div { padding: 8px; text-align: center; font-size: 13px; font-weight: 600; border-radius: 6px; border: 2px solid var(--line);
  color: var(--muted); background: var(--surface); }
.ribbon div.cand { border-style: dashed; border-color: var(--accent); color: var(--accent); }
.ribbon div.done { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 20px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); }
.timeline li.verified::before { background: var(--accent); }
.quote { margin: 8px 0; padding: 8px 12px; border-left: 3px solid var(--line-strong); background: #F7F8FA; font-size: 14px; border-radius: 0 6px 6px 0; }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }

/* Wizard */
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; counter-reset: s; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 110px; padding: 8px 0 0; border-top: 4px solid var(--line); font-size: 13px; color: var(--muted); font-weight: 600; }
.steps li.done, .steps li.current { border-color: var(--accent); color: var(--text); }
.wizard { max-width: 720px; }
.wizard-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 24px; }

/* Results */
.result { border-left: 6px solid var(--line-strong); }
.result.likely_eligible { border-left-color: var(--positive); }
.result.insufficient_information { border-left-color: var(--attention-src); }
.result.not_eligible { border-left-color: var(--danger); }
.result-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.result-head > div:last-child { margin-left: auto; }
.reasons { list-style: none; padding: 0; margin: 8px 0 0; }
.reasons li { padding: 8px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 150px 1fr; gap: 12px; }
.reasons li:first-child { border-top: 0; }
details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--accent); }

/* Map */
#map { height: 560px; border-radius: var(--radius); border: 1px solid var(--line); background: #EEF0F2; }
.maplibregl-popup-content { font: 14px/1.4 var(--font); color: var(--text); border-radius: var(--radius); max-height: 320px; overflow: auto; }
.maplibregl-popup-content ul { margin: 4px 0 0; padding-left: 16px; }

/* Login */
.login-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; padding: 24px; }
.login { width: 100%; max-width: 420px; }
.login h1 { margin-bottom: 8px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 20px;
  border-radius: var(--radius); z-index: 50; box-shadow: var(--shadow); }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.prose { max-width: 75ch; }
.prose p { margin-bottom: 12px; white-space: pre-line; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

@media (max-width: 960px) {
  .cols { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; padding: 8px 16px; }
  .menu-btn { display: inline-flex; margin-left: auto; }
  .nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; }
  .nav.open { display: flex; }
  main { padding: 16px; }
  .reasons li { grid-template-columns: 1fr; gap: 4px; }
  #map { height: 420px; }
}
@media (max-width: 480px) { .ribbon { grid-template-columns: 1fr; } h1 { font-size: 20px; } .card { padding: 16px; } }
@media print {
  .topbar, footer, .no-print, button { display: none !important; }
  body { background: #fff; font-size: 12px; } main { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 10px; color: var(--muted); word-break: break-all; }
}
