/* ============================================================
   Умные анкеты — дизайн-система «умный бланк», v2
   Тёплая бумага + чернила + синяя ручка. Фирменный знак — зоны-светофор.
   Шрифты: Unbounded (дисплей), Golos Text (текст), JetBrains Mono (данные).
   ============================================================ */

@font-face { font-family: "Golos Text"; src: url("/static/fonts/golos-text-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/static/fonts/golos-text-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/static/fonts/golos-text-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/static/fonts/golos-text-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("/static/fonts/unbounded-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Unbounded"; src: url("/static/fonts/unbounded-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ink: #1b1f27;
  --ink-soft: #5b6472;
  --ink-faint: #8b93a1;
  --paper: #f4f2ec;          /* тёплая бумага */
  --paper-deep: #ece8df;
  --card: #ffffff;
  --line: #e7e2d8;
  --line-soft: #f0ece3;
  --pen: #2f53d6;            /* синяя ручка */
  --pen-deep: #2241ad;
  --pen-soft: #e9eefc;
  --hero: #1c2030;          /* тёмная чернильная панель */
  --hero-2: #262c40;
  --green: #1c9a5b;  --green-soft: #e2f3e9;
  --yellow: #c79100; --yellow-soft: #f8efce;
  --red: #d6453f;    --red-soft: #fbe6e4;
  --none: #b3b9c2;

  --r-sm: 9px; --r: 13px; --r-lg: 18px; --r-xl: 26px;
  --sh-1: 0 1px 2px rgba(28,32,40,.05), 0 2px 8px rgba(28,32,40,.045);
  --sh-2: 0 2px 4px rgba(28,32,40,.06), 0 10px 30px rgba(28,32,40,.07);
  --sh-3: 0 6px 16px rgba(28,32,40,.08), 0 22px 50px rgba(28,32,40,.10);
  --sh-pen: 0 6px 18px rgba(47,83,214,.28);

  --font-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --font-display: "Unbounded", var(--font-body);
  --font-data: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--pen); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--pen); outline-offset: 2px; border-radius: 5px; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.rise { animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r); border: 1px solid transparent; cursor: pointer;
  font: 600 15px var(--font-body); color: #fff; background: var(--ink); white-space: nowrap;
  transition: background .16s, transform .08s, box-shadow .16s, border-color .16s;
}
.btn:hover { background: #2a2f3b; text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-pen { background: var(--pen); box-shadow: var(--sh-pen); }
.btn-pen:hover { background: var(--pen-deep); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: var(--sh-1); }
.btn-ghost:hover { background: #fff; border-color: #d2cdc1; transform: translateY(-1px); }
.btn-danger { background: transparent; color: var(--red); border-color: transparent; box-shadow: none; }
.btn-danger:hover { background: var(--red-soft); transform: none; }
.btn-sm { padding: 7px 13px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }
.btn.is-disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; pointer-events: none; }

/* ---------- Поля ---------- */
.input, .textarea, .select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r);
  background: #fff; color: var(--ink); font: 400 15.5px var(--font-body);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:hover, .textarea:hover, .select:hover { border-color: #d6d1c5; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--pen); box-shadow: 0 0 0 4px var(--pen-soft);
}
.textarea { min-height: 104px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' stroke='%235b6472' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px; }
.field-label { display: block; font-weight: 600; font-size: 14px; margin: 0 0 7px; color: var(--ink); }
.field-hint { color: var(--ink-soft); font-size: 13.5px; margin: 5px 0 0; }
.field-error { color: var(--red); font-size: 13.5px; margin: 6px 0 0; font-weight: 500; }

.tag {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 7px;
  font: 500 12px var(--font-data); letter-spacing: .01em; background: var(--paper-deep); color: var(--ink-soft);
}
.status-draft { background: var(--paper-deep); color: var(--ink-soft); }
.status-active { background: var(--green-soft); color: var(--green); }
.status-closed { background: var(--red-soft); color: var(--red); }

/* ---------- Зоны (фирменный элемент) ---------- */
.zone-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.zone-dot.green, .zone-green .zone-dot { background: var(--green); }
.zone-dot.yellow, .zone-yellow .zone-dot { background: var(--yellow); }
.zone-dot.red, .zone-red .zone-dot { background: var(--red); }
.zone-dot.none, .zone-none .zone-dot { background: var(--none); }

.zone-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.zone-pill.green { background: var(--green-soft); color: var(--green); }
.zone-pill.yellow { background: var(--yellow-soft); color: #9a7400; }
.zone-pill.red { background: var(--red-soft); color: var(--red); }
.zone-pill.none { background: var(--paper-deep); color: var(--ink-soft); }

.zonebar { display: flex; height: 9px; border-radius: 99px; overflow: hidden; background: var(--line); gap: 2px; padding: 0; }
.zonebar > i { display: block; height: 100%; border-radius: 99px; transition: width .6s cubic-bezier(.2,.7,.3,1); }
.zonebar .z-green { background: var(--green); }
.zonebar .z-yellow { background: var(--yellow); }
.zonebar .z-red { background: var(--red); }
.zonebar .z-none { background: var(--none); opacity: .5; }

/* фирменный знак */
.brand { font: 600 16px var(--font-display); color: var(--ink); letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 11px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; gap: 4px; }
.brand-mark i { width: 9px; height: 9px; border-radius: 3px; }
.brand-mark i:nth-child(1) { background: var(--green); }
.brand-mark i:nth-child(2) { background: var(--yellow); }
.brand-mark i:nth-child(3) { background: var(--red); }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; display: block; flex: none; }
.eyebrow .brand-logo { width: 19px; height: 19px; border-radius: 5px; }

/* ---------- Каркас админки ---------- */
.topbar { background: rgba(255,255,255,.82); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 18px; height: 62px; }
.topbar nav a, .topbar .navlink { color: var(--ink-soft); font-size: 14.5px; font-weight: 500; }
.topbar nav a:hover, .topbar .navlink:hover { color: var(--ink); text-decoration: none; }
.topbar-spacer { flex: 1; }
.topbar .who { color: var(--ink-soft); font-size: 14px; }

/* кабинет: боковое меню + контент */
.shell { max-width: 1180px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 30px; align-items: start; }
.sidebar { position: sticky; top: 62px; padding: 28px 0 40px; display: flex; flex-direction: column; gap: 3px; }
.sidebar .spacer { flex: 1; min-height: 22px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 10px 13px; border-radius: 11px; color: var(--ink-soft); font: 500 15px var(--font-body); transition: background .14s, color .14s; }
.side-link:hover { background: var(--paper-deep); color: var(--ink); text-decoration: none; }
.side-link.on { background: var(--pen-soft); color: var(--pen); font-weight: 600; }
.side-link .ic { width: 19px; height: 19px; flex: none; display: inline-flex; }
.side-link .ic svg { width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: 1.7; }
.side-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.content { padding: 32px 0 96px; min-width: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 32px 24px 96px; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 26px; }
.page-title { font: 600 26px/1.2 var(--font-display); letter-spacing: -.02em; margin: 0; }
.page-head .grow, .page-head .topbar-spacer { flex: 1; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }

/* вкладки */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; overflow-x: auto; }
.tabs a { padding: 10px 16px 13px; color: var(--ink-soft); font-weight: 500; font-size: 15px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .15s; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--pen); font-weight: 600; }
.tabs .count { font-family: var(--font-data); font-size: 12px; color: var(--ink-soft); margin-left: 6px; }

