/* =========================================================
   Epsilon AI Forms — design system
   ========================================================= */
:root {
  --ink: #0b1b3f;
  --ink-2: #33415f;
  --muted: #69748e;
  --faint: #9aa3b8;
  --line: #e6e9f2;
  --line-2: #d6dbe7;
  --bg: #f5f7fb;
  --card: #fff;
  --brand: #1f4fe0;
  --brand-2: #19b5fe;
  --brand-ink: #1739b0;
  --brand-soft: #edf2ff;
  --ok: #0a7a52;
  --ok-soft: #e4f6ee;
  --bad: #c42a32;
  --bad-soft: #fdeced;
  --warn: #92560a;
  --warn-soft: #fff4dc;
  --tc: #1f4fe0;
  --ff: "Plus Jakarta Sans", system-ui, sans-serif;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 14px;
  --r-sm: 10px;
  --shadow-1: 0 1px 2px rgba(11, 27, 63, .05);
  --shadow-2: 0 1px 2px rgba(11, 27, 63, .04), 0 10px 28px -14px rgba(11, 27, 63, .14);
  --shadow-3: 0 2px 4px rgba(11, 27, 63, .04), 0 24px 56px -20px rgba(11, 27, 63, .28);
  --ring: 0 0 0 4px rgba(31, 79, 224, .14);
  --grad: linear-gradient(135deg, #1435c4 0%, #1f5cff 55%, #19b5fe 100%);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
[hidden] { display: none !important; }
input, select, textarea, button { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(31, 79, 224, .18); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; color: var(--brand); margin: 0 0 8px; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-more, .ic-more-h, .ic-grip, .ic-grip-h { stroke-width: 3.2; }
.ic.ok { color: var(--ok); }
.ic.bad { color: var(--bad); }

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--card); color: var(--ink); font-weight: 600; font-size: .92rem; white-space: nowrap;
  box-shadow: var(--shadow-1); transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: #f4f6fb; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .icon-btn:focus-visible, .seg > *:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { border-color: transparent; color: #fff; background: linear-gradient(180deg, #2b5ff2, #1c46d4); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 2px rgba(20, 50, 160, .3), 0 6px 16px -8px rgba(31, 79, 224, .6); }
.btn-primary:hover { background: linear-gradient(180deg, #2453e0, #1739b0); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: #eef1f8; }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand); box-shadow: none; }
.btn-soft:hover { background: #e0e8ff; color: var(--brand-ink); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: #f3c4c7; color: var(--bad); }
.btn-sm { height: 34px; padding: 0 12px; font-size: .86rem; border-radius: 9px; }
.btn-lg { height: 48px; font-size: 1rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2); list-style: none; transition: background .15s, color .15s;
}
.icon-btn:hover { background: #eef1f8; color: var(--ink); }
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn.disabled { opacity: .3; pointer-events: none; }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn-sm .ic { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; padding: 4px 2px; color: var(--ink-2); font-weight: 500; font-size: .92rem; }
.link-btn:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.link-btn.link-accent { color: var(--brand); }
.link-btn.muted { color: var(--muted); }

.input, .select {
  height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--card); font-size: .94rem; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input-sm, .select-sm { height: 36px; font-size: .88rem; border-radius: 9px; }
.input-xs { height: 32px; width: 72px; padding: 0 8px; font-size: .88rem; }
.input-lg { height: 48px; font-size: 1rem; }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2369748e' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.field > span { font-weight: 600; color: var(--ink-2); }
.field .input, .field .select { width: 100%; }

.switch { position: relative; display: inline-block; width: 40px; height: 24px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch > span { position: absolute; inset: 0; border-radius: 999px; background: #cdd3e1; transition: background .2s; }
.switch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(11,27,63,.3); transition: transform .2s cubic-bezier(.3,1.4,.6,1); }
.switch input:checked + span, .switch.is-on > span { background: var(--tc); }
.switch input:checked + span::after, .switch.is-on > span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }
.switch-label { display: inline-flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 500; color: var(--ink-2); cursor: pointer; background: none; border: 0; padding: 0; }

.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: #e9edf5; }
.seg > button, .seg > a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: var(--ink-2); font-weight: 600; font-size: .86rem; white-space: nowrap; }
.seg > .on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(11,27,63,.12); }
.seg > :not(.on):hover { color: var(--ink); }
.seg-icons > button { padding: 0 9px; }
.seg-center { display: flex; width: fit-content; margin: 0 auto 18px; }
.seg .ic { width: 16px; height: 16px; }

.search { position: relative; display: inline-flex; align-items: center; }
.search .ic { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search input { height: 40px; width: 260px; padding: 0 12px 0 38px; border: 1px solid var(--line-2); border-radius: 11px; background: var(--card); outline: none; font-size: .92rem; transition: border-color .15s, box-shadow .15s; }
.search input:focus { border-color: var(--brand); box-shadow: var(--ring); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; background: #eef1f7; color: var(--ink-2); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.chip .ic { width: 14px; height: 14px; }
.chip-quiz { background: #f1ebff; color: #6633d6; }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-accent { background: var(--brand-soft); color: var(--brand); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.status.is-open { color: var(--ok); }
.status.is-open::before { background: #12b076; box-shadow: 0 0 0 3px rgba(18, 176, 118, .18); }
.status.is-closed { color: var(--muted); }
.status.is-closed::before { background: var(--faint); }
.swatch { width: 10px; height: 10px; border-radius: 4px; flex: none; display: inline-block; }

/* ---------- App chrome ---------- */
.env-banner { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .72rem; font-weight: 700; letter-spacing: .1em; padding: 5px; border-bottom: 1px solid #f1dfae; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 28px; height: 64px; padding: 0 28px;
  background: rgba(255, 255, 255, .86); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; }
.logo { display: block; height: 36px; width: auto; }
.logo-lg { height: 52px; margin-bottom: 26px; }
.topnav { display: flex; gap: 4px; }
.topnav a { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.topnav a:hover { background: #eef1f8; color: var(--ink); }
.topnav a.active { background: var(--brand-soft); color: var(--brand); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-right form { margin: 0; }
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; background: var(--grad); color: #fff; font-weight: 700; font-size: .9rem; cursor: pointer; list-style: none; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line); }
.avatar::-webkit-details-marker { display: none; }
.avatar-lg { width: 42px; height: 42px; box-shadow: none; cursor: default; }

.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu-pop, .popover {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 230px; padding: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3);
  animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-pop a, .menu-pop button, .pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; color: var(--ink); font-size: .9rem; font-weight: 500; text-align: left;
}
.menu-pop a:hover, .menu-pop button:hover, .pop-item:hover { background: #f1f4fa; color: var(--ink); }
.menu-pop .ic, .pop-item .ic { color: var(--muted); }
.menu-pop .danger, .menu-pop .danger .ic { color: var(--bad); }
.menu-pop form { margin: 0; }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-head div { display: flex; flex-direction: column; font-size: .88rem; min-width: 0; }
.menu-head span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

.flashes { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; width: min(560px, calc(100vw - 32px)); }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-3); font-weight: 500; font-size: .92rem; animation: pop .2s ease-out; transition: opacity .4s, transform .4s; }
.flash > span { flex: 1; }
.flash.fade { opacity: 0; transform: translateY(-6px); }
.flash-success > .ic { color: var(--ok); }
.flash-error > .ic { color: var(--bad); }
.flash-secret { background: #fffaf0; border-color: #f1dca2; }
.flash-secret span { font-family: var(--mono); font-size: .86rem; }
.flash-x { border: 0; background: none; color: var(--muted); padding: 2px; display: grid; }
.alert { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 10px; font-size: .9rem; font-weight: 500; }
.alert-error { background: var(--bad-soft); color: var(--bad); }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 90; display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-3); opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: all .25s cubic-bezier(.3,1.3,.6,1); }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { border: 0; background: none; color: #8fb4ff; font-weight: 700; padding: 0; }

.page { max-width: 1180px; margin: 0 auto; padding: 32px 28px 96px; }
.page-wide { padding: 0 0 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-2); }
.pad { padding: 24px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.narrow-card { max-width: 540px; }
.member { display: flex; align-items: center; gap: 12px; }
.member div { display: flex; flex-direction: column; font-size: .9rem; }
.member .avatar { cursor: default; box-shadow: none; }

.empty { text-align: center; padding: 64px 24px; background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--r); }
.empty h3 { font-size: 1.15rem; margin: 14px 0 6px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 20px; }
.empty-art { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--brand-soft); color: var(--brand); }
.empty-art .ic { width: 28px; height: 28px; }
.no-match { padding: 28px; text-align: center; margin: 0; color: var(--muted); }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.table th { position: sticky; top: 0; text-align: left; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 16px; background: #fafbfe; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child { border-top-left-radius: var(--r); }
.table th:last-child { border-top-right-radius: var(--r); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f9fafd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { vertical-align: middle; }
.table-dense td { padding: 10px 14px; vertical-align: top; font-size: .88rem; }
.table-dense .cell { max-width: 320px; max-height: 8em; overflow: auto; }
.row-title { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 650; }
.row-link { display: flex; align-items: center; gap: 2px; padding-left: 20px; font-size: .8rem; }
.row-link a { color: var(--muted); }

/* ---------- Dashboard ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: radial-gradient(1200px 400px at 85% -20%, rgba(25, 181, 254, .45), transparent 60%), radial-gradient(900px 500px at 0% 120%, rgba(31, 92, 255, .55), transparent 60%), #0b1b3f; }
.hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(to bottom, #000, transparent); pointer-events: none; }
.hero-inner { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 40px 28px 36px; }
.hero-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.hero .eyebrow { color: #8fd4ff; }
.hero h1 { font-size: 1.9rem; max-width: 620px; }
.kpis { display: flex; gap: 8px; }
.kpi { display: flex; flex-direction: column; min-width: 104px; padding: 12px 16px; border-radius: 14px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); backdrop-filter: blur(6px); }
.kpi b { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi span { font-size: .78rem; color: rgba(255, 255, 255, .7); font-weight: 500; }
.tpl-row { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 14px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.tpl { margin: 0; }
.tpl button { display: flex; flex-direction: column; gap: 3px; width: 100%; height: 100%; padding: 0; border: 0; background: none; color: #fff; text-align: left; }
.tpl-art { display: grid; place-items: center; aspect-ratio: 4 / 3; margin-bottom: 8px; border-radius: 14px; background: color-mix(in srgb, var(--c) 10%, #fff); border: 2px solid transparent; transition: transform .2s, border-color .2s, box-shadow .2s; overflow: hidden; }
.tpl button:hover .tpl-art, .tpl button:focus-visible .tpl-art { transform: translateY(-3px); border-color: #8fd4ff; box-shadow: 0 16px 30px -14px rgba(0, 0, 0, .6); }
.tpl button:focus-visible { outline: none; }
.tpl-blank { background: #fff; }
.tpl-plus { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--grad); color: #fff; box-shadow: 0 10px 20px -8px rgba(31, 79, 224, .8); }
.tpl-plus .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.tpl-name { font-weight: 650; font-size: .92rem; }
.tpl-blurb { font-size: .78rem; color: rgba(255, 255, 255, .62); }
.mini { display: flex; flex-direction: column; gap: 6px; width: 72%; padding: 10px; border-radius: 8px; background: #fff; box-shadow: 0 6px 14px -6px rgba(11, 27, 63, .25); }
.mini-band { height: 5px; margin: -10px -10px 2px; border-radius: 8px 8px 0 0; background: var(--c); }
.mini-title { height: 7px; width: 70%; border-radius: 4px; background: #1d2742; opacity: .8; }
.mini-q { display: flex; flex-direction: column; gap: 3px; padding: 5px 6px; border-radius: 4px; background: #f3f5fa; }
.mini-q i { display: block; height: 4px; border-radius: 2px; background: #c9cfdd; }
.mini-q i + i { width: 60%; background: color-mix(in srgb, var(--c) 35%, #fff); }

.forms-area { max-width: 1180px; margin: 0 auto; padding: 32px 28px 96px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.fcard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); transition: box-shadow .2s, transform .2s, border-color .2s; }
.fcard:hover { box-shadow: var(--shadow-3); transform: translateY(-2px); border-color: transparent; }
.fcard-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 10; border-radius: var(--r) var(--r) 0 0; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 14%, #fff), color-mix(in srgb, var(--c) 4%, #fff)); border-bottom: 1px solid var(--line); overflow: hidden; }
.fcard-thumb .mini { width: 70%; transform: translateY(14px); transition: transform .25s; }
.fcard:hover .fcard-thumb .mini { transform: translateY(8px); }
.mini-title-text { font-size: .66rem; font-weight: 700; color: var(--ink); line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.mini-q em { font-style: normal; font-size: .54rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard-thumb .chip { position: absolute; top: 10px; left: 10px; height: 22px; font-size: .72rem; }
.fcard-body { padding: 14px 12px 14px 16px; }
.fcard-top { display: flex; align-items: flex-start; gap: 6px; }
.fcard-title { flex: 1; min-width: 0; padding-top: 6px; color: var(--ink); font-weight: 650; font-size: .96rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fcard-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.fcard-meta a { color: var(--ink-2); font-weight: 600; }

/* ---------- Form bar & tabs ---------- */
.formbar { position: sticky; top: 64px; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; height: 60px; padding: 0 20px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.formbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.formbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.formbar-title b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-state { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.save-state.err { color: var(--bad); font-weight: 600; }
.formbar-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.formbar-right .btn { margin-left: 8px; }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs a { position: relative; display: flex; align-items: center; gap: 6px; padding: 0 16px; color: var(--ink-2); font-weight: 600; font-size: .92rem; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--tc); }
.tabs a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--tc); }
.tabs .count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--tc); color: #fff; font-size: .72rem; font-weight: 700; }

.modal { width: min(500px, calc(100vw - 32px)); padding: 28px; border: 0; border-radius: 20px; box-shadow: var(--shadow-3); color: var(--ink); }
.modal::backdrop { background: rgba(11, 27, 63, .5); backdrop-filter: blur(3px); }
.modal[open] { animation: pop .18s ease-out; }
.modal h2 { margin-bottom: 4px; }
.modal-x { position: absolute; top: 14px; right: 14px; margin: 0; }
.share-tabs { margin: 16px 0 14px; }
.copy-field { display: flex; gap: 8px; margin-bottom: 12px; }
.copy-field input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #f8f9fc; font-family: var(--mono); font-size: .84rem; }
.copy-field.narrow { max-width: 520px; margin: 0 auto; }
.qr { display: flex; justify-content: center; padding: 6px 0 14px; }
.qr img, .qr canvas { padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
[data-share-pane="qr"] { text-align: center; }
.embed-code { width: 100%; padding: 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #f8f9fc; font-family: var(--mono); font-size: .8rem; resize: none; margin-bottom: 10px; }

/* ---------- Builder ---------- */
.canvas { min-height: calc(100vh - 124px); background: color-mix(in srgb, var(--tc) 9%, #f5f7fb); transition: background .3s; }
.panel { position: relative; max-width: 1000px; margin: 0 auto; padding: 28px 24px 120px; }
.builder-col { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.qlist { display: flex; flex-direction: column; gap: 14px; }
.qcard { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); padding: 22px 26px 12px; transition: box-shadow .2s, border-color .2s; }
.qcard::before { content: ""; position: absolute; left: -1px; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: transparent; transition: background .2s, top .2s, bottom .2s; }
.qcard.is-active { box-shadow: var(--shadow-3); border-color: transparent; }
.qcard.is-active::before { background: var(--tc); top: 0; bottom: 0; border-radius: var(--r) 0 0 var(--r); width: 6px; }
.qcard.is-preview { cursor: pointer; padding-bottom: 20px; }
.qcard.is-preview:hover { border-color: var(--line-2); box-shadow: var(--shadow-2); }
.qcard.is-preview:focus-visible { outline: none; box-shadow: var(--ring); }
.qcard.dragging { opacity: .45; }
.qcard.drop-before { box-shadow: 0 -4px 0 var(--tc), var(--shadow-2); }
.qcard.drop-after { box-shadow: 0 4px 0 var(--tc), var(--shadow-2); }
.drag-handle { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 40px; height: 18px; color: #b9c0d0; cursor: grab; opacity: 0; transition: opacity .15s; }
.qcard:hover .drag-handle, .qcard.is-active .drag-handle { opacity: 1; }
.drag-handle .ic { width: 20px; height: 20px; }

.title-card { padding: 30px 28px 22px; overflow: hidden; cursor: text; }
.title-band { position: absolute; left: 0; right: 0; top: 0; height: 10px; background: linear-gradient(90deg, var(--tc), color-mix(in srgb, var(--tc) 55%, #19b5fe)); }
.title-card.is-active::before { top: 10px; }
.section-tab { position: absolute; top: -1px; left: -1px; padding: 5px 14px; border-radius: var(--r) 0 var(--r-sm) 0; background: var(--tc); color: #fff; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.title-card .section-tab { top: 10px; border-radius: 0 0 var(--r-sm) 0; }
.title-card:has(.section-tab:not([hidden])) .title-input { margin-top: 18px; }
.title-input, .desc-input, .q-label, .q-help { display: block; width: 100%; border: 0; outline: none; background: none; resize: none; overflow: hidden; font-family: var(--ff); }
.title-input { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; padding: 6px 0; border-bottom: 2px solid transparent; transition: border-color .15s; }
.desc-input { margin-top: 6px; padding: 6px 0; color: var(--ink-2); font-size: .98rem; border-bottom: 1px solid transparent; }
.title-card.is-active .title-input { border-bottom-color: var(--line); }
.title-card.is-active .desc-input { border-bottom-color: var(--line); }
.title-input:focus, .desc-input:focus { border-bottom-color: var(--tc) !important; }
.title-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.title-meta:empty { display: none; }

.qcard.is-section { padding-top: 40px; }
.q-head { display: flex; gap: 14px; align-items: flex-start; }
.q-label { flex: 1; min-width: 0; padding: 14px 16px; background: #f5f7fb; border-bottom: 2px solid var(--line-2); border-radius: 10px 10px 0 0; font-size: 1.05rem; font-weight: 600; line-height: 1.4; transition: background .15s, border-color .15s; }
.q-label:focus { background: #eff2f9; border-bottom-color: var(--tc); }
.q-label-title { padding: 6px 0; background: none; border-radius: 0; font-size: 1.4rem; font-weight: 700; border-bottom: 2px solid var(--line); }
.q-label-title:focus { background: none; }
.type-btn { display: inline-flex; align-items: center; gap: 10px; height: 50px; width: 230px; flex: none; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); font-weight: 600; font-size: .92rem; text-align: left; transition: border-color .15s, box-shadow .15s; }
.type-btn span { flex: 1; }
.type-btn:hover { border-color: var(--faint); }
.type-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.type-btn .ic { color: var(--ink-2); }
.type-btn .chev { color: var(--muted); }
.q-help { margin-top: 10px; padding: 6px 0; color: var(--ink-2); font-size: .92rem; border-bottom: 1px solid var(--line); }
.q-help:focus { border-bottom-color: var(--tc); }
.q-body { padding: 14px 0 4px; }
.q-foot { display: flex; align-items: center; gap: 2px; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--line); }
.q-foot .switch-label { margin: 0 6px 0 4px; }
.vsep { width: 1px; height: 26px; margin: 0 10px; background: var(--line-2); }
.key-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; margin-left: -10px; border: 0; border-radius: 9px; background: none; color: var(--brand); font-weight: 650; font-size: .9rem; }
.key-btn:hover { background: var(--brand-soft); }
.after-row { display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 12px 14px; border-radius: 10px; background: #f6f8fc; color: var(--ink-2); font-size: .88rem; font-weight: 600; flex-wrap: wrap; }

.opts { display: flex; flex-direction: column; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.opt.dragging { opacity: .4; }
.row-grip { display: grid; place-items: center; width: 18px; margin-left: -22px; color: #c2c8d6; cursor: grab; opacity: 0; }
.row-grip .ic { width: 16px; height: 16px; }
.opt:hover .row-grip { opacity: 1; }
.opt-add .row-grip, .opt .row-grip:empty { cursor: default; }
.mk { display: inline-block; width: 18px; height: 18px; flex: none; border: 2px solid #b9c0d0; }
.mk-radio { border-radius: 50%; }
.mk-box { border-radius: 4px; }
.mk.on { border-color: var(--ok); background: radial-gradient(circle, var(--ok) 0 4px, transparent 5px); }
.mk-box.on { background: var(--ok); box-shadow: inset 0 0 0 2px #fff; }
.mk-num { width: 18px; flex: none; color: var(--muted); font-size: .88rem; text-align: right; }
.opt-input { flex: 1; min-width: 0; height: 38px; padding: 0 2px; border: 0; border-bottom: 1px solid transparent; outline: none; background: none; font-size: .95rem; transition: border-color .15s; }
.opt-input:hover { border-bottom-color: var(--line); }
.opt-input:focus { border-bottom: 2px solid var(--tc); }
.opt-other { flex: 1; color: var(--muted); padding: 8px 2px; border-bottom: 1px dotted var(--line-2); }
.opt-add { color: var(--muted); font-size: .9rem; }
.opt .select-sm { max-width: 220px; height: 32px; font-size: .82rem; }
.grid-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.grid-col-title { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.inline-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.scale-label { display: flex; align-items: center; gap: 12px; margin-top: 8px; max-width: 360px; }
.file-settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.file-settings label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.hint { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; font-size: .82rem; color: var(--muted); }
.hint .ic { width: 15px; height: 15px; }
.validation { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 12px; border-radius: 10px; background: #f6f8fc; }
.validation .grow { flex: 1; min-width: 160px; }
.validation .input-sm { width: 120px; }
.validation .grow.input-sm { width: auto; }

.pv-label { font-family: var(--ff); font-size: 1.02rem; font-weight: 600; line-height: 1.4; }
.req { color: var(--bad); }
.pv-help { margin-top: 4px; color: var(--muted); font-size: .9rem; white-space: pre-wrap; }
.pv-body { margin-top: 12px; }
.pv-opt { display: flex; align-items: center; gap: 12px; padding: 6px 0; color: var(--ink-2); font-size: .94rem; }
.pv-opt.is-correct { color: var(--ok); font-weight: 600; }
.pv-grid { border-collapse: collapse; font-size: .82rem; color: var(--ink-2); }
.pv-grid th, .pv-grid td { padding: 6px 12px; text-align: center; font-weight: 500; }
.pv-grid td:first-child { text-align: left; }
.pv-scale { display: flex; align-items: flex-end; gap: 16px; font-size: .85rem; flex-wrap: wrap; }
.pv-scale-n { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pv-stars { color: #f3b515; font-size: 1.4rem; letter-spacing: 3px; }
.pv-file { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--muted); font-size: .88rem; }
.pv-line { width: 60%; padding: 8px 0; border-bottom: 1px dotted var(--line-2); color: var(--faint); font-size: .9rem; }
.pv-line-long { width: 90%; }
.pv-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pv-section-title { font-family: var(--ff); font-size: 1.3rem; font-weight: 700; }
.pv-statement-title { font-family: var(--ff); font-size: 1.15rem; font-weight: 700; }

.is-key .key-head { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--brand); }
.is-key .key-head b { color: var(--ink); }
.points { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.key-question { font-family: var(--ff); font-weight: 600; font-size: 1.02rem; margin-bottom: 10px; }
.key-opts { display: flex; flex-direction: column; gap: 4px; }
.key-opt { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border: 1px solid transparent; border-radius: 10px; background: none; text-align: left; font-size: .95rem; transition: background .15s, border-color .15s; }
.key-opt:hover { background: #f6f8fc; }
.key-opt span:nth-child(2) { flex: 1; }
.key-opt.is-correct { background: var(--ok-soft); border-color: #b9e6d1; color: #075c3e; font-weight: 600; }
.key-answers .opt { gap: 12px; }
.feedback { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.feedback label { display: flex; flex-direction: column; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--muted); }

.add-bottom { display: flex; justify-content: center; padding: 8px 0; }
.fab { position: absolute; top: 28px; left: calc(50% + 380px + 16px); display: flex; flex-direction: column; gap: 2px; padding: 6px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-2); transition: top .25s cubic-bezier(.3,1.2,.6,1); z-index: 5; }
.fab button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); }
.fab button:hover { background: var(--brand-soft); color: var(--brand); }
.fab .ic { width: 20px; height: 20px; }

.popover { position: absolute; right: auto; top: 0; }
.popover-types { min-width: 250px; max-height: 70vh; overflow-y: auto; }
.pop-item { gap: 12px; }
.pop-item.checked { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.pop-item.checked .ic { color: var(--brand); }
.pop-item span { flex: 1; }
.pop-check { margin-left: auto; }
.pop-label { padding: 8px 10px 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }

/* ---------- Settings ---------- */
.settings-col { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.scard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); padding: 6px 24px 10px; scroll-margin-top: 140px; }
.scard-head { display: flex; gap: 14px; align-items: flex-start; padding: 18px 0 14px; border-bottom: 1px solid var(--line); }
.scard-head p { margin: 2px 0 0; color: var(--muted); font-size: .88rem; }
.scard-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: color-mix(in srgb, var(--tc) 12%, #fff); color: var(--tc); }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.srow:last-child, .scard > :last-child { border-bottom: 0; }
.srow-text { display: flex; flex-direction: column; }
.srow-text b { font-weight: 600; font-size: .94rem; }
.srow-text span { color: var(--muted); font-size: .84rem; }
.srow-field { cursor: default; }
.srow-field .input { width: 230px; }
.srow-field .input-sm { width: 140px; }
.subsettings { margin: 0 0 6px 18px; padding-left: 18px; border-left: 2px solid var(--line); }
.subsettings .srow:last-child { border-bottom: 0; }
.sfield { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.sfield > b { font-weight: 600; font-size: .94rem; }
.sfield .input { width: 100%; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.colors button, .color-custom { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform .15s; }
.colors button:hover { transform: scale(1.08); }
.colors button.on { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c); }
.colors button.on::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / 16px no-repeat; }
.color-custom { display: grid; place-items: center; background: conic-gradient(#f44, #fd3, #4d6, #3cf, #66f, #e4e, #f44); color: #fff; cursor: pointer; overflow: hidden; }
.color-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.color-custom .ic { width: 16px; height: 16px; stroke-width: 2.6; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.fonts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fonts button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); font-size: .84rem; color: var(--ink-2); transition: border-color .15s, box-shadow .15s; }
.fonts button:hover { border-color: var(--faint); }
.fonts button.on { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 18%, transparent); color: var(--ink); }
.font-aa { font-size: 1.5rem; font-weight: 700; color: var(--ink); line-height: 1.1; }
.slug-field { display: flex; align-items: center; height: 42px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.slug-field:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.slug-field span { padding: 0 2px 0 12px; color: var(--muted); font-size: .84rem; white-space: nowrap; }
.slug-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; font-weight: 600; font-size: .9rem; }
.danger-row { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 0; }
.danger-row form { margin: 0; }

/* ---------- Responses ---------- */
.resp-wrap { max-width: 800px; margin: 0 auto; padding: 28px 24px 0; }
.resp-wrap.resp-wide { max-width: none; padding: 28px 28px 0; }
.resp-wide .resp-head, .resp-wide .seg-center { max-width: 800px; margin-left: auto; margin-right: auto; }
.resp-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 24px; margin-bottom: 20px; border-top: 6px solid var(--tc); flex-wrap: wrap; }
.resp-head p { margin: 2px 0 0; font-size: .86rem; }
.resp-count { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.resp-count span { font-size: 1.05rem; font-weight: 600; color: var(--ink-2); }
.resp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.accept-toggle { margin: 0 8px 0 0; }
.sum-card, .ans-card, .scard-insights { padding: 22px 24px; margin-bottom: 14px; }
.sum-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.sum-head h3 { font-size: 1rem; }
.sum-head p { margin: 4px 0 0; font-size: .84rem; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(100px, 240px) 1fr 84px; gap: 14px; align-items: center; font-size: .9rem; }
.bar-label { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar-row.is-correct .bar-label { color: var(--ok); font-weight: 600; }
.bar-track { height: 26px; border-radius: 7px; background: #f0f2f8; overflow: hidden; }
.bar-fill { display: block; height: 100%; min-width: 3px; border-radius: 7px; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 70%, #fff)); animation: grow .7s cubic-bezier(.2,.8,.2,1); transform-origin: left; }
.bar-row.is-correct .bar-fill { background: linear-gradient(90deg, #12a06c, #4fd1a0); }
@keyframes grow { from { transform: scaleX(0); } }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; }
.histo { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding: 10px 4px 0; border-bottom: 1px solid var(--line); }
.histo-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.histo-bar { display: block; width: 100%; max-width: 56px; min-height: 3px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, var(--c, var(--tc)), color-mix(in srgb, var(--c, var(--tc)) 65%, #fff)); animation: rise .7s cubic-bezier(.2,.8,.2,1); transform-origin: bottom; }
@keyframes rise { from { transform: scaleY(0); } }
.histo-n { font-size: .8rem; font-weight: 700; color: var(--ink-2); }
.histo-l { font-size: .8rem; color: var(--muted); padding-bottom: 6px; margin-bottom: -28px; height: 22px; }
.histo + * { margin-top: 30px; }
.scard-insights h3 { display: flex; align-items: center; gap: 8px; color: #6633d6; margin-bottom: 14px; }
.insight-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.insight-stats div, .mini-stats div { display: flex; flex-direction: column; padding: 14px 16px; border-radius: 12px; background: #f6f8fc; }
.insight-stats span, .mini-stats span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.insight-stats b, .mini-stats b { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.insight-stats small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.heat { border-collapse: separate; border-spacing: 4px; font-size: .86rem; }
.heat th { padding: 6px 10px; font-weight: 600; color: var(--ink-2); text-align: center; }
.heat tbody th { text-align: left; max-width: 220px; }
.heat td { min-width: 70px; height: 40px; text-align: center; border-radius: 8px; background: color-mix(in srgb, var(--c) calc(var(--a) * 85%), #f2f4f9); font-weight: 700; font-variant-numeric: tabular-nums; }
.heat td span { color: var(--ink); mix-blend-mode: normal; }
.answers { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.answers li { padding: 10px 14px; border-radius: 10px; background: #f6f8fc; font-size: .92rem; overflow-wrap: anywhere; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 14px; }
.pager form { margin: 0; }
.pager-jump { display: flex; align-items: center; gap: 8px; }
.pager-jump .select { max-width: 320px; }
.resp-meta { display: flex; gap: 32px; flex-wrap: wrap; padding: 18px 24px; margin-bottom: 14px; border-top: 6px solid var(--c); }
.resp-meta div { display: flex; flex-direction: column; }
.resp-meta span { font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.resp-meta b { font-weight: 600; }
.score { font-size: 1.4rem; color: var(--ok); }
.score small { font-size: .9rem; color: var(--muted); }
.resp-section { margin: 24px 0 10px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ans-card { border-left: 4px solid transparent; }
.ans-card.is-correct { border-left-color: #12a06c; }
.ans-card.is-wrong { border-left-color: var(--bad); }
.no-answer { font-style: italic; margin: 0; }
.answer-text { padding: 10px 14px; border-radius: 10px; background: #f6f8fc; overflow-wrap: anywhere; }
.picked { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { padding: 7px 14px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; font-size: .9rem; }
.grid-answer { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0; font-size: .92rem; }
.grid-answer dt { color: var(--muted); }
.grid-answer dd { margin: 0; font-weight: 600; }
.stars-static { color: #f3b515; font-size: 1.5rem; letter-spacing: 3px; }
.stars-static span { color: #dde2ec; }
.correct-note { display: block; margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--ok-soft); color: #075c3e; font-size: .88rem; font-weight: 500; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); color: var(--ink); font-size: .86rem; font-weight: 600; }
.file-chip:hover { border-color: var(--brand); color: var(--brand); }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-chip small { color: var(--muted); font-weight: 500; }
.table-dense .file-chip { padding: 4px 8px; margin: 2px 0; }

/* ---------- Auth ---------- */
.bare-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(800px 400px at 50% -10%, #e4ecff, transparent 70%), var(--bg); }
.bare-main:has(.auth) { padding: 0; place-items: stretch; }
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-side { position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 56px; color: #fff; background: radial-gradient(700px 500px at 100% 0%, rgba(25, 181, 254, .5), transparent 60%), radial-gradient(700px 600px at 0% 100%, rgba(31, 92, 255, .6), transparent 60%), #0b1b3f; }
.auth-side::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(circle at 70% 30%, #000, transparent 70%); }
.auth-side-inner { position: relative; z-index: 1; max-width: 480px; }
.auth-side .eyebrow { color: #8fd4ff; }
.auth-side h2 { font-size: 2.1rem; line-height: 1.15; margin-bottom: 24px; }
.auth-side ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; color: rgba(255,255,255,.85); }
.auth-side li { display: flex; gap: 12px; align-items: center; }
.auth-side li .ic { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: rgba(143, 212, 255, .2); color: #8fd4ff; stroke-width: 2.4; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 24px; }
.auth-card .stack { margin: 22px 0 18px; }
.auth-card.center { text-align: center; padding: 40px 32px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-3); }
.auth-card.center .logo-lg { margin: 0 auto 22px; }
.auth-card.center h1 { margin-bottom: 8px; }
.auth-card.center .btn { margin-top: 10px; }

/* ---------- Public form ---------- */
body.public { min-height: 100vh; background: color-mix(in srgb, var(--tc) 10%, #f5f7fb); }
.public-main { max-width: 760px; margin: 0 auto; padding: 32px 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.public.embed { background: transparent; }
.public.embed .public-main { padding-top: 8px; }
.pcard { position: relative; margin: 0; min-width: 0; padding: 24px 28px; background: #fff; border: 1px solid color-mix(in srgb, var(--tc) 8%, var(--line)); border-radius: var(--r); box-shadow: 0 1px 2px rgba(11,27,63,.04), 0 8px 24px -16px rgba(11,27,63,.16); }
.phead { padding-top: 36px; overflow: hidden; }
.phead-band { position: absolute; top: 0; left: 0; right: 0; height: 10px; background: linear-gradient(90deg, var(--tc), color-mix(in srgb, var(--tc) 50%, #19b5fe)); }
.phead h1 { font-family: var(--ff); font-size: 2.05rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 10px; overflow-wrap: anywhere; }
.pdesc { color: var(--ink-2); margin: 0; font-size: 1rem; }
.phead-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.phead-meta span { display: inline-flex; align-items: center; gap: 6px; }
.phead-meta .ic { width: 15px; height: 15px; }
.req-note { color: var(--bad) !important; }
.preview-note { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: .86rem; }
.pclosed { display: flex; align-items: center; gap: 14px; color: var(--ink-2); }
.pclosed .ic { width: 26px; height: 26px; color: var(--tc); }
.pclosed p { margin: 0; font-size: 1.02rem; }
.perror-summary { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: var(--bad-soft); border-color: #f3c4c7; color: var(--bad); font-weight: 600; }
.pform { display: flex; flex-direction: column; gap: 14px; }
.js .ppage:not(.is-current) { display: none; }
.ppage { display: flex; flex-direction: column; gap: 14px; animation: fadein .25s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }
.progress { display: flex; align-items: center; gap: 14px; padding: 4px 4px 0; }
.progress-track { flex: 1; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 14%, #fff); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--tc), color-mix(in srgb, var(--tc) 55%, #19b5fe)); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.progress small { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.psection { padding-top: 42px; overflow: hidden; }
.psection-tab { position: absolute; top: 0; left: 0; padding: 5px 14px; border-radius: 0 0 10px 0; background: var(--tc); color: #fff; font-size: .74rem; font-weight: 700; }
.psection h2, .pstatement h2 { font-family: var(--ff); font-size: 1.35rem; margin-bottom: 6px; }
.psection p, .pstatement p { color: var(--ink-2); margin: 0; }
.pq { transition: border-color .2s, box-shadow .2s; }
.pq::before { content: ""; position: absolute; left: -1px; top: 0; bottom: 0; width: 5px; border-radius: var(--r) 0 0 var(--r); background: transparent; transition: background .2s; }
.pq:focus-within::before { background: var(--tc); }
.pq.has-error { border-color: #f0b4b8; }
.pq.has-error::before { background: var(--bad); }
.pq-label { display: flex; justify-content: space-between; gap: 16px; float: left; width: 100%; padding: 0; margin-bottom: 4px; font-family: var(--ff); font-size: 1.06rem; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.pq-label + * { clear: left; }
.pts { flex: none; font-family: var(--font); font-size: .78rem; font-weight: 600; color: var(--muted); padding-top: 3px; }
.pq-help { clear: left; margin: 0 0 4px; color: var(--muted); font-size: .9rem; }
.pinput { display: block; width: 100%; max-width: 100%; margin-top: 14px; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--line-2); outline: none; background: transparent; font-size: 1rem; transition: border-color .2s, box-shadow .2s; }
.pq .pinput:not(.pinput-inline) { max-width: 100%; }
.pinput:focus { border-bottom-color: var(--tc); box-shadow: 0 1px 0 var(--tc); }
.pinput-auto { width: auto; min-width: 200px; }
textarea.pinput { resize: none; overflow: hidden; min-height: 44px; line-height: 1.5; }
.choices { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.choice { position: relative; display: flex; align-items: center; gap: 14px; min-height: 44px; padding: 8px 12px; margin: 0 -12px; border-radius: 10px; cursor: pointer; transition: background .12s; }
.choice:hover { background: color-mix(in srgb, var(--tc) 5%, #fff); }
.choice > input, .pgrid input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ctl { position: relative; flex: none; width: 20px; height: 20px; border: 2px solid #aab2c3; border-radius: 50%; background: #fff; transition: border-color .15s, background .15s, box-shadow .15s; }
input[type=checkbox] + .ctl { border-radius: 6px; }
input:checked + .ctl { border-color: var(--tc); }
input[type=radio]:checked + .ctl::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--tc); animation: dot .18s cubic-bezier(.3,1.6,.6,1); }
input[type=checkbox]:checked + .ctl { background: var(--tc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat; }
@keyframes dot { from { transform: scale(0); } }
input:focus-visible + .ctl { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 22%, transparent); }
.choice-text { font-size: .98rem; overflow-wrap: anywhere; }
.choice-other .pinput-inline { flex: 1; margin: 0; padding: 4px 2px; }
.clear-choice { display: block; margin: 8px 0 0 auto; border: 0; background: none; color: var(--muted); font-size: .84rem; font-weight: 600; }
.clear-choice:hover { color: var(--ink); }
.pselect-wrap { position: relative; display: inline-block; margin-top: 14px; min-width: 260px; max-width: 100%; }
.pselect { appearance: none; width: 100%; height: 46px; padding: 0 42px 0 14px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; font-size: .98rem; outline: none; cursor: pointer; }
.pselect:focus { border-color: var(--tc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 18%, transparent); }
.pselect-wrap .ic { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.scale { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.scale-end { font-size: .86rem; color: var(--ink-2); max-width: 140px; }
.scale-opts { display: flex; gap: 6px; flex-wrap: wrap; }
.scale-opt { position: relative; cursor: pointer; }
.scale-opt input { position: absolute; opacity: 0; }
.scale-opt span { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; font-weight: 600; color: var(--ink-2); transition: all .15s; }
.scale-opt:hover span { border-color: var(--tc); color: var(--tc); }
.scale-opt input:checked + span { background: var(--tc); border-color: var(--tc); color: #fff; box-shadow: 0 6px 14px -6px var(--tc); transform: translateY(-1px); }
.scale-opt input:focus-visible + span { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 22%, transparent); }
.stars { display: inline-flex; flex-direction: row-reverse; gap: 4px; margin-top: 12px; }
.stars input { position: absolute; opacity: 0; }
.stars label { cursor: pointer; color: #d9dee8; transition: color .12s, transform .12s; }
.stars label .ic { width: 36px; height: 36px; fill: currentColor; stroke: currentColor; stroke-width: 1; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: #f3b515; }
.stars label:hover { transform: scale(1.12); }
.stars input:focus-visible + label { outline: 2px solid var(--tc); outline-offset: 2px; border-radius: 6px; }
.pgrid-wrap { margin-top: 14px; overflow-x: auto; }
.pgrid { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: .92rem; }
.pgrid thead th { padding: 6px 8px; font-weight: 600; color: var(--ink-2); text-align: center; font-size: .86rem; }
.pgrid tbody tr { background: #f7f8fc; }
.pgrid tbody th { padding: 12px 14px; text-align: left; font-weight: 500; border-radius: 10px 0 0 10px; }
.pgrid td { text-align: center; padding: 8px; }
.pgrid td:last-child { border-radius: 0 10px 10px 0; }
.pgrid td label { display: inline-grid; place-items: center; padding: 6px; cursor: pointer; position: relative; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 14px; padding: 22px; border: 2px dashed color-mix(in srgb, var(--tc) 30%, var(--line-2)); border-radius: 14px; background: color-mix(in srgb, var(--tc) 3%, #fff); color: var(--ink-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 7%, #fff); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .ic { width: 28px; height: 28px; color: var(--tc); margin-bottom: 4px; }
.dropzone b { color: var(--tc); }
.dropzone small { color: var(--muted); font-size: .8rem; }
.file-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 10px; background: #f6f8fc; font-size: .9rem; font-weight: 600; }
.file-list small { color: var(--muted); font-weight: 500; }
.perr { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--bad); font-size: .87rem; font-weight: 500; }
.perr .ic { width: 16px; height: 16px; padding: 2px; border-radius: 50%; background: var(--bad); color: #fff; stroke-width: 3; }
.pnav { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.pbtn { display: inline-flex; align-items: center; gap: 6px; height: 46px; padding: 0 26px; border: 0; border-radius: 12px; background: var(--tc); color: #fff; font-weight: 650; font-size: .98rem; box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 8px 18px -10px var(--tc); transition: filter .15s, transform .05s; }
.pbtn:hover { filter: brightness(.93); }
.pbtn:active { transform: translateY(1px); }
.pbtn:disabled { opacity: .7; cursor: wait; }
.pbtn-ghost { background: #fff; color: var(--tc); border: 1px solid color-mix(in srgb, var(--tc) 25%, var(--line-2)); box-shadow: none; padding: 0 18px 0 14px; }
.pbtn .ic { width: 18px; height: 18px; }
.plink { border: 0; background: none; color: var(--tc); font-weight: 600; font-size: .92rem; }
.plink:hover { text-decoration: underline; text-underline-offset: 3px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.public-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 16px 40px; color: var(--muted); font-size: .78rem; }
.foot-brand { display: inline-flex; align-items: center; gap: 8px; }
.foot-brand img { height: 20px; width: auto; }
.embed .public-foot { display: none; }
.pdone { text-align: center; padding-bottom: 32px; }
.done-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin: 4px auto 16px; border-radius: 50%; background: color-mix(in srgb, var(--tc) 12%, #fff); color: var(--tc); animation: popin .5s cubic-bezier(.3,1.6,.5,1); }
.done-icon .ic { width: 30px; height: 30px; stroke-width: 2.6; }
@keyframes popin { from { transform: scale(.4); opacity: 0; } }
.pdone .pdesc { max-width: 520px; margin: 0 auto 18px; }
.score-ring { display: grid; place-items: center; width: 160px; height: 160px; margin: 8px auto 20px; border-radius: 50%; background: conic-gradient(var(--tc) calc(var(--p) * 1%), color-mix(in srgb, var(--tc) 12%, #fff) 0); }
.score-ring > div { display: grid; place-items: center; align-content: center; width: 128px; height: 128px; border-radius: 50%; background: #fff; }
.score-ring b { font-size: 2.4rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.score-ring span { font-size: .82rem; color: var(--muted); font-weight: 600; }
.review { border-left: 5px solid var(--line-2); }
.review.is-correct { border-left-color: #12a06c; }
.review.is-wrong { border-left-color: var(--bad); }
.review-head { display: flex; justify-content: space-between; gap: 16px; font-family: var(--ff); font-size: 1.02rem; margin-bottom: 8px; }
.review-answer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.review-correct { display: block; margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--ok-soft); color: #075c3e; font-size: .9rem; }
.review-feedback { margin: 10px 0 0; padding: 10px 14px; border-radius: 10px; background: #f6f8fc; color: var(--ink-2); font-size: .9rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .tpl-row { grid-template-columns: repeat(6, 160px); }
}
@media (max-width: 960px) {
  .two-col { grid-template-columns: 1fr; }
  .formbar { grid-template-columns: 1fr auto; height: auto; padding: 8px 12px 0; row-gap: 0; }
  .formbar .tabs { grid-column: 1 / -1; grid-row: 2; justify-content: center; height: 46px; }
  .formbar-right { grid-column: 2; grid-row: 1; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 1000px) {
  .fab { position: fixed; top: auto !important; bottom: 18px; left: 50%; right: auto; transform: translateX(-50%); flex-direction: row; box-shadow: var(--shadow-3); z-index: 35; }
  .panel { padding-bottom: 110px; }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .topbar { padding: 0 14px; gap: 10px; height: 58px; }
  .topbar .logo { height: 30px; }
  .topnav a span { display: none; }
  .topnav a { padding: 0 10px; }
  .hide-sm { display: none; }
  .formbar { top: 58px; }
  .formbar-title .save-state { display: none; }
  .formbar-right .btn span { display: none; }
  .hero-inner, .forms-area, .page { padding-left: 16px; padding-right: 16px; }
  .hero h1 { font-size: 1.45rem; }
  .kpis { width: 100%; }
  .kpi { flex: 1; min-width: 0; padding: 10px 12px; }
  .kpi b { font-size: 1.15rem; }
  .tpl-row { grid-template-columns: repeat(6, 132px); margin: 0 -16px; padding: 2px 16px 8px; }
  .search input { width: 100%; }
  .toolbar { width: 100%; }
  .toolbar .search { flex: 1 1 100%; }
  .form-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .panel { padding: 16px 10px 110px; }
  .qcard { padding: 20px 16px 10px; }
  .title-card { padding: 26px 18px 18px; }
  .title-input { font-size: 1.55rem; }
  .q-head { flex-direction: column; align-items: stretch; }
  .type-btn { width: 100%; height: 46px; }
  .q-foot { flex-wrap: wrap; }
  .grid-editor, .feedback, .file-settings { grid-template-columns: 1fr; }
  .fonts { grid-template-columns: repeat(2, 1fr); }
  .srow-field { flex-direction: column; align-items: stretch; gap: 8px; }
  .srow-field .input, .srow-field .input-sm { width: 100%; }
  .scard { padding: 4px 16px 8px; }
  .resp-wrap, .resp-wrap.resp-wide { padding: 16px 10px 0; }
  .bar-row { grid-template-columns: 1fr 76px; }
  .bar-label { grid-column: 1 / -1; }
  .insight-stats, .mini-stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .insight-stats b, .mini-stats b { font-size: 1.15rem; }
  .table th:nth-child(4), .table td:nth-child(4), .table th:nth-child(5), .table td:nth-child(5) { display: none; }
  #resp-table th, #resp-table td { display: table-cell; }
  .public-main { padding: 16px 10px; gap: 10px; }
  .pcard { padding: 20px 18px; }
  .phead { padding-top: 30px; }
  .phead h1 { font-size: 1.6rem; }
  .pnav { flex-wrap: wrap; }
  .pgrid thead { display: none; }
  .pgrid, .pgrid tbody, .pgrid tr, .pgrid th, .pgrid td { display: block; }
  .pgrid tbody tr { padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; }
  .pgrid tbody th { padding: 0 0 6px; border-radius: 0; }
  .pgrid td { display: inline-flex; align-items: center; padding: 2px 10px 2px 0; }
  .pgrid td::after { content: attr(data-col); font-size: .86rem; color: var(--ink-2); }
  .pgrid td label { padding: 6px 6px 6px 0; }
  .scale-opt span { width: 38px; height: 38px; }
}
@media (max-width: 420px) {
  .form-grid { grid-template-columns: 1fr; }
}
.review-correct .ic, .correct-note .ic { margin: -2px 6px 0 0; }
