/* =========================================================
   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", "IBM Plex Sans Arabic", 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; }
.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(8, minmax(130px, 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: 0 28px 22px; overflow: hidden; cursor: text; }
.title-card .cover { margin: 0 -28px 22px; height: 92px; }
.title-card .cover-minimal { height: 10px; }
.title-card.is-active::before { top: 0; z-index: 1; }
.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 { position: static; display: inline-block; margin: -22px 0 12px -28px; border-radius: 0 0 var(--r-sm) 0; }
.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 .auth-brand { display: flex; justify-content: center; }
.auth-card.center h1 { margin-bottom: 8px; }
.auth-card.center .btn { margin-top: 10px; }

/* ---------- Covers (shared by public form, editor and pickers) ---------- */
.cover { position: relative; overflow: hidden; height: 136px; isolation: isolate; background: var(--tc); }
.cover i { position: absolute; border-radius: 50%; filter: blur(30px); }
.cover-aurora { background: linear-gradient(120deg, color-mix(in oklch, var(--tc) 75%, #000) 0%, var(--tc) 45%, color-mix(in oklch, var(--tc) 60%, #19b5fe) 100%); }
.cover-aurora i:nth-child(1) { width: 55%; height: 170%; left: -8%; top: -70%; background: color-mix(in oklch, var(--tc) 40%, #ffffff); opacity: .7; animation: drift 16s ease-in-out infinite alternate; }
.cover-aurora i:nth-child(2) { width: 45%; height: 150%; right: -6%; top: -25%; background: color-mix(in oklch, var(--tc) 55%, #ffd36b); opacity: .55; animation: drift 20s ease-in-out infinite alternate-reverse; }
.cover-aurora i:nth-child(3) { width: 30%; height: 110%; left: 42%; top: 35%; background: #fff; opacity: .22; }
@keyframes drift { to { transform: translate(12%, 8%) scale(1.12); } }
.cover-mesh { background: radial-gradient(at 12% 18%, color-mix(in srgb, var(--tc) 45%, #fff) 0, transparent 48%), radial-gradient(at 88% 8%, color-mix(in oklch, var(--tc) 60%, #19b5fe) 0, transparent 52%), radial-gradient(at 55% 110%, color-mix(in srgb, var(--tc) 65%, #000) 0, transparent 58%), radial-gradient(at 100% 100%, color-mix(in oklch, var(--tc) 55%, #ffd36b) 0, transparent 45%), var(--tc); }
.cover-waves { background: linear-gradient(135deg, color-mix(in oklch, var(--tc) 80%, #000), var(--tc) 50%, color-mix(in oklch, var(--tc) 60%, #19b5fe)); }
.cover-waves::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 140' preserveAspectRatio='none'%3E%3Cpath d='M0 70 C200 20 400 120 600 70 S1000 20 1200 70' fill='none' stroke='white' stroke-opacity='.22' stroke-width='2'/%3E%3Cpath d='M0 90 C200 40 400 140 600 90 S1000 40 1200 90' fill='none' stroke='white' stroke-opacity='.34' stroke-width='2'/%3E%3Cpath d='M0 110 C200 60 400 160 600 110 S1000 60 1200 110' fill='none' stroke='white' stroke-opacity='.2' stroke-width='2'/%3E%3Cpath d='M0 140 L0 122 C300 84 520 150 800 116 S1100 96 1200 112 L1200 140Z' fill='white' fill-opacity='.14'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }
.cover-dots { background: radial-gradient(rgba(255, 255, 255, .3) 1.3px, transparent 1.7px) 0 0 / 16px 16px, linear-gradient(135deg, color-mix(in srgb, var(--tc) 78%, #000), var(--tc) 55%, color-mix(in srgb, var(--tc) 55%, #fff)); }
.cover-minimal { height: 10px; background: linear-gradient(90deg, var(--tc), color-mix(in srgb, var(--tc) 50%, #19b5fe)); }
.cover-mesh i, .cover-waves i, .cover-dots i, .cover-minimal i { display: none; }
.cover-short { height: 100px; }
.cover-short.cover-minimal { height: 10px; }

/* ---------- Public form ---------- */
body.public { --p-surface: #fff; --p-card: rgba(255, 255, 255, .92); --p-card-border: rgba(255, 255, 255, .8); --p-soft: #f6f8fc; --p-base: #f6f7fb; --p-bar: rgba(255, 255, 255, .84); --p-control: #aab2c3; color: var(--ink); }
body.public.mode-dark {
  color-scheme: dark;
  --ink: #edf1fa; --ink-2: #c5cde0; --muted: #8f99b4; --faint: #6c7690;
  --line: rgba(255, 255, 255, .08); --line-2: rgba(255, 255, 255, .16);
  --p-surface: #161c2d; --p-card: rgba(21, 27, 44, .78); --p-card-border: rgba(255, 255, 255, .07); --p-soft: rgba(255, 255, 255, .05);
  --p-base: #090d17; --p-bar: rgba(13, 18, 31, .86); --p-control: #4d5772;
  --bad-soft: rgba(229, 72, 77, .14); --ok-soft: rgba(23, 163, 107, .16); --warn-soft: rgba(245, 165, 36, .14);
}
.mode-dark .ambient i:nth-child(1) { background: color-mix(in srgb, var(--tc) 55%, transparent); opacity: .7; }
.mode-dark .ambient i:nth-child(2) { opacity: .45; }
.mode-dark .pcard { box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 24px 48px -24px rgba(0, 0, 0, .7); }
.mode-dark .review-correct, .mode-dark .correct-note { color: #7ee2b8; }
.mode-dark .perror-summary { border-color: rgba(229, 72, 77, .35); }
.mode-dark .pq.has-error { box-shadow: 0 0 0 1.5px rgba(239, 154, 160, .6), 0 12px 32px -18px rgba(0, 0, 0, .6); }
.mode-dark .preview-note, .mode-dark .draft-note { border-color: var(--line-2); }
.mode-dark .brand-name { color: var(--ink-2); }
.mode-dark kbd { box-shadow: none; }
body.public { min-height: 100vh; background: color-mix(in srgb, var(--tc) 5%, var(--p-base)); }
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.ambient i { position: absolute; border-radius: 50%; filter: blur(90px); }
.ambient i:nth-child(1) { width: 60vmax; height: 60vmax; top: -28vmax; left: -18vmax; background: color-mix(in srgb, var(--tc) 32%, transparent); }
.ambient i:nth-child(2) { width: 55vmax; height: 55vmax; bottom: -32vmax; right: -22vmax; background: color-mix(in oklch, var(--tc) 40%, #19b5fe); opacity: .25; }
.ambient i:nth-child(3) { width: 30vmax; height: 30vmax; top: 40%; right: 12%; background: color-mix(in oklch, var(--tc) 50%, #ffd36b); opacity: .16; }
.public-main { max-width: 760px; margin: 0 auto; padding: 36px 16px 20px; display: flex; flex-direction: column; gap: 16px; }
.public.embed, .public.embed .ambient { background: transparent; }
.public.embed .ambient { display: none; }
.public.embed .public-main { padding-top: 8px; }
.pcard { position: relative; margin: 0; min-width: 0; padding: 26px 30px; background: var(--p-card); border: 1px solid var(--p-card-border); border-radius: 20px; box-shadow: 0 1px 2px rgba(11, 27, 63, .04), 0 12px 32px -18px rgba(11, 27, 63, .22); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.phead { padding: 0; overflow: hidden; }
.phead-body { padding: 26px 32px 28px; }
.phead h1 { font-family: var(--ff); font-size: 2.1rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 10px; overflow-wrap: anywhere; }
.pdesc { color: var(--ink-2); margin: 0; font-size: 1.02rem; line-height: 1.6; }
.phead-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.phead-meta span { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 8%, var(--p-surface)); color: color-mix(in srgb, var(--tc) 70%, var(--ink)); font-size: .82rem; font-weight: 600; }
.phead-meta .ic { width: 15px; height: 15px; }
.req-note { margin: 14px 0 0; color: var(--bad); font-size: .82rem; }
.start-row { display: flex; align-items: center; gap: 16px; margin-top: 26px; flex-wrap: wrap; }
.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: 16px; }
.js .ppage:not(.is-current) { display: none; }
.ppage { display: flex; flex-direction: column; gap: 16px; animation: fadein .3s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } }
.progress { display: flex; align-items: center; gap: 14px; padding: 2px 4px 0; }
.progress-track { flex: 1; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 14%, var(--p-surface)); 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 .5s cubic-bezier(.2,.8,.2,1); }
.progress small { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.draft-note { transition: opacity .4s, transform .4s; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--p-surface); border: 1px solid color-mix(in srgb, var(--tc) 25%, var(--line)); box-shadow: var(--shadow-2); font-size: .9rem; color: var(--ink-2); animation: pop .3s ease-out; }
.draft-note .ic { color: var(--tc); }
.draft-note button { margin-left: auto; border: 0; background: none; color: var(--tc); font-weight: 700; white-space: nowrap; }
.psection { padding-top: 44px; overflow: hidden; }
.psection-tab { position: absolute; top: 0; left: 0; padding: 6px 16px; border-radius: 0 0 12px 0; background: var(--tc); color: #fff; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.psection h2, .pstatement h2 { font-family: var(--ff); font-size: 1.4rem; letter-spacing: -.02em; margin-bottom: 6px; }
.psection p, .pstatement p { color: var(--ink-2); margin: 0; line-height: 1.6; }
.pq { transition: box-shadow .25s, border-color .25s, transform .25s; }
.pq:focus-within { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--tc) 45%, transparent), 0 18px 40px -20px color-mix(in srgb, var(--tc) 55%, transparent); }
.pq.has-error { box-shadow: 0 0 0 1.5px #ef9aa0, 0 12px 32px -18px rgba(196, 42, 50, .35); }
.shake { animation: shake .42s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.pq-label { display: flex; align-items: baseline; gap: 10px; float: left; width: 100%; padding: 0; margin-bottom: 4px; font-family: var(--ff); font-size: 1.1rem; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.pq-label + * { clear: left; }
.pq-text { flex: 1; }
.qnum { display: none; align-items: center; gap: 2px; color: var(--tc); font-family: var(--font); font-size: .9rem; font-weight: 700; flex: none; }
.qnum .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.pts { flex: none; padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 9%, var(--p-surface)); color: color-mix(in srgb, var(--tc) 75%, var(--ink)); font-family: var(--font); font-size: .74rem; font-weight: 700; }
.pq-help { clear: left; margin: 0 0 4px; color: var(--muted); font-size: .92rem; }
.choose-hint { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.pinput { display: block; width: 100%; max-width: 100%; margin-top: 16px; padding: 10px 2px; border: 0; border-bottom: 1.5px solid var(--line-2); outline: none; background: transparent; font-size: 1.04rem; transition: border-color .2s; }
.pinput::placeholder { color: var(--faint); }
.pinput:focus { border-bottom-color: var(--tc); }
.pinput-auto { width: auto; min-width: 220px; padding: 10px 12px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--p-surface); }
.pinput-auto:focus { border-color: var(--tc); }
textarea.pinput { resize: none; overflow: hidden; min-height: 46px; line-height: 1.55; }
.counter { display: block; margin-top: 6px; text-align: right; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--bad); font-weight: 700; }

.choices { display: grid; gap: 10px; margin-top: 16px; }
.choice { position: relative; display: flex; align-items: center; gap: 14px; min-height: 54px; margin: 0; padding: 10px 16px 10px 12px; border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--p-surface); cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s, transform .15s; }
.choice:hover { border-color: color-mix(in srgb, var(--tc) 55%, var(--line-2)); background: color-mix(in srgb, var(--tc) 3%, var(--p-surface)); transform: translateY(-1px); }
.choice > input, .pgrid input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice .key { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border: 1.5px solid color-mix(in srgb, var(--tc) 30%, var(--line-2)); border-radius: 9px; background: var(--p-surface); color: var(--tc); font-size: .8rem; font-weight: 700; transition: all .15s; }
.choice input[type=radio] + .key { border-radius: 50%; }
.choice-text { flex: 1; font-size: 1rem; overflow-wrap: anywhere; }
.choice .tick { color: var(--tc); opacity: 0; transform: scale(.5); transition: opacity .15s, transform .2s cubic-bezier(.3,1.6,.6,1); stroke-width: 2.6; }
.choice input:checked + .key { background: var(--tc); border-color: var(--tc); color: #fff; }
.choice:has(input:checked) { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 7%, var(--p-surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 13%, transparent); }
.choice:has(input:checked) .tick { opacity: 1; transform: none; }
.choice:has(input:focus-visible) { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 24%, transparent); }
.choice-other .choice-text { flex: none; }
.choice-other .pinput-inline { flex: 1; min-width: 0; margin: 0; padding: 4px 2px; font-size: .96rem; }
.clear-choice { display: block; margin: 10px 0 0 auto; border: 0; background: none; color: var(--muted); font-size: .84rem; font-weight: 600; }
.clear-choice:hover { color: var(--ink); }
.ctl { position: relative; display: inline-block; flex: none; width: 22px; height: 22px; border: 2px solid var(--p-control); border-radius: 50%; background: var(--p-surface); transition: border-color .15s, background .15s, box-shadow .15s; }
input[type=checkbox] + .ctl { border-radius: 7px; }
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); }

.pselect-wrap { position: relative; display: block; margin-top: 16px; max-width: 420px; }
.pselect { appearance: none; width: 100%; height: 52px; padding: 0 44px 0 16px; border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--p-surface); font-size: 1rem; outline: none; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.pselect:hover { border-color: color-mix(in srgb, var(--tc) 55%, var(--line-2)); }
.pselect:focus { border-color: var(--tc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 16%, transparent); }
.pselect-wrap .ic { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.scale { margin-top: 18px; }
.scale-opts { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 6px; }
.scale-opt { position: relative; cursor: pointer; }
.scale-opt input { position: absolute; opacity: 0; }
.scale-opt span { display: grid; place-items: center; height: 52px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--p-surface); font-weight: 700; font-size: 1rem; color: var(--ink-2); transition: all .15s; }
.scale-opt:hover span { border-color: var(--tc); color: var(--tc); transform: translateY(-2px); }
.scale-opt input:checked + span { background: var(--tc); border-color: var(--tc); color: #fff; box-shadow: 0 10px 20px -10px var(--tc); transform: translateY(-2px); }
.scale-opt input:focus-visible + span { box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 22%, transparent); }
.scale-nps .scale-opt:nth-child(-n+7) input:checked + span { background: #e5484d; border-color: #e5484d; box-shadow: 0 10px 20px -10px #e5484d; }
.scale-nps .scale-opt:nth-child(8) input:checked + span, .scale-nps .scale-opt:nth-child(9) input:checked + span { background: #f5a524; border-color: #f5a524; box-shadow: 0 10px 20px -10px #f5a524; }
.scale-nps .scale-opt:nth-child(n+10) input:checked + span { background: #17a36b; border-color: #17a36b; box-shadow: 0 10px 20px -10px #17a36b; }
.scale-ends { display: flex; justify-content: space-between; gap: 16px; margin-top: 10px; font-size: .84rem; color: var(--muted); }
.stars { display: inline-flex; flex-direction: row-reverse; gap: 6px; margin-top: 14px; }
.stars input { position: absolute; opacity: 0; }
.stars label { cursor: pointer; color: #dde2ec; transition: color .12s, transform .15s cubic-bezier(.3,1.6,.6,1); }
.stars label .ic { width: 40px; height: 40px; fill: currentColor; stroke: currentColor; stroke-width: 1; }
.stars label:hover, .stars label:hover ~ label, .stars input:checked ~ label { color: #f5b70f; }
.stars label:hover { transform: scale(1.15) rotate(-6deg); }
.stars input:focus-visible + label { outline: 2px solid var(--tc); outline-offset: 2px; border-radius: 6px; }
.pgrid-wrap { margin-top: 16px; overflow-x: auto; }
.pgrid { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: .94rem; }
.pgrid thead th { padding: 6px 8px; font-weight: 600; color: var(--ink-2); text-align: center; font-size: .84rem; }
.pgrid tbody tr { background: color-mix(in srgb, var(--tc) 4%, var(--p-soft)); }
.pgrid tbody th { padding: 13px 16px; text-align: left; font-weight: 500; border-radius: 12px 0 0 12px; }
.pgrid td { text-align: center; padding: 8px; }
.pgrid td:last-child { border-radius: 0 12px 12px 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: 16px; padding: 28px 22px; border: 2px dashed color-mix(in srgb, var(--tc) 30%, var(--line-2)); border-radius: 18px; background: color-mix(in srgb, var(--tc) 3%, var(--p-surface)); color: var(--ink-2); text-align: center; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 7%, var(--p-surface)); }
.dropzone.drag { transform: scale(1.01); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 8px; border-radius: 50%; background: color-mix(in srgb, var(--tc) 12%, var(--p-surface)); color: var(--tc); }
.dz-icon .ic { width: 24px; height: 24px; }
.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; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: color-mix(in srgb, var(--tc) 5%, var(--p-soft)); font-size: .9rem; font-weight: 600; }
.file-list li .ic { color: var(--tc); }
.file-list li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list small { color: var(--muted); font-weight: 500; }
.perr { display: flex; align-items: center; gap: 8px; margin: 14px 0 0; color: var(--bad); font-size: .88rem; font-weight: 600; }
.perr .ic { width: 18px; height: 18px; 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; justify-content: center; gap: 8px; height: 50px; padding: 0 28px; border: 0; border-radius: 14px; background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 88%, #fff), var(--tc)); color: #fff; font-weight: 700; font-size: 1rem; text-decoration: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 10px 22px -12px var(--tc); transition: filter .15s, transform .1s, box-shadow .2s; }
.pbtn:hover { filter: brightness(1.06); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 14px 26px -12px var(--tc); }
.pbtn:active { transform: translateY(1px); }
.pbtn:disabled { opacity: .7; cursor: wait; }
.pbtn-lg { height: 56px; padding: 0 32px; font-size: 1.06rem; }
.pbtn-ghost { background: var(--p-surface); color: var(--tc); border: 1.5px solid color-mix(in srgb, var(--tc) 25%, var(--line-2)); box-shadow: none; }
.pbtn-ghost:hover { color: var(--tc); background: color-mix(in srgb, var(--tc) 5%, var(--p-surface)); box-shadow: none; }
.pbtn .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.plink { border: 0; background: none; color: var(--tc); font-weight: 600; font-size: .92rem; }
.plink:hover { text-decoration: underline; text-underline-offset: 3px; }
.kbd-hint { font-size: .8rem; color: var(--muted); }
kbd { display: inline-block; padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--p-surface); box-shadow: 0 1px 0 var(--line-2); font: 600 .74rem var(--font); color: var(--ink-2); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.public-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 16px 40px; color: var(--muted); font-size: .78rem; }
.foot-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.foot-brand:hover { color: var(--ink-2); }
.embed .public-foot { display: none; }

/* Finish & results */
.pdone .phead-body { text-align: center; padding-top: 0; }
.done-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 84px; height: 84px; margin: -42px auto 16px; border-radius: 50%; background: var(--p-surface); box-shadow: 0 12px 30px -12px color-mix(in srgb, var(--tc) 60%, transparent); }
.cover-minimal + .phead-body .done-icon { margin-top: 26px; }
.done-icon svg { width: 54px; height: 54px; fill: none; stroke: var(--tc); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.done-icon circle { stroke-dasharray: 151; stroke-dashoffset: 151; opacity: .3; animation: draw .7s .1s forwards; }
.done-icon path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s .6s cubic-bezier(.3,1.4,.6,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pdone .pdesc { max-width: 520px; margin: 0 auto 22px; }
.pdone .pbtn-ghost { margin-top: 6px; }
.score-ring { display: grid; place-items: center; width: 168px; height: 168px; margin: 8px auto 12px; border-radius: 50%; background: conic-gradient(var(--tc) calc(var(--p) * 1%), color-mix(in srgb, var(--tc) 12%, var(--p-surface)) 0); animation: popin .6s cubic-bezier(.3,1.5,.5,1); }
.score-ring > div { display: grid; place-items: center; align-content: center; width: 134px; height: 134px; border-radius: 50%; background: var(--p-surface); }
.score-ring b { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.score-ring span { font-size: .82rem; color: var(--muted); font-weight: 600; }
@keyframes popin { from { transform: scale(.5); opacity: 0; } }
.score-msg { font-weight: 700; font-size: 1.05rem; margin: 0 0 18px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.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.04rem; 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: 12px; background: var(--ok-soft); color: #075c3e; font-size: .9rem; }
.review-feedback { margin: 10px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--p-soft); color: var(--ink-2); font-size: .9rem; }

/* ---------- Focus layout: one question at a time ---------- */
.layout-focus .public-main { min-height: calc(100vh - 90px); justify-content: center; padding-top: 48px; padding-bottom: 130px; }
.js .layout-focus .fstep:not(.is-current) { display: none; }
.js .layout-focus .ppage, .js .layout-focus .ppage:not(.is-current) { display: contents; }
.layout-focus .perror-summary { display: none; }
.layout-focus .pq, .layout-focus .pstatement, .layout-focus .psection, .layout-focus .pfinish { padding: 44px 48px 38px; border-radius: 26px; }
.layout-focus .psection { padding-top: 58px; }
.layout-focus .pq-label { font-size: 1.55rem; line-height: 1.3; letter-spacing: -.015em; gap: 12px; }
.layout-focus .qnum { display: inline-flex; font-size: 1rem; padding-top: 4px; }
.layout-focus .pq-help { font-size: 1rem; margin-top: 6px; }
.layout-focus .pinput { font-size: 1.4rem; padding: 12px 2px; margin-top: 26px; }
.layout-focus .pinput-auto { font-size: 1.1rem; }
.layout-focus .choices { margin-top: 26px; }
.layout-focus .choice { min-height: 58px; }
.layout-focus .phead h1 { font-size: 2.5rem; }
.layout-focus .phead .cover { height: 170px; }
.layout-focus .phead .cover-minimal { height: 10px; }
.layout-focus .phead-body { padding: 32px 44px 38px; }
.layout-focus .psection h2, .layout-focus .pstatement h2 { font-size: 1.8rem; }
.step-actions { display: flex; align-items: center; gap: 14px; margin-top: 30px; flex-wrap: wrap; clear: both; }
.step-actions .pbtn { height: 46px; padding: 0 22px; }
.from-below { animation: stepUp .5s cubic-bezier(.2,.8,.2,1); }
.from-above { animation: stepDown .5s cubic-bezier(.2,.8,.2,1); }
@keyframes stepUp { from { opacity: 0; transform: translateY(40px); } }
@keyframes stepDown { from { opacity: 0; transform: translateY(-40px); } }
.pfinish { text-align: center; }
.finish-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 16px; border-radius: 20px; background: color-mix(in srgb, var(--tc) 12%, var(--p-surface)); color: var(--tc); }
.finish-icon .ic { width: 28px; height: 28px; }
.pfinish h2 { font-family: var(--ff); font-size: 1.9rem; letter-spacing: -.02em; margin-bottom: 8px; }
.pfinish p { color: var(--muted); margin: 0 auto 24px; max-width: 420px; }
.focusbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 16px; padding: 12px max(20px, calc(50% - 380px)); background: var(--p-bar); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.focusbar-progress { flex: 1; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 14%, var(--p-surface)); overflow: hidden; }
.focusbar-progress 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 .5s cubic-bezier(.2,.8,.2,1); }
.focusbar small { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.focusbar-nav { display: flex; gap: 6px; }
.fnav { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 12px; background: var(--tc); color: #fff; transition: filter .15s, opacity .15s; }
.fnav:hover { filter: brightness(1.08); }
.fnav:disabled { opacity: .3; cursor: default; }
.fnav:first-child .ic { transform: rotate(180deg); }
.focus-started .public-foot { display: none; }
.layout-focus .draft-note { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 30; width: max-content; max-width: calc(100vw - 32px); }

@media (max-width: 720px) {
  .public-main { padding: 16px 10px; gap: 12px; }
  .pcard { padding: 22px 18px; border-radius: 18px; }
  .phead { padding: 0; }
  .phead-body { padding: 22px 20px 24px; }
  .phead h1 { font-size: 1.65rem; }
  .cover { height: 104px; }
  .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-opts { grid-template-columns: repeat(min(var(--n), 6), minmax(0, 1fr)); }
  .scale-opt span { height: 46px; }
  .layout-focus .public-main { padding-top: 20px; justify-content: flex-start; }
  .layout-focus .pq, .layout-focus .pstatement, .layout-focus .psection, .layout-focus .pfinish { padding: 30px 22px 26px; border-radius: 22px; }
  .layout-focus .pq-label { font-size: 1.25rem; }
  .layout-focus .pinput { font-size: 1.15rem; }
  .layout-focus .phead h1 { font-size: 1.9rem; }
  .layout-focus .phead .cover { height: 120px; }
  .layout-focus .phead-body { padding: 24px 22px 28px; }
  .step-actions .kbd-hint, .start-row .kbd-hint { display: none; }
  .focusbar { padding: 10px 14px; }
}
@media (min-width: 721px) {
  .choices-many { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .tpl-row { grid-template-columns: repeat(8, 150px); }
}
@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; }
  .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(8, 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: 0 18px 18px; }
  .title-card .cover { margin: 0 -18px 18px; height: 72px; }
  .title-card .section-tab { margin-left: -18px; }
  .layouts { grid-template-columns: 1fr; }
  .covers { grid-template-columns: repeat(3, 1fr); }
  .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; }
}
@media (max-width: 420px) {
  .form-grid { grid-template-columns: 1fr; }
}
.review-correct .ic, .correct-note .ic { margin: -2px 6px 0 0; }

/* ---------- Dashboard sparklines ---------- */
.fcard-stats { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 10px; }
.fcard-count { display: flex; align-items: baseline; gap: 6px; color: var(--ink); }
.fcard-count:hover { color: var(--brand); }
.fcard-count b { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.fcard-count span { font-size: .8rem; color: var(--muted); font-weight: 500; }
.spark { width: 96px; height: 28px; overflow: visible; flex: none; }
.spark polyline { fill: none; stroke: var(--c); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark polygon { fill: color-mix(in srgb, var(--c) 14%, transparent); stroke: none; }
.fcard-meta { margin-top: 8px; }
.meta-tag { padding: 1px 8px; border-radius: 999px; background: #eef1f7; color: var(--ink-2); font-size: .72rem; font-weight: 700; }

/* ---------- Responses over time ---------- */
.trend-card { padding: 22px 24px 18px; margin-bottom: 14px; }
.trend-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.trend-head h3 { display: flex; align-items: center; gap: 8px; }
.trend-head h3 .ic { color: var(--tc); }
.trend-stats { display: flex; gap: 24px; }
.trend-stats div { display: flex; flex-direction: column; align-items: flex-end; }
.trend-stats b { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.trend-stats span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.trend { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin-bottom: 24px; }
.trend-col { position: relative; flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; cursor: default; }
.trend-col::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: #eef1f7; }
.trend-bar { position: relative; display: block; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--c), color-mix(in srgb, var(--c) 55%, #fff)); animation: rise .7s cubic-bezier(.2,.8,.2,1); transform-origin: bottom; transition: filter .15s; }
.trend-col:hover .trend-bar { filter: brightness(1.12) saturate(1.1); }
.trend-l { position: absolute; bottom: -22px; left: 0; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.trend-col:last-child .trend-l { left: auto; right: 0; }
.trend-col:nth-child(15) .trend-l { left: 50%; transform: translateX(-50%); }

/* ---------- Look & feel pickers ---------- */
.layouts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.layouts button { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1.5px solid var(--line-2); border-radius: 14px; background: #fff; text-align: left; transition: border-color .15s, box-shadow .15s; }
.layouts button:hover { border-color: var(--faint); }
.layouts button.on { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 16%, transparent); }
.layouts b { display: block; font-size: .92rem; font-weight: 650; }
.layouts small { display: block; font-size: .8rem; line-height: 1.35; color: var(--muted); margin-top: 2px; }
.layout-art { display: flex; flex-direction: column; gap: 4px; flex: none; width: 66px; height: 54px; padding: 7px; border-radius: 10px; background: color-mix(in srgb, var(--tc) 12%, #f6f7fb); }
.layout-art-classic i { display: block; height: 10px; border-radius: 3px; background: #fff; box-shadow: 0 1px 2px rgba(11,27,63,.1); }
.layout-art-focus { align-items: center; justify-content: center; }
.layout-art-focus i { display: block; width: 84%; height: 24px; border-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(11,27,63,.1); }
.layout-art-focus em { display: block; width: 40%; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--tc); }
.covers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.covers button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px; border: 1.5px solid transparent; border-radius: 14px; background: none; color: var(--ink-2); font-size: .78rem; font-weight: 600; transition: border-color .15s, background .15s; }
.covers button:hover { background: #f4f6fb; }
.covers button.on { border-color: var(--tc); background: color-mix(in srgb, var(--tc) 6%, #fff); color: var(--ink); }
.covers .cover { width: 100%; height: 56px; border-radius: 9px; }
.covers .cover-minimal { height: 56px; background: #fff linear-gradient(90deg, var(--tc), color-mix(in srgb, var(--tc) 50%, #19b5fe)) top / 100% 9px no-repeat; box-shadow: inset 0 0 0 1px var(--line); }
.draft-note.fade { opacity: 0; transform: translate(-50%, -10px); }
.mini .mini-band.cover { height: 16px; }
.mini .mini-band.cover-minimal { height: 5px; }

/* ---------- Brand lockup ---------- */
.brand-logo { --bl: 30px; display: inline-flex; align-items: center; gap: calc(var(--bl) * .34); line-height: 1; white-space: nowrap; user-select: none; }
.brand-sm { --bl: 18px; }
.brand-md { --bl: 30px; }
.brand-lg { --bl: 44px; }
.brand-mark { display: block; width: var(--bl); height: var(--bl); flex: none; filter: drop-shadow(0 2px 4px rgba(20, 53, 196, .18)); }
.brand-word { display: inline-flex; align-items: center; gap: calc(var(--bl) * .3); font-family: var(--font); font-size: calc(var(--bl) * .6); letter-spacing: -.025em; }
.brand-name { font-weight: 800; color: var(--ink); }
.brand-ai { margin-left: .18em; font-weight: 800; background: linear-gradient(120deg, #1435c4, #1f5cff 50%, #19b5fe); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sep { width: 1px; height: calc(var(--bl) * .62); background: linear-gradient(180deg, transparent, var(--line-2) 20%, var(--line-2) 80%, transparent); }
.brand-product { font-weight: 500; color: var(--ink-2); letter-spacing: -.01em; }
.brand:hover .brand-product { color: var(--ink); }
.brand-sm .brand-word { font-size: calc(var(--bl) * .68); }
.brand-sm .brand-mark { filter: none; }
.brand-sm .brand-name { color: var(--ink-2); }
.auth-brand { margin-bottom: 30px; }
@media (max-width: 720px) { .topbar .brand-md { --bl: 26px; } .topbar .brand-sep, .topbar .brand-product { display: none; } }

/* ---------- Dashboard: browse-all tile ---------- */
.tpl-all { display: flex; flex-direction: column; gap: 3px; color: #fff; text-decoration: none; }
.tpl-all:hover { color: #fff; }
.tpl-browse { background: rgba(255, 255, 255, .08); border: 1.5px dashed rgba(255, 255, 255, .28) !important; }
.tpl-browse span { display: flex; flex-direction: column; align-items: center; color: #fff; font-size: .78rem; font-weight: 600; opacity: .85; }
.tpl-browse b { font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; opacity: 1; }
.tpl-all:hover .tpl-browse { border-color: #8fd4ff !important; transform: translateY(-3px); }
.tpl-all .tpl-name { display: inline-flex; align-items: center; gap: 2px; }
.tpl-all .tpl-name .ic { width: 15px; height: 15px; }

/* ---------- Template gallery ---------- */
.gallery-hero { position: relative; overflow: hidden; color: #fff; text-align: center; background: radial-gradient(900px 380px at 50% -40%, rgba(25, 181, 254, .45), transparent 65%), radial-gradient(700px 400px at 100% 120%, rgba(139, 92, 246, .35), transparent 60%), #0b1b3f; }
.gallery-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; }
.gallery-hero-inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 48px 24px 44px; }
.gallery-hero .eyebrow { color: #8fd4ff; }
.gallery-hero h1 { font-size: 2.3rem; letter-spacing: -.03em; margin-bottom: 12px; }
.gallery-sub { color: rgba(255, 255, 255, .72); font-size: 1.02rem; max-width: 600px; margin: 0 auto 26px; }
.search-lg { width: 100%; max-width: 560px; }
.search-lg input { width: 100%; height: 52px; padding-left: 46px; border-radius: 14px; border: 0; font-size: 1rem; box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .6); }
.search-lg .ic { left: 16px; width: 20px; height: 20px; }
.gallery { max-width: 1240px; margin: 0 auto; padding: 26px 28px 96px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 26px; }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--ink-2); font-weight: 600; font-size: .88rem; transition: all .15s; }
.chip-btn span { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: #eef1f7; font-size: .72rem; color: var(--muted); }
.chip-btn:hover { border-color: var(--faint); color: var(--ink); }
.chip-btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip-btn.on span { background: rgba(255, 255, 255, .16); color: #fff; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }
.tcard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-1); transition: box-shadow .25s, transform .25s, border-color .25s; }
.tcard:hover { box-shadow: var(--shadow-3); transform: translateY(-3px); border-color: transparent; }
.tcard-art { position: relative; display: grid; place-items: center; height: 196px; overflow: hidden; background: radial-gradient(400px 200px at 20% 0%, color-mix(in srgb, var(--tc) 22%, transparent), transparent 70%), color-mix(in srgb, var(--tc) 8%, #f6f7fb); }
.tcard.is-dark .tcard-art { background: radial-gradient(400px 200px at 20% 0%, color-mix(in srgb, var(--tc) 45%, transparent), transparent 70%), #0d1220; }
.tcard-sheet { position: relative; display: flex; flex-direction: column; gap: 7px; width: 74%; padding: 0 12px 14px; transform: translateY(26px); border-radius: 10px; background: #fff; box-shadow: 0 18px 36px -16px rgba(11, 27, 63, .4); overflow: hidden; transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.tcard:hover .tcard-sheet { transform: translateY(14px); }
.tcard.is-dark .tcard-sheet { background: #171d2f; }
.tcard-sheet .cover { height: 34px; margin: 0 -12px 2px; }
.tcard-sheet .cover-minimal { height: 5px; }
.tcard-title { font-family: var(--ff); font-weight: 700; font-size: .78rem; color: var(--ink); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard.is-dark .tcard-title { color: #eef2fb; }
.tcard-q { display: flex; flex-direction: column; gap: 4px; padding: 6px 7px; border-radius: 6px; background: #f4f6fa; }
.tcard.is-dark .tcard-q { background: rgba(255, 255, 255, .05); }
.tcard-q em { font-style: normal; font-size: .58rem; font-weight: 600; color: #3b4660; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcard.is-dark .tcard-q em { color: #c5cde0; }
.tcard-q i { display: block; height: 4px; width: 70%; border-radius: 2px; background: color-mix(in srgb, var(--tc) 30%, #dfe3ec); }
.tcard-q .tcard-opts { display: flex; gap: 4px; width: auto; height: auto; background: none; }
.tcard-q .tcard-opts b { display: block; width: 34%; height: 8px; border-radius: 3px; border: 1px solid color-mix(in srgb, var(--tc) 40%, #dfe3ec); }
.tcard-q .tcard-opts b:first-child { background: color-mix(in srgb, var(--tc) 85%, #fff); border-color: transparent; }
.tcard-hover { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(11, 27, 63, .82); color: #fff; font-size: .78rem; font-weight: 600; opacity: 0; transform: translateY(-4px); transition: all .2s; }
.tcard-hover .ic { width: 14px; height: 14px; }
.tcard:hover .tcard-hover { opacity: 1; transform: none; }
.tcard-body { display: flex; flex-direction: column; flex: 1; padding: 16px 18px 18px; border-top: 1px solid var(--line); }
.tcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tcard-top h3 { font-size: 1rem; }
.tcard-body > p { color: var(--muted); font-size: .88rem; margin: 4px 0 10px; }
.tcard-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .76rem; color: var(--muted); margin-bottom: 14px; }
.tcard-theme { display: inline-flex; align-items: center; gap: 5px; }
.tcard-theme i { width: 9px; height: 9px; border-radius: 50%; }
.tcard-actions { display: flex; gap: 8px; margin-top: auto; }
.tcard-actions form { margin: 0; flex: 1; }
.tcard-actions .btn-primary { width: 100%; }
.tcard-actions .btn-ghost { border: 1px solid var(--line-2); }

/* ---------- Public: template preview bar, organisation logo ---------- */
.template-bar { position: sticky; top: 12px; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 14px 12px 18px; border-radius: 16px; background: rgba(11, 27, 63, .92); color: #fff; box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .6); backdrop-filter: blur(10px); }
.template-bar div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.template-bar b { display: inline-flex; align-items: center; gap: 8px; font-size: .95rem; }
.template-bar b .ic { color: #8fd4ff; }
.template-bar span { font-size: .8rem; color: rgba(255, 255, 255, .7); }
.template-bar form { margin: 0; flex: none; }
.pbtn-sm { height: 40px; padding: 0 18px; font-size: .9rem; border-radius: 11px; }
.flash-bar { animation: barflash .9s ease-out; }
@keyframes barflash { 30% { box-shadow: 0 0 0 4px #8fd4ff, 0 18px 40px -18px rgba(0,0,0,.6); } }
.org-logo { display: block; max-height: 52px; max-width: 220px; width: auto; margin: 0 0 18px; object-fit: contain; }
.org-logo-center { margin: 18px auto 0; position: relative; z-index: 2; }
.pdone .org-logo-center + .done-icon { margin-top: 18px; }
.title-logo { display: block; max-height: 44px; max-width: 200px; margin: 0 0 12px; object-fit: contain; }

/* ---------- Editor: theme gallery, logo, appearance ---------- */
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.theme-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 8px 10px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--card); text-align: left; transition: border-color .15s, box-shadow .15s, transform .15s; }
.theme-card:hover { border-color: var(--faint); transform: translateY(-2px); }
.theme-card.on { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 18%, transparent); }
.theme-art { position: relative; display: block; width: 100%; height: 86px; margin-bottom: 8px; border-radius: 10px; overflow: hidden; background: color-mix(in srgb, var(--tc) 9%, #f6f7fb); }
.theme-art.is-dark { background: radial-gradient(120px 60px at 20% 0%, color-mix(in srgb, var(--tc) 45%, transparent), transparent 70%), #0d1220; }
.theme-art .cover { position: absolute; left: 0; right: 0; top: 0; height: 30px; }
.theme-art .cover-minimal { height: 5px; }
.theme-sheet { position: absolute; left: 12%; right: 12%; top: 20px; bottom: -6px; display: flex; flex-direction: column; gap: 4px; padding: 8px 9px; border-radius: 7px 7px 0 0; background: #fff; box-shadow: 0 6px 16px -8px rgba(11, 27, 63, .35); }
.theme-art.is-dark .theme-sheet { background: #171d2f; }
.theme-sheet b { font-family: var(--ff); font-size: 1rem; line-height: 1; color: var(--ink); }
.theme-art.is-dark .theme-sheet b { color: #eef2fb; }
.theme-sheet i { display: block; height: 4px; width: 80%; border-radius: 2px; background: #e3e7ef; }
.theme-art.is-dark .theme-sheet i { background: rgba(255, 255, 255, .12); }
.theme-sheet i + i { width: 55%; }
.theme-sheet em { display: block; width: 36%; height: 9px; margin-top: 2px; border-radius: 3px; background: var(--tc); }
.theme-name { display: flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 650; color: var(--ink); padding: 0 2px; }
.theme-dark { padding: 1px 6px; border-radius: 999px; background: #0d1220; color: #fff; font-size: .62rem; font-weight: 700; letter-spacing: .03em; }
.theme-vibe { font-size: .75rem; color: var(--muted); padding: 0 2px; }
.logo-field { display: flex; align-items: center; gap: 16px; }
.logo-preview { display: grid; place-items: center; width: 132px; height: 72px; flex: none; border: 1.5px dashed var(--line-2); border-radius: 12px; background: #fafbfd; color: var(--faint); overflow: hidden; }
.logo-preview img { max-width: 112px; max-height: 52px; object-fit: contain; }
.logo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.logo-actions small { flex-basis: 100%; }
.seg-wide { display: inline-flex; }
.seg-wide button { padding: 0 18px; }

/* ---------- Responses: views & completion ---------- */
.resp-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dot-sep { margin: 0 4px; color: var(--faint); }
.conv { color: var(--ok); }

@media (max-width: 960px) { .themes { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) {
  .themes { grid-template-columns: repeat(2, 1fr); }
  .gallery { padding: 18px 14px 80px; }
  .gallery-hero h1 { font-size: 1.7rem; }
  .chips { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 20px; padding: 0 14px 4px; }
  .chip-btn { flex: none; }
  .template-bar { flex-direction: column; align-items: stretch; }
  .logo-field { flex-direction: column; align-items: flex-start; }
}

/* ---------- Mixed-direction text: each field follows the language typed into it ---------- */
.title-input, .desc-input, .q-label, .q-help, .opt-input, .pv-label, .pv-help, .pv-opt span, .pv-section-title, .pv-statement-title,
.tcard-title, .tcard-q em, .tcard-top h3, .tcard-body > p, .fcard-title, .mini-title-text, .mini-q em, .row-title, .formbar-title b,
.answers li, .answer-text, .pick, .bar-label, .sum-head h3, .key-question, .key-opt span, .tr-src, .tr-dst .input {
  unicode-bidi: plaintext; text-align: start;
}

/* ---------- Right-to-left public forms (Arabic) ---------- */
[dir=rtl] body.public { letter-spacing: 0; }
[dir=rtl] .phead h1, [dir=rtl] .pq-label, [dir=rtl] .psection h2, [dir=rtl] .pstatement h2, [dir=rtl] .pfinish h2 { letter-spacing: 0; line-height: 1.5; }
[dir=rtl] .pq::before { left: auto; right: -1px; border-radius: 0 var(--r) var(--r) 0; }
[dir=rtl] .psection-tab { left: auto; right: 0; border-radius: 0 0 0 12px; }
[dir=rtl] .choice { padding: 10px 12px 10px 16px; }
[dir=rtl] .qnum .ic, [dir=rtl] .pbtn .ic-chev-r, [dir=rtl] .pbtn .ic-chev-l { transform: scaleX(-1); }
[dir=rtl] .clear-choice { margin: 10px auto 0 0; }
[dir=rtl] .pselect { padding: 0 16px 0 44px; }
[dir=rtl] .pselect-wrap .ic { right: auto; left: 16px; }
[dir=rtl] .pgrid tbody th { border-radius: 0 12px 12px 0; }
[dir=rtl] .pgrid td:last-child { border-radius: 12px 0 0 12px; }
[dir=rtl] .review { border-left: 0; border-right: 5px solid var(--line-2); }
[dir=rtl] .review.is-correct { border-right-color: #12a06c; }
[dir=rtl] .review.is-wrong { border-right-color: var(--bad); }
[dir=rtl] .draft-note button { margin-left: 0; margin-right: auto; }
[dir=rtl] .counter { text-align: left; }
[dir=rtl] .pinput[type=email], [dir=rtl] .pinput[type=tel], [dir=rtl] .pinput[type=number] { direction: ltr; text-align: right; }
[dir=rtl] .kbd-hint kbd { direction: ltr; }
@media (max-width: 720px) { [dir=rtl] .pgrid td { padding: 2px 0 2px 10px; } }

/* Language switcher on public forms */
.lang-switch { position: absolute; top: 14px; inset-inline-end: 14px; z-index: 3; display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .88); box-shadow: 0 6px 18px -8px rgba(11, 27, 63, .35); backdrop-filter: blur(8px); }
[dir=rtl] .lang-switch { padding: 4px 10px 4px 4px; }
.lang-switch .ic { width: 15px; height: 15px; color: var(--tc); margin-inline-end: 4px; }
.lang-switch a { padding: 5px 12px; border-radius: 999px; color: #33415f; font-size: .82rem; font-weight: 600; text-decoration: none; }
.lang-switch a.on { background: var(--tc); color: #fff; }
.mode-dark .lang-switch { background: rgba(20, 26, 42, .85); }
.mode-dark .lang-switch a { color: #c5cde0; }

/* ---------- Account security ---------- */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; align-items: start; }
.sec-head { display: flex; align-items: flex-start; gap: 14px; }
.sec-head > div { flex: 1; }
.sec-head p { margin: 2px 0 0; }
.recovery { padding: 16px 18px; border-radius: 14px; background: #fffaf0; border: 1px solid #f1dca2; }
.recovery b { display: flex; align-items: center; gap: 8px; }
.recovery ol { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; margin: 10px 0 14px; padding-inline-start: 22px; }
.recovery code, .totp-key code { font-family: var(--mono); font-size: .92rem; font-weight: 600; letter-spacing: .04em; }
.setup-steps { margin: 0; padding-inline-start: 20px; color: var(--ink-2); font-size: .92rem; display: flex; flex-direction: column; gap: 4px; }
.totp-setup { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.totp-setup .qr { padding: 0; }
.totp-key { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: #f6f8fc; }
.otp-input { font-family: var(--mono); font-size: 1.3rem; letter-spacing: .18em; text-align: center; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-actions form { margin: 0; }
.disable-2fa { padding-top: 14px; border-top: 1px solid var(--line); }
.menu-pop .menu-nudge { color: var(--warn); }
.menu-pop .menu-nudge .ic { color: var(--warn); }

/* ---------- Audit log ---------- */
.audit-filters .select { min-width: 200px; }
.audit-table td { vertical-align: top; }
.audit-details { max-width: 420px; font-size: .86rem; overflow-wrap: anywhere; }
.audit-act { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .86rem; white-space: nowrap; }
.audit-act::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.audit-auth::before { background: #1f4fe0; }
.audit-form::before { background: #7c3aed; }
.audit-responses::before, .audit-file::before { background: #0e7490; }
.audit-user::before { background: #b45309; }
.audit-act.is-bad { color: var(--bad); }
.audit-act.is-bad::before { background: var(--bad); }
.mono { font-family: var(--mono); }
.pager-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }

/* ---------- Language settings & translation editor ---------- */
.lang-picks { display: flex; gap: 10px; flex-wrap: wrap; }
.lang-pick { position: relative; display: flex; flex-direction: column; gap: 1px; min-width: 130px; padding: 10px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.lang-pick input { position: absolute; opacity: 0; }
.lang-pick span { font-weight: 700; font-size: 1rem; }
.lang-pick small { color: var(--muted); font-size: .76rem; }
.lang-pick:has(input:checked) { border-color: var(--tc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 16%, transparent); }
.lang-pick:has(input:disabled) { cursor: default; opacity: .8; }
.lang-pick:has(input:checked)::after { content: ""; position: absolute; top: 10px; inset-inline-end: 10px; width: 16px; height: 16px; border-radius: 50%; 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 / 10px no-repeat; }
.translate-wrap { max-width: 980px; margin: 0 auto; padding: 28px 24px 96px; }
.tr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 24px; margin-bottom: 18px; border-top: 6px solid var(--tc); flex-wrap: wrap; }
.tr-head h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tr-head h2 .ic { color: var(--tc); }
.tr-head p { margin: 0; max-width: 640px; }
.tr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 0 24px 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tr-progress { display: flex; align-items: center; gap: 16px; padding: 14px 20px; margin-bottom: 14px; flex-wrap: wrap; }
.tr-progress .progress-track { flex: 1; min-width: 160px; height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 14%, #fff); overflow: hidden; }
.tr-progress .progress-track span { display: block; height: 100%; border-radius: 999px; background: var(--tc); }
.tr-card { padding: 18px 24px 8px; margin-bottom: 12px; }
.tr-card h3 { display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.tr-num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: color-mix(in srgb, var(--tc) 12%, #fff); color: var(--tc); font-size: .78rem; }
.tr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.tr-src { font-size: .94rem; color: var(--ink-2); overflow-wrap: anywhere; }
.tr-dst .input { width: 100%; font-size: .96rem; }
.tr-dst [dir=rtl] { font-family: "IBM Plex Sans Arabic", var(--font); }
.tr-sub { margin: 10px 0 0; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.tr-save { position: sticky; bottom: 16px; display: flex; justify-content: flex-end; margin-top: 18px; }
.tr-save .btn { box-shadow: var(--shadow-3); }
@media (max-width: 720px) {
  .tr-row, .tr-cols { grid-template-columns: 1fr; gap: 6px; }
  .tr-cols span:first-child { display: none; }
  .translate-wrap { padding: 16px 10px 80px; }
  .account-grid { grid-template-columns: 1fr; }
  .recovery ol { grid-template-columns: 1fr; }
}

/* =========================================================
   Data workspace (Airtable-style)
   ========================================================= */
.dchip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; height: 22px; padding: 0 9px; border-radius: 999px; border: 0; font-size: .78rem; font-weight: 600; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dchip .ic { width: 12px; height: 12px; stroke-width: 2.6; }
.dchip-blue { background: #d6e4ff; color: #12306e; }
.dchip-cyan { background: #d1f1fc; color: #0a3b52; }
.dchip-teal { background: #c9f3e8; color: #08423a; }
.dchip-green { background: #d4f5cc; color: #164b12; }
.dchip-yellow { background: #ffefbf; color: #5a3b00; }
.dchip-orange { background: #ffe1d1; color: #7a2f0f; }
.dchip-red { background: #ffdbe2; color: #7a1028; }
.dchip-pink { background: #ffdaf3; color: #6d0f53; }
.dchip-purple { background: #e9e0ff; color: #3f1d82; }
.dchip-gray { background: #eceef2; color: #3d4556; }
.dchips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.dstars { color: #f5b70f; letter-spacing: 1px; }
.dstars span { color: #dde2ec; }
.dfile { display: inline-flex; align-items: center; gap: 4px; max-width: 200px; height: 22px; padding: 0 8px; border-radius: 6px; background: #eef2fb; color: var(--brand-ink); font-size: .76rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dfile .ic { width: 12px; height: 12px; flex: none; }
.dcount { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.dcount .ic { width: 13px; height: 13px; }
.dgrid-val { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; }
.dgrid-val b { font-weight: 600; color: var(--muted); }
.dw-person { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; white-space: nowrap; }
.dw-av { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--grad); color: #fff; font-size: .68rem; font-weight: 700; }

.dw { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: calc(100vh - 124px); background: #fff; }
.env-banner ~ main .dw { height: calc(100vh - 148px); }
.dw-side { display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); background: #f8f9fb; min-height: 0; }
.dw-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 8px 16px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.dw-views { flex: 1; overflow-y: auto; padding: 0 8px; }
.dw-view-item { display: flex; align-items: center; border-radius: 8px; }
.dw-view-item:hover { background: #eef1f6; }
.dw-view-item.on { background: color-mix(in srgb, var(--tc) 12%, #fff); }
.dw-view-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 8px 8px; border: 0; background: none; text-align: start; font-size: .88rem; font-weight: 500; color: var(--ink-2); }
.dw-view-item.on .dw-view-link { color: var(--ink); font-weight: 650; }
.dw-view-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-view-more { opacity: 0; }
.dw-view-item:hover .dw-view-more, .dw-view-item.on .dw-view-more { opacity: 1; }
.vt-grid { color: #1f6feb; } .vt-kanban { color: #0e9f6e; } .vt-gallery { color: #9b51e0; } .vt-calendar { color: #e8590c; }
.dw-side-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.dw-side-foot p { margin: 0; font-size: .76rem; line-height: 1.45; }
.dw-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.dw-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.tb-view { display: inline-flex; align-items: center; gap: 8px; padding: 0 8px; font-size: .92rem; }
.tb-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line-2); }
.tb-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font-size: .84rem; font-weight: 500; white-space: nowrap; }
.tb-btn:hover { background: #f0f2f6; color: var(--ink); }
.tb-btn .ic { width: 16px; height: 16px; }
.tb-btn.is-active { background: color-mix(in srgb, var(--tc) 12%, #fff); color: var(--ink); }
.tb-btn.tb-danger { color: var(--bad); }
.tb-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--tc); color: #fff; font-size: .68rem; }
.tb-total { font-size: .8rem; padding: 0 8px; white-space: nowrap; }
.tb-search { position: relative; display: inline-flex; align-items: center; }
.tb-search .ic { position: absolute; inset-inline-start: 9px; width: 15px; height: 15px; color: var(--faint); }
.tb-search input { width: 180px; height: 32px; padding: 0 10px 0 30px; border: 1px solid var(--line-2); border-radius: 8px; font-size: .84rem; outline: none; }
[dir=rtl] .tb-search input { padding: 0 30px 0 10px; }
.tb-search input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.tb-note { flex-basis: 100%; font-size: .78rem; color: var(--warn); padding: 0 8px; }
.dw-bulk { display: flex; align-items: center; gap: 4px; padding: 6px 14px; background: color-mix(in srgb, var(--tc) 8%, #fff); border-bottom: 1px solid color-mix(in srgb, var(--tc) 20%, var(--line)); font-size: .86rem; flex-wrap: wrap; }
.dw-bulk > b { margin-inline-end: 10px; }
.dw-view { flex: 1; min-height: 0; overflow: auto; position: relative; background: #fff; }

/* Grid */
.grid-wrap { min-width: max-content; }
.dgrid { border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .84rem; }
.dgrid th, .dgrid td { border-bottom: 1px solid #e6e8ee; border-inline-end: 1px solid #eceef3; padding: 0; background: #fff; text-align: start; vertical-align: top; }
.dgrid thead th { position: sticky; top: 0; z-index: 3; height: 36px; background: #f6f7f9; font-weight: 600; color: var(--ink-2); }
.dgrid .g-num { position: sticky; inset-inline-start: 0; z-index: 2; width: 76px; text-align: center; color: var(--faint); font-size: .76rem; }
.dgrid thead .g-num { z-index: 4; vertical-align: middle; }
.dgrid .g-primary { position: sticky; inset-inline-start: 76px; z-index: 2; box-shadow: inset -1px 0 0 #dfe2e8, 6px 0 8px -6px rgba(11, 27, 63, .12); font-weight: 600; }
[dir=rtl] .dgrid .g-primary { box-shadow: inset 1px 0 0 #dfe2e8, -6px 0 8px -6px rgba(11, 27, 63, .12); }
.dgrid thead .g-primary { z-index: 4; }
.g-head { position: relative; }
.g-head-btn { display: flex; align-items: center; gap: 7px; width: 100%; height: 36px; padding: 0 10px; border: 0; background: none; font-weight: 600; font-size: .8rem; color: var(--ink-2); text-align: start; cursor: pointer; }
.g-head-btn:hover { background: #eceef2; }
.g-head-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-head-btn .ic { width: 15px; height: 15px; color: var(--muted); flex: none; }
.team-mark { flex: none; margin-inline-start: auto; padding: 1px 6px; border-radius: 5px; background: color-mix(in srgb, var(--tc) 12%, #fff); color: var(--tc); font-style: normal; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.g-resize { position: absolute; top: 0; inset-inline-end: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 5; }
.g-resize:hover, .is-resizing .g-resize { background: color-mix(in srgb, var(--tc) 40%, transparent); }
.is-resizing { cursor: col-resize; user-select: none; }
.dgrid tbody tr { cursor: pointer; }
.dgrid tbody tr:hover td { background: #f7f9fc; }
.dgrid tbody tr.is-sel td { background: color-mix(in srgb, var(--tc) 7%, #fff); }
.dgrid tbody .g-num { vertical-align: middle; }
.g-num input { display: none; width: 15px; height: 15px; margin: 0; accent-color: var(--tc); cursor: pointer; }
thead .g-num input, tr:hover .g-num input, tr.is-sel .g-num input { display: inline-block; }
tr:hover .g-n, tr.is-sel .g-n { display: none; }
.g-expand { display: none; position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: color-mix(in srgb, var(--tc) 14%, #fff); color: var(--tc); place-items: center; }
.g-expand .ic { width: 13px; height: 13px; }
tr:hover .g-expand { display: grid; }
.cell { position: relative; padding: 8px 10px; overflow: hidden; line-height: 1.45; overflow-wrap: anywhere; }
.rh-short .cell { height: 35px; white-space: nowrap; text-overflow: ellipsis; }
.rh-short .cell > span:not(.dchips):not(.dchip) { display: block; overflow: hidden; text-overflow: ellipsis; }
.rh-short .dchips, .rh-short .dgrid-val { flex-wrap: nowrap; overflow: hidden; }
.rh-medium .cell { height: 62px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rh-tall .cell { height: 106px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.g-edit { cursor: pointer; }
.g-edit:hover .cell { background: color-mix(in srgb, var(--tc) 5%, #fff); }
.g-add { color: var(--faint); font-weight: 600; opacity: 0; }
.g-edit:hover .g-add { opacity: 1; }
.g-group td { background: #f3f5f8 !important; padding: 8px 12px; font-size: .84rem; cursor: pointer; position: sticky; inset-inline-start: 0; }
.g-group td > * { vertical-align: middle; }
.g-caret { display: inline-grid; margin-inline-end: 6px; transition: transform .15s; }
.g-caret.closed { transform: rotate(-90deg); }
.g-caret .ic { width: 15px; height: 15px; }
.g-group-name { color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-inline-end: 8px; }
.g-group-count { margin-inline-start: 8px; color: var(--muted); font-weight: 600; font-size: .78rem; }
.g-more td { padding: 12px; text-align: center; background: #fafbfc; }
.dw-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 72px 20px; text-align: center; color: var(--ink-2); position: sticky; inset-inline-start: 0; width: min(100%, 100vw - 300px); }
.dw-empty .ic { width: 34px; height: 34px; color: var(--faint); margin-bottom: 6px; }

/* Kanban */
.kanban-wrap { padding: 16px; min-width: max-content; }
.kanban-note { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: .84rem; }
.kanban { display: flex; gap: 14px; align-items: flex-start; }
.kcol { width: 290px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 250px); border-radius: 14px; background: #f3f5f8; transition: box-shadow .15s, background .15s; }
.kcol.drop { background: color-mix(in srgb, var(--tc) 10%, #f3f5f8); box-shadow: inset 0 0 0 2px var(--tc); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.kcol-count { margin-inline-start: auto; color: var(--muted); font-size: .8rem; font-weight: 700; }
.kcol-body { display: flex; flex-direction: column; gap: 8px; padding: 4px 8px 10px; overflow-y: auto; min-height: 60px; }
.kcol-empty { padding: 18px; text-align: center; font-size: .82rem; border: 1.5px dashed var(--line-2); border-radius: 10px; }
.dcard { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(11, 27, 63, .08), 0 0 0 1px rgba(11, 27, 63, .04); cursor: pointer; transition: box-shadow .15s, transform .15s; }
.dcard:hover { box-shadow: 0 8px 20px -10px rgba(11, 27, 63, .35), 0 0 0 1px rgba(11, 27, 63, .06); transform: translateY(-1px); }
.dcard.dragging { opacity: .5; transform: rotate(2deg); }
.dcard[draggable=true] { cursor: grab; }
.dcard-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.dcard-title b { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.dcard-n { flex: none; color: var(--faint); font-size: .72rem; font-weight: 700; }
.dcard-fields { display: flex; flex-direction: column; gap: 6px; }
.card-field { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; min-width: 0; }
.card-field > span:not(.card-label) { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-label { font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.dcard-foot { display: flex; align-items: center; gap: 10px; font-size: .74rem; }
.dcard-foot .dw-av { margin-inline-start: auto; }

/* Gallery */
.gallery-wrap { padding: 18px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.gcard { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 1px 2px rgba(11, 27, 63, .08), 0 0 0 1px rgba(11, 27, 63, .05); cursor: pointer; transition: box-shadow .2s, transform .2s; }
.gcard:hover { box-shadow: 0 16px 32px -16px rgba(11, 27, 63, .35), 0 0 0 1px rgba(11, 27, 63, .06); transform: translateY(-2px); }
.gcover { height: 150px; background: #f1f3f7; overflow: hidden; }
.gcover img { width: 100%; height: 100%; object-fit: cover; }
.gcover-blank { display: grid; place-items: center; background: linear-gradient(135deg, hsl(var(--h) 70% 92%), hsl(calc(var(--h) + 40) 70% 85%)); }
.gcover-blank span { font-size: 2.4rem; font-weight: 800; color: hsl(var(--h) 45% 35%); }
.gbody { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.g-more-wrap { display: flex; justify-content: center; padding: 18px; }

/* Calendar */
.cal-wrap { padding: 16px 18px 24px; min-width: 760px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-title { font-size: 1.15rem; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-inline-start: 1px solid var(--line); }
.cal-dow { padding: 8px 10px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f6f7f9; border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); }
.cal-day { display: flex; flex-direction: column; gap: 4px; min-height: 112px; padding: 6px; border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); min-width: 0; }
.cal-day.is-out { background: #fafbfc; }
.cal-num { font-size: .78rem; font-weight: 600; color: var(--muted); padding: 2px 4px; }
.cal-day.is-today .cal-num { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border-radius: 50%; background: var(--tc); color: #fff; }
.cal-chip { display: block; width: 100%; padding: 3px 8px; border: 0; border-radius: 6px; font-size: .74rem; font-weight: 600; text-align: start; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-more { border: 0; background: none; color: var(--muted); font-size: .74rem; font-weight: 600; text-align: start; padding: 2px 4px; }

/* Record drawer */
.drawer-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(11, 27, 63, .28); opacity: 0; transition: opacity .2s; }
.drawer-scrim.open { opacity: 1; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 81; width: min(580px, 100vw); display: flex; flex-direction: column; background: #fff; box-shadow: -24px 0 60px -20px rgba(11, 27, 63, .4); transform: translateX(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
[dir=rtl] .drawer { transform: translateX(-100%); }
.drawer.open { transform: none !important; }
.dr-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 14px 24px; border-bottom: 1px solid var(--line); }
.dr-title { min-width: 0; }
.dr-n { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dr-title h2 { font-size: 1.25rem; margin-top: 2px; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.dr-actions { display: flex; gap: 2px; flex: none; }
.dr-actions .icon-btn:disabled { opacity: .3; }
.dr-body { flex: 1; overflow-y: auto; padding: 8px 24px 32px; }
.dr-section-title { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.dr-section-title .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.dr-section-title .ic { width: 15px; height: 15px; color: var(--tc); }
.dr-team { margin: 4px -12px 0; padding: 4px 12px 12px; border-radius: 14px; background: color-mix(in srgb, var(--tc) 5%, #fafbfd); }
.dr-field { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dr-team .dr-field { border-color: color-mix(in srgb, var(--tc) 10%, var(--line)); }
.dr-field:last-child { border-bottom: 0; }
.dr-field.stacked { grid-template-columns: 1fr; gap: 4px; }
.dr-label { padding-top: 3px; font-size: .78rem; font-weight: 600; color: var(--muted); }
.dr-value { min-width: 0; font-size: .92rem; overflow-wrap: anywhere; white-space: pre-wrap; unicode-bidi: plaintext; }
.dr-value .select { max-width: 260px; }
.dr-status { display: flex; flex-wrap: wrap; gap: 6px; }
.dr-status .dchip { height: 26px; padding: 0 11px; cursor: pointer; opacity: .55; transition: opacity .12s, box-shadow .12s; }
.dr-status .dchip:hover { opacity: .85; }
.dr-status .dchip.is-on { opacity: 1; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px currentColor; }
.dr-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag-x { display: inline-grid; place-items: center; width: 14px; height: 14px; padding: 0; border: 0; background: none; color: inherit; opacity: .6; }
.tag-x:hover { opacity: 1; }
.tag-input { width: 120px; height: 26px; padding: 0 8px; border: 1px dashed var(--line-2); border-radius: 999px; background: transparent; font-size: .78rem; outline: none; }
.tag-input:focus { border-style: solid; border-color: var(--tc); }
.dr-notes { width: 100%; font-size: .9rem; }
.dr-score { color: var(--ok); }
.dr-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.dr-comment { display: flex; gap: 10px; }
.dr-comment.fresh { animation: pop .3s ease-out; }
.dr-comment .dw-av { width: 28px; height: 28px; font-size: .74rem; }
.dr-comment-head { display: flex; gap: 8px; align-items: baseline; font-size: .82rem; }
.dr-comment p { margin: 2px 0 0; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.dr-compose { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.dr-compose textarea { width: 100%; }

/* Workspace popovers */
.dw-pop { max-height: 70vh; overflow-y: auto; }
.pop-wide { min-width: 420px; }
.pop-filter { min-width: 560px; }
.flt-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.flt-row .select, .flt-row .input { flex: 1; min-width: 0; }
.flt-lead { flex: none; width: 64px; font-size: .82rem; color: var(--muted); }
select.flt-lead { width: 64px; }
.flt-add { margin: 6px 8px 4px; }
.pop-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.hide-list { display: flex; flex-direction: column; }
.hide-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: .86rem; }
.hide-row:hover { background: #f4f6fa; }
.hide-row.dragging { opacity: .4; }
.hide-row .row-grip { margin: 0; opacity: .5; cursor: grab; }
.hide-row > .ic { width: 15px; height: 15px; color: var(--muted); }
.hide-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch-sm { width: 32px; height: 19px; }
.switch-sm > span::after { width: 13px; height: 13px; }
.switch-sm input:checked + span::after { transform: translateX(13px); }
.status-edit { display: flex; align-items: center; gap: 8px; padding: 4px 8px; }
.status-edit .input { width: 150px; }
.color-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.cdot { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 0; cursor: pointer; }
.cdot.on { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }

@media (max-width: 860px) {
  .dw { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: calc(100vh - 150px); }
  .dw-side { border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .dw-side-head, .dw-side-foot { display: none; }
  .dw-views { display: flex; gap: 4px; overflow-x: auto; padding: 8px; }
  .dw-view-item { flex: none; }
  .dw-view-more { display: none; }
  .tb-search input { width: 130px; }
  .pop-wide, .pop-filter { min-width: 0; width: calc(100vw - 24px); }
  .flt-row { flex-wrap: wrap; }
  .dr-field { grid-template-columns: 1fr; gap: 4px; }
}
