/* Design language: calm, minimal, precise — Apple/Jobs taste.
   Restrained palette, generous whitespace, SF typography, hairline dividers,
   one accent color, soft shadows, pill buttons. */
:root {
  --bg: #fbfbfd;
  --card: #ffffff;
  --soft: #f5f5f7;       /* Apple light surface */
  --ink: #1d1d1f;        /* near-black */
  --muted: #6e6e73;      /* secondary text */
  --line: #d2d2d7;       /* hairline */
  --accent: #0071e3;     /* Apple blue */
  --accent-d: #0077ed;
  --therapist: #e8f1fd;
  --patient: #f5f5f7;
  --err: #d70015;
  --radius: 18px;
  --radius-s: 12px;
  /* themeable surfaces */
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.06);
  --card-border: none;
  --bar-bg: rgba(251, 251, 253, 0.8);
  --field-bg: #ffffff;
  --code-bg: #1d1d1f;
  --toast-bg: #1d1d1f;
  --ok: #1d8a4e;
  --warn: #b15c00;
}

/* Apple-style dark mode. Active when the OS is dark (unless the user forced
   light), or whenever data-theme="dark" is set via the toggle. */
:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1c1c1e;
  --soft: #2c2c2e;
  --ink: #f5f5f7;
  --muted: #b4b4b9;
  --line: #38383a;
  --accent: #0a84ff;
  --accent-d: #409cff;
  --therapist: rgba(10, 132, 255, 0.22);
  --patient: #2c2c2e;
  --err: #ff453a;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 34px rgba(0, 0, 0, 0.7);
  --card-border: 1px solid var(--line);
  --bar-bg: rgba(0, 0, 0, 0.72);
  --field-bg: #1c1c1e;
  --code-bg: #000000;
  --toast-bg: #2c2c2e;
  --ok: #30d158;
  --warn: #ff9f0a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1c1c1e;
    --soft: #2c2c2e;
    --ink: #f5f5f7;
    --muted: #b4b4b9;
    --line: #38383a;
    --accent: #0a84ff;
    --accent-d: #409cff;
    --therapist: rgba(10, 132, 255, 0.22);
    --patient: #2c2c2e;
    --err: #ff453a;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 34px rgba(0, 0, 0, 0.7);
    --card-border: 1px solid var(--line);
    --bar-bg: rgba(0, 0, 0, 0.72);
    --field-bg: #1c1c1e;
    --code-bg: #000000;
    --toast-bg: #2c2c2e;
  --ok: #30d158;
  --warn: #ff9f0a;
  }
}

* { box-sizing: border-box; }
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { transition: background .3s ease, color .3s ease; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
  letter-spacing: -0.01em;
}

