:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --ink: #0c0c0d;
  --ink-2: #1f2024;
  --muted: #6b7280;
  --line: #ececee;
  --line-strong: #d9d9dd;
  --brand: #ff5a1f;
  --brand-soft: #fff0e9;
  --good: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(12, 12, 13, 0.04), 0 1px 1px rgba(12, 12, 13, 0.03);
  --shadow-md: 0 6px 24px rgba(12, 12, 13, 0.06);
  --shadow-lg: 0 24px 60px rgba(12, 12, 13, 0.12);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[hidden] { display: none !important; }

button { font-family: inherit; cursor: pointer; }

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

h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: end;
  gap: 2px;
  height: 20px;
}
.brand-mark span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--brand);
}
.brand-mark span:nth-child(1) { height: 8px; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 12px; }
.brand-mark span:nth-child(4) { height: 18px; }

.brand-name { font-size: 16px; }
.brand-dot { color: var(--brand); }

.role-switch {
  display: inline-flex;
  padding: 4px;
  background: #f1f1f3;
  border-radius: 999px;
}
.role-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 999px;
  transition: all 0.18s var(--ease);
}
.role-btn.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.lang-switch {
  display: inline-flex;
  margin-left: 8px;
  padding: 4px;
  background: #f1f1f3;
  border-radius: 999px;
}
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  transition: all 0.18s var(--ease);
}
.lang-btn.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ---------- Layout ---------- */
.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

body.is-kiosk-student .role-switch { display: none !important; }

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.view-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 6px;
}

.view-sub { color: var(--muted); }

