/* ============================================================
   AI Research Survey — admin "mission control"
   Deep midnight, glass panels, aurora data-viz. RTL.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

:root {
  --ink:    #090D1C;
  --ink-2:  #0F1630;
  --panel:  #131B38;
  --panel-2:#182247;
  --line:   rgba(255,255,255,.09);
  --line-2: rgba(255,255,255,.16);
  --text:   #EAEDFB;
  --muted:  #93A0C6;
  --faint:  #5D6890;

  --cyan:#22D3EE; --indigo:#6366F1; --violet:#8B5CF6; --magenta:#EC4899; --gold:#FBBF24;
  --green:#34D399; --red:#FB7185;
  --aurora: linear-gradient(115deg, #22D3EE 0%, #6366F1 36%, #8B5CF6 64%, #EC4899 100%);

  --r-sm: 12px; --r: 16px; --r-lg: 22px; --r-xl: 28px;
  --shadow: 0 24px 60px -24px rgba(0,0,0,.6);
  --font-body: 'Vazirmatn','Tahoma',system-ui,sans-serif;
  --font-display: 'Morabba','Vazirmatn','Tahoma',serif;
  --ease: cubic-bezier(.16,1,.3,1);
}

body {
  font-family: var(--font-body); color: var(--text); line-height: 1.8; font-size: 15.5px;
  background:
    radial-gradient(60% 50% at 100% 0%, rgba(99,102,241,.18), transparent 60%),
    radial-gradient(50% 40% at 0% 10%, rgba(34,211,238,.12), transparent 60%),
    var(--ink);
  min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
img, svg { display: block; max-width: 100%; }
::selection { background: rgba(139,92,246,.35); }
.grad-text { background: var(--aurora); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- buttons / chips ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.3rem; border: 0; border-radius: 100px; font-weight: 700; font-size: .95rem;
  cursor: pointer; transition: transform .3s var(--ease), box-shadow .3s, background .3s, opacity .2s; color: var(--text);
}
.btn:active { transform: translateY(1px); }
.btn-grad { color:#fff; background: var(--aurora); background-size:180% 180%; box-shadow: 0 14px 34px -14px rgba(99,102,241,.8); animation: auroraShift 8s ease infinite; }
.btn-grad:hover { transform: translateY(-2px); box-shadow: 0 22px 48px -14px rgba(139,92,246,.85); }
.btn-soft { background: rgba(255,255,255,.06); border: 1px solid var(--line-2); }
.btn-soft:hover { background: rgba(255,255,255,.12); transform: translateY(-2px); }
.btn-danger { background: rgba(251,113,133,.14); color: var(--red); border: 1px solid rgba(251,113,133,.35); }
.btn-danger:hover { background: rgba(251,113,133,.24); }
.btn-sm { padding: .5rem 1rem; font-size: .85rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .85rem; border-radius: 100px; font-size: .82rem; font-weight: 700; border: 1px solid var(--line-2); }
.chip.active { color: var(--green); background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.35); }
.chip.draft  { color: var(--gold);  background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.35); }
.chip.closed { color: var(--muted); background: rgba(255,255,255,.05); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px 1px currentColor; }

.glass { background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); backdrop-filter: blur(12px); }

/* ---------------- flashes ---------------- */
.flash-wrap { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: .6rem; width: min(420px,92vw); }
.flash { padding: .85rem 1.2rem; border-radius: var(--r); font-weight: 600; font-size: .92rem; box-shadow: var(--shadow); animation: dropIn .5s var(--ease); border: 1px solid var(--line-2); }
.flash.success { background: rgba(52,211,153,.16); color: #a7f3d0; border-color: rgba(52,211,153,.4); }
.flash.error   { background: rgba(251,113,133,.16); color: #fecdd3; border-color: rgba(251,113,133,.4); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem; position: relative; overflow: hidden; }
.login-blobs span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; }
.login-blobs .b1 { width: 420px; height: 420px; background: rgba(99,102,241,.6); top: -120px; inset-inline-end: -80px; animation: float 16s ease-in-out infinite; }
.login-blobs .b2 { width: 360px; height: 360px; background: rgba(236,72,153,.4); bottom: -120px; inset-inline-start: -60px; animation: float 18s ease-in-out infinite -6s; }
.login-card { position: relative; z-index: 2; width: min(430px, 94vw); padding: 2.6rem 2.4rem; }
.login-card .logo { width: 62px; height: 62px; border-radius: 18px; display: grid; place-items: center; background: var(--aurora); font-size: 1.8rem; color: #fff; margin: 0 auto 1.4rem; box-shadow: 0 16px 40px -12px rgba(139,92,246,.8); }
.login-card h1 { text-align: center; font-family: var(--font-display); font-size: 1.6rem; margin-bottom: .4rem; }
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 2rem; font-size: .95rem; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: .5rem; font-weight: 600; }
.inp, .txta, .sel {
  width: 100%; background: rgba(255,255,255,.04); border: 1.5px solid var(--line-2); border-radius: var(--r-sm);
  color: var(--text); padding: .85rem 1rem; font-size: 1rem; transition: border-color .2s, box-shadow .2s, background .2s;
}
.inp::placeholder, .txta::placeholder { color: var(--faint); }
.inp:focus, .txta:focus, .sel:focus { outline: none; border-color: var(--indigo); background: rgba(255,255,255,.06); box-shadow: 0 0 0 4px rgba(99,102,241,.18); }
.txta { min-height: 90px; resize: vertical; line-height: 1.9; }
.sel { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%238B5CF6' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 1rem center; padding-inline-start: 2.6rem; }
.login-card .btn { width: 100%; margin-top: .6rem; padding: .9rem; }
.login-hint { margin-top: 1.6rem; padding: .9rem 1rem; border-radius: var(--r-sm); background: rgba(255,255,255,.04); border: 1px dashed var(--line-2); font-size: .84rem; color: var(--muted); text-align: center; }
.login-hint b { color: var(--text); }

/* ============================================================
   APP SHELL (sidebar + topbar)
   ============================================================ */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; padding: 1.5rem 1.1rem; border-inline-start: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.04), transparent); display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: .3rem .4rem 1.4rem; }
