/* =========================================================
   Wellbeing Outfit — AI Governance Survey
   Palette derived from logo: navy + teal + green dot accent
   ========================================================= */

:root {
  --navy: #143358;
  --navy-2: #1f4774;
  --navy-soft: #2c578a;
  --teal: #2cb6e0;
  --teal-soft: #6fd0ef;
  --teal-tint: #e6f6fb;
  --green: #8bc53f;
  --green-soft: #c4e198;
  --cream: #faf7f2;
  --cream-2: #f3ede2;
  --paper: #ffffff;
  --ink: #0e1f33;
  --ink-2: #2b4262;
  --muted: #6b7c93;
  --line: #e3dfd5;
  --line-2: #cfc9bc;
  --danger: #c84a3a;
  --warn: #d49a2a;
  --good: #4f9a3a;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(20,51,88,0.06), 0 2px 8px rgba(20,51,88,0.04);
  --shadow: 0 4px 16px rgba(20,51,88,0.08), 0 1px 3px rgba(20,51,88,0.06);
  --shadow-lg: 0 18px 48px rgba(20,51,88,0.16), 0 4px 12px rgba(20,51,88,0.08);

  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 18px;
}
.topbar img.logo { height: 30px; display: block; }
.topbar .crumb {
  font-size: 13px; color: var(--muted);
  border-left: 1px solid var(--line); padding-left: 18px;
  letter-spacing: 0.02em;
}
.topbar .spacer { flex: 1; }
.topbar .user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-2);
}
.topbar .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: white;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.02em;
}
.topbar .save-badge {
  font-size: 12px; color: var(--good);
  display: flex; align-items: center; gap: 6px;
}
.topbar .save-badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); display: inline-block;
}

/* ---------- Login ---------- */
.login-shell {
  min-height: 100vh;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--cream);
}
.login-shell .left {
  padding: 56px 64px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(160deg, var(--navy) 0%, #0d2541 100%);
  color: white; position: relative; overflow: hidden;
}
.login-shell .left::after {
  content: ""; position: absolute;
  right: -120px; bottom: -120px; width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(44,182,224,0.4), transparent 70%);
  filter: blur(20px);
}
.login-shell .logo-white {
  font-family: var(--sans); font-weight: 600; font-size: 22px;
  letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 6px;
  position: relative; z-index: 1;
}
.login-shell .logo-white .a { color: white; }
.login-shell .logo-white .b { color: var(--teal); font-weight: 500; }
.login-shell .logo-white .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green);
  display: inline-block; margin-left: -2px; transform: translateY(-10px);
}

.login-shell .left .pitch { position: relative; z-index: 1; }
.login-shell .left .pitch h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: 44px; line-height: 1.1; letter-spacing: -0.01em;
  margin: 0 0 18px;
}
.login-shell .left .pitch h1 em {
  font-style: italic; color: var(--teal-soft);
}
.login-shell .left .pitch p {
  font-size: 16px; line-height: 1.55; color: rgba(255,255,255,0.78);
  max-width: 460px;
}
.login-shell .left .meta { position: relative; z-index: 1; font-size: 13px; color: rgba(255,255,255,0.55); }

.login-shell .right {
  padding: 56px 64px;
  display: flex; flex-direction: column; justify-content: center;
  align-items: stretch;
}
.login-card {
  width: 100%; max-width: 420px; margin: 0 auto;
}
.login-card h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 28px; margin: 0 0 8px; letter-spacing: -0.01em;
}
.login-card .sub { color: var(--muted); margin: 0 0 32px; font-size: 14px; }
.login-card label {
  display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-2); font-weight: 600;
  margin: 18px 0 8px;
}
.login-card input[type="text"],
.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%; padding: 13px 14px;
  border: 1px solid var(--line-2); background: var(--paper);
  border-radius: var(--radius-sm); font-size: 15px;
  transition: border-color 120ms, box-shadow 120ms;
}
.login-card input:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(20,51,88,0.12);
}
.login-card .row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px; font-size: 13px; color: var(--muted);
}
.login-card .row a { color: var(--navy-2); text-decoration: none; }
.login-card .submit {
  margin-top: 28px; width: 100%; padding: 14px;
  background: var(--navy); color: white; border: none;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 15px;
  letter-spacing: 0.01em;
  transition: background 120ms, transform 100ms;
}
.login-card .submit:hover { background: var(--navy-2); }
.login-card .submit:active { transform: translateY(1px); }
.login-card .helper-pill {
  margin-top: 24px; padding: 12px 14px;
  background: var(--teal-tint); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink-2);
  display: flex; gap: 10px; align-items: flex-start;
}
.login-card .helper-pill strong { color: var(--navy); }

