@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Sage palette — verbatim from clinical-ops design package */
  --co-sage-900: #2f5d57;
  --co-sage-800: #3e7a72;
  --co-sage-700: #57958a;
  --co-sage-600: #6ea69b;
  --co-sage-500: #80b7b1;
  --co-sage-400: #a4c8c2;
  --co-sage-300: #c4dad6;
  --co-sage-200: #dde9e6;
  --co-sage-100: #ecf3f1;
  --co-sage-50:  #f4f8f7;
  --co-sage-25:  #f7faf8;

  /* Teal aliases — design package treats these as the same scale */
  --co-teal-900: var(--co-sage-900);
  --co-teal-800: var(--co-sage-800);
  --co-teal-700: var(--co-sage-700);
  --co-teal-600: var(--co-sage-600);
  --co-teal-500: var(--co-sage-500);
  --co-teal-400: var(--co-sage-400);
  --co-teal-300: var(--co-sage-300);
  --co-teal-200: var(--co-sage-200);
  --co-teal-100: var(--co-sage-100);
  --co-teal-50:  var(--co-sage-50);
  --co-teal-25:  var(--co-sage-25);

  /* Slate neutrals */
  --co-slate-700:  #404a5c;
  --co-slate-600:  #586b85;
  --co-slate-500:  #6b7a92;
  --co-slate-400:  #898f9a;
  --co-slate-300:  #a4adb9;
  --co-slate-200:  #cbd2dc;
  --co-slate-150:  #e1e7ef;
  --co-slate-100:  #e2e8f0;
  --co-slate-75:   #ecf2f4;
  --co-slate-50:   #f4f6f9;
  --co-slate-25:   #f7f9fb;

  --fg-primary:   #191c1e;
  --fg-secondary: #586b85;
  --fg-tertiary:  #a4adb9;
  --fg-muted:     #898f9a;
  --bg-primary:   #ffffff;
  --bg-canvas:    var(--co-slate-25);
  --border-default: var(--co-slate-100);
  --border-subtle:  var(--co-slate-50);
  --border-strong:  var(--co-slate-150);
  --focus-ring: color-mix(in srgb, var(--co-sage-700) 35%, transparent);

  --font-sans:  "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --font-mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-1: 0 1px 2px rgba(15, 23, 23, 0.04);
  --shadow-2: 0 2px 8px rgba(15, 23, 23, 0.06), 0 1px 2px rgba(15, 23, 23, 0.04);
  --shadow-3: 0 12px 32px rgba(15, 23, 23, 0.08), 0 2px 8px rgba(15, 23, 23, 0.04);

  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --duration-fast: 120ms;
  --duration-base: 240ms;

  /* Radius — see docs/design-system.md */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* Spacing — 4px grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Sizing */
  --input-max: 360px;

  /* Type scale */
  --text-2xs: 11px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 17px;
  --text-lg: 20px;
  --text-xl: 22px;
  --text-2xl: 26px;
  --text-3xl: 32px;
  --text-display: clamp(36px, 4.5vw, 48px);
  --text-display-xl: clamp(40px, 5vw, 56px);

  /* Semantic status — initial values sanction the colors already rendering
     today (monitor badges); retune here, in one place, if harmonizing later */
  --status-success-fg: var(--co-sage-900);
  --status-success-accent: var(--co-sage-700);
  --status-success-bg: var(--co-sage-100);
  --status-info-fg: #1e3a8a;
  --status-info-accent: #2563eb;
  --status-info-bg: #eff4fe;
  --status-warn-fg: #713f12;
  --status-warn-accent: #ca8a04;
  --status-warn-bg: #fdf6e3;
  --status-danger-fg: #7f1d1d;
  --status-danger-accent: #b91c1c;
  --status-danger-bg: #fdeeee;
  --status-neutral-fg: var(--co-slate-700);
  --status-neutral-accent: var(--co-slate-400);
  --status-neutral-bg: var(--co-slate-50);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--fg-primary);
  background: var(--bg-canvas);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Editorial gradient wash (v4 style) */
.bg-wash {
  background:
    radial-gradient(ellipse at 12% 8%, var(--co-teal-50) 0%, transparent 36%),
    radial-gradient(ellipse at 92% 80%, var(--co-sage-50) 0%, transparent 38%),
    linear-gradient(180deg, #fafbfc 0%, #f6f8f9 100%);
  background-attachment: fixed;
}

a { color: var(--co-teal-700); text-decoration: none; }
@media (hover: hover) {
  a:hover { text-decoration: underline; text-underline-offset: 3px; }
}

::selection { background: var(--co-teal-100); color: var(--fg-primary); }

/* ─────── home ─────── */

.home-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 80px 32px 96px;
}
.home-shell .eyebrow {
  font: 600 11px/1 var(--font-sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--co-sage-700);
  margin-bottom: 16px;
}
.home-shell h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--fg-primary);
  margin: 0 0 18px;
  max-width: 760px;
}
.home-shell .lede {
  font: 400 17px/1.55 var(--font-sans);
  color: var(--fg-secondary);
  margin: 0 0 56px;
  max-width: 620px;
}
.flows {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 720px) {
  .flows { grid-template-columns: 1fr; }
  .home-shell h1 { font-size: 40px; }
}
.flow-card {
  display: block;
  text-decoration: none !important;
  color: var(--fg-primary);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 28px 30px 24px;
  transition: all var(--duration-base) var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .flow-card:hover {
    border-color: var(--co-teal-300);
    transform: translateY(-3px);
    box-shadow: var(--shadow-3);
  }
}
.flow-card-eyebrow {
  font: 600 10px/1 var(--font-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--co-sage-700);
  margin-bottom: 14px;
}
.flow-card h3 {
  font: 500 20px/1.3 var(--font-sans);
  letter-spacing: -0.005em;
  margin: 0 0 8px;
  color: var(--fg-primary);
}
.flow-card p {
  font: 400 14px/1.55 var(--font-sans);
  color: var(--fg-secondary);
  margin: 0 0 18px;
}
.flow-card-arrow {
  font: 500 13px/1 var(--font-sans);
  color: var(--co-teal-700);
  transition: transform var(--duration-fast) var(--ease-out);
}
@media (hover: hover) {
  .flow-card:hover .flow-card-arrow { transform: translateX(4px); }
}

.footnote {
  margin-top: 56px;
  padding: 20px 24px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  max-width: 720px;
}
.footnote p {
  font: 400 13px/1.55 var(--font-sans);
  color: var(--fg-secondary);
  margin: 0;
}
.footnote code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--co-slate-100);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ─────── per-flow shell ─────── */

.shell {
  max-width: 600px;
  margin: 0 auto;
  padding: 56px 28px 100px;
}
.shell-narrow { max-width: 560px; }
.shell-wide   { max-width: 720px; }

.eyebrow {
  font: 600 11px/1 var(--font-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--co-sage-700);
  margin-bottom: 12px;
}

.h1-editorial {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fg-primary);
  margin: 0 0 14px;
}
.h1-display {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.022em;
  color: var(--fg-primary);
  margin: 0 0 8px;
}
.section-title {
  font: 600 16px/1.3 var(--font-sans);
  color: var(--fg-primary);
  margin: 0 0 4px;
}
.section-framing {
  font: 400 13px/1.55 var(--font-sans);
  color: var(--fg-secondary);
  margin: 0 0 20px;
}
.section-header { margin-bottom: 22px; }

.lede {
  font: 400 16px/1.6 var(--font-sans);
  color: var(--fg-secondary);
  margin: 0 0 28px;
  max-width: 540px;
}

/* ─────── empathy strip (triggered) ─────── */

.empathy-strip {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  margin-bottom: 28px;
}
.empathy-strip .eyebrow { margin-bottom: 6px; }
.empathy-text {
  font: 400 14px/1.55 var(--font-sans);
  color: var(--fg-secondary);
  margin: 0;
}
.waveform {
  color: var(--co-teal-700);
  flex-shrink: 0;
  margin-top: 4px;
}

/* ─────── card ─────── */

.card {
  background: #fff;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow-1);
}

/* ─────── q-block ─────── */

.q-block { animation: fade-in 320ms var(--ease-out); }
.q-block + .q-block {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--border-subtle);
}
.q-prompt {
  font: 500 15px/1.5 var(--font-sans);
  color: var(--fg-primary);
  margin: 0 0 14px;
}
.q-prompt .hint {
  font-weight: 400;
  color: var(--fg-tertiary);
  font-size: 13px;
  margin-left: 4px;
}

/* ─────── choice row (Yes/No pills) ─────── */

