/* ============================================================
   Montara Client Platform — premium visual layer.
   Loaded after tokens.css; overrides the utilitarian admin
   tokens with an editorial, prestige aesthetic.
   ============================================================ */

:root {
  /* Brand */
  --brand:       #00674B;
  --brand-600:   #00533C;
  --brand-700:   #013A2A;
  --brand-900:   #04241B;
  --brand-100:   #E4EFEA;

  /* Prestige accent (brass) */
  --gold:        #B0894F;
  --gold-soft:   #F2EADC;

  --accent:       var(--brand);
  --accent-hover: var(--brand-600);
  --accent-soft:  var(--brand-100);

  /* Surfaces — warm ivory paper */
  --bg:        #F7F5EF;
  --surface:   #FFFFFF;
  --surface-2: #F3F1E9;
  --border:    #E7E3D7;
  --overlay:   rgba(4, 36, 27, 0.42);

  --text:        #19261F;
  --text-muted:  #6E7873;
  --text-invert: #FFFFFF;

  --success: #1F7A55;
  --warning: #B27214;
  --danger:  #B23A3A;
  --danger-hover: #94302F;

  --radius:    14px;
  --radius-sm: 9px;
  --radius-lg: 22px;
  --shadow:    0 1px 2px rgba(20,40,32,.05), 0 8px 24px -10px rgba(20,40,32,.14);
  --shadow-lg: 0 24px 60px -20px rgba(15,40,30,.32);
  --focus:     0 0 0 3px rgba(0,103,75,.22);

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-5: 24px; --sp-6: 36px;

  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font:  "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

html, body {
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(0,103,75,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(176,137,79,.07), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  letter-spacing: .005em;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--brand-900);
}
h1 { font-size: clamp(28px, 4.4vw, 40px); line-height: 1.12; }
h2 { font-size: clamp(20px, 2.6vw, 25px); margin: 0 0 var(--sp-3); }
.muted { color: var(--text-muted); }

::selection { background: var(--brand-100); }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3);
  padding: 14px var(--sp-5);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { display: block; height: 30px; width: auto; }
.demo-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold);
  border: 1px solid var(--gold); border-radius: 999px;
  padding: 4px 10px; background: var(--gold-soft);
}
.spacer { flex: 1; min-width: 0; }

/* Segmented role switch */
.seg {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px;
  box-shadow: inset 0 1px 2px rgba(20,40,32,.04);
}
.seg button {
  border: none; background: none; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--text-muted);
  padding: 8px 18px; border-radius: 999px; min-height: 38px;
  transition: color .18s, background .18s, box-shadow .18s;
}
.seg button:hover { color: var(--brand); }
.seg button.active {
  background: var(--brand); color: var(--text-invert);
  box-shadow: 0 6px 16px -6px rgba(0,103,75,.55);
}

.picker { display: flex; flex-direction: column; gap: 3px; }
.picker .muted { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.picker select {
  max-width: 280px; min-height: 38px; padding: 7px 12px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font: inherit; font-weight: 600; color: var(--text);
}
#reset {
  min-height: 38px; border-radius: 999px; font-weight: 600;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
}
#reset:hover { background: var(--surface); color: var(--text); }

/* ---------------- Layout ---------------- */
main {
  max-width: 1080px; margin: 0 auto;
  padding: var(--sp-6) var(--sp-5) 80px;
  animation: rise .35s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.head-row {
  display: flex; flex-wrap: wrap; gap: var(--sp-4);
  align-items: center; margin-bottom: var(--sp-6);
}

/* Avatar */
.avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 21px;
  color: var(--text-invert);
  box-shadow: 0 8px 20px -8px rgba(20,40,32,.5);
  border: 2px solid rgba(255,255,255,.7);
}
.avatar.sm { width: 38px; height: 38px; font-size: 15px; }
.head-meta { display: flex; flex-direction: column; gap: 2px; }
.head-meta .eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold);
}

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.grid > * { min-width: 0; }

/* KPI card with progress ring */
.kpi {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-5);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.kpi-body { min-width: 0; }
.kpi-label {
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-muted);
}
.kpi-value {
  font-family: var(--serif); font-size: 30px; font-weight: 600;
  color: var(--brand-900); line-height: 1.1; margin: 4px 0 2px;
}
.kpi-sub { font-size: 12.5px; color: var(--text-muted); }

