/* CapyCore Brief — стиль HH Radar: тёплая нейтральная гамма, лаймовый акцент, светлая и тёмная тема.
   Шрифты локальные (static/fonts), внешних запросов нет. */

@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/static/fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("/static/fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("/static/fonts/jbmono-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("/static/fonts/jbmono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: 246 245 240; --panel: 255 255 255; --raised: 239 238 232;
  --ink: 24 27 24; --muted: 92 99 92; --faint: 140 146 139; --line: 24 27 24;
  --accent: 77 124 15; --accent-ink: 255 255 255; --accent-soft: 236 245 214;
  --good: 21 128 61; --warn: 180 83 9; --bad: 190 18 60;
  --line-a: .11;
  --shadow: 0 1px 2px rgb(24 27 24 / .06), 0 8px 24px -12px rgb(24 27 24 / .12);
  --radius: 14px;
  --f-ui: "Onest", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: 12 14 13; --panel: 19 22 20; --raised: 27 31 28;
    --ink: 230 235 228; --muted: 150 158 150; --faint: 101 109 102; --line: 230 235 228;
    --accent: 190 242 100; --accent-ink: 16 22 6; --accent-soft: 38 50 20;
    --good: 134 239 172; --warn: 252 211 77; --bad: 253 164 175;
    --line-a: .09;
    --shadow: 0 1px 0 rgb(255 255 255 / .03) inset, 0 12px 32px -16px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: 12 14 13; --panel: 19 22 20; --raised: 27 31 28;
  --ink: 230 235 228; --muted: 150 158 150; --faint: 101 109 102; --line: 230 235 228;
  --accent: 190 242 100; --accent-ink: 16 22 6; --accent-soft: 38 50 20;
  --good: 134 239 172; --warn: 252 211 77; --bad: 253 164 175;
  --line-a: .09;
  --shadow: 0 1px 0 rgb(255 255 255 / .03) inset, 0 12px 32px -16px rgb(0 0 0 / .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: rgb(var(--ink));
  font: 16px/1.55 var(--f-ui);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  background-color: rgb(var(--bg));
  background-image:
    radial-gradient(circle at 0 0, rgb(var(--accent) / .07), transparent 40rem),
    linear-gradient(rgb(var(--line) / .035) 1px, transparent 1px),
    linear-gradient(90deg, rgb(var(--line) / .035) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
}
::selection { background: rgb(var(--accent) / .35); }
a { color: rgb(var(--accent)); text-underline-offset: 2px; }
a:hover { filter: brightness(1.1); }
h1, h2 { line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: clamp(26px, 6vw, 34px); margin: .25em 0 .4em; }
h2 { font-size: 19px; margin: 0 0 .6em; font-weight: 600; }
code { font-family: var(--f-mono); font-size: .9em; background: rgb(var(--raised)); padding: 2px 6px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: rgb(var(--muted)); }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* ── каркас ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: rgb(var(--panel) / .8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgb(var(--line) / var(--line-a));
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: rgb(var(--ink)); text-decoration: none; font-weight: 600; }
.brand:hover { filter: none; }
.brand-logo { width: 32px; height: 32px; flex: none; }
.logo-bg { fill: rgb(var(--raised)); }
.logo-on { fill: rgb(var(--accent)); }
.logo-line { stroke: rgb(var(--accent)); stroke-width: 2; stroke-linecap: round; fill: none; }
.logo-dim { opacity: .45; }
.brand-text { display: grid; line-height: 1.15; }
.brand-sub { color: rgb(var(--faint)); font-size: 12px; font-weight: 500; }
.topbar-step { margin-left: auto; color: rgb(var(--muted)); font-size: 13px; }
.theme-toggle {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid rgb(var(--line) / var(--line-a)); background: rgb(var(--raised));
  color: rgb(var(--muted)); cursor: pointer; font: inherit; font-size: 16px; line-height: 1;
}
.theme-toggle:hover { color: rgb(var(--ink)); border-color: rgb(var(--line) / .25); }
.theme-toggle::before { content: "☾"; }
:root[data-theme="dark"] .theme-toggle::before { content: "☀"; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle::before { content: "☀"; } }

.progress { height: 3px; background: rgb(var(--line) / .08); }
.progress-bar { height: 100%; width: 0; background: rgb(var(--accent)); box-shadow: 0 0 10px rgb(var(--accent) / .6); transition: width .3s ease; }

.wrap { width: 100%; max-width: 680px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.footer { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 18px 16px 26px;
  color: rgb(var(--faint)); font-size: 13px; border-top: 1px solid rgb(var(--line) / var(--line-a)); }
.footer a { color: rgb(var(--muted)); }

/* ── интро и шаги ───────────────────────────────────────────────────── */
.eyebrow { margin: 0; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: rgb(var(--faint)); font-weight: 600; }
.eyebrow .num { color: rgb(var(--accent)); letter-spacing: 0; }
.lead { color: rgb(var(--muted)); font-size: 17px; margin: 0 0 20px; }
.intro { padding-top: 4vh; }
.intro-points { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; }
.intro-points li { position: relative; padding-left: 22px; color: rgb(var(--ink)); }
.intro-points li::before { content: ""; position: absolute; left: 2px; top: .6em; width: 7px; height: 7px; border-radius: 50%;
  background: rgb(var(--accent)); box-shadow: 0 0 8px rgb(var(--accent) / .6); }
.done { text-align: center; padding-top: 10vh; }
.done-mark { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; position: relative;
  background: rgb(var(--accent-soft)); border: 2px solid rgb(var(--accent)); box-shadow: 0 0 24px -2px rgb(var(--accent) / .45); }
.done-mark::after { content: ""; position: absolute; left: 21px; top: 13px; width: 14px; height: 26px;
  border: solid rgb(var(--accent)); border-width: 0 3px 3px 0; transform: rotate(45deg); }

.step > h1 { margin-bottom: .3em; }
.q { margin: 0 0 14px; padding: 18px; background: rgb(var(--panel)); border: 1px solid rgb(var(--line) / var(--line-a));
  border-radius: 18px; box-shadow: var(--shadow); }
.q-label { margin: 0 0 4px; font-weight: 600; font-size: 16.5px; }
.q-hint { margin: 0 0 8px; color: rgb(var(--muted)); font-size: 14px; }
.q-foot { margin: 10px 0 0; color: rgb(var(--faint)); font-size: 12px; }
.req { color: rgb(var(--bad)); }

/* ── варианты ───────────────────────────────────────────────────────── */
.options { display: grid; gap: 6px; margin-top: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 13px; min-height: 46px;
  background: rgb(var(--bg)); color: rgb(var(--ink)); font: inherit; font-size: 15px;
  border: 1px solid rgb(var(--line) / var(--line-a)); border-radius: 12px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: rgb(var(--line) / .25); }
.opt:active { transform: translateY(1px); }
.opt:focus-visible, .btn:focus-visible, .seg-btn:focus-visible, .input:focus-visible, .theme-toggle:focus-visible, .link-btn:focus-visible {
  outline: 2px solid rgb(var(--accent) / .6); outline-offset: 2px; }
.opt-mark { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid rgb(var(--line) / .3); position: relative; }
.opt[role="checkbox"] .opt-mark { border-radius: 5px; }
.opt.on { border-color: rgb(var(--accent) / .55); background: rgb(var(--accent-soft)); }
.opt.on .opt-mark { border-color: rgb(var(--accent)); background: rgb(var(--accent)); }
.opt.on .opt-mark::after { content: ""; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 9px;
  border: solid rgb(var(--accent-ink)); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.opt-muted { color: rgb(var(--muted)); border-style: dashed; }

.input {
  width: 100%; padding: 11px 13px; font: inherit; font-size: 15px; color: rgb(var(--ink));
  background: rgb(var(--bg)); border: 1px solid rgb(var(--line) / var(--line-a)); border-radius: 12px;
}
.input::placeholder { color: rgb(var(--faint)); }
.input:focus { border-color: rgb(var(--accent) / .55); outline: none; }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.55; }
.other-input { margin: -2px 0 2px; border-color: rgb(var(--accent) / .35); }

/* ── голос ──────────────────────────────────────────────────────────── */
.voice-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.voice-status { color: rgb(var(--muted)); font-size: 13px; }
.voice-status .num, .voice-status { font-variant-numeric: tabular-nums; }
.voice-meter { width: 72px; height: 6px; border-radius: 999px; background: rgb(var(--line) / .12); overflow: hidden; }
.voice-meter-bar { display: block; height: 100%; width: 0; background: rgb(var(--accent)); border-radius: inherit;
  box-shadow: 0 0 8px rgb(var(--accent) / .6); transition: width .08s linear; }
.mic-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 14px; }
.mic-select { width: auto; max-width: 100%; flex: 1; padding: 8px 10px; font-size: 14px; }
.voice-list { display: grid; gap: 8px; margin-top: 10px; }
.voice-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px;
  background: rgb(var(--bg)); border: 1px solid rgb(var(--line) / var(--line-a)); }
.voice-item audio { flex: 1 1 0%; width: 0; min-width: 0; height: 36px; }
.voice-del { flex: none; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; cursor: pointer;
  font: inherit; font-size: 14px; color: rgb(var(--muted)); background: transparent;
  border: 1px solid rgb(var(--line) / var(--line-a)); border-radius: 9px; }
.voice-del:hover { color: rgb(var(--bad)); border-color: rgb(var(--bad) / .4); background: rgb(var(--bad) / .08); }
.voice-del:focus-visible { outline: 2px solid rgb(var(--accent) / .6); outline-offset: 2px; }
.voice-num { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; font-size: 12px;
  background: rgb(var(--accent-soft)); color: rgb(var(--ink)); }
.voice-dur { flex: none; font-size: 12.5px; }
.voice-counter { margin: 8px 0 0; }
.voice-saved { color: rgb(var(--good)); font-size: 14px; }
.mic { width: 8px; height: 8px; border-radius: 50%; background: rgb(var(--accent)); box-shadow: 0 0 8px rgb(var(--accent) / .7); display: inline-block; }
.btn-voice.recording { border-color: rgb(var(--bad) / .5); color: rgb(var(--bad)); background: rgb(var(--bad) / .08); }
.btn-voice.recording .mic { background: rgb(var(--bad)); box-shadow: 0 0 8px rgb(var(--bad) / .7); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .btn-voice.recording .mic { animation: none; } .progress-bar { transition: none; } }

/* ── файлы ──────────────────────────────────────────────────────────── */
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone { display: grid; gap: 2px; justify-items: center; padding: 16px; margin-top: 10px; cursor: pointer; text-align: center;
  border: 1.5px dashed rgb(var(--line) / .2); border-radius: 12px; background: rgb(var(--bg)); font-size: 14px; }
.dropzone:hover { border-color: rgb(var(--accent) / .6); }
.dropzone-title { color: rgb(var(--accent)); font-weight: 600; font-size: 15px; }
.file-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 14px; }
.file-name { word-break: break-all; }

/* ── матрица (сегментированный переключатель как в HH Radar) ────────── */
.matrix { display: grid; gap: 4px; margin-top: 10px; }
.matrix-row { display: grid; gap: 6px; padding: 8px 0; border-bottom: 1px solid rgb(var(--line) / var(--line-a)); }
.matrix-row:last-child { border-bottom: 0; }
.matrix-label { font-size: 15px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 12px;
  background: rgb(var(--raised)); border: 1px solid rgb(var(--line) / var(--line-a)); }
.seg-btn { height: 34px; padding: 0 6px; font: inherit; font-size: 13.5px; color: rgb(var(--muted)); background: transparent;
  border: 0; border-radius: 9px; cursor: pointer; }
.seg-btn:hover { color: rgb(var(--ink)); }
.seg-btn.on { background: rgb(var(--panel)); color: rgb(var(--ink)); box-shadow: var(--shadow); font-weight: 600; }
.seg-btn.on::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%;
  vertical-align: 2px; background: rgb(var(--accent)); box-shadow: 0 0 8px rgb(var(--accent) / .7); }