.login-card .err {
  margin-top: 14px; padding: 10px 12px;
  background: #fdecea; color: var(--danger); border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ---------- Mode picker ---------- */
.mode-shell {
  min-height: calc(100vh - 60px);
  padding: 56px 28px; max-width: 1080px; margin: 0 auto;
}
.mode-shell .hello {
  font-family: var(--serif); font-size: 44px; font-weight: 400;
  letter-spacing: -0.01em; margin: 0 0 12px; line-height: 1.1;
}
.mode-shell .hello em { font-style: italic; color: var(--navy-2); }
.mode-shell .lead {
  font-size: 17px; color: var(--ink-2); max-width: 720px; margin: 0 0 40px;
  line-height: 1.55;
}
.mode-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 8px;
}
.mode-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px; cursor: pointer;
  transition: transform 160ms, box-shadow 160ms, border-color 160ms;
  display: flex; flex-direction: column; gap: 18px;
  position: relative; overflow: hidden;
}
.mode-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--navy);
}
.mode-card .preview {
  height: 200px; border-radius: var(--radius);
  background: var(--cream);
  border: 1px solid var(--line);
  position: relative; overflow: hidden;
}
.mode-card h3 {
  font-family: var(--serif); font-weight: 400; font-size: 26px;
  letter-spacing: -0.01em; margin: 0;
}
.mode-card p { color: var(--ink-2); font-size: 14px; margin: 0; line-height: 1.55; }
.mode-card .meta {
  display: flex; gap: 14px; font-size: 12px; color: var(--muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.mode-card .meta span { display: flex; gap: 5px; align-items: center; }
.mode-card .meta span::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--green);
}
.mode-card .cta {
  align-self: flex-start; margin-top: 6px;
  padding: 10px 18px; background: var(--navy); color: white;
  border-radius: 999px; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.mode-card.recommended::after {
  content: "Recommended"; position: absolute;
  top: 18px; right: 18px;
  background: var(--green); color: white;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  padding: 4px 10px; border-radius: 999px;
  text-transform: uppercase;
}

/* mini-preview decorations */
.preview.standard {
  display: flex; flex-direction: column; padding: 16px;
  gap: 8px; background: var(--paper);
}
.preview.standard .progress-mini {
  height: 4px; background: var(--line); border-radius: 999px; overflow: hidden;
}
.preview.standard .progress-mini::after {
  content: ""; display: block; width: 38%; height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--navy));
}
.preview.standard .q { font-size: 11px; color: var(--ink-2); font-weight: 600; }
.preview.standard .opt {
  font-size: 11px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 6px; color: var(--muted); background: var(--cream);
}
.preview.standard .opt.sel {
  background: var(--navy); color: white; border-color: var(--navy);
}

.preview.chat {
  background: var(--paper); padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.preview.chat .bubble {
  font-size: 11px; padding: 8px 11px; border-radius: 12px; max-width: 75%;
}
.preview.chat .bubble.bot {
  background: var(--cream-2); color: var(--ink-2); align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.preview.chat .bubble.user {
  background: var(--navy); color: white; align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.preview.chat .pill {
  align-self: flex-start; font-size: 9px; padding: 3px 7px;
  background: var(--teal-tint); color: var(--navy);
  border-radius: 999px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- Standard survey ---------- */
.survey-shell {
  display: grid; grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 60px);
}
.survey-side {
  background: var(--cream-2);
  border-right: 1px solid var(--line);
  padding: 32px 24px; position: sticky; top: 60px;
  height: calc(100vh - 60px); overflow-y: auto;
}
.survey-side .progress-block {
  background: var(--paper); padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--line); margin-bottom: 20px;
}
.survey-side .progress-block .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
}
.survey-side .progress-block .pct {
  font-family: var(--serif); font-size: 32px; margin: 6px 0 10px;
}
.survey-side .progress-block .bar {
  height: 6px; background: var(--cream); border-radius: 999px; overflow: hidden;
}
.survey-side .progress-block .bar > div {
  height: 100%; background: linear-gradient(90deg, var(--teal), var(--navy));
  transition: width 300ms;
}
.survey-side ol { list-style: none; padding: 0; margin: 0; }
.survey-side ol li {
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink-2);
  display: flex; gap: 10px; align-items: flex-start;
  cursor: pointer; transition: background 120ms;
}
.survey-side ol li:hover { background: rgba(20,51,88,0.05); }
.survey-side ol li.current {
  background: var(--paper);
  box-shadow: var(--shadow-sm);
  font-weight: 600; color: var(--navy);
}
.survey-side ol li .num {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  background: var(--cream); color: var(--muted);
  flex-shrink: 0;
}
.survey-side ol li.done .num {
  background: var(--green); color: white;
}
.survey-side ol li.current .num {
  background: var(--navy); color: white;
}