.choice-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.choice-row button {
  font: 600 13px/1 var(--font-sans);
  padding: 13px 32px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: #fff;
  color: var(--fg-primary);
  cursor: pointer;
  min-width: 120px;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .choice-row button:hover {
    border-color: var(--co-teal-700);
    color: var(--co-teal-700);
  }
}
.choice-row button.active {
  background: var(--co-teal-700);
  color: #fff;
  border-color: var(--co-teal-700);
}

/* ─────── sliding-thumb Likert ─────── */

.likert {
  background: var(--co-slate-25);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px;
}
.likert-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n, 5), 1fr);
}
.likert-track input { position: absolute; opacity: 0; pointer-events: none; }
.likert-track label {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  font: 500 12px/1.3 var(--font-sans);
  color: var(--fg-secondary);
  padding: 12px 4px;
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--duration-base) var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.likert-track label .val {
  font: 600 10px/1 var(--font-sans);
  color: var(--fg-tertiary);
  width: 22px; height: 22px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  background: #fff;
  transition: all var(--duration-base) var(--ease-out);
}
.likert-track .thumb {
  position: absolute;
  top: 0; left: 0;
  width: calc(100% / var(--n, 5));
  height: 100%;
  background: var(--co-teal-700);
  border-radius: 8px;
  transition: transform var(--duration-base) var(--ease-out);
  z-index: 1;
}
/* Thumb glide */
.likert-5 .likert-track:has(input[value="2"]:checked) .thumb { transform: translateX(100%); }
.likert-5 .likert-track:has(input[value="3"]:checked) .thumb { transform: translateX(200%); }
.likert-5 .likert-track:has(input[value="4"]:checked) .thumb { transform: translateX(300%); }
.likert-5 .likert-track:has(input[value="5"]:checked) .thumb { transform: translateX(400%); }
/* Active label color flips to white */
.likert-5 .likert-track:has(input[value="1"]:checked) label[data-v="1"],
.likert-5 .likert-track:has(input[value="2"]:checked) label[data-v="2"],
.likert-5 .likert-track:has(input[value="3"]:checked) label[data-v="3"],
.likert-5 .likert-track:has(input[value="4"]:checked) label[data-v="4"],
.likert-5 .likert-track:has(input[value="5"]:checked) label[data-v="5"] {
  color: #fff;
  font-weight: 600;
}
.likert-5 .likert-track:has(input[value="1"]:checked) label[data-v="1"] .val,
.likert-5 .likert-track:has(input[value="2"]:checked) label[data-v="2"] .val,
.likert-5 .likert-track:has(input[value="3"]:checked) label[data-v="3"] .val,
.likert-5 .likert-track:has(input[value="4"]:checked) label[data-v="4"] .val,
.likert-5 .likert-track:has(input[value="5"]:checked) label[data-v="5"] .val {
  color: var(--co-teal-700);
  background: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}

/* ─────── multi-select chips ─────── */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips input[type="checkbox"] { position: absolute; opacity: 0; pointer-events: none; }
.chips label {
  font: 500 13px/1 var(--font-sans);
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-default);
  background: #fff;
  color: var(--fg-primary);
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .chips label:hover { border-color: var(--co-teal-300); }
}
.chips input[type="checkbox"]:focus-visible + label {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.chips input[type="checkbox"]:checked + label {
  background: var(--co-teal-50);
  border-color: var(--co-teal-700);
  color: var(--co-teal-900);
}

/* ─────── NPS 0-10 ─────── */

.nps {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
}
.nps input { position: absolute; opacity: 0; pointer-events: none; }
.nps label {
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-default);
  background: #fff;
  color: var(--fg-primary);
  font: 600 14px/1 var(--font-sans);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all var(--duration-fast);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .nps label:hover {
    border-color: var(--co-teal-300);
    color: var(--co-teal-700);
  }
}
.nps input:checked + label {
  background: var(--co-teal-700);
  color: #fff;
  border-color: var(--co-teal-700);
}
.nps-edges {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font: 500 11px/1 var(--font-sans);
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─────── textarea ─────── */

.textarea {
  width: 100%;
  min-height: 120px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-primary);
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: #fff;
  outline: none;
  resize: vertical;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.textarea:focus {
  border-color: var(--co-teal-700);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ─────── stepper ─────── */

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
}
.stepper-step { display: flex; align-items: center; gap: 6px; }
.stepper-dot {
  width: 26px; height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 600 11px/1 var(--font-sans);
  background: transparent;
  color: var(--fg-tertiary);
  border: 1px solid var(--border-default);
  transition: all var(--duration-fast);
}
.stepper-step.complete .stepper-dot {
  background: var(--co-teal-100);
  color: var(--co-teal-700);
  border-color: var(--co-teal-100);
}
.stepper-step.current .stepper-dot {
  background: var(--co-teal-700);
  color: #fff;
  border-color: var(--co-teal-700);
}
.stepper-line {
  width: 24px; height: 1px;
  background: var(--border-default);
}

/* ─────── group dot indicator (Variant B) ─────── */

.group-dots {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 24px;
  flex-wrap: wrap;
}
.group-dot-step { display: flex; align-items: center; gap: 8px; }
.group-dot-num {
  width: 24px; height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 600 11px/1 var(--font-sans);
  background: transparent;
  color: var(--fg-tertiary);
  border: 1px solid var(--border-default);
  transition: all var(--duration-fast);
}
.group-dot-label {
  font: 500 13px/1 var(--font-sans);
  color: var(--fg-tertiary);
}
.group-dot-step.complete .group-dot-num {
  background: var(--co-teal-100);
  color: var(--co-teal-700);
  border-color: var(--co-teal-100);
}
.group-dot-step.current .group-dot-num {
  background: var(--co-teal-700);
  color: #fff;
  border-color: var(--co-teal-700);
}
.group-dot-step.current .group-dot-label {
  color: var(--fg-primary);
  font-weight: 600;
}
.group-dot-line {
  width: 28px;
  height: 1px;
  background: var(--border-default);
}

/* ─────── buttons ─────── */

.btn-primary {
  font: 600 14px/1 var(--font-sans);
  padding: 14px 24px;
  border-radius: 12px;
  background: var(--co-teal-700);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast);
  letter-spacing: -0.005em;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: var(--shadow-2);
  }
}
.btn-ghost {
  font: 500 13px/1 var(--font-sans);
  color: var(--fg-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 14px 4px;
  text-decoration: none;
  transition: color var(--duration-fast);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .btn-ghost:hover { color: var(--fg-primary); text-decoration: none; }
}

/* ─────── footer (button row) ─────── */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

/* ─────── thanks ─────── */

.thanks {
  text-align: center;
  padding: 60px 28px 48px;
}
.thanks p {
  font: 400 15px/1.55 var(--font-sans);
  color: var(--fg-secondary);
  margin: 0 auto;
  max-width: 400px;
}
.thanks h2 { margin-bottom: 8px; }

/* ─────── animation ─────── */

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ═════════════════════════════════════════════════════════════════════════
   v4 ENTRY SURVEY — EntryAppV4.jsx port
   ChromeHeader + Sidebar + signature header + section card + step nav
   ═════════════════════════════════════════════════════════════════════════ */

@keyframes q-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.q-rise { animation: q-rise 380ms cubic-bezier(0.2, 0, 0, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .q-rise { animation: none !important; }
}

/* ─── chrome header (sticky) ────────────────────────────────────────────── */

.v4-chrome {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 4px 16px -8px rgba(25,28,30,0.06);
}
.v4-chrome-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.v4-chrome-brand-progress {
  justify-content: flex-start;
}
.v4-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 700 19px/1 var(--font-sans);
  letter-spacing: -0.01em;
}
.v4-wordmark-logo {
  display: block;
  width: min(190px, 42vw);
  height: auto;
  aspect-ratio: 15 / 4;
  object-fit: contain;
}
.v4-progress-thread {
  position: relative;
  height: 2px;
  background: rgba(128, 183, 177, 0.18);
  border-radius: 999px;
  overflow: hidden;
  flex: 1;
  max-width: 400px;
}
.v4-progress-thread--research {
  max-width: none;
  min-width: 120px;
}
.v4-progress-thread > span {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--co-sage-700), var(--co-sage-500));
  transform-origin: left;
  transition: transform 480ms cubic-bezier(0.2,0,0,1);
}
.v4-encrypted {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 12px/1 var(--font-sans);
  color: var(--fg-secondary);
}

/* ─── shell layout ──────────────────────────────────────────────────────── */