.ring { width: 64px; height: 64px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring .track { stroke: var(--surface-2); }
.ring .val   { stroke: url(#ringgrad); transition: stroke-dasharray .5s ease; }
.ring-wrap { position: relative; width: 64px; height: 64px; flex: none; }
.ring-num {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 14px; color: var(--brand);
}

/* ---------------- Section heading ---------------- */
.sec-head {
  display: flex; align-items: baseline; gap: var(--sp-3);
  margin: var(--sp-6) 0 var(--sp-4);
}
.sec-head h2 { margin: 0; }
.sec-head::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}
.sec-sub { color: var(--text-muted); font-size: 13.5px; margin: -6px 0 var(--sp-4); }

/* ---------------- Timeline (deadlines) ---------------- */
.timeline { position: relative; padding-left: 30px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(var(--border), transparent);
}
.tl-item {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  isolation: isolate;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
  font: inherit; color: var(--text);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.tl-item:hover { transform: translateX(2px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.tl-node {
  position: absolute; left: -25px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--text-muted);
  box-shadow: 0 0 0 4px var(--bg);
}
.tl-node.soon { border-color: var(--danger); }
.tl-node.mid  { border-color: var(--warning); }
.tl-node.ok   { border-color: var(--brand); }
.tl-node.done { background: var(--brand); border-color: var(--brand); }
.tl-item.is-done { opacity: .55; }
.tl-item.is-done .tl-title { text-decoration: line-through; }
.row-main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.tl-title, .row-title { font-weight: 600; }
.row-meta { font-size: 12.5px; color: var(--text-muted); }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-2); color: var(--text-muted);
}
.pill-accent  { background: var(--gold-soft); color: var(--gold); }
.pill-success { background: #E4F1EA; color: var(--success); }
.pill-warning { background: #F8EEDC; color: var(--warning); }
.pill-danger  { background: #F7E3E3; color: var(--danger); }

/* ---------------- Essay planner ---------------- */
.essay-board {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
}
.essay-board > * { min-width: 0; }
.essay-card {
  padding: var(--sp-5); border-radius: var(--radius-lg);
  transition: transform .2s, box-shadow .2s;
}
.essay-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.essay-head {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  justify-content: space-between; margin-bottom: var(--sp-4);
}
.essay-head strong { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.bar {
  height: 8px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--gold));
  transition: width .45s ease;
}
.task-list { display: flex; flex-direction: column; gap: 7px; margin-top: var(--sp-3); }
.task {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left; background: var(--surface-2);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 13px; font: inherit; color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.task:hover { background: #EDEBE0; border-color: var(--border); }
.task.is-done { opacity: .5; }
.task.is-done .row-main > span:first-child { text-decoration: line-through; }

/* Check circle */
.check {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  border: 2px solid var(--border); display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-invert); transition: all .18s;
}
.is-done .check { background: var(--brand); border-color: var(--brand); transform: scale(1.05); }

/* ---------------- Parent report ---------------- */
.report-card {
  position: relative; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-6);
  background:
    linear-gradient(180deg, #FFFFFF, #FCFBF6);
  box-shadow: var(--shadow);
}
.report-card::before {
  content: ""; position: absolute; left: 0; top: 26px; bottom: 26px;
  width: 4px; border-radius: 4px;
  background: linear-gradient(var(--brand), var(--gold));
}
.report-bar {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.report-card > p { font-size: 16px; line-height: 1.65; color: var(--text); }
.report-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold);
}
.report-list { list-style: none; margin: 8px 0 0; padding: 0; }
.report-list li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 6px 0; font-size: 14.5px; line-height: 1.5;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 8px;
  background: var(--text-muted);
}
.dot.pill-success { background: var(--success); }
.dot.pill-warning { background: var(--warning); }
.field-label {
  font-family: var(--serif); font-size: 15px; font-weight: 600;
  color: var(--brand-900); text-transform: none; letter-spacing: 0;
  margin-bottom: 2px;
}

/* ---------------- Stack / generic rows ---------------- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  font: inherit; color: var(--text); cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.row-item:hover { transform: translateX(2px); box-shadow: var(--shadow); border-color: var(--brand-100); }
.row-item.is-done { opacity: .55; }
.row-item.is-done .row-title { text-decoration: line-through; }

/* ---------------- Table (counselor roster) ---------------- */
.table-wrapper {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface); box-shadow: var(--shadow);
}
.table-wrapper table { width: 100%; border-collapse: collapse; min-width: 620px; }
.table-wrapper th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); background: var(--surface-2);
  padding: 14px 18px; text-align: left; font-weight: 700;
}
.table-wrapper td {
  padding: 16px 18px; border-top: 1px solid var(--border);
  white-space: nowrap; vertical-align: middle;
}
.table-wrapper tbody tr { cursor: pointer; transition: background .15s; }
.table-wrapper tbody tr:hover { background: var(--surface-2); }
.cell-name { display: flex; align-items: center; gap: 12px; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border);
  color: var(--brand); font-weight: 600; border-radius: 999px;
  padding: 7px 14px; min-height: 36px;
}
.btn-ghost:hover { background: var(--brand-100); }
.btn-secondary {
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 600;
}