.survey-main {
  padding: 48px 64px; max-width: 820px; width: 100%;
  margin: 0 auto;
}
.section-eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--teal); font-weight: 600; margin-bottom: 12px;
}
.section-title {
  font-family: var(--serif); font-weight: 400; font-size: 38px;
  letter-spacing: -0.01em; margin: 0 0 18px; line-height: 1.15;
}
.section-blurb {
  font-size: 15px; color: var(--ink-2); line-height: 1.6;
  background: var(--paper); padding: 18px 20px;
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 36px;
}
.q-block { margin-bottom: 36px; }
.q-block .q-prompt {
  font-size: 17px; line-height: 1.45; font-weight: 500;
  color: var(--ink); margin-bottom: 14px;
}
.q-block .q-prompt .qid {
  font-size: 11px; color: var(--muted); font-weight: 700;
  letter-spacing: 0.08em; margin-right: 10px; vertical-align: 2px;
}
.q-block .q-help { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

.opt-list {
  display: grid; gap: 10px;
}
.opt-list.cols-2 { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; gap: 12px; align-items: center;
  padding: 13px 16px; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); cursor: pointer;
  background: var(--paper); transition: all 120ms;
  font-size: 14px;
}
.opt:hover { border-color: var(--navy-soft); background: var(--cream); }
.opt.selected {
  border-color: var(--navy); background: rgba(20,51,88,0.04);
  box-shadow: 0 0 0 1px var(--navy) inset;
}
.opt .box {
  width: 18px; height: 18px; border-radius: 4px; border: 1.5px solid var(--line-2);
  display: grid; place-items: center; flex-shrink: 0; transition: all 120ms;
}
.opt.radio .box { border-radius: 50%; }
.opt.selected .box { background: var(--navy); border-color: var(--navy); }
.opt.selected .box::after {
  content: ""; width: 10px; height: 10px;
  background-image: linear-gradient(45deg, transparent 45%, white 45%, white 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, white 45%, white 55%, transparent 55%);
  background-size: 14px 2px, 14px 2px;
  background-repeat: no-repeat;
  background-position: 0 6px, 0 6px;
}
.opt.radio.selected .box::after {
  width: 8px; height: 8px; background: white; border-radius: 50%;
  background-image: none;
}

.q-block textarea, .q-block input[type="text"] {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--paper); font-size: 14px; line-height: 1.5;
  resize: vertical; min-height: 90px; transition: border-color 120ms;
}
.q-block textarea:focus, .q-block input[type="text"]:focus {
  outline: none; border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(20,51,88,0.12);
}
.q-block .followup-label {
  font-size: 13px; color: var(--ink-2); margin: 14px 0 6px;
  font-weight: 500;
}

/* tools table */
.tools-table {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.tools-table .row {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) 1.4fr 1.4fr 1.2fr;
  border-bottom: 1px solid var(--line);
}
.tools-table .row:last-child { border-bottom: none; }
.tools-table .row.head {
  background: var(--cream-2); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); font-weight: 600;
}
.tools-table .cell { padding: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tools-table .cell.tool { font-weight: 500; font-size: 14px; }
.tools-table .chip {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--paper);
  cursor: pointer; transition: all 120ms; color: var(--ink-2);
}
.tools-table .chip:hover { border-color: var(--navy-soft); }
.tools-table .chip.selected { background: var(--navy); color: white; border-color: var(--navy); }
.tools-table .chip.yes.selected { background: var(--good); border-color: var(--good); }
.tools-table .chip.no.selected { background: var(--ink-2); border-color: var(--ink-2); }