/* ---------- Список анкет ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.form-card { padding: 22px; display: flex; flex-direction: column; gap: 15px; transition: border-color .16s, box-shadow .16s, transform .16s; }
.form-card:hover { border-color: #d8d3c7; box-shadow: var(--sh-2); transform: translateY(-2px); }
.form-card .t { font-weight: 600; font-size: 17.5px; color: var(--ink); line-height: 1.3; letter-spacing: -.01em; }
.form-card .t:hover { text-decoration: none; color: var(--pen); }
.form-card .meta { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-faint); font-family: var(--font-data); }
.form-card .nums { display: flex; gap: 16px; font: 500 14px var(--font-data); }
.nums .n-green { color: var(--green); } .nums .n-yellow { color: var(--yellow); }
.nums .n-red { color: var(--red); } .nums .n-total { color: var(--ink); }
.form-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.form-card-foot .resp { font: 500 14.5px var(--font-body); color: var(--ink); }
.form-card-foot .resp b { font-family: var(--font-data); }
.form-card-foot .zmini { display: flex; gap: 12px; font: 500 13.5px var(--font-data); color: var(--ink-soft); }
.form-card-foot .zmini span { display: inline-flex; align-items: center; gap: 5px; }
.form-card-foot .zmini .zone-dot { width: 9px; height: 9px; }
.form-card-dates { font: 400 12.5px var(--font-data); color: var(--ink-faint); letter-spacing: -.01em; }

.empty { text-align: center; padding: 72px 24px; color: var(--ink-soft); }
.empty h2 { font: 600 20px var(--font-display); color: var(--ink); margin: 0 0 10px; }
.empty p { margin: 0 0 22px; }

/* блок автосборки */
.ai-box { padding: 24px; border-radius: var(--r-lg); position: relative; overflow: hidden;
  background: linear-gradient(135deg, #fbfbf9, #fff); border: 1px solid var(--line); box-shadow: var(--sh-1); }
.ai-box .ai-eyebrow { display: inline-flex; align-items: center; gap: 8px; font: 600 12.5px var(--font-data); letter-spacing: .04em; text-transform: uppercase; color: var(--pen); margin-bottom: 12px; }
.manual-link { background: none; border: none; cursor: pointer; color: var(--ink-soft); font: 500 14.5px var(--font-body); padding: 2px 0; transition: color .14s; }
.manual-link:hover { color: var(--ink); }

/* сводка */
.summary { padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.dash-counts { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.dash-counts .big { font: 500 28px var(--font-data); letter-spacing: -.02em; }
.zone-chip { display: inline-flex; align-items: center; gap: 8px; font: 500 14px var(--font-data); padding: 5px 12px; border-radius: var(--r-sm); color: var(--ink); transition: background .14s, box-shadow .14s; }
.zone-chip:hover { background: var(--paper); text-decoration: none; }
.zone-chip.on { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ink); }

/* ---------- Конструктор ---------- */
.builder { display: flex; flex-direction: column; gap: 14px; }
.qcard { padding: 18px; position: relative; border-left: 3px solid var(--line); transition: border-color .16s, box-shadow .16s; }
.qcard.editing { border-left-color: var(--pen); }
.qcard:hover { box-shadow: var(--sh-2); }
.qcard .qhead { display: flex; gap: 12px; align-items: flex-start; }
.qcard .qnum { font: 500 13px var(--font-data); color: var(--ink-faint); padding-top: 13px; min-width: 24px; }
.qcard .qbody { flex: 1; min-width: 0; }
.qcard .qtools { display: flex; gap: 2px; align-items: center; }
.icon-btn { width: 34px; height: 34px; border: none; background: transparent; border-radius: var(--r-sm); cursor: pointer; color: var(--ink-faint); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; transition: background .14s, color .14s; }
.icon-btn:hover { background: var(--paper-deep); color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.qmeta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.qopts { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.qimage-box { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; align-items: flex-start; }
.qimage-preview { display: block; width: min(100%, 420px); max-height: 240px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--r); background: #fbfaf7; }
.qimage-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.file-input-hidden { position: fixed; left: -10000px; top: 0; width: 1px; height: 1px; opacity: 0; }
.qopt-row { display: flex; gap: 7px; align-items: center; }
.qopt-main { flex: 1; min-width: 220px; display: flex; gap: 7px; align-items: center; }
.qopt-row .input { padding: 8px 11px; font-size: 14.5px; }
.qopt-row-image { align-items: flex-start; flex-wrap: wrap; padding: 9px; border: 1px solid var(--line-soft); border-radius: var(--r); background: #fff; }
.qoption-image { flex: 1 1 260px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qoption-image-preview { width: 112px; height: 82px; object-fit: cover; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fbfaf7; }
.qroutes { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 8px; }
.quiz-box { margin-top: 14px; padding: 13px; border: 1px solid var(--line-soft); border-radius: var(--r); background: #fbfaf7; display: flex; flex-direction: column; gap: 8px; }
.qroutes-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--ink); font-weight: 600; font-size: 13.5px; }
.qroutes-head small { color: var(--ink-faint); font-weight: 500; }
.qroute-row { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(220px, 1.2fr); gap: 8px; align-items: center; min-width: 0; }
.qroute-option { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 10px; border-radius: var(--r-sm); background: var(--paper); color: var(--ink); font-size: 14px; }
.qroute-row .select { min-width: 0; padding-top: 8px; padding-bottom: 8px; font-size: 14.5px; }
.check { display: inline-flex; gap: 9px; align-items: center; font-size: 14px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--pen); }
.add-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.builder-foot { position: sticky; bottom: 0; padding: 14px 0; margin-top: 8px; background: linear-gradient(transparent, var(--paper) 38%); display: flex; gap: 14px; align-items: center; }
.save-note { font-size: 13.5px; color: var(--ink-soft); }
.save-note.ok { color: var(--green); font-weight: 500; }
.save-note.err { color: var(--red); font-weight: 500; }

.embed-panel { border: 1px solid var(--line); border-radius: var(--r); background: #fbfaf7; padding: 14px; display: grid; gap: 12px; }
.domain-panel { border: 1px solid var(--line); border-radius: var(--r); background: #fbfaf7; padding: 14px; display: grid; gap: 12px; }
.embed-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.embed-code { min-height: 118px; font: 500 12.5px/1.5 var(--font-data); color: var(--ink-soft); background: #fff; resize: vertical; }
.embed-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.field-map { flex: 1 1 100%; margin-top: 4px; padding: 12px; border-radius: var(--r); background: #fbfaf7; border: 1px solid var(--line-soft); display: grid; gap: 9px; }
.field-map-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; color: var(--ink); font-weight: 600; font-size: 14px; }
.field-map-head small { color: var(--ink-soft); font-weight: 400; font-size: 12.5px; text-align: right; }
.field-map-subhead { margin-top: 2px; padding-top: 6px; border-top: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 600; color: var(--ink-faint); }
.field-map-head + .field-map-subhead { margin-top: 0; padding-top: 0; border-top: 0; }
.field-map-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(210px, 280px); gap: 10px; align-items: center; }
.field-map-source { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.field-map-source strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 500; color: var(--ink); }

/* ---------- Биллинг ---------- */
.billing-grid { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 16px; }
.billing-balance, .billing-rules { padding: 22px; }
.billing-balance-num { font: 600 48px/1 var(--font-display); letter-spacing: 0; margin-top: 12px; color: var(--ink); }
.billing-balance p { margin: 6px 0 0; color: var(--ink-soft); }
.billing-rules-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.billing-rules-list span { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; color: var(--ink-soft); font-size: 14px; }
.billing-rules-list b { color: var(--ink); font-family: var(--font-data); }
.billing-packages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.billing-package { border: 1px solid var(--line); border-radius: var(--r); background: #fff; padding: 16px; display: grid; gap: 16px; }
.billing-package h3 { margin: 0 0 5px; font-size: 18px; }
.billing-package p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
.billing-package-main b { display: block; font: 600 30px/1 var(--font-display); letter-spacing: 0; }
.billing-package-main span { color: var(--ink-faint); font-size: 13px; }
.billing-package-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.billing-package-foot strong { font-size: 18px; }
.billing-custom {
  margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r);
  background: #fbfaf7; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) minmax(260px, 1fr) auto;
  gap: 14px; align-items: end;
}
.billing-custom h3 { margin: 0 0 5px; font-size: 18px; }
.billing-custom p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.45; }
.billing-custom-input .field-label { margin-bottom: 7px; }
.billing-custom-estimate-wrap { align-self: center; display: grid; gap: 7px; }
.billing-custom-estimate { display: flex; gap: 8px; flex-wrap: wrap; align-self: center; }
.billing-custom-estimate > span {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: #fff;
  color: var(--ink-soft); font-size: 13.5px;
}
.billing-custom-estimate b { color: var(--ink); font-family: var(--font-data); }
.billing-custom-estimate .billing-token-pill {
  padding: 9px 12px 9px 10px; gap: 8px; border-color: #dfc76b;
  background: linear-gradient(135deg, #fff7d6 0%, #fffef9 72%);
  color: var(--ink); box-shadow: inset 0 0 0 1px rgba(199,145,0,.13), var(--sh-1);
  font-size: 15px; font-weight: 500;
}
.billing-token-pill b { font-size: 15.5px; font-weight: 700; }
.billing-token-pill em { font-style: normal; color: var(--ink-soft); }
.token-icon {
  position: relative; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%;
  background: radial-gradient(circle at 36% 28%, #fff9c7 0 22%, #e4b83e 23% 62%, #b78300 63% 100%);
  box-shadow: inset 0 0 0 2px rgba(255,246,183,.72), 0 1px 3px rgba(120,86,0,.22);
}
.token-icon::after {
  content: "T"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 11px var(--font-data); color: #5b4100;
}

/* ---------- Дашборд ответов ---------- */
.rtable { width: 100%; border-collapse: collapse; }
.rtable th { text-align: left; font: 500 11.5px var(--font-data); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-faint); padding: 12px 16px; border-bottom: 1px solid var(--line); }
.rtable td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; vertical-align: middle; }
.rtable tr:last-child td { border-bottom: none; }
.rtable tbody tr { cursor: pointer; transition: background .12s; }
.rtable tbody tr:hover { background: #fbfaf7; }
.rtable .zcell { width: 4px; padding: 0; }
.rtable .zcell i { display: block; width: 4px; height: 100%; min-height: 48px; border-radius: 0 3px 3px 0; }
.rtable tr.zone-green .zcell i { background: var(--green); }
.rtable tr.zone-yellow .zcell i { background: var(--yellow); }
.rtable tr.zone-red .zcell i { background: var(--red); }
.rtable tr.zone-none .zcell i { background: transparent; }
.rtable .mono { font: 400 13.5px var(--font-data); color: var(--ink-soft); white-space: nowrap; }

/* ---------- Детальная страница ответа ---------- */
.answer-list { display: flex; flex-direction: column; }
.answer-row { padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.answer-row:last-child { border-bottom: none; }
.answer-row .q { font-size: 13px; color: var(--ink-faint); margin-bottom: 4px; font-weight: 500; }
.answer-row .a { font-size: 15.5px; white-space: pre-wrap; word-break: break-word; }
.answer-row .a.muted { color: var(--none); }
.criteria-details { overflow: hidden; }
.criteria-details summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 24px 18px 18px; cursor: pointer; list-style: none; font-weight: 600; line-height: 1.3;
}
.criteria-details summary::-webkit-details-marker { display: none; }
.criteria-details summary small { color: var(--ink-faint); font: 500 12.5px var(--font-data); white-space: nowrap; }
.criteria-details summary::after {
  content: "Раскрыть"; flex: none; min-width: 78px; padding: 4px 9px; border-radius: 7px;
  background: var(--paper); color: var(--ink-soft); font: 500 12px var(--font-body);
  text-align: center;
}
.criteria-details[open] summary { border-bottom: 1px solid var(--line-soft); }
.criteria-details[open] summary::after { content: "Скрыть"; }
.criteria-details-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Вход (сплит-герой) ---------- */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-hero { background: linear-gradient(155deg, var(--hero), var(--hero-2)); color: #fff; padding: 56px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(47,83,214,.35), transparent 70%); }
.auth-hero .brand { color: #fff; position: relative; z-index: 1; }
.auth-hero-mid { position: relative; z-index: 1; max-width: 460px; }
.auth-hero h2 { font: 600 38px/1.15 var(--font-display); letter-spacing: -.02em; margin: 0 0 18px; }
.auth-hero p { font-size: 17px; line-height: 1.55; color: rgba(255,255,255,.72); margin: 0; }
.hero-legend { display: flex; flex-direction: column; gap: 14px; margin-top: 36px; }
.hero-legend .row { display: flex; align-items: center; gap: 13px; font-size: 15.5px; color: rgba(255,255,255,.9); }
.hero-legend .row .zone-dot { width: 13px; height: 13px; border-radius: 4px; box-shadow: 0 0 0 4px rgba(255,255,255,.06); }
.auth-hero .foot { position: relative; z-index: 1; color: rgba(255,255,255,.45); font-size: 13px; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 32px; }
.auth-stack { width: 100%; max-width: 500px; display: flex; flex-direction: column; gap: 13px; }
.auth-card { width: 100%; display: flex; flex-direction: column; gap: 17px; }
.auth-card h1 { font: 600 27px var(--font-display); margin: 0; letter-spacing: -.02em; }
.auth-card .sub { color: var(--ink-soft); font-size: 15px; margin: -8px 0 4px; }
.auth-card .btn { width: 100%; padding: 13px; font-size: 15.5px; margin-top: 4px; }
.auth-links { display: flex; justify-content: center; min-height: 20px; font-size: 14.5px; }
.auth-divider { display: grid; grid-template-columns: 1fr auto 1fr; gap: 11px; align-items: center; color: var(--ink-faint); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--line); }
.auth-social { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-social-btn { width: 100%; min-height: 58px; padding: 12px 16px; color: var(--ink); gap: 10px; font-size: 15.5px; }
.auth-social-btn[aria-disabled="true"] { opacity: .55; box-shadow: none; }
.auth-social-icon { width: 30px; height: 30px; flex: 0 0 30px; display: block; }

/* ============================================================
   Публичная анкета — «бланк для людей»
   ============================================================ */
.pub-body { background: var(--paper); min-height: 100vh; }
.pub-wrap { max-width: 680px; margin: 0 auto; padding: 40px 18px 90px; }
.pub-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-3); overflow: hidden; }
.pub-embed-body { background: transparent; min-height: auto; }
.pub-embed-body .pub-wrap { max-width: 760px; padding: 0; }
.pub-embed-body .pub-card { border-radius: 18px; box-shadow: none; }
.pub-embed-body .pub-head { padding-top: 30px; }
.pub-cover { display: block; width: 100%; max-height: 300px; object-fit: cover; }
.pub-head { padding: 34px 34px 26px; position: relative; background: linear-gradient(180deg, #fff, #fdfcfa); border-bottom: 1px solid var(--line); }
.pub-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(var(--green), var(--yellow), var(--red)); }
.pub-head .eyebrow { display: inline-flex; align-items: center; gap: 9px; font: 600 12px var(--font-display); letter-spacing: -.01em; color: var(--ink-soft); margin-bottom: 14px; }
.pub-head .eyebrow .brand-mark i { width: 8px; height: 8px; }
.pub-head h1 { font: 600 27px/1.25 var(--font-display); margin: 0; letter-spacing: -.02em; }
.pub-head .desc { margin: 12px 0 0; color: var(--ink-soft); font-size: 16px; line-height: 1.55; white-space: pre-wrap; }
.pub-form { padding: 10px 34px 30px; }
.pub-q { padding: 22px 0; border-bottom: 1px solid var(--line-soft); }
.pub-q:last-of-type { border-bottom: none; }
.pub-q .label { display: block; font-weight: 600; font-size: 16px; margin-bottom: 5px; line-height: 1.4; }
.pub-q .label .req { color: var(--red); margin-left: 3px; }
.pub-q .hint { color: var(--ink-soft); font-size: 14px; margin: 0 0 12px; }
.pub-question-image { display: block; width: 100%; max-height: 360px; object-fit: contain; border: 1px solid var(--line); border-radius: var(--r); background: #fbfaf7; margin: 14px 0 16px; }
.pub-q.has-error .input, .pub-q.has-error .textarea, .pub-q.has-error .select { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.pub-q .info-text { color: var(--ink-soft); font-size: 15px; white-space: pre-wrap; line-height: 1.6; }

.choice-list { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: var(--r); cursor: pointer; background: #fff; transition: border-color .14s, background .14s, box-shadow .14s; font-size: 15.5px; }
.choice:hover { border-color: var(--pen); background: #fcfdff; }
.choice input { width: 19px; height: 19px; margin-top: 1px; accent-color: var(--pen); flex: none; }
.choice:has(input:checked) { border-color: var(--pen); background: var(--pen-soft); box-shadow: inset 0 0 0 1px var(--pen); }

.image-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.image-choice {
  display: grid; gap: 10px; padding: 10px; border: 1.5px solid var(--line); border-radius: var(--r);
  background: #fff; cursor: pointer; transition: border-color .14s, background .14s, box-shadow .14s, transform .08s;
}
.image-choice:hover { border-color: var(--pen); background: #fcfdff; transform: translateY(-1px); }
.image-choice input { position: absolute; opacity: 0; pointer-events: none; }
.image-choice img, .image-choice-empty { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-sm); object-fit: cover; background: #fbfaf7; border: 1px solid var(--line-soft); }
.image-choice-empty { display: flex; align-items: center; justify-content: center; color: var(--ink-faint); font-size: 13.5px; }
.image-choice-label { font-weight: 600; line-height: 1.35; color: var(--ink); }
.image-choice:has(input:checked) { border-color: var(--pen); background: var(--pen-soft); box-shadow: inset 0 0 0 1px var(--pen); }

.scale-row { display: flex; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.scale-row label { flex: 1; min-width: 40px; text-align: center; padding: 11px 0; border: 1.5px solid var(--line); border-radius: var(--r); cursor: pointer; font: 500 15.5px var(--font-data); background: #fff; transition: border-color .14s, background .14s, transform .08s; }
.scale-row label:hover { border-color: var(--pen); transform: translateY(-1px); }
.scale-row label:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.scale-row input { position: absolute; opacity: 0; pointer-events: none; }
.scale-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-faint); margin-top: 8px; }

.file-drop { margin-top: 12px; border: 1.5px dashed var(--line); border-radius: var(--r); padding: 20px; text-align: center; color: var(--ink-soft); font-size: 14px; background: #fcfbf8; transition: border-color .14s, background .14s; }
.file-drop:hover { border-color: var(--pen); background: #fcfdff; }
.file-drop input { display: block; margin: 10px auto 0; font-size: 13.5px; }

.pub-form[data-display-mode="step"] .pub-q { min-height: 210px; border-bottom: none; }
.pub-step-nav { margin-top: 22px; display: grid; grid-template-columns: minmax(96px, auto) 1fr minmax(96px, auto); gap: 10px; align-items: center; }
.pub-step-nav[hidden] { display: none; }
.pub-step-nav [hidden] { display: none !important; }
.pub-step-count { text-align: center; color: var(--ink-soft); font: 500 13.5px var(--font-data); }
.pub-submit { margin-top: 26px; }
.pub-submit .btn { justify-content: center; padding: 15px 24px; font-size: 16.5px; width: 100%; }
.pub-foot { text-align: center; margin-top: 22px; font-size: 12.5px; color: var(--ink-faint); }
.pub-foot a { color: inherit; }
.pub-foot .brand-mark { display: inline-flex; gap: 3px; vertical-align: middle; margin-right: 5px; }
.pub-foot .brand-mark i { width: 6px; height: 6px; }
.error-summary { background: var(--red-soft); color: var(--red); border-radius: var(--r); padding: 13px 16px; font-size: 14.5px; font-weight: 500; margin: 16px 0 0; }

/* страница «спасибо» */
.thanks-card { text-align: center; padding: 64px 36px; }
.thanks-mark { width: 76px; height: 76px; margin: 0 auto 24px; border-radius: 50%; background: var(--green-soft); display: flex; align-items: center; justify-content: center; }
.thanks-mark svg { width: 36px; height: 36px; stroke: var(--green); }
.thanks-card h1 { font: 600 24px var(--font-display); margin: 0 0 14px; letter-spacing: -.02em; }
.thanks-card p { color: var(--ink-soft); font-size: 16.5px; line-height: 1.6; white-space: pre-wrap; margin: 0 auto; max-width: 440px; }
.test-result-card { margin: 0 auto 18px; max-width: 360px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: #fbfaf7; display: grid; gap: 4px; }
.test-result-card strong { font: 600 22px/1.25 var(--font-display); color: var(--ink); }
.test-result-card span:last-child { color: var(--ink-soft); font: 500 14px var(--font-data); }

/* недоступная анкета */
.closed-mark { font-size: 40px; margin-bottom: 18px; }

/* ---------- Мобильная адаптация ---------- */
@media (max-width: 880px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { min-height: 100vh; }
  .auth-stack { min-width: 0; max-width: 100%; }
  .shell { grid-template-columns: 1fr; gap: 0; }
  .topbar-in { max-width: 100%; min-width: 0; overflow-x: auto; }
  .topbar-in .brand, .topbar-in .btn, .topbar-in form { flex: none; }
  .sidebar { position: static; flex-direction: row; overflow-x: auto; padding: 12px 0 0; gap: 6px; }
  .sidebar .spacer, .sidebar .side-sep { display: none; }
  .side-link { white-space: nowrap; padding: 8px 12px; }
  .content { padding: 22px 0 64px; }
}
@media (max-width: 640px) {
  .auth-panel { padding: 32px 16px; align-items: flex-start; }
  .auth-social { grid-template-columns: 1fr; }
  .auth-social-btn { min-height: 54px; }
  .wrap { padding: 22px 16px 64px; }
  .page-title { font-size: 22px; }
  .topbar-in { padding: 0 16px; height: 56px; gap: 12px; }
  .topbar .who { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .card, .builder, .qcard, .qbody, .field-map, .billing-grid, .billing-packages, .billing-custom { min-width: 0; }
  .rtable { table-layout: fixed; }
  .rtable th, .rtable td { overflow-wrap: anywhere; }
  .rtable .mono { white-space: normal; font-size: 12px; }
  .rtable .hide-m { display: none; }
  .rtable th, .rtable td { padding: 11px 10px; }
  .pub-wrap { padding: 22px 12px 70px; }
  .pub-embed-body .pub-wrap { padding: 0; }
  .pub-head { padding: 26px 22px 22px; }
  .pub-head h1 { font-size: 23px; }
  .pub-form { padding: 6px 22px 24px; }
  .pub-form[data-display-mode="step"] .pub-q { min-height: 180px; }
  .pub-step-nav { grid-template-columns: 1fr 1fr; }
  .pub-step-count { grid-column: 1 / -1; grid-row: 1; }
  .pub-step-nav [data-step-prev] { grid-column: 1; grid-row: 2; }
  .pub-step-nav [data-step-next] { grid-column: 2; grid-row: 2; }
  .pub-step-nav .btn { width: 100%; justify-content: center; }
  .image-choice-grid { grid-template-columns: 1fr; }
  .field-map-head { flex-direction: column; align-items: flex-start; gap: 2px; }
  .field-map-head small { text-align: left; }
  .field-map-row { grid-template-columns: 1fr; }
  .billing-grid, .billing-packages { grid-template-columns: 1fr; }
  .billing-custom { grid-template-columns: 1fr; align-items: stretch; }
  .billing-custom .btn { width: 100%; justify-content: center; }
  .qcard .qhead { flex-wrap: wrap; }
  .qcard .qtools { margin-left: auto; }
  .qopt-row, .builder-foot { flex-wrap: wrap; }
  .qopt-main { min-width: 0; flex: 1 1 100%; }
  .qoption-image { flex: 1 1 100%; min-width: 0; }
  .add-row .select { width: 100% !important; min-width: 0 !important; }
  .qroute-row { grid-template-columns: 1fr; }
  .qroutes-head { flex-direction: column; align-items: flex-start; gap: 2px; }
}