.muted { color: var(--muted); font-size: 13px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s var(--ease);
}
.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover { background: #2a2b30; }
.btn-primary:disabled { background: #c8c8cc; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: #f5f5f7; }
.btn-ghost:disabled { color: #b5b5ba; cursor: not-allowed; }

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: #f1f1f3; color: var(--ink); }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 36px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---------- Blocks ---------- */
.block { margin-top: 36px; }
.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.block-head h2 {
  font-size: 16px;
  font-weight: 600;
}

/* ---------- Task list (admin) ---------- */
.task-list { display: grid; gap: 10px; }

.task-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  transition: border-color 0.15s var(--ease);
}
.task-row:hover { border-color: var(--line-strong); }

.task-row h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.task-row p {
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: #f5f5f7;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.task-actions { display: flex; gap: 6px; }

/* ---------- Submissions list ---------- */
.sub-list { display: grid; gap: 8px; }
.sub-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s var(--ease);
}
.sub-row:hover { border-color: var(--line-strong); }

.sub-row-rich { cursor: default; align-items: center; }
.sub-main { min-width: 0; }
.sub-side { display: flex; align-items: center; gap: 12px; }
.sub-scores { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sub-score {
  font-size: 12px;
  color: #4b5563;
  background: #f4f4f5;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.sub-score-overall { background: #ecfdf3; border-color: #abefc6; color: #067647; }

.student-form { display: flex; gap: 8px; margin-bottom: 12px; }
.student-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font: inherit;
  background: var(--surface);
}
.student-list { display: grid; gap: 8px; }
.student-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.student-main { min-width: 0; }
.student-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-id { font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.btn-sm { padding: 6px 10px; font-size: 13px; line-height: 1.2; white-space: nowrap; border-radius: 8px; }
@media (max-width: 720px) {
  .student-row { grid-template-columns: 32px minmax(0, 1fr); }
  .student-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sub-name { font-weight: 500; font-size: 14px; }
.sub-task { font-size: 13px; color: var(--muted); }

.score-pill {
  font-weight: 600;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--ink-2);
}
.score-pill.is-good { background: #e7f7f0; color: #0a7c5a; }
.score-pill.is-warn { background: #fff4e0; color: #b6781a; }
.score-pill.is-bad { background: #fde8e8; color: #b91c1c; }

.timestamp { font-size: 12px; color: var(--muted); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; font-weight: 600; }

/* ---------- Student focused stage ---------- */
.view-student {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 110px);
}

.student-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.student-bar-left {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f1f3;
  padding: 4px;
  border-radius: 999px;
}
.pager-btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease);
}
.pager-btn:hover:not(:disabled) { background: #fff; }
.pager-btn:disabled { color: #c2c2c8; cursor: not-allowed; }

.task-counter {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 10px;
  font-variant-numeric: tabular-nums;
}

.who { display: inline-flex; align-items: center; }
.input-ghost {
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  padding: 6px 2px;
  font-size: 14px;
  text-align: right;
  min-width: 160px;
  outline: none;
  transition: border-color 0.15s var(--ease);
}
.input-ghost:focus { border-color: var(--ink); }

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 0 24px;
  animation: stage-in 0.35s var(--ease);
}
@keyframes stage-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.stage-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 18px;
}
.chip-ghost {
  background: #e7f7f0;
  color: #0a7c5a;
}

.stage-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
  max-width: 720px;
}

.stage-prompt {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 600px;
  margin-bottom: 36px;
}

/* ---------- Big recorder ---------- */
.big-recorder {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.rec-rings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.rec-rings span {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--brand);
  opacity: 0;
}

.stage-speak[data-rec="recording"] .rec-rings span {
  animation: ring 2.4s var(--ease) infinite;
}
.stage-speak[data-rec="recording"] .rec-rings span:nth-child(2) { animation-delay: 0.8s; }
.stage-speak[data-rec="recording"] .rec-rings span:nth-child(3) { animation-delay: 1.6s; }

@keyframes ring {
  0% { transform: scale(0.7); opacity: 0.5; }
  80% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

.big-rec-btn {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 0;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(255, 90, 31, 0.4);
  transition: transform 0.18s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.big-rec-btn:hover { transform: scale(1.04); }
.big-rec-btn:active { transform: scale(0.97); }

.big-rec-icon {
  display: block;
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.25s var(--ease);
}
.stage-speak[data-rec="recording"] .big-rec-btn {
  animation: rec-pulse 1.6s var(--ease) infinite;
}
.stage-speak[data-rec="recording"] .big-rec-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
}
@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 12px 40px rgba(255, 90, 31, 0.4); }
  50% { box-shadow: 0 12px 50px rgba(255, 90, 31, 0.65); }
}

.stage-speak[data-rec="ready"] .big-rec-btn {
  background: var(--good);
  box-shadow: 0 12px 40px rgba(16, 185, 129, 0.35);
}
.stage-speak[data-rec="ready"] .big-rec-icon {
  width: 0; height: 0;
  background: transparent;
  border-left: 22px solid #fff;
  border-top: 16px solid transparent;
  border-bottom: 16px solid transparent;
  border-radius: 0;
  margin-left: 6px;
}

.big-meta {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.big-time {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.big-status {
  font-size: 14px;
  color: var(--muted);
}
.big-status.is-warning {
  color: #b42318;
  font-weight: 600;
}

.big-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 48px;
  margin-top: 18px;
  opacity: 0.4;
  transition: opacity 0.2s var(--ease);
}
.big-wave span {
  display: block;
  width: 4px;
  height: 8px;
  background: var(--ink-2);
  border-radius: 3px;
}
.stage-speak[data-rec="recording"] .big-wave {
  opacity: 1;
}
.stage-speak[data-rec="recording"] .big-wave span {
  background: var(--brand);
  animation: bw 1s var(--ease) infinite;
}
.big-wave span:nth-child(1) { animation-delay: 0.0s; }
.big-wave span:nth-child(2) { animation-delay: 0.08s; }
.big-wave span:nth-child(3) { animation-delay: 0.16s; }
.big-wave span:nth-child(4) { animation-delay: 0.24s; }
.big-wave span:nth-child(5) { animation-delay: 0.32s; }
.big-wave span:nth-child(6) { animation-delay: 0.4s; }
.big-wave span:nth-child(7) { animation-delay: 0.32s; }
.big-wave span:nth-child(8) { animation-delay: 0.24s; }
.big-wave span:nth-child(9) { animation-delay: 0.16s; }
.big-wave span:nth-child(10) { animation-delay: 0.08s; }
.big-wave span:nth-child(11) { animation-delay: 0.04s; }
@keyframes bw {
  0%, 100% { height: 8px; }
  50% { height: 40px; }
}

.speak-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  animation: stage-in 0.3s var(--ease);
}
.btn-lg {
  padding: 14px 22px;
  font-size: 15px;
  border-radius: 12px;
}

.speak-view-fb {
  margin-top: 28px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(255, 90, 31, 0.3);
  text-underline-offset: 4px;
}
.speak-view-fb:hover { text-decoration-color: var(--brand); }

/* ---------- Empty student state ---------- */
.stage-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: auto;
  padding: 48px 24px;
}
.stage-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.stage-empty h2 { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.stage-empty p { color: var(--muted); }

/* ---------- Analyzing ---------- */
.analyzing {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 48px 24px;
}
.analyzing h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 8px;
}
.analyzing-orb {
  width: 80px;
  height: 80px;
  position: relative;
}
.analyzing-orb span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--brand);
  animation: spin 1.4s linear infinite;
}
.analyzing-orb span:nth-child(2) {
  inset: 10px;
  border-top-color: var(--ink);
  animation-duration: 1.8s;
  animation-direction: reverse;
}
.analyzing-orb span:nth-child(3) {
  inset: 20px;
  border-top-color: var(--good);
  animation-duration: 1.1s;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Stage Feedback ---------- */
.stage-feedback {
  align-items: stretch;
  text-align: left;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  gap: 20px;
}
.fb-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 8px 0 16px;
}
.score-ring-lg {
  width: 120px;
  height: 120px;
  font-size: 38px;
}
.score-ring-lg::before { inset: 8px; }

