:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --record: #dc2626;
  --record-dark: #b91c1c;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --error-bg: #fee2e2;
  --error-text: #b91c1c;
  --success-bg: #e8f5ee;
  --success-text: #14532d;
  --success-bar: #1a8754;
  --banner-bg: #fff8e1;
  --banner-bar: #f4b400;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* Always-visible dev strip */
.dev-strip {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  text-align: center;
  border-bottom: 1px solid #f6e1a3;
}
.dev-strip .warn { color: var(--error-text); font-weight: 700; }

.impersonation-strip {
  background: #ede9fe;
  color: #4c1d95;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  border-bottom: 1px solid #c4b5fd;
}
.impersonation-strip .muted { color: #6d28d9; }
.impersonation-strip .btn-link { color: #4c1d95; font-weight: 600; }
.impersonation-strip .btn-link:hover { text-decoration: underline; }

/* Parents'-evening (campaign) mode — locks the portal until exit. */
.campaign-strip {
  background: #ecfeff;
  color: #155e75;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid #67e8f9;
}
.campaign-strip strong { color: #0e7490; }
.campaign-strip .btn-link { color: #0e7490; font-weight: 600; }
.campaign-strip .btn-link:hover { text-decoration: underline; }

body.in-campaign {
  /* Subtle tint on the page background so the mode is visible at a glance
     even after scrolling past the strip. */
  background: #f0fdff;
}
body.in-campaign main {
  background: transparent;
}

.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}
.brand-text { white-space: nowrap; }
.brand-text .muted { font-weight: 400; opacity: 0.6; margin: 0 0.1em; }
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover { color: var(--accent); }
.nav .nav-dev { color: #b45309; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }
.nav-badge {
  display: inline-block;
  margin-left: 2px;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent, #2563eb);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  vertical-align: 2px;
}

.user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.user .who { color: var(--text); }
.user .school { color: var(--muted); font-weight: normal; }
.logout-form { margin: 0; }
.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.btn-link:hover { text-decoration: underline; }

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }

.subtitle, .class-meta, .student-meta, .contact-meta, .muted {
  color: var(--muted);
  font-size: 0.9rem;
}
.muted { font-size: 0.875rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem auto;
  max-width: 420px;
}
.centered { margin: 4rem auto; }

.dev-banner {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.form { display: flex; flex-direction: column; gap: 0.75rem; }
.form label { font-weight: 500; font-size: 0.9rem; }
.form input[type="email"], .search-input, .form input[type="file"] {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: var(--card);
  width: 100%;
}
.form input:focus, .search-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.search-input { margin: 1rem 0; font-size: 1rem; }

.radio {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.radio:hover { background: var(--bg); }

.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
}
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary {
  background: var(--card);
  color: var(--accent);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-danger {
  background: var(--card);
  color: var(--error-text);
  border-color: var(--border);
}
.btn-danger:hover { background: var(--error-bg); }
.btn-record {
  background: var(--record);
  color: white;
  border-color: var(--record);
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  margin: 1rem 0 0.25rem;
  font-size: 1.05rem;
}
.btn-record:hover { background: var(--record-dark); border-color: var(--record-dark); }

.flash {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}
.flash-error { background: var(--error-bg); color: var(--error-text); }
.flash-info { background: var(--card); color: var(--muted); border: 1px solid var(--border); }
.flash-success { background: var(--success-bg); color: var(--success-text); }

.bypass { margin-top: 2rem; }

.class-list, .student-list, .contact-list, .video-list, .email-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.class-list li, .student-list li, .contact-list li, .video-list li, .email-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.class-list a, .student-list a, .video-list a, .email-list a {
  display: block;
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--text);
}
.class-list a:hover, .student-list a:hover, .video-list a:hover, .email-list a:hover { background: var(--bg); }
.contact-list li { padding: 0.85rem 1rem; }

.class-name, .student-name, .contact-name { font-weight: 500; }

.priority {
  font-weight: normal;
  color: var(--muted);
  font-size: 0.85rem;
  margin-left: 0.4rem;
}

.contact-email, .contact-mobile { font-size: 0.9rem; margin-top: 0.2rem; }
.contact-email a { color: var(--accent); text-decoration: none; }
.contact-email a:hover { text-decoration: underline; }

.contact-restricted { background: var(--warn-bg); }
.warning {
  color: var(--warn);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 0.4rem;
}

.empty {
  padding: 1rem;
  color: var(--muted);
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.back {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.back:hover { color: var(--accent); }

.crumbs {
  font-size: 0.825rem;
  color: var(--muted);
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--border); user-select: none; }
.crumbs .current { color: var(--text); }

.student-card { padding-top: 0.25rem; }

/* ---------------- Recorder (segment 2 patterns ported) ---------------- */

.student-banner {
  background: var(--banner-bg);
  border-left: 6px solid var(--banner-bar);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.student-banner .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.student-banner .name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.stage {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.video-wrap {
  position: relative;
  background: #0b0d10;
  aspect-ratio: 16 / 9;
  width: 100%;
}
.video-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  background: #0b0d10;
}
.video-wrap.is-preview video { transform: scaleX(-1); }

.rec-badge, .rec-timer {
  position: absolute;
  top: 12px;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}
.rec-badge { left: 12px; }
.rec-timer { right: 12px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.rec-badge .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--record);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.8); }
}
body[data-state="recording"] .rec-badge,
body[data-state="recording"] .rec-timer { display: inline-flex; }

.controls {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.hint { color: var(--muted); font-size: 14px; }

.button {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: #eef0f3;
  color: var(--text);
  transition: background 80ms ease, transform 80ms ease;
}
.button:hover:not(:disabled) { background: #e3e6ea; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--accent-dark); }
.button.danger  { background: var(--record); color: #fff; }
.button.danger:hover:not(:disabled)  { background: var(--record-dark); }
.button.large   { padding: 14px 22px; font-size: 17px; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}
.meta strong { color: var(--text); font-weight: 600; }

.state { display: none; }
body[data-state="ready"]     .state-ready,
body[data-state="recording"] .state-recording,
body[data-state="review"]    .state-review,
body[data-state="uploading"] .state-uploading,
body[data-state="error"]     .state-error    { display: flex; flex-direction: column; gap: 12px; }

body[data-state="error"] .stage { display: none; }

.error {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px;
  border-left: 6px solid var(--record);
}
.error h2 { margin: 0 0 8px; font-size: 18px; }
.error p { margin: 0 0 8px; color: var(--muted); }
.error code {
  background: #f1f3f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.95em;
}

.camera-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.camera-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 96px;
  min-height: 96px;
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: border-color 80ms ease, background 80ms ease, color 80ms ease;
}
.camera-pick:hover {
  border-color: var(--accent, #2563eb);
  color: var(--text);
}
.camera-pick.is-active {
  border-color: var(--accent, #2563eb);
  background: color-mix(in srgb, var(--accent, #2563eb) 8%, var(--bg));
  color: var(--text);
}
.camera-pick-icon {
  display: block;
  width: 40px;
  height: 40px;
}
.camera-pick-icon svg {
  width: 100%;
  height: 100%;
}
.camera-pick-label {
  display: block;
  text-align: center;
  line-height: 1.2;
  /* Truncate device labels that come back as full USB-string descriptors. */
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-fallback {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}
.upload-fallback summary { cursor: pointer; }
.upload-fallback input[type="file"] { margin-top: 8px; }
.upload-progress {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}
.upload-progress > div {
  height: 100%;
  background: var(--accent);
  width: 0;
  transition: width 200ms ease;
}

/* ---------------- Review / Send ---------------- */

.review-list .recipient {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
}
.review-list .excluded {
  background: var(--warn-bg);
}

.review-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.video-preview {
  width: 100%;
  max-width: 720px;
  border-radius: 8px;
  background: #0b0d10;
  margin: 0.5rem 0 1rem;
}

/* ---------------- Status badges (dashboards, video lists) ---------------- */
.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-DRAFT       { background: #e2e8f0; color: #334155; }
.status-SENT        { background: #dbeafe; color: #1d4ed8; }
.status-VIEWED      { background: var(--success-bg); color: var(--success-text); }
.status-REMINDED_1,
.status-REMINDED_2  { background: var(--warn-bg); color: var(--warn); }
.status-SENT_TO_STUDENT { background: #fde68a; color: #854d0e; }
.status-EXPIRED     { background: #f1f5f9; color: var(--muted); }

/* ---------------- Dashboard ---------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 1rem 0;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.9rem 1rem;
}
.stat .num { font-size: 1.4rem; font-weight: 700; }
.stat .lbl { font-size: 0.8rem; color: var(--muted); }

.video-list .row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

table.report {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.9rem;
}
table.report th, table.report td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
table.report th { background: var(--bg); font-weight: 600; }
table.report tr:last-child td { border-bottom: 0; }

/* Expandable per-year class breakdown */
.year-classes summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
  list-style: none;
}
.year-classes summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 120ms ease;
}
.year-classes[open] summary::before { transform: rotate(90deg); }
table.report.nested {
  margin: 0.5rem 0 0;
  background: var(--bg);
  font-size: 0.825rem;
}
table.report.nested th { background: transparent; }

table.snapshot .col-pick   { width: 2.4rem; text-align: center; }
table.snapshot .col-state  { width: 5.2rem; text-align: center; white-space: nowrap; }
table.snapshot .col-date   { width: 6rem; color: var(--muted); font-variant-numeric: tabular-nums; }
table.snapshot .col-action { width: 9rem; }
table.snapshot .tick { color: var(--success-bar); font-weight: 700; }
table.snapshot .x    { color: var(--muted); }
table.snapshot a    { color: var(--text); text-decoration: none; }
table.snapshot a:hover { color: var(--accent); text-decoration: underline; }

.btn-small,
.btn-record-small {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.825rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-record-small {
  background: var(--record);
  color: white;
  border-color: var(--record);
}
.btn-record-small:hover { background: var(--record-dark); border-color: var(--record-dark); }

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.75rem 0;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  table.snapshot .col-state, table.snapshot .col-date { width: auto; }
  table.snapshot .col-pick { width: 2rem; }
}

/* ---------------- Watch page (parent-facing) ---------------- */
body.watch {
  background: var(--bg);
}
.watch-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}
.watch-header {
  text-align: center;
  margin: 1.5rem 0 2rem;
}
.watch-logo {
  max-height: 110px;
  width: auto;
  margin: 0 auto 1rem;
  display: block;
}
.watch-header .school { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.watch-header .from { color: var(--muted); margin-top: 0.25rem; }
.watch-video {
  width: 100%;
  border-radius: 12px;
  background: #0b0d10;
  box-shadow: var(--shadow);
}
.watch-meta {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 1rem 0;
}
.watch-expired {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  margin-top: 2rem;
  box-shadow: var(--shadow);
}
.watch-expired h1 { margin-bottom: 0.5rem; }

.lang-picker {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
}
.lang-picker a, .lang-picker-current {
  padding: 3px 10px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
}
.lang-picker a:hover { color: var(--text); }
.lang-picker-current {
  color: var(--text);
  border-color: var(--border);
  background: var(--card);
  font-weight: 600;
}

/* ---- Watch-page reply section (parent → teacher, v1-light) ---- */
.reply-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.reply-confirm {
  background: color-mix(in srgb, var(--accent, #2563eb) 10%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent, #2563eb) 30%, var(--border));
  color: var(--text);
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}
.reply-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.reply-thanks-form, .reply-question {
  flex: 1 1 220px;
}
.reply-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 80ms ease, background 80ms ease;
}
.reply-btn:hover {
  border-color: var(--accent, #2563eb);
}
.reply-btn-icon { display: inline-flex; width: 22px; height: 22px; }
.reply-btn-icon svg { width: 100%; height: 100%; }
/* Native <details>/<summary>: hide the disclosure triangle, restyle as button */
.reply-question summary { list-style: none; }
.reply-question summary::-webkit-details-marker { display: none; }
.reply-question[open] summary { border-color: var(--accent, #2563eb); }
.reply-question-form {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.reply-question-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  resize: vertical;
  min-height: 100px;
  box-sizing: border-box;
}
.reply-question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.reply-charcount {
  font-size: 0.85rem;
  color: var(--muted);
}
.reply-submit {
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent, #2563eb);
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.reply-transparency {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

@media (max-width: 540px) {
  .app-header { padding: 0.6rem 1rem; }
  main { padding: 1rem 1rem 4rem; }
  .card { padding: 1.25rem; margin: 1.5rem auto; }
  .user { font-size: 0.85rem; }
  .student-banner .name { font-size: 18px; }
  .button { padding: 11px 14px; font-size: 15px; }
}

/* ---- Reply inbox (teacher-facing) ---- */
.reply-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.reply-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}
.reply-card.is-unread {
  border-left: 4px solid var(--accent, #2563eb);
  background: color-mix(in srgb, var(--accent, #2563eb) 4%, var(--card));
}
.reply-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 1rem;
}
.reply-kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.reply-kind svg { width: 14px; height: 14px; }
.reply-kind-thanks {
  color: #b91c1c;
  background: #fee2e2;
}
.reply-kind-question {
  color: #1e40af;
  background: #dbeafe;
}
.reply-when {
  font-size: 0.82rem;
  color: var(--muted);
}
.reply-context {
  margin-bottom: 0.5rem;
}
.reply-body {
  margin: 0.6rem 0 0.75rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border);
  background: var(--bg);
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.95rem;
}
.reply-watch-link {
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
}
.reply-watch-link:hover { text-decoration: underline; }

/* ---- Subtitle language picker on the review page ---- */
.subtitle-picker {
  margin-top: 1.5rem;
  padding: 1.1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.subtitle-picker h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.subtitle-detected {
  font-size: 0.9rem;
  margin: 0.25rem 0 0.75rem;
}
.subtitle-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0.5rem 0;
}
.subtitle-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  cursor: pointer;
}
.subtitle-controls select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  font: inherit;
  font-size: 0.92rem;
  min-width: 160px;
}
.subtitle-controls select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.subtitle-note {
  font-size: 0.82rem;
  margin: 0.4rem 0 0;
  font-style: italic;
}
.review-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ---- Home/first language pill on student detail ---- */
.student-language {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 3px 10px;
  background: color-mix(in srgb, var(--accent, #2563eb) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent, #2563eb) 25%, var(--border));
  border-radius: 999px;
  color: var(--text);
  font-size: 0.85rem;
}

/* ---- Prior video list on student detail page ---- */
.prior-video-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prior-video {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}
.prior-video-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.prior-video-actions a { color: var(--accent); text-decoration: none; font-size: 0.85rem; }
.prior-video-actions a:hover { text-decoration: underline; }
.prior-video-discard { margin: 0; }
.btn-link-danger {
  background: none;
  border: none;
  color: var(--error-text);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 0;
}
.btn-link-danger:hover { text-decoration: underline; }