.v4-entry-container {
  display: flex;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* ─── sidebar ───────────────────────────────────────────────────────────── */

.v4-sidebar {
  width: 264px;
  flex-shrink: 0;
  padding: 40px 24px 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid rgba(226, 232, 240, 0.5);
}
.v4-sidebar-header {
  padding: 0 12px 18px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  margin-bottom: 12px;
}
.v4-sidebar-header .v4-eyebrow { margin-bottom: 8px; }
.v4-sidebar-id {
  font: 500 12px/1.4 var(--font-mono);
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
}

.v4-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  margin: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: all 180ms cubic-bezier(0.2,0,0,1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .v4-nav-item:hover { background: rgba(255, 255, 255, 0.6); text-decoration: none; }
}
.v4-nav-item.active {
  background: linear-gradient(180deg, var(--co-sage-700) 0%, var(--co-sage-800) 100%);
  box-shadow: 0 4px 14px rgba(47, 93, 87, 0.20), 0 1px 2px rgba(47, 93, 87, 0.18);
}
@media (hover: hover) {
  .v4-nav-item.active:hover { background: linear-gradient(180deg, var(--co-sage-700) 0%, var(--co-sage-800) 100%); }
}
.v4-nav-item.locked {
  opacity: 0.45;
  cursor: not-allowed;
}
@media (hover: hover) {
  .v4-nav-item.locked:hover { background: transparent; }
}

.v4-nav-step {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 600 11px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--fg-tertiary);
  background: transparent;
  border: 1px solid rgba(226, 232, 240, 0.9);
}
.v4-nav-item.active .v4-nav-step {
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.v4-nav-item.done .v4-nav-step {
  color: var(--co-sage-800);
  background: rgba(186, 228, 219, 0.55);
  border-color: transparent;
}

.v4-nav-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.v4-nav-label {
  font: 500 13px/1.2 var(--font-sans);
  color: var(--fg-primary);
}
.v4-nav-item.active .v4-nav-label {
  font-weight: 600;
  color: #fff;
}
.v4-nav-desc {
  font: 400 11px/1.3 var(--font-sans);
  color: var(--fg-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.v4-nav-item.active .v4-nav-desc { color: rgba(255, 255, 255, 0.78); }

/* ─── main column ───────────────────────────────────────────────────────── */

.v4-main {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 96px;
  max-width: 760px;
}

/* ─── eyebrow / mono / utility ──────────────────────────────────────────── */

.v4-eyebrow {
  font: 600 10px/1 var(--font-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--co-sage-800);
}
.v4-mono {
  font: 500 11px/1 var(--font-mono);
  color: var(--fg-tertiary);
  letter-spacing: 0.04em;
}
.v4-bullet {
  width: 4px; height: 4px;
  border-radius: 999px;
  background: var(--fg-tertiary);
  display: inline-block;
}
.v4-meta-bullet {
  width: 3px; height: 3px;
  border-radius: 999px;
  background: var(--fg-tertiary);
  display: inline-block;
}

/* ─── editorial title (display-xl) ──────────────────────────────────────── */

.v4-display-xl {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg-primary);
}
.v4-display-xl em {
  font-style: italic;
  font-weight: 600;
  color: var(--co-sage-800);
}

/* ─── signature header (step 1) ─────────────────────────────────────────── */

.v4-signature { margin-bottom: 44px; }
.v4-signature-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.v4-welcome {
  margin: 0 0 18px;
  font-size: clamp(40px, 5vw, 56px);
  line-height: 1.05;
}
.v4-lede {
  font: 400 17px/1.6 var(--font-sans);
  color: var(--fg-secondary);
  max-width: 580px;
  margin: 0 0 22px;
}
.v4-meta-row {
  display: inline-flex;
  gap: 18px;
  align-items: center;
  font: 500 11px/1 var(--font-sans);
  color: var(--fg-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.v4-meta-num {
  color: var(--fg-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ─── section shell + card ──────────────────────────────────────────────── */

.v4-section-shell { margin-bottom: 32px; }
.v4-section-header { margin-bottom: 28px; }
.v4-section-title {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.018em;
}
.v4-section-intro {
  margin: 0;
  font: 400 15px/1.6 var(--font-sans);
  color: var(--fg-secondary);
  max-width: 540px;
}
.v4-card-elevated {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: 18px;
  padding: 32px 36px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 1px 2px rgba(25, 28, 30, 0.04),
    0 8px 32px rgba(25, 28, 30, 0.06),
    0 24px 64px -16px rgba(47, 93, 87, 0.10);
}

.v4-research-form-shell {
  width: min(100%, 880px);
  margin-right: auto;
  margin-left: auto;
}
.v4-research-contact-form {
  width: min(100%, 760px);
}
.v4-research-consent-form {
  width: min(100%, 780px);
}
.v4-research-module-form {
  width: min(100%, 820px);
}
.v4-research-module-form > .v4-card-elevated {
  padding-top: 40px;
}
.v4-research-card-stack {
  display: grid;
  gap: var(--space-6);
}
.v4-research-action-card {
  display: grid;
  gap: var(--space-5);
}
.v4-research-action-card .v4-section-intro {
  max-width: none;
}
.v4-research-action-card .v4-research-form-actions {
  margin-top: 0;
}
.v4-oauth-status-shell {
  width: min(100%, 640px);
}
.v4-oauth-status-card {
  display: grid;
  gap: var(--space-5);
  padding: var(--space-8);
}
.v4-oauth-status-card .v4-section-intro {
  max-width: none;
}
.v4-oauth-status-card .v4-form-error,
.v4-oauth-action {
  margin: 0;
}
.v4-oauth-form {
  display: grid;
  margin: 0;
}
.v4-oauth-form .v4-submit-btn,
.v4-oauth-form button[type="submit"],
.v4-oauth-action .v4-submit-btn {
  width: 100%;
  min-height: 46px;
  justify-content: center;
}
.v4-oauth-form button[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font: 600 var(--text-sm)/1 var(--font-sans);
  padding: var(--space-4) var(--space-6);
  border: none;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, var(--co-sage-700) 0%, var(--co-sage-800) 100%);
  color: var(--bg-primary);
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-2);
  transition:
    transform var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .v4-oauth-form button[type="submit"]:hover {
    background: linear-gradient(180deg, var(--co-sage-600) 0%, var(--co-sage-700) 100%);
    transform: translateY(-1px);
  }
}
.v4-oauth-form button[type="submit"]:focus-visible,
.v4-oauth-action .v4-submit-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.v4-research-status-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-3) var(--space-5);
  margin: var(--space-1) 0 0;
  padding: var(--space-4);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--co-slate-25);
}
.v4-research-status-list dt {
  margin: 0;
  color: var(--fg-primary);
  font: 700 var(--text-sm)/1.4 var(--font-sans);
}
.v4-research-status-list dd {
  margin: 0;
  color: var(--fg-secondary);
  font: 500 var(--text-sm)/1.4 var(--font-sans);
}
.v4-research-module-notice {
  margin: 0 0 36px;
  padding: 24px 28px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 14px 38px -26px rgba(47, 93, 87, 0.26);
}
.v4-research-module-notice .v4-protocol-notice-text {
  font-size: 13px;
  line-height: 1.6;
}
.v4-research-module-notice .v4-protocol-notice-text h2 {
  margin-bottom: 10px;
  font-size: 13px;
}
.v4-research-module-notice .v4-protocol-notice-text p + p {
  margin-top: 12px;
}
.v4-research-landing-header {
  display: grid;
  justify-items: start;
  margin: 0 0 var(--space-8);
  text-align: left;
}
.v4-research-landing-header .v4-eyebrow {
  margin-bottom: var(--space-5);
}
.v4-research-landing-title {
  justify-self: stretch;
  margin: 0 0 var(--space-3);
  font-size: var(--text-3xl);
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
}
.v4-research-landing-subtitle {
  justify-self: stretch;
  max-width: 760px;
  margin: 0 auto;
  font-size: var(--text-base);
  line-height: 1.6;
  font-weight: 600;
  text-align: center;
  color: var(--fg-secondary);
}
.v4-research-copy {
  width: 100%;
  max-width: 780px;
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-5);
}
.v4-research-copy-paragraph {
  max-width: none;
  text-align: left;
}