.fb-cta {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.speak-lock-msg {
  margin: 12px auto 0;
  padding: 10px 14px;
  background: #fff5e6;
  border: 1px solid #f0c98c;
  color: #8a4a00;
  border-radius: var(--radius);
  font-size: 14px;
  text-align: center;
  max-width: 360px;
}
.big-rec-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.fb-score-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  width: 100%;
  justify-content: center;
  text-align: left;
}
.fb-score {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  flex: 0 0 auto;
}
.fb-summary {
  margin: 0;
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.5;
}
.fb-h {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.fb-list {
  list-style: disc;
  padding-left: 20px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
}
.fb-mistakes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fb-mistakes li {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}
.fb-mistakes .mq {
  font-style: italic;
  color: var(--ink-2);
}
.fb-mistakes .mi {
  color: #b42318;
  font-size: 13px;
}
.fb-mistakes .mf {
  color: #067647;
  font-weight: 500;
}
.fb-mistakes .mp {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
.fb-mistakes-intro {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.fb-encourage {
  margin: 12px 0 0 0;
  padding: 10px 14px;
  background: #ecfdf3;
  color: #067647;
  border: 1px solid #abefc6;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  width: 100%;
  max-width: 520px;
}
.fb-breakdown {
  width: 100%;
  max-width: 520px;
  margin-top: 12px;
}
.brk-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px 0;
  text-align: left;
}
.brk-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.brk-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brk-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
}
.brk-label {
  font-weight: 600;
  color: var(--ink);
}
.brk-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
}
.brk-bar {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.brk-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s var(--ease);
}
/* Tier colors: 80-100 green, 60-79 orange, 0-59 red */
.brk-good .brk-fill  { background: #16a34a; }
.brk-mid  .brk-fill  { background: #f59e0b; }
.brk-low  .brk-fill  { background: #dc2626; }
.brk-good .brk-score { color: #16a34a; }
.brk-mid  .brk-score { color: #b45309; }
.brk-low  .brk-score { color: #dc2626; }
.brk-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.brk-overall {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
}
.brk-overall.brk-good { background: #16a34a; }
.brk-overall.brk-mid  { background: #d97706; }
.brk-overall.brk-low  { background: #dc2626; }
.brk-overall strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .fb-breakdown { max-width: 100%; }
  .brk-row { padding: 9px 11px; }
  .brk-head { font-size: 12px; }
}
.fb-next-tip {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* ---------- Modal ---------- */
.modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 520px;
  width: calc(100% - 32px);
  border-radius: var(--radius-lg);
}
.modal.modal-wide {
  max-width: 780px;
}
.modal::backdrop {
  background: rgba(12, 12, 13, 0.5);
  backdrop-filter: blur(4px);
}
.modal[open] { animation: pop 0.2s var(--ease); }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.input {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  width: 100%;
}
.input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(12, 12, 13, 0.06);
}
textarea.input { resize: vertical; min-height: 80px; }

/* ---------- Recorder ---------- */
.record-card { gap: 18px; }
.prompt {
  background: #fafafa;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
}

.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
}

.rec-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 0;
  background: var(--brand);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(255, 90, 31, 0.35);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.rec-btn:hover { transform: scale(1.04); }
.rec-btn:active { transform: scale(0.98); }

.rec-dot {
  display: block;
  width: 28px;
  height: 28px;
  background: #fff;
  border-radius: 50%;
  transition: all 0.2s var(--ease);
}

.recorder[data-state="recording"] .rec-btn {
  animation: pulse 1.4s var(--ease) infinite;
}
.recorder[data-state="recording"] .rec-dot {
  border-radius: 6px;
  width: 22px;
  height: 22px;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 90, 31, 0.5), 0 8px 24px rgba(255, 90, 31, 0.35); }
  50% { box-shadow: 0 0 0 16px rgba(255, 90, 31, 0), 0 8px 24px rgba(255, 90, 31, 0.35); }
}

.recorder[data-state="ready"] .rec-btn { background: var(--good); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3); }
.recorder[data-state="ready"] .rec-dot {
  width: 0; height: 0;
  background: transparent;
  border-left: 14px solid #fff;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-radius: 0;
  margin-left: 4px;
}

.rec-meta { text-align: center; }
.rec-time {
  display: block;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.rec-status {
  font-size: 13px;
  color: var(--muted);
}

.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 28px;
  margin-top: 4px;
}
.wave span {
  display: block;
  width: 3px;
  height: 6px;
  background: var(--line-strong);
  border-radius: 2px;
}
.recorder[data-state="recording"] .wave span {
  animation: wave 0.9s var(--ease) infinite;
  background: var(--brand);
}
.wave span:nth-child(2) { animation-delay: 0.1s; }
.wave span:nth-child(3) { animation-delay: 0.2s; }
.wave span:nth-child(4) { animation-delay: 0.05s; }
.wave span:nth-child(5) { animation-delay: 0.15s; }
.wave span:nth-child(6) { animation-delay: 0.25s; }
.wave span:nth-child(7) { animation-delay: 0.1s; }
.wave span:nth-child(8) { animation-delay: 0.2s; }
@keyframes wave {
  0%, 100% { height: 6px; }
  50% { height: 22px; }
}

/* ---------- Feedback ---------- */
.score-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 0;
}
.score-ring {
  --p: 0;
  --c: var(--good);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0);
  position: relative;
  flex-shrink: 0;
}
.score-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--surface);
}
.score-ring span { position: relative; }

.score-label { font-weight: 600; font-size: 16px; margin-bottom: 2px; }

.fb-section { display: flex; flex-direction: column; gap: 8px; }
.fb-section h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.transcript {
  background: #fafafa;
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
}