/* ---------------- Responsive ---------------- */
@media (max-width: 640px) {
  .topbar-inner { padding: 12px var(--sp-4); }
  .seg button { padding: 8px 13px; font-size: 13px; }
  .picker select { max-width: 100%; }
  main { padding: var(--sp-5) var(--sp-4) 72px; }
  .avatar { width: 48px; height: 48px; font-size: 18px; }
  .report-card { padding: var(--sp-5); }
}

/* ============================================================
   Expanded build — nav, sections, chat, charts
   ============================================================ */

.seg.sm button { padding: 7px 13px; font-size: 13px; }
.seg.sm button.active { background: var(--brand-700); }

/* Sub-navigation */
.subnav {
  display: flex; flex-wrap: wrap; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 var(--sp-5);
}
.subnav-btn {
  border: none; background: none; cursor: pointer; font: inherit;
  font-weight: 600; font-size: 14px; color: var(--text-muted);
  padding: 11px 16px; border-radius: 10px 10px 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color .15s, border-color .15s, background .15s;
}
.subnav-btn:hover { color: var(--brand); background: var(--surface-2); }
.subnav-btn.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Focus / recommendation card */
.focus-card {
  background: linear-gradient(135deg, #FFFFFF, #F4F1E8);
  border-left: 4px solid var(--gold);
}
.focus-text {
  font-family: var(--serif); font-size: 19px; line-height: 1.45;
  color: var(--brand-900); margin: 8px 0 0;
}

/* Meeting card */
.meeting-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); flex-wrap: wrap;
}
.mtg-title { font-weight: 700; font-size: 16px; margin: 4px 0 2px; }

/* Essay prompt + word bar */
.prompt {
  font-style: italic; color: var(--text-muted);
  border-left: 3px solid var(--border); padding-left: 14px;
  margin: var(--sp-3) 0; line-height: 1.55;
}
.wordbar { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; color: var(--text-muted); }
.wordbar .over { color: var(--danger); font-weight: 700; }

/* Counselor feedback */
.feedback { margin-top: var(--sp-4); border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.fb { background: var(--surface-2); border-radius: var(--radius); padding: var(--sp-4); margin-top: var(--sp-3); }
.fb-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.fb p { margin: 0; line-height: 1.55; }

/* Numbered advice list */
.report-list .num {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 1px;
}

/* Icon box (KPI without ring) */
.icon-box {
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: var(--surface-2); border-radius: 16px;
}

/* Score chart */
.chart-wrap { width: 100%; overflow: hidden; }
.spark { width: 100%; height: auto; display: block; }
.sp-area { fill: rgba(0,103,75,.10); stroke: none; }
.sp-line { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.sp-dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2.5; }
.sp-val { fill: var(--brand-900); font-size: 12px; font-weight: 700; text-anchor: middle; font-family: var(--font); }
.sp-x { fill: var(--text-muted); font-size: 11px; text-anchor: middle; font-family: var(--font); }
.sp-target { stroke: var(--gold); stroke-width: 1.5; stroke-dasharray: 5 4; }
.sp-tlabel { fill: var(--gold); font-size: 11px; font-weight: 700; font-family: var(--font); }

/* Cohort */
.member-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: var(--sp-2); }
.mini-row {
  display: flex; justify-content: space-between; gap: var(--sp-2);
  font-size: 13.5px; padding: 6px 0; border-bottom: 1px dashed var(--border);
}
.mini-row:last-child { border-bottom: none; }