.v4-consent-document {
  display: grid;
  gap: 28px;
  padding: 42px 48px;
  border-color: rgba(203, 213, 225, 0.95);
  border-radius: 10px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 1px 2px rgba(25, 28, 30, 0.04),
    0 18px 48px -24px rgba(47, 93, 87, 0.24);
}
.v4-consent-title-block {
  display: grid;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
.v4-consent-title-block h2 {
  margin: 0;
  font: 600 28px/1.15 var(--font-serif);
  color: var(--fg-primary);
}
.v4-consent-title-block p {
  margin: 0;
  font: 600 14px/1.45 var(--font-sans);
  color: var(--fg-secondary);
}
.v4-consent-facts {
  display: grid;
  margin: 10px 0 0;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.v4-consent-facts div {
  display: grid;
  grid-template-columns: minmax(160px, 210px) 1fr;
  min-width: 0;
}
.v4-consent-facts dt,
.v4-consent-facts dd {
  margin: 0;
  padding: 12px 14px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  font: 500 13px/1.45 var(--font-sans);
}
.v4-consent-facts div:first-child dt,
.v4-consent-facts div:first-child dd {
  border-top: none;
}
.v4-consent-facts dt {
  background: rgba(247, 249, 251, 0.78);
  color: var(--fg-primary);
  font-weight: 700;
}
.v4-consent-facts dd {
  color: var(--fg-secondary);
}
.v4-consent-section {
  display: grid;
  gap: 12px;
}
.v4-consent-section h2 {
  margin: 0;
  font: 600 19px/1.3 var(--font-serif);
  color: var(--fg-primary);
}
.v4-consent-section p,
.v4-consent-section li {
  margin: 0;
  font: 400 14px/1.7 var(--font-sans);
  color: var(--fg-secondary);
}
.v4-consent-section ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}
.v4-consent-checklist {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}
.v4-consent-check {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: 10px;
  background: rgba(247, 249, 251, 0.58);
  color: var(--fg-secondary);
  font: 400 13px/1.58 var(--font-sans);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.v4-consent-check:has(input:checked) {
  border-color: rgba(87, 149, 138, 0.56);
  background: rgba(244, 248, 247, 0.92);
  color: var(--fg-primary);
}
.v4-consent-check:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.v4-consent-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--co-sage-700);
}
.v4-consent-attestation-card {
  margin-top: 0;
  padding: 22px 24px;
}
.v4-consent-attestation {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font: 500 14px/1.55 var(--font-sans);
  color: var(--fg-primary);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.v4-consent-attestation input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--co-sage-700);
}

/* ─── group + question rows ─────────────────────────────────────────────── */

.v4-group-block { margin-bottom: 32px; }
.v4-group-block:last-child { margin-bottom: 0; }
.v4-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.v4-group-rule {
  flex: 1;
  height: 1px;
  background: rgba(226, 232, 240, 0.7);
}
.v4-group-framing {
  font: 400 14px/1.6 var(--font-sans);
  color: var(--fg-secondary);
  margin: 0 0 20px;
  max-width: 540px;
}

.v4-question-row { /* row container — divider between handled separately */ }
.v4-q-head {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 14px;
}
.v4-q-number {
  font: 500 11px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--co-sage-700);
  padding-top: 4px;
  min-width: 22px;
}
.v4-q-prompt {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.008em;
  color: var(--fg-primary);
  flex: 1;
}
.v4-q-note {
  display: block;
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.45;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--fg-secondary);
}
.v4-optional {
  margin-left: 10px;
  font: 500 11px/1 var(--font-sans);
  color: var(--fg-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.v4-q-hint {
  padding-left: 36px;
  margin: 0 0 12px;
  font: 400 13px/1.5 var(--font-sans);
  color: var(--fg-tertiary);
}
.v4-q-answer { padding-left: 36px; }
.v4-q-divider {
  height: 1px;
  background: rgba(226, 232, 240, 0.7);
  margin: 26px 0;
}

/* ─── inputs (text / number / phone / textarea) ─────────────────────────── */

.v4-input {
  width: 100%;
  max-width: var(--input-max);
  min-width: 0;
  min-height: 46px;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4;
  color: var(--fg-primary);
  padding: 11px 14px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(247, 249, 251, 0.6);
  border-radius: 10px;
  outline: none;
  transition: all 180ms cubic-bezier(0.2,0,0,1);
}
.v4-input:focus {
  border-color: var(--co-sage-700);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(87, 149, 138, 0.14);
}
/* iOS Safari renders date inputs with native control chrome whose intrinsic
   sizing escapes the card; strip it so they lay out like every other field. */
.v4-input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  text-align: left;
}
.v4-pill-followup-input {
  flex-basis: min(100%, var(--input-max));
  margin-top: var(--space-2);
}
/* Labeled date/time fields: label text sits above its input, successive
   fields get clear separation. */
.v4-field-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: var(--input-max);
}
.v4-field-grid + .v4-pill-group {
  margin-top: 16px;
}
.v4-field-grid + .v4-choice-stack {
  margin-top: 18px;
}
.v4-field-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: 500 13px/1.3 var(--font-sans);
  color: var(--fg-secondary);
}
.v4-num-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.v4-num-input {
  width: 110px;
  box-sizing: border-box;
  font: 500 16px/1.4 var(--font-sans);
  padding: 12px 14px;
  font-variant-numeric: tabular-nums;
}
.v4-num-input::-webkit-outer-spin-button,
.v4-num-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.v4-num-input { -moz-appearance: textfield; }
.v4-suffix {
  font: 500 13px/1 var(--font-sans);
  color: var(--fg-tertiary);
}
.v4-phone-input {
  width: 100%;
  max-width: var(--input-max);
  box-sizing: border-box;
  font: 400 15px/1.4 var(--font-sans);
  padding: 12px 14px;
}
.v4-textarea {
  width: 100%;
  box-sizing: border-box;
  font: 400 15px/1.55 var(--font-sans);
  color: var(--fg-primary);
  padding: 14px 16px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: rgba(247, 249, 251, 0.6);
  border-radius: 12px;
  outline: none;
  resize: vertical;
  transition: all 180ms cubic-bezier(0.2,0,0,1);
  font-family: var(--font-sans);
}
.v4-textarea:focus {
  border-color: var(--co-sage-700);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(87, 149, 138, 0.14);
}

/* ─── pill group (single / multi / select / yesno) ──────────────────────── */

.v4-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.v4-pill {
  font: 500 13px/1.3 var(--font-sans);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  color: var(--fg-primary);
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.2,0,0,1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: inline-flex;
  align-items: center;
}
.v4-pill input { position: absolute; opacity: 0; pointer-events: none; }
/* hover is a pointer affordance only — on touch, iOS applies sticky :hover on
   first tap, flashing the hover tint under the checked state (tap flicker). */