@media (min-width: 600px) {
  .matrix-row { grid-template-columns: 1fr 280px; align-items: center; }
}

/* ── кнопки и действия ──────────────────────────────────────────────── */
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions.nav { justify-content: space-between; margin-top: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  font: inherit; font-size: 15px; font-weight: 500; color: rgb(var(--ink)); background: rgb(var(--raised));
  border: 1px solid rgb(var(--line) / var(--line-a)); border-radius: 12px; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, filter .15s, transform .1s; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: rgb(var(--line) / .25); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: rgb(var(--accent)); color: rgb(var(--accent-ink)); border-color: transparent; font-weight: 600; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-ghost:hover:not(:disabled) { background: rgb(var(--raised)); }
.btn-danger { color: rgb(var(--bad)); border-color: rgb(var(--bad) / .4); background: rgb(var(--bad) / .08); }
.link-btn { padding: 0; font: inherit; font-size: 13.5px; color: rgb(var(--muted)); background: none; border: 0; text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: rgb(var(--bad)); }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin-top: 3px; accent-color: rgb(var(--accent)); }
.consent { padding: 16px 18px; margin: 4px 0 0; border: 1px solid rgb(var(--line) / var(--line-a)); border-radius: 18px;
  background: rgb(var(--panel)); box-shadow: var(--shadow); font-size: 15px; }