/* Chat */
.chat-card { padding: 0; overflow: hidden; }
.chat-log {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-5); max-height: 460px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 80%; }
.msg.mine { margin-left: auto; flex-direction: row-reverse; }
.bubble {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 16px; padding: 10px 14px; line-height: 1.5;
}
.msg.mine .bubble {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.msg-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 4px; }
.msg.mine .msg-meta { color: rgba(255,255,255,.8); }
.chat-input {
  display: flex; gap: var(--sp-2); padding: var(--sp-3);
  border-top: 1px solid var(--border); background: var(--surface);
}
.chat-input .input { flex: 1; border-radius: 999px; }
.chat-input .btn-primary { border-radius: 999px; }

@media (max-width: 640px) {
  .subnav-btn { padding: 10px 12px; font-size: 13px; }
  .focus-text { font-size: 17px; }
  .msg { max-width: 92%; }
  .topbar-inner { gap: var(--sp-2); }
}

/* ============================================================
   Feedback pass — task provenance, journey, rollups, editor stub
   ============================================================ */

.focus-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--brand);
  background: var(--brand-100); border-radius: 999px;
  padding: 4px 10px;
}
.focus-tag-ai {
  background: linear-gradient(135deg, var(--gold-soft), #FFFFFF);
  color: var(--gold); border: 1px solid var(--gold);
}

/* Hero "Before your next meeting" card */
.hero-tasks {
  margin: var(--sp-4) 0 var(--sp-4);
  border-left: 4px solid var(--brand);
  background: linear-gradient(180deg, #FFFFFF, #F8F6EF);
}
.hero-tasks-head {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  align-items: flex-start; justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.task-group { margin-top: var(--sp-3); }
.task-group-head {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted);
  margin-bottom: 6px;
}

/* Journey (richer milestones) */
.journey {
  position: relative; padding-left: 30px;
}
.journey::before {
  content: ""; position: absolute; left: 9px; top: 12px; bottom: 12px;
  width: 2px; background: linear-gradient(var(--brand-100), var(--border));
}
.journey-item {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px;
}
.journey-item .tl-node {
  position: absolute; left: -25px; top: 18px;
}
.journey-item.is-next {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100);
}
.journey-item.is-done { opacity: .82; }
.journey-head {
  display: flex; gap: var(--sp-3); align-items: center;
  justify-content: space-between; flex-wrap: wrap;
}
.journey-head strong { font-family: var(--serif); font-size: 17px; }
.journey-note { margin: 4px 0 0; line-height: 1.55; color: var(--text); font-size: 14px; }

/* Common App / shared-items rollup */
.rollup-card {
  background: linear-gradient(135deg, var(--gold-soft), #FFFFFF);
  border-left: 4px solid var(--gold);
  margin-bottom: var(--sp-5);
}
.rollup-list { display: flex; flex-direction: column; }
.rollup-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 12px 0; border-top: 1px solid var(--border);
}
.rollup-row:first-child { border-top: none; }

/* Session-grouped tasks (counselor Sessions tab) */
.session-tasks {
  margin-top: 10px; background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.session-tasks-head {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px;
}
.session-task {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; font-size: 13.5px;
}
.session-task.is-done { opacity: .55; text-decoration: line-through; }

/* Essay editor stub */
.editor-row {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap; margin-top: var(--sp-3);
}
.editor-btn {
  display: inline-flex; gap: 8px; align-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-700));
  border-radius: 999px;
}
.editor-btn[disabled] { opacity: .85; cursor: not-allowed; }

/* Cohort CTA */
.cohort-cta {
  width: 100%; margin-top: var(--sp-3); border-radius: 999px;
}

/* ============================================================
   Practice (SAT question bank)
   ============================================================ */