@media (hover: hover) {
  .v4-pill:hover {
    border-color: var(--co-sage-400);
    background: rgba(247, 249, 251, 0.7);
  }
}
.v4-pill:has(input:checked) {
  background: var(--co-sage-700);
  color: #fff;
  border-color: var(--co-sage-700);
}
.v4-pill:has(input:focus-visible) {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ─── likert strip (sliding thumb) ──────────────────────────────────────── */

.v4-likert-strip {
  position: relative;
  display: grid;
  padding: 4px;
  background: rgba(244, 248, 247, 0.8);
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 12px;
}
/* minmax(0, …) keeps tracks equal even when a label's min-content width
   exceeds its share — otherwise the fixed-percent thumb lands off-cell. */
.v4-likert-strip[data-n="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.v4-likert-strip[data-n="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v4-likert-strip[data-n="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.v4-likert-strip[data-n="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.v4-likert-strip[data-n="7"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }

.v4-likert-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: linear-gradient(180deg, var(--co-sage-700) 0%, var(--co-sage-800) 100%);
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(47, 93, 87, 0.22), 0 1px 2px rgba(47, 93, 87, 0.18);
  transition: left 280ms cubic-bezier(0.2,0,0,1), opacity 180ms;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
}
.v4-likert-strip[data-n="5"] .v4-likert-thumb { width: calc(20% - 8px); }
.v4-likert-strip[data-n="5"]:has(input[value="0"]:checked) .v4-likert-thumb { left: calc(0% + 4px); opacity: 1; }
.v4-likert-strip[data-n="5"]:has(input[value="1"]:checked) .v4-likert-thumb { left: calc(20% + 4px); opacity: 1; }
.v4-likert-strip[data-n="5"]:has(input[value="2"]:checked) .v4-likert-thumb { left: calc(40% + 4px); opacity: 1; }
.v4-likert-strip[data-n="5"]:has(input[value="3"]:checked) .v4-likert-thumb { left: calc(60% + 4px); opacity: 1; }
.v4-likert-strip[data-n="5"]:has(input[value="4"]:checked) .v4-likert-thumb { left: calc(80% + 4px); opacity: 1; }

.v4-likert-pill {
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
  padding: 10px 6px;
  font: 500 12px/1.2 var(--font-sans);
  color: var(--fg-secondary);
  cursor: pointer;
  text-align: center;
  transition: color 200ms;
  border-radius: 8px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.v4-likert-pill input { position: absolute; opacity: 0; pointer-events: none; }
.v4-likert-pill:has(input:checked) {
  font-weight: 600;
  color: #fff;
}

/* ─── 0-N scale strip ───────────────────────────────────────────────────── */

.v4-scale-strip {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 6px;
}
.v4-scale-cell {
  aspect-ratio: 1 / 1;
  font: 600 13px/1 var(--font-sans);
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  color: var(--fg-primary);
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 160ms cubic-bezier(0.2,0,0,1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.v4-scale-cell input { position: absolute; opacity: 0; pointer-events: none; }
@media (hover: hover) {
  .v4-scale-cell:hover {
    border-color: var(--co-sage-400);
    color: var(--co-sage-800);
  }
}
.v4-scale-cell:has(input:checked) {
  background: linear-gradient(180deg, var(--co-sage-700) 0%, var(--co-sage-800) 100%);
  color: #fff;
  border-color: var(--co-sage-700);
  box-shadow: 0 4px 12px rgba(47, 93, 87, 0.22);
}
.v4-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font: 500 11px/1 var(--font-sans);
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── step nav ──────────────────────────────────────────────────────────── */

.v4-step-nav {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.v4-research-form-actions {
  justify-content: center;
  margin-top: 34px;
}
.v4-research-form-actions .v4-submit-btn {
  min-width: 152px;
  justify-content: center;
}
.v4-section-counter {
  font: 500 12px/1 var(--font-sans);
  color: var(--fg-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.v4-section-counter .v4-meta-num {
  color: var(--fg-primary);
  font-weight: 700;
}
.v4-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 500 13px/1 var(--font-sans);
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  color: var(--fg-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 160ms cubic-bezier(0.2,0,0,1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .v4-back-btn:hover {
    border-color: var(--co-sage-400);
    background: rgba(247, 249, 251, 0.7);
    text-decoration: none;
  }
}
.v4-submit-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 600 14px/1 var(--font-sans);
  padding: 14px 24px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(180deg, var(--co-sage-700) 0%, var(--co-sage-800) 100%);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(47, 93, 87, 0.22), 0 1px 2px rgba(47, 93, 87, 0.18);
  transition: all 180ms cubic-bezier(0.2,0,0,1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .v4-submit-btn:hover {
    background: linear-gradient(180deg, var(--co-sage-600) 0%, var(--co-sage-700) 100%);
    transform: translateY(-1px);
    text-decoration: none;
  }
}

/* ─── privacy ───────────────────────────────────────────────────────────── */

.v4-privacy {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 32px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(226, 232, 240, 0.6);
  border-radius: 12px;
}
.v4-privacy-icon {
  color: var(--co-sage-700);
  flex-shrink: 0;
  margin-top: 1px;
  display: inline-flex;
}
.v4-privacy-text {
  font: 400 12px/1.55 var(--font-sans);
  color: var(--fg-secondary);
}

.v4-protocol-notice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 32px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(196, 218, 214, 0.9);
  border-left: 3px solid var(--co-sage-700);
  border-radius: 8px;
}
.v4-protocol-notice-icon {
  color: var(--co-sage-700);
  flex-shrink: 0;
  margin-top: 2px;
  display: inline-flex;
}
.v4-protocol-notice-text {
  font: 400 12px/1.55 var(--font-sans);
  color: var(--fg-secondary);
}
.v4-protocol-notice-text h2 {
  margin: 0 0 6px;
  font: 600 12px/1.3 var(--font-sans);
  color: var(--fg-primary);
}
.v4-protocol-notice-text p {
  margin: 0;
}
.v4-protocol-notice-text p + p {
  margin-top: 8px;
}
.v4-research-inline-error {
  margin: 0 0 var(--space-6);
  background: var(--status-danger-bg);
  border-color: var(--status-danger-bg);
  border-left-color: var(--status-danger-accent);
}
.v4-form-error {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--status-danger-bg);
  border-left: 3px solid var(--status-danger-accent);
  border-radius: var(--radius-sm);
  background: var(--status-danger-bg);
  color: var(--status-danger-fg);
  font: 500 var(--text-sm)/1.5 var(--font-sans);
}

/* ─── review block ──────────────────────────────────────────────────────── */

.v4-review-section {
  padding: 24px 0;
  border-top: 1px solid rgba(226, 232, 240, 0.7);
}
.v4-review-section.first {
  padding: 0 0 24px;
  border-top: none;
}
.v4-review-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 14px;
}
.v4-review-num {
  font: 500 12px/1 var(--font-mono);
  color: var(--co-sage-700);
}
.v4-review-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  flex: 1;
}
.v4-review-edit {
  font: 500 12px/1 var(--font-sans);
  color: var(--co-sage-800);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .v4-review-edit:hover {
    background: rgba(247, 249, 251, 0.7);
    text-decoration: none;
  }
}
.v4-review-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 8px 0;
  padding-left: 36px;
}
.v4-review-q {
  font: 400 13px/1.5 var(--font-sans);
  color: var(--fg-secondary);
}
.v4-review-a {
  font: 500 13px/1.5 var(--font-sans);
  color: var(--fg-primary);
}
.v4-review-empty {
  color: var(--fg-tertiary);
  font-style: italic;
}

/* ─── closing screen ────────────────────────────────────────────────────── */

.v4-research-terminal {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
/* Survey closing pages: header + centered closing + policy footer pinned in
   one static viewport, mirroring the research terminal. */
.v4-survey-terminal {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.v4-survey-terminal .v4-closing {
  min-height: 0;
  padding-top: clamp(36px, 6vh, 64px);
  padding-bottom: clamp(18px, 3vh, 28px);
}
.v4-survey-terminal .v4-research-footer {
  margin-bottom: clamp(20px, 4vh, 36px);
}
.v4-closing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
}
.v4-research-terminal .v4-closing {
  min-height: 0;
  padding-top: clamp(36px, 6vh, 64px);
  padding-bottom: clamp(18px, 3vh, 28px);
}
.v4-closing-inner { max-width: 720px; }
.v4-closing-mark {
  margin-bottom: 32px;
  display: flex;
  justify-content: center;
}
.v4-closing-logo-mark {
  margin-bottom: 32px;
  display: flex;
  justify-content: center;
}
.v4-closing-logo-img {
  display: block;
  width: min(112px, 34vw);
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
}
.v4-research-closing-title {
  margin: 0;
  font-size: var(--text-display);
  line-height: 1.1;
}
.v4-closing-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.v4-closing-lede {
  font: 400 17px/1.75 var(--font-sans);
  color: var(--fg-secondary);
  max-width: 680px;
  margin: 0 auto;
}
.v4-closing-lede p {
  margin: 0;
}
.v4-closing-lede p + p {
  margin-top: 16px;
}
.v4-closing-lede-body {
  text-align: center;
}
.v4-closing-lede-contact {
  text-align: left;
  text-wrap: pretty;
}
.v4-closing-meta {
  margin-top: 36px;
  display: inline-flex;
  gap: 14px;
  align-items: center;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.7);
  font: 500 12px/1 var(--font-sans);
  color: var(--fg-secondary);
}

/* ─── public research footer ───────────────────────────────────────────── */

.v4-research-footer {
  width: 100%;
  max-width: 680px;
  margin: 0 auto 48px;
  padding: 0 32px;
  color: var(--fg-tertiary);
  box-sizing: border-box;
  text-align: center;
}
.v4-research-terminal .v4-research-footer {
  margin-bottom: clamp(20px, 4vh, 36px);
}
.v4-research-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.v4-research-footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font: 500 12px/1.3 var(--font-sans);
  color: var(--fg-secondary);
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .v4-research-footer-link:hover {
    color: var(--co-sage-800);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

/* ─── responsive ────────────────────────────────────────────────────────── */

@media (max-width: 880px) {
  .v4-sidebar { display: none; }
  .v4-main { padding: 32px 24px 80px; }
  .v4-chrome-inner { padding: 14px 20px; gap: 14px; }
  .v4-encrypted span { display: none; }
  .v4-welcome { font-size: 38px !important; }
  .v4-section-title { font-size: 26px; }
  .v4-review-row { grid-template-columns: 1fr; gap: 4px; padding-left: 0; }
}

@media (max-width: 480px) {
  .v4-chrome-inner {
    padding: 12px 16px;
    gap: 12px;
    min-width: 0;
  }
  .v4-wordmark { min-width: 0; }
  .v4-wordmark-logo { width: min(156px, 48vw); }
  .v4-progress-thread { min-width: 54px; }
  .v4-main {
    width: 100%;
    padding: 28px 16px 72px;
  }
  .v4-signature { margin-bottom: 32px; }
  .v4-signature-meta {
    flex-wrap: wrap;
    gap: 10px 12px;
    margin-bottom: 18px;
  }
  .v4-welcome {
    font-size: 34px !important;
    line-height: 1.08;
    letter-spacing: -0.018em;
  }
  .v4-lede {
    font-size: 15px;
    line-height: 1.55;
  }
  .v4-meta-row {
    flex-wrap: wrap;
    gap: 8px 12px;
    line-height: 1.3;
  }
  .v4-section-shell { margin-bottom: 28px; }
  .v4-section-header { margin-bottom: 20px; }
  .v4-section-title {
    font-size: 24px;
    line-height: 1.18;
  }
  .v4-section-intro {
    font-size: 14px;
    line-height: 1.55;
  }
  .v4-research-landing-header {
    margin-bottom: 24px;
  }
  .v4-research-landing-title {
    font-size: 28px;
    line-height: 1.1;
  }
  .v4-research-landing-subtitle {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.4;
  }
  .v4-research-copy {
    gap: 14px;
    margin-top: 20px;
  }
  .v4-research-copy-paragraph {
    text-align: justify;
    text-justify: inter-word;
  }
  .v4-research-module-form > .v4-card-elevated {
    padding-top: 28px;
  }
  .v4-research-module-notice {
    margin-bottom: 28px;
    padding: 18px 18px;
  }
  .v4-research-module-notice .v4-protocol-notice-text {
    font-size: 12px;
    line-height: 1.55;
  }
  .v4-consent-document {
    gap: 20px;
    padding: 26px 20px;
    border-radius: 10px;
  }
  .v4-consent-title-block {
    gap: 10px;
    padding-bottom: 6px;
  }
  .v4-consent-title-block h2 {
    font-size: 23px;
  }
  .v4-consent-facts div {
    grid-template-columns: 1fr;
  }
  .v4-consent-facts dt,
  .v4-consent-facts dd {
    padding: 10px 12px;
  }
  .v4-consent-facts dd {
    border-top: none;
  }
  .v4-consent-section h2 {
    font-size: 17px;
  }
  .v4-consent-section p,
  .v4-consent-section li {
    font-size: 13px;
    line-height: 1.6;
  }
  .v4-consent-checklist {
    gap: 10px;
  }
  .v4-consent-check {
    grid-template-columns: 18px 1fr;
    gap: 10px;
    padding: 13px 14px;
    font-size: 12px;
    line-height: 1.55;
  }
  .v4-consent-check input {
    width: 17px;
    height: 17px;
  }
  .v4-consent-attestation-card {
    margin-top: 20px;
    padding: 18px;
  }
  .v4-consent-attestation {
    font-size: 13px;
    line-height: 1.55;
  }
  .v4-card-elevated {
    border-radius: 14px;
    padding: 24px 18px;
  }
  .v4-oauth-status-card {
    padding: var(--space-6) var(--space-5);
  }
  .v4-research-status-list {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
  .v4-research-status-list dd + dt {
    margin-top: var(--space-2);
  }
  .v4-group-block { margin-bottom: 26px; }
  .v4-group-header {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }
  .v4-q-head {
    gap: 10px;
    margin-bottom: 12px;
  }
  .v4-q-number { min-width: 20px; }
  .v4-q-hint,
  .v4-q-answer {
    padding-left: 30px;
  }
  .v4-q-prompt {
    font-size: 16px;
    line-height: 1.42;
  }
  .v4-q-note {
    font-size: 14px;
    line-height: 1.45;
  }
  .v4-optional {
    display: block;
    margin: 8px 0 0;
  }
  .v4-q-divider { margin: 22px 0; }
  .v4-input,
  .v4-phone-input,
  .v4-textarea {
    max-width: none;
    min-height: 46px;
    font-size: 16px;
  }
  .v4-num-wrap {
    display: flex;
    width: 100%;
  }
  .v4-num-input {
    width: 100%;
    min-width: 0;
  }
  .v4-pill-group { gap: 8px; }
  .v4-pill {
    min-height: 44px;
    padding: 11px 14px;
  }
  .v4-likert-strip { margin: 0 -8px; }
  .v4-likert-pill {
    min-height: 42px;
    padding: 10px 2px;
    font-size: 11px;
    letter-spacing: -0.01em;
  }
  .v4-scale-strip { gap: 3px; }
  .v4-scale-cell {
    min-width: 0;
    border-radius: 8px;
    font-size: 11px;
  }
  .v4-scale-labels {
    gap: 12px;
    line-height: 1.25;
    letter-spacing: 0.04em;
  }
  .v4-step-nav {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 12px;
  }
  .v4-research-form-actions {
    align-items: stretch;
    margin-top: 28px;
  }
  .v4-back-btn,
  .v4-submit-btn {
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }
  .v4-section-counter { text-align: center; }
  .v4-privacy,
  .v4-protocol-notice {
    margin-top: 24px;
    padding: 14px 16px;
  }
  .v4-closing {
    min-height: 100svh;
    padding: 40px 20px;
  }
  .v4-research-terminal .v4-closing {
    min-height: 0;
    padding: 32px 20px 18px;
  }
  .v4-closing-mark,
  .v4-closing-logo-mark {
    margin-bottom: 24px;
  }
  .v4-closing-logo-img,
  .v4-closing-mark .v4-wordmark-logo {
    width: min(96px, 32vw);
  }
  .v4-closing-lede {
    font-size: 15px;
  }
  .v4-closing-lede-body {
    text-align: center;
  }
  .v4-closing-lede-contact {
    text-align: left;
    text-wrap: pretty;
  }
  .v4-closing-meta {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
    line-height: 1.3;
    border-radius: 14px;
  }
  .v4-research-footer {
    margin-bottom: 32px;
    padding: 0 16px;
  }
  .v4-research-terminal .v4-research-footer {
    margin-bottom: 22px;
  }
  .v4-research-footer-links {
    justify-content: center;
    gap: 4px 14px;
  }
  .v4-research-footer-link {
    min-height: 44px;
    font-size: 12px;
  }
}

/* ═════════════════════════════════════════════════════════════════════════
   v4 WEEKLY CHECK-IN — WeeklyApp.jsx port
   Single-page Yes/No BigChoice + Yes-reveal follow-up
   ═════════════════════════════════════════════════════════════════════════ */

/* Simple chrome (no progress thread) — wordmark + Encrypted ID only */
.v4-chrome-simple {
  /* same paddings as v4-chrome-inner; no flex:1 thread between */
}

/* Centered weekly main column (680px max, like the screenshot) */
.v4-weekly-main {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 56px 32px 96px;
  box-sizing: border-box;
}

/* Override the welcome-sized signature title for weekly (smaller, denser) */
.v4-weekly-title {
  margin: 0 0 16px;
  font-size: clamp(36px, 4.5vw, 48px);
  line-height: 1.05;
}

/* Primary Q1 prompt — bold sans display, not signature-sized */
.v4-weekly-q1 {
  margin: 0 0 24px;
  font-size: 26px;
  line-height: 1.4;
  letter-spacing: -0.012em;
  font-family: var(--font-serif);
  font-weight: 700;
}

/* BigChoice — two large card buttons */
.v4-bigchoice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.v4-bigchoice {
  position: relative;
  text-align: left;
  padding: 26px 24px 22px;
  border-radius: 16px;
  border: 1.5px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(25, 28, 30, 0.03);
  transition: all 180ms cubic-bezier(0.2, 0, 0, 1);
  font-family: var(--font-sans);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
@media (hover: hover) {
  .v4-bigchoice:hover {
    border-color: var(--co-sage-400);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 14px rgba(25, 28, 30, 0.06);
    transform: translateY(-1px);
  }
}
.v4-bigchoice.active {
  border-color: var(--co-sage-700);
  background: linear-gradient(180deg, rgba(236, 243, 241, 0.7) 0%, rgba(221, 233, 230, 0.5) 100%);
  box-shadow: 0 6px 20px rgba(47, 93, 87, 0.14), 0 1px 2px rgba(47, 93, 87, 0.08);
  transform: translateY(0);
}
.v4-bigchoice-row-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.v4-bigchoice-label {
  font: 600 17px/1.3 var(--font-sans);
  color: var(--fg-primary);
  letter-spacing: -0.005em;
}
.v4-bigchoice.active .v4-bigchoice-label {
  color: var(--co-sage-900);
}
.v4-bigchoice-radio {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1.5px solid var(--co-slate-200);
  background: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 160ms;
}
.v4-bigchoice.active .v4-bigchoice-radio {
  border-color: var(--co-sage-700);
  background: var(--co-sage-700);
}
.v4-bigchoice-sub {
  display: block;
  margin-top: 8px;
  font: 500 13px/1.3 var(--font-sans);
  color: var(--fg-tertiary);
}
.v4-bigchoice.active .v4-bigchoice-sub {
  color: var(--co-sage-800);
}

/* Follow-up card-elevated — same visual as section card */
.v4-weekly-followup {
  margin-top: 28px;
  padding: 32px 36px;
}
.v4-weekly-field { /* row container */ }
.v4-weekly-field-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.v4-weekly-field-label {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -0.008em;
  flex: 1;
}
.v4-weekly-field-body {
  padding-left: 34px;
}

/* Static pills (date / time-of-day) — same visual as v4-pill but no input */
.v4-pill-static {
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  color: var(--fg-primary);
}
@media (hover: hover) {
  .v4-pill-static:hover {
    border-color: var(--co-sage-400);
    background: rgba(247, 249, 251, 0.7);
  }
}

/* Footer (hint + submit) */
.v4-weekly-footer {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.v4-weekly-footer:has(+ * .v4-weekly-followup),
.v4-weekly-followup ~ .v4-weekly-footer {
  margin-top: 32px;
}
.v4-weekly-hint {
  font: 500 13px/1.3 var(--font-sans);
  color: var(--fg-tertiary);
}
.v4-submit-btn-disabled,
.v4-submit-btn[disabled] {
  background: var(--co-slate-100) !important;
  color: var(--fg-tertiary) !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  transform: none !important;
}
@media (hover: hover) {
  .v4-submit-btn-disabled:hover,
  .v4-submit-btn[disabled]:hover {
    background: var(--co-slate-100) !important;
    transform: none !important;
  }
}

/* ─── Triggered Check-In (triggered_app.go) ────────────────────────────── */

.v4-trigger-main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 32px 96px;
  box-sizing: border-box;
}

/* Headline override — display-xl scaled larger than weekly's title */
.v4-trigger-headline {
  margin: 0 0 18px;
  font-size: clamp(40px, 5vw, 56px);
  line-height: 1.05;
}

/* Uppercase meta row under signature lede (~2 min · Window 9–9) */
.v4-trigger-meta {
  display: inline-flex;
  gap: 18px;
  align-items: center;
  font: 500 11.5px/1 var(--font-sans);
  color: var(--fg-tertiary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.v4-trigger-meta .v4-meta-num {
  color: var(--fg-secondary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Questions card — same v4-card-elevated visual, slightly larger padding */
.v4-trigger-card { padding: 36px 40px; }

/* Question row inside the trigger card */
.v4-trigger-q { padding: 4px 0; }
.v4-trigger-q-head {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 18px;
}
/* Larger question prompt — display-xl serif italic-em, 22px (vs Entry's 17) */
.v4-trigger-q-prompt {
  margin: 0;
  font-size: 22px;
  line-height: 1.35;
  letter-spacing: -0.012em;
  flex: 1;
}
.v4-trigger-q-body { padding-left: 36px; }

/* Edge labels below the likert strip ("No disruption" / "Major disruption") */
.v4-trigger-likert-edges {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font: 500 11px/1 var(--font-sans);
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ─── Choice stack (Q3 vertical radio cards) ───────────────────────────── */

.v4-choice-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.v4-choice-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  font: 500 14px/1.4 var(--font-sans);
  color: var(--fg-primary);
  cursor: pointer;
  text-align: left;
  transition: all 160ms cubic-bezier(0.2, 0, 0, 1);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.v4-choice-card input { position: absolute; opacity: 0; pointer-events: none; }
@media (hover: hover) {
  .v4-choice-card:hover {
    border-color: var(--co-sage-400);
    background: rgba(247, 249, 251, 0.7);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(25, 28, 30, 0.05);
  }
}
.v4-choice-card:has(input:checked),
.v4-choice-card.active {
  border-color: var(--co-sage-700);
  background: rgba(236, 243, 241, 0.7);
  box-shadow: 0 4px 14px rgba(47, 93, 87, 0.10);
  transform: translateY(0);
}
.v4-choice-radio {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1.5px solid var(--co-slate-200);
  background: #fff;
  display: grid;
  place-items: center;
  transition: all 160ms;
}
.v4-choice-card:has(input:checked) .v4-choice-radio,
.v4-choice-card.active .v4-choice-radio {
  border-color: var(--co-sage-700);
  background: var(--co-sage-700);
}
.v4-choice-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: transparent;
  transition: background 160ms;
}
.v4-choice-card:has(input:checked) .v4-choice-dot,
.v4-choice-card.active .v4-choice-dot {
  background: #fff;
}
.v4-choice-label { flex: 1; }

/* ─── "Why we're asking" empathy card ──────────────────────────────────── */

.v4-trigger-empathy {
  padding: 28px 40px;
  margin-top: 18px;
}
.v4-trigger-empathy-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.v4-trigger-empathy-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--co-sage-100);
  color: var(--co-sage-800);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.v4-trigger-empathy-body { flex: 1; }
.v4-trigger-empathy-text {
  margin: 0;
  font: 500 14px/1.55 var(--font-sans);
  color: var(--fg-secondary);
}
.v4-trigger-empathy-link {
  color: var(--co-sage-800);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─── Footer (counter + submit) ────────────────────────────────────────── */

.v4-trigger-footer {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.v4-trigger-counter {
  font: 500 13px/1 var(--font-sans);
  color: var(--fg-secondary);
}
.v4-trigger-counter-num {
  font-weight: 600;
  color: var(--fg-primary);
  font-variant-numeric: tabular-nums;
}

/* ─── Triggered closing screen ─────────────────────────────────────────── */

.v4-trigger-closing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
}
.v4-trigger-closing-inner { max-width: 520px; }
.v4-trigger-closing-mark { margin-bottom: 28px; }
.v4-trigger-checkcircle {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--co-sage-300) 0%, var(--co-sage-500) 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 32px rgba(47, 93, 87, 0.25);
}
.v4-trigger-closing-lede {
  margin: 0;
  font: 400 17px/1.6 var(--font-sans);
  color: var(--fg-secondary);
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Exit Survey (exit_app.go) ────────────────────────────────────────── */

.v4-exit-main {
  flex: 1;
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 32px 96px;
  box-sizing: border-box;
}
.v4-exit-headline {
  margin: 0 0 18px;
  font-size: clamp(40px, 5vw, 56px);
  line-height: 1.05;
}

.v4-exit-q { padding: 4px 0; }
.v4-exit-q-head {
  display: flex;
  gap: 14px;
  align-items: baseline;
  margin-bottom: 16px;
}
.v4-exit-q-body { padding-left: 36px; }
.v4-exit-textarea { min-height: 140px; }

/* ─── Exit closing screen ──────────────────────────────────────────────── */

.v4-exit-closing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
}
.v4-exit-closing-inner { max-width: 560px; }
.v4-exit-closing-mark {
  margin-bottom: 32px;
  display: flex;
  justify-content: center;
}
.v4-exit-closing-lede {
  margin: 0 auto;
  font: 400 17px/1.65 var(--font-sans);
  color: var(--fg-secondary);
  max-width: 480px;
}
.v4-exit-closing-meta-line {
  margin: 16px 0 0;
  font: 400 15px/1.65 var(--font-sans);
  color: var(--fg-tertiary);
}

/* ─── Responsive (≤720px) ──────────────────────────────────────────────── */

@media (max-width: 720px) {
  .v4-bigchoice-row { grid-template-columns: 1fr; }
  .v4-weekly-main { padding: 40px 20px 80px; }
  .v4-weekly-followup { padding: 24px 20px; }
  .v4-weekly-field-body { padding-left: 0; }

  .v4-trigger-main { padding: 24px 20px 80px; }
  .v4-trigger-card { padding: 26px 22px; }
  .v4-trigger-q-body { padding-left: 0; }
  .v4-trigger-q-head { gap: 10px; }
  .v4-trigger-empathy { padding: 22px 22px; }
  .v4-trigger-footer { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .v4-trigger-footer .v4-submit-btn { justify-content: center; }
  .v4-trigger-counter { text-align: center; }

  .v4-exit-main { padding: 28px 20px 80px; }
  .v4-exit-q-body { padding-left: 0; }
  .v4-scale-strip { gap: 4px; }
  .v4-scale-cell { font-size: 11px; }
}

@media (max-width: 480px) {
  .v4-weekly-main,
  .v4-trigger-main,
  .v4-exit-main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .v4-weekly-title,
  .v4-trigger-headline,
  .v4-exit-headline {
    font-size: 34px;
    line-height: 1.08;
    letter-spacing: -0.018em;
  }
  .v4-weekly-q1 {
    font-size: 21px;
    line-height: 1.35;
  }
  .v4-bigchoice {
    min-height: 76px;
    padding: 20px 18px;
  }
  .v4-bigchoice-label { font-size: 16px; }
  .v4-weekly-footer {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 12px;
  }
  .v4-weekly-footer .v4-submit-btn { justify-content: center; }
  .v4-weekly-hint { text-align: center; }
  .v4-weekly-followup,
  .v4-trigger-card,
  .v4-trigger-empathy {
    padding-left: 18px;
    padding-right: 18px;
  }
  .v4-weekly-field-head,
  .v4-trigger-q-head,
  .v4-exit-q-head {
    gap: 10px;
  }
  .v4-weekly-field-label { font-size: 16px; }
  .v4-trigger-q-prompt { font-size: 19px; }
  .v4-trigger-meta {
    flex-wrap: wrap;
    gap: 8px 12px;
    line-height: 1.3;
  }
  .v4-trigger-likert-edges {
    gap: 12px;
    line-height: 1.25;
    letter-spacing: 0.04em;
  }
  .v4-trigger-empathy-row {
    gap: 12px;
  }
  .v4-trigger-empathy-icon {
    width: 32px;
    height: 32px;
  }
  .v4-trigger-closing,
  .v4-exit-closing {
    min-height: 100svh;
    padding: 40px 20px;
  }
  .v4-trigger-closing-lede,
  .v4-exit-closing-lede,
  .v4-exit-closing-meta-line {
    font-size: 15px;
  }
}

/* ─────── workbench (wb-) — internal/operator component tier ───────
   Plain, token-driven components for dev-admin, monitor, demo, and other
   internal surfaces. Participant-facing pages use the v4- tier instead.
   See docs/design-system.md. */

.wb-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
}
.wb-card--compact {
  padding: var(--space-3);
}
.wb-card--dashed {
  border-style: dashed;
}
.wb-card-stack {
  display: grid;
  gap: var(--space-2);
}

.wb-main {
  max-width: 1080px;
}
.wb-main--960 { max-width: 960px; }
.wb-main--1080 { max-width: 1080px; }
.wb-main--1120 { max-width: 1120px; }
.wb-main--1180 { max-width: 1180px; }

.wb-flex-spacer {
  flex: 1;
}

.wb-measure-720 { max-width: 720px; }
.wb-measure-740 { max-width: 740px; }
.wb-measure-780 { max-width: 780px; }

.wb-section {
  margin-top: var(--space-6);
}
.wb-section--tight {
  margin-top: var(--space-4);
}
.wb-section--result {
  margin-top: var(--space-5);
}

.wb-section-title {
  font: 700 var(--text-lg)/1.2 var(--font-sans);
  color: var(--fg-primary);
  margin: 0 0 var(--space-3);
}

.wb-overview {
  margin-top: var(--space-6);
}
.wb-overview__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5) var(--space-8);
  align-items: center;
  justify-content: space-between;
}
.wb-overview__details,
.wb-overview__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  align-items: center;
  margin: 0;
}
.wb-overview__actions {
  margin-left: auto;
}
.wb-overview-title {
  font: 700 var(--text-md)/1.25 var(--font-sans);
  color: var(--fg-primary);
  margin: var(--space-1) 0 0;
}

.wb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
}
.wb-grid--min-180 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.wb-grid--min-220 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.wb-grid--min-240 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.wb-grid--min-250 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.wb-grid--min-260 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.wb-grid--align-end { align-items: end; }
.wb-grid--stretch { align-items: stretch; }

.wb-action-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.wb-action-card--dispatch { min-height: 310px; }
.wb-action-card--manual { min-height: 300px; }
.wb-action-card--link { min-height: 330px; }
.wb-action-card__body--dispatch { min-height: 116px; }
.wb-action-card__body--manual { min-height: 104px; }
.wb-action-card__body--link { min-height: 118px; }
.wb-card-copy {
  margin: var(--space-2) 0 0;
  color: var(--fg-secondary);
  line-height: 1.45;
}
.wb-card-note {
  margin-top: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 10px var(--space-3);
  background: var(--co-slate-25);
  font: 600 var(--text-sm)/1.35 var(--font-sans);
  color: var(--fg-secondary);
}
.wb-card-note--full {
  grid-column: 1 / -1;
  margin-top: 0;
}

.wb-field-group {
  display: grid;
  gap: var(--space-2);
}
.wb-label {
  display: grid;
  gap: 6px;
  font: 600 var(--text-xs)/1.2 var(--font-sans);
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0;
}
.wb-input,
.wb-select,
.wb-file-input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  background: var(--bg-primary);
  font: 600 var(--text-sm)/1.2 var(--font-sans);
  color: var(--fg-primary);
}
.wb-file-input {
  padding: var(--space-2) 10px;
}
.wb-input--quiet {
  font-weight: 500;
}

.wb-button--full {
  width: 100%;
  justify-content: center;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
}
.wb-button--compact {
  justify-content: center;
  border-radius: var(--radius-sm);
  padding: 11px var(--space-3);
  box-shadow: none;
}

.wb-table-scroll {
  overflow-x: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}
.wb-table {
  width: 100%;
  border-collapse: collapse;
}
.wb-table--min-760 { min-width: 760px; }
.wb-table--min-820 { min-width: 820px; }
.wb-table--min-960 { min-width: 960px; }
.wb-table--min-980 { min-width: 980px; }
.wb-table--min-1120 { min-width: 1120px; }
.wb-table--min-1320 { min-width: 1320px; }
.wb-table-caption {
  caption-side: top;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  font: 600 var(--text-xs)/1.35 var(--font-sans);
  color: var(--fg-secondary);
}
.wb-table th {
  font: 600 var(--text-xs)/1.2 var(--font-sans);
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  background: var(--co-slate-25);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
.wb-table td {
  font: 400 var(--text-sm)/1.4 var(--font-sans);
  color: var(--fg-primary);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}
.wb-table .wb-cell--nowrap {
  white-space: nowrap;
}
.wb-table .wb-cell--strong {
  font-weight: 700;
}
.wb-table .wb-cell--mono {
  font: 600 var(--text-sm)/1.35 var(--font-mono);
}
.wb-table tbody tr:last-child td {
  border-bottom: none;
}

.wb-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font: 600 var(--text-2xs)/1 var(--font-sans);
  letter-spacing: 0;
  text-transform: uppercase;
  padding: 3px var(--space-2);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  color: var(--status-neutral-fg);
  background: var(--status-neutral-bg);
  border: 1px solid var(--status-neutral-accent);
}
.wb-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--status-neutral-accent);
}
.wb-badge--success {
  color: var(--status-success-fg);
  background: var(--status-success-bg);
  border-color: var(--status-success-accent);
}
.wb-badge--success::before { background: var(--status-success-accent); }
.wb-badge--info {
  color: var(--status-info-fg);
  background: var(--status-info-bg);
  border-color: var(--status-info-accent);
}
.wb-badge--info::before { background: var(--status-info-accent); }
.wb-badge--warn {
  color: var(--status-warn-fg);
  background: var(--status-warn-bg);
  border-color: var(--status-warn-accent);
}
.wb-badge--warn::before { background: var(--status-warn-accent); }
.wb-badge--danger {
  color: var(--status-danger-fg);
  background: var(--status-danger-bg);
  border-color: var(--status-danger-accent);
}
.wb-badge--danger::before { background: var(--status-danger-accent); }

.wb-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.wb-stat-label {
  font: 600 var(--text-2xs)/1.2 var(--font-sans);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0;
}
.wb-stat-value {
  font: 500 var(--text-xl)/1.2 var(--font-mono);
  color: var(--fg-primary);
  font-feature-settings: "tnum" 1;
}
.wb-stat-helper {
  font: 500 var(--text-xs)/1.35 var(--font-sans);
  color: var(--fg-secondary);
}

.wb-note {
  display: flex;
  gap: var(--space-3);
  font: 400 var(--text-sm)/1.5 var(--font-sans);
  color: var(--status-neutral-fg);
  background: var(--status-neutral-bg);
  border: 1px solid var(--status-neutral-accent);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}
.wb-note__body {
  min-width: 0;
}
.wb-note p {
  margin: var(--space-2) 0 0;
}
.wb-note--success {
  color: var(--status-success-fg);
  background: var(--status-success-bg);
  border-color: var(--status-success-accent);
}
.wb-note--info {
  color: var(--status-info-fg);
  background: var(--status-info-bg);
  border-color: var(--status-info-accent);
}
.wb-note--warn {
  color: var(--status-warn-fg);
  background: var(--status-warn-bg);
  border-color: var(--status-warn-accent);
}
.wb-note--danger {
  color: var(--status-danger-fg);
  background: var(--status-danger-bg);
  border-color: var(--status-danger-accent);
}

.wb-detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 10px;
  margin: 0;
  color: var(--fg-secondary);
  font: 500 var(--text-sm)/1.4 var(--font-sans);
}
.wb-detail-list--split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-3);
}
.wb-detail-list dd {
  margin: 0;
  word-break: break-word;
}
.wb-detail {
  min-width: 0;
}
.wb-detail dt {
  font: 700 var(--text-2xs)/1.2 var(--font-sans);
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0;
}
.wb-detail dd {
  margin: 3px 0 0;
  color: var(--fg-primary);
  word-break: break-word;
}
.wb-detail--inline dd {
  margin-top: var(--space-1);
  font: 600 var(--text-sm)/1.25 var(--font-sans);
}

.wb-result-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
.wb-break-word {
  word-break: break-word;
}
.wb-muted {
  color: var(--fg-secondary);
}
.wb-link {
  font: 700 var(--text-sm)/1 var(--font-sans);
  color: var(--co-sage-800);
}