.intro .consent { margin-bottom: 4px; }
.intro-actions { margin-top: 16px; }
.consent-note { margin: 6px 2px 0; }
.form-error { margin: 12px 0 0; color: rgb(var(--bad)); }
.form-error:empty { margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ── админка и юридические страницы ─────────────────────────────────── */
.admin .wrap { max-width: 980px; }
.table-wrap { overflow-x: auto; background: rgb(var(--panel)); border: 1px solid rgb(var(--line) / var(--line-a)); border-radius: 18px; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td { padding: 11px 14px; border-bottom: 1px solid rgb(var(--line) / var(--line-a)); text-align: left; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.wrap-cell { white-space: normal; min-width: 220px; }
.legal .table-wrap { margin: 8px 0 16px; }
.legal .table th, .legal .table td { white-space: normal; font-family: var(--f-ui); font-size: 14px; }
.table th { color: rgb(var(--faint)); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.table td:first-child, .table td:nth-child(2) { font-family: var(--f-mono); font-size: 13px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 6px; font-size: 12px;
  background: rgb(var(--raised)); color: rgb(var(--muted)); }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: rgb(var(--faint)); }
.status-done::before { background: rgb(var(--good)); box-shadow: 0 0 8px rgb(var(--good) / .6); }
.status-error::before { background: rgb(var(--bad)); box-shadow: 0 0 8px rgb(var(--bad) / .6); }
.status-pending::before { background: rgb(var(--warn)); animation: pulse 1.6s ease-in-out infinite; }
.card { padding: 18px; margin: 0 0 14px; background: rgb(var(--panel)); border: 1px solid rgb(var(--line) / var(--line-a)); border-radius: 18px; box-shadow: var(--shadow); }
.card.danger { border-color: rgb(var(--bad) / .3); }
.brief, .answer-text { white-space: pre-wrap; word-break: break-word; }
.answers dt { margin-top: 14px; color: rgb(var(--muted)); font-size: 13.5px; }
.answers dd { margin: 3px 0 0; }
.answers audio { display: block; margin-top: 6px; max-width: 100%; }
.file-link { margin-right: 8px; }
.error-box { white-space: pre-wrap; padding: 12px; border-radius: 12px; background: rgb(var(--bad) / .08); color: rgb(var(--bad));
  font-family: var(--f-mono); font-size: 12.5px; overflow-x: auto; }
.delete-form { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.legal { max-width: 680px; }
.legal h2 { margin-top: 1.4em; }
.legal li { margin-bottom: 4px; }