.sidebar .brand .logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--aurora); color: #fff; font-size: 1.15rem; box-shadow: 0 10px 26px -8px rgba(139,92,246,.7); }
.sidebar .brand b { font-size: 1rem; }
.sidebar .brand small { display: block; color: var(--faint); font-weight: 500; font-size: .74rem; }
.nav-group { margin-top: .5rem; }
.nav-group .label { font-size: .74rem; color: var(--faint); padding: .8rem .8rem .4rem; letter-spacing: .5px; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: var(--r-sm); color: var(--muted); font-weight: 600; font-size: .93rem; transition: background .2s, color .2s, transform .2s; margin-bottom: .15rem; }
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav-item.on { background: linear-gradient(90deg, rgba(99,102,241,.22), rgba(139,92,246,.08)); color: #fff; box-shadow: inset 0 0 0 1px var(--line-2); }
.nav-item.on svg { color: var(--cyan); }
.sidebar .spacer { flex: 1; }
.side-user { display: flex; align-items: center; gap: .7rem; padding: .8rem; border-radius: var(--r); background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.side-user .av { width: 38px; height: 38px; border-radius: 50%; background: var(--aurora); display: grid; place-items: center; color: #fff; font-weight: 800; }
.side-user .who { font-size: .86rem; line-height: 1.4; overflow: hidden; }
.side-user .who b { display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.side-user .who span { color: var(--faint); font-size: .76rem; }

.main { min-width: 0; padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 3rem; }
.topbar-m { display: none; }
.page-head-a { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head-a h1 { font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.4; }
.page-head-a .crumb { color: var(--faint); font-size: .85rem; margin-bottom: .3rem; }
.page-head-a .actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* form tabs */
.tabs { display: flex; gap: .3rem; background: rgba(255,255,255,.03); padding: .35rem; border-radius: 100px; border: 1px solid var(--line); margin-bottom: 1.6rem; overflow-x: auto; }
.tabs a { padding: .55rem 1.1rem; border-radius: 100px; color: var(--muted); font-weight: 700; font-size: .9rem; white-space: nowrap; transition: .2s; }
.tabs a:hover { color: var(--text); }
.tabs a.on { background: var(--aurora); color: #fff; box-shadow: 0 10px 24px -12px rgba(139,92,246,.8); }

/* ---------------- stat cards ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat { padding: 1.4rem 1.5rem; border-radius: var(--r-lg); position: relative; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)); }
.stat::after { content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: var(--aurora); opacity: .16; filter: blur(6px); }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: rgba(255,255,255,.06); border: 1px solid var(--line-2); margin-bottom: 1rem; }
.stat .ico svg { width: 22px; height: 22px; color: var(--cyan); }
.stat .num { font-size: 2.2rem; font-weight: 800; font-family: var(--font-display); line-height: 1; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: .9rem; margin-top: .4rem; }
.stat.v2 .ico svg { color: var(--violet); } .stat.v3 .ico svg { color: var(--magenta); } .stat.v4 .ico svg { color: var(--gold); }

/* ---------------- panels ---------------- */
.panel { padding: 1.5rem 1.6rem; border-radius: var(--r-lg); border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015)); margin-bottom: 1.3rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.panel-head h2 { font-size: 1.15rem; font-family: var(--font-display); }
.panel-head .hint { color: var(--faint); font-size: .84rem; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.3rem; align-items: start; }

/* area/line chart */
.chart-area { width: 100%; height: 220px; }
.chart-area .grid line { stroke: rgba(255,255,255,.06); }
.chart-area .axislbl { fill: var(--faint); font-size: 11px; }
.spark-dot { fill: #fff; }

/* bar list (analytics) */
.bars { display: grid; gap: .85rem; }
.bar-row { display: grid; grid-template-columns: 1fr; gap: .35rem; }
.bar-row .top { display: flex; justify-content: space-between; gap: 1rem; font-size: .92rem; }
.bar-row .top .cnt { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 12px; border-radius: 100px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 100px; background: var(--aurora); background-size: 200% 100%; transform: scaleX(0); transform-origin: right center; transition: transform 1s var(--ease); }

/* scale distribution */
.scale-viz { display: flex; align-items: flex-end; gap: .6rem; height: 150px; padding-top: 1rem; }
.scale-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .5rem; height: 100%; justify-content: flex-end; }
.scale-col .col-bar { width: 100%; max-width: 54px; border-radius: 10px 10px 4px 4px; background: var(--aurora); background-size: 100% 200%; min-height: 4px; transform: scaleY(0); transform-origin: bottom; transition: transform .9s var(--ease); }
.scale-col .col-n { font-weight: 800; font-size: 1.05rem; }
.scale-col .col-c { color: var(--muted); font-size: .8rem; }
.avg-badge { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem 1rem; border-radius: 100px; background: rgba(139,92,246,.16); border: 1px solid rgba(139,92,246,.4); color: #ddd6fe; font-weight: 800; }

/* ---- scientific charts ---- */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font-body); }
.c-center { fill: #fff; font-size: 26px; font-weight: 800; }
.c-center-sub { fill: var(--muted); font-size: 11px; }
.c-big { fill: #fff; font-size: 28px; font-weight: 800; }
.c-axis { fill: var(--muted); font-size: 11px; }

.sci-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.3rem; }
.corr-card { text-align: center; display: flex; flex-direction: column; justify-content: center; }
.corr-card .corr-r { font-family: var(--font-display); font-size: 3rem; line-height: 1; background: var(--aurora); -webkit-background-clip: text; background-clip: text; color: transparent; }
.corr-card .corr-lbl { font-weight: 800; margin-top: .3rem; }
.corr-card small { color: var(--faint); display: block; margin-top: .5rem; }
.gauge-card { text-align: center; }
.gauge-card h3 { font-size: 1rem; margin-bottom: .2rem; }
.gauge-card .chart-svg { max-width: 200px; margin: .2rem auto 0; }
.gauge-card .chart-svg.ring { max-width: 180px; }

.radar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.3rem; margin-bottom: 1.3rem; }
.radar-grid .chart-svg { max-width: 360px; margin: 0 auto; }
.radar-legend { margin: .8rem .3rem 0; padding: 0; list-style: none; display: grid; gap: .4rem; color: var(--muted); font-size: .86rem; counter-reset: rl; }
.radar-legend li { display: flex; gap: .5rem; }
.radar-legend li::before { counter-increment: rl; content: counter(rl); flex: none; width: 20px; height: 20px; border-radius: 6px; background: rgba(139,92,246,.2); color: #ddd6fe; display: grid; place-items: center; font-size: .74rem; font-weight: 800; }
.radar-legend b { color: var(--text); }
.radar-legend .m { margin-inline-start: auto; color: var(--cyan); font-weight: 700; white-space: nowrap; }

.donut-row { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; }
.donut-row .chart-svg { width: 180px; flex: none; }
.donut-legend { flex: 1; min-width: 190px; display: grid; gap: .5rem; }
.donut-legend .lg { display: flex; align-items: center; gap: .6rem; font-size: .92rem; }
.donut-legend .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.donut-legend .lg .v { margin-inline-start: auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.scatter-wrap { max-width: 520px; margin: 0 auto; }
.corr-note { color: var(--muted); margin-top: .8rem; font-size: .92rem; line-height: 2; }
.corr-note b { color: var(--text); }

/* analytics question card */
.qa { padding: 1.5rem 1.6rem; border-radius: var(--r-lg); border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015)); margin-bottom: 1.1rem; }
.qa .qa-head { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1.2rem; }
.qa .qnum { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--aurora); color: #fff; display: grid; place-items: center; font-weight: 800; }
.qa .qa-title { font-size: 1.08rem; font-weight: 700; line-height: 1.6; }
.qa .qa-meta { display: flex; gap: .8rem; flex-wrap: wrap; color: var(--faint); font-size: .82rem; margin-top: .3rem; }
.qa .qa-meta .t { color: var(--cyan); }
.text-answers { display: grid; gap: .6rem; max-height: 320px; overflow-y: auto; }
.text-answers .ta { padding: .8rem 1rem; border-radius: var(--r-sm); background: rgba(255,255,255,.04); border: 1px solid var(--line); font-size: .95rem; }
.text-answers .ta time { display: block; color: var(--faint); font-size: .76rem; margin-top: .3rem; }
.empty-hint { color: var(--faint); font-size: .9rem; text-align: center; padding: 2rem; }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; min-width: 640px; }
table.data th, table.data td { padding: .95rem 1.1rem; text-align: right; border-bottom: 1px solid var(--line); font-size: .92rem; }
table.data th { color: var(--muted); font-weight: 700; background: rgba(255,255,255,.03); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .2s; }
table.data tbody tr:hover { background: rgba(255,255,255,.04); }
table.data .mono { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.row-link { color: var(--cyan); font-weight: 700; }
.pager { display: flex; gap: .5rem; justify-content: center; margin-top: 1.4rem; }
.pager a, .pager span { padding: .5rem .9rem; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: .9rem; }
.pager a:hover { color: var(--text); background: rgba(255,255,255,.05); }
.pager .cur { background: var(--aurora); color: #fff; border-color: transparent; }

/* response detail */
.resp-q { padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.resp-q:last-child { border-bottom: 0; }
.resp-q .qz { color: var(--muted); font-size: .9rem; margin-bottom: .35rem; }
.resp-q .az { font-size: 1.05rem; font-weight: 600; }
.resp-q .az.empty { color: var(--faint); font-weight: 400; }
.badge-page { display: inline-block; margin: 1.4rem 0 .6rem; padding: .3rem .9rem; border-radius: 100px; background: rgba(99,102,241,.16); color: #c7d2fe; font-size: .82rem; font-weight: 700; }

/* forms list cards */
.form-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 1.2rem; }
.fcard { padding: 1.5rem; border-radius: var(--r-lg); border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)); transition: transform .35s var(--ease), box-shadow .35s; position: relative; overflow: hidden; }
.fcard:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: var(--line-2); }
.fcard .fc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.fcard h3 { font-size: 1.12rem; line-height: 1.6; margin-bottom: 1.2rem; min-height: 3.2em; }
.fcard .fc-stats { display: flex; gap: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.fcard .fc-stats .s b { font-size: 1.3rem; font-family: var(--font-display); }
.fcard .fc-stats .s span { display: block; color: var(--faint); font-size: .8rem; }
.fcard .fc-actions { display: flex; gap: .5rem; margin-top: 1.2rem; }

/* account / admins */
.a-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.3rem; align-items: start; }
.people { display: grid; gap: .8rem; }
.person { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border-radius: var(--r); border: 1px solid var(--line); background: rgba(255,255,255,.03); }
.person .av { width: 46px; height: 46px; border-radius: 50%; background: var(--aurora); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.1rem; }
.person .info { flex: 1; }
.person .info b { font-size: 1rem; }
.person .info span { display: block; color: var(--faint); font-size: .84rem; }
.role-tag { padding: .25rem .7rem; border-radius: 100px; font-size: .76rem; font-weight: 700; }
.role-tag.super { background: rgba(251,191,36,.16); color: var(--gold); }
.role-tag.researcher { background: rgba(34,211,238,.14); color: var(--cyan); }

/* ============================================================
   BUILDER
   ============================================================ */
.builder { display: grid; grid-template-columns: 1fr 320px; gap: 1.3rem; align-items: start; }
.build-main { min-width: 0; }
.build-side { position: sticky; top: 1rem; display: grid; gap: 1rem; }
.build-meta { padding: 1.4rem; }
.build-meta .field { margin-bottom: .9rem; }
.b-page { border-radius: var(--r-lg); border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015)); margin-bottom: 1.2rem; overflow: hidden; }
.b-page .bp-head { padding: 1.1rem 1.3rem; background: rgba(255,255,255,.04); border-bottom: 1px solid var(--line); display: flex; gap: .8rem; align-items: center; }
.b-page .bp-head .pg-badge { width: 30px; height: 30px; border-radius: 9px; background: var(--aurora); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; font-size: .85rem; }
.b-page .bp-head input.pg-title { flex: 1; background: transparent; border: 0; color: var(--text); font-size: 1.05rem; font-weight: 700; padding: .3rem; border-bottom: 1.5px dashed transparent; }
.b-page .bp-head input.pg-title:focus { outline: none; border-bottom-color: var(--indigo); }
.b-page .bp-head .pg-actions { display: flex; gap: .3rem; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--muted); cursor: pointer; transition: .2s; }
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.1); }
.icon-btn.danger:hover { color: var(--red); background: rgba(251,113,133,.15); }
.b-questions { padding: 1rem 1.3rem; display: grid; gap: .9rem; }
.b-q { border: 1px solid var(--line); border-radius: var(--r); background: rgba(255,255,255,.03); padding: 1rem 1.1rem; transition: border-color .2s; }
.b-q:hover { border-color: var(--line-2); }
.b-q .bq-top { display: flex; gap: .7rem; align-items: center; margin-bottom: .7rem; }
.b-q .bq-top .drag { color: var(--faint); cursor: grab; }
.b-q input.q-title-in { flex: 1; background: rgba(255,255,255,.04); border: 1.5px solid var(--line); border-radius: var(--r-sm); color: var(--text); padding: .6rem .8rem; font-size: .98rem; font-weight: 600; }
.b-q input.q-title-in:focus { outline: none; border-color: var(--indigo); }
.b-q .q-type-sel { width: 150px; }
.b-q .q-opts { display: grid; gap: .5rem; margin: .6rem 0; padding-inline-start: 1.2rem; }
.b-q .q-opt-row { display: flex; gap: .5rem; align-items: center; }
.b-q .q-opt-row .oc { width: 16px; height: 16px; border: 2px solid var(--faint); flex: none; }
.b-q .q-opt-row.radio .oc { border-radius: 50%; } .b-q .q-opt-row.check .oc { border-radius: 4px; }
.b-q .q-opt-row input { flex: 1; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: var(--text); padding: .3rem; }
.b-q .q-opt-row input:focus { outline: none; border-bottom-color: var(--indigo); }
.b-q .q-opt-row .rm { color: var(--faint); cursor: pointer; padding: .2rem; }
.b-q .q-opt-row .rm:hover { color: var(--red); }
.b-q .add-opt { color: var(--cyan); font-size: .88rem; font-weight: 700; cursor: pointer; padding: .3rem; display: inline-flex; gap: .3rem; align-items: center; width: fit-content; }
.b-q .bq-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .7rem; border-top: 1px solid var(--line); margin-top: .7rem; }
.b-q .bq-foot .left { display: flex; gap: .5rem; }
.scale-preview { display: flex; gap: .4rem; align-items: center; color: var(--muted); font-size: .85rem; padding-inline-start: 1.2rem; }
.scale-preview .pip { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; font-size: .8rem; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .88rem; color: var(--muted); user-select: none; }
.switch input { display: none; }
.switch .track { width: 42px; height: 24px; border-radius: 100px; background: rgba(255,255,255,.12); position: relative; transition: background .25s; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-end: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.switch input:checked + .track { background: var(--indigo); }
.switch input:checked + .track::after { transform: translateX(-18px); }

.add-q-bar { display: flex; gap: .6rem; flex-wrap: wrap; padding: 1rem 1.3rem 1.3rem; }
.add-q-bar button { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: 100px; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--muted); font-weight: 700; font-size: .86rem; cursor: pointer; transition: .2s; }
.add-q-bar button:hover { color: var(--text); background: rgba(255,255,255,.1); border-color: var(--line-2); }