.miss-card {
  border-left: 4px solid var(--gold);
  background: linear-gradient(135deg, var(--gold-soft), #FFFFFF);
  margin-bottom: var(--sp-5);
}
.miss-head {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  align-items: center; justify-content: space-between;
}

.topic-grid {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.topic-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--sp-5);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.topic-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.topic-card.is-weak { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.topic-head {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 6px; margin-bottom: var(--sp-3);
}
.topic-head h3 {
  margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 600;
  line-height: 1.2; color: var(--brand-900);
  max-width: 100%; overflow-wrap: break-word; word-break: break-word;
}
.topic-section {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold);
}
.topic-meta {
  display: flex; gap: var(--sp-4); align-items: center;
  padding: var(--sp-3) 0; border-top: 1px solid var(--border);
}
.topic-acc {
  font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--brand-900);
}

/* In-session UI */
.practice-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  justify-content: space-between; margin-bottom: 10px;
}
.practice-progress {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  letter-spacing: .04em;
}
.practice-rail {
  height: 6px; background: var(--surface-2);
  border-radius: 999px; overflow: hidden; margin-bottom: var(--sp-4);
}
.practice-rail-fill {
  height: 100%; background: linear-gradient(90deg, var(--brand), var(--gold));
  border-radius: 999px; transition: width .35s ease;
}
.practice-card { padding: var(--sp-6); }
.practice-passage {
  background: var(--surface-2); border-left: 3px solid var(--gold);
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 14.5px; line-height: 1.65; color: var(--text);
  margin-bottom: var(--sp-4); font-style: italic;
}
.practice-prompt {
  font-family: var(--serif); font-size: 19px; line-height: 1.5;
  color: var(--brand-900); margin-bottom: var(--sp-4); white-space: pre-line;
}
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  font: inherit; color: var(--text);
  transition: transform .12s, border-color .12s, background .12s;
}
.choice:hover:not(:disabled) {
  border-color: var(--brand); background: var(--brand-100);
  transform: translateX(2px);
}
.choice:disabled { cursor: default; }
.choice.is-correct {
  border-color: var(--success); background: #E4F1EA; color: var(--brand-900);
}
.choice.is-wrong {
  border-color: var(--danger); background: #F8E5E5;
}
.choice.is-faded { opacity: .5; }
.choice-letter {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: var(--surface-2); border: 1.5px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: var(--text-muted);
}
.choice.is-correct .choice-letter { background: var(--success); color: #fff; border-color: var(--success); }
.choice.is-wrong .choice-letter { background: var(--danger); color: #fff; border-color: var(--danger); }
.choice-text { flex: 1; line-height: 1.5; }
.choice-mark {
  margin-left: auto; font-weight: 700; font-size: 16px;
}
.choice.is-correct .choice-mark { color: var(--success); }
.choice.is-wrong .choice-mark { color: var(--danger); }

.explain {
  margin-top: var(--sp-4); padding: 14px 18px;
  border-radius: var(--radius); border-left: 4px solid var(--brand);
  background: var(--brand-100);
}
.explain.no { border-left-color: var(--danger); background: #FBE8E8; }
.explain-head {
  font-weight: 700; font-size: 13.5px; color: var(--brand-900);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px;
}
.explain.no .explain-head { color: var(--danger); }
.explain p { margin: 0; line-height: 1.55; }

.practice-next {
  margin-top: var(--sp-4); border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-700));
}

.practice-summary {
  border-left: 4px solid var(--gold);
  background: linear-gradient(180deg, #FFFFFF, #FCFBF6);
  margin-bottom: var(--sp-4);
}
.summary-actions {
  display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-5);
}
.summary-actions .btn-primary, .summary-actions .btn-secondary {
  border-radius: 999px;
}

.plan-practice {
  width: 100%; border-radius: 999px;
  margin-top: var(--sp-3); border: 1px dashed var(--brand);
  color: var(--brand); background: var(--surface);
  font-weight: 600; padding: 10px;
}
.plan-practice:hover { background: var(--brand-100); }

@media (max-width: 640px) {
  .practice-card { padding: var(--sp-5); }
  .practice-prompt { font-size: 17px; }
  .topic-meta { gap: var(--sp-3); }
}

/* ============================================================
   Full-length adaptive module + AI alignment workspace
   ============================================================ */

.exam-launch { border-left: 4px solid var(--brand); }
.exam-launch-head { margin-bottom: var(--sp-3); }
.exam-launch-btns { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.exam-launch-btns .btn-primary { border-radius: 999px; flex: 1; min-width: 200px; }

.exam-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap; margin-bottom: 10px;
}
.exam-bar-l, .exam-bar-r { display: flex; align-items: center; gap: var(--sp-3); }
.exam-mod { font-weight: 700; font-size: 13.5px; color: var(--text-muted); letter-spacing: .03em; }
.exam-bar-r .btn-secondary { border-radius: 999px; min-height: 36px; padding: 6px 14px; }
.exam-timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px;
  color: var(--brand-900); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px;
}
.exam-timer.low { color: var(--danger); border-color: var(--danger); }
.exam-qnum {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.choice.is-selected {
  border-color: var(--brand); background: var(--brand-100);
}
.choice.is-selected .choice-letter { background: var(--brand); color: #fff; border-color: var(--brand); }
.spr-wrap { margin-top: var(--sp-2); }
.spr-input { max-width: 220px; font-size: 18px; font-weight: 600; }
.exam-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-top: var(--sp-4); flex-wrap: wrap;
}
.exam-nav .btn-primary, .exam-nav .btn-secondary { border-radius: 999px; }

.exam-transition { text-align: center; border-left: 4px solid var(--gold); }
.branch-row {
  display: flex; align-items: center; justify-content: center;
  gap: var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-4);
}
.branch-card {
  border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 14px 20px; background: var(--surface-2); opacity: .55;
}
.branch-card.on {
  opacity: 1; border-color: var(--brand); background: var(--brand-100);
  box-shadow: 0 0 0 3px var(--brand-100);
}
.branch-tier { font-weight: 700; color: var(--brand-900); }
.branch-arrow { font-size: 24px; color: var(--gold); font-weight: 700; }

