:root {
  --bg: #f4f7fd; --panel: #ffffff; --ink: #0f1d3a; --muted: #5a6b8c; --line: #dce4f2; --soft: #eef3fc;
  --blue: #1d4ed8; --blue-2: #2563eb; --blue-soft: #e8effd; --blue-line: #c4d5f8;
  --ok: #15803d; --ok-soft: #e9f7ee; --bad: #c62828; --bad-soft: #fdeeee; --warn: #b45309; --warn-soft: #fef5e6;
  --mark: #fef08a;
  --pending: var(--warn); --edit: var(--ok);
  /* the three study conditions + AI alone */
  --cA: #64748b; --cA-soft: #f1f5f9; --cB: #7c3aed; --cB-soft: #f3eefe; --cC: #0d9488; --cC-soft: #e6f6f4;
  --cAI: #d97706; --cAI-soft: #fef3e2;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 29, 58, .04), 0 4px 16px rgba(15, 29, 58, .05);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { letter-spacing: -.015em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.sub { color: var(--muted); font-size: 13px; }
.ok { color: var(--ok); font-weight: 600; } .no { color: var(--bad); font-weight: 600; }

/* ---------------------------------------------------------------- top bar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: var(--panel); color: var(--ink);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.brand::before { content: ""; width: 20px; height: 20px; border-radius: 6px; background: var(--blue); box-shadow: inset 0 0 0 5px #93b4f5; }
.brand:hover { text-decoration: none; }
#usernav { margin-left: auto; display: flex; gap: 4px; align-items: center; font-size: 14px; }
#usernav > a { color: var(--muted); padding: 6px 12px; border-radius: 8px; }
#usernav > a:hover { color: var(--ink); background: var(--soft); text-decoration: none; }
#usernav > a.on { color: var(--ink); font-weight: 600; background: var(--soft); }
.profile-menu { position: relative; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); }
.avatar-btn { display: flex; align-items: center; gap: 4px; background: none; border: 0; padding: 3px; border-radius: 999px; color: var(--muted); }
.avatar-btn:hover { background: var(--soft); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-weight: 700; font-size: 14px;
  display: grid; place-items: center; flex: none; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.menu { position: absolute; right: 0; top: 46px; width: 260px; background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 32px rgba(15, 29, 58, .14); padding: 6px; z-index: 20; }
.menu-top { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-email { font-weight: 600; font-size: 14px; word-break: break-all; line-height: 1.3; }
.menu-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.badge { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; background: var(--blue-soft); color: var(--blue);
  padding: 0 6px; border-radius: 5px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-radius: 8px; padding: 9px 10px;
  color: var(--bad); text-align: left; font-size: 14px; }
.menu-item:hover { background: var(--bad-soft); }

main { max-width: 1320px; margin: 0 auto; padding: 32px 28px; }

/* ---------------------------------------------------------------- forms + buttons */
.auth { max-width: 420px; margin: 7vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 32px;
  box-shadow: var(--shadow); }
.auth h1 { margin: 0 0 20px; font-size: 24px; font-weight: 700; text-align: center; color: var(--blue); }
.tabs { display: flex; justify-content: center; gap: 4px; margin-bottom: 18px; background: var(--soft); padding: 4px; border-radius: 999px; }
.tabs button { flex: 1; background: none; border: 0; padding: 7px 0; color: var(--muted); border-radius: 999px; }
.tabs button.on { background: #fff; color: var(--blue); font-weight: 600; box-shadow: 0 1px 3px rgba(15, 29, 58, .1); }
.auth-foot { text-align: center; margin: 18px 0 0; font-size: 14px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; }
.field { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.field:focus { outline: none; border-color: var(--blue-2); box-shadow: 0 0 0 3px var(--blue-soft); }
select.field { appearance: auto; }
textarea.field { min-height: 110px; resize: vertical; }
.primary, a.primary { background: var(--blue); color: #fff; border: 0; padding: 10px 18px; border-radius: 8px; font-weight: 600; display: inline-block; }
.primary:hover, a.primary:hover { background: #1e40af; text-decoration: none; }
.primary:disabled { opacity: .4; cursor: default; }
.wide { width: 100%; margin-top: 20px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 10px; }
.btn { display: inline-block; border-radius: 8px; padding: 8px 14px; font-size: 14px; }
a.b-plain.btn { border: 1px solid var(--blue-line); color: var(--blue); background: #fff; }
a.b-plain.btn:hover { background: var(--blue-soft); text-decoration: none; }
.linkbtn { background: none; border: 0; color: var(--blue); padding: 0; font-size: 13px; margin-top: 8px; }
.consent { max-width: 520px; }
.consent h1 { text-align: left; }
.steps-sm { padding-left: 20px; } .steps-sm li { margin-bottom: 4px; }

/* ---------------------------------------------------------------- lists + tables */
.page-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; }
.page-head .muted { color: var(--muted); font-size: 14px; }
.spacer { flex: 1; }
.notice { background: var(--blue-soft); border: 1px solid var(--blue-line); border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 20px; }
table.list { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; }
.list th, .list td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.list th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8faff; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: #f7faff; }
.num { font-variant-numeric: tabular-nums; }
.bar { width: 100px; height: 6px; background: var(--blue-soft); border-radius: 3px; overflow: hidden; display: inline-block;
  vertical-align: middle; margin-right: 8px; }
.bar > span { display: block; height: 100%; background: var(--blue-2); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--blue-soft); color: #1e3a8a; white-space: nowrap; }
.scroll { overflow-x: auto; }
.snip { font-size: 13px; }
tr.wrong td { background: #fff8f8; }
.tag-err { font-size: 12px; background: var(--bad-soft); color: var(--bad); padding: 1px 7px; border-radius: 6px; white-space: nowrap; }

/* ---------------------------------------------------------------- conversation bubbles */
.transcript { display: flex; flex-direction: column; gap: 10px; }
.turn { max-width: 85%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.turn .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-weight: 500; }
.turn.client { background: var(--soft); border-color: transparent; align-self: flex-start; border-bottom-left-radius: 4px; }
.turn.therapist { align-self: flex-end; border-bottom-right-radius: 4px; }
.turn.target { border: 2px solid var(--blue-2); box-shadow: 0 0 0 4px var(--blue-soft); }
.turn.target .who { color: var(--blue); font-weight: 600; }
.convo-card .turn.target { max-width: 92%; background: #f3f7ff; border-width: 2.5px; font-size: 16px; padding: 14px 18px;
  box-shadow: 0 0 0 5px var(--blue-soft), 0 8px 24px rgba(37, 99, 235, .15); }
details.earlier summary { font-size: 13px; color: var(--blue); cursor: pointer; margin-bottom: 10px; }
details.earlier .transcript { margin-bottom: 10px; }
mark { background: var(--mark); padding: 0 1px; border-radius: 2px; }

/* ---------------------------------------------------------------- review flags (conversation page) */
.conv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: 28px; align-items: start; }
.profile { font-size: 13px; color: var(--muted); margin-bottom: 18px; padding: 12px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); }
.profile b { color: var(--ink); }
.turn.flagged { border: 1.5px solid var(--warn); cursor: pointer; }
.turn.flagged.s-accept, .turn.flagged.s-edit { border-color: var(--ok); }
.turn.flagged.s-reject { border-color: #a3b0c7; border-style: dashed; }
.turn.flagged.selected { box-shadow: 0 0 0 4px var(--blue-soft); border-color: var(--blue-2); }
.turn .rev { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 14px; }
.turn .rev .lbl { font-size: 12px; color: var(--muted); }
.turn.s-reject .rev { color: var(--muted); }
.strike { text-decoration: line-through; color: var(--muted); }
.status { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; }
.status.pending { background: var(--warn-soft); color: var(--warn); }
.status.accept, .status.edit { background: var(--ok-soft); color: var(--ok); }
.status.reject { background: var(--soft); color: var(--muted); }
.panel { position: sticky; top: 76px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
  max-height: calc(100vh - 96px); overflow: auto; box-shadow: var(--shadow); }
.panel h2 { font-size: 16px; margin: 0 0 2px; font-weight: 600; }
.panel h3 { font-size: 13px; margin: 22px 0 8px; font-weight: 600; }
.quote { background: var(--soft); padding: 9px 12px; border-radius: 8px; font-size: 14px; }
.client-quote { font-size: 13px; color: var(--muted); }
.det { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.det-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.det-head .name { font-weight: 600; flex: 1; }
.sev { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--soft); color: var(--muted); font-variant-numeric: tabular-nums; }
.sev.s2 { background: var(--warn-soft); color: var(--warn); } .sev.s3 { background: var(--bad-soft); color: var(--bad); }
.det .j { font-size: 13px; margin-top: 6px; }
.det .j .jn { color: var(--muted); }
.det .ev, .ai-type .ev { font-style: italic; }
.det details summary, .ai-type details summary { font-size: 12px; color: var(--blue); cursor: pointer; margin-top: 4px; }
.det details p, .ai-type details p { font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.agree { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); margin: 0; }
input[type=checkbox] { accent-color: var(--blue); width: 16px; height: 16px; }
.sugg { border: 1px solid var(--blue-line); border-radius: 10px; padding: 10px 12px; font-size: 14px; background: #f8faff; }
.sugg .why { color: var(--muted); font-size: 13px; margin-top: 6px; }
.draft { font-size: 11px; font-weight: 500; color: var(--warn); background: var(--warn-soft); padding: 1px 6px; border-radius: 5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.actions button { border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.actions button:hover { background: var(--soft); }
.b-accept { background: var(--ok) !important; border-color: var(--ok) !important; color: #fff !important; }
.b-edit { background: var(--blue) !important; border-color: var(--blue) !important; color: #fff !important; }
.b-reject { color: var(--bad) !important; border-color: #f2c4c4 !important; }
.navrow { display: flex; justify-content: space-between; margin-top: 18px; font-size: 13px; }
.navrow button { background: none; border: 0; color: var(--blue); padding: 0; }
.navrow button:disabled { color: var(--muted); opacity: .5; cursor: default; }
.allscores { font-size: 12px; border-collapse: collapse; width: 100%; }
.allscores th, .allscores td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.empty { color: var(--muted); font-size: 14px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px;
  vertical-align: -1px; border: 1.5px solid var(--c); }

/* ---------------------------------------------------------------- conditions */
.k-A { --k: var(--cA); --ks: var(--cA-soft); } .k-B { --k: var(--cB); --ks: var(--cB-soft); }
.k-C { --k: var(--cC); --ks: var(--cC-soft); } .k-AI { --k: var(--cAI); --ks: var(--cAI-soft); }
.cond-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; padding: 3px 12px 3px 3px;
  border-radius: 999px; background: var(--ks); color: var(--k); white-space: nowrap; }
.cond-pill.k-AI { padding-left: 12px; }
.cond-pill .cond-letter { width: 22px; height: 22px; border-radius: 50%; font-size: 12px; }
.cond-letter { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--k); color: #fff; font-weight: 700;
  display: grid; place-items: center; }
.ai-box { border-radius: 10px; padding: 10px 12px; font-size: 14px; background: #fff; border: 1px solid var(--line); }
.ai-box.ai-flag { border-left: 3px solid var(--bad); }
.ai-box.ai-clear { border-left: 3px solid var(--ok); }
.ai-head { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.ai-flag > .ai-head:first-child { color: var(--bad); }
.ai-clear > .ai-head:first-child { color: var(--ok); }
.ai-type { margin: 8px 0; }
.ai-box .sugg { margin-top: 4px; }

/* ---------------------------------------------------------------- study page */
.study-head { display: flex; align-items: center; gap: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 20px; margin-bottom: 22px; box-shadow: var(--shadow); flex-wrap: wrap; }
.sh-left { flex: 1; min-width: 200px; }
.sh-count { font-size: 15px; margin-bottom: 6px; color: var(--muted); }
.sh-count b { color: var(--ink); font-size: 18px; }
.sh-bar { height: 8px; background: var(--blue-soft); border-radius: 4px; overflow: hidden; }
.sh-bar span { display: block; height: 100%; background: var(--blue-2); border-radius: 4px; transition: width .3s; }
.study-head .cond-pill { font-size: 14px; padding: 4px 16px 4px 4px; }
.study-head .cond-pill .cond-letter { width: 26px; height: 26px; }
.convo-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); }
.convo-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.pill { font-size: 12px; background: var(--blue-soft); color: #1e3a8a; padding: 2px 10px; border-radius: 999px; }
.study-panel { border-top: 5px solid var(--k); padding-top: 18px; }
.help-box { background: var(--ks); border-radius: 12px; padding: 12px; margin-bottom: 6px; }
.help-title { font-size: 12px; font-weight: 700; color: var(--k); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.help-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.q-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 10px; }
.q-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.q-head h3 .sub { font-weight: 400; }
.qn { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700;
  display: grid; place-items: center; }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.yn button { padding: 11px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-weight: 600; color: var(--ink); }
.yn button:hover { border-color: var(--blue-line); background: #f8faff; }
.yn .yes.on { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.yn .no.on { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.typepick { display: flex; flex-direction: column; gap: 6px; }
.tp { display: flex; gap: 10px; align-items: flex-start; margin: 0; color: var(--ink); font-size: 14px; line-height: 1.4;
  padding: 9px 11px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }
.tp:hover { border-color: var(--blue-line); }
.tp:has(input:checked) { border-color: var(--blue-2); background: var(--blue-soft); }
.tp input { margin-top: 1px; }
.tp .sub { font-size: 12px; }
.choice-row { display: flex; flex-direction: column; gap: 6px; }
.choice { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-weight: 500; }
.choice:hover { border-color: var(--blue-line); background: #f8faff; }
.choice.on { border-color: var(--blue-2); background: var(--blue-soft); color: var(--blue); }

/* ---------------------------------------------------------------- about */
.about { max-width: 960px; margin: 0 auto; }
.hero { padding: 8px 0 32px; margin-bottom: 36px; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: 32px; line-height: 1.2; font-weight: 700; margin: 0 0 10px; }
.hero p { color: var(--muted); margin: 0; font-size: 16px; max-width: 64ch; }
.hero .actions { margin-top: 22px; }
.about section { margin-bottom: 40px; }
.about section h2 { font-size: 19px; font-weight: 700; margin: 0 0 14px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.steps li { counter-increment: s; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 4px; font-size: 14px; box-shadow: var(--shadow); }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--blue-soft); color: var(--blue);
  font-size: 13px; font-weight: 700; display: grid; place-items: center; margin-bottom: 6px; }
.steps li span { color: var(--muted); }
.cond-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.cond-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 0 0 14px; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px; border-top: 5px solid var(--k); box-shadow: var(--shadow); }
.cond-card > :not(.cond-top) { margin: 0 14px; }
.cond-card .turn { max-width: 100%; font-size: 14px; }
.cond-card .turn.target { border-color: var(--k); box-shadow: none; }
.cond-card .turn.target .who { color: var(--k); }
.cond-top { display: flex; gap: 12px; align-items: flex-start; background: var(--ks); padding: 12px 14px; margin-bottom: 4px; }
.cond-top b { color: var(--k); }
.cond-top .sub { line-height: 1.45; }
.no-ai { border: 1.5px dashed var(--line); border-radius: 10px; padding: 12px; text-align: center; color: var(--muted); font-size: 13px; }
.types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.type { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.type span { color: var(--muted); }
.type .eg { font-size: 13px; font-style: italic; }
.about-foot { border-top: 1px solid var(--line); padding-top: 24px; display: flex; align-items: center; gap: 20px;
  justify-content: space-between; flex-wrap: wrap; }
.about-foot p { margin: 0; color: var(--muted); }

/* ---------------------------------------------------------------- debrief + admin */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  border-top: 4px solid var(--k, var(--blue-2)); }
.stat .big { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 6px; line-height: 1.2; letter-spacing: -.02em; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.card table.list { border: 0; border-radius: 0; margin-top: 10px; }
.card .list tbody tr:not([data-user]) { cursor: default; }
.hbars { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.hb { display: grid; grid-template-columns: 230px minmax(0, 1fr) 100px; gap: 14px; align-items: center; font-size: 14px; }
.hb-track { height: 14px; background: var(--soft); border-radius: 7px; overflow: hidden; }
.hb-fill { display: block; height: 100%; border-radius: 7px; }
.hb-fill.c-A { background: var(--cA); } .hb-fill.c-B { background: var(--cB); } .hb-fill.c-C { background: var(--cC); }
.hb-fill.c-AI { background: var(--cAI); }
.hb-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.hb-val .sub { font-weight: 400; }
.defs { margin: 14px 0 0; padding-left: 18px; }
.defs li { margin-bottom: 4px; }

@media (max-width: 960px) {
  main { padding: 20px 16px; }
  .topbar { padding: 10px 16px; }
  #usernav { margin-left: 0; flex-wrap: wrap; }
  .conv { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; max-height: none; }
  .turn { max-width: 100%; }
  .hide-sm { display: none; }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cond-grid, .types { grid-template-columns: minmax(0, 1fr); }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hb { grid-template-columns: 1fr; gap: 4px; }
  .hero h1 { font-size: 25px; }
}
details.why summary { cursor: pointer; color: var(--blue); font-size: 12px; margin-top: 6px; }
details.why p { margin: 4px 0 0; }

/* sign-in / create account: black, no blue */
.auth h1 { color: var(--ink); }
.auth .tabs button.on { color: var(--ink); }
.auth .primary { background: var(--ink); }
.auth .primary:hover { background: #2a3550; }
.auth .field:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15, 29, 58, .08); }
.auth-foot a { color: var(--ink); text-decoration: underline; }

/* phones */
@media (max-width: 600px) {
  body { font-size: 15px; }
  main { padding: 14px 12px 40px; }
  .topbar { padding: 8px 12px; gap: 8px; flex-wrap: nowrap; }
  .brand { font-size: 15px; white-space: nowrap; }
  #usernav { margin-left: auto; flex-wrap: nowrap; gap: 0; font-size: 13px; }
  #usernav > a { padding: 6px 8px; white-space: nowrap; }
  .profile-menu { margin-left: 6px; padding-left: 6px; }
  .avatar-btn svg { display: none; }
  .menu { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; }
  .field, input, select, textarea { font-size: 16px; }   /* stops iOS zooming into inputs */
  .auth { margin: 16px auto; padding: 22px 18px; border-radius: 14px; }
  .hero h1 { font-size: 22px; }
  .steps, .stat-row { grid-template-columns: minmax(0, 1fr); }
  .study-head { padding: 12px 14px; gap: 10px; margin-bottom: 14px; }
  .sh-left { min-width: 0; flex-basis: 100%; }
  .study-head .cond-pill { font-size: 13px; }
  .convo-card, .panel { padding: 14px; border-radius: 14px; }
  .conv { gap: 16px; }
  .turn { padding: 9px 12px; }
  .convo-card .turn.target { max-width: 100%; font-size: 15px; padding: 12px 14px; }
  .yn button, .choice, .tp { min-height: 44px; }
  .q-head { margin-top: 18px; }
  table.list { min-width: 520px; }
  .scroll { -webkit-overflow-scrolling: touch; }
}

/* ---------------------------------------------------------------- Task 2: two blind corrections */
.pair { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.pair-opt { border: 1px solid var(--blue-line); border-radius: 10px; padding: 10px 12px 10px 44px; font-size: 14px; background: #f8faff; position: relative; }
.pair-label { position: absolute; left: 12px; top: 10px; width: 22px; height: 22px; border-radius: 6px; background: var(--blue); color: #fff;
  font-weight: 700; font-size: 13px; display: grid; place-items: center; }

/* ---------------------------------------------------------------- "Which could be a better response?": two square cards */
.pair-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 4px 0 16px; }
.pair-card { aspect-ratio: 1 / 1; display: flex; flex-direction: column; gap: 10px; text-align: left; padding: 16px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); font-size: 14.5px;
  line-height: 1.55; overflow: auto; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s, transform .15s; }
.pair-card:hover { border-color: var(--blue-line); transform: translateY(-1px); }
.pair-card .pair-tag { width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff; }
.pair-card.kA .pair-tag { background: #4f46e5; } .pair-card.kB .pair-tag { background: #0d9488; }
.pair-card.kA { background: linear-gradient(180deg, #f5f5ff 0, #fff 40%); }
.pair-card.kB { background: linear-gradient(180deg, #f0fbf9 0, #fff 40%); }
.pair-card.kA.on { border-color: #4f46e5; box-shadow: 0 0 0 4px #e0e7ff; }
.pair-card.kB.on { border-color: #0d9488; box-shadow: 0 0 0 4px #ccfbf1; }
.pair-card.on .pair-tag::after { content: " ✓"; }
.primary.wide:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 720px) { .pair-cards { grid-template-columns: 1fr; } .pair-card { aspect-ratio: auto; min-height: 160px; } }
.study-panel { --k: var(--blue); }
details.full-conv { border: 1px dashed var(--blue-line); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; background: #f8faff; }
details.full-conv summary { margin-bottom: 0; font-weight: 600; }
details.full-conv[open] summary { margin-bottom: 10px; }

/* ---------------------------------------------------------------- study: back button, numbered strip */
.back-btn { border: 1px solid var(--blue-line); color: var(--blue); background: #fff; padding: 7px 14px; border-radius: 8px; font-weight: 600; }
.back-btn:hover { background: var(--blue-soft); }
.nav-strip { display: flex; flex-wrap: wrap; gap: 4px; flex-basis: 100%; }
.nav-strip .ns { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 12px; font-weight: 600; padding: 0; font-variant-numeric: tabular-nums; }
.nav-strip .ns.done { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.nav-strip .ns.partial { background: #fff7e6; border-color: #f5d28a; color: #92400e; }
.nav-strip .ns.cur { outline: 2px solid var(--blue-2); outline-offset: 1px; color: var(--ink); }
.nav-strip .ns:disabled { opacity: .45; cursor: not-allowed; }
.nav-strip .ns:not(:disabled):hover { border-color: var(--blue-2); }

/* ---------------------------------------------------------------- study: rate both replies, then pick */
.conv.pairmode { grid-template-columns: minmax(0, 1fr) minmax(0, 820px); }
.pair-cards.rated .pair-card { aspect-ratio: auto; overflow: visible; cursor: default; transform: none; gap: 12px; }
.pair-cards.rated .pair-text { min-height: 150px; max-height: 300px; overflow: auto; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.rate-qs { display: flex; flex-direction: column; gap: 12px; }
.rate-label { font-size: 13px; font-weight: 600; margin-bottom: 5px; line-height: 1.35; }
.rate-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.rate-send { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.rb { padding: 6px 2px; border-radius: 7px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; min-height: 34px; }
.rb:hover { border-color: var(--blue-line); background: #f8faff; }
.kA .rb.on { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.kB .rb.on { background: #0d9488; border-color: #0d9488; color: #fff; }
.rate-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }
.pick-ab { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pick-ab .pk { padding: 12px; border-radius: 10px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 15px; }
.pick-ab .pk.kA:hover, .pick-ab .pk.kA.on { border-color: #4f46e5; color: #4f46e5; }
.pick-ab .pk.kB:hover, .pick-ab .pk.kB.on { border-color: #0d9488; color: #0d9488; }
.pick-ab .pk.kA.on { background: #eef2ff; box-shadow: 0 0 0 4px #e0e7ff; }
.pick-ab .pk.kB.on { background: #f0fdfa; box-shadow: 0 0 0 4px #ccfbf1; }
@media (max-width: 1200px) { .conv.pairmode { grid-template-columns: minmax(0, 1fr); } .conv.pairmode .panel { position: static; max-height: none; } }
@media (max-width: 720px) { .pair-cards.rated { grid-template-columns: 1fr; } .rb { min-height: 44px; } }
/* ratings of the chosen reply */
.rate-qs.chosen { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.rate-qs.chosen.kA { border-color: #c7d2fe; background: #f8f8ff; }
.rate-qs.chosen.kB { border-color: #99f6e4; background: #f5fdfb; }
.pick-name { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; font-size: 12px; }
.pick-name.kA { background: #4f46e5; } .pick-name.kB { background: #0d9488; }
.pair-intro { margin: -4px 0 10px; }
.del-btn { border: 1px solid #f3c4c4; color: #b42318; background: #fff; padding: 5px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; }
.del-btn:hover { background: #fef0f0; border-color: #b42318; }
.del-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 7px; border: 1px solid transparent;
  background: none; color: var(--muted); }
.del-icon:hover { color: #b42318; background: #fef0f0; border-color: #f3c4c4; }
.modal-back { position: fixed; inset: 0; background: rgba(15, 29, 58, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border-radius: 14px; padding: 24px; width: 100%; max-width: 380px; text-align: center;
  box-shadow: 0 20px 50px rgba(15, 29, 58, .25); }
.modal h2 { margin: 8px 0 6px; font-size: 18px; }
.modal p { margin: 4px 0; word-break: break-word; }
.modal-icon { width: 44px; height: 44px; border-radius: 50%; background: #fef0f0; color: #b42318; display: grid; place-items: center; margin: 0 auto; }
.modal-icon svg { width: 22px; height: 22px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.modal-actions button { padding: 10px; border-radius: 8px; font-weight: 600; }
.modal-actions .b-plain { border: 1px solid var(--line); background: #fff; }
.danger { background: #b42318; color: #fff; border: 0; }
.danger:hover { background: #912018; }
/* tables folded after 5 rows, with a thin bar to expand */
.folded tr.fold-more { display: none; }
.scroll.folded table.list, .scroll:has(+ .expand-bar) table.list { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.expand-bar { display: block; width: 100%; margin: 0 0 12px; padding: 5px 0; border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 10px 10px; background: var(--soft); color: var(--blue); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.expand-bar:hover { background: var(--blue-soft); }
th.idx, td.idx { width: 36px; color: var(--muted); padding-left: 12px; padding-right: 4px; }
.card .expand-bar { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
/* drift-type examples: client line, then the therapist reply */
.ex-pair { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--blue-line);
  background: var(--soft); border-radius: 0 8px 8px 0; font-size: 13px; color: var(--ink); }
.ex-line b { font-weight: 600; color: var(--muted); }
.ex-why { font-size: 12px; color: var(--muted); margin-top: 3px; font-style: italic; }