.save-bar { position: sticky; bottom: 1rem; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.3rem; border-radius: 100px; margin-top: 1rem; background: rgba(15,22,48,.9); border: 1px solid var(--line-2); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.save-bar .status { font-size: .88rem; color: var(--muted); }
.save-bar .status.dirty { color: var(--gold); }
.save-bar .status.saved { color: var(--green); }

/* empty state */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-state .big-ico { width: 90px; height: 90px; border-radius: 26px; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 1.5rem; font-size: 2.4rem; }
.empty-state h2 { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: .6rem; }
.empty-state p { color: var(--muted); max-width: 44ch; margin: 0 auto 1.6rem; }

/* keyframes */
@keyframes auroraShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes float { 0%,100% { transform: translate(0,0); } 50% { transform: translate(20px,-24px); } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.reveal-a { animation: fadeUp .6s var(--ease) both; }

/* ---------------- responsive ---------------- */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; right: 0; left: auto; height: 100vh;
    width: 272px; max-width: 84vw; z-index: 120; overflow-y: auto;
    transform: translateX(100%); transition: transform .32s var(--ease);
    border: 0; border-inline-start: 1px solid var(--line); background: var(--ink-2);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar-m { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
  .topbar-m .brand { display: flex; align-items: center; gap: .6rem; }
  .topbar-m .brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--aurora); display: grid; place-items: center; color: #fff; }
  .burger { width: 44px; height: 44px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); display: grid; place-items: center; cursor: pointer; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 110; opacity: 0; visibility: hidden; transition: .3s; }
  .scrim.show { opacity: 1; visibility: visible; }
  .grid-2, .a-grid, .builder { grid-template-columns: 1fr; }
  .build-side { position: static; }
}
@media (min-width: 961px) { .topbar-m { display: none; } }
@media (max-width: 640px) {
  .main { padding: 1rem .9rem 3rem; }
  .qa, .panel, .stat, .fcard, .build-meta { padding: 1.1rem; }
  .page-head-a h1 { font-size: 1.35rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: .7rem; }
  .stat { padding: 1rem; }
  .stat .num { font-size: 1.7rem; }
  .form-cards { grid-template-columns: 1fr; }
  .fcard h3 { min-height: 0; }
  /* builder: stack the question header controls */
  .b-q .bq-top { flex-wrap: wrap; }
  .b-q input.q-title-in { flex: 1 1 100%; order: 1; }
  .b-q .q-type-sel { width: 100%; order: 2; }
  .b-q .bq-top .drag { order: 0; }
  .b-questions, .bp-head, .add-q-bar { padding-inline: .9rem; }
  .save-bar { flex-wrap: wrap; gap: .6rem; border-radius: 18px; }
  .save-bar .status { flex: 1 1 100%; text-align: center; }
  /* people rows wrap */
  .person { flex-wrap: wrap; }
  .person .info { flex: 1 1 60%; min-width: 0; }
  .tabs { margin-bottom: 1.2rem; }
  .qa .qnum, .stat .ico { transform: none; }
  table.data th, table.data td { padding: .7rem .8rem; font-size: .85rem; }
}
@media (max-width: 380px) {
  .stat-grid { grid-template-columns: 1fr; }
  .scale-viz { gap: .3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