/* Top bar — slim, translucent, hairline */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bar-bg); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px; position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.progress { color: var(--muted); font-size: 13px; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
#theme-toggle { font-size: 17px; line-height: 1; padding: 6px 10px; }
.back-btn {
  background: transparent; border: none; color: var(--accent);
  padding: 4px 6px; font-size: 15px; border-radius: 8px;
}
.back-btn:hover { opacity: 0.7; background: transparent; }

#app { max-width: 1160px; margin: 0 auto; padding: 48px 24px 80px; }
.screen { display: none; }
.screen.active { display: block; animation: rise .4s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Cards — borderless, soft shadow, roomy */
.card {
  background: var(--card); border: var(--card-border);
  border-radius: var(--radius); padding: 44px;
  box-shadow: var(--shadow);
}
.card.narrow { max-width: 680px; margin: 0 auto; }
.card.center { text-align: center; }

h1 { font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -0.025em; margin: 0 0 16px; }
h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 10px; }
p { margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

.steps, .form { margin: 20px 0; }
.steps li, .tips li { margin: 8px 0; }
.tips { margin: 18px 0; padding-left: 20px; }

/* Buttons — pill, quiet, one accent */
button {
  font: inherit; font-size: 15px; cursor: pointer; border-radius: 980px;
  padding: 11px 24px; border: 1px solid transparent;
  transition: background .2s ease, opacity .2s ease, transform .1s ease;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: .4; cursor: not-allowed; }
.primary { background: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { background: var(--accent-d); }
.accent { background: var(--accent); color: #fff; }
.accent:hover:not(:disabled) { background: var(--accent-d); }
.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.ghost:hover { background: var(--soft); }

.actions { display: flex; gap: 14px; margin-top: 28px; align-items: center; }
.actions.between { justify-content: space-between; }

/* Forms */
.form-row { margin-bottom: 22px; }
.form-row > label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.field-instruction { color: var(--muted); font-size: 13px; margin: 2px 0 8px; line-height: 1.45; }
input[type=text], input[type=number], input[type=email], input[type=tel], select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: var(--radius-s); font: inherit; background: var(--field-bg); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
textarea { resize: vertical; }
.object-group {
  border: 1px solid var(--line); border-radius: var(--radius-s); padding: 20px;
  margin-bottom: 22px; background: var(--field-bg);
}
.object-group > .group-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; letter-spacing: -0.01em; }
.subfield { margin-bottom: 16px; }
.subfield > label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.list-items { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; gap: 8px; }
.list-item input { flex: 1; }
.list-item .remove { padding: 8px 14px; }
.add-item { align-self: flex-start; margin-top: 8px; padding: 7px 16px; font-size: 14px; }
/* Multi-select chips (e.g. Current emotions) — pick options instead of typing. */
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chip {
  padding: 7px 14px; font-size: 14px; line-height: 1.2; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--field-bg); color: var(--text);
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.chip:hover { border-color: var(--accent); }
.chip.selected {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500;
}
.checkbox-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.checkbox-row input { width: auto; }
.checkbox-row label { font-weight: 400; }

.errors {
  background: color-mix(in srgb, var(--err) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--err) 35%, var(--card));
  color: var(--err);
  border-radius: var(--radius-s); padding: 14px 16px; margin: 16px 0;
}
.errors ul { margin: 6px 0 0; padding-left: 20px; }
.json-preview {
  background: var(--code-bg); color: #f5f5f7; padding: 18px; border-radius: var(--radius-s);
  overflow: auto; font-size: 12.5px; line-height: 1.5; max-height: 360px; text-align: left;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* Model list / hub */
.model-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin: 24px 0; }
.model-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; text-align: center;
  cursor: pointer; font-weight: 600; font-size: 19px; letter-spacing: -0.01em; background: var(--card);
  transition: box-shadow .2s ease, border-color .2s ease, transform .1s ease;
}
.model-card:hover { border-color: transparent; box-shadow: 0 6px 26px rgba(0, 0, 0, 0.10); transform: translateY(-2px); }
.model-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.14); }

/* Interview / eval layout */
.interview-layout, .eval-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.eval-layout.three { grid-template-columns: 250px minmax(0, 1fr) minmax(0, 1.55fr); gap: 22px; }
.eval-layout.two { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 26px; }