.score-dial {
  width: 120px; height: 120px; flex: none; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, var(--brand-100), #fff);
  border: 3px solid var(--brand);
}
.score-dial-num { font-family: var(--serif); font-size: 34px; font-weight: 700; color: var(--brand-900); line-height: 1; }
.score-dial-range { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Answer review */
.rev-card { padding: var(--sp-4) var(--sp-5); }
.rev-head { display: flex; gap: var(--sp-3); align-items: flex-start; }
.rev-badge {
  width: 28px; height: 28px; flex: none; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.rev-badge.ok { background: var(--success); }
.rev-badge.no { background: var(--danger); }
.rev-prompt { font-weight: 600; line-height: 1.45; margin-top: 2px; }
.rev-answers {
  display: flex; flex-direction: column; gap: 4px;
  margin: var(--sp-3) 0; font-size: 14px;
  padding: var(--sp-3); background: var(--surface-2); border-radius: var(--radius-sm);
}
.rev-answers .ok { color: var(--success); }
.rev-answers .no { color: var(--danger); }
.rev-why { font-size: 14px; line-height: 1.55; }
.rev-distracts { margin-top: var(--sp-2); }
.rev-distract { font-size: 13.5px; line-height: 1.5; color: var(--text-muted); padding: 4px 0; }

/* Reference sheet modal */
.refsheet {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3);
  font-size: 14px; line-height: 1.6;
}
.refsheet > div { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }

/* Alignment workspace */
.align-grid {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  margin-bottom: var(--sp-4);
}
.align-col-ref { background: linear-gradient(180deg, #fff, #F4F8F5); }
.align-col-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.align-prompt { font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--brand-900); margin-bottom: var(--sp-3); white-space: pre-line; }
.align-choices { display: flex; flex-direction: column; gap: 6px; }
.align-choice {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px;
}
.align-choice.correct { border-color: var(--success); background: #E4F1EA; }
.align-spr { padding: 10px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 14px; }
.align-decision { border-left: 4px solid var(--gold); }
.align-btns { display: flex; gap: var(--sp-3); margin-top: var(--sp-3); }
.align-btns .btn-primary, .align-btns .btn-danger { border-radius: 999px; flex: 1; }

@media (max-width: 640px) {
  .score-dial { width: 96px; height: 96px; }
  .score-dial-num { font-size: 28px; }
  .refsheet { grid-template-columns: 1fr; }
}

/* ============================================================
   Confetti (correct-answer celebration)
   ============================================================ */
.confetti-root { position: fixed; inset: 0; pointer-events: none; z-index: 9998; overflow: hidden; }
.confetti-piece {
  position: absolute; top: 42%; left: 50%; border-radius: 2px; opacity: 0;
  animation: confetti-fly var(--d) cubic-bezier(.15,.7,.35,1) var(--delay) forwards;
}
@keyframes confetti-fly {
  0%   { transform: translate(-50%, -50%) rotate(0deg); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x)), calc(-50% + 64vh)) rotate(var(--r)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .confetti-root { display: none; } }

/* ============================================================
   Custom test builder
   ============================================================ */
.builder-card { display: flex; flex-direction: column; gap: var(--sp-5); }
.builder-field { display: flex; flex-direction: column; gap: 8px; }
.builder-row { display: flex; gap: var(--sp-5); flex-wrap: wrap; }
.builder-row .builder-field { flex: 1; min-width: 200px; }
.builder-seg { align-self: flex-start; flex-wrap: wrap; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600;
  font-size: 13px; cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.builder-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: var(--sp-4);
}
.exam-launch-btns #open-builder { border-radius: 999px; flex: 1; min-width: 200px; }

/* ============================================================
   Skill heatmap + motion polish
   ============================================================ */
.heatmap {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 116px), 1fr));
}
.heat-cell {
  border-radius: 12px; padding: 12px 12px 10px; min-width: 0;
  border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px;
  animation: heat-in .42s cubic-bezier(.2,.7,.3,1) both;
}
.heat-acc { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--brand-900); }
.heat-lbl { font-size: 10.5px; line-height: 1.2; color: var(--text-muted); }
.heat-hi   { background: #E4F1EA; border-color: #BFE0CF; }
.heat-mid  { background: #F8EEDC; border-color: #ECD9B0; }
.heat-lo   { background: #F7E3E3; border-color: #EEC4C4; }
.heat-none { background: var(--surface-2); }
.heat-none .heat-acc { color: var(--text-muted); }
@keyframes heat-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .heat-cell { animation: none; } }

/* Choice press feedback */
.choice:active:not(:disabled) { transform: scale(.99); }
.choice.is-selected { animation: choice-pop .18s ease-out; }
@keyframes choice-pop { 0% { transform: scale(1); } 50% { transform: scale(1.015); } 100% { transform: scale(1); } }

/* ============================================================
   #3 Score predictor card
   ============================================================ */
.predict-card { margin: var(--sp-5) 0; padding: 0; overflow: hidden; }
.predict-grid {
  display: grid; gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
}
.predict-dial {
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--sp-4) var(--sp-5);
  background: linear-gradient(135deg, #E4F1EA, #F8F4EA);
  border-right: 1px solid var(--border);
}
.predict-dial.warn { background: linear-gradient(135deg, #F8EEDC, #F7E3E3); }
.predict-eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 600;
}
.predict-num { font-family: var(--serif); font-size: 44px; font-weight: 700; color: var(--brand-900); line-height: 1.05; }
.predict-band { font-size: 12.5px; color: var(--text-muted); }
.predict-body { padding: var(--sp-4) var(--sp-5); min-width: 0; }
.predict-verdict { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.predict-track {
  position: relative; height: 8px; border-radius: 999px;
  background: var(--surface-2); margin: var(--sp-4) 0 10px;
}
.predict-range { position: absolute; top: 0; bottom: 0; background: rgba(0,103,75,.16); border-radius: 999px; }
.predict-mark { position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%; transform: translate(-50%, -50%); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.predict-mark.cur  { background: var(--text-muted); }
.predict-mark.proj { background: var(--brand); width: 16px; height: 16px; }
.predict-mark.tgt  { background: #B0894F; }
.predict-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.predict-legend i.lg { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.predict-legend i.lg.cur  { background: var(--text-muted); }
.predict-legend i.lg.proj { background: var(--brand); }
.predict-legend i.lg.tgt  { background: #B0894F; }

/* ============================================================
   #2 Misconception coaching — "Where you slip"
   ============================================================ */
.miss-patterns { gap: var(--sp-3); margin-top: var(--sp-2); }
.slip-card { border-left: 4px solid var(--danger); }
.slip-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.slip-trap { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--brand-900); }
.slip-skill { font-size: 12.5px; }
.slip-head .pill { margin-left: auto; }
.slip-note { margin: 8px 0 var(--sp-3); font-size: 14px; color: var(--text); }
.slip-drill { border-radius: 999px; }

/* ============================================================
   #1 Item-level adaptive drill
   ============================================================ */
.adapt-launch { border-left: 4px solid #B0894F; }
.adapt-leveltag {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.adapt-easy   { background: #E4F1EA; color: #1F7A55; }
.adapt-medium { background: #F8EEDC; color: #7A5A1F; }
.adapt-hard   { background: #F7E3E3; color: #A23B3B; }
.adapt-ladder { display: flex; gap: 6px; justify-content: center; margin: 0 0 var(--sp-3); }
.adapt-ladder .rung {
  width: 34px; height: 6px; border-radius: 999px; background: var(--surface-2);
  transition: background .3s ease, transform .3s ease;
}
.adapt-ladder .rung.below { background: #BFE0CF; }
.adapt-ladder .rung.on { background: var(--brand); transform: scaleY(1.6); }
.adapt-ladder.big .rung { width: 48px; height: 8px; }
.adapt-level-card { margin-top: var(--sp-4); }
.adapt-level-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-top: 6px; }
.adapt-level-name { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--brand-900); }

/* ============================================================
   Auth shell (sign-in / verify)
   ============================================================ */
.hidden { display: none !important; }
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
  background: linear-gradient(135deg, #F8F4EA, #F1F6F3);
}
.auth-card {
  width: 100%; max-width: 420px; padding: var(--sp-6);
  background: #fff; border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0,0,0,.06);
}
.auth-brand { display: flex; justify-content: center; margin-bottom: var(--sp-3); }
.auth-brand img { height: 36px; }
.auth-title {
  font-family: var(--serif); font-weight: 700; font-size: 22px;
  color: var(--brand-900); margin: 0 0 var(--sp-3); text-align: center;
}
.auth-sub { font-size: 14px; color: var(--text-muted); margin: 0 0 var(--sp-4); text-align: center; }
.auth-error { color: var(--danger); font-size: 13px; margin: 8px 0 0; }
.auth-foot { font-size: 12px; margin-top: var(--sp-5); text-align: center; }
.auth-foot code {
  background: var(--surface-2); padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
}
.auth-code { letter-spacing: 8px; font-size: 22px; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.auth-google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; font-weight: 600; }
.auth-google .g-mark { display: inline-flex; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: var(--sp-4) 0; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
@media (max-width: 380px) {
  .auth-card { padding: var(--sp-4); }
  .auth-title { font-size: 19px; }
  .auth-code { letter-spacing: 5px; font-size: 19px; }
  .auth-foot code { word-break: break-all; }
}

/* ============================================================
   Full-length practice test
   ============================================================ */
.fulltest-launch {
  border-left: 4px solid var(--brand);
  background: linear-gradient(135deg, #ffffff, #F1F6F3);
}
.fulltest-launch .exam-launch-head { margin-bottom: var(--sp-3); }
/* Two-section progress indicator shown during a full test */
.full-progress { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--sp-2); }
.full-dot {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: 3px 10px; border-radius: 999px; background: var(--surface-2);
}
.full-dot.on { background: var(--brand); color: #fff; }
.full-prog-line { flex: 1; height: 2px; background: var(--border); border-radius: 2px; }
/* Larger composite dial on the full-test result */
.score-dial-lg { width: 132px; height: 132px; }
.score-dial-lg .score-dial-num { font-size: 42px; }
@media (max-width: 600px) { .score-dial-lg { width: 108px; height: 108px; } .score-dial-lg .score-dial-num { font-size: 34px; } }
