:root {
  --bg: #F2F4F6;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --ink: #19212C;
  --muted: #637082;
  --line: #E1E5EA;
  --brand: #0F6E66;
  --brand-ink: #FFFFFF;
  --brand-soft: #E3F1EF;
  --sun: #FFD25E;
  --danger: #C23B2E;
  --chart: #0F6E66;
  --shadow: 0 1px 2px rgba(25, 33, 44, .06), 0 4px 16px rgba(25, 33, 44, .05);
  --radius: 12px;
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Unbounded', 'Onest', system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101419; --surface: #181D24; --surface-2: #1E242C; --ink: #E9EDF1; --muted: #9AA6B3; --line: #2A323C;
    --brand: #3FA79B; --brand-ink: #0B1513; --brand-soft: #173430; --danger: #F07A6E; --chart: #4FB3A8;
    --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
[hidden] { display: none !important; }

/* ---------- primitives ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 14px; border-radius: 8px; }
.btn-icon { width: 32px; min-height: 32px; padding: 0; border-radius: 8px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }

.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.textarea { resize: vertical; min-height: 72px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-4 { grid-template-columns: repeat(4, 1fr); }
.hint { font-size: 13px; color: var(--muted); margin: -8px 0 16px; }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 12px; user-select: none; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.badge { display: inline-flex; align-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--sun); color: #3A2A00; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-right: 8px; }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.pill.is-live { color: var(--ink); }
.pill.is-live::before { background: #2E9E5B; }
.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty h3 { color: var(--ink); font-size: 18px; margin-bottom: 8px; }
.empty p { margin: 0 0 20px; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; }
.toast { background: #222A35; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.is-error { background: var(--danger); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 400px; padding: 32px; }
.auth-box h1 { font-size: 22px; margin: 20px 0 6px; }
.auth-box p { color: var(--muted); margin: 0 0 24px; }
.auth-box .btn-primary { width: 100%; min-height: 46px; margin-top: 4px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }
.form-error { color: var(--danger); font-size: 14px; margin: 0 0 12px; }

/* ---------- shell ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font: 700 18px/1 var(--display); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.logo-mark { width: 28px; height: 28px; flex: none; }
.topbar { display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-nav { display: flex; gap: 4px; margin-left: 16px; }
.topbar-nav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.topbar-nav a:hover { color: var(--ink); background: var(--surface-2); }
.topbar-nav a.is-active { color: var(--ink); background: var(--surface-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user { color: var(--muted); font-size: 14px; }
.page { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; letter-spacing: -.01em; }

/* ---------- quiz list ---------- */
.quiz-list { display: grid; gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.quiz-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px 96px 300px; align-items: center; gap: 16px; padding: 16px 20px; background: var(--surface); }
.quiz-row-head { font-size: 13px; color: var(--muted); padding-top: 10px; padding-bottom: 10px; }
.quiz-name { font-weight: 600; color: var(--ink); text-decoration: none; font-size: 16px; }
.quiz-name:hover { color: var(--brand); }
.quiz-meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.quiz-num { font-variant-numeric: tabular-nums; font-weight: 500; }
.quiz-num a { color: inherit; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.quiz-actions { display: flex; gap: 4px; justify-content: flex-end; }

.modal-back { position: fixed; inset: 0; background: rgba(12, 16, 22, .5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; padding: 28px; }
.modal h2 { font-size: 20px; margin-bottom: 20px; }
.tpl-grid { display: grid; gap: 10px; }
.tpl { text-align: left; padding: 16px 18px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.tpl:hover { border-color: var(--brand); }
.tpl b { display: block; font-size: 16px; margin-bottom: 2px; }
.tpl span { color: var(--muted); font-size: 14px; }

/* ---------- editor ---------- */
.ed { height: 100vh; display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); }
.ed-top { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.ed-name { border: 1px solid transparent; background: transparent; font-weight: 600; font-size: 16px; padding: 6px 8px; border-radius: 8px; width: 240px; min-width: 0; }
.ed-name:hover { border-color: var(--line); }
.ed-name:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.ed-tabs { display: flex; gap: 2px; margin: 0 auto; min-width: 0; overflow-x: auto; }
.ed-tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.ed-tabs a:hover { color: var(--ink); background: var(--surface-2); }
.ed-tabs a.is-active { color: var(--brand); background: var(--brand-soft); }
.ed-save { font-size: 13px; color: var(--muted); min-width: 92px; text-align: right; }
.ed-body { min-height: 0; display: grid; grid-template-columns: 260px 380px minmax(0, 1fr); }
.ed-body.is-wide { grid-template-columns: 1fr; overflow: auto; }

.steps { overflow: auto; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--surface); }
.steps-group { font-size: 12px; color: var(--muted); padding: 16px 10px 6px; font-weight: 500; }
.steps-group:first-child { padding-top: 0; }
.step {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent;
  text-align: left; cursor: pointer; font-size: 14px; position: relative;
}
.step:hover { background: var(--surface-2); }
.step.is-active { background: var(--brand-soft); color: var(--ink); }
.step.is-off { color: var(--muted); }
.step-n { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.step.is-active .step-n { background: var(--brand); color: var(--brand-ink); }
.step-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step[draggable="true"] { cursor: grab; }
.step.is-drop { box-shadow: inset 0 2px 0 var(--brand); }
.steps-add { margin: 6px 0 0; width: 100%; justify-content: flex-start; color: var(--brand); border-style: dashed; }

.panel { overflow: auto; padding: 20px; border-right: 1px solid var(--line); background: var(--surface); }
.panel h2 { font-size: 17px; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel h3 { font-size: 14px; margin: 24px 0 12px; }
.types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 18px; }
.type { padding: 10px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 12px; display: grid; justify-items: center; gap: 4px; text-align: center; }
.type:hover { border-color: var(--brand); }
.type.is-on { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.type svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.opts { display: grid; gap: 8px; margin-bottom: 10px; }
.opt { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface-2); display: grid; gap: 6px; }
.opt-row { display: flex; gap: 6px; align-items: center; }
.opt-row .input { min-height: 36px; padding: 6px 10px; }
.opt-next { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.opt-next .select { min-height: 30px; padding: 2px 8px; font-size: 13px; }

.img-field { display: flex; gap: 8px; align-items: center; }
.img-thumb { width: 40px; height: 40px; border-radius: 8px; background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--line); flex: none; }
.img-thumb-btn { cursor: pointer; padding: 0; color: var(--muted); font-size: 18px; height: 36px; width: 36px; }
.img-thumb-btn:hover { border-color: var(--brand); }
.img-field .input { min-height: 36px; padding: 6px 10px; font-size: 13px; }

.preview { min-width: 0; display: grid; grid-template-rows: auto 1fr; background: var(--bg); }
.preview-bar { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 10px; }
.preview-stage { min-height: 0; display: flex; justify-content: center; padding: 0 20px 20px; }
.preview-frame { width: 100%; height: 100%; border: 0; border-radius: 12px; background: #fff; box-shadow: var(--shadow); transition: width .2s; }
.preview-frame.is-mobile { width: 375px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.is-on { background: var(--brand-soft); color: var(--ink); font-weight: 500; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.is-on { box-shadow: 0 0 0 2px var(--ink); }
.swatches input[type="color"] { width: 36px; height: 36px; border: 0; padding: 0; background: none; cursor: pointer; }

.layouts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.layout { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 6px; cursor: pointer; display: grid; gap: 4px; font-size: 12px; justify-items: center; }
.layout.is-on { border-color: var(--brand); background: var(--brand-soft); }
.layout i { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 100%; height: 30px; }
.layout i b { background: var(--line); border-radius: 2px; }
.layout i b.img { background: var(--brand); opacity: .5; }

/* wide settings pages (integrations, install, leads, stats) */
.wide { max-width: 860px; margin: 0 auto; padding: 32px 24px 64px; width: 100%; }
.wide-xl { max-width: 1120px; }
.section { padding: 24px; margin-bottom: 16px; }
.section h2 { font-size: 18px; margin-bottom: 6px; }
.section > p { color: var(--muted); margin: 0 0 18px; }
.code { position: relative; }
.code pre { margin: 0; padding: 14px 16px; padding-right: 110px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; font: 13px/1.5 ui-monospace, 'Cascadia Code', Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.code .btn { position: absolute; top: 8px; right: 8px; }

/* ---------- leads ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.leads { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lead { border-top: 1px solid var(--line); }
.lead:first-child { border-top: 0; }
.lead-sum { display: grid; grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr) 150px 20px; gap: 16px; align-items: center; padding: 14px 20px; cursor: pointer; }
.lead-sum:hover { background: var(--surface-2); }
.lead-date { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lead-who b { display: block; }
.lead-who span { font-size: 13px; color: var(--muted); }
.lead-quiz { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-new .lead-who b::after { content: 'новая'; margin-left: 8px; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: var(--sun); color: #3A2A00; vertical-align: 2px; }
.lead-chev { color: var(--muted); transition: transform .15s; }
.lead.is-open .lead-chev { transform: rotate(90deg); }
.lead-body { padding: 4px 20px 20px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; }
.answers { margin: 0; display: grid; gap: 10px; }
.answers dt { font-size: 13px; color: var(--muted); }
.answers dd { margin: 0; font-weight: 500; }
.lead-side { display: grid; gap: 12px; align-content: start; font-size: 13px; color: var(--muted); }
.lead-side b { color: var(--ink); font-weight: 500; }
.status-select { min-height: 34px; padding: 4px 8px; font-size: 14px; }

/* ---------- stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { padding: 18px 20px; }
.kpi-label { font-size: 14px; color: var(--muted); }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.chart { padding: 20px; position: relative; }
.chart h3 { font-size: 15px; margin-bottom: 14px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--chart); }
.chart .bar-hit { fill: transparent; cursor: default; }
.chart .bar-hit:hover + .bar, .chart .bar.is-hover { opacity: .75; }
.tip { position: absolute; pointer-events: none; background: #222A35; color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 3; }
.funnel { padding: 20px; }
.funnel h3 { font-size: 15px; margin-bottom: 14px; }
.funnel-row { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr) 64px 56px; gap: 12px; align-items: center; padding: 6px 0; font-size: 14px; }
.funnel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-track { height: 20px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.funnel-fill { height: 100%; background: var(--chart); border-radius: 0 4px 4px 0; min-width: 2px; }
.funnel-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.funnel-p { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) {
  .ed-body { grid-template-columns: 220px minmax(0, 1fr); }
  .ed-body > .preview { display: none; }
  .ed-tabs a span.t { display: none; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 16px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px 0; gap: 10px; }
  .topbar-nav { order: 5; width: 100%; margin: 0 -8px; overflow-x: auto; padding-bottom: 6px; }
  .topbar-user { display: none; }
  .page { padding: 24px 16px 48px; }
  .quiz-row { grid-template-columns: 1fr auto; }
  .quiz-row > .quiz-num, .quiz-row-head { display: none; }
  .ed-top { flex-wrap: wrap; height: auto; padding: 8px 12px; }
  .ed-tabs { order: 5; width: 100%; overflow-x: auto; }
  .ed-body { grid-template-columns: 1fr; }
  .steps { border-right: 0; border-bottom: 1px solid var(--line); max-height: 220px; }
  .lead-sum { grid-template-columns: 1fr auto 20px; }
  .lead-sum .lead-quiz, .lead-sum .lead-date { display: none; }
  .lead-body { grid-template-columns: 1fr; }
  .kpis, .charts { grid-template-columns: 1fr 1fr; }
  .charts { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: minmax(0, 1fr) 80px 44px; }
  .funnel-row .funnel-track { display: none; }
  .wide { padding: 20px 16px 48px; }
}

/* ---------- v2: account, team, billing, admin ---------- */
.form-ok { color: var(--brand); font-size: 14px; margin: 0 0 12px; }
.auth-forgot { text-align: center; margin-top: 14px; font-size: 14px; }
.field-hint { font-size: 12px; color: var(--muted); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.narrow { max-width: 760px; }
.notice { background: color-mix(in srgb, var(--sun) 28%, var(--surface)); border: 1px solid color-mix(in srgb, var(--sun) 70%, var(--line)); color: var(--ink); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.modal-text { color: var(--muted); margin: -8px 0 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-wide { max-width: 860px; }

.usage { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; text-decoration: none; color: var(--ink); font-size: 12px; padding: 4px 10px; border-radius: 8px; }
.usage:hover { background: var(--surface-2); }
.usage-plan { font-weight: 600; }
.usage-num { color: var(--muted); }
.usage-bar { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-top: 3px; }
.usage-bar i { display: block; height: 100%; background: var(--brand); }
.usage.is-over .usage-bar i { background: var(--danger); }
.usage.is-over .usage-num { color: var(--danger); }
.account-switch { width: auto; min-height: 34px; padding: 4px 8px; font-size: 14px; max-width: 200px; }

.menu-wrap { position: relative; }
.avatar-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); font-weight: 700; cursor: pointer; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(25,33,44,.14); padding: 6px; display: grid; z-index: 40; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; }
.menu-head span { font-size: 13px; color: var(--muted); }
.menu a, .menu button { text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--ink); text-decoration: none; cursor: pointer; font-size: 14px; }
.menu a:hover, .menu button:hover { background: var(--surface-2); }

.invite-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px auto; gap: 8px; }
.team { overflow: hidden; margin-bottom: 20px; }
.team-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 220px 32px; gap: 12px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line); }
.team-row:first-child { border-top: 0; }
.team-row.is-pending { color: var(--muted); }
.team-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; }
.team-who { display: grid; min-width: 0; }
.team-who b, .team-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-who span { font-size: 13px; color: var(--muted); }
.team-role { font-size: 14px; color: var(--muted); }
.roles { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; color: var(--muted); margin: 0; }
.roles dt { color: var(--ink); font-weight: 500; }
.roles dd { margin: 0; }

.current-plan { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 32px; align-items: center; }
.current-plan p { margin: 0; color: var(--muted); }
.meters { display: grid; gap: 12px; }
.meter-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 4px; }
.meter-top span { color: var(--muted); }
.meter-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.meter-bar.is-over i { background: var(--danger); }
.plans-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 28px 0 14px; }
.plans-head h2 { font-size: 20px; }
.seg-badge { margin-left: 6px; font-size: 11px; font-weight: 600; color: var(--brand); }
.plans { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.plan { padding: 22px 20px; display: flex; flex-direction: column; gap: 6px; position: relative; border: 1.5px solid transparent; }
.plan.is-featured { border-color: var(--brand); }
.plan.is-current { background: var(--brand-soft); }
.plan h3 { font-size: 17px; }
.plan-flag { position: absolute; top: -10px; left: 16px; background: var(--sun); color: #3A2A00; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.plan-price { font-size: 14px; color: var(--muted); }
.plan-price b { font-size: 24px; color: var(--ink); letter-spacing: -.01em; }
.plan-total { font-size: 13px; color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 10px 0 16px; display: grid; align-content: start; gap: 7px; font-size: 14px; flex: 1; }
.plan li { padding-left: 20px; position: relative; }
.plan li::before { content: ''; position: absolute; left: 2px; top: 6px; width: 9px; height: 5px; border: solid var(--brand); border-width: 0 0 2px 2px; transform: rotate(-45deg); }

.table { display: grid; font-size: 14px; }
.table-row { display: grid; grid-template-columns: 1.2fr 1.4fr 1fr 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; }
.table-head { color: var(--muted); font-size: 13px; border-top: 0; }
.table-row small { display: block; color: var(--muted); font-size: 12px; }
.pay-status.is-succeeded { color: #2E9E5B; font-weight: 500; }
.pay-status.is-pending { color: var(--muted); }
.pay-status.is-canceled { color: var(--danger); }
.admin-table .table-row { grid-template-columns: minmax(0, 1.6fr) 1fr 70px 110px minmax(0, 2fr); padding: 12px 20px; }
.card > .admin-table .table-head { padding-top: 14px; }
.admin-change { display: flex; gap: 6px; align-items: center; }
.admin-change .select { width: 130px; }
.days-input { width: 70px; min-height: 34px; padding: 4px 8px; }
.card .table:not(.admin-table) { margin-top: 8px; }
.section .table-row { grid-template-columns: 1.2fr 1.4fr 1fr 1fr; }
.section .table-row:has(> :nth-child(5)) { grid-template-columns: 1.2fr 1.4fr 1.2fr 1fr 1fr; }
.pay-summary { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 24px; }
.pay-summary dt { color: var(--muted); }
.pay-summary dd { margin: 0; }

@media (max-width: 1000px) {
  .plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .current-plan { grid-template-columns: 1fr; gap: 16px; }
  .usage { display: none; }
}
@media (max-width: 760px) {
  .invite-row { grid-template-columns: 1fr; }
  .team-row { grid-template-columns: 36px minmax(0, 1fr) 32px; }
  .team-row > :nth-child(3) { grid-column: 2; }
  .plans { grid-template-columns: 1fr; }
  .admin-table .table-row { grid-template-columns: 1fr 1fr; }
  .admin-change { grid-column: 1 / -1; flex-wrap: wrap; }
  .account-switch { max-width: 120px; }
}

/* ---------- v2: editor & leads extras ---------- */
.locked-note { font-size: 13px; background: color-mix(in srgb, var(--sun) 22%, var(--surface)); border-radius: 8px; padding: 8px 12px; margin: 0 0 14px; }
.score-input { width: 64px; flex: none; min-height: 36px; padding: 6px 8px; text-align: center; }
.opt-next .score-input { min-height: 30px; padding: 2px 6px; }
.score-label { float: right; font-weight: 400; }
.result-item .textarea { min-height: 56px; }
.test-results { display: grid; gap: 6px; margin-top: 14px; }
.delivery { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.delivery b { font-weight: 600; flex: none; }
.delivery span { color: var(--muted); overflow-wrap: anywhere; }
.delivery::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; transform: translateY(-1px); }
.delivery.is-ok::before { background: #2E9E5B; }
.delivery.is-fail::before { background: var(--danger); }
.delivery.is-fail span { color: var(--danger); }
.deliveries { display: grid; gap: 4px; }
.lead-tag { display: inline-block; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 6px; background: var(--brand-soft); color: var(--ink); margin-right: 6px; }
.lead-tag.is-fail { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.lead.is-locked .lead-sum { cursor: default; }
.lead.is-locked .lead-who b { color: var(--muted); }
.lead-page b { overflow-wrap: anywhere; }
.file-link { display: block; }
.preview-bar { flex-wrap: wrap; }
code { font: 12px/1.4 ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.funnel + .funnel { margin-top: 16px; }
.src-row { grid-template-columns: minmax(0, 2fr) 1fr 1fr 1fr; }
.ab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ab-col { background: var(--surface-2); border-radius: 10px; padding: 14px 16px; }
.ab-name { font-size: 14px; color: var(--muted); }
.ab-conv { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ab-meta { font-size: 13px; color: var(--muted); }

/* ---------- v3: domains, 2FA, OAuth, folders, history ---------- */
.oauth { display: grid; gap: 8px; margin-bottom: 18px; }
.oauth-btn { width: 100%; min-height: 44px; justify-content: center; font-weight: 600; }
.oauth-mark { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; border-radius: 6px; font-size: 12px; font-weight: 800; color: #fff; }
.oauth-yandex .oauth-mark { background: #FC3F1D; }
.oauth-vk .oauth-mark { background: #0077FF; }
.oauth-or { text-align: center; font-size: 13px; color: var(--muted); margin-top: 6px; }
.code-input { font-size: 22px; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.two-col { grid-template-columns: minmax(0, 1fr) auto; }
.qr { width: 184px; height: 184px; padding: 8px; background: #fff; border-radius: 10px; border: 1px solid var(--line); margin: 4px 0 16px; }
.qr img, .qr canvas { display: block; }
.recovery { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px 16px; margin: 0 0 16px; }
.recovery code { font-size: 15px; padding: 4px 8px; }
.steps-list { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.domains { display: grid; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.domain-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 10px 14px; background: var(--surface); }
.domain-row > a, .domain-row > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.domain-add { margin-top: 4px; grid-template-columns: minmax(0, 1fr) auto; }
.folder-tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); margin-right: 8px; text-decoration: none; }
a.folder-tag:hover { color: var(--ink); }
.folder-seg { flex-wrap: wrap; }
.view-tabs { margin-bottom: 14px; }
.price-input { width: 110px; min-height: 30px; padding: 2px 8px; }
.versions { display: grid; gap: 1px; background: var(--line); border-radius: 10px; overflow: hidden; max-height: 60vh; overflow-y: auto; }
.version { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--surface); }
.version div { display: grid; }
.version span { font-size: 13px; color: var(--muted); }
.lead-tag.is-pay-succeeded { background: color-mix(in srgb, #2E9E5B 16%, var(--surface)); color: #1E7B45; }
.lead-tag.is-pay-pending { background: var(--surface-2); color: var(--muted); }
.lead-tag.is-pay-canceled { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
@media (max-width: 760px) {
  .domain-row { grid-template-columns: minmax(0, 1fr) auto; }
  .recovery { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .quiz-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .quiz-actions { justify-content: flex-start; flex-wrap: wrap; }
}

/* ---------- sign-in: form + brand panel ---------- */
.auth-split { grid-template-columns: minmax(0, 440px) minmax(0, 480px); justify-content: center; gap: 28px; align-items: stretch; }
.auth-split .auth-box { align-self: center; }
.auth-aside { align-self: center; min-height: 520px; max-height: 680px; border-radius: 24px; background: #0F6E66; color: #fff; padding: 48px 44px; display: flex; flex-direction: column; gap: 28px; position: relative; overflow: hidden; }
.auth-aside::after { content: ''; position: absolute; right: -90px; bottom: -90px; width: 260px; height: 260px; border-radius: 50%; background: var(--sun); }
.auth-aside-title { font: 700 34px/1.05 var(--display); letter-spacing: -.02em; max-width: 11ch; }
.auth-aside ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; font-size: 16px; color: rgba(255,255,255,.88); }
.auth-aside li { padding-left: 26px; position: relative; }
.auth-aside li::before { content: ''; position: absolute; left: 2px; top: 7px; width: 10px; height: 6px; border: solid var(--sun); border-width: 0 0 2px 2px; transform: rotate(-45deg); }
.auth-aside-lead { position: relative; z-index: 1; margin-top: auto; align-self: flex-start; display: grid; gap: 2px; background: #fff; color: #19212C; border-radius: 16px; padding: 14px 18px; box-shadow: 0 16px 40px rgba(0,0,0,.2); font-size: 14px; }
.auth-aside-lead span { color: #637082; }
@media (max-width: 900px) {
  .auth-split { grid-template-columns: minmax(0, 440px); }
  .auth-aside { display: none; }
}

/* ---------- v4: cabinet in the landing style ---------- */
:root { --radius: 16px; --live: #2E9E5B; }
.page-head h1 { font: 700 28px/1.15 var(--display); letter-spacing: -.02em; }
.btn { border-radius: 12px; transition: background .15s, transform .1s, filter .15s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-sm { border-radius: 10px; }
.btn-primary { box-shadow: 0 1px 0 rgba(0,0,0,.08), inset 0 -2px 0 rgba(0,0,0,.12); }
.seg { border-radius: 12px; }
.seg button { border-radius: 9px; transition: background .15s, color .15s; }
.seg button.is-on { background: var(--ink); color: var(--surface); }
.card { border: 1px solid var(--line); box-shadow: none; }
.section h2, .funnel h3, .chart h3, .panel h2, .modal h2 { font-family: var(--display); font-weight: 600; letter-spacing: -.01em; }
.section h2 { font-size: 17px; }

/* topbar: the active page wears the yellow tap dot */
.topbar { height: 64px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); }
.topbar-nav a { position: relative; padding: 8px 14px; border-radius: 10px; }
.topbar-nav a.is-active { background: var(--brand-soft); color: var(--brand); }
.topbar-nav a.is-active::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sun) 35%, transparent); }
.avatar-btn { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--sun); }

/* quiz list: summary band */
.overview {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px 40px; align-items: end;
  padding: 26px 30px; margin-bottom: 22px; border-radius: 22px; background: #0F6E66; color: #fff;
}
.overview::after { content: ''; position: absolute; right: -60px; bottom: -120px; width: 210px; height: 210px; border-radius: 50%; background: var(--sun); }
.overview > * { position: relative; z-index: 1; }
.overview-main { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 2px 22px; }
.overview-label { grid-column: 1 / -1; font-size: 14px; color: rgba(255,255,255,.75); }
.overview-num { font: 700 56px/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.overview .spark { color: var(--sun); height: 44px; max-width: 260px; }
.overview .spark .is-zero { fill: rgba(255,255,255,.22); }
.overview-stats { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.overview-stats dt { font-size: 13px; color: rgba(255,255,255,.7); }
.overview-stats dd { margin: 2px 0 0; font: 600 20px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.overview-new {
  grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
  padding: 9px 16px 9px 10px; border-radius: 999px; background: #fff; color: #19212C; text-decoration: none; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 28px rgba(0,0,0,.18); transition: transform .15s;
}
a.overview-new:hover { transform: translateY(-1px); }
.overview-new b { display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: var(--sun); color: #3A2A00; font-size: 13px; }
.overview-new span { color: #0F6E66; font-weight: 700; }
.overview-new.is-calm { background: rgba(255,255,255,.12); color: rgba(255,255,255,.85); box-shadow: none; padding-left: 16px; }

/* quiz list: cards */
.spark { display: block; color: var(--chart); }
.spark svg { display: block; width: 100%; height: 100%; }
.spark rect { fill: currentColor; }
.spark .is-zero { fill: var(--line); }
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.qcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: box-shadow .2s, transform .2s, border-color .2s; }
.qcard:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); box-shadow: 0 14px 36px rgba(25,33,44,.09); transform: translateY(-2px); }
.qcard-cover { position: relative; display: block; height: 116px; background: var(--qc) center / cover no-repeat; overflow: hidden; }
.qcard-cover::before { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, color-mix(in srgb, var(--qc) 70%, transparent), color-mix(in srgb, var(--qc) 25%, transparent)); }
.qcard-cover::after { content: ''; position: absolute; right: -26px; bottom: -38px; width: 92px; height: 92px; border-radius: 50%; background: var(--sun); }
.qcard-status {
  position: absolute; left: 12px; top: 12px; z-index: 1; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.94); color: #19212C; font-size: 12px; font-weight: 600;
}
.qcard-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #A3ADB8; }
.qcard-status.is-live::before { background: var(--live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 22%, transparent); }
.qcard-body { padding: 16px 18px 6px; display: grid; gap: 6px; flex: 1; align-content: start; }
.qcard .quiz-name { font-size: 17px; line-height: 1.3; }
.qcard .quiz-meta { margin: 0; }
.qcard-stats { margin: 8px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qcard-stats dt { font-size: 12px; color: var(--muted); }
.qcard-stats dd { margin: 0; display: flex; align-items: center; gap: 6px; font: 600 19px/1.3 var(--display); font-variant-numeric: tabular-nums; }
.qcard-stats dd a { color: inherit; text-decoration: none; }
.qcard-stats dd a:hover { color: var(--brand); }
.qcard-stats .badge { font-family: var(--font); }
.qcard-trend { display: flex; align-items: end; gap: 10px; margin-top: 6px; }
.qcard-trend .spark { flex: 1; height: 26px; }
.qcard-trend > span:last-child { font-size: 11px; color: var(--muted); flex: none; }
.qcard-partials { font-size: 13px; color: var(--muted); text-decoration: none; }
.qcard-partials:hover { color: var(--brand); }
.qcard-actions { display: flex; align-items: center; gap: 4px; padding: 12px 14px 14px; flex-wrap: wrap; }
.qcard-actions > :first-child { margin-right: auto; }
.qcard-new {
  min-height: 300px; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--brand) 40%, var(--line)); border-radius: var(--radius); background: transparent; cursor: pointer; color: var(--muted);
  transition: background .15s, border-color .15s;
}
.qcard-new:hover { background: var(--brand-soft); border-color: var(--brand); }
.qcard-new b { color: var(--ink); font: 600 17px/1.3 var(--display); }
.qcard-plus { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 6px; background: var(--sun); color: #3A2A00; font: 400 30px/1 var(--font); transition: transform .2s; }
.qcard-new:hover .qcard-plus { transform: scale(1.08) rotate(90deg); }
.qcard-none { grid-column: 1 / -1; }
.empty h3 { font: 600 19px/1.3 var(--display); }

/* editor: top bar */
.ed-top { height: 64px; gap: 10px; }
.ed-back { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 12px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; flex: none; }
.ed-back svg { width: 32px; height: 32px; }
.ed-back:hover { background: var(--surface-2); color: var(--ink); }
.ed-title { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: 10px; border-left: 1px solid var(--line); }
.ed-name { font: 600 15px/1.3 var(--display); letter-spacing: -.01em; width: 190px; }
.ed-save { min-width: 0; }
.ed-status { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); padding: 3px 9px; border-radius: 999px; background: var(--surface-2); }
.ed-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #A3ADB8; }
.ed-status.is-live { color: var(--live); background: color-mix(in srgb, var(--live) 12%, var(--surface)); }
.ed-status.is-live::before { background: var(--live); }
.ed-tabs { background: var(--surface-2); padding: 3px; border-radius: 12px; }
.ed-tabs a { border-radius: 9px; padding: 6px 10px; }
.ed-tabs a.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(25,33,44,.1), 0 0 0 1px var(--line); }

/* editor: steps as a path through the quiz */
.steps { background: var(--surface-2); padding: 18px 12px; }
.steps-group { font-size: 12px; font-weight: 600; color: var(--muted); padding: 18px 10px 8px; }
.step { border-radius: 10px; padding: 8px 10px; transition: background .12s; }
.step:hover { background: var(--surface); }
.step.is-active { background: var(--surface); box-shadow: 0 1px 2px rgba(25,33,44,.08), 0 0 0 1px var(--line); font-weight: 500; }
.step-n { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--line); color: var(--muted); font-size: 11px; }
.step.is-active .step-n { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 3px var(--sun); }
.step.is-off .step-n { border-style: dashed; background: transparent; }
.steps-track { position: relative; }
.steps-track::before { content: ''; position: absolute; left: 21px; top: 20px; bottom: 20px; width: 2px; background: var(--line); border-radius: 1px; }
.steps-track .step-n { position: relative; }
.steps-add { border-radius: 10px; background: transparent; }

/* editor: settings panel */
.panel h2 { font-size: 17px; }
.type { border-radius: 12px; transition: border-color .12s, background .12s; }
.opt { border-radius: 12px; }

/* editor: preview stage with a device mock */
.preview {
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--muted) 28%, transparent) 1px, transparent 0);
  background-size: 18px 18px;
}
.preview-bar { padding: 14px; }
.preview-stage { padding: 0 24px 24px; align-items: stretch; }
.device {
  width: 100%; max-width: 1040px; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--surface);
  border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(25,33,44,.12); transition: max-width .25s, border-radius .25s;
}
.device-bar { flex: none; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.device-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.device-bar i:first-child { background: #F2A39A; }
.device-bar i:nth-child(2) { background: var(--sun); }
.device-bar i:nth-child(3) { background: #8FD0A6; }
.device-bar span { flex: 1; margin: 0 40px 0 12px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; }
.device .preview-frame { flex: 1; height: auto; min-height: 0; border-radius: 0; box-shadow: none; width: 100%; }
.device.is-mobile { max-width: 380px; border: 10px solid #19212C; border-radius: 42px; box-shadow: 0 24px 60px rgba(25,33,44,.22); align-self: center; height: min(100%, 780px); }
.device.is-mobile .device-bar { height: 26px; justify-content: center; background: #19212C; border: 0; }
.device.is-mobile .device-bar i, .device.is-mobile .device-bar span { display: none; }
.device.is-mobile .device-bar::after { content: ''; width: 80px; height: 18px; border-radius: 0 0 12px 12px; background: #19212C; }

/* leads */
.leads { border: 1px solid var(--line); box-shadow: none; }
.status-seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg-count { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .65; }
.status-seg button.is-new .seg-count { opacity: 1; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: var(--sun); color: #3A2A00; font-weight: 600; display: inline-grid; place-items: center; }
.lead-sum { grid-template-columns: 120px minmax(0, 1.2fr) minmax(0, 1fr) 150px 20px; padding: 14px 20px; transition: background .12s; }
.lead-who:has(.lead-avatar) { display: grid; grid-template-columns: 38px minmax(0, 1fr); column-gap: 12px; align-items: center; }
.lead-who:has(.lead-avatar) > :not(.lead-avatar) { grid-column: 2; }
.lead-avatar { grid-row: 1 / span 2; position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font: 600 15px/1 var(--display); }
.lead-who span:not(.lead-avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-new .lead-who:has(.lead-avatar) b::after { content: none; }
.lead-new .lead-avatar::after { content: ''; position: absolute; right: -1px; top: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 2px var(--surface); }
.lead-new .lead-sum { background: color-mix(in srgb, var(--sun) 7%, var(--surface)); }
.lead-new .lead-sum:hover { background: color-mix(in srgb, var(--sun) 13%, var(--surface)); }
.lead.is-open .lead-sum { background: var(--surface-2); }
.lead-body { background: var(--surface-2); padding: 6px 20px 22px 70px; }
.answers { gap: 0; border-left: 2px solid var(--line); padding-left: 16px; }
.answers dt { padding-top: 10px; }
.answers dt:first-child { padding-top: 0; }
.lead-side { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.status-select { width: auto; border-radius: 999px; font-weight: 500; font-size: 13px; padding: 4px 28px 4px 12px; border-color: transparent; }
.status-select.is-new { background-color: color-mix(in srgb, var(--sun) 45%, var(--surface)); color: #4A3500; }
.status-select.is-work { background-color: color-mix(in srgb, #2A5BD7 13%, var(--surface)); color: #2A5BD7; }
.status-select.is-done { background-color: color-mix(in srgb, var(--live) 14%, var(--surface)); color: #1E7B45; }
.status-select.is-spam { background-color: var(--surface-2); color: var(--muted); }
.lead-tag { border-radius: 999px; padding: 1px 9px; }

/* stats */
.kpi { padding: 18px 20px 20px; position: relative; overflow: hidden; }
.kpi-value { font: 700 32px/1.1 var(--display); letter-spacing: -.03em; margin-top: 8px; }
.kpi-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.kpi.is-accent { background: #0F6E66; border-color: #0F6E66; color: #fff; }
.kpi.is-accent .kpi-label, .kpi.is-accent .kpi-sub { color: rgba(255,255,255,.75); }
.kpi.is-accent::after { content: ''; position: absolute; right: -36px; top: -36px; width: 84px; height: 84px; border-radius: 50%; background: var(--sun); }
.kpi.is-accent .kpi-label { padding-right: 40px; }
.funnel-note { margin: -4px 0 14px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--sun) 22%, var(--surface)); font-size: 14px; }
.kpi.is-accent > * { position: relative; z-index: 1; }
.chart .bar { transition: opacity .12s; }
.tip { border-radius: 10px; font-weight: 500; }
.funnel-row { grid-template-columns: minmax(0, 240px) minmax(0, 1fr) 64px 56px; padding: 5px 8px; margin: 0 -8px; border-radius: 10px; }
.funnel-track { display: flex; align-items: center; gap: 8px; height: 26px; background: none; border-radius: 0; }
.funnel-fill { flex: none; height: 100%; border-radius: 6px; background: var(--chart); }
.funnel-drop { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.funnel-row.is-worst { background: color-mix(in srgb, var(--sun) 22%, var(--surface)); }
.funnel-row.is-worst .funnel-drop { color: #7A5300; font-weight: 600; }
.ab-col { border-radius: 14px; }
.ab-conv { font-family: var(--display); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .status-select.is-new { color: var(--sun); }
  :root:not([data-theme="light"]) .status-select.is-work { color: #8CA9F0; }
  :root:not([data-theme="light"]) .status-select.is-done { color: #6CCB92; }
  :root:not([data-theme="light"]) .funnel-row.is-worst .funnel-drop { color: var(--sun); }
}
@media (prefers-reduced-motion: reduce) {
  .qcard, .qcard-plus, .btn, .device, a.overview-new { transition: none; }
  .qcard:hover { transform: none; }
}
@media (max-width: 1440px) {
  .ed-back { padding-right: 4px; }
  .ed-back span { display: none; }
}
@media (max-width: 1100px) {
  .ed-top { flex-wrap: wrap; height: auto; padding: 10px 14px; row-gap: 8px; }
  .ed-title { flex: 1; }
  .ed-name { width: 100%; }
  .ed-tabs { order: 5; flex-basis: 100%; margin: 0; }
}
@media (max-width: 760px) {
  .overview { grid-template-columns: 1fr; padding: 22px 20px; border-radius: 18px; }
  .overview-num { font-size: 44px; }
  .overview-stats dd { font-size: 17px; }
  .page-head h1 { font-size: 23px; }
  .quiz-grid { grid-template-columns: minmax(0, 1fr); }
  .qcard-new { min-height: 160px; }
  .topbar { height: auto; }
  .ed-top { height: auto; }
  .ed-title { border-left: 0; padding-left: 0; flex: 1 1 calc(100% - 60px); }
  .ed-save { margin-right: auto; }
  .ed-name { width: 100%; }
  .lead-sum { grid-template-columns: minmax(0, 1fr) auto 14px; gap: 10px; padding: 12px 14px; }
  .lead-body { padding: 6px 16px 20px; }
  .status-select { max-width: 116px; }
  .status-seg { max-width: 100%; overflow-x: auto; }
  .status-seg button { white-space: nowrap; }
  .kpi-value { font-size: 26px; }
  .funnel-row { grid-template-columns: minmax(0, 1fr) 70px 44px; }
}