/* nav */
.survey-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 28px 0 0; border-top: 1px solid var(--line); margin-top: 36px;
  gap: 16px;
}
.btn {
  padding: 12px 22px; border-radius: var(--radius-sm); font-weight: 600;
  font-size: 14px; border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 120ms;
}
.btn.primary { background: var(--navy); color: white; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--paper); border-color: var(--navy-soft); }
.btn.subtle { background: var(--cream-2); color: var(--ink-2); border-color: transparent; }
.btn.subtle:hover { background: var(--cream); }

/* ---------- Chat mode ---------- */
.chat-shell {
  display: grid; grid-template-columns: 1fr 380px;
  min-height: calc(100vh - 60px);
  background: var(--cream);
}
.chat-pane {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--paper);
}
.chat-header {
  padding: 22px 32px; border-bottom: 1px solid var(--line);
  background: var(--paper);
  display: flex; align-items: center; gap: 14px;
}
.chat-header .agent-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--teal));
  color: white; display: grid; place-items: center; font-weight: 700;
  font-size: 14px;
  position: relative;
}
.chat-header .agent-avatar::after {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); position: absolute; bottom: 0; right: 0;
  border: 2px solid var(--paper);
}
.chat-header .who h4 {
  margin: 0; font-size: 15px; font-weight: 600;
}
.chat-header .who span { font-size: 12px; color: var(--muted); }
.chat-header .progress-mini {
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  min-width: 180px;
}
.chat-header .progress-mini .lbl {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
}
.chat-header .progress-mini .bar {
  width: 200px; height: 6px; background: var(--cream-2);
  border-radius: 999px; overflow: hidden;
}
.chat-header .progress-mini .bar > div {
  height: 100%; background: linear-gradient(90deg, var(--teal), var(--navy));
  transition: width 400ms;
}

