/* Layout and palette from the v2 prototype. */
:root{
  --navy:#0b2b5c; --navy-d:#071f47; --navy-l:#12386f; --cyan:#3bc9f2;
  --bg:#f4f7fb; --ink:#1a1d21; --muted:#6b7480; --line:#e3e8ee; --card:#fff;
  --green:#0a7a52; --amber:#8a7413; --orange:#a8410f;
}
*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%}
body{font-family:'Rubik',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  background:var(--bg);color:var(--ink);line-height:1.5;font-size:15px;overflow:hidden}
/* the login screen is its own full-height page and scrolls normally */
body:has(#login:not(.hidden)){overflow:auto}
button{font-family:inherit;cursor:pointer}
.hidden{display:none!important}
.muted{color:var(--muted);font-size:13px}

/* ── login ─────────────────────────────────────────── */
.login-wrap{min-height:100vh;height:100vh;overflow-y:auto;display:flex;align-items:center;
  justify-content:center;background:var(--navy-d);padding:24px}
.login-card{background:#fff;padding:40px;border-radius:16px;width:390px;box-shadow:0 18px 50px rgba(0,0,0,.3)}
.login-logo{border-radius:11px;display:block;margin-bottom:14px}
.login-card .eyebrow{color:#1d5fa8;font-size:11px;font-weight:600;letter-spacing:.09em;text-transform:uppercase}
.login-card h1{font-size:23px;color:var(--navy);margin:4px 0 22px}
.field{margin-bottom:16px}
.field label{display:block;font-size:12.5px;font-weight:500;margin-bottom:6px;color:var(--muted)}
.field input{width:100%;padding:11px 13px;border:1px solid var(--line);border-radius:9px;font-size:14px}
.field input:focus{outline:none;border-color:var(--cyan);box-shadow:0 0 0 3px rgba(59,201,242,.16)}
.btn-primary{width:100%;padding:12px;background:var(--navy);color:#fff;border:none;border-radius:9px;font-size:14px;font-weight:600}
.btn-primary:hover{background:var(--navy-l)}
.btn-primary:disabled{opacity:.6;cursor:not-allowed}
.error{background:#fdeceb;color:var(--orange);padding:10px 13px;border-radius:8px;font-size:13px;margin-bottom:16px}

/* ── shell ─────────────────────────────────────────── */
/* height, not min-height. With min-height the shell grows to fit its content
   and the whole PAGE scrolls; the inner panes never get a scrollbar. */
.shell{display:flex;height:100vh;overflow:hidden}
.sidebar{width:264px;background:var(--navy-d);color:#a9bdd8;flex-shrink:0;
  display:flex;flex-direction:column;overflow-y:auto;min-height:0}
/* 20px above the mark sat it against the top edge of the sidebar. Matched to
   the landing page's nav so the two read as the same product. */
/* The mark alone, centred. The product name lives in the page heading, and
   repeating it here said the same thing twice on one screen. */
.logo{display:flex;justify-content:center;align-items:center;padding:clamp(22px,2vw,28px) 22px 22px;
  border-bottom:1px solid rgba(255,255,255,.08)}
/* It is an <a> now, so it needs to stop looking like body copy and start
   looking like something you can click. */
.logo{text-decoration:none;color:inherit;transition:background .2s}
.logo:hover{background:rgba(59,201,242,.06)}
.logo:hover .logo-mark{transform:scale(1.03)}
.logo-mark{transition:transform .25s cubic-bezier(.34,1.4,.64,1)}
.logo:focus-visible{outline:2px solid var(--cyan);outline-offset:-2px}
/* A 1246x412 wordmark, sized by HEIGHT so its own 3:1 aspect sets the width.
   Stretching it to the sidebar width made it the loudest thing on the page —
   it is a nameplate, not a banner. 40px is the nav-mark size. */
.logo-mark{height:40px;width:auto;display:block}
/* the hero's mark is the same wordmark, larger; sized by height so its
   own 3:1 aspect sets the width rather than being cropped square */
/* The mark sits to the RIGHT of the copy, not above it, so the hero reads as
   one band rather than three stacked things. Sized by width; flex-shrink:0
   keeps the copy doing the compressing when the window narrows. */
.hero-row{display:flex;align-items:flex-start;justify-content:space-between;gap:34px}
.hero-copy{min-width:0}
.hero-mark{width:148px;height:auto;display:block;flex-shrink:0;align-self:flex-start}
/* Below this the copy would be squeezed to a column, so stack instead. */
@media(max-width:900px){.hero-row{flex-direction:column;align-items:flex-start;gap:20px}
  .hero-mark{width:132px;order:-1}}
.side-label{font-size:10.5px;letter-spacing:.13em;text-transform:uppercase;color:#6d86a8;padding:20px 22px 9px}
.nav-item{display:flex;align-items:center;gap:11px;padding:11px 22px;border:none;background:none;
  color:#a9bdd8;width:100%;text-align:left;font-size:14.5px;font-weight:500}
.nav-item:hover{background:rgba(255,255,255,.05);color:#fff}
.nav-item.active{background:var(--navy-l);color:#fff;box-shadow:inset 3px 0 0 var(--cyan)}
.nav-item .ic{width:17px;text-align:center;opacity:.9}

.qnr-panel{margin:18px;padding:16px;background:rgba(255,255,255,.045);border-radius:12px}
.qnr-panel h4{font-size:13.5px;color:#fff;font-weight:500;margin-bottom:12px;display:flex;align-items:center;gap:8px}
.drop{border:1.5px dashed #40608c;border-radius:10px;padding:26px 12px;text-align:center;transition:.15s;cursor:pointer}
.drop:hover,.drop.over{border-color:var(--cyan);background:rgba(59,201,242,.07)}
.drop .up{font-size:21px;color:var(--cyan);line-height:1}
.drop b{display:block;color:#fff;font-size:13.5px;font-weight:500;margin-top:9px}
.drop small{color:#7e97b8;font-size:11.5px}
/* Two states in one zone: prompt until a file is accepted, then the file.
   The loaded state is a compact row — icon beside the text, left aligned —
   because the centred prompt layout gives a document a full-width icon and
   turns a filled slot into the largest object on the screen. */
.drop .drop-file{display:none}
.drop.loaded .drop-empty{display:none}
/* Centred, not top-aligned: the filename runs to two lines and the icon was
   pinned to the first, so it sat high against its own block. */
.drop.loaded .drop-file{display:flex;gap:11px;align-items:center;text-align:left}
.drop.loaded{border-style:solid;border-color:var(--cyan);
  background:rgba(59,201,242,.07);padding:12px}
/* The mark sits in a tile, the way every other icon in this app does, so a
   loaded slot reads as a component rather than a glyph beside some text. */
.fi-tile{width:34px;height:34px;flex:0 0 34px;border-radius:9px;display:grid;
  place-items:center;background:rgba(59,201,242,.14);
  box-shadow:inset 0 0 0 1px rgba(59,201,242,.28)}
/* An <svg> with no explicit size fills its container. */
.drop .fi{width:17px;height:17px;color:var(--cyan);display:block}
/* min-width:0 lets the flex child shrink so the clamp can bite; without it a
   long unbroken filename widens the sidebar instead of wrapping. */
.drop-meta{flex:1;min-width:0}
/* margin:0 matters — .drop b above sets margin-top:9px for the EMPTY state,
   and inherited into the loaded row it pushed the name off the icon's centre. */
.drop-file b{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
  overflow:hidden;overflow-wrap:anywhere;font-size:12.5px;font-weight:500;
  color:#fff;margin:0;line-height:1.3}
.drop-file small{display:block;color:#7e97b8;font-size:11px;margin-top:3px}
.mode-box{margin-top:13px;font-size:12.5px;color:#a9bdd8}
.mode-box label{display:flex;gap:8px;align-items:flex-start;margin-top:7px;cursor:pointer}
.sidebar-foot{margin-top:auto;padding:15px 22px;border-top:1px solid rgba(255,255,255,.08);font-size:12px}
.sidebar-foot button{background:none;border:none;color:#7e97b8;font-size:12.5px;padding:0;text-decoration:underline}

/* ── top bar ───────────────────────────────────────── */
.topbar{background:#fff;border-bottom:1px solid var(--line);padding:11px 26px;
  display:flex;gap:6px;align-items:center}
.topbar-right{margin-left:auto;display:flex;gap:8px;align-items:center}
.ver{font-size:11.5px;font-weight:600;letter-spacing:.03em;padding:5px 11px;border-radius:99px;
  background:var(--navy);color:#fff}
.ver-model{background:#eaf5ff;color:#1d5fa8;font-weight:500}
/* The model changed under an open page. Amber, not red — nothing is broken,
   but any estimate already on screen came from the previous model. */
.ver-model.changed{background:#fff4e0;color:#8a6a12;
  animation:verPulse 1.6s cubic-bezier(.34,1.4,.64,1) 3}
@keyframes verPulse{0%,100%{transform:scale(1)}30%{transform:scale(1.07)}}
@media(prefers-reduced-motion:reduce){.ver-model.changed{animation:none}}
.portal{padding:9px 22px;border-radius:99px;border:none;background:none;font-size:14.5px;font-weight:600;color:#5a6672}
.portal.on{background:var(--navy);color:#fff}
/* min-height:0 is load-bearing. A flex item defaults to min-height:auto, which
   refuses to shrink below its content — so the overflow never triggers and the
   scrollbar lands on <body> instead of here. */
.main{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden}
.topbar{flex-shrink:0}
.content{padding:26px;flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  scroll-behavior:smooth}

/* ── hero ──────────────────────────────────────────── */
.hero{background:linear-gradient(135deg,var(--navy) 0%,#0e3268 55%,var(--navy-l) 100%);
  color:#fff;border-radius:14px;padding:38px 42px;margin-bottom:22px}
.brand-row img{border-radius:10px;display:block}
.hero .eyebrow{color:var(--cyan);font-size:12px;font-weight:600;letter-spacing:.1em;text-transform:uppercase}
.hero h1{font-size:38px;font-weight:600;margin:8px 0 14px;letter-spacing:-.01em}
.hero p{font-size:15.5px;opacity:.92;max-width:770px}
.hero p b{font-weight:600}

/* ── pipeline ──────────────────────────────────────── */
.panel{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:24px;margin-bottom:18px}
.panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}
.panel-head h3{font-size:17px;color:var(--navy);font-weight:600}
.pill{background:#eaf5ff;color:#1d5fa8;font-size:12px;font-weight:600;padding:6px 13px;border-radius:99px}
.pipe{display:flex;align-items:flex-start;justify-content:space-between;gap:4px}
.step{text-align:center;flex:1;min-width:0}
.step .box{width:52px;height:52px;border-radius:13px;background:#f2f6fb;display:flex;align-items:center;
  justify-content:center;margin:0 auto 9px;font-size:20px;position:relative;
  transition:transform .35s ease, box-shadow .35s ease}
.step.warm .box{background:#fdf4e0}
.step.done .box{background:#e6f6ec}
.step b{font-size:13px;font-weight:500;display:block}
.step.done b{color:var(--green)}

/* Flowing dashes. A repeating gradient scrolled by exactly one tile keeps the
   loop seamless — animating a border-dash would jump on repeat. */
.dash{flex:0 0 auto;margin-top:26px;width:6%;height:2px;border:0;border-radius:2px;
  background-image:repeating-linear-gradient(90deg,#7fb5e4 0 7px,transparent 7px 15px);
  background-size:15px 2px;
  animation:dashflow .7s linear infinite}
@keyframes dashflow{to{background-position:15px 0}}

/* Each stage lights up in turn, so the eye follows the pipeline end to end.
   5 stages x 0.9s = a 4.5s cycle; delays are staggered to match. */
.step .box{animation:stagepulse 4.5s ease-in-out infinite}
.pipe > .step:nth-child(1) .box{animation-delay:0s}
.pipe > .step:nth-child(3) .box{animation-delay:.9s}
.pipe > .step:nth-child(5) .box{animation-delay:1.8s}
.pipe > .step:nth-child(7) .box{animation-delay:2.7s}
.pipe > .step:nth-child(9) .box{animation-delay:3.6s}
@keyframes stagepulse{
  0%,14%,100%{transform:scale(1);box-shadow:0 0 0 0 rgba(59,201,242,0)}
  5%{transform:scale(1.11);box-shadow:0 0 0 7px rgba(59,201,242,.16)}
  9%{transform:scale(1.04);box-shadow:0 0 0 12px rgba(59,201,242,0)}
}
.dash{animation-delay:inherit}

/* Motion here is decorative; honour the OS setting rather than override it. */
@media(prefers-reduced-motion:reduce){
  .dash{animation:none}
  .step .box{animation:none}
}

/* ── feature cards ─────────────────────────────────── */
.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:18px}
.fcard{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:22px}
.fcard .ic{width:44px;height:44px;border-radius:11px;background:#f2f6fb;display:flex;align-items:center;
  justify-content:center;font-size:19px;margin-bottom:14px}
.fcard h4{font-size:15.5px;color:var(--navy);margin-bottom:7px;font-weight:600}
.fcard p{font-size:13.5px;color:#5a6672}
.cta{background:#eaf3fc;border-radius:12px;padding:17px 24px;display:flex;align-items:center;
  justify-content:space-between;gap:16px}
.cta span{font-size:14.5px}
.cta b{font-weight:600}
.btn-dark{background:var(--navy);color:#fff;border:none;padding:12px 26px;border-radius:99px;font-size:14px;font-weight:600}
.btn-dark:hover{background:var(--navy-l)}
.foot{text-align:center;color:#94a0ac;font-size:12.5px;padding:22px 0 4px}
.foot i{font-family:Georgia,serif;color:#6b7480}

/* ── results ───────────────────────────────────────── */
.page-head{margin-bottom:18px}
.page-head h2{font-size:22px;color:var(--navy)}
/* Equal-height cards. The empty white under the shorter one was not the
   stretch itself — it was that its content did not grow to use the height.
   Both cards are now columns whose list fills the space: the section bars
   spread out and get thicker, the question list scrolls inside. */
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:stretch}
.grid2 > .sub-card{display:flex;flex-direction:column;min-height:0}
#sections{flex:1;min-height:0;overflow-y:auto}
.bar-row{display:flex;align-items:center;gap:10px;margin-bottom:9px;font-size:13.5px}
.bar-row .lbl{width:150px;color:var(--muted);flex-shrink:0}
.bar-row .track{flex:1;height:22px;background:#eef2f6;border-radius:5px;overflow:hidden}
.bar-row .fill{height:100%;background:linear-gradient(90deg,var(--navy),#1c5194);border-radius:5px;
  width:0;transition:width 1s cubic-bezier(.22,1,.36,1)}
.bar-row .val,.score .v{font-variant-numeric:tabular-nums}
@media(prefers-reduced-motion:reduce){.bar-row .fill{transition:none}}
.bar-row .val{width:76px;text-align:right;font-weight:500;flex-shrink:0}
table{width:100%;border-collapse:collapse;font-size:13.5px}
th{text-align:left;color:var(--muted);font-weight:500;font-size:12px;padding:9px 8px;border-bottom:1px solid var(--line)}
td{padding:10px 8px;border-bottom:1px solid #f2f5f8}
tbody tr:hover{background:#fafbfc;cursor:pointer}
.notice{background:#fff8e6;border:1px solid #f0dfae;color:#7a5f12;padding:12px 16px;border-radius:10px;font-size:13.5px;margin-bottom:16px}
.spinner{width:34px;height:34px;border:3px solid var(--line);border-top-color:var(--navy);border-radius:50%;
  animation:spin .8s linear infinite;margin:0 auto 14px}
@keyframes spin{to{transform:rotate(360deg)}}
@media(max-width:1100px){.cards{grid-template-columns:1fr}.grid2{grid-template-columns:1fr}
  .sidebar{width:228px}.hero h1{font-size:29px}.pipe{flex-wrap:wrap;gap:14px}.dash{display:none}}


/* ── scrollbars ────────────────────────────────────── */
.content::-webkit-scrollbar,.sidebar::-webkit-scrollbar{width:10px}
.content::-webkit-scrollbar-track{background:transparent}
.content::-webkit-scrollbar-thumb{background:#c8d4e2;border-radius:6px;
  border:3px solid var(--bg);background-clip:padding-box}
.content::-webkit-scrollbar-thumb:hover{background:#a8b9cc;background-clip:padding-box}
.sidebar::-webkit-scrollbar-track{background:transparent}
.sidebar::-webkit-scrollbar-thumb{background:rgba(255,255,255,.16);border-radius:6px;
  border:3px solid var(--navy-d);background-clip:padding-box}
.sidebar::-webkit-scrollbar-thumb:hover{background:rgba(255,255,255,.28);background-clip:padding-box}
.content{scrollbar-width:thin;scrollbar-color:#c8d4e2 transparent}
.sidebar{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.2) transparent}

/* On a short viewport the sidebar panel must not squash the nav. */
@media(max-height:760px){
  .qnr-panel{margin:12px}
  .drop{padding:18px 10px}
  .side-label{padding:13px 22px 6px}
}


/* ── model registry charts ─────────────────────────── */
:root{--c-model:#2563eb;--c-base:#f59e0b;--c-track:#eef2f7}
.mv{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:24px;margin-bottom:18px}

.tiles{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:24px}
.tile{background:#f8fafc;border:1px solid var(--line);border-radius:11px;padding:15px}
.tile .t-k{font-size:11.5px;color:var(--muted);text-transform:uppercase;letter-spacing:.05em}
.tile .t-v{font-size:26px;font-weight:600;color:var(--navy);margin-top:5px;font-variant-numeric:tabular-nums}
.tile .t-u{font-size:13px;font-weight:400;color:var(--muted);margin-left:3px}
.tile .t-n{font-size:11.5px;color:var(--muted);margin-top:3px}

.chart{margin-bottom:22px}
.chart h4{font-size:13.5px;color:var(--navy);font-weight:600;margin-bottom:3px}
.chart .cap{font-size:12px;color:var(--muted);margin-bottom:13px}
.legend{display:flex;gap:16px;font-size:12.5px;color:var(--muted);margin-bottom:12px}
.legend span{display:flex;align-items:center;gap:6px}
.legend i{width:11px;height:11px;border-radius:3px;display:block}
@media(prefers-reduced-motion:reduce){.cbar .fl{transition:none}}
@media(max-width:900px){.tiles{grid-template-columns:repeat(2,1fr)}.cbar .k{width:120px}}

/* ── version comparison ─────────────────────────────────────────────────
   Shown on the result page when the same questionnaire has been uploaded
   before. Colour carries direction, but the sign and the word "min" carry
   it too — never colour alone. */

/* ── icons ──────────────────────────────────────────────────────────────
   Inline SVG sprite (see the <symbol> block in index.html). Everything is
   stroked in `currentColor`, so an icon takes the colour of whatever text
   it sits beside and needs no per-context override. */
.sprite{position:absolute;width:0;height:0;overflow:hidden}
/* Default size for EVERY icon. Without this an .ic in a context I have not
   written a rule for falls back to the SVG default of 300x150 and renders
   enormous — which is exactly what happened in the percentiles heading.
   Per-context rules below override; nothing has to. */
svg.ic{width:16px;height:16px;flex:0 0 auto;vertical-align:-3px}
svg use,.sprite symbol{fill:none;stroke:currentColor;stroke-width:1.75;
  stroke-linecap:round;stroke-linejoin:round}

/* Sizes per context. The glyphs these replaced were sized by font-size,
   which is why they never lined up across the three places they appeared. */
.nav-item .ic{width:17px;height:17px;flex:0 0 17px;opacity:.9}
.qnr-panel h4 .ic{width:15px;height:15px;color:var(--cyan)}
.drop .up{width:24px;height:24px;color:var(--cyan)}
.step .box svg{width:24px;height:24px;color:#2f4c74}
.step.warm .box svg{color:#8a6a12}
.step.done .box svg{color:#15693c}
.fcard .ic svg{width:22px;height:22px;color:var(--navy,#0b2b5c)}

/* Micro-animations. Each one is tied to an interaction or to a step that is
   genuinely working — nothing loops just to look busy. All of it is switched
   off under prefers-reduced-motion at the bottom of this block. */
.nav-item .ic,.fcard .ic svg,.drop .up{transition:transform .25s cubic-bezier(.34,1.4,.64,1)}

/* Draw-on strokes: dashed at rest, closed up on hover. */
.nav-item .ic .dash-a,.nav-item .ic .dash-b,
.fcard .ic .dash-a,.fcard .ic .dash-b{
  stroke-dasharray:12;stroke-dashoffset:12;transition:stroke-dashoffset .3s ease}
.nav-item:hover .ic .dash-a,.nav-item.active .ic .dash-a,
.fcard:hover .ic .dash-a{stroke-dashoffset:0}
.nav-item:hover .ic .dash-b,.nav-item.active .ic .dash-b,
.fcard:hover .ic .dash-b{stroke-dashoffset:0;transition-delay:.07s}

.nav-item:hover .ic{transform:translateX(2px)}
.nav-item.active .ic{opacity:1}
/* The history icon's arc rotates back — the direction the metaphor implies. */
.nav-item:hover .ic .spin-p{transform-origin:12px 12px;animation:rot-back .6s ease}
@keyframes rot-back{from{transform:rotate(40deg)}to{transform:rotate(0)}}

.fcard:hover .ic svg{transform:scale(1.12)}
.fcard:hover .ic .glow{animation:bulb 1.1s ease-in-out infinite}
@keyframes bulb{0%,100%{opacity:1}50%{opacity:.45}}

/* Drop zone: the arrow lifts, which is the gesture being asked for. */
.drop:hover .up,.drop.over .up{transform:translateY(-3px)}
.drop:hover .up .lift,.drop.over .up .lift{animation:lift 1s ease-in-out infinite}
@keyframes lift{0%,100%{transform:translateY(0)}50%{transform:translateY(-2px)}}

/* The cog in the pipeline turns continuously and slowly — it is the one step
   that depicts ongoing work, and it reads as alive rather than decorative. */
.step .box .spin-p{transform-origin:12px 10.4px;animation:cog 9s linear infinite}
@keyframes cog{to{transform:rotate(360deg)}}
/* The API step's chevron nudges forward, matching the flow direction. */
.step.done .box .lift{animation:nudge 2.4s ease-in-out infinite}
@keyframes nudge{0%,100%{transform:translateX(0)}50%{transform:translateX(2px)}}

@media (prefers-reduced-motion: reduce){
  .nav-item .ic,.fcard .ic svg,.drop .up{transition:none}
  .step .box .spin-p,.step.done .box .lift,.drop .up .lift,
  .fcard .ic .glow,.nav-item .ic .spin-p{animation:none}
  .nav-item .ic .dash-a,.nav-item .ic .dash-b,
  .fcard .ic .dash-a,.fcard .ic .dash-b{stroke-dashoffset:0}
}

/* ── question-wise duration ─────────────────────────────────────────────
   Geometry copied from the v2 prototype: 34px number / flexible track /
   48px value, a 12px bar, cyan-to-navy left-anchored gradient. */
.qnote{font-size:12.5px;margin:0 0 16px}
.qbars{display:flex;flex-direction:column;gap:7px;flex:1;min-height:0;
  overflow-y:auto;padding-right:6px}
.qrow{display:grid;grid-template-columns:48px 1fr 44px;align-items:center;gap:10px}
.qnum{font-size:11px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  color:#7b8188;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.qtrack{height:14px;background:#eef2f6;border-radius:5px;overflow:hidden}
.qfill{height:14px;background:linear-gradient(90deg,#3bc9f2,#002658);border-radius:5px;
  transform-origin:left;animation:loi-growX .85s ease both}
.qsec{font-size:11.5px;color:#7b8188;text-align:right;font-variant-numeric:tabular-nums}
@keyframes loi-growX{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@media (prefers-reduced-motion: reduce){
  .qfill{animation:none}
}

/* ── questionnaire builder ──────────────────────────────────────────────
   The v2 prototype's detection screen, colour-for-colour. */
.builder{padding:26px 28px}
.bld-head{display:flex;align-items:center;gap:13px;margin-bottom:20px;flex-wrap:wrap}
.bld-no{width:30px;height:30px;border-radius:99px;background:var(--navy);color:#fff;
  display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:700;flex:0 0 30px}
.bld-head h3{font-size:17px;color:var(--navy);margin:0;flex:1}
.bld-total{display:flex;align-items:center;gap:9px;background:#eaf3fc;border-radius:99px;
  padding:9px 19px;font-size:13.5px;color:#5a6672}
.bld-total .ic{width:16px;height:16px;color:#5a6672}
.bld-total b{color:var(--navy);font-size:16px;font-variant-numeric:tabular-nums}

/* The panel is a fixed-height column: header, a scrolling list, and the
   detecting card pinned at the bottom. The list auto-scrolls as each
   question lands, so the card the eye is following never moves.
   
   min-height:100% was not enough to bound it. The panel carries an 18px
   bottom margin and .page-head another 18, so the section came out taller
   than the pane, the pane scrolled, and the "pinned" card went below the
   fold anyway. Percentage heights against a flex parent are fragile here;
   .busy makes the pane a bounded flex column instead, applied only while
   the builder is on screen so no other page is affected. */
.content.busy{display:flex;flex-direction:column;overflow:hidden}
.content.busy > #page-loading:not(.hidden){flex:1;min-height:0;margin:0}
.content.busy .builder{margin-bottom:0}
#page-loading:not(.hidden){display:flex;flex-direction:column;min-height:0}
#page-loading .builder{flex:1;display:flex;flex-direction:column;min-height:0}
.bld-rows{display:flex;flex-direction:column;gap:9px;flex:1;min-height:0;
  overflow-y:auto;padding-right:6px;scroll-behavior:smooth}
.bld-rows::-webkit-scrollbar{width:8px}
.bld-rows::-webkit-scrollbar-thumb{background:#cfd8e3;border-radius:5px}
.bld-rows::-webkit-scrollbar-track{background:transparent}
/* flex:0 0 auto keeps the detect card its natural height at the foot of the
   panel instead of being squeezed by the list above it. */
.bld-detect{flex:0 0 auto}
/* position + z-index are load-bearing, not decoration.
   `animation: ... both` makes every row a STACKING CONTEXT, which traps its
   tooltip inside the row no matter how high the tooltip's own z-index goes —
   the next row's context simply paints later and covers it. Lifting the
   hovered row above its siblings is the only thing that works. */
.bld-row{position:relative;z-index:1;
  border:1px solid #eef1f4;border-radius:11px;background:#fff;
  animation:loi-in .42s cubic-bezier(.2,.8,.2,1) both}
.bld-row:hover,.bld-row:focus-within{z-index:20}
/* Five columns for five cells. There were six: the spare `auto` belonged to
   the +Ns chip, and after that was removed it kept an empty column open,
   which is the gap that appeared before the chevron. */
.bld-line{display:grid;grid-template-columns:44px 1fr auto 22px 52px 42px 26px 20px;align-items:center;
  gap:12px;padding:13px 17px;cursor:pointer}
/* Rows settle in rather than snapping: they rise, fade and relax out of a
   slight scale, which reads as the row being placed rather than appearing. */
@keyframes loi-in{
  from{opacity:0;transform:translateY(10px) scale(.985)}
  to{opacity:1;transform:none}}

.bld-row .q{font-size:12px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:#9aa4ad;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bld-row .t{font-size:14px;color:#1a1d21;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bld-row .sec{font-size:14px;font-weight:700;color:var(--navy);text-align:right;
  font-variant-numeric:tabular-nums}
.chip{font-size:12px;font-weight:700;border-radius:99px;padding:5px 13px;white-space:nowrap}
.chip.single{background:#eaf3fc;color:#0b2b5c}
.chip.multi{background:#e4f6fd;color:#0a5f7a}
.chip.grid{background:#fdf4e0;color:#8a6a12}
.chip.open{background:#fdece6;color:#b4530a}
.chip.rank{background:#e5f8ee;color:#0a7a52}
.chip.scale{background:#eef0fb;color:#3a3f8a}
.chip.num{background:#f1f3f5;color:#4a5560}

/* The card for the question being read right now. */
.bld-detect{transition:opacity .25s ease;border:1.5px solid var(--cyan);border-radius:11px;padding:16px 18px;
  background:#f5fcff;margin-top:9px;animation:loi-in .3s ease both}
.bld-detect-head{display:flex;align-items:center;gap:12px;font-size:13px;font-weight:600;
  color:var(--navy)}
.bld-detect-head b{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.ring{width:22px;height:22px;border:2.5px solid #cfeaf6;border-top-color:var(--cyan);
  border-radius:99px;flex:0 0 22px;animation:loi-spin .7s linear infinite}
@keyframes loi-spin{to{transform:rotate(360deg)}}
.bld-steps{list-style:none;display:flex;flex-direction:column;gap:9px;margin:14px 0 0;
  padding-left:34px}
.bld-steps li{display:flex;align-items:center;gap:10px;font-size:12.5px;font-weight:500;
  color:#9aa4ad;transition:color .2s ease}
.bld-steps li .dot{transition:border-color .2s ease,background .2s ease}
.bld-steps li .dot{width:16px;height:16px;border-radius:99px;border:2px solid #d3dbe3;
  flex:0 0 16px;box-sizing:border-box}
.bld-steps li.now{color:var(--navy)}
.bld-steps li.now .dot{border-color:#cfeaf6;border-top-color:var(--navy);
  animation:loi-spin .7s linear infinite}
.bld-steps li.done{color:var(--green,#0a7a52)}
.bld-steps li.done .dot{border-color:var(--green,#0a7a52);background:var(--green,#0a7a52);
  position:relative}
.bld-steps li.done .dot::after{content:'';position:absolute;left:4.4px;top:1.4px;
  width:4px;height:8px;border:solid #fff;border-width:0 2.2px 2.2px 0;transform:rotate(45deg)}

@media (prefers-reduced-motion: reduce){
  .bld-row,.bld-detect{animation:none}
  .ring,.bld-steps li.now .dot{animation:none}
}
@media(max-width:820px){
  .bld-line{grid-template-columns:38px 1fr auto auto;row-gap:7px}
  .bld-row .chip{grid-column:2}
  .bld-row .sec{grid-column:3}
  .bld-row .chev{display:none}
}

/* ── prediction & analytics (v2 section 3) ──────────────────────────────
   Dark header bar, hero LOI beside the percentiles, three score cards,
   section- and question-wise duration side by side, recommendations. */
.pa{padding:0;overflow:hidden}
.pa-head{display:flex;align-items:center;gap:12px;padding:18px 22px;
  background:linear-gradient(150deg,#002658,#0a4074)}
.pa-no{width:26px;height:26px;border-radius:99px;background:rgba(59,201,242,.2);
  color:var(--cyan);font-size:12px;font-weight:700;display:flex;align-items:center;
  justify-content:center;flex:0 0 26px}
.pa-title{flex:1;min-width:0}
.pa-title h3{font-size:16px;color:#fff;margin:0}
.pa-file{font-size:12px;color:#7fa3cc;margin-top:3px}
.pa-sub{font-size:12px;color:#9db3cf;margin-top:2px}
.pa-sub strong{color:var(--cyan)}
.pa-export{display:flex;align-items:center;gap:7px;padding:9px 16px;border-radius:999px;
  border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.08);color:#fff;
  font-weight:600;font-size:13px;cursor:pointer;font-family:inherit;transition:background .15s}
.pa-export:hover{background:rgba(255,255,255,.16)}
.pa-export .ic{width:15px;height:15px}
.pa-body{padding:24px 26px;display:flex;flex-direction:column;gap:16px}

.pa-top{display:grid;grid-template-columns:1fr 1.5fr;gap:16px}
.loi-card{background:linear-gradient(150deg,#002658,#0a4074);border-radius:12px;padding:24px;
  color:#fff;text-align:center;display:flex;flex-direction:column;justify-content:center}
.loi-eyebrow{font-size:11px;color:#9db3cf;letter-spacing:.08em;text-transform:uppercase}
.loi-big{font-size:52px;font-weight:700;line-height:1;margin:12px 0 10px;
  animation:loi-pop .6s ease both;font-variant-numeric:tabular-nums}
.loi-big small{font-size:19px;color:#9db3cf;font-weight:700;margin-left:2px}
@keyframes loi-pop{0%{opacity:0;transform:scale(.8)}60%{transform:scale(1.06)}100%{opacity:1;transform:scale(1)}}
.loi-pill{display:inline-flex;align-self:center;align-items:center;font-size:12.5px;
  color:#002658;font-weight:600;background:var(--cyan);padding:5px 14px;border-radius:999px}

.pct-card{background:#f7fafc;border:1px solid #eef1f4;border-radius:12px;padding:20px 22px}
.pct-card h4{font-size:14px;color:var(--navy);margin:0 0 3px}
.pct-card p{font-size:12px;margin:0 0 14px}
/* One column per band the model publishes -- four, five, however many. A
   fixed repeat(4,1fr) wrapped the fifth onto a second row. */
.pcts{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;gap:12px;align-items:end}
.pct{text-align:center;display:flex;flex-direction:column;gap:8px}
.pct .v{font-size:22px;font-weight:700;color:var(--navy);font-variant-numeric:tabular-nums}
.pct .col{height:120px;display:flex;align-items:flex-end;justify-content:center}
.pct .bar{width:70%;background:linear-gradient(180deg,#3bc9f2,#002658);border-radius:6px 6px 0 0;
  transform-origin:bottom;animation:loi-growY .8s cubic-bezier(.2,.8,.2,1) both}
@keyframes loi-growY{from{transform:scaleY(0)}to{transform:scaleY(1)}}
.pct .k{font-size:11.5px;font-weight:700;color:#5a6672;letter-spacing:.04em}

.score-row{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
/* display:block is deliberate. An earlier .score rule set display:flex, which
   laid the label, the figure and the TRACK out in a row — the track has no
   width of its own, so it collapsed to nothing and the coloured bar simply
   was not there. Stating the display here means a stray flex cannot do it
   again. */
.score{display:block;background:#fff;border:1px solid #e2e5e8;border-radius:12px;padding:18px}
.score .n{font-size:12.5px;color:#7b8188;font-weight:600;margin-bottom:10px}
.score .row{display:flex;align-items:baseline;gap:7px}
.score .v{font-size:28px;font-weight:700;font-variant-numeric:tabular-nums}
.score .muted{font-size:12px}
.score .track{height:8px;background:#eef2f6;border-radius:99px;margin-top:12px;overflow:hidden}
.score .fill{height:8px;border-radius:99px;transform-origin:left;
  animation:loi-growX .9s cubic-bezier(.2,.8,.2,1) both}
.score .v.good,.score .fill.good{color:var(--green,#0a7a52)}
.score .fill.good{background:#70c7ad}
.score .v.warn,.score .fill.warn{color:#8a7413}
.score .fill.warn{background:#ffbc00}
.score .v.bad,.score .fill.bad{color:#f05523}
.score .fill.bad{background:#f05523}

.sub-card{background:#fff;border:1px solid #e2e5e8;border-radius:14px;padding:22px 24px}
.sub-card h4{font-size:15px;color:var(--navy);margin:0 0 4px}
.sub-card > p.muted{font-size:12px;margin:0 0 16px}
.sec-row:last-child{margin-bottom:0}

.rec-card{background:#f7fafc;border-color:#d5e2f2}
.rec-head{display:flex;align-items:center;gap:9px;margin-bottom:14px}
.rec-ic{width:28px;height:28px;border-radius:8px;flex:0 0 28px;color:#fff;
  background:linear-gradient(135deg,#3bc9f2,#0a86c9);display:flex;align-items:center;
  justify-content:center}
.rec-ic .ic{width:16px;height:16px}
.rec-head h4{flex:1;margin:0}
.rec-total{font-size:11.5px;font-weight:700;color:#8a6a12;background:#fdf4e0;
  padding:5px 12px;border-radius:999px;white-space:nowrap}
.rec{display:flex;align-items:center;gap:13px;padding:12px 15px;background:#fff;
  border:1px solid #eef1f4;border-radius:10px;margin-bottom:9px;
  animation:loi-fadeUp .5s ease both}
@keyframes loi-fadeUp{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.rec:last-child{margin-bottom:0}
.rec .rq{font-size:11px;font-weight:700;color:var(--navy);width:30px;flex:0 0 30px;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.rec .rt{flex:1;min-width:0}
.rec .rt .h{font-size:12.5px;color:#161a1f;font-weight:600;white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis}
.rec .rt .s{font-size:12px;color:#7b8188;margin-top:2px}
.rec .rs{font-size:11.5px;font-weight:700;color:var(--green,#0a7a52);
  background:rgba(112,199,173,.2);padding:5px 11px;border-radius:999px;white-space:nowrap}

@media(max-width:900px){
  .pa-top,.score-row{grid-template-columns:1fr}
}
@media (prefers-reduced-motion: reduce){
  .loi-big,.pct .bar,.score .fill,.sec-row .fill,.rec{animation:none}
}

/* Question count beside the section name — small, recessive, so the name and
   the minutes stay the two things you read. */

/* ── icons in the rest of the flow ──────────────────────────────────────
   Every icon inherits currentColor, so these rules only set size and the
   space beside the text. */
.sub-card h4,.pct-card h4{display:flex;align-items:center;gap:9px}
/* margin-left:auto pushes the control to the right edge of the same row as
   the heading, so it reads as part of that box rather than a stray field. */
.qorder{margin-left:auto;font:inherit;font-size:12px;font-weight:400;color:var(--navy);
  background:#f7fafc;border:1px solid #d5e2f2;border-radius:7px;padding:4px 8px;
  cursor:pointer;transition:border-color .15s,background .15s}
.qorder:hover{border-color:var(--cyan);background:#fff}
.qorder:focus-visible{outline:2px solid var(--cyan);outline-offset:1px}
.sub-card h4 .ic,.pct-card h4 .ic{color:var(--cyan)}
.cta-ic{width:15px;height:15px;vertical-align:-2px;margin-right:2px}

/* Warning and comparison banners: icon in its own column so the text wraps
   against the text, not under the icon. */
.notice{display:flex;align-items:flex-start;gap:11px}
.notice .ic{width:18px;height:18px;flex:0 0 18px;color:#8a6a12;margin-top:1px}

/* Sign-in spinner — the button loses its label while posting, so give it
   something that reads as work rather than an empty pill. */
.btn-spin{width:14px;height:14px;border:2px solid rgba(255,255,255,.35);
  border-top-color:#fff;border-radius:99px;display:inline-block;
  animation:loi-spin .7s linear infinite;vertical-align:-2px;margin-right:7px}
@media (prefers-reduced-motion: reduce){ .btn-spin{animation:none} }

/* ── section-wise duration ──────────────────────────────────────────────
   The prototype's layout exactly: name and minutes on one line, a full-width
   bar beneath. No header row and no question column — they pushed the bar
   into a narrow cell and buried the one thing the panel is for. */
.sec-row{margin-bottom:16px}
.sec-row:last-child{margin-bottom:0}
.sec-top{display:flex;justify-content:space-between;align-items:baseline;gap:12px;
  font-size:14px;color:#1a1d21;margin-bottom:7px}
.sec-top b{color:#5a6672;font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap}
.sec-row .track{height:9px;background:#eef2f6;border-radius:99px;overflow:hidden}
.sec-row .fill{height:9px;border-radius:99px;transform-origin:left;
  animation:loi-growX .85s ease both}
/* A section this questionnaire does not contain: still listed, so a zero is
   visibly a zero rather than a missing row. */
.sec-row.empty .sec-top{color:#9aa4ad}
.sec-row.empty .sec-top b{color:#b3bcc6}
@media (prefers-reduced-motion: reduce){ .sec-row .fill{animation:none} }

/* Both cards get a real inner scroller and a matching height, so a long
   question list cannot stretch the card next to it. */
.grid2 > .sub-card{max-height:460px}
#sections,.qbars{scrollbar-width:thin}
#sections::-webkit-scrollbar,.qbars::-webkit-scrollbar{width:8px}
#sections::-webkit-scrollbar-thumb,.qbars::-webkit-scrollbar-thumb{
  background:#cfd8e3;border-radius:5px}
#sections::-webkit-scrollbar-track,.qbars::-webkit-scrollbar-track{background:transparent}


/* ── question drawer ────────────────────────────────────────────────────
   Each row opens to show how it compares with the rest of the survey and
   what, if anything, is worth changing. Collapsed by default — a 41-row
   list with every drawer open is unreadable. */
.chev{background:none;border:none;padding:0;cursor:pointer;color:#b3bcc6;
  display:flex;align-items:center;justify-content:center}
.chev .ic{width:14px;height:14px;transition:transform .25s ease}
.bld-row.open .chev .ic{transform:rotate(90deg)}
.bld-row.open{border-color:#d5e2f2}

/* grid-template-rows 0fr -> 1fr animates to the content's own height without
   a hard-coded max-height that would clip a long suggestion.
   
   The content MUST be a single child. 0fr defines one row: with several
   children only the first collapsed and every one after it got an implicit
   auto row and stayed visible — the drawer looked permanently open with its
   first line missing. .d-inner is that single child. */
.bld-drawer{display:grid;grid-template-rows:0fr;background:#fbfdff;
  border-radius:0 0 10px 10px;transition:grid-template-rows .28s ease}
.bld-row.open .bld-drawer{grid-template-rows:1fr}
.d-inner{overflow:hidden;min-height:0;padding:0 17px}
.bld-row.open .d-inner{padding:4px 17px 15px}

/* Prototype's exact geometry and colours (its source, not eyeballed):
     row      150px / 1fr / 60px, 10px bar, track #e6eaef
     standard #9db3cf, label #161a1f 600, value #4a5057 600
     audience estBar = d > 0 ? '#f05523' : '#002658', value #002658 700
   The audience bar is conditional there too — it goes orange only when the
   audience ADDS time. Navy at neutral is the prototype's own behaviour, not
   a difference; v2 simply preloads a mobile, 35–44 sample so it is orange
   from the start. */
/* The audience row's value carries more weight than the standard row's,
   because it is the number that actually applies. */

.d-ok{display:flex;align-items:center;gap:8px;font-size:12.5px;
  color:var(--green,#0a7a52);margin-top:11px}
.d-ok .ic{width:15px;height:15px;flex:0 0 15px}
.d-sug{display:flex;align-items:flex-start;gap:11px;margin-top:11px;padding:12px 14px;
  background:#fff;border:1px solid #f2e0a8;border-radius:9px}
.d-sug .ic{width:16px;height:16px;flex:0 0 16px;color:#c9971a;margin-top:1px}
.d-sug > div{flex:1;min-width:0}
.d-sug b{display:block;font-size:12.5px;color:#1a1d21;margin-bottom:2px}
.d-sug span{font-size:12.5px;color:#7b8188}
.d-save{font-size:11.5px;font-weight:700;color:var(--green,#0a7a52);
  background:rgba(112,199,173,.2);padding:5px 11px;border-radius:999px;white-space:nowrap}

@media (prefers-reduced-motion: reduce){
  .bld-drawer{transition:none}
  .chev .ic{transition:none}
}

/* ── audience demographics (section 2) ──────────────────────────────────*/
.demo-head{display:flex;align-items:center;gap:13px;margin-bottom:18px;flex-wrap:wrap}
.demo-head h3{font-size:17px;color:var(--navy);margin:0;flex:1}
.demo-head .muted{font-size:12.5px}
/* Three controls now that Digital literacy is gone. Equal columns fill
   the panel; below 720px they stack rather than crush. */
.demo-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
@media (max-width:720px){.demo-grid{grid-template-columns:1fr}}
.demo-grid label{display:flex;flex-direction:column;gap:8px;font-size:12px;
  color:#7b8188;font-weight:600;letter-spacing:.02em;text-transform:uppercase}

/* The native select is styled differently by every OS — a flat grey box on
   one, a rounded pill on another — so it never matched the panels around it.
   appearance:none strips the platform control and .sel supplies the chevron,
   which keeps all three identical everywhere and lets them use the same
   focus ring as the rest of the app. */
.sel{position:relative;display:block}
.demo-grid select{appearance:none;-webkit-appearance:none;width:100%;
  font-family:inherit;font-size:14px;font-weight:500;color:#1a1d21;
  padding:12px 40px 12px 14px;border:1px solid #d9e1ea;border-radius:10px;
  background:#fff;cursor:pointer;transition:border-color .15s,box-shadow .15s}
.demo-grid select:hover{border-color:#b9c8d8}
.demo-grid select:focus{outline:none;border-color:var(--cyan);
  box-shadow:0 0 0 3px rgba(59,201,242,.22)}
/* The chevron sits over the control and must not swallow the click that
   opens it. */
.sel .ic{position:absolute;right:14px;top:50%;margin-top:-7px;width:14px;height:14px;
  color:#8fa0b3;transform:rotate(90deg);pointer-events:none}
.sel:hover .ic{color:#5a6672}
.demo-note{display:flex;align-items:flex-start;gap:9px;margin:16px 0 0;font-size:12.5px;
  color:#7b8188}
.demo-note .ic{width:15px;height:15px;flex:0 0 15px;color:var(--cyan);margin-top:1px}
.demo-note b{color:var(--navy);font-weight:600}
@media(max-width:820px){ .demo-grid{grid-template-columns:1fr} }

/* ── account avatar & menu ──────────────────────────────────────────────*/
.acct{position:relative}
.avatar{width:34px;height:34px;border-radius:99px;border:none;cursor:pointer;
  background:linear-gradient(140deg,var(--cyan),#0a86c9);color:#fff;
  font-family:inherit;font-size:12.5px;font-weight:700;letter-spacing:.02em;
  display:flex;align-items:center;justify-content:center;flex:0 0 34px;
  box-shadow:0 0 0 2px rgba(255,255,255,.7);transition:box-shadow .15s,transform .15s}
.avatar:hover{transform:translateY(-1px);box-shadow:0 0 0 3px rgba(59,201,242,.3)}
.avatar.lg{width:42px;height:42px;flex:0 0 42px;font-size:15px;cursor:default}
.avatar.xl{width:56px;height:56px;flex:0 0 56px;font-size:19px;cursor:default}

.acct-card{position:absolute;top:44px;right:0;z-index:40;min-width:236px;
  background:#fff;border:1px solid var(--line);border-radius:12px;padding:7px;
  box-shadow:0 16px 40px rgba(11,43,92,.18);animation:loi-in .16s ease both}
.acct-who{display:flex;align-items:center;gap:12px;padding:11px 12px 13px;
  border-bottom:1px solid var(--line);margin-bottom:6px}
.acct-who > div{min-width:0;display:flex;flex-direction:column}
.acct-who b{font-size:13.5px;color:var(--navy);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acct-who span{font-size:12px;color:#7b8188;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acct-role{margin-top:4px;align-self:flex-start;font-size:10.5px;font-weight:700;
  text-transform:uppercase;letter-spacing:.04em;color:#0a6a8f;background:#e4f6fd;
  padding:3px 8px;border-radius:99px}
.acct-item{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;
  border:none;background:none;border-radius:8px;cursor:pointer;font-family:inherit;
  font-size:13.5px;color:#1a1d21;text-align:left;transition:background .12s}
.acct-item:hover{background:#f5f8fa}
.acct-item .ic{width:15px;height:15px;color:#5a6672}
.acct-item.danger{color:#b4530a}
.acct-item.danger .ic{color:#b4530a}
.acct-item.danger:hover{background:#fdf1ea}

.prof-head{display:flex;align-items:center;gap:16px;margin-bottom:20px}
.prof-head h3{font-size:19px;color:var(--navy);margin:0 0 2px}
#page-profile .btn-dark{margin-top:20px;display:inline-flex;align-items:center;gap:8px}
@media (prefers-reduced-motion: reduce){ .acct-card{animation:none} .avatar{transition:none} }

/* A refused upload explains itself on the page. An alert box gets dismissed
   before it is read, and "this is not a questionnaire" needs reading. */
.notice.err{background:#fdf1ea;border-left-color:#b4530a;margin-bottom:18px;
  align-items:flex-start;position:relative;padding-right:44px}
.notice.err .ic{color:#b4530a}
.notice.err strong{color:#8a3d06;display:block}
.notice.err p{margin:5px 0 0;font-size:13px;color:#7b5a44}
.notice-x{position:absolute;top:8px;right:10px;border:none;background:none;cursor:pointer;
  font-size:22px;line-height:1;color:#c39a7d;padding:2px 7px;border-radius:6px}
.notice-x:hover{background:rgba(180,83,10,.1);color:#8a3d06}

[hidden],.hidden{display:none!important}

/* ── modal ──────────────────────────────────────────────────────────────*/
.modal-wrap{position:fixed;inset:0;z-index:100;display:flex;align-items:center;
  justify-content:center;padding:24px;background:rgba(7,31,71,.45);
  backdrop-filter:blur(2px);animation:fade .18s ease both}
@keyframes fade{from{opacity:0}to{opacity:1}}
.modal{background:#fff;border-radius:16px;padding:30px 32px 26px;max-width:440px;width:100%;
  text-align:center;box-shadow:0 24px 60px rgba(7,31,71,.3);
  animation:pop .22s cubic-bezier(.2,.9,.3,1.1) both}
@keyframes pop{from{opacity:0;transform:translateY(10px) scale(.96)}to{opacity:1;transform:none}}
.modal-ic{width:52px;height:52px;border-radius:99px;margin:0 auto 16px;
  background:#fdf1ea;color:#b4530a;display:flex;align-items:center;justify-content:center}
.modal-ic .ic{width:24px;height:24px}
.modal h3{font-size:18px;color:var(--navy);margin:0 0 8px;line-height:1.35}
.modal p{font-size:13.5px;color:#7b8188;margin:0 0 22px;line-height:1.55}
.modal .btn-dark{min-width:130px;justify-content:center}

/* ── password verification modal ── */
.modal.pw-modal{max-width:460px;text-align:left;padding:26px 28px}
.pw-modal-ic{width:46px;height:46px;border-radius:12px;background:#eaf5ff;color:#1d5fa8;
  display:flex;align-items:center;justify-content:center;margin-bottom:14px}
.pw-modal-ic .ic{width:22px;height:22px}
.pw-modal h3{font-size:17.5px;color:var(--navy);font-weight:600;margin:0 0 6px;text-align:left}
.pw-modal p{font-size:13px;color:var(--muted);margin:0 0 16px;line-height:1.5;text-align:left}
.pw-modal p strong{color:var(--navy);font-weight:600}
.pw-field-wrap{position:relative;display:flex;align-items:center;margin-bottom:12px}
.pw-modal-input{width:100%;height:40px;padding:8px 40px 8px 12px;border:1px solid var(--line);
  border-radius:9px;font-size:13.5px;color:var(--ink);background:#fff;transition:.15s}
.pw-modal-input:focus{outline:none;border-color:var(--cyan);box-shadow:0 0 0 3px rgba(59,201,242,.2)}
.pw-modal-input.has-err{border-color:var(--orange);background:#fff9f6}
.pw-eye-btn{position:absolute;right:8px;top:50%;transform:translateY(-50%);background:none;
  border:none;color:var(--muted);cursor:pointer;padding:4px;display:flex;align-items:center;
  border-radius:6px;transition:color .12s}
.pw-eye-btn:hover{color:var(--navy)}
.pw-eye-btn .ic{width:18px;height:18px}
.pw-modal-err{background:#fff2ee;border:1px solid #fbdad0;color:#c0391b;font-size:12.5px;
  border-radius:8px;padding:8px 12px;margin-bottom:14px;line-height:1.45;display:flex;align-items:center;gap:8px}
.pw-modal-actions{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:16px}
.pw-btn-cancel{padding:9px 16px;border:1px solid var(--line);border-radius:8px;background:#fff;
  color:var(--body);font-size:13px;font-weight:500;cursor:pointer;transition:.12s}
.pw-btn-cancel:hover{background:#f4f7fa;border-color:#cfd8e3}
.pw-btn-confirm{padding:9px 20px;border:none;border-radius:8px;background:var(--navy);
  color:#fff;font-size:13px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;
  gap:7px;transition:.14s}
.pw-btn-confirm:hover{background:var(--navy-l, #16437e)}
.pw-btn-confirm:disabled{opacity:.55;cursor:not-allowed}
@media (prefers-reduced-motion: reduce){ .modal-wrap,.modal{animation:none} }

/* ── sidebar links (About / Privacy / Terms) ────────────────────────────
   Recessive: these are always available but are not the job. Sits at the
   foot of the sidebar, below the questionnaire panel. */
.side-links{margin-top:auto;padding:16px 22px 20px;display:flex;flex-direction:column;
  align-items:flex-start;gap:9px;border-top:1px solid rgba(255,255,255,.09)}
.side-link{background:none;border:none;padding:0;cursor:pointer;font-family:inherit;
  font-size:12.5px;color:rgba(255,255,255,.55);transition:color .15s}
.side-link:hover{color:rgba(255,255,255,.9)}
.side-link.on{color:var(--cyan)}

/* ── document pages (Privacy, Terms) ────────────────────────────────────
   Cards in a responsive grid. auto-fit with a 340px minimum means the
   browser decides the column count from the width available — three across
   on a wide screen, one on a phone — rather than a fixed layout that leaves
   the pane half empty at one size and cramped at another. */
.doc-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));
  gap:18px;align-items:stretch}
/* stretch, not start. Left to their natural heights the cards in a row ended
   at different points and the grid looked ragged; a card with three points
   sat beside one with five. They now fill their row. */
.doc-block{display:flex;flex-direction:column;
  background:var(--card);border:1px solid var(--line);border-radius:14px;
  padding:22px 24px;box-shadow:0 1px 3px rgba(11,43,92,.05);
  transition:box-shadow .18s,border-color .18s}
.doc-block ul{flex:1}
.doc-block:hover{border-color:#d5e2f2;box-shadow:0 6px 18px rgba(11,43,92,.08)}
.doc-block h3{display:flex;align-items:center;gap:10px;font-size:14.5px;color:var(--navy);
  margin:0 0 14px;padding-bottom:12px;border-bottom:1px solid var(--line)}
/* A cyan rule before the heading, so the eye finds the card titles when
   scanning down a column. */
.doc-block h3::before{content:'';width:3px;height:15px;border-radius:2px;
  background:var(--cyan);flex:0 0 3px}
.doc-block ul{list-style:none;margin:0;padding:0}
.doc-block li{position:relative;padding-left:20px;font-size:13.8px;line-height:1.62;
  color:#3c4650;margin-bottom:10px}
.doc-block li:last-child{margin-bottom:0}
.doc-block li::before{content:'';position:absolute;left:0;top:8px;width:6px;height:6px;
  border-radius:2px;background:var(--cyan)}
.doc-block li b{color:var(--navy)}
/* The closing advisory reads as a caution, not another rule. */
.doc-block.note{background:#fffdf6;border-color:#f2e4b8}
.doc-block.note h3{color:#8a6a12;border-bottom-color:#f2e4b8}
.doc-block.note h3::before{background:#e8c65a}
.doc-block.note li::before{background:#e8c65a}

/* ── duration bar: one segment per minute ───────────────────────────────
   Each segment is a full 60 seconds. A question under a minute fills part
   of one; a longer one fills whole segments and part of the next, so
   crossing a minute boundary is visible rather than implied by a number. */
.d-time{display:grid;grid-template-columns:130px 1fr 66px;align-items:center;gap:12px;
  font-size:12px;color:#161a1f;font-weight:600;margin-bottom:11px}
.mbar{display:flex;gap:7px}
/* flex:1 with no max-width, so the segments always span the FULL track and
   divide it equally. One minute = one full-width bar. Two minutes = two
   half-width bars side by side, the first full and the second part-filled.
   The old max-width:96px capped them, so the track never filled. */
.mseg{flex:1 1 0;min-width:0;height:10px;border-radius:99px;
  background:#e6eaef;overflow:hidden}
.mfill{display:block;height:10px;border-radius:99px;
  background:linear-gradient(90deg,#5fd6f7,#0a86c9);
  transition:width .35s cubic-bezier(.2,.8,.2,1)}
.d-clock{color:#0b2b5c;font-weight:700;text-align:right;font-variant-numeric:tabular-nums}
.d-lab{color:#5a6672;font-weight:600}
@media (prefers-reduced-motion: reduce){ .mfill{transition:none} }

/* ── removing a wrongly-parsed question ─────────────────────────────────*/
/* Always visible, not hover-only. It was invisible until the row was
   hovered, which meant nobody knew the row could be removed at all. Quiet
   by default so 35 of them do not shout, but present. */
.rm{position:relative;background:#f4f7fa;border:1px solid #e3e9f0;padding:0;cursor:pointer;
  display:flex;align-items:center;justify-content:center;width:22px;height:22px;
  border-radius:6px;color:#8fa0b3;
  transition:background .16s,color .16s,border-color .16s,transform .16s}
.rm .ic{width:12px;height:12px;transition:transform .16s}
.rm:hover{background:#fdece6;border-color:#f0cdb8;color:#b4530a;transform:scale(1.12)}
.rm:hover .ic{transform:rotate(-90deg)}
.rm:active{transform:scale(.94)}
.rm:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}

/* Styled tooltip rather than the browser's — the native one waits a second
   and looks like an OS artefact next to everything else here. */
/* The tooltip sits BESIDE the button, vertically centred on the row.
   Above and below both failed, for two different reasons that no z-index
   fixes: every .bld-row has `animation: ... both`, which makes it a stacking
   context that traps its own tooltip; and .bld-rows is a scroll container
   (overflow-y:auto), which CLIPS anything crossing its edge. Placed
   horizontally the tooltip never leaves the row it belongs to, so it can
   neither be covered by the next row nor cut off by the scroller. */
.rm::after{content:attr(data-tip);position:absolute;top:50%;right:calc(100% + 9px);
  transform:translateY(-50%) translateX(3px);
  white-space:nowrap;background:#0b2b5c;color:#fff;font-size:11.5px;font-weight:500;
  padding:5px 10px;border-radius:6px;opacity:0;pointer-events:none;
  transition:opacity .16s,transform .16s;z-index:30}
.rm::before{content:'';position:absolute;top:50%;right:calc(100% + 4px);
  margin-top:-5px;border:5px solid transparent;border-left-color:#0b2b5c;
  opacity:0;pointer-events:none;transition:opacity .16s;z-index:30}
.rm:hover::after,.rm:focus-visible::after{opacity:1;transform:translateY(-50%)}
.rm:hover::before,.rm:focus-visible::before{opacity:1}

@media (prefers-reduced-motion: reduce){
  .rm,.rm .ic,.rm::after,.del-add,.del-add .ic,.del-add::after{transition:none}
  .rm:hover,.del-add:hover{transform:none}
  .rm:hover .ic,.del-add:hover .ic{transform:none}
}

/* The row lifts and collapses out rather than vanishing, so the eye can
   follow where it went. Height and padding animate to zero so the rows
   below close the gap instead of jumping. */
.bld-row.going{animation:strike .26s cubic-bezier(.4,0,.7,.2) both;overflow:hidden}
@keyframes strike{
  0%{opacity:1;transform:none;max-height:220px}
  40%{opacity:.5;transform:translateX(-14px)}
  100%{opacity:0;transform:translateX(-26px);max-height:0;
       margin-bottom:0;padding-top:0;padding-bottom:0;border-width:0}
}

.bld-deleted{display:flex;align-items:center;gap:8px;background:#fdf1ea;border:1px solid #f2d6c4;
  color:#b4530a;font-family:inherit;font-size:12.5px;font-weight:600;padding:8px 15px;
  border-radius:99px;cursor:pointer;transition:background .15s}
.bld-deleted:hover{background:#fbe4d6}
.bld-deleted .ic{width:14px;height:14px}
.bld-deleted b{font-variant-numeric:tabular-nums}

.del-panel{background:#fdfaf8;border:1px dashed #e8cdbb;border-radius:12px;
  padding:14px 16px;margin-bottom:14px;animation:loi-in .24s ease both}
.del-head{font-size:11.5px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;
  color:#b4530a;margin-bottom:11px}
.del-row{position:relative;z-index:1;
  display:grid;grid-template-columns:24px 44px 1fr auto 52px;align-items:center;gap:12px;
  padding:9px 12px;background:#fff;border:1px solid #f0e2d8;border-radius:9px;margin-bottom:7px}
.del-row:hover,.del-row:focus-within{z-index:20}
.del-row:last-child{margin-bottom:0}
.del-row .t{font-size:13.5px;color:#7b8188;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.del-row .q{font-size:11px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:#9aa4ad}
.del-row .sec{font-size:13px;color:#9aa4ad;text-align:right;font-variant-numeric:tabular-nums}
/* Same shape and behaviour as the remove button on a question row — square
   with a soft radius, a drawn tooltip below, and the same micro-animation.
   Two controls that do opposite things should still feel like one family. */
.del-add{position:relative;background:#e9f7f0;border:1px solid #cdeede;padding:0;
  width:22px;height:22px;border-radius:6px;cursor:pointer;
  display:flex;align-items:center;justify-content:center;color:#0a7a52;
  transition:background .16s,color .16s,border-color .16s,transform .16s}
.del-add .ic{width:12px;height:12px;transition:transform .16s}
.del-add:hover{background:#cdeede;border-color:#a9dcc4;transform:scale(1.12)}
.del-add:hover .ic{transform:rotate(90deg)}
.del-add:active{transform:scale(.94)}
.del-add:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}

/* The tooltip sits BESIDE the button, vertically centred on the row.
   Above and below both failed, for two different reasons that no z-index
   fixes: every .bld-row has `animation: ... both`, which makes it a stacking
   context that traps its own tooltip; and .bld-rows is a scroll container
   (overflow-y:auto), which CLIPS anything crossing its edge. Placed
   horizontally the tooltip never leaves the row it belongs to, so it can
   neither be covered by the next row nor cut off by the scroller. */
.del-add::after{content:attr(data-tip);position:absolute;top:50%;right:calc(100% + 9px);
  transform:translateY(-50%) translateX(3px);
  white-space:nowrap;background:#0b2b5c;color:#fff;font-size:11.5px;font-weight:500;
  padding:5px 10px;border-radius:6px;opacity:0;pointer-events:none;
  transition:opacity .16s,transform .16s;z-index:30}
.del-add::before{content:'';position:absolute;top:50%;right:calc(100% + 4px);
  margin-top:-5px;border:5px solid transparent;border-left-color:#0b2b5c;
  opacity:0;pointer-events:none;transition:opacity .16s;z-index:30}
.del-add:hover::after,.del-add:focus-visible::after{opacity:1;transform:translateY(-50%)}
.del-add:hover::before,.del-add:focus-visible::before{opacity:1}

@media (prefers-reduced-motion: reduce){
  .bld-row.going{animation:none;display:none}
  .del-panel{animation:none}
}

/* ═══════════════════════════════════════════════════════════════════════
   PHONE — everything below is inside one breakpoint, so nothing at desktop
   width changes. The app was unusable on a phone: .shell is a flex ROW with
   a 290px fixed sidebar, so on a 390px screen the content had 100px.
   ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 760px) {

  /* dvh, not vh. iOS Safari counts its toolbar in 100vh, so the last
     ~90px of the page sits under the browser chrome and cannot be reached. */
  html, body { height: 100dvh; }

  /* The stack. This is the whole fix — everything else is consequence. */
  .shell { flex-direction: column; height: 100dvh; }

  /* Sidebar becomes a header strip: logo, then the drop zone. It scrolls
     with the page rather than owning a fixed column. */
  .sidebar { width: 100%; flex-shrink: 1; overflow: visible; }
  .logo { padding: 14px 16px; }
  .side-label { display: none; }          /* "User workspace" over one item */
  .nav-item { padding: 11px 16px; }
  .qnr-panel { margin: 12px 16px; padding: 14px; }
  .drop { padding: 20px 12px; }
  .side-links { flex-direction: row; gap: 18px; padding: 12px 16px 16px; }

  .main { overflow: visible; }
  .content { padding: 16px; }
  .content.busy { overflow: visible; }     /* the builder may exceed the fold */
  #page-loading:not(.hidden) { min-height: auto; }
  #page-loading .builder { flex: 0 0 auto; }
  .bld-rows { overflow: visible; }         /* page scrolls, not an inner box */

  .topbar { padding: 10px 16px; }
  .page-head h2 { font-size: 19px; }
  .hero { padding: 22px 18px; }
  .hero h1 { font-size: 24px; }
  .hero p { width: auto; font-size: 14px; }
  .brand-row img { width: 34px; height: 34px; }

  /* Every analytics grid collapses to one column. */
  .pa-top, .score-row, .grid2, .doc-grid, .demo-grid, .cards { grid-template-columns: 1fr; }
  .pa-head { padding: 14px 16px; flex-wrap: wrap; }
  .pa-body { padding: 16px; gap: 14px; }
  .loi-big { font-size: 42px; }
  .pcts { gap: 8px; }
  .pct .col { height: 84px; }
  .pct .v { font-size: 18px; }
  .sub-card, .doc-block { padding: 16px 15px; }
  .grid2 > .sub-card { max-height: none; }
  .qbars { max-height: 300px; }

  /* Question rows go to two lines: identity on top, measurements beneath.
     Five columns at 360px gives every one of them about 60px. */
  .bld-line { grid-template-columns: 40px 1fr auto auto; row-gap: 9px; padding: 12px 13px; }
  .bld-row .t { grid-column: 1 / -1; grid-row: 2; white-space: normal;
                line-height: 1.4; font-size: 13.5px; }
  .bld-row .chip { grid-column: 2; grid-row: 1; justify-self: start; }
  .bld-row .sec { grid-column: 3; grid-row: 1; }
  .bld-row .rm  { grid-column: 4; grid-row: 1; }
  .bld-row .chev { display: none; }        /* the row itself opens the drawer */

  /* 44px is Apple's minimum tap target; the button is 22px on desktop. The
     visible square stays small — the touch area around it grows. */
  .rm, .del-add { width: 22px; height: 22px; }
  .rm::after, .del-add::after { display: none; }   /* no hover on a phone */
  .rm::before, .del-add::before { display: none; }
  .rm, .del-add, .chev, .side-link, .nav-item {
    position: relative;
  }
  .rm::after, .del-add::after { content: none; }
  .rm, .del-add { touch-action: manipulation; }
  .bld-row .rm { padding: 11px; margin: -11px; box-sizing: content-box; }

  .d-time { grid-template-columns: 1fr; gap: 6px; }
  .d-clock { text-align: left; }
  .mbar { gap: 5px; }

  .bld-head { gap: 10px; }
  .bld-total { padding: 8px 14px; font-size: 12.5px; }
  .del-row { grid-template-columns: 24px 1fr auto; row-gap: 6px; }
  .del-row .t { grid-column: 1 / -1; grid-row: 2; white-space: normal; }

  .rec { flex-wrap: wrap; }
  .rec .rt { flex: 1 1 100%; order: 2; }
  .rec .rs { order: 3; }

  .modal { padding: 24px 20px; }
  .notice.err { padding-right: 40px; }
}

/* Very small phones — 360px and below. */
@media (max-width: 380px) {
  .content, .pa-body { padding: 12px; }
  .loi-big { font-size: 36px; }
  .bld-line { grid-template-columns: 34px 1fr auto; }
  .bld-row .rm { grid-column: 3; }
  .bld-row .sec { grid-column: 2; justify-self: end; }
  .pct .v { font-size: 16px; }
}

/* Hidden on screen, shown only on paper. */
.print-only { display: none; }

/* ═══════════════════════════════════════════════════════════════════════
   PRINT / SAVE-AS-PDF
   The browser's own PDF writer, not a library: text stays selectable, the
   file is a few hundred KB rather than 10-20 MB, and it behaves the same on
   desktop, Android and iOS. A rasterising library would have dropped all 17
   box-shadows and mangled every gradient.
   ═══════════════════════════════════════════════════════════════════════ */
@media print {
  @page { size: A4; margin: 12mm 11mm 14mm; }

  /* Chrome and Safari drop backgrounds when printing unless asked. Every bar
     in this report IS a background, so without this the charts print as
     white gaps. */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  html, body { height: auto; background: #fff; font-size: 10.5pt; }
  .shell, .main, .content { display: block; height: auto; overflow: visible; padding: 0; }

  /* PAGE 1 IS THE SUMMARY. Everything that is an on-screen affordance, or
     that repeats what the tables below say better, is dropped:
       the builder      35 bar rows, ~4 pages, superseded by the question table
       demographics     three dropdowns, meaningless on paper
       bars & drawers   screen idioms with no columns */
  .sidebar, .topbar, #page-loading, #page-demo, #uploadError,
  .rm, .chev, .del-add, .bld-deleted, .pa-export, .export-menu,
  .side-links, .modal-wrap, .cta,
  #sections, #qbars, #recs, .qnote, .rec-total { display: none !important; }
  .sub-card:has(#sections), .sub-card:has(#qbars),
  .rec-card { display: none !important; }
  /* "What drives the estimate" stays as bars, not a table. It is four rows
     of proportion — a shape reads that instantly where four numbers do not.
     The long lists below stay tabular because 35 bars cannot be read as
     data; this one can. */
  .sub-card:has(#drivers) { display: block !important; break-inside: avoid;
    border: 1px solid #d8e0e8 !important; border-radius: 8px; padding: 12px 14px; }
  #drivers { display: block !important; }
  .bar-row { break-inside: avoid; font-size: 8.5pt; margin-bottom: 6px; }
  .bar-row .lbl { width: 150px; }
  .bar-row .track { height: 13px; }
  .bar-row .fill { height: 13px; }
  .bar-row .val { width: 62px; }
  .print-only { display: block !important; }

  /* NEVER break-inside a container taller than a page. Doing that to .panel
     is what left page 1 empty: the browser could not fit the whole panel, so
     it pushed all of it to page 2 rather than splitting it. Only small units
     get the rule. */
  .panel, .pa { box-shadow: none !important; border: none !important;
                break-inside: auto; page-break-inside: auto; }
  .pa-body { padding: 0; gap: 10px; }

  /* margin-bottom, not just the flex gap: .pa-body is a separate box, so the
     gap between its children never applied between the header and the first
     card. That is why the two were touching. */
  .pa-head { background: #0b2b5c !important; color: #fff !important;
             padding: 12px 15px; border-radius: 8px; margin-bottom: 12px; }
  .pa-head h3 { font-size: 13pt; }
  .pa-file, .pa-sub { font-size: 8.5pt; }

  /* The summary block, compact enough to leave room for the first table. */
  .pa-top { grid-template-columns: 1fr 1.5fr; gap: 10px; break-inside: avoid; }
  .loi-card { padding: 14px; border-radius: 8px; }
  .loi-big { font-size: 30pt; margin: 6px 0 6px; }
  .loi-eyebrow { font-size: 7.5pt; }
  .pct-card { padding: 12px 14px; border-radius: 8px; }
  .pct-card h4 { font-size: 10pt; margin-bottom: 2px; }
  .pct-card p { font-size: 8pt; margin-bottom: 8px; }
  .pct .col { height: 52px; }
  .pct .v { font-size: 13pt; }
  .pct .k { font-size: 7.5pt; }
  .score-row { grid-template-columns: repeat(3, 1fr); gap: 10px; break-inside: avoid; }
  .score { padding: 11px 13px; border-radius: 8px; break-inside: avoid; }
  .score .v { font-size: 17pt; }
  .score .n { font-size: 8.5pt; margin-bottom: 5px; }

  /* Tables. Lines, a tinted header, and rows that never split. */
  .pt-h { font-size: 11pt; color: #0b2b5c; margin: 15px 0 6px;
          break-after: avoid; page-break-after: avoid; }
  .pt-h span { font-size: 8pt; font-weight: 400; color: #6b7480; margin-left: 6px; }
  table.pt { width: 100%; border-collapse: collapse; font-size: 8.5pt;
             break-inside: auto; }
  table.pt thead { display: table-header-group; }   /* repeat on every page */
  table.pt th { background: #eef3f9 !important; color: #0b2b5c; text-align: left;
                font-weight: 700; padding: 5px 7px; border: 1px solid #c9d6e4; }
  table.pt td { padding: 4px 7px; border: 1px solid #dde5ee; vertical-align: top; }
  table.pt tr { break-inside: avoid; page-break-inside: avoid; }
  table.pt tbody tr:nth-child(even) td { background: #f7fafd !important; }
  table.pt .num { text-align: right; white-space: nowrap; }
  table.pt .mono { font-family: ui-monospace, Menlo, monospace; white-space: nowrap; }
  table.pt tr.dim td { color: #98a3ae; }

  /* ── paper masthead ────────────────────────────────────────────────
     Title left, mark right. margin-bottom does the spacing to the panel
     below — the padding only separates the rule from the text inside. */
  .print-masthead { display: block !important; margin-bottom: 22px;
    padding-bottom: 11px; border-bottom: 2px solid #0b2b5c; break-inside: avoid; }
  .pm-row { display: flex; align-items: center; justify-content: space-between;
            gap: 20px; }
  /* A 3:1 wordmark, not the square mark that used to sit here. Constrain
     the WIDTH and let the height follow, or a 1360x450 image forced into a
     square box comes out stretched. */
  .pm-logo { width: 112px; height: auto; flex: 0 0 auto; border-radius: 0;
    /* Nudged down visually only. position:relative moves the painted image
       without touching the layout, so the title and the file line beneath
       stay exactly where they were. */
    position: relative; top: 7px; }
  .pm-title { font-size: 17pt; color: #0b2b5c; margin: 0; font-weight: 600;
              letter-spacing: -.01em; }
  .pm-file { font-size: 8.5pt; color: #5a6672; margin: 7px 0 0; }

  /* ── paper footer ──────────────────────────────────────────────────
     After the last table rather than in a running position, so it appears
     once at the end instead of on every page. */
  .print-foot { display: flex !important; justify-content: space-between;
    gap: 16px; margin-top: 20px; padding-top: 9px;
    border-top: 1px solid #c9d6e4; font-size: 7.5pt; color: #6b7480;
    break-inside: avoid; }

  h2, h3, h4 { break-after: avoid; page-break-after: avoid; }
  .page-head { margin-bottom: 8px; }
  .page-head h2 { font-size: 14pt; }
  .page-head p { font-size: 8.5pt; }

  /* An animation captured mid-flight prints as a half-drawn bar. */
  *, *::before, *::after { animation: none !important; transition: none !important;
                           opacity: 1 !important; transform: none !important; }
  a[href]::after { content: ''; }
}

/* ── export menu ────────────────────────────────────────────────────────*/
.export-wrap{position:relative}
.pa-export .caret{width:12px;height:12px;transform:rotate(90deg);opacity:.75}
.export-menu{position:absolute;top:calc(100% + 8px);right:0;z-index:50;min-width:236px;
  background:#fff;border:1px solid var(--line);border-radius:12px;padding:6px;
  box-shadow:0 16px 40px rgba(11,43,92,.2);animation:loi-in .16s ease both}
.export-item{display:flex;align-items:center;gap:12px;width:100%;padding:10px 12px;
  border:none;background:none;border-radius:8px;cursor:pointer;font-family:inherit;
  text-align:left;color:#1a1d21;transition:background .12s}
.export-item:hover{background:#f5f8fa}
.export-item:disabled{opacity:.6;cursor:progress}
.export-item .ic{width:17px;height:17px;color:var(--cyan);flex:0 0 17px}
.export-item span{display:flex;flex-direction:column;min-width:0}
.export-item b{font-size:13.5px}
.export-item small{font-size:11.5px;color:#7b8188;margin-top:1px}
@media (prefers-reduced-motion: reduce){ .export-menu{animation:none} }


/* ── survey mode ─────────────────────────────────────────────────────────
   Three icons under the drop zone, inside .qnr-panel on the navy sidebar.
   Borrows the drop zone's dashed border and cyan hover so the two read as one
   control rather than two widgets that happen to be adjacent. */
.mode-box{display:flex;gap:6px;margin-top:10px}
.mt{flex:1;position:relative;display:flex;align-items:center;justify-content:center;
    padding:9px 0;border:1.5px dashed #40608c;border-radius:10px;cursor:pointer;
    transition:border-color .15s,background .15s}
.mt input{position:absolute;opacity:0;width:0;height:0;pointer-events:none}
.mt .mi{width:18px;height:18px;color:rgba(255,255,255,.62);transition:color .15s}
.mt:hover{border-color:var(--cyan);background:rgba(59,201,242,.07)}
.mt:hover .mi{color:#fff}
.mt:has(input:checked){border-style:solid;border-color:var(--cyan);
                       background:rgba(59,201,242,.14)}
.mt:has(input:checked) .mi{color:var(--cyan)}
.mt:has(input:focus-visible){outline:2px solid var(--cyan);outline-offset:2px}

/* Tooltip BELOW the icon.
   White bubble, not navy: the sidebar is already navy-dark, so the #0b2b5c
   used by the row tooltips elsewhere sat almost invisibly on top of it. Dark
   bold text on white is the only combination that reads here. */
.mt::after{content:attr(data-tip);position:absolute;top:calc(100% + 9px);left:50%;
  transform:translateX(-50%) translateY(-3px);
  white-space:nowrap;background:#fff;color:var(--navy-d);
  font-size:11.5px;font-weight:700;letter-spacing:.01em;line-height:1;
  padding:6px 11px;border-radius:6px;box-shadow:0 4px 14px rgba(0,0,0,.4);
  opacity:0;pointer-events:none;transition:opacity .16s,transform .16s;z-index:40}
.mt::before{content:'';position:absolute;top:calc(100% + 4px);left:50%;
  margin-left:-5px;border:5px solid transparent;border-bottom-color:#fff;
  opacity:0;pointer-events:none;transition:opacity .16s;z-index:40}
.mt:hover::after,.mt:has(input:focus-visible)::after{opacity:1;transform:translateX(-50%) translateY(0)}
.mt:hover::before,.mt:has(input:focus-visible)::before{opacity:1}

/* ── range beside the headline ────────────────────────────────────────── */
.loi-range{margin-top:.3rem;font-size:.8rem;color:var(--muted,#6b7280);font-variant-numeric:tabular-nums}
.loi-range b{color:inherit;font-weight:600}



/* ── the settings gear, beside the model badge ────────
   Same height as the .ver pill so the two read as one control group. The
   cog turns on hover — the icon's own path carries .spin-p, but a rotation
   on the whole glyph is what reads as "adjustable" at 16px. */
.cog{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;
  border-radius:8px;color:var(--muted);text-decoration:none;transition:.16s}
.cog:hover{background:#eaf5ff;color:#1d5fa8}
.cog:hover .ic use[href="#i-cog"],
.cog:hover svg:has(use[href="#i-cog"]){transform:rotate(60deg)}
.cog svg{transition:transform .3s cubic-bezier(.34,1.3,.64,1)}
.cog:focus-visible{outline:2px solid var(--cyan);outline-offset:1px}

/* ── the uploaded document, beside the questions it produced ──────────────
   Closed, the builder is exactly what it was: the split is a plain block and
   nothing moves. Open, the two panes share a bounded height and scroll
   INDEPENDENTLY -- the row list has its own scrollbar and so does the
   document, because they are different lengths and locking them together
   means one of them is always in the wrong place. */
/* The split sits between .builder and .bld-rows, and it has to carry the
   bounded height through. Without flex:1 and min-height:0 it collapsed to its
   content, the row list grew to its full length instead of scrolling inside
   the panel, and the "Detecting Q11…" ticker underneath it was pushed to the
   bottom of a very long page -- reported as the ticker sitting in the footer. */
.bld-split{display:flex;gap:0;flex:1;min-height:0}
/* Open, the two panes share a height so each scrolls inside itself. The BOX
   is the view's alone: the question list keeps the appearance it has always
   had -- no border, no background, no padding of its own -- because the point
   of opening a view is to look at the view, not to restyle the builder. */
.bld-split.with-doc{gap:16px;height:min(72vh,760px);align-items:stretch}
.bld-split > .bld-rows{flex:1;min-width:0}
.bld-split.with-doc > .bld-rows{flex:1 1 0;overflow-y:auto;min-height:0;height:100%}

.doc-pane{display:flex;flex-direction:column;flex:1 1 0;min-width:0;
  border:1px solid #e2e9f1;border-radius:12px;background:#fff;min-height:0;height:100%;
  overflow:hidden}
.doc-pane.hidden{display:none}
.doc-head{display:flex;align-items:center;gap:9px;padding:11px 13px;
  border-bottom:1px solid #e8edf3;background:#f8fafd;flex:0 0 auto;border-radius:12px 12px 0 0}
.doc-head .ic{width:16px;height:16px;color:#7b8794;flex:0 0 auto}
.doc-name{font-size:12.5px;font-weight:600;color:#31404f;overflow:hidden;
  text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}
.doc-count{font-size:11px;color:#93a0ad;font-variant-numeric:tabular-nums;flex:0 0 auto}
/* the pane's own scroll: the document is long and the row list is not */
.doc-body{overflow:auto;padding:10px 6px 24px;font-size:12.5px;line-height:1.62;
  color:#4a5866;flex:1;min-height:0}
.doc-body::-webkit-scrollbar{width:8px}
.doc-body::-webkit-scrollbar-thumb{background:#cfd8e3;border-radius:5px}
.doc-p{padding:3px 12px;border-left:2px solid transparent;white-space:pre-wrap;
  overflow-wrap:anywhere;border-radius:0 4px 4px 0}
/* a line the parser read as a question: marked always, so the reader can see
   what was picked up and -- more usefully -- what was not */
.doc-p.is-q{border-left-color:#c3d3e6;background:#f4f8fd;color:#31404f;cursor:pointer}
.doc-p.is-q:hover{background:#e9f1fb}
.doc-p.on{border-left-color:#2f6fd0;background:#e8f0fc;color:#1f2d3d}
.doc-q-tag{display:inline-block;font-size:10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  color:#2f6fd0;background:#dfeafb;border-radius:4px;padding:0 5px;margin-right:7px;
  vertical-align:1px}

/* ── the survey preview: the question as a respondent meets it ──────────── */
.doc-body.as-survey{padding:16px 16px 26px;background:#fbfcfe}
.sv-q{border:1px solid #e4eaf2;border-radius:10px;background:#fff;padding:13px 15px;
  margin:0 0 12px}
.sv-q.on{border-color:#2f6fd0;box-shadow:0 0 0 2px #dfeafb}
.sv-num{font-size:10.5px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:#8b97a4}
.sv-text{font-size:13px;color:#25313d;margin:3px 0 10px;line-height:1.5}
.sv-opts{display:flex;flex-direction:column;gap:7px}
.sv-opt{display:flex;align-items:center;gap:9px;font-size:12.5px;color:#4a5866}
/* a radio for one answer, a box for many: the shape says how many you may pick */
/* inline-block, not inline: an inline span ignores width and height, so in a
   grid cell -- where there is no flex parent to stretch it -- every radio
   collapsed to a 1px bar. */
.sv-mark{display:inline-block;width:15px;height:15px;border:1.5px solid #9fb2c8;
  flex:0 0 15px;background:#fff;vertical-align:middle}
.sv-mark.one{border-radius:99px}
.sv-mark.many{border-radius:4px}
.sv-open{border:1px dashed #c6d3e2;border-radius:8px;padding:14px 12px;color:#9aa6b3;
  font-size:12px;background:#fcfdff}
.sv-grid{overflow-x:auto}
.sv-grid table{border-collapse:collapse;font-size:11.5px;min-width:100%}
.sv-grid th{font-weight:600;color:#5a6875;padding:6px 8px;text-align:center;
  border-bottom:1px solid #e4eaf2;white-space:nowrap}
.sv-grid td{padding:6px 8px;border-bottom:1px solid #f0f4f8;text-align:center}
.sv-grid td:first-child{text-align:left;color:#41505f;max-width:230px}
.sv-grid .sv-mark{margin:0 auto}
.sv-note{font-size:11px;color:#93a0ad;margin:8px 0 0}

/* the per-row control: a pencil to open, a cross while it is open */
.bld-row .edit{border:0;background:transparent;color:#9aa6b2;cursor:pointer;padding:2px;
  border-radius:6px;display:inline-flex;align-items:center}
.bld-row .edit:hover{background:#eef2f7;color:#2f6fd0}
.bld-row .edit .ic{width:14px;height:14px}
.bld-row.editing .edit{background:#e8f0fc;color:#2f6fd0}
.bld-row .tsel{font:inherit;font-size:11.5px;border:1px solid #cfdae7;border-radius:7px;
  padding:2px 6px;background:#fff;color:#31404f;max-width:132px}
.bld-row.editing{outline:2px solid #cfe0f6;outline-offset:-2px;border-radius:10px}

/* the toolbar control that opens the same view without picking a question */
.bld-views{display:inline-flex;gap:7px}
.bld-view{position:relative;display:inline-flex;align-items:center;gap:7px;
  border:1px solid #dbe4ee;background:#fff;border-radius:99px;padding:6px 13px;
  font-size:12px;color:#4a5866;cursor:pointer;
  transition:border-color .16s,background .16s,color .16s,transform .12s,box-shadow .16s}
/* The button lifts a little under the cursor and presses back down when
   clicked. Movement is what tells you a control is a control before you have
   read anything on it. */
.bld-view:hover{border-color:#b9cbe4;background:#f6f9fd;transform:translateY(-1px);
  box-shadow:0 2px 8px rgba(20,40,70,.07)}
.bld-view:active{transform:translateY(0) scale(.975);box-shadow:none}
.bld-view:focus-visible{outline:2px solid #2f6fd0;outline-offset:2px}
.bld-view.on{border-color:#2f6fd0;color:#2f6fd0;background:#eef4fd}
.bld-view .ic{width:14px;height:14px;transition:transform .18s cubic-bezier(.2,.8,.3,1)}
.bld-view:hover .ic{transform:scale(1.14)}
/* A short pop when the view actually opens, so the press is acknowledged by
   the thing that changed rather than only by the cursor. */
.bld-view.on .ic{animation:loi-pop .26s cubic-bezier(.2,.8,.3,1)}
@keyframes loi-pop{
  0%{transform:scale(.72) rotate(-8deg)}
  60%{transform:scale(1.16) rotate(2deg)}
  100%{transform:scale(1)}}
@media(prefers-reduced-motion:reduce){
  .bld-view,.bld-view .ic{transition:none}
  .bld-view:hover{transform:none}
  .bld-view.on .ic{animation:none}}

/* Tooltip below the button — the same bubble the sidebar icons use, so a
   control explains itself the way every other control here does. */
.bld-view[data-tip]::after{content:attr(data-tip);position:absolute;top:calc(100% + 9px);left:50%;
  transform:translateX(-50%) translateY(-3px);
  white-space:nowrap;background:var(--navy-d,#0b2b5c);color:#fff;
  font-size:11.5px;font-weight:650;letter-spacing:.01em;line-height:1;
  padding:6px 11px;border-radius:6px;box-shadow:0 4px 14px rgba(11,43,92,.22);
  opacity:0;pointer-events:none;transition:opacity .16s,transform .16s;z-index:40}
.bld-view[data-tip]::before{content:'';position:absolute;top:calc(100% + 4px);left:50%;
  margin-left:-5px;border:5px solid transparent;border-bottom-color:var(--navy-d,#0b2b5c);
  opacity:0;pointer-events:none;transition:opacity .16s;z-index:40}
.bld-view[data-tip]:hover::after,.bld-view[data-tip]:focus-visible::after{opacity:1;transform:translateX(-50%) translateY(0)}
.bld-view[data-tip]:hover::before,.bld-view[data-tip]:focus-visible::before{opacity:1}

@media(max-width:900px){
  .bld-split.with-doc{flex-direction:column;height:auto;padding:10px}
  .doc-pane{max-height:52vh}
  .bld-split.with-doc > .bld-rows{height:auto;max-height:44vh}
}

/* ── the document as it looks ─────────────────────────────────────────────
   Narrow on purpose: emphasis, headings, alignment, list indent, tables. Not
   fonts, not colours, not images — the job is recognising the document and
   finding a line in it, not reproducing Word. */
.doc-body.as-doc{padding:18px 18px 26px;color:#33414f;font-size:12.8px;line-height:1.66}
.doc-body.as-doc .dx-p{margin:0 0 7px;padding:2px 8px;border-left:2px solid transparent;
  border-radius:0 4px 4px 0}
.doc-body.as-doc h1,.doc-body.as-doc h2,.doc-body.as-doc h3,
.doc-body.as-doc h4,.doc-body.as-doc h5,.doc-body.as-doc h6{
  color:#1f2d3d;line-height:1.35;margin:16px 0 8px;font-weight:680}
.doc-body.as-doc h1{font-size:17px}
.doc-body.as-doc h2{font-size:15px}
.doc-body.as-doc h3{font-size:13.8px}
.doc-body.as-doc h4,.doc-body.as-doc h5,.doc-body.as-doc h6{font-size:13px}
.doc-body.as-doc .dx-li{list-style:none;position:relative;padding-left:20px}
.doc-body.as-doc .dx-li::before{content:"•";position:absolute;left:8px;color:#9fb0c2}
.doc-body.as-doc strong{font-weight:680;color:#1f2d3d}
.doc-body.as-doc .dx-tw{overflow-x:auto;margin:10px 0 14px}
.doc-body.as-doc .dx-t{border-collapse:collapse;font-size:11.6px;width:100%}
.doc-body.as-doc .dx-t th{background:#f3f7fc;color:#42505f;font-weight:640;
  border:1px solid #e2e9f1;padding:6px 9px;text-align:left;vertical-align:top}
.doc-body.as-doc .dx-t td{border:1px solid #eaf0f6;padding:6px 9px;vertical-align:top}
/* the same marking as the plain view, so the two behave identically */
.doc-body.as-doc .is-q{background:#f4f8fd;border-left-color:#c3d3e6;cursor:pointer}
.doc-body.as-doc .is-q:hover{background:#e9f1fb}
.doc-body.as-doc .on{background:#e8f0fc;border-left-color:#2f6fd0;color:#1f2d3d}

/* the rows and what belongs beneath them, as one column beside the view */
.bld-left{display:flex;flex-direction:column;min-width:0;flex:1 1 0;min-height:0;overflow:hidden}
.bld-split.with-doc > .bld-left{height:100%}
/* .bld-rows takes what is LEFT after the survey overhead row takes its natural
   height.  height:100% would give rows the FULL parent height and bld-ov
   would then add on top, making bld-left overflow and dragging doc-pane with it. */
.bld-split.with-doc > .bld-left > .bld-rows{flex:1;overflow-y:auto;min-height:0}
/* Fix 1: native <select> dropdown escapes the scroll container while the type
   picker is open.  overflow-y:auto clips it before it paints; :has(.tsel)
   lifts the clip.  The list still scrolls because bld-rows has a bounded
   height via flex — overflow:visible only removes the clip, not the size. */
/* The list KEEPS its overflow while a picker is open.
   .tsel is a native <select>: its popup is painted in the browser's own layer
   and is not clipped by an ancestor's overflow, so nothing needed lifting. What
   the override actually did was stop the question list being a scroll container
   at all -- so .bld-left simply CLIPPED it, the column ended dead after a few
   questions, and the document pane beside it looked twice as long. That is the
   "one short, one long" this chased for an hour, and it was on screen the whole
   time because a row click sets .picking. */


/* Survey overhead, stated on screen. Without it the running total could not be
   checked against the rows: they added to six minutes and the total said
   thirteen, with nothing on the page for the difference. */
.bld-ov{display:flex;align-items:flex-start;gap:10px;margin-top:10px;padding:11px 14px;
  border:1px dashed #d8e2ee;border-radius:10px;background:#fafcfe;color:#69788a;
  font-size:12px;line-height:1.5}
.bld-ov.hidden{display:none}
.bld-ov .ic{width:15px;height:15px;color:#9aa8b8;flex:0 0 15px;margin-top:1px}
.bld-ov .ov-t{flex:1;min-width:0}
.bld-ov b{color:#2b3947;font-size:13px;white-space:nowrap;font-variant-numeric:tabular-nums}

/* A long option list scrolls inside its own card. Every option is drawn --
   hiding them defeats the view -- but an 81-option question must not push the
   next one off the screen. */
.sv-opts{max-height:290px;overflow-y:auto;padding-right:4px}
.sv-opts::-webkit-scrollbar{width:7px}
.sv-opts::-webkit-scrollbar-thumb{background:#d6dfe9;border-radius:5px}
.sv-grid{max-height:340px;overflow:auto}
.sv-grid::-webkit-scrollbar{width:7px;height:7px}
.sv-grid::-webkit-scrollbar-thumb{background:#d6dfe9;border-radius:5px}
/* the header row stays put while the statements scroll under it */
.sv-grid thead th{position:sticky;top:0;background:#fff;z-index:1}

/* ── the view's own switch, in its header ────────────────────────────────
   Two icons and a close, so changing what the pane shows never means leaving
   what you are reading. */
/* the same bubble the other controls use */
@media(prefers-reduced-motion:reduce){
}

/* ── both columns end on the same line ──────────────────────────────────────
   .bld-split.with-doc already carries a definite height and .bld-left takes
   height:100% of it. .doc-pane took neither, so its body grew to the length of
   the document and the pane ran hundreds of pixels past the question column
   beside it. It now takes the same height and scrolls its own body, which is
   what .bld-left already does with the row list.
   Guarded to the wide layout: below 900px the split stacks and each pane is
   capped separately, where a shared height would be wrong. */
@media(min-width:901px){
  /* Keyed on the pane being VISIBLE, not on the .with-doc class.
     bldReset() removes .with-doc (public/app.js) while the pane itself stays
     open, so the height was being stripped out from under an open document and
     the split fell back to its content -- the panel grew to the length of the
     questionnaire, thousands of pixels past the question column beside it. A
     class set by one function and cleared by another can disagree with what is
     on screen; the pane's own visibility cannot.

     One box, one height, and each column scrolls inside it. */
  .bld-split.with-doc,
  .bld-split:has(> .doc-pane:not(.hidden)){
    height:min(72vh,760px);align-items:stretch;gap:16px}

  .bld-split.with-doc > .bld-left,
  .bld-split.with-doc > .doc-pane,
  .bld-split:has(> .doc-pane:not(.hidden)) > .bld-left,
  .bld-split:has(> .doc-pane:not(.hidden)) > .doc-pane{
    height:100%;min-height:0;overflow:hidden}

  /* the question list scrolls */
  .bld-split.with-doc > .bld-left > .bld-rows,
  .bld-split:has(> .doc-pane:not(.hidden)) > .bld-left > .bld-rows{
    flex:1;min-height:0;overflow-y:auto}

  /* and so does the document */
  .bld-split.with-doc > .doc-pane > .doc-body,
  .bld-split:has(> .doc-pane:not(.hidden)) > .doc-pane > .doc-body{
    flex:1;min-height:0;overflow:auto}
}

/* ── the document pane can never be taller than this ───────────────────────
   Unconditional, and deliberately so. Every earlier attempt keyed the height
   on something that can be absent when it matters: .with-doc is removed by
   bldReset() while the pane is still open, and a height inherited through flex
   needs every ancestor to have resolved one. A max-height on the pane itself
   depends on nothing -- no class, no parent, no script -- so the pane cannot
   run past the column beside it whatever else is true.

   With the pane capped, the flex row's height is the taller of the two
   columns, and align-items:stretch (the default) brings the shorter one up to
   it. That is what makes them end on the same line. */
.doc-pane{max-height:min(72vh,760px)}
/* and its body takes the space left under the header, and scrolls */
.doc-pane > .doc-body{flex:1 1 auto;min-height:0;overflow:auto}
@media(max-width:900px){
  .doc-pane{max-height:52vh}
}

/* ── the two columns are the same box ──────────────────────────────────────
   The document pane is capped just above. The question column takes the same
   cap, so the two are the same size rather than one being as tall as its own
   content, and each scrolls inside itself: the row list on the left, the
   document on the right.

   Unconditional for the same reason the pane's cap is: a rule that depends on
   .with-doc is removed by bldReset() while the view is still open, and a
   height inherited through flex needs every ancestor to have resolved one. */
.bld-left{max-height:min(72vh,760px)}
.bld-left > .bld-rows{flex:1 1 auto;min-height:0;overflow-y:auto}
/* The scroll container must be the positioned ancestor too, or a jump computed
   against it lands somewhere else. */
.bld-left > .bld-rows,
.doc-pane > .doc-body{position:relative}
@media(max-width:900px){
  .bld-left{max-height:52vh}
}

/* ── the type picker must not be clipped ───────────────────────────────────
   .bld-rows is a scroll container, and a scroll container clips what overflows
   it. While a picker is open the clip is lifted so its list can paint outside
   the box. This has to be at least as specific as the rule that sets the
   scroll, or the later one silently wins it back. */


/* ── the document view scrolls both ways ───────────────────────────────────
   Some questionnaires carry a grid or an option list far wider than the pane.
   Wrapping them to fit turns a table into a column of words, so the pane
   scrolls sideways instead and the content keeps the shape it has in the
   document. */
.doc-pane > .doc-body{overflow:auto;overscroll-behavior:contain}
.doc-body::-webkit-scrollbar{width:9px;height:9px}
.doc-body::-webkit-scrollbar-thumb{background:#cfd8e3;border-radius:5px}
.doc-body::-webkit-scrollbar-corner{background:transparent}
/* A wide table keeps its own width and scrolls within the pane rather than
   being squeezed into it. */
.doc-body.as-doc .dx-t{width:auto;min-width:100%}
.doc-body.as-doc .dx-tw{overflow-x:auto;overflow-y:hidden}
.doc-body.as-survey .sv-grid{overflow:auto;max-height:340px}
.doc-body.as-survey .sv-grid table{width:auto;min-width:100%}
/* Long option wording and long statements stay on one line and scroll with the
   table instead of stacking into a narrow column. */
.doc-body.as-survey .sv-grid td:first-child{white-space:normal;min-width:210px}
.doc-body.as-survey .sv-grid th{white-space:nowrap}

/* ── the reader decides how wide the document is ───────────────────────────
   A questionnaire with a wide grid needs the document; a long list of short
   questions needs the builder. The split is driven by one custom property so
   the drag sets a single number and both columns follow it. */
.bld-split{--doc-w:46%}
.bld-split.with-doc > .doc-pane,
.bld-split:has(> .doc-pane:not(.hidden)) > .doc-pane{
  flex:0 0 var(--doc-w);max-width:none}
.bld-split.with-doc > .bld-left,
.bld-split:has(> .doc-pane:not(.hidden)) > .bld-left{flex:1 1 auto;min-width:0}

/* The grip is only there when there is something to resize. */
.bld-grip{display:none}
.bld-split.with-doc > .bld-grip,
.bld-split:has(> .doc-pane:not(.hidden)) > .bld-grip{
  display:block;flex:0 0 14px;align-self:stretch;cursor:col-resize;
  position:relative;border-radius:6px;background:transparent;
  transition:background .16s}
/* A full-height dotted rule in ink, not a pale 38px tick. A control you have
   to hunt for is one nobody finds: the line has to read as a seam between two
   panels at a glance. */
.bld-grip::before{content:'';position:absolute;top:0;bottom:0;left:50%;
  width:0;border-left:2px dotted #2b3947;transform:translateX(-50%);
  transition:border-color .16s}
/* The grab dots: three in the middle, so the seam also says "pull me". */
.bld-grip::after{content:'';position:absolute;top:50%;left:50%;
  width:6px;height:34px;transform:translate(-50%,-50%);border-radius:4px;
  background:#fff;
  box-shadow:0 -9px 0 -2px #2b3947, 0 0 0 -2px #2b3947, 0 9px 0 -2px #2b3947;
  transition:box-shadow .16s}
.bld-grip:hover{background:#eef4fd}
.bld-grip:hover::before,.bld-grip:focus-visible::before{border-color:#2f6fd0}
.bld-grip:hover::after,.bld-grip:focus-visible::after{
  box-shadow:0 -9px 0 -2px #2f6fd0, 0 0 0 -2px #2f6fd0, 0 9px 0 -2px #2f6fd0}
body.bld-resizing .bld-grip::before{border-color:#2f6fd0}
.bld-grip:focus-visible{outline:2px solid #2f6fd0;outline-offset:1px}
/* While dragging, the pointer owns the page: no text selection anywhere and
   the cursor stays a resize arrow even off the 10px strip. */
body.bld-resizing{cursor:col-resize;user-select:none}
body.bld-resizing .doc-body,body.bld-resizing .bld-rows{pointer-events:none}
@media(max-width:900px){
  .bld-split.with-doc > .bld-grip,
  .bld-split:has(> .doc-pane:not(.hidden)) > .bld-grip{display:none}
  .bld-split.with-doc > .doc-pane,
  .bld-split:has(> .doc-pane:not(.hidden)) > .doc-pane{flex:1 1 auto}
}

/* ═══ RESULTS: screen shows the answer, print keeps the working ════════════
   The results panel led with a headline figure and then eight more blocks --
   percentiles, three scores, section and question breakdowns, recommendations,
   drivers. On screen that buries the number people came for.

   Hidden on SCREEN only. The PDF export is window.print(), so it renders this
   markup: a print-time display:none would have quietly stripped the detail out
   of the report as well. The Excel workbook is built from adjusted(), which is
   data and never touches the DOM, so it is unaffected either way.

   Nothing is deleted and no JS changed -- every element is still in the DOM and
   still written to, so unhiding a section is removing one class. */
/* .removed — gone from the screen AND the printed report. These are the
   elements pulled from the output entirely: band coverage, the P25-P75 line,
   complexity/fatigue/mobile, recommendations, section-wise duration and the
   drivers list. The markup stays so the decision is reversible and the reason
   is on the record; nothing renders it. */
.removed { display: none !important; }

@media screen {
  .ui-collapsed { display: none !important; }
  /* with the range and pill gone, the figure carries the card on its own */
  .loi-card { align-items: flex-start; }
  .loi-big { font-size: clamp(44px, 6vw, 64px); line-height: 1; letter-spacing: -2px; }
  .loi-big small { font-size: 18px; margin-left: 4px; }
  .loi-eyebrow { font-size: 11px; letter-spacing: .12em; }
  .pa-top { grid-template-columns: 1fr; }
}

/* the source file, kept beside the builder heading while its estimate is live */
.bld-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bld-file { font-size: 11.5px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 46ch; }

/* ═══ RESULT HEAD — title, source, figure and Export on one line ═══════════
   The estimate sat in a card below the head while the head carried only a
   title, so the number people came for was the second thing on the page. It
   joins the line that already names the document it describes.

   #loiNum and the card it lives in are untouched and still written to -- the
   print export renders them, and screen-only hiding keeps the report whole. */
.pa-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pa-title { flex: 1; min-width: 0; }
/* .pa-head is a dark navy gradient, so everything in here is light. The first
   version used var(--navy) on var(--navy) and the figure was unreadable. The
   key and unit follow .pa-file, which is the tone already used on this bar. */
.pa-loi { display: flex; flex-direction: column; gap: 1px; flex: none;
  padding: 0 18px;
  border-left: 1px solid rgba(255,255,255,.16);
  border-right: 1px solid rgba(255,255,255,.16); }
.pa-loi-k { font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #a8c6e8; }
.pa-loi b { font-size: 30px; font-weight: 700; letter-spacing: -1px; color: #fff;
  line-height: 1.05; font-variant-numeric: tabular-nums lining-nums; }
.pa-loi b small { font-size: 13px; font-weight: 500; color: #9db3cf; margin-left: 3px; }

/* the intro card belongs to the screen; print opens with its own masthead */
@media print { .screen-only { display: none !important; } }
@media (max-width: 720px) {
  .pa-loi { border: 0; padding: 0; }
}

/* ═══ RESULT ON TOP ════════════════════════════════════════════════════════
   On the result screen the builder stays on screen beneath the totals it
   produced, but it was ABOVE them: the page opened with "Reading <file> —
   detecting each question" and the estimate was below all of it.

   The panel is reordered rather than moved, because #page-result and
   #page-loading are separate sections and app.js addresses both by id --
   relocating one in the DOM would be a bigger change than the layout needs.

   Scoped with :has() so it applies only while the result is showing; upload,
   privacy and terms keep .content as the block they were laid out as. The
   stylesheet already relies on :has() elsewhere. */
.content.has-result,
.content:has(#page-result:not(.hidden)) {
  display: flex;
  flex-direction: column;
}
.content.has-result #page-result,
.content:has(#page-result:not(.hidden)) #page-result { order: -1; }

/* the intro card belongs to whichever block is first, so the builder drops its
   own heading while the result is on screen and the two do not repeat */
.content.has-result #page-loading > .page-head,
.content:has(#page-result:not(.hidden)) #page-loading > .page-head { display: none; }

/* ═══ AFTER THE EDITORIAL STRIP ════════════════════════════════════════════
   .grid2 is a two-column pair and section-wise duration was one of the two, so
   removing it left question-wise in one column with an empty column beside it.
   One visible child means one column. */
.grid2:has(> .sub-card.removed) { grid-template-columns: 1fr; }
/* both children are removed now, so the wrapper would leave a 16px gap and a
   stretch row behind an empty grid */
.grid2:not(:has(> .sub-card:not(.removed))) { display: none; }

/* The detect card must sit on the foot of the PANE, with the row list scrolling
   above it -- so the panel fills the height (it already did, #page-loading
   .builder is flex:1) and the column inside it has to fill too.

   .bld-left carries max-height:min(72vh,760px). That cap exists to keep the
   question column and the document pane the same size, and while a document is
   open it still does: .bld-split then takes a definite height and both columns
   take height:100% of it. With no document open there is no second column to
   match, and the cap just stopped the only column short of the panel -- which is
   where the dead space came from. Lifted for the loading pane only; the result
   page, where .builder is a block and nothing bounds the list, keeps it. */
.content.busy .bld-left { max-height: none; }
.content.busy .bld-left > .bld-detect { margin-top: auto; }

/* ═══ AUDIENCE PANEL SITS WITH THE ESTIMATE ════════════════════════════════
   It is the one control that changes the number, so it belongs beside it
   rather than below the question list. Ordered, not moved: #page-demo is its
   own section that app.js addresses by id.

   It also carried a panel's worth of padding for three selects and a sentence,
   so it is tightened here -- this is a strip on the result screen, not a page
   of its own. */
.content.has-result #page-result,
.content:has(#page-result:not(.hidden)) #page-result { order: -2; }
.content:has(#page-result:not(.hidden)) #page-demo   { order: -1; }

.content:has(#page-result:not(.hidden)) #page-demo .panel.demo { padding: 14px 18px; }
.content:has(#page-result:not(.hidden)) #page-demo .demo-head { margin-bottom: 10px; }
.content:has(#page-result:not(.hidden)) #page-demo .demo-head h3 { font-size: 14px; }
.content:has(#page-result:not(.hidden)) #page-demo .demo-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.content:has(#page-result:not(.hidden)) #page-demo .demo-grid label { font-size: 11.5px; }
.content:has(#page-result:not(.hidden)) #page-demo .demo-note {
  font-size: 11.5px; margin-top: 10px; line-height: 1.5; }
@media (max-width: 820px) {
  .content:has(#page-result:not(.hidden)) #page-demo .demo-grid { grid-template-columns: 1fr; }
}

/* ═══ RESULT PANEL AFTER THE STRIP ═════════════════════════════════════════
   Everything .pa-body held is now hidden on screen or removed outright, so it
   rendered as an empty padded card hanging under the header. The header IS the
   panel on screen now, so it takes the panel's corners; the body keeps its
   padding for print, where the LOI card and percentiles still print.

   #warnBox stays -- it is inside .pa-body but must still be able to speak, so
   it is lifted out of the collapse and only takes space when it has content. */
@media screen {
  /* .pa-top is back: it was hidden while every field inside it had been
     removed and it rendered as an empty padded card. The percentiles card is
     on the page again, so the row shows -- and with .loi-card still collapsed
     the percentiles take the full width rather than sitting in the right-hand
     column of a 1fr 1.5fr grid with an empty column beside them. */
  /* the LOI card is back beside the percentiles, so the row is two columns
     again rather than the single one it took while the card was collapsed */
  .pa-top { grid-template-columns: 1fr 1.5fr; }
  .pa-body { padding: 0 22px 18px; }
  .pa-body > #warnBox:not(:empty) { padding: 14px 22px 16px; display: block; }
  /* .panel.pa is the wrapper: its own padding and border would frame an empty
     card, so on screen the header IS the panel. */
  /* No overflow:hidden here. The Export menu is absolutely positioned below
     the head, and with the panel collapsed to just that head the menu now
     extends past the panel box -- clipping it hid the menu entirely. The
     rounded corners come from .pa-head itself, so nothing needs clipping. */
  .panel.pa { padding: 0; border: 0; overflow: visible; background: transparent; }
  .pa { overflow: visible; }
  /* and it must paint above the panels that follow it in the DOM */
  .export-wrap { z-index: 60; }
  .export-menu { z-index: 61; }
  .panel.pa .pa-head { border-radius: 12px; }
  .pa-body { gap: 0; }

  /* the step badges numbered a three-step flow that no longer exists: the
     page is an estimate, an audience control and the questions */
  .pa-no, .bld-no { display: none; }
  .pa-head { gap: 14px; }
  .bld-head, .demo-head { gap: 10px; }

  /* the audience strip, tighter again */
  .content:has(#page-result:not(.hidden)) #page-demo .panel.demo { padding: 12px 16px; }
  .content:has(#page-result:not(.hidden)) #page-demo .demo-head { margin-bottom: 8px; }
  .content:has(#page-result:not(.hidden)) #page-demo .demo-head h3 { font-size: 13.5px; }
  .content:has(#page-result:not(.hidden)) #page-demo .demo-grid { gap: 10px; }
  .content:has(#page-result:not(.hidden)) #page-demo .demo-grid label { font-size: 11px; }
  .content:has(#page-result:not(.hidden)) #page-demo .sel select { padding: 8px 10px; font-size: 13px; }
  .content:has(#page-result:not(.hidden)) #page-demo .demo-note { font-size: 11px; margin-top: 8px; }
}

/* ═══ RUNNING TOTAL — at the edge, and explained ═══════════════════════════
   flex:1 sat on the h3, but the heading is wrapped in .bld-title now so the
   file name can sit under it. The wrapper never grew, so the total came to
   rest beside the title instead of at the right edge. */
.bld-head .bld-title { flex: 1; }
.bld-head h3 { flex: 0 0 auto; }
.bld-head .bld-total { margin-left: auto; }

/* "14.1 / 13.2 min" is two different quantities and the pair says neither. The
   label names whichever the model leads with; this says what both are. */
.bld-help { width: 16px; height: 16px; flex: none; border: 0; border-radius: 50%;
  background: #d3e3f5; color: #3f6690; font-size: 10.5px; font-weight: 700;
  line-height: 16px; text-align: center; cursor: help; padding: 0; margin-left: 2px; }
.bld-help:hover { background: #c2d8ef; color: #26456b; }
.bld-help:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ═══ AUDIENCE STRIP — caption beside its control ══════════════════════════
   Stacked, each pair took two lines and the three of them made the strip as
   tall as a panel. Laid out in a row the caption and its select share one line
   and the row is half the height, which is what this is now: a control strip
   between the estimate and the questions, not a page.

   The caption is a bare text node inside <label>, so it becomes an anonymous
   flex item -- it cannot be targeted, but it sizes to its content and the
   select takes the rest, which is the arrangement wanted. Scoped to the result
   screen; the standalone panel keeps the stacked form, where there is room. */
.content:has(#page-result:not(.hidden)) #page-demo .demo-grid label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.content:has(#page-result:not(.hidden)) #page-demo .demo-grid .sel {
  flex: 1;
  min-width: 0;
}
/* three captions of different lengths would leave the selects ragged, so the
   columns size to their content instead of thirds */
.content:has(#page-result:not(.hidden)) #page-demo .demo-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 22px;
}
@media (max-width: 900px) {
  .content:has(#page-result:not(.hidden)) #page-demo .demo-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══ SELECTS — the popup the OS draws, not the box we style ═══════════════
   The closed control was already styled, so the black was the OPEN list: the
   native popup follows the operating system's colour scheme, and on a machine
   set to dark it renders dark on a light page.

   color-scheme:light is the fix. It tells the browser to draw this control's
   native parts -- popup, scrollbar, focus ring -- in the light scheme
   regardless of the OS setting. Styling `option` alone does not do it, because
   macOS ignores those rules; the two together cover every platform.

   Applied to every select in the app so they match each other as well as the
   page: the three audience controls and the question-order picker. */
.app select,
.demo-grid select,
#qOrder,
.sel select {
  color-scheme: light;
}
.demo-grid option,
#qOrder option,
.sel select option {
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}
.demo-grid option:checked,
#qOrder option:checked,
.sel select option:checked {
  background: #eaf3fc;
  color: var(--navy);
  font-weight: 600;
}

/* the question-order picker was the odd one out -- a bare native select beside
   controls that had all been given a border, a radius and a chevron */
#qOrder {
  appearance: none; -webkit-appearance: none;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--ink); background: #fff;
  padding: 7px 28px 7px 11px;
  border: 1px solid #d9e1ea; border-radius: 9px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7480' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
#qOrder:hover { border-color: #b9c8d8; }
#qOrder:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(59,201,242,.22); }

/* ═══ THE ESTIMATE — lit, because it is the answer ═════════════════════════
   The figure sits on a dark navy bar, which is the one place on this page a
   glow reads as emphasis rather than decoration: light on dark carries, the
   same treatment on a white card would just look blurred.

   Three layers, all cheap: a soft cyan bloom behind the number, a tight white
   halo on the glyphs themselves, and a faint cyan wash on the cell. No
   animation -- a number that pulses is a number people stop reading. */
/* No cell, no box -- the light comes off the glyphs alone. The bloom behind the
   number, the inset top hairline and the base cell's side borders together read
   as a lit panel sitting on the bar, which is not what was wanted. */
.pa-loi { border-left: 0; border-right: 0; background: none; }
/* Bigger, heavier, and spaced back out. At 30px/-1px the digits nearly touched,
   so a wide halo closed the gaps between them and the figure read as one soft
   mass. Weight and air do the emphasis; the glow only lights it. */
.pa-loi b {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: #fff;
  text-shadow: 0 0 16px rgba(126,224,255,.42), 0 0 40px rgba(59,201,242,.20);
}
/* Everything in the cell is white now -- the key and the unit were #a8c6e8 and
   #9db3cf, blue-grey against a white figure, which is what made the group look
   unfinished rather than lit. */
/* One line, label in front of the figure: "Estimated LOI 14.1 min". The base
   rule stacks them in a column with a 10px uppercase key; here the key is set
   big and lit like the figure, so the whole phrase reads as one lit statement
   rather than a caption sitting on top of a number. */
.pa-loi { flex-direction: row; align-items: baseline; gap: 12px; }
.pa-loi-k {
  font-size: 22px; font-weight: 700;
  letter-spacing: -.2px; text-transform: none; white-space: nowrap;
  color: #fff; opacity: .92;
  text-shadow: 0 0 16px rgba(126,224,255,.42), 0 0 40px rgba(59,201,242,.20);
}
.pa-loi b small { color: #fff; opacity: .78; font-weight: 600; text-shadow: none; }

/* The estimate is the answer this whole screen exists to give, so the bar it
   sits on gets the room to say it: deeper padding, and the figure stepped up
   34 -> 42. Enough to lead the page without turning the header into a hero
   banner -- the questionnaire name beside it still has to stay readable. */
.pa-head { padding: 26px 24px; }
.pa-loi b { font-size: 42px; }
.pa-loi-k { font-size: 26px; }
.pa-loi b small { font-size: 16px; margin-left: 4px; }

/* The questionnaire name was #7fa3cc -- a blue-grey that reads as disabled
   next to a white figure on the same bar. It is the one thing on the screen
   that says WHICH survey this estimate is for, so it gets white too, held
   just below the title's weight so the hierarchy survives. */
.pa-file { color: #fff; opacity: .86; font-size: 13px; }



/* ── AI assist opt-in on the import page ─────────────────────────────────────
   Deliberately quiet: it is an option, not a call to action. Same card idiom as
   the mode row above it so it does not read as a warning. */

/* A question the AI pass suggested. Marked so it is never mistaken for one the
   document itself numbered -- the estimate is the same, the provenance is not. */
.chip.ai { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; font-weight: 700; }


/* The running-total help bubble. [data-tip] is nowrap and centred, which is
   right for a three-word label on a button in the middle of a row; this one is
   a paragraph on a control near the panel's right edge, so it wraps and hangs
   from the right instead of running off the side. */
.bld-help[data-tip]::after {
  white-space: normal; width: 264px; line-height: 1.45; text-align: left;
  left: auto; right: -6px; transform: translateY(-3px); padding: 9px 11px;
}
.bld-help[data-tip]:hover::after { transform: translateY(0); }
.bld-help[data-tip]::before { left: auto; right: 6px; margin-left: 0; }

/* Share of the questions' total time, beside the duration. From LOI-Predictor's
   ReviewPanel, which leads each row with impact rather than with a confidence
   score. Quiet by design: it ranks what is worth checking, it does not claim
   anything is wrong. */
.bld-line .imp { font-size: 11px; font-weight: 700; color: #6b8bb0;
  text-align: right; position: relative; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.d-tags .tag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: #eef4fb; color: #416186; }
.d-tags .tag-strong { background: #dbeafe; color: #1e40af; }

/* The real .docx, rendered by docx-preview. Word's own page furniture is not
   wanted inside a side panel: the page boxes become plain blocks so the document
   flows in the pane it is given. Question marking is ours and sits on top. */
.doc-body.as-real { padding: 0 4px; }
.doc-body.as-real .docx-wrapper { background: transparent; padding: 0; }
.doc-body.as-real .docx { box-shadow: none; margin: 0 0 10px; padding: 0;
  width: auto !important; min-height: 0 !important; }
.doc-body.as-real .dx-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 8px;
  -webkit-overflow-scrolling: touch; }
.doc-body.as-real .dx-scroll::-webkit-scrollbar { height: 8px; }
.doc-body.as-real .dx-scroll::-webkit-scrollbar-thumb { background: #cfd8e3; border-radius: 5px; }
.doc-body.as-real .dx-scroll > table { max-width: none; }
/* Word fixes a row's height for the text at ITS page width. At ours the same
   text is taller, and a fixed height makes it spill over whatever follows --
   which is the question box drawn on top of the grid above it. */
.doc-body.as-real tr, .doc-body.as-real td, .doc-body.as-real th {
  height: auto !important; min-height: 0 !important; }
.doc-body.as-real .is-q { background: #eaf4ff; outline: 1px solid #bcd8f5; border-radius: 5px; }
/* The real Word file prints its own question number, in whatever position and
   format that file's own author chose -- often not the same number our parser
   assigned. Our tag used to be inserted inline as the paragraph's first word,
   which sits directly against (and for Word's own list-numbered paragraphs,
   often visually on top of) whatever the document already renders there. Its
   own line removes the collision regardless of the document's own numbering
   style or how the two numbers compare. */
.doc-body.as-real .doc-q-tag { display: block; width: fit-content; margin: 0 0 3px; }

/* The restored percentiles card, at a reduced height: it is a second reading of
   a number the bar above already gives, so it gets less room than it had. The
   page scrolls (.content is overflow-y:auto), so the extra height costs the
   reader a little scroll rather than squeezing anything above it. */
@media screen {
  .pa-body > .pa-top { margin-top: 14px; }
  .pct-card { padding: 14px 16px; }
  .pct-card h4 { margin: 0 0 2px; }
  .pct-card .muted { margin: 0 0 10px; font-size: 11.5px; }
  .pct .col { height: 64px; }
  .pct .v { font-size: 13px; }
  .pct .k { font-size: 10px; letter-spacing: .06em; }
}

/* ── the builder is TALLER, and nothing leaves the card ──────────────────────
   The height must sit on .bld-split, the container the panel measures -- NOT on
   .bld-left. Putting it on the child grew the column past the panel that paints
   the white card, so the rows carried on down the grey page outside it.

   .bld-split is the box; .bld-left fills it and scrolls inside. That also keeps
   the two columns equal for free when the document pane is open, because both
   are children of the same sized box.

   Screen only. The loading pane keeps its own bounded layout, where the detect
   card has to sit on the foot of a bounded pane. */
@media screen {
  .content.has-result .bld-split,
  .content:has(#page-result:not(.hidden)) .bld-split {
    height: clamp(1040px, 132vh, 2000px);
    min-height: 0;
  }
  /* every column takes the box's height and scrolls its own contents; the floor
     and cap are cleared here so no child can push past the box again */
  .content.has-result .bld-split > .bld-left,
  .content.has-result .bld-split > .doc-pane,
  .content:has(#page-result:not(.hidden)) .bld-split > .bld-left,
  .content:has(#page-result:not(.hidden)) .bld-split > .doc-pane {
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }
}


/* ── the builder, full screen ────────────────────────────────────────────────
   The control sits at the right edge of the builder's own header, beside the
   Removed toggle. Off, it changes nothing: the panel is exactly as it was.

   On, the panel is lifted out of the page flow to cover the window, and the
   split takes the height that is left after the header. Fixed rather than
   inset into .content, so it clears the sidebar as well -- a questionnaire read
   full screen wants the whole window, not the column beside the navigation. */
/* the Removed toggle used to be the element that pushed right; the button now
   holds that job, so the toggle sits beside it rather than fighting it */
.bld-head .bld-deleted { margin-left: 8px; }

/* Fixed to the PAGE AREA, not the window: the offsets are measured from
   .content when the toggle fires and written onto the panel, so the sidebar and
   the top bar stay visible and usable. Measured rather than hardcoded because
   the sidebar collapses at narrow widths and a fixed 264px would be wrong there
   the moment anything about it changes. */

/* the estimate, shown only in full screen and only ahead of the control */
/* the control keeps its place at the right edge, after the estimate */
/* the split takes whatever the header leaves, overriding the page-area height */
/* the page behind must not scroll under the overlay */

/* ── the per-question preview, inside a row's drawer ─────────────────────────
   Replaced the duration bar, which restated a number already on the row a few
   pixels above it. Two columns: what the question IS on the left, what a
   respondent would be shown on the right.

   The answer widget is the survey view's own (.sv-opts, .sv-grid, .sv-mark),
   so there is one renderer and the two cannot drift. */
.dq { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 22px; align-items: start; padding: 4px 2px 2px; }
.dq-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dq-chip { display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: #eef2f7; color: #33506f; font-size: 12px; font-weight: 700;
  white-space: nowrap; position: relative; }
.dq-conf { background: #e9eef5; }
.dq-q { margin: 0; font-size: 17px; line-height: 1.35; font-weight: 700;
  color: var(--navy, #0b2b5c); }
.dq-ask { margin: 8px 0 0; font-size: 13.5px; color: #6a7c92; }

/* the answer side sits on its own quiet card, as a respondent would meet it */
.dq-r > .sv-opts,
.dq-r > .sv-open { background: #f5f7fa; border: 1px solid #e8edf3; border-radius: 12px;
  padding: 14px 16px; margin: 0; max-height: 260px; overflow-y: auto; }
.dq-r .sv-opt { display: flex; align-items: center; gap: 11px; padding: 7px 0;
  font-size: 14px; color: #23364d; }
.dq-r .sv-note { margin: 8px 2px 0; font-size: 12px; color: #7c8ea3; }
.dq-r .sv-grid { max-width: 100%; overflow-x: auto; }
.dq-r .sv-grid table { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.dq-r .sv-grid th { background: var(--navy-d, #0b2b5c); color: #fff; font-weight: 700;
  padding: 9px 11px; text-align: center; vertical-align: middle; }
.dq-r .sv-grid th:first-child { text-align: left; }
.dq-r .sv-grid td { border: 1px solid #e3e9f0; padding: 9px 11px; text-align: center;
  vertical-align: middle; background: #fff; }
.dq-r .sv-grid td:first-child { text-align: left; font-weight: 700; color: var(--navy, #0b2b5c); }

@media (max-width: 900px) { .dq { grid-template-columns: 1fr; gap: 14px; } }

/* the two view buttons on the builder header */
.bld-views { display: flex; gap: 6px; margin-left: auto; }
.bld-view { display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; position: relative; flex: none;
  border: 1px solid var(--line, #dde5ee); border-radius: 8px; background: #fff;
  color: #4a6b90; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.bld-view:hover { background: #f2f7fc; color: var(--navy, #0b2b5c); border-color: #bcd0e4; }
.bld-view[aria-pressed="true"] { background: var(--navy, #0b2b5c); border-color: var(--navy, #0b2b5c);
  color: #fff; }
.bld-view .ic { width: 15px; height: 15px; }
.bld-head .bld-deleted { margin-left: 8px; }

/* The statement column stays put while the scale scrolls. A wide grid is read
   by scrolling right, and a scale point means nothing once the statement it
   belongs to has gone off the left edge. */
.dq-r .sv-grid { position: relative; }
.dq-r .sv-grid td:first-child,
.dq-r .sv-grid th:first-child { position: sticky; left: 0; z-index: 1; }
.dq-r .sv-grid td:first-child { background: #f5f7fa; box-shadow: 1px 0 0 #e3e9f0; }
.dq-r .sv-grid th:first-child { background: var(--navy-d, #0b2b5c); }
/* long statements wrap rather than forcing the table wider still */
.dq-r .sv-grid td:first-child { min-width: 150px; max-width: 230px; white-space: normal; }
.dq-r .sv-grid th { white-space: normal; min-width: 84px; }

/* Close, beside the two view buttons. Quieter than them: it undoes rather than
   chooses, and it is hidden entirely while nothing is open -- an inert control
   sitting permanently beside two live ones is just noise. */
.bld-view-x { color: #8a9cb3; }
.bld-view-x:hover { background: #fdf0f0; border-color: #f0c8c8; color: #b4443f; }
.bld-view-x .ic { width: 13px; height: 13px; }

/* ── the grid's two sticky axes, stacked in the right order ──────────────────
   The header row is sticky (top) and the statement column is sticky (left).
   Both were z-index 1, and body cells come later in the DOM, so at equal
   z-index the statement column painted OVER the header row: scrolling down put
   statements on top of the scale labels.

   Three layers, and the corner has to be highest because it belongs to both
   sticky axes at once. */
.dq-r .sv-grid thead th { position: sticky; top: 0; z-index: 2; }
.dq-r .sv-grid td:first-child { z-index: 1; }
.dq-r .sv-grid thead th:first-child { z-index: 3; }
/* Sticky cells must be opaque or the rows show through them as they pass
   underneath. border-collapse:separate is already set here, which is what lets
   a sticky cell keep its own background at all. */
.dq-r .sv-grid thead th { background: var(--navy-d, #0b2b5c); }
.dq-r .sv-grid tbody td:first-child { background: #f5f7fa; }

/* ── the builder must appear even without :has() ─────────────────────────────
   The only rule giving .bld-split a definite height on the result screen is
   scoped with .content:has(#page-result:not(.hidden)). A browser without :has()
   drops that selector as invalid, and then .bld-rows -- flex:1, i.e. flex-basis
   0% -- has no free space to grow into and resolves to ZERO. The panel is in
   the DOM, styled, and nothing is visible inside it. :has() shipped in Firefox
   only in 121 (Dec 2023), so this is an ordinary browser, not an ancient one.

   Two layers, because @supports selector() is itself unsupported in browsers
   old enough to matter here:

   1. an unconditional floor, so the rows can never collapse to nothing
      whatever else fails; harmless where the layout already works because the
      list is always taller than this. */
.bld-rows { min-height: 140px; }

/* 2. and where the browser can tell us it lacks :has(), a full fallback: the
      rows size to their content and cap, instead of depending on a definite
      height arriving from an ancestor that no longer matches. */
@supports not selector(:has(*)) {
  .bld-left { max-height: min(78vh, 900px); }
  .bld-left > .bld-rows,
  .bld-split > .bld-rows,
  .bld-rows {
    flex: 0 1 auto;
    max-height: min(70vh, 820px);
    overflow-y: auto;
  }
  /* .content is a plain block there, so the result cannot be re-ordered above
     the builder. It reads in DOM order instead -- worse, but whole. */
  .bld-split { min-height: 320px; }
}

/* ── the page scrolls on the result screen ───────────────────────────────────
   .shell is height:100vh with overflow:hidden and .main is overflow:hidden, so
   the DOCUMENT can never scroll: only .content can, and a wheel over the
   question list scrolled that list while the page stayed still. That is the
   "cannot scroll below" -- a fixed page height, exactly as reported.

   On the result screen the shell grows with its content and the document
   scrolls. The sidebar sticks to the top so it stays usable down a long page
   instead of stretching to the length of the questionnaire.

   The LOADING screen keeps the bounded shell: the detect card is pinned to the
   panel foot there and only the row list moves, which needs the pane bounded. */
body.result-open .shell { height: auto; min-height: 100vh; overflow: visible; }
body.result-open .main { overflow: visible; min-height: 0; }
body.result-open .content { overflow: visible; min-height: 0; flex: 0 1 auto; }
body.result-open .sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
}
@media (max-width: 900px) {
  /* the shell stacks here, so a sticky sidebar would sit on top of the page */
  body.result-open .sidebar { position: static; height: auto; }
}


/* ── release the ROOT height on the result screen ────────────────────────────
   html and body carry height:100% -- fixed, not a minimum -- so however tall
   the shell grows, the two boxes containing it stay exactly one viewport and
   the rest is unreachable. Freeing .shell without freeing these did nothing,
   which is why the page still would not scroll after several attempts.

   min-height keeps a short result filling the window; height:auto lets a long
   one grow past it and the document scroll, which is the whole point. */
html.result-open,
body.result-open {
  height: auto;
  min-height: 100%;
  overflow: visible;
}






/* ── the builder box, done simply ────────────────────────────────────────────
   This replaces every forced height, !important and inline style that came
   before it, all of which fought the flex algorithm and lost -- and the last
   round pushed content out of the white card entirely.

   Nothing here sets a height on a container. The two SCROLLERS are capped at
   the same value, which is all the problem ever needed:

     - the question list and the document body each stop at 46vh and scroll;
     - so both columns are that tall plus their own header, which makes them
       equal without either being told a number;
     - the card wraps them, because nothing is taller than its parent;
     - the page scrolls for whatever is below, because no ancestor is pinned.

   A cap on the thing that scrolls cannot overflow its parent. A height on the
   parent can, and did. */
.bld-rows,
.bld-left > .bld-rows {
  max-height: 46vh;
  overflow-y: auto;
}
.doc-pane > .doc-body {
  max-height: 46vh;
  overflow: auto;
}
/* the columns take their content's height, so the pair matches by construction */
.bld-split > .bld-left,
.bld-split > .doc-pane {
  height: auto;
  max-height: none;
  min-height: 0;
  align-self: stretch;
}

/* The two scrollers, made obvious. A box that scrolls but shows no scrollbar
   until you touch it reads as a box that has been cut off -- which is what the
   question list looked like for most of this. A visible track, room for it, and
   a hairline where the content runs under the edge. */
.bld-left > .bld-rows,
.doc-pane > .doc-body {
  scrollbar-width: thin;
  scrollbar-color: #c3d0de transparent;
  padding-right: 8px;
  overscroll-behavior: contain;
}
.bld-left > .bld-rows::-webkit-scrollbar,
.doc-pane > .doc-body::-webkit-scrollbar { width: 9px; }
.bld-left > .bld-rows::-webkit-scrollbar-thumb,
.doc-pane > .doc-body::-webkit-scrollbar-thumb {
  background: #c3d0de; border-radius: 6px;
  border: 2px solid transparent; background-clip: content-box;
}
.bld-left > .bld-rows::-webkit-scrollbar-thumb:hover,
.doc-pane > .doc-body::-webkit-scrollbar-thumb:hover { background: #9fb3c8; background-clip: content-box; }
.bld-left > .bld-rows::-webkit-scrollbar-track,
.doc-pane > .doc-body::-webkit-scrollbar-track { background: transparent; }

/* Routing: a question only some respondents are asked. The marker sits on the
   question number so the row keeps its layout; the condition is in the drawer. */
.bld-row.routed .q::after { content: " \2197"; color: #b45309; font-weight: 700; }
.d-route { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px;
  padding: 8px 10px; border-radius: 8px; background: #fff7ed; color: #7c2d12; font-size: 12.5px; }
.d-route .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; }