.mistakes {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mistakes li {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.55;
}
.mistakes .m-old {
  text-decoration: line-through;
  color: var(--bad);
  margin-right: 8px;
}
.mistakes .m-new { color: var(--good); font-weight: 600; }
.mistakes .m-exp { color: var(--muted); display: block; margin-top: 4px; }

.next-task {
  background: var(--brand-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: #8a3a14;
  line-height: 1.55;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: toast-in 0.2s var(--ease);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .app { padding: 28px 16px 60px; }
  .view-head {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 24px;
  }
  .view-title { font-size: 26px; }
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 20px; }
  .who { align-items: stretch; }
  .input-ghost { text-align: left; min-width: 0; }
  .field-row { grid-template-columns: 1fr; }

  .sub-row { grid-template-columns: 32px 1fr auto; }
  .sub-row .timestamp { display: none; }

  .task-row { grid-template-columns: 1fr; }
  .task-actions { justify-content: flex-end; }

  .modal-card { padding: 20px; border-radius: 18px; }
  .rec-btn { width: 76px; height: 76px; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:nth-child(3) { grid-column: span 2; }
}

.btn-danger { color: #b42318; }
.btn-danger:hover { background: #fef3f2; }

/* ---------- Teacher analysis (admin feedback modal only) ---------- */
.fb-teacher { background:#f9fafb; border:1px solid #eaecf0; border-radius:10px; padding:12px 14px; margin-top:12px; }
.fb-teacher .fb-h { color:#475467; font-size:13px; letter-spacing:.02em; text-transform:uppercase; margin:0 0 8px 0; }
/* Task adherence badge */
.adherence-badge { display:inline-flex; align-items:center; gap:6px; padding:4px 12px; border-radius:20px; font-size:13px; font-weight:600; }
.adherence-badge.on-topic        { background:#d1fadf; color:#027a48; }
.adherence-badge.partially       { background:#fef0c7; color:#b54708; }
.adherence-badge.off-topic       { background:#fee4e2; color:#b42318; }
.adherence-badge.fragments       { background:#fce7f6; color:#9c1ab1; }
.adherence-badge.no-response     { background:#f2f4f7; color:#475467; }
.adherence-note { font-size:12px; color:#667085; margin-top:4px; }
.fb-teacher-block { margin-top:10px; }
.fb-teacher-block:first-of-type { margin-top:0; }
.fb-teacher-h { font-size:12px; color:#667085; margin:0 0 6px 0; font-weight:600; text-transform:uppercase; letter-spacing:.04em; }
.fb-teacher-scores { display:flex; flex-wrap:wrap; gap:8px; list-style:none; padding:0; margin:0; }
.fb-teacher-scores li { display:flex; align-items:center; gap:6px; background:#fff; border:1px solid #eaecf0; border-radius:8px; padding:4px 10px; font-size:13px; }
.fb-teacher-scores .ts-k { color:#475467; }
.fb-teacher-scores .ts-v { font-weight:700; color:#101828; }
.fb-teacher-tags, .fb-teacher-recurring { list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:6px; }
.fb-teacher-tags li, .fb-teacher-recurring li { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.tag { display:inline-block; font-size:11px; font-weight:600; padding:2px 8px; border-radius:999px; text-transform:capitalize; letter-spacing:.01em; }
.tag-cat { background:#eff8ff; color:#175cd3; border:1px solid #b2ddff; }
.tag-pat { background:#fef6ee; color:#b93815; border:1px solid #f9dbaf; }
.tag-quote { font-size:12px; font-style:italic; }
.fb-teacher-recurring .ts-v { font-weight:700; color:#101828; }

.sub-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sub-audio { height: 32px; max-width: 220px; }

/* ============================================================
   v2 dashboard — sidebar shell, polished cards, calm hierarchy
   ============================================================ */
:root {
  --side-w: 232px;
  --card-r: 16px;
  --hairline: #eef0f3;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  gap: 24px;
  align-items: start;
}
.main-col { min-width: 0; }
.app { max-width: 1280px; }

/* ---------- Sidebar ---------- */
.side {
  position: sticky;
  top: 76px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 4px;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #475467;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 10px;
  transition: all 0.15s var(--ease);
}
.side-link svg { color: #98a2b3; flex-shrink: 0; }
.side-link:hover { background: #f6f7f9; color: var(--ink); }
.side-link:hover svg { color: #475467; }
.side-link.is-active {
  background: #fff1ec;
  color: var(--brand);
}
.side-link.is-active svg { color: var(--brand); }
.side-pill {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 2px 8px;
  border-radius: 999px;
}
.side-group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #98a2b3;
  margin: 16px 12px 4px;
}
.side-help {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: #fff;
}
.side-help-h { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.side-help-p { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }

/* ---------- View head pill ---------- */
.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}
.date-pill svg { color: var(--muted); }

/* ---------- Stat cards (v2) ---------- */
.stats {
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--card-r);
  border: 1px solid var(--hairline);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s var(--ease);
}
.stat-card:hover { border-color: #e0e3e8; }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-rose { background: #fff1f2; color: #e11d48; }
.stat-icon-blue { background: #eff6ff; color: #2563eb; }
.stat-icon-green { background: #ecfdf5; color: #059669; }
.stat-icon-amber { background: #fffbeb; color: #d97706; }
.stat-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); margin: 0; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.stat-foot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-good { background: #10b981; }
.dot-warn { background: #f59e0b; }
.dot-bad { background: #ef4444; }

/* ---------- Dashboard grid ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.dash-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- Card ---------- */
.card {
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: var(--card-r);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.card-head h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.card-foot-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--hairline);
  background: #fff;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s var(--ease);
}
.card-foot-btn:hover { background: #f6f7f9; }

/* ---------- Dash tables ---------- */
.dash-table { display: flex; flex-direction: column; }
.dash-row {
  display: grid;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
}
.dash-row:first-child { border-top: 0; }
.dash-row .r-title { color: var(--ink); font-weight: 500; }
.dash-row .r-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dash-row .r-meta { color: var(--muted); font-size: 12px; }
.dash-row.head {
  border-top: 0;
  padding-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.dash-tasks-row { grid-template-columns: minmax(0,1fr) auto auto 120px 28px; }
.dash-subs-row  { grid-template-columns: 32px minmax(0,1.1fr) minmax(0,1.4fr) auto auto 36px 28px; }
@media (max-width: 1100px) {
  .dash-tasks-row, .dash-subs-row { grid-template-columns: minmax(0,1fr) auto; }
  .dash-row .col-hide { display: none; }
}

/* avatar circle */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

/* level chip */
.lvl-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475467;
  letter-spacing: 0.02em;
}
.lvl-chip[data-lvl="A1"], .lvl-chip[data-lvl="A2"] { background: #fef3c7; color: #92400e; }
.lvl-chip[data-lvl="B1"], .lvl-chip[data-lvl="B2"] { background: #dbeafe; color: #1d4ed8; }
.lvl-chip[data-lvl="C1"], .lvl-chip[data-lvl="C2"] { background: #ede9fe; color: #6d28d9; }
.lvl-chip[data-lvl="TEST"] { background: #f1f5f9; color: #475467; }

/* score pill */
.score-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* mini progress */
.mini-prog {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.mini-prog-bar {
  width: 90px;
  height: 6px;
  border-radius: 999px;
  background: #eef0f3;
  overflow: hidden;
}
.mini-prog-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #34d399, #10b981);
  border-radius: 999px;
}

/* play button */
.play-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
}
.play-btn:hover { background: #f6f7f9; }

.row-more {
  width: 28px; height: 28px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}
.row-more:hover { background: #f6f7f9; color: var(--ink); }

/* ---------- Speaking behavior summary ---------- */
.dash-behavior { display: flex; flex-direction: column; gap: 4px; }
.beh-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-top: 1px solid var(--hairline);
}
.beh-row:first-child { border-top: 0; }
.beh-row .beh-info { flex: 1; min-width: 0; }
.beh-row .beh-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.beh-row .beh-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.beh-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.beh-tag-good { background: #ecfdf5; color: #047857; }
.beh-tag-stable { background: #f1f5f9; color: #475467; }
.beh-tag-support { background: #fef2f2; color: #b91c1c; }

/* ---------- Quick actions ---------- */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 1px solid var(--hairline);
  background: #fff;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  transition: all 0.15s var(--ease);
}
.quick svg { color: var(--brand); }
.quick:hover { background: #fafbfc; border-color: #e0e3e8; }

/* ---------- Tip card ---------- */
.tip-card {
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
  border-color: #fde68a;
}
.tip-h {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 6px;
}
.tip-p {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
  margin-bottom: 8px;
}
.tip-link {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
}

/* ---------- Placeholder sections ---------- */
.placeholder-block {
  border: 1px dashed var(--hairline);
  border-radius: var(--card-r);
  padding: 28px;
  background: #fcfcfd;
}

/* ---------- Mobile ---------- */
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .side {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .side-nav { flex-direction: row; gap: 4px; }
  .side-group, .side-help { display: none; }
  .side-link { white-space: nowrap; padding: 8px 12px; }
  .side-link span { display: none; }
  .side-link.is-active span,
  .side-link span.side-pill { display: inline; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .stats { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- v3 workflow intelligence ---------- */
.insight-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 6px 0 18px;
}
.insight-row:empty { display: none; }
.insight {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.insight-ico {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.insight-body { display: flex; flex-direction: column; gap: 2px; }
.insight-text { font-size: 13.5px; color: var(--ink); line-height: 1.45; font-weight: 500; }
.insight-sub { font-size: 11.5px; color: var(--muted); }
.insight-good   .insight-ico { background: #ecfdf5; color: #047857; }
.insight-warn   .insight-ico { background: #fef3c7; color: #92400e; }
.insight-info   .insight-ico { background: #eff6ff; color: #1d4ed8; }
.insight-soft   .insight-ico { background: #f5f3ff; color: #6d28d9; }

/* Weekly strip */
.weekly-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  font-size: 13px;
  color: var(--ink-2);
}
.weekly-strip:empty { display: none; }
.weekly-strip .wk-h {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 6px;
}
.weekly-strip .wk-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.weekly-strip .wk-up   { color: #047857; }
.weekly-strip .wk-down { color: #b45309; }
.weekly-strip .wk-flat { color: var(--muted); }

/* Behavior cards (richer) */
.beh-card {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 14px 16px;
  background: #fff;
  margin-bottom: 10px;
}
.beh-card.priority { border-left: 3px solid #f59e0b; }
.beh-card.priority-2 { border-left: 3px solid #d97706; }
.beh-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.beh-card-head .beh-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.beh-card-head .beh-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.beh-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.beh-tag-soft {
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f4f5f7;
  color: #475467;
  border: 1px solid #eaecf0;
}
.beh-tag-soft.t-good   { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.beh-tag-soft.t-warn   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.beh-tag-soft.t-info   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.beh-tag-soft.t-soft   { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.beh-suggest {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--ink-2);
  background: #fafbfc;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 8px 10px;
  line-height: 1.5;
}
.beh-suggest::before {
  content: "✦";
  color: var(--brand);
  font-size: 13px;
  line-height: 1.2;
}

/* Submission rapid review row */
.sub-rev {
  border-top: 1px solid var(--hairline);
  padding: 12px 4px;
}
.sub-rev:first-child { border-top: 0; }
.sub-rev.is-reviewed { opacity: 0.55; }
.sub-rev-head {
  display: grid;
  grid-template-columns: 32px minmax(0,1.1fr) minmax(0,1.4fr) auto auto auto auto;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}
.sub-rev-quote {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: #fafbfc;
  border-left: 2px solid var(--hairline);
  padding: 8px 10px;
  border-radius: 0 8px 8px 0;
  line-height: 1.5;
}
.sub-rev-summary {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.sub-rev-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.sub-rev-actions .chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: #fff;
  color: var(--ink-2);
}
.sub-rev-actions .chip-btn:hover { background: #f6f7f9; }
.sub-rev-actions .chip-btn.is-on {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}
.sub-rev-note-input {
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-size: 12.5px;
  resize: vertical;
  min-height: 36px;
  font-family: inherit;
}
@media (max-width: 1100px) {
  .sub-rev-head { grid-template-columns: 32px 1fr auto auto; }
  .sub-rev-head .col-hide { display: none; }
}

/* ---------- v4 calm hierarchy ---------- */
.card-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}
.card-head-soft { align-items: flex-start; }
.card-head-soft h2 { font-size: 17px; font-weight: 600; }

/* Insights card wrapper (insight row + weekly strip live inside one calm card) */
.insights-card .insight-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 0;
}
.insights-card .insight {
  background: #fafbfc;
  border: 1px solid var(--hairline);
  box-shadow: none;
  padding: 12px 14px;
}
.insights-card .insight-text { font-size: 13.5px; }
.insights-card .insights-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 2px 0;
  margin: 0;
}
.insights-card .weekly-strip {
  background: transparent;
  border: 0;
  border-top: 1px dashed var(--hairline);
  border-radius: 0;
  margin: 14px 0 0;
  padding: 12px 0 0;
  font-size: 12.5px;
}
.insights-card .weekly-strip:empty { display: none; border: 0; padding: 0; margin: 0; }

/* Needs Attention list (calm, scannable) */
.attn-list { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 0; }
.attn-empty { padding: 14px 2px; font-size: 13.5px; }
.attn-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
}
.attn-row:last-child { border-bottom: 0; padding-bottom: 0; }
.attn-row .avatar { width: 36px; height: 36px; font-size: 13px; }
.attn-body { min-width: 0; }
.attn-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.attn-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.attn-meta { font-size: 11.5px; color: var(--muted); }
.attn-reason {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.attn-suggest {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
  display: flex;
  gap: 8px;
}
.attn-suggest::before {
  content: "✦";
  color: var(--brand);
  font-size: 13px;
  flex-shrink: 0;
}
.attn-row-top .attn-name { color: #b45309; }
.attn-row-top .attn-name::after {
  content: "Öncelikli";
  margin-left: 8px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #b45309;
  background: #fef3c7;
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: 2px;
}

/* Compact tasks table (right column) */
.dash-table-compact .dash-row { padding: 10px 0; }
.dash-table-compact .dash-row.head { display: none; }
.dash-table-compact .dash-tasks-row {
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.dash-table-compact .dash-tasks-row > *:nth-child(n+3) { display: none; }
.dash-table-compact .r-title { font-size: 13.5px; font-weight: 500; }
.dash-table-compact .r-sub { display: none; }

/* Quieter submission review rows */
.sub-rev { padding: 14px 4px; }
.sub-rev .sub-rev-summary { display: none; } /* keep transcript only — reduce duplication */
.sub-rev-quote {
  font-size: 12.5px;
  color: var(--ink-2);
  background: transparent;
  border-left: 2px solid var(--hairline);
  padding: 2px 0 2px 10px;
  margin-top: 6px;
  line-height: 1.55;
  /* clamp to ~2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sub-rev-actions { gap: 6px; margin-top: 8px; opacity: 0.7; transition: opacity .15s ease; }
.sub-rev:hover .sub-rev-actions,
.sub-rev:focus-within .sub-rev-actions { opacity: 1; }
.sub-rev-head { gap: 10px; }
.sub-rev-head .r-title { font-size: 13.5px; }
.sub-rev-head .r-sub { font-size: 11.5px; }

/* ---------- v5 group system ---------- */
.dash-filter {
  max-width: 200px;
  font-size: 12.5px;
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  background: #fff;
  border-radius: 8px;
  color: var(--ink-2);
}
.group-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.group-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.group-card-main { flex: 1; min-width: 0; }
.group-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.group-name { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.group-level {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #fde0ce;
  padding: 2px 7px;
  border-radius: 999px;
}
.group-desc {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 4px;
  line-height: 1.5;
}
.group-meta { font-size: 12px; color: var(--muted); }
.group-actions { display: flex; gap: 6px; flex-shrink: 0; }
.student-group-pick {
  font-size: 12px !important;
  padding: 5px 8px !important;
  height: auto !important;
}
.student-form { flex-wrap: wrap; }

/* Group type badge */
.group-type-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid;
}
.group-type-class  { color: #1d6fb8; background: #e8f3ff; border-color: #b6d7f8; }
.group-type-level  { color: #6b3db0; background: #f3ecff; border-color: #d1b8f8; }
.group-type-custom { color: #3a7860; background: #e6f5ef; border-color: #a8d9c4; }

/* Student groups tags in student list / profile */
.student-groups { display: flex; flex-wrap: wrap; gap: 4px; }
.student-group-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2, #f7f7f8);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
}

/* Kiosk name picker */
#kiosk-name-picker select {
  min-width: 180px;
  max-width: 240px;
}

/* ---------- Student profile modal ---------- */
.sp-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.sp-stat {
  flex: 1;
  min-width: 80px;
  background: var(--surface-2, #f7f7f8);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
}
.sp-stat-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  display: block;
}
.sp-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sp-submission {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.sp-submission:last-child { border-bottom: 0; }
.sp-sub-main { flex: 1; min-width: 0; }
.sp-sub-task { font-weight: 600; font-size: 13.5px; color: var(--ink); margin-bottom: 2px; }
.sp-sub-date { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.sp-sub-scores { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sp-sub-score {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2, #f3f4f6);
  color: var(--ink-2);
}
.sp-sub-score.is-main {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.sp-sub-transcript {
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 6px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-missing {
  padding: 10px 0;
  color: var(--muted);
  font-size: 13px;
  border-bottom: 1px solid var(--hairline);
}
.sp-missing:last-child { border-bottom: 0; }
.sp-section-head {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 18px 0 8px 0;
}
.student-row-clickable { cursor: pointer; }
.student-row-clickable:hover .student-name { color: var(--brand); }

/* ---------- v6 Speaking Intelligence System ---------- */

/* Modal XL — wider for intelligence panels */
.modal-xl .modal-card {
  max-width: 860px;
  width: min(860px, 96vw);
}

/* Intelligence panel layout */
.intel-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.intel-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
}
.intel-section:last-child { border-bottom: 0; }
.intel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.intel-section-h {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.intel-section-action {
  font-size: 11.5px;
  color: var(--brand);
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* Stats row at top of panel */
.intel-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.intel-stat {
  background: var(--surface-2, #f7f7f8);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}
.intel-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  line-height: 1.2;
}
.intel-stat-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.intel-trend-up   { font-size: 13px; color: #047857; }
.intel-trend-down { font-size: 13px; color: #b45309; }
.intel-trend-flat { font-size: 13px; color: var(--muted); }

/* Profile grid — 2 columns */
.intel-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.intel-profile-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #fafbfc;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 10px 12px;
}
.intel-profile-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}
.intel-profile-val {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}
.intel-profile-val.is-good   { color: #047857; font-weight: 500; }
.intel-profile-val.is-warn   { color: #b45309; font-weight: 500; }
.intel-profile-val.is-strong { color: #1d4ed8; font-weight: 500; }

/* Confidence badge chips */
.conf-high   { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.conf-medium { background: #fef9ec; color: #92700e; border: 1px solid #fde68a; }
.conf-low    { background: #fff7ed; color: #b45309; border: 1px solid #fed7aa; }
.conf-nervous { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.conf-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

/* AI snapshot chips on submission cards */
.ai-snap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.ai-snap-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
}
.ai-snap-chip.good   { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.ai-snap-chip.warn   { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.ai-snap-chip.info   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.ai-snap-chip.soft   { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.ai-snap-chip.neutral { background: #f4f5f7; color: #475467; border-color: #eaecf0; }

/* Recurring patterns list in intelligence panel */
.intel-patterns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.intel-pattern-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.intel-pattern-bar-wrap {
  flex: 1;
  height: 5px;
  background: #f0f1f3;
  border-radius: 999px;
  overflow: hidden;
}
.intel-pattern-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
  transition: width 0.4s ease;
}
.intel-pattern-bar.warn { background: #f59e0b; }
.intel-pattern-label {
  font-size: 12px;
  color: var(--ink-2);
  min-width: 120px;
}
.intel-pattern-count {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* Longitudinal trend chart (score sparkline using divs) */
.intel-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 36px;
}
.intel-spark-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: var(--brand-soft);
  border-bottom: 2px solid var(--brand);
  min-height: 4px;
  transition: height 0.3s ease;
}
.intel-spark-bar.is-last {
  background: var(--brand-soft);
  border-bottom-color: var(--brand);
  opacity: 1;
}

/* Development focus block */
.intel-dev-focus {
  background: linear-gradient(135deg, #f0f7ff 0%, #fafbff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: #1e40af;
  line-height: 1.5;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.intel-dev-focus::before {
  content: "📌";
  flex-shrink: 0;
  font-size: 14px;
}

/* Intelligence panel submission timeline */
.intel-timeline { display: flex; flex-direction: column; gap: 0; }
.intel-sub-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}
.intel-sub-row:last-child { border-bottom: 0; }
.intel-sub-row:hover { background: #fafbfc; margin: 0 -4px; padding: 10px 4px; border-radius: 8px; }
.intel-sub-date {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}
.intel-sub-task { font-size: 13px; font-weight: 500; color: var(--ink); }
.intel-sub-preview {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.intel-sub-score-col { text-align: right; }
.intel-sub-score {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.intel-sub-score.score-good  { color: #047857; }
.intel-sub-score.score-mid   { color: #b45309; }
.intel-sub-score.score-low   { color: #b91c1c; }
.intel-sub-delta {
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
}
.intel-sub-delta.up   { color: #047857; }
.intel-sub-delta.down { color: #b91c1c; }

/* Hidden pattern pills in behavior cards */
.hidden-pattern-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  white-space: nowrap;
}

/* Score trend inline */
.score-with-trend {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.score-delta-up   { font-size: 11px; color: #047857; font-weight: 600; }
.score-delta-down { font-size: 11px; color: #b91c1c; font-weight: 600; }
.score-delta-flat { font-size: 11px; color: var(--muted); }

@media (max-width: 680px) {
  .intel-stats { grid-template-columns: repeat(2, 1fr); }
  .intel-profile-grid { grid-template-columns: 1fr; }
  .intel-sub-row { grid-template-columns: 56px 1fr auto; }
  .modal-xl .modal-card { max-width: 100vw; width: 100vw; border-radius: 18px 18px 0 0; }
}

/* ===== Student Intelligence Panel (SIP) — right-side drawer ===== */

.sip-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  z-index: 190;
  opacity: 0;
  transition: opacity 0.28s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
}
.sip-overlay.sip-open {
  opacity: 1;
  pointer-events: auto;
}

.sip-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 500px;
  max-width: 96vw;
  background: #fff;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: -8px 0 48px rgba(15, 23, 42, 0.13), -1px 0 0 #eaecf0;
  overflow: hidden;
}
.sip-drawer.sip-open { transform: translateX(0); }

/* Drawer header */
.sip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
  gap: 10px;
}
.sip-head-left { min-width: 0; flex: 1; }
.sip-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand);
  margin: 0 0 5px;
}
.sip-name {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Drawer scrollable body */
.sip-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
}

/* AI Summary card */
.sip-ai-summary {
  margin: 16px 20px 4px;
  background: linear-gradient(135deg, #f0f7ff 0%, #fafeff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 13px 16px 14px;
}
.sip-ai-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #2563eb;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sip-ai-eyebrow::before { content: "✦"; font-size: 11px; }
.sip-ai-text {
  font-size: 13.5px;
  color: #1e3a8a;
  line-height: 1.6;
  font-weight: 500;
}

/* Stats strip */
.sip-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--hairline);
  margin-top: 16px;
}
.sip-stat {
  padding: 11px 4px;
  text-align: center;
  border-right: 1px solid var(--hairline);
}
.sip-stat:last-child { border-right: 0; }
.sip-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.sip-stat-label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Generic section */
.sip-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
}
.sip-section:last-child { border-bottom: 0; }
.sip-section-h {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Speaking profile attributes */
.sip-profile-attrs { display: flex; flex-direction: column; gap: 9px; }
.sip-attr-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
}
.sip-attr-icon {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Trends grid */
.sip-trends-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.sip-trend-item {
  background: #f9fafb;
  border: 1px solid #eaecf0;
  border-radius: 10px;
  padding: 10px 12px;
}
.sip-trend-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 5px;
}
.sip-trend-val {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.sip-trend-val.trend-up   { color: #047857; }
.sip-trend-val.trend-down { color: #b91c1c; }
.sip-trend-val.trend-flat { color: #475467; }

/* Strongest / Growth area */
.sip-sg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sip-sg-item {
  border-radius: 10px;
  padding: 11px 13px;
}
.sip-sg-item.is-strength { background: #ecfdf5; border: 1px solid #a7f3d0; }
.sip-sg-item.is-growth   { background: #fffbeb; border: 1px solid #fde68a; }
.sip-sg-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 5px;
}
.sip-sg-item.is-strength .sip-sg-label { color: #065f46; }
.sip-sg-item.is-growth   .sip-sg-label { color: #92400e; }
.sip-sg-val { font-size: 12.5px; font-weight: 500; line-height: 1.35; }
.sip-sg-item.is-strength .sip-sg-val { color: #047857; }
.sip-sg-item.is-growth   .sip-sg-val { color: #b45309; }

/* AI Recommendations */
.sip-reco-list { display: flex; flex-direction: column; gap: 9px; }
.sip-reco-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.45;
}
.sip-reco-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 5px;
}

/* Sparkline in SIP */
.sip-sparkline {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 22px;
  vertical-align: bottom;
  margin-left: 6px;
}
.sip-spark-bar {
  width: 5px;
  border-radius: 2px 2px 0 0;
  background: #dbeafe;
  border-bottom: 2px solid #2e90fa;
  min-height: 3px;
}
.sip-spark-bar.is-last {
  background: #bfdbfe;
  border-bottom-color: #1d4ed8;
}

/* Submission rows in SIP timeline */
.sip-timeline { display: flex; flex-direction: column; }
.sip-sub-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid #f0f1f3;
  cursor: pointer;
  border-radius: 6px;
}
.sip-sub-row:last-child { border-bottom: 0; }
.sip-sub-row:hover { background: #f9fafb; margin: 0 -6px; padding: 9px 6px; }
.sip-sub-date {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.3;
}
.sip-sub-task { font-size: 13px; font-weight: 500; color: var(--ink); }
.sip-sub-preview {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.sip-sub-score-col { text-align: right; }
.sip-sub-score {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.sip-sub-score.score-good { color: #047857; }
.sip-sub-score.score-mid  { color: #b45309; }
.sip-sub-score.score-low  { color: #b91c1c; }
.sip-sub-delta { font-size: 11px; font-weight: 500; margin-top: 2px; }
.sip-sub-delta.up   { color: #047857; }
.sip-sub-delta.down { color: #b91c1c; }

/* Group badges in SIP */
.sip-group-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 20px 0; }
.sip-group-badge {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

/* Patterns (reused intel-pattern-* classes) */
.sip-patterns { display: flex; flex-direction: column; gap: 9px; }

@media (max-width: 540px) {
  .sip-drawer { width: 100vw; max-width: 100vw; }
  .sip-stats { grid-template-columns: repeat(2, 1fr); }
  .sip-trends-grid { grid-template-columns: repeat(2, 1fr); }
  .sip-sg-grid { grid-template-columns: 1fr; }
}