/* Session-eval page header + collapsible profile */
.eval-page-title { margin-bottom: 18px; }
.collapse {
  background: var(--soft); border-radius: var(--radius-s);
  padding: 14px 20px; margin-bottom: 22px;
}
.collapse > summary {
  cursor: pointer; font-weight: 600; list-style: none;
  display: flex; align-items: center; gap: 10px; color: var(--ink);
}
.collapse > summary::-webkit-details-marker { display: none; }
.collapse > summary::before {
  content: "›"; font-size: 20px; line-height: 1; color: var(--muted);
  transition: transform .18s ease; display: inline-block;
}
.collapse[open] > summary::before { transform: rotate(90deg); }
.collapse .profile-summary { margin-top: 14px; max-height: none; }
.profile-summary.wide {
  column-count: 2; column-gap: 36px; font-size: 14px;
}
.profile-summary.wide h4 { break-after: avoid; }
.profile-summary.wide ul, .profile-summary.wide p { break-inside: avoid; }
.eval-conversation-col { background: var(--card); border: var(--card-border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.eval-conversation-col h1 { font-size: 22px; }
.chat-log.tall { max-height: 62vh; }
.sidepanel { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 90px; }
.panel-block { background: var(--card); border: var(--card-border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.profile-summary { font-size: 13.5px; max-height: 460px; overflow: auto; }
.profile-summary h4 { margin: 12px 0 2px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.profile-summary ul { margin: 2px 0 8px; padding-left: 18px; }
.profile-summary p { margin: 2px 0 8px; }

.chat-main, .eval-main { background: var(--card); border: var(--card-border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.section-head { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.section-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.timer-group { display: flex; gap: 8px; align-items: center; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.interview-timer {
  flex: none; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px;
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--card));
}
/* Per-section timer: muted by default; amber while still under the suggested time. */
.section-timer {
  flex: none; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px;
  padding: 5px 12px; border-radius: 999px; white-space: nowrap;
  color: var(--muted); background: var(--card); border: 1px solid var(--line);
}
.section-timer.under {
  color: #9a6a00; background: color-mix(in srgb, #b8860b 12%, var(--card));
  border-color: color-mix(in srgb, #b8860b 40%, var(--card));
}
/* Last minute of the suggested time: gentle amber nudge. */
.interview-timer.low {
  color: #9a6a00; background: color-mix(in srgb, #b8860b 12%, var(--card));
  border-color: color-mix(in srgb, #b8860b 40%, var(--card));
}
/* Past the suggested time (soft limit): neutral, no pressure. */
.interview-timer.over {
  color: var(--muted); background: var(--card);
  border-color: var(--line);
}
.model-estimate { color: var(--muted); font-variant-numeric: tabular-nums; }
.clear-data-line { margin-top: 18px; text-align: center; }
.linklike {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent); text-decoration: underline;
}
.linklike:hover { opacity: 0.8; }
.section-goal { color: var(--muted); font-size: 14.5px; margin-top: 6px; }
.section-questions { margin-top: 14px; font-size: 14px; background: var(--soft); border: none; border-radius: var(--radius-s); padding: 16px 18px; }
.section-questions .sq-title { font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.section-questions ul { margin: 4px 0 10px; padding-left: 20px; }
.section-questions li { margin: 4px 0; }
.section-questions .sq-group { font-weight: 600; margin-top: 10px; color: var(--ink); }

/* Calm informational callout */
.notice {
  background: var(--soft); border: none;
  border-radius: var(--radius-s); padding: 16px 18px; margin: 16px 0; font-size: 14px; line-height: 1.6;
  text-align: left; color: var(--ink);
}
.notice code, .userid-banner code, .json-inline code {
  background: var(--card); padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line);
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em;
}

/* Resume box */
.resume-box { margin-top: 32px; border-top: 1px solid var(--line); padding-top: 24px; }
.resume-row { display: flex; gap: 12px; }
.resume-row input { flex: 1; }

/* Hub User ID banner — calm, not loud */
.userid-banner { background: var(--soft); border: none; border-radius: var(--radius-s); padding: 14px 18px; margin-bottom: 20px; font-size: 14px; }
.model-card.hub { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; text-align: left; }
.model-card.hub .model-name { font-size: 19px; font-weight: 600; }
.model-card.hub.done { background: var(--soft); box-shadow: none; cursor: default; }
.model-card.hub.done:hover { transform: none; box-shadow: none; border-color: var(--line); }
.model-status { font-size: 13px; font-weight: 600; }
.model-status.completed { color: var(--ok); }
.model-status.in_progress { color: var(--warn); }
.model-status.new { color: var(--muted); }
.model-cta { font-weight: 400; }

/* Chat */
.chat-log {
  display: flex; flex-direction: column; gap: 12px;
  min-height: 280px; max-height: 50vh; overflow-y: auto; padding: 8px 2px;
}
.chat-log.readonly { max-height: 40vh; background: var(--soft); border-radius: var(--radius-s); padding: 14px; }
.bubble { padding: 11px 15px; border-radius: 18px; max-width: 80%; white-space: pre-wrap; font-size: 14.5px; line-height: 1.5; }
.bubble.therapist { background: var(--therapist); align-self: flex-end; border-bottom-right-radius: 5px; }
.bubble.patient { background: var(--patient); align-self: flex-start; border-bottom-left-radius: 5px; }
.bubble .who { display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.chat-empty { color: var(--muted); text-align: center; padding: 36px; }

.chat-input { display: flex; gap: 12px; margin-top: 16px; }
.chat-input textarea { flex: 1; }

/* Example / reference profile */
.example-block {
  border: none; background: var(--soft); border-radius: var(--radius-s);
  padding: 16px 18px; margin: 16px 0;
}
.example-block > summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.example-block #example-title { margin: 0 0 4px; color: var(--ink); }
.example-view { max-height: 360px; overflow: auto; margin-top: 10px; }
.example-view h4 { color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; }

/* Criteria */
.criteria { display: flex; flex-direction: column; gap: 20px; margin: 18px 0; }
.criterion { border: none; background: var(--soft); border-radius: var(--radius); padding: 26px 28px; }
.criterion .q { font-weight: 600; font-size: 18px; margin-bottom: 18px; letter-spacing: -0.015em; line-height: 1.35; }
.scale { display: flex; flex-direction: column; gap: 8px; }
.scale-opt {
  display: flex; gap: 14px; align-items: flex-start; padding: 13px 16px; border-radius: 12px;
  cursor: pointer; background: var(--card); border: 1px solid var(--line);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.scale-opt:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.scale-opt:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}
.scale-opt input { margin-top: 3px; accent-color: var(--accent); width: 17px; height: 17px; flex: none; }
.scale-opt .lvl { font-weight: 600; white-space: nowrap; min-width: 88px; }
.scale-opt .guide { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.dim-progress {
  display: inline-block; font-weight: 600; color: var(--accent); margin-bottom: 16px; font-size: 14px;
  background: color-mix(in srgb, var(--accent) 10%, var(--card)); padding: 6px 14px; border-radius: 980px;
}
.dim-nav { display: flex; justify-content: space-between; gap: 12px; margin: 18px 0; }
#section-final { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }

/* Toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: var(--toast-bg); color: #fff; padding: 13px 22px; border-radius: 980px;
  z-index: 100; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45); font-size: 14px; max-width: 90vw;
}

/* ---- Playful motion ---- */
.primary, .accent { will-change: transform; }
.primary:hover:not(:disabled), .accent:hover:not(:disabled) { transform: translateY(-1px); }

/* Chat bubbles glide in */
.bubble-enter { animation: bubbleIn .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

/* Typing indicator */
.bubble.typing { display: inline-flex; flex-direction: column; gap: 4px; }
.typing .dots { display: inline-flex; gap: 5px; align-items: center; height: 12px; }
.typing .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; animation: blink 1.3s infinite ease-in-out; }
.typing .dots i:nth-child(2) { animation-delay: .18s; }
.typing .dots i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-4px); } }

/* Criterion eases in (nice when stepping dimensions) */
.criterion { animation: fadeUp .3s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.scale-opt:active { transform: scale(.99); }

/* Confetti */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 300; }
.confetti-piece {
  position: absolute; top: -16px; opacity: .95; will-change: transform, top;
  animation-name: confetti-fall; animation-timing-function: cubic-bezier(.25, .6, .4, 1); animation-fill-mode: forwards;
}
@keyframes confetti-fall { to { top: 112vh; transform: rotate(900deg); opacity: .85; } }

/* Celebratory finale */
.done-emoji { font-size: 56px; line-height: 1; margin-bottom: 8px; display: inline-block; animation: bloom .7s cubic-bezier(.16, .8, .3, 1) both; }
@keyframes bloom { 0% { transform: scale(.2) rotate(-25deg); opacity: 0; } 60% { transform: scale(1.15) rotate(6deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
.model-status.completed { animation: pop .45s cubic-bezier(.16, .8, .3, 1) both; }
@keyframes pop { 0% { transform: scale(.5); opacity: 0; } 70% { transform: scale(1.12); } 100% { transform: scale(1); opacity: 1; } }

/* Flower celebration — full-screen */
.flower-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 300; }
.flower {
  position: absolute; top: -8vh; will-change: transform, opacity;
  animation-name: flower-fall; animation-timing-function: linear; animation-fill-mode: forwards;
  user-select: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.12));
}
@keyframes flower-fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 0; }
  8% { opacity: 1; }
  100% { transform: translate(var(--sway, 0), 116vh) rotate(var(--spin, 360deg)); opacity: .9; }
}
/* Center bloom burst */
.flower-burst { position: absolute; top: 42%; left: 50%; }
.flower-burst .petal {
  position: absolute; font-size: 30px; transform: translate(-50%, -50%);
  animation: petal-out 1.1s cubic-bezier(.16, .8, .3, 1) forwards;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}
@keyframes petal-out {
  0% { transform: translate(-50%, -50%) rotate(var(--ang)) translateY(0) scale(.2); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(-50%, -50%) rotate(var(--ang)) translateY(-180px) scale(1.1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .confetti-layer, .flower-layer { display: none !important; }
}

@media (max-width: 1100px) {
  .eval-layout.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  #app { padding: 32px 18px 64px; }
  .card { padding: 28px; }
  h1 { font-size: 28px; }
  .interview-layout, .eval-layout, .eval-layout.three, .eval-layout.two { grid-template-columns: 1fr; }
  .sidepanel { position: static; }
  .model-list { grid-template-columns: 1fr; }
  .profile-summary.wide { column-count: 1; }
}

/* ---- Advisory profile review panel ---- */
.review-panel {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}
.review-panel h3 { margin: 0 0 6px; }
.review-panel h4 { margin: 14px 0 6px; font-size: 0.95rem; }
.review-field { padding: 8px 0; border-top: 1px solid var(--line); }
.review-field:first-of-type { border-top: none; }
.review-field-head { display: flex; align-items: center; gap: 8px; }
.review-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
}
.review-badge.q-good { background: var(--ok); }
.review-badge.q-adequate { background: var(--accent); }
.review-badge.q-weak { background: var(--warn); }
.review-badge.q-empty { background: var(--err); }

/* ---- Per-field writing assist ---- */
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.assist-btn {
  flex: none;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.assist-btn:disabled { opacity: 0.5; cursor: default; }
.assist-pop {
  position: relative;
  margin-top: 8px;
  padding: 12px 32px 12px 14px;
  background: var(--soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-s);
}
.assist-close {
  position: absolute;
  top: 6px; right: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.assist-note { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.assist-items, .assist-prompts { margin: 4px 0 10px; padding-left: 20px; }
.assist-items li, .assist-prompts li { margin: 3px 0; }
.assist-text { margin: 4px 0 10px; }
button.primary.small, button.small {
  font-size: 0.82rem;
  padding: 5px 12px;
}

/* ---- Inline review suggestion (next to the field it refers to) ---- */
.field-suggestion {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--soft);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font-size: 0.9rem;
}
.field-suggestion.q-weak { border-left-color: var(--warn); }
.field-suggestion.q-empty { border-left-color: var(--err); }
.field-suggestion.q-good { border-left-color: var(--ok); }
.field-suggestion .fs-text { flex: 1; }

/* ---- Session roadmap (interview sidebar catalog) ---- */
.roadmap { display: flex; flex-direction: column; gap: 4px; }
.roadmap-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-s);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.roadmap-item:hover { background: var(--soft); }
.roadmap-item .rm-num {
  flex: none;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 0.78rem; font-weight: 600;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--muted);
}
.roadmap-item .rm-name { font-size: 0.86rem; line-height: 1.25; }
.roadmap-item.started .rm-num { border-color: var(--accent); color: var(--accent); }
.roadmap-item.done .rm-num { background: var(--ok); border-color: var(--ok); color: #fff; }
.roadmap-item.current {
  background: var(--therapist);
  border-color: var(--accent);
}
.roadmap-item.current .rm-name { font-weight: 600; }
/* Sequential roadmap: completed sections are clickable (read-only); the active
   section is the editable frontier; future sections are locked. */
.roadmap-item.done { cursor: pointer; }
.roadmap-item.locked { opacity: 0.5; cursor: default; }
.roadmap-item.locked:hover { background: none; }
.roadmap-item.active .rm-num {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
}
