/* Survey Studio: a calm working tool. Green accent, warm-green neutrals, grotesk type, mono for figures. */
:root {
  --bg: #f4f7f5; --surface: #ffffff; --sunk: #eaf0ec; --line: #d6dfd9; --line-strong: #b9c7bf;
  --ink: #132019; --muted: #586960; --accent: #0f6b4a; --accent-ink: #ffffff; --accent-weak: #e1f0e8;
  --danger: #b4332b; --danger-weak: #fbeceb; --warn: #9a5b00; --warn-weak: #fdf3e2; --ok: #1d7d47;
  --focus: #1f6fc2;
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 10px; --shadow: 0 1px 2px rgb(19 32 25 / .06), 0 4px 16px rgb(19 32 25 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1411; --surface: #151e19; --sunk: #1b2620; --line: #29372f; --line-strong: #3a4b41;
    --ink: #e3ece6; --muted: #98aaa0; --accent: #4fc58e; --accent-ink: #05140c; --accent-weak: #18352a;
    --danger: #ef6b61; --danger-weak: #3a1d1b; --warn: #e3a447; --warn-weak: #3a2c15; --ok: #5dcf8c;
    --focus: #6aa8ef; --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 700; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.wrap { max-width: 1040px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
.narrow { max-width: 720px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: .95rem;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn.danger.solid { background: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunk); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .875rem; }
.btn.icon { width: 36px; min-height: 36px; padding: 0; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* forms */
label.field, .field { display: grid; gap: 6px; }
.field > span, .label { font-weight: 600; font-size: .92rem; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  min-height: 44px; padding: 9px 12px; }
textarea { min-height: 96px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
.check { display: inline-flex; gap: 10px; align-items: center; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.hint { font-size: .85rem; color: var(--muted); }
.error { color: var(--danger); font-weight: 600; font-size: .9rem; }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--accent-weak); font-size: .92rem; }
.notice.warn { background: var(--warn-weak); }
.notice.bad { background: var(--danger-weak); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; border: 1px solid currentColor; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.open { color: var(--ok); } .pill.draft { color: var(--muted); } .pill.closed { color: var(--warn); }

/* app header */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.mark { width: 24px; height: 24px; flex: none; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* toast + modal */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .92rem; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.scrim { position: fixed; inset: 0; z-index: 50; background: rgb(10 16 13 / .45); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 14px; padding: 22px; width: min(460px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); max-height: calc(100vh - 32px); overflow: auto; }

/* auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth .card { width: min(420px, 100%); padding: 26px; display: grid; gap: 16px; box-shadow: var(--shadow); }

/* dashboard */
.page { padding-block: 28px 64px; }
.list { display: grid; gap: 10px; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 16px; align-items: center; }
.srow h3 a { color: var(--ink); text-decoration: none; }
.srow h3 a:hover { text-decoration: underline; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86rem; color: var(--muted); align-items: center; }
.tpl-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.tpl { text-align: left; display: grid; gap: 4px; align-content: start; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.tpl:hover { border-color: var(--accent); }
.tpl b { font-size: 1rem; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 15; min-width: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; display: grid; }
.menu-pop button { text-align: left; background: none; border: 0; font: inherit; padding: 9px 12px; border-radius: 6px; cursor: pointer; color: var(--ink); }
.menu-pop button:hover { background: var(--sunk); }
.menu-pop button.danger { color: var(--danger); }

/* builder */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.title-input { font-size: 1.15rem; font-weight: 700; border-color: transparent !important; background: transparent !important; padding-inline: 8px; min-width: 0; }
.title-input:hover, .title-input:focus { border-color: var(--line-strong) !important; background: var(--surface) !important; }
.savestate { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.qcard.open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.qhead { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; cursor: pointer; width: 100%; background: none; border: 0; font: inherit; color: inherit; text-align: left; }
.qnum { font-family: var(--mono); color: var(--muted); font-size: .85rem; min-width: 2.2ch; padding-top: 2px; }
.qtype { font-size: .78rem; color: var(--muted); }
.qbody { padding: 0 16px 16px; display: grid; gap: 14px; }
.qcard.section { background: var(--sunk); border-style: dashed; }
.chev { width: 20px; height: 20px; flex: none; color: var(--muted); margin-top: 1px; transition: transform .2s; }
.qcard.open .chev { transform: rotate(180deg); color: var(--accent); }
.badge { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--accent-weak); color: var(--accent); font-weight: 700; font-size: .72rem; line-height: 1.6; vertical-align: 1px; }
.logic { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
.logic summary { cursor: pointer; }
.logic-body { display: grid; gap: 10px; margin-top: 10px; }
.lrule { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; align-items: center; }
.lrule select, .lrule input { min-height: 40px; padding: 6px 8px; }
@media (max-width: 560px) { .lrule { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; } .lrule [data-lg="q"] { grid-column: 1 / -1; } }
.opt-edit { display: grid; gap: 8px; }
.opt-line { display: flex; gap: 8px; align-items: center; }
.opt-line .dot { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-radius: 50%; flex: none; }
.opt-line .dot.sq { border-radius: 4px; }
.qtools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.two { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.typegrid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
.typegrid button { text-align: left; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font: inherit; cursor: pointer; color: var(--ink); }
.typegrid button:hover { border-color: var(--accent); background: var(--accent-weak); }
.sharebox { display: flex; gap: 8px; }
.sharebox input { font-family: var(--mono); font-size: .9rem; }

/* respondent */
.rs { max-width: 680px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left, 0px)) 64px max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 16px; }
.rs-head { display: grid; gap: 8px; padding-bottom: 6px; }
.rs-desc { white-space: pre-line; color: var(--muted); }
.progress { height: 6px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.rq { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 12px; margin: 0; min-width: 0; }
.rq.bad { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.rq legend, .rq .rq-title { font-weight: 600; font-size: 1.02rem; padding: 0; float: left; width: 100%; }
.rq legend + * { clear: both; }
.req { color: var(--danger); margin-left: 3px; }
.rq-help { color: var(--muted); font-size: .9rem; white-space: pre-line; }
.choices { display: grid; gap: 8px; }
.choice { position: relative; display: flex; gap: 12px; align-items: center; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; background: var(--surface); }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.segs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.segs.tight { gap: 3px; }
.segs.tight .seg span { font-size: .85rem; min-height: 42px; }
button.choice { width: 100%; font: inherit; color: var(--ink); text-align: left; }
.choice.rank.on { border-color: var(--accent); background: var(--accent-weak); }
.rank-n { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px dashed var(--line-strong); display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 600; font-size: .85rem; }
.choice.rank.on .rank-n { border: 0; background: var(--accent); color: var(--accent-ink); }
.seg { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; font-family: var(--mono); font-weight: 500; background: var(--surface); }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.ends { display: flex; justify-content: space-between; gap: 12px; font-size: .82rem; color: var(--muted); }
.stars { display: flex; gap: 4px; flex-wrap: wrap; }
.star { background: none; border: 0; padding: 4px; cursor: pointer; color: var(--line-strong); line-height: 0; border-radius: 6px; }
.star svg { width: 34px; height: 34px; }
.star.on { color: #e0a100; }
.mrow { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.mrow:first-of-type { border-top: 0; padding-top: 0; }
.mrow .mlabel { font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: 40px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: .9rem; background: var(--surface); }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid var(--focus); }
.rs-nav { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.section-card { padding: 4px 2px; display: grid; gap: 6px; }
.banner { background: var(--warn-weak); color: var(--ink); text-align: center; padding: 10px 16px; font-size: .9rem; font-weight: 600; }
.foot { text-align: center; font-size: .8rem; color: var(--muted); padding: 24px 16px; }
.foot a { color: inherit; }

/* report */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.kpi .v { font-family: var(--mono); font-size: 1.7rem; font-weight: 500; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.rcard { display: grid; gap: 14px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; gap: 4px; }
.bar-top { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; }
.bar-top .mono { white-space: nowrap; color: var(--muted); }
.track { height: 10px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.track span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.track span.top { background: var(--accent); }
.track span.rest { background: color-mix(in oklab, var(--accent) 55%, var(--surface)); }
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-rows: 100%; gap: 6px; height: 140px; padding-top: 6px; }
.col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; min-height: 0; }
.col .b { width: 100%; max-width: 46px; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 2px; }
.col .n { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.col-labels { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; font-family: var(--mono); font-size: .78rem; color: var(--muted); text-align: center; border-top: 1px solid var(--line-strong); padding-top: 4px; }
.col-labels span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statline { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; }
.statline .big { font-family: var(--mono); font-size: 1.9rem; font-weight: 500; line-height: 1; }
.stack-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--sunk); }
.stack-bar span { display: block; height: 100%; min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.mx { display: grid; gap: 14px; }
.mx-row { display: grid; gap: 6px; }
.answers { display: grid; gap: 0; max-height: 420px; overflow: auto; border-top: 1px solid var(--line); }
.answers li { list-style: none; padding: 10px 0; border-bottom: 1px solid var(--line); display: grid; gap: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.answers ul, ul.answers { margin: 0; padding: 0; }
.timeline { width: 100%; height: 150px; display: block; }
.timeline text { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.resp { display: grid; gap: 10px; }
.resp dl { margin: 0; display: grid; gap: 10px; }
.resp dt { font-size: .85rem; color: var(--muted); }
.resp dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }

/* landing */
.hero { padding-block: 56px 40px; display: grid; gap: 22px; }
.hero h1 { font-size: clamp(2.1rem, 6.4vw, 3.6rem); line-height: 1.04; max-width: 15ch; letter-spacing: -.03em; }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 54ch; }
.feature-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.steps { counter-reset: s; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.steps li { list-style: none; counter-increment: s; display: grid; gap: 6px; }
.steps li::before { content: counter(s); font-family: var(--mono); font-weight: 500; color: var(--accent); font-size: 1.4rem; }
.steps ol { margin: 0; padding: 0; }
.plans { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.plans ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.section-gap { padding-block: 36px; display: grid; gap: 20px; }
.preview-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); display: grid; gap: 12px; max-width: 520px; }

@media (max-width: 560px) {
  .srow { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
