/* ===== MaestroSurveys — shared styles (landing, admin, public form) ===== */
:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --ink: #16181d;
  --ink-2: #4b4f58;
  --muted: #80848d;
  --line: #e4e4df;
  --line-2: #d3d3cd;
  --primary: #0567c8;
  --primary-ink: #ffffff;
  --primary-soft: #e6f2fd;
  --sky: #079ef0;
  --navy: #033f97;
  --grad: linear-gradient(135deg, #079ef0 0%, #0570cd 48%, #033f97 100%);
  --bar: #0a78d6;
  --danger: #c43535;
  --danger-soft: #fdecec;
  --ok: #18794e;
  --ok-soft: #e7f5ee;
  --warn: #8a5a00;
  --warn-soft: #fdf4e1;
  --logic: #6250d6;
  --logic-soft: #efedfc;
  --skip: #b5501f;
  --skip-soft: #fcefe8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 2px 8px rgba(20, 20, 20, .04);
  --font: "IBM Plex Sans Arabic", "Inter", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121315; --surface: #1b1c1f; --surface-2: #222327; --ink: #eeeeea; --ink-2: #c3c2b7; --muted: #8f9098;
    --line: #2d2e33; --line-2: #3a3b41; --primary: #2f95ef; --primary-soft: #132a44; --bar: #3a96ea;
    --danger: #ef6b6b; --danger-soft: #3a1f1f; --ok: #4cc38a; --ok-soft: #173326; --warn: #e9b44c; --warn-soft: #3a2f17;
    --logic: #9085e9; --logic-soft: #26233f; --skip: #ec8a5a; --skip-soft: #3a261c;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; }
code { font-family: var(--mono); background: var(--surface-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }

/* ---------- form controls ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: .55rem .75rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 2.6rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
label { display: block; font-weight: 500; color: var(--ink-2); font-size: .92rem; }
label > input, label > select, label > textarea { margin-top: .3rem; font-weight: 400; color: var(--ink); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem 1rem; margin: 0; }
legend { padding: 0 .4rem; color: var(--ink-2); font-weight: 500; font-size: .92rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .5rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500; white-space: nowrap;
  text-decoration: none !important; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--grad); border-color: transparent; color: var(--primary-ink); box-shadow: 0 2px 8px rgba(5, 103, 200, .25); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); border-color: transparent; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: transparent; }
.btn-sm { padding: .3rem .7rem; font-size: .85rem; }
.btn-lg { padding: .75rem 2rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.icon-btn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink-2); display: inline-grid; place-items: center; font-size: .95rem; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }

.chip { display: inline-block; padding: .05rem .5rem; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; color: var(--ink-2); }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 6px; font-size: .75rem; font-weight: 500; background: var(--surface-2); color: var(--ink-2); }
.badge-req { background: var(--danger-soft); color: var(--danger); }
.badge-logic { background: var(--logic-soft); color: var(--logic); }
.badge-skip { background: var(--skip-soft); color: var(--skip); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.code-chip { font-family: var(--mono); font-size: .8rem; font-weight: 600; padding: .1rem .5rem; border-radius: 6px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.code-chip.sm { font-size: .72rem; padding: 0 .35rem; }

.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-err { background: var(--danger-soft); color: var(--danger); white-space: pre-line; }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.flash.errors ul { margin: .4rem 0 0; padding-inline-start: 1.2rem; white-space: normal; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.stack > * + * { margin-top: .9rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.tools-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.tools-row.between { justify-content: space-between; margin-top: 1rem; }
.narrow { max-width: 560px; }

/* ---------- admin layout ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }
.topbar { background: var(--grad); position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 12px rgba(3, 63, 151, .25); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--ink); font-size: 1.1rem; text-decoration: none !important; font-family: "Inter", var(--font); letter-spacing: -.01em; }
.brand-logo { width: 34px; height: 34px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.brand-name b { font-weight: 800; }
.topbar .brand { color: #fff; }
.topbar .brand-name b { color: #bfe6ff; }
.nav { display: flex; gap: .25rem; }
.nav a { padding: .4rem .8rem; border-radius: 8px; color: rgba(255,255,255,.85); text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.nav a.on { background: #fff; color: var(--navy); }
.main { padding-top: 1.5rem; padding-bottom: 3rem; min-height: 70vh; }
.foot { color: var(--muted); font-size: .8rem; padding-bottom: 2rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-title { margin: 0; }
.back { font-size: .88rem; color: var(--muted); display: inline-block; margin-bottom: .25rem; }
.section-title { margin: 2rem 0 1rem; }

.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem 1rem; background: radial-gradient(1200px 500px at 80% -10%, rgba(7,158,240,.25), transparent), radial-gradient(900px 500px at 0% 110%, rgba(3,63,151,.22), transparent), var(--bg); }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 2rem; width: 100%; max-width: 480px; box-shadow: 0 12px 40px rgba(3, 63, 151, .12); }
.auth-card h1 { font-size: 1.35rem; text-align: center; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 1rem; }
.auth-brand .brand { font-size: 1.35rem; }
.auth-brand .brand-logo { width: 46px; height: 46px; box-shadow: none; }
.auth-brand .brand-name b { color: var(--primary); }
.center { text-align: center; }
.big-check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 1rem; }
.pw-meter { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: .4rem !important; }
.pw-meter div { height: 100%; width: 0; background: var(--danger); transition: all .2s; }
.pw-meter div[data-s="3"] { background: var(--warn); } .pw-meter div[data-s="4"], .pw-meter div[data-s="5"] { background: var(--ok); }
.check-line { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; font-size: .88rem; }
.check-line input { margin-top: .3rem; accent-color: var(--primary); }
.grid-2.tight { gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.empty { text-align: center; padding: 3rem 1rem; }
.empty-icon { font-size: 2.6rem; margin-bottom: .5rem; }

/* survey list */
.survey-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.survey-card { display: flex; flex-direction: column; gap: .8rem; }
.survey-card-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.langs { display: flex; gap: .25rem; flex-wrap: wrap; }
.survey-title { font-size: 1.1rem; margin: 0; }
.survey-title a { color: var(--ink); }
.survey-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; background: var(--surface-2); border-radius: var(--radius-sm); padding: .6rem; text-align: center; }
.survey-meta strong { display: block; font-size: 1.1rem; }
.survey-meta span { font-size: .78rem; color: var(--muted); }
.copy-row { display: flex; gap: .4rem; }
.copy-row input { font-size: .8rem; padding: .35rem .6rem; color: var(--ink-2); }
.survey-actions { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.status { font-size: .78rem; font-weight: 600; padding: .15rem .6rem; border-radius: 99px; }
.status-draft { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.status-open { background: var(--ok-soft); color: var(--ok); }
.status-closed { background: var(--danger-soft); color: var(--danger); }
.more { position: relative; }
.more summary { list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 200px; z-index: 10; padding: .3rem; }
.more-menu form { margin: 0; }
.more-menu button, .more-menu a { display: block; width: 100%; text-align: start; background: none; border: 0; padding: .45rem .7rem; border-radius: 6px; cursor: pointer; color: var(--ink); font-size: .9rem; }
.more-menu button:hover, .more-menu a:hover { background: var(--surface-2); text-decoration: none; }
.more-menu .danger { color: var(--danger); }

.dlg { border: 0; border-radius: 16px; padding: 1.5rem; width: min(560px, 94vw); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(10, 12, 16, .45); }
.dlg-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.lang-picks { display: flex; flex-wrap: wrap; gap: .4rem; }
.pick { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 99px; font-weight: 400; cursor: pointer; font-size: .88rem; color: var(--ink); }
.pick:has(input:checked) { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.pick input { margin: 0; }
.hint { font-size: .82rem; color: var(--muted); white-space: pre-wrap; font-family: inherit; margin: 0; background: var(--surface-2); padding: .6rem .8rem; border-radius: var(--radius-sm); }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; font-size: .82rem; }
.table td.end { text-align: end; }
.table-card { padding: 0; overflow-x: auto; }
.row-form { display: flex; gap: .4rem; margin-top: 1rem; }
.pager { display: flex; gap: .25rem; flex-wrap: wrap; }
.pager a { padding: .25rem .6rem; border-radius: 6px; border: 1px solid var(--line); color: var(--ink-2); }
.pager a.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.resp-details summary { cursor: pointer; color: var(--primary); }
.resp-details dl { margin: .5rem 0 0; min-width: 320px; }
.resp-details dt { font-weight: 500; margin-top: .5rem; font-size: .85rem; color: var(--ink-2); }
.resp-details dd { margin: .1rem 0 0; }

/* ---------- builder ---------- */
.builder-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
  position: sticky; top: 58px; z-index: 15; background: var(--bg); padding: .75rem 0; border-bottom: 1px solid var(--line); }
.bt-title h1 { margin: 0; font-size: 1.35rem; }
.bt-sub { color: var(--muted); font-size: .85rem; }
.bt-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.status-select { width: auto; font-weight: 600; font-size: .88rem; padding: .45rem .6rem; }
.status-select.status-open { color: var(--ok); }
.status-select.status-closed { color: var(--danger); }
.share-bar { display: flex; align-items: center; gap: .5rem; background: var(--ok-soft); color: var(--ok); padding: .5rem .8rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.share-bar input { max-width: 460px; font-size: .85rem; padding: .3rem .6rem; }
.settings-card { padding: 0; margin-bottom: 1rem; }
.settings-head { width: 100%; display: flex; justify-content: space-between; background: none; border: 0; padding: 1rem 1.25rem; cursor: pointer; font-weight: 600; font-size: 1rem; }
.settings-body { padding: 0 1.25rem 1.25rem; display: grid; gap: 1rem; }
.field > label { margin-bottom: .3rem; }
.slug-row { display: flex; align-items: center; gap: .3rem; }
.lang-bar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; }
.segs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg { border: 0; background: none; padding: .3rem .8rem; border-radius: 7px; cursor: pointer; font-size: .88rem; color: var(--ink-2); }
.seg.on { background: var(--primary); color: #fff; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin: 1.5rem 0 .75rem; }
.list-head h2 { margin: 0; }
.qlist { display: grid; gap: .6rem; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s; }
.qcard.open { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.qcard.is-note { background: var(--surface-2); }
.qhead { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; cursor: pointer; }
.qnum { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: .8rem; color: var(--muted); flex: none; }
.qhead-text { flex: 1; min-width: 0; }
.qtitle { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qsub { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.qtools { display: flex; gap: 2px; flex: none; }
.qbody { padding: .25rem 1.25rem 1.25rem; display: grid; gap: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.qrow { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.f-code { width: 160px; } .f-type { width: 220px; } .f-num { width: 180px; }
.switch { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; padding-bottom: .55rem; color: var(--ink); }
.switch input { width: 18px; height: 18px; accent-color: var(--primary); }
.ml { display: grid; gap: .4rem; }
.ml-row { display: flex; gap: .5rem; align-items: flex-start; }
.ml-row > input, .ml-row > textarea { flex: 1; }
.lang-tag { flex: none; width: 38px; text-align: center; font-family: var(--mono); font-size: .72rem; font-weight: 600; text-transform: uppercase; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .45rem 0; color: var(--ink-2); }
.ml-compact .lang-tag { padding: .3rem 0; }
.ml-compact input { padding: .35rem .6rem; }
.sub-details summary { cursor: pointer; color: var(--primary); font-size: .88rem; margin-bottom: .4rem; }
.opt-list { display: grid; gap: .45rem; margin-bottom: .6rem; }
.opt-row { display: flex; gap: .5rem; align-items: flex-start; padding: .45rem; background: var(--surface-2); border-radius: var(--radius-sm); }
.opt-row .ml { flex: 1; }
.opt-code { width: 72px !important; flex: none; text-align: center; padding: .35rem .3rem !important; }
.opt-tools { display: flex; flex: none; }
.type-settings { display: grid; gap: .75rem; }
.logic-box { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: .8rem 1rem; display: grid; gap: .55rem; }
.logic-box.active { border-style: solid; border-color: var(--logic); background: var(--logic-soft); }
.skip-box.active { border-color: var(--skip); background: var(--skip-soft); }
.logic-head { display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.logic-box.active .logic-head strong { color: var(--logic); }
.skip-box.active .logic-head strong { color: var(--skip); }
.logic-mode { font-size: .9rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.logic-mode select { width: auto; padding: .25rem .5rem; }
.rule { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; background: var(--surface); padding: .45rem; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.rule.invalid { border-color: var(--danger); }
.rule select, .rule input { width: auto; padding: .35rem .5rem; font-size: .88rem; }
.rule-q { max-width: 300px; } .rule-val { min-width: 140px; max-width: 260px; }
.rule-lbl { font-size: .85rem; color: var(--ink-2); }
.logic-box > .btn { justify-self: start; }
.qfoot { display: flex; justify-content: flex-start; }
.add-bar { margin-top: 1rem; }
.add-title { font-weight: 600; margin-bottom: .6rem; }
.add-types { display: flex; flex-wrap: wrap; gap: .4rem; }
.type-btn { border: 1px solid var(--line-2); background: var(--surface); padding: .45rem .9rem; border-radius: 99px; cursor: pointer; font-size: .88rem; }
.type-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--bg); padding: .65rem 1.2rem; border-radius: 10px; z-index: 100; transition: all .25s; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-err { background: var(--danger); color: #fff; }

/* ---------- results ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; padding: 1rem; }
.filters label { min-width: 150px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.kpi span { display: block; color: var(--muted); font-size: .82rem; }
.kpi strong { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi strong.sm { font-size: 1rem; }
.overall { margin-bottom: .5rem; }
.timeline { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; align-items: end; height: 150px; border-bottom: 1px solid var(--line-2); }
.tl-col { height: 100%; display: flex; align-items: flex-end; cursor: default; }
.tl-col:hover .tl-bar { filter: brightness(1.15); }
.tl-bar { width: 100%; max-width: 28px; margin: 0 auto; background: var(--bar); border-radius: 4px 4px 0 0; min-height: 0; }
.tl-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: .35rem; }
.qresults { display: grid; gap: 1rem; }
.qres-head { display: flex; gap: .6rem; align-items: baseline; margin-bottom: .4rem; }
.qres-title { flex: 1; font-weight: 600; }
.type-lbl { font-size: .8rem; white-space: nowrap; }
.qres-meta { display: flex; gap: 1.25rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
.bars { display: grid; gap: .4rem; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 110px; gap: .75rem; align-items: center; font-size: .9rem; }
.bar-row.unknown .bar-label { color: var(--muted); font-style: italic; }
.bar-label { overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--bar); border-radius: 4px; min-width: 2px; }
.bar-val { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.numstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; margin-top: .75rem; }
.numstats > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: .6rem .8rem; }
.numstats span { display: block; font-size: .78rem; color: var(--muted); }
.numstats strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.samples { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .35rem; max-height: 320px; overflow-y: auto; }
.samples li { background: var(--surface-2); padding: .45rem .75rem; border-radius: var(--radius-sm); font-size: .9rem; }
.top-terms { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.top-terms b { color: var(--primary); }
.inline-fields { display: flex; gap: .75rem; flex-wrap: wrap; }
.inline-fields label { flex: 1; min-width: 130px; }

/* ---------- public form ---------- */
body.public { background: linear-gradient(180deg, var(--primary-soft) 0, var(--bg) 320px) no-repeat, var(--bg); }
.preview-bar { background: var(--warn-soft); color: var(--warn); text-align: center; padding: .5rem; font-weight: 500; font-size: .9rem; }
.form-wrap { max-width: 760px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.form-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 4px 24px rgba(20, 30, 60, .06); overflow: hidden; }
.form-card.center { text-align: center; padding: 3rem 2rem; }
.form-head { padding: 2rem 2rem 1.25rem; border-top: 6px solid var(--primary); }
.form-head h1 { font-size: 1.7rem; margin: 0 0 .5rem; }
.form-desc { color: var(--ink-2); }
.lang-switch { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 1rem; }
.lang-switch button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: .25rem .8rem; cursor: pointer; font-size: .85rem; color: var(--ink-2); }
.lang-switch button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.progress { display: flex; align-items: center; gap: .75rem; padding: 0 2rem 1rem; font-size: .8rem; color: var(--muted); position: sticky; top: 0; background: var(--surface); z-index: 5; padding-top: .6rem; }
.progress-track { flex: 1; height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--grad); border-radius: 99px; transition: width .3s; }
.qs { padding: 0 2rem 2rem; }
.q { padding: 1.25rem 0; border-top: 1px solid var(--line); animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.q-label { font-weight: 600; font-size: 1.05rem; display: flex; gap: .4rem; align-items: baseline; }
.q-num { color: var(--muted); font-weight: 500; flex: none; }
.req { color: var(--danger); }
.q-help { color: var(--muted); font-size: .9rem; margin-top: .2rem; }
.q-input { margin-top: .75rem; }
.q-note .note-text { background: var(--primary-soft); padding: 1rem 1.2rem; border-radius: var(--radius-sm); color: var(--ink); }
.q.q-note { border-top: 0; }
.q-error { color: var(--danger); font-size: .88rem; margin-top: .4rem; min-height: 0; }
.q.has-error .q-label { color: var(--danger); }
.q.has-error input, .q.has-error select, .q.has-error textarea { border-color: var(--danger); }
.choices { display: grid; gap: .45rem; }
.choice { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; font-weight: 400; color: var(--ink); transition: all .12s; position: relative; }
.choice:hover { border-color: var(--primary); background: var(--primary-soft); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-box { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; transition: all .12s; }
.choice-box.square { border-radius: 5px; }
.choice input:checked ~ .choice-box { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); }
.choice input:checked ~ .choice-box.square { box-shadow: none; }
.choice input:checked ~ .choice-box.square::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 700; line-height: 1; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice input:focus-visible ~ .choice-box { box-shadow: 0 0 0 3px var(--primary-soft); }
.scale-row { display: flex; gap: .4rem; flex-wrap: wrap; }
.scale-btn { min-width: 46px; height: 46px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 1rem; flex: 1; max-width: 70px; transition: all .12s; }
.scale-btn:hover { border-color: var(--primary); }
.scale-btn.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.scale-labels { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-top: .35rem; }
.err-summary { color: var(--danger); font-weight: 500; text-align: center; min-height: 1.2em; margin-top: 1rem; }
.form-actions { display: flex; justify-content: center; padding-top: 1rem; }
.hp { position: absolute !important; inset-inline-start: 0; top: 0; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; opacity: 0; overflow: hidden; clip-path: inset(50%); pointer-events: none; }
.thanks .check { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 2rem; margin: 0 auto 1rem; }
.thanks-msg { font-size: 1.1rem; color: var(--ink-2); }

@media (max-width: 640px) {
  .form-head, .qs { padding-left: 1.1rem; padding-right: 1.1rem; }
  .progress { padding-left: 1.1rem; padding-right: 1.1rem; }
  .bar-row { grid-template-columns: 1fr 90px; }
  .bar-row .bar-label { grid-column: 1 / -1; }
  .f-code, .f-type { width: 100%; }
  .builder-top { position: static; }
  .qtools .icon-btn { width: 26px; }
  .opt-row { flex-wrap: wrap; }
  .nav a { padding: .4rem .5rem; }
}

/* ---------- v2: users admin ---------- */
.grid-side { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .grid-side { grid-template-columns: 1fr; } }
a.kpi { color: inherit; text-decoration: none; transition: border-color .15s; }
a.kpi:hover { border-color: var(--primary); }
.kpi.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.kpi-alert strong { color: var(--warn); }
.table-tools { display: flex; gap: .5rem; padding: .9rem; border-bottom: 1px solid var(--line); }
.row-actions { display: inline-flex; gap: .35rem; align-items: center; }
.row-actions form { margin: 0; }
.inline-pw { display: flex; gap: .3rem; padding: .3rem .4rem; }
.inline-pw input { padding: .3rem .5rem; font-size: .85rem; }
.inline-pw button { width: auto !important; background: var(--primary-soft) !important; color: var(--primary) !important; }
.u-name { font-weight: 600; }
.status-u-active { background: var(--ok-soft); color: var(--ok); }
.status-u-pending { background: var(--warn-soft); color: var(--warn); }
.status-u-suspended { background: var(--danger-soft); color: var(--danger); }
.radio-card { display: flex; gap: .6rem; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .8rem; cursor: pointer; font-weight: 400; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card input { margin-top: .3rem; accent-color: var(--primary); }
.radio-card b { display: block; color: var(--ink); }
.radio-card small { color: var(--muted); }
.plain-list { padding-inline-start: 1.1rem; margin: .5rem 0 0; }
.plain-list li + li { margin-top: .3rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
.owner { margin-inline-end: auto; padding-inline-start: .5rem; }
.segs a.seg { text-decoration: none; display: inline-block; }

/* ---------- v2: option flags (builder) ---------- */
.opt-main { flex: 1; display: grid; gap: .35rem; min-width: 0; }
.opt-flags { display: flex; gap: .9rem; flex-wrap: wrap; }
.mini-check { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; font-weight: 400; color: var(--ink-2); cursor: pointer; }
.mini-check input { accent-color: var(--primary); margin: 0; }
.opt-row.is-excl { border-inline-start: 3px solid var(--skip); }
.opt-row.has-text { border-inline-start: 3px solid var(--logic); }

/* ---------- v2: option text / select-all / exclusive (public form) ---------- */
.choice-wrap { display: grid; gap: .35rem; }
.choice-wrap.excl { margin-top: .35rem; padding-top: .55rem; border-top: 1px dashed var(--line-2); }
.choice-extra { display: none; margin-inline-start: 2.4rem; width: calc(100% - 2.4rem) !important; padding: .5rem .75rem !important; font-size: .95rem; }
.choice-extra.show { display: block; animation: fadein .2s ease; }
.dd-wrap { display: grid; gap: .5rem; }
.dd-wrap .choice-extra { margin-inline-start: 0; width: 100% !important; }
.choice.select-all { background: var(--surface-2); border-style: dashed; font-weight: 600; }
.opt-texts { margin-top: 1rem; }
.opt-texts-head { font-size: .88rem; font-weight: 500; color: var(--ink-2); margin-bottom: .3rem; }

/* ---------- v2: public form branding ---------- */
.form-head { border-top: 0; position: relative; }
.form-head::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--grad); }
.form-brand { display: flex; justify-content: center; padding: 1.5rem 0 0; }
.form-brand .brand { font-size: .85rem; color: var(--muted); }
.form-brand .brand-logo { width: 22px; height: 22px; box-shadow: none; }

/* ---------- v2: landing page ---------- */
.landing { background: var(--bg); }
.l-nav { position: absolute; inset: 0 0 auto 0; z-index: 5; }
.l-nav-in { display: flex; justify-content: space-between; align-items: center; height: 72px; }
.l-nav .brand { color: #fff; font-size: 1.2rem; }
.l-nav .brand-name b { color: #bfe6ff; }
.l-nav .brand-logo { width: 40px; height: 40px; }
.l-links { display: flex; gap: .5rem; align-items: center; }
.l-links a { color: rgba(255,255,255,.9); padding: .45rem .9rem; border-radius: 8px; font-weight: 500; text-decoration: none; }
.l-links a:hover { background: rgba(255,255,255,.14); }
.l-links .btn-white { background: #fff; color: var(--navy); }
.l-links .btn-white:hover { background: #eaf6ff; }
.hero { background: var(--grad); color: #fff; padding: 140px 0 120px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 760px; height: 760px; border-radius: 50%; border: 2px solid rgba(255,255,255,.14); inset-inline-start: -220px; top: -180px; }
.hero::before { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 2px solid rgba(255,255,255,.1); inset-inline-end: -140px; bottom: -260px; }
.hero-in { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; position: relative; z-index: 2; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.25; margin: 0 0 1rem; font-weight: 700; }
.hero h1 span { color: #bfe6ff; }
.hero p.lead { font-size: 1.15rem; opacity: .92; max-width: 560px; margin: 0 0 2rem; }
.hero-cta { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn-white { background: #fff; color: var(--navy); border-color: #fff; font-weight: 600; }
.btn-white:hover { background: #eaf6ff; border-color: #eaf6ff; }
.btn-outline-white { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); }
.btn-outline-white:hover { background: rgba(255,255,255,.12); border-color: #fff; }
.hero-art { display: flex; justify-content: center; }
.mock { background: #fff; color: var(--ink); border-radius: 18px; padding: 1.25rem; width: 100%; max-width: 380px; box-shadow: 0 30px 60px rgba(1, 30, 80, .35); transform: rotate(-2deg); }
.mock-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.mock-langs span { font-size: .72rem; padding: .15rem .55rem; border-radius: 99px; border: 1px solid #d3d3cd; margin-inline-start: .2rem; }
.mock-langs span.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.mock-q { font-weight: 600; font-size: .95rem; margin-bottom: .5rem; }
.mock-opt { border: 1px solid #e4e4df; border-radius: 9px; padding: .45rem .7rem; margin-bottom: .35rem; font-size: .85rem; display: flex; gap: .5rem; align-items: center; }
.mock-opt.on { border-color: var(--primary); background: #e6f2fd; }
.mock-opt i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #c3c3bd; flex: none; }
.mock-opt.on i { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 2px #fff; }
.mock-extra { margin: -.1rem 0 .35rem 0; margin-inline-start: 1.6rem; border: 1px solid var(--primary); border-radius: 7px; padding: .3rem .6rem; font-size: .78rem; color: #80848d; }
.mock-logic { margin-top: .8rem; font-size: .75rem; background: #efedfc; color: #6250d6; border-radius: 8px; padding: .4rem .6rem; }
.mock-bars { margin-top: .8rem; display: grid; gap: .3rem; }
.mock-bars div { height: 8px; border-radius: 4px; background: var(--grad); }
.section { padding: 80px 0; }
.section h2.s-title { text-align: center; font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: .5rem; }
.section p.s-sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 3rem; font-size: 1.05rem; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.1rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem; transition: transform .2s, box-shadow .2s, border-color .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(3, 63, 151, .1); border-color: #b9dcf8; }
.f-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 1.35rem; margin-bottom: .9rem; }
.feature h3 { font-size: 1.08rem; margin-bottom: .35rem; }
.feature p { color: var(--ink-2); margin: 0; font-size: .95rem; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; counter-reset: st; }
.step { position: relative; padding: 1.5rem; padding-top: 2.6rem; background: var(--surface); border-radius: 16px; border: 1px solid var(--line); }
.step::before { counter-increment: st; content: counter(st); position: absolute; top: -18px; inset-inline-start: 1.5rem; width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; box-shadow: 0 6px 16px rgba(5,103,200,.3); }
.step h3 { margin-bottom: .3rem; }
.step p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cta-band { background: var(--grad); color: #fff; border-radius: 22px; padding: 3rem 2rem; text-align: center; position: relative; overflow: hidden; }
.cta-band h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
.cta-band p { opacity: .9; margin: 0 0 1.5rem; }
.l-foot { padding: 2rem 0 3rem; color: var(--muted); font-size: .88rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; align-items: center; }
.l-foot .brand { color: var(--ink); font-size: .95rem; }
.l-foot .brand-logo { width: 26px; height: 26px; box-shadow: none; }
.l-foot .brand-name b { color: var(--primary); }
@media (max-width: 860px) {
  .hero-in { grid-template-columns: 1fr; }
  .hero { padding: 110px 0 70px; }
  .hero-art { display: none; }
  .l-links a:not(.btn-white) { display: none; }
}

/* ---------- v2: print / PDF of results ---------- */
.print-head { display: none; }
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f5f8; --ink: #111; --ink-2: #333; --muted: #666; --line: #dde1e6; --line-2: #c9ced5; --bar: #0a78d6; --primary: #0567c8; --primary-soft: #e6f2fd; }
  @page { size: A4; margin: 14mm 12mm; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: #fff !important; font-size: 12px; }
  .topbar, .foot, .filters, .no-print, .page-head .tools-row, .back, .toast { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .main { padding: 0; }
  .print-head { display: flex !important; justify-content: space-between; align-items: center; border-bottom: 3px solid transparent; border-image: var(--grad) 1; padding-bottom: 8px; margin-bottom: 14px; }
  .print-head .brand { color: #111; font-size: 14px; }
  .print-head .brand-logo { width: 28px; height: 28px; box-shadow: none; }
  .print-head .brand-name b { color: var(--primary); }
  .print-meta { text-align: end; font-size: 11px; color: #555; }
  .card, .kpi { box-shadow: none !important; border-color: #dde1e6; break-inside: avoid; page-break-inside: avoid; }
  .qres { break-inside: avoid; }
  .samples { max-height: none !important; overflow: visible !important; }
  .kpis { grid-template-columns: repeat(5, 1fr); }
  .kpi strong { font-size: 1.3rem; }
  .grid-2.overall { grid-template-columns: 1fr 1fr; }
  .section-title { margin: 1rem 0 .6rem; break-after: avoid; }
  a { color: inherit; text-decoration: none; }
  .page-title { font-size: 1.4rem; }
}