.chat-stream {
  flex: 1; overflow-y: auto;
  padding: 28px 32px;
  display: flex; flex-direction: column; gap: 18px;
}
.bubble-row {
  display: flex; gap: 12px; align-items: flex-start;
  animation: fadeUp 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.bubble-row.user { justify-content: flex-end; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.bubble-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  flex-shrink: 0; display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}
.bubble-avatar.bot {
  background: linear-gradient(135deg, var(--navy), var(--teal));
  color: white;
}
.bubble {
  max-width: 580px; padding: 14px 18px;
  border-radius: 18px; font-size: 15px; line-height: 1.55;
}
.bubble.bot {
  background: var(--cream-2); color: var(--ink);
  border-bottom-left-radius: 6px;
}
.bubble.user {
  background: var(--navy); color: white;
  border-bottom-right-radius: 6px;
}
.bubble.bot .signal-banner {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed rgba(20,51,88,0.2);
  font-size: 13px; color: var(--ink-2);
  display: flex; flex-direction: column; gap: 8px;
}
.signal-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 8px;
  background: var(--paper); border: 1px solid var(--line-2);
  border-radius: 999px; font-size: 12px;
  cursor: pointer; transition: all 120ms;
}
.signal-pill:hover { border-color: var(--navy-soft); background: var(--cream); }
.signal-pill .dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.signal-pill .qid {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.signal-pill .val {
  font-weight: 600; color: var(--navy);
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.signal-pill .conf {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  font-weight: 700; letter-spacing: 0.04em;
}
.conf-high { background: #d8f0d4; color: #2c6d1d; }
.conf-med { background: #fdf1d6; color: #8a5a14; }
.conf-low { background: #fde4df; color: #944029; }
.dot-high { background: #4f9a3a; }
.dot-med { background: #d49a2a; }
.dot-low { background: #c84a3a; }

.typing {
  display: inline-flex; gap: 4px; padding: 4px 0;
}
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.chat-input {
  padding: 16px 24px 22px; border-top: 1px solid var(--line);
  background: var(--paper);
}
.chat-input .field {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--cream); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 12px;
  transition: border-color 120ms;
}
.chat-input .field:focus-within {
  border-color: var(--navy); box-shadow: 0 0 0 3px rgba(20,51,88,0.08);
}
.chat-input textarea {
  flex: 1; border: none; background: transparent; resize: none;
  font-size: 15px; line-height: 1.5; min-height: 24px; max-height: 160px;
  font-family: inherit;
}
.chat-input textarea:focus { outline: none; }
.chat-input .send {
  padding: 8px 16px; background: var(--navy); color: white;
  border-radius: var(--radius-sm); border: none; font-weight: 600;
  font-size: 13px; display: flex; align-items: center; gap: 6px;
}
.chat-input .send:disabled { opacity: 0.4; cursor: default; }
.chat-input .hint {
  font-size: 11px; color: var(--muted); margin-top: 8px;
  text-align: center; letter-spacing: 0.04em;
}

/* ---------- Right rail (live answer sheet) ---------- */
.answer-rail {
  background: var(--cream-2);
  display: flex; flex-direction: column;
  height: calc(100vh - 60px);
  position: sticky; top: 60px;
}
.answer-rail .head {
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.answer-rail .head h4 {
  margin: 0 0 6px; font-size: 14px; font-weight: 700;
  letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px;
}
.answer-rail .head h4 .live {
  font-size: 9px; padding: 2px 6px; background: var(--green); color: white;
  border-radius: 999px; font-weight: 700; letter-spacing: 0.06em;
}
.answer-rail .head p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.answer-rail .stats {
  display: flex; gap: 16px; margin-top: 14px;
}
.answer-rail .stat {
  flex: 1; background: var(--paper); padding: 10px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
}
.answer-rail .stat .n {
  font-family: var(--serif); font-size: 24px; line-height: 1;
}
.answer-rail .stat .l {
  font-size: 10px; color: var(--muted); margin-top: 4px;
  text-transform: uppercase; letter-spacing: 0.06em;
}

.answer-rail .list {
  flex: 1; overflow-y: auto; padding: 16px 16px 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.answer-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 12px;
  animation: fadeUp 240ms;
  position: relative;
}
.answer-card.just-added {
  animation: pop 600ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes pop {
  0% { transform: scale(0.95); border-color: var(--green); box-shadow: 0 0 0 4px rgba(139, 197, 63, 0.2); }
  100% { transform: none; }
}
.answer-card .qid {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  letter-spacing: 0.04em;
}
.answer-card .qprompt {
  font-size: 12px; color: var(--ink-2); font-weight: 500;
  line-height: 1.4; margin: 4px 0 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.answer-card .answer {
  font-size: 13px; font-weight: 600; color: var(--navy);
  line-height: 1.4;
}
.answer-card .answer .tag {
  display: inline-block; background: var(--cream-2); padding: 2px 6px;
  border-radius: 4px; margin: 2px 4px 2px 0; font-weight: 500; font-size: 11px;
}
.answer-card .conf {
  position: absolute; top: 10px; right: 10px;
  font-size: 9px; padding: 2px 5px; border-radius: 3px; font-weight: 700;
  letter-spacing: 0.04em;
}
.answer-rail .empty {
  text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13px;
}

/* ---------- Review screen ---------- */
.review-shell {
  max-width: 920px; margin: 0 auto; padding: 48px 28px 80px;
}
.review-shell h1 {
  font-family: var(--serif); font-weight: 400; font-size: 40px;
  letter-spacing: -0.01em; margin: 0 0 8px;
}
.review-shell .lead {
  font-size: 16px; color: var(--ink-2); max-width: 680px; margin: 0 0 32px;
}
.review-section {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; margin-bottom: 18px;
}
.review-section h3 {
  font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0 0 4px;
}
.review-section .scount {
  font-size: 12px; color: var(--muted); margin-bottom: 18px;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.review-q {
  display: grid; grid-template-columns: 1fr auto;
  padding: 14px 0; border-top: 1px solid var(--line);
  gap: 14px; align-items: flex-start;
}
.review-q:first-of-type { border-top: none; }
.review-q .qprompt {
  font-size: 14px; color: var(--ink-2); line-height: 1.4;
}
.review-q .qprompt .qid {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  letter-spacing: 0.04em; margin-right: 8px;
}
.review-q .qanswer {
  font-size: 14px; color: var(--navy); font-weight: 600;
  line-height: 1.4; margin-top: 4px;
}
.review-q .qanswer.unanswered { color: var(--muted); font-style: italic; font-weight: 400; }
.review-q .edit-btn {
  padding: 6px 12px; background: var(--cream-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 12px; font-weight: 600;
  color: var(--ink-2); white-space: nowrap;
}
.review-q .edit-btn:hover { background: var(--paper); border-color: var(--navy-soft); }

.review-edit {
  background: var(--cream); padding: 18px; margin-top: 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
}
.review-edit .edit-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px;
}

.submit-bar {
  position: sticky; bottom: 0; z-index: 10;
  background: var(--paper); padding: 18px 28px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; gap: 16px; align-items: center;
  margin-top: 24px;
}
.submit-bar .summary {
  flex: 1; font-size: 13px; color: var(--ink-2);
}
.submit-bar .summary strong { color: var(--navy); }

/* ---------- Done screen ---------- */
.done-shell {
  min-height: calc(100vh - 60px); display: grid; place-items: center;
  padding: 48px 28px;
}
.done-card {
  max-width: 520px; text-align: center;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 48px 40px;
}
.done-card .badge {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 18px;
  background: var(--green); display: grid; place-items: center;
}
.done-card .badge::before {
  content: ""; width: 36px; height: 18px;
  border-left: 3px solid white; border-bottom: 3px solid white;
  transform: rotate(-45deg) translate(2px, -4px);
}
.done-card h1 {
  font-family: var(--serif); font-weight: 400; font-size: 32px;
  margin: 0 0 8px;
}
.done-card p { color: var(--ink-2); font-size: 15px; line-height: 1.55; }

/* ---------- Admin area ---------- */
.admin-shell { padding: 36px 32px 80px; max-width: 1400px; margin: 0 auto; }
.admin-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px; margin-bottom: 24px; flex-wrap: wrap;
}
.admin-head h1 {
  font-family: var(--serif); font-weight: 400; font-size: 36px;
  letter-spacing: -0.01em; margin: 0 0 4px;
}
.admin-head .lead { color: var(--ink-2); margin: 0; font-size: 14px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.admin-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
}
.stat-card .n {
  font-family: var(--serif); font-size: 32px; line-height: 1;
  color: var(--navy);
}
.stat-card .l {
  font-size: 11px; color: var(--muted); margin-top: 6px;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}

.admin-grid {
  display: grid; grid-template-columns: 360px 1fr; gap: 18px;
  align-items: start;
}
.admin-list {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  max-height: calc(100vh - 280px); overflow-y: auto;
  position: sticky; top: 80px;
}
.admin-list-head {
  padding: 14px 18px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); font-weight: 700;
  border-bottom: 1px solid var(--line); background: var(--cream-2);
}
.admin-list-item {
  display: flex; gap: 12px; align-items: center;
  width: 100%; padding: 12px 16px; border: none; border-bottom: 1px solid var(--line);
  background: var(--paper); cursor: pointer; text-align: left;
  transition: background 120ms;
}
.admin-list-item:hover { background: var(--cream); }
.admin-list-item.active { background: var(--teal-tint); border-left: 3px solid var(--teal); padding-left: 13px; }
.admin-list-item:last-child { border-bottom: none; }
.ali-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy); color: white; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.ali-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.ali-email { font-size: 12px; color: var(--muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ali-meta {
  display: flex; gap: 8px; font-size: 11px; color: var(--muted);
  margin-top: 6px; align-items: center;
}
.ali-mode {
  font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.ali-mode.std { background: var(--cream-2); color: var(--ink-2); }
.ali-mode.chat { background: var(--teal-tint); color: var(--navy); }

.admin-detail {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  min-height: 400px;
}
.admin-detail-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--line);
  background: var(--cream-2);
}
.admin-detail-head h2 {
  font-family: var(--serif); font-weight: 400; font-size: 22px;
  margin: 0 0 4px; letter-spacing: -0.01em;
}
.md-preview {
  padding: 24px; max-height: 70vh; overflow-y: auto;
}
.md-preview pre {
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word; margin: 0;
  color: var(--ink-2);
}

/* ---------- Formatted response view ---------- */
.seg {
  display: inline-flex; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
.seg-btn {
  padding: 8px 14px; background: transparent; border: none;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
  letter-spacing: 0.02em;
}
.seg-btn.on { background: var(--navy); color: white; }
.seg-btn:not(.on):hover { background: var(--cream); color: var(--ink-2); }

.resp-view { padding: 24px 28px 32px; max-height: 78vh; overflow-y: auto; }
.resp-summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  margin-bottom: 28px;
}
.resp-stat {
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.resp-stat .n {
  font-family: var(--serif); font-size: 26px; line-height: 1; color: var(--navy);
  font-weight: 400;
}
.resp-stat .n span { color: var(--muted); font-size: 16px; }
.resp-stat .l {
  font-size: 10px; color: var(--muted); margin-top: 6px;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}

.resp-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0; margin-bottom: 18px;
  overflow: hidden;
}
.resp-shead {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px; background: var(--cream-2);
  border-bottom: 1px solid var(--line);
}
.resp-snum {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--navy); color: white;
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 16px; font-weight: 500;
  flex-shrink: 0;
}
.resp-shead h3 {
  font-family: var(--serif); font-weight: 400; font-size: 19px; margin: 0;
  letter-spacing: -0.01em;
}
.resp-scount {
  font-size: 11px; color: var(--muted); margin-top: 3px;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}

.resp-q {
  padding: 18px 22px;
  border-top: 1px solid var(--line);
}
.resp-q:first-of-type { border-top: none; }
.resp-q.unans { background: linear-gradient(0deg, var(--cream) 0%, transparent 100%); }
.resp-qh {
  display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap;
  margin-bottom: 12px;
}
.resp-qid {
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  letter-spacing: 0.06em; font-weight: 600;
  background: var(--cream); padding: 3px 7px; border-radius: 4px;
  flex-shrink: 0; align-self: center;
}
.resp-qprompt {
  flex: 1; font-size: 14px; font-weight: 500; color: var(--ink);
  line-height: 1.45;
}
.resp-qh .conf {
  font-size: 10px; padding: 3px 7px; border-radius: 4px;
  font-weight: 700; letter-spacing: 0.04em; flex-shrink: 0;
  align-self: center;
}
.resp-qbody { padding-left: 0; }

.ans-empty {
  font-size: 13px; color: var(--muted); font-style: italic;
  padding: 6px 12px; background: var(--cream); border-radius: var(--radius-sm);
  display: inline-block;
}
.ans-pill {
  display: inline-block;
  padding: 8px 14px; background: var(--navy); color: white;
  border-radius: 999px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.01em;
}
.ans-quote {
  margin-top: 10px; padding: 12px 16px;
  background: var(--cream); border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px; color: var(--ink-2); line-height: 1.55;
  white-space: pre-wrap;
}
.ans-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ans-tag {
  display: inline-block;
  padding: 6px 11px; font-size: 12px;
  background: var(--paper); border: 1px solid var(--line-2);
  border-radius: 999px; color: var(--ink-2); font-weight: 500;
}
.ans-tag.other {
  background: var(--teal-tint); border-color: var(--teal-soft); color: var(--navy);
  font-style: italic;
}

.ans-table {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
  background: var(--paper);
}
.ans-trow {
  display: grid; grid-template-columns: minmax(180px, 2fr) 1fr 1fr 1fr;
  border-top: 1px solid var(--line);
}
.ans-trow:first-child { border-top: none; }
.ans-trow > div {
  padding: 10px 14px; font-size: 13px; display: flex; align-items: center;
}
.ans-trow.head > div {
  background: var(--cream-2); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); font-weight: 700;
  padding: 9px 14px;
}
.ans-trow .tool { font-weight: 600; color: var(--ink); }
.ans-chip {
  display: inline-block; font-size: 11px; padding: 3px 8px;
  border-radius: 4px; font-weight: 600; letter-spacing: 0.02em;
}
.ans-chip.yes { background: #d8f0d4; color: #2c6d1d; }
.ans-chip.no { background: #fde4df; color: #944029; }
.ans-chip.warn { background: #fdf1d6; color: #8a5a14; }
.ans-chip.neutral { background: var(--cream-2); color: var(--ink-2); }
.ans-dash { color: var(--line-2); font-weight: 600; }

/* responsive */
@media (max-width: 1100px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-list { position: static; max-height: 400px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-shell .left { padding: 40px 32px; }
  .login-shell .right { padding: 40px 32px; }
  .mode-grid { grid-template-columns: 1fr; }
  .survey-shell { grid-template-columns: 1fr; }
  .survey-side { display: none; }
  .survey-main { padding: 32px 24px; }
  .chat-shell { grid-template-columns: 1fr; }
  .answer-rail { display: none; }
  .opt-list.cols-2 { grid-template-columns: 1fr; }
  .tools-table .row { grid-template-columns: 1fr; gap: 0; padding: 8px 0; }
  .tools-table .row.head { display: none; }
}


/* ============== Deck promo card on home ============== */
.deck-promo {
  margin-top: 56px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 36px;
  display: grid; grid-template-columns: 1fr auto;
  gap: 32px; align-items: center;
  cursor: pointer;
  position: relative; overflow: hidden;
  transition: all 200ms;
}
.deck-promo::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: linear-gradient(180deg, var(--teal) 0%, var(--green) 100%);
}
.deck-promo:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--navy-soft);
}
.deck-promo-eye {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--teal); font-weight: 700; margin-bottom: 8px;
}
.deck-promo h3 {
  font-family: var(--serif); font-weight: 400; font-size: 28px;
  letter-spacing: -0.01em; margin: 0 0 6px; line-height: 1.15;
}
.deck-promo p {
  font-size: 14px; color: var(--ink-2); line-height: 1.5; margin: 0;
  max-width: 720px;
}
.deck-promo-r {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.deck-promo-meta {
  font-size: 12px; color: var(--muted);
  letter-spacing: 0.04em;
}
.deck-promo-cta {
  font-size: 13px; font-weight: 600; color: var(--navy);
  padding: 10px 18px; background: var(--cream-2);
  border-radius: 999px; border: 1px solid var(--line);
  transition: all 160ms; white-space: nowrap;
}
.deck-promo:hover .deck-promo-cta {
  background: var(--navy); color: white; border-color: var(--navy);
}

/* ============== Deck analytics in admin ============== */
.dv-table {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.dv-row {
  display: grid; grid-template-columns: 1.4fr 1fr 0.8fr 0.8fr 1fr 0.6fr;
  gap: 18px; padding: 14px 22px;
  border-top: 1px solid var(--line);
  align-items: center; font-size: 13px;
}
.dv-row:first-child { border-top: none; }
.dv-row.head {
  background: var(--cream-2); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700; color: var(--muted);
}
.dv-name { font-weight: 600; color: var(--ink); }
.dv-name .em { color: var(--muted); font-weight: 400; font-size: 12px; display: block; margin-top: 2px; }
.dv-when { color: var(--ink-2); font-family: var(--mono); font-size: 12px; }
.dv-completion {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
}
.dv-bar {
  flex: 1; height: 4px; background: var(--cream-2); border-radius: 999px; overflow: hidden;
}
.dv-bar > div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--navy)); }
.dv-bar.full > div { background: var(--green); }
.dv-dwell { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.dv-end {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px;
  display: inline-block; letter-spacing: 0.04em;
}
.dv-end.yes { background: #e8f3da; color: var(--good); }
.dv-end.no { background: var(--cream-2); color: var(--muted); }
.dv-empty {
  padding: 60px 24px; text-align: center; color: var(--muted);
  background: var(--paper); border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.dv-detail {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 26px;
  margin-top: 16px;
}
.dv-detail h4 {
  font-family: var(--serif); font-weight: 400; font-size: 22px;
  margin: 0 0 14px; letter-spacing: -0.005em;
}
.dv-detail-meta {
  display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); margin-bottom: 18px;
}
.dv-detail-meta strong { color: var(--ink); font-weight: 600; }
.dv-slide-bars { display: flex; flex-direction: column; gap: 6px; }
.dv-slide-row {
  display: grid; grid-template-columns: 32px 1fr 70px;
  gap: 14px; align-items: center; font-size: 12px;
  padding: 6px 0;
}
.dv-slide-n { font-family: var(--mono); color: var(--muted); font-size: 11px; }
.dv-slide-t {
  display: flex; align-items: center; gap: 12px;
  color: var(--ink-2);
}
.dv-slide-bar {
  flex: 1; height: 6px; background: var(--cream-2); border-radius: 999px; overflow: hidden;
}
.dv-slide-bar > div { height: 100%; background: var(--teal); border-radius: 999px; }
.dv-slide-dwell { font-family: var(--mono); color: var(--ink-2); text-align: right; font-size: 11px; }

.dv-tabs {
  display: flex; gap: 4px; background: var(--cream-2);
  padding: 4px; border-radius: 6px;
  margin-bottom: 18px; align-self: flex-start;
}
.dv-tab {
  background: transparent; border: 0; padding: 7px 14px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-radius: 4px; letter-spacing: 0.04em;
}
.dv-tab.on { background: var(--paper); color: var(--navy); box-shadow: var(--shadow-sm); }

/* Stat tiles for deck analytics top row */
.dv-tiles {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px;
}
.dv-tile {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px;
}
.dv-tile-l {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600; margin-bottom: 8px;
}
.dv-tile-n {
  font-family: var(--serif); font-size: 36px; font-weight: 400;
  color: var(--navy); line-height: 1;
}
.dv-tile-h { font-size: 11px; color: var(--muted); margin-top: 6px; }
