:root {
  /* Viji's Academy: navy and red from the logo, on white */
  --wood: #121d6c;        /* navy: headings, primary buttons */
  --wood-dark: #0c1450;
  --amber: #c80000;       /* logo red: accents, highlights */
  --amber-light: #121d6c;
  --page-bg: #f3f5fb;
  --cream: #ffffff;       /* cards */
  --text: #1b1f33;
  --muted: #5b6275;
  --success: #2f7a45;
  --pending: #a8650a;
  --danger: #b42318;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.55;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.topbar {
  background: linear-gradient(135deg, #0c0710, var(--wood-dark) 40%, var(--wood));
  color: var(--cream);
  padding: 34px 20px;
  text-align: center;
  margin-bottom: 30px;
  border-bottom: 3px solid var(--amber);
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  letter-spacing: 0.5px;
  color: var(--amber-light);
  text-shadow: 0 0 18px rgba(224, 166, 62, 0.35);
}

.topbar p {
  margin: 0;
  color: var(--cream);
  font-size: 0.95rem;
  opacity: 0.85;
}

.card {
  background: var(--cream);
  border: 1px solid #dfe3ef;
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.poster-wrap {
  position: relative;
  overflow: hidden;
  max-height: 230px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: max-height 0.4s ease;
}

.poster-wrap.expanded {
  max-height: 2000px;
}

.poster-image {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  margin: 0 auto;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

.poster-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, rgba(250, 243, 232, 0), var(--cream));
  pointer-events: none;
}

.poster-wrap.expanded .poster-fade {
  display: none;
}

.poster-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.btn-small {
  padding: 9px 18px;
  font-size: 0.85rem;
  margin-top: 0;
}

.poster-thumb {
  max-width: 220px;
  border-radius: 8px;
  border: 1px solid #dfe3ef;
  display: block;
  margin-top: 8px;
}

.fee-strike {
  text-decoration: line-through;
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 400;
  margin-left: 6px;
}

.early-bird-banner {
  background: linear-gradient(135deg, #eef1fb, #fff1dc);
  border: 1px solid var(--amber);
  color: #7a5518;
  padding: 12px 14px;
  border-radius: 8px;
  margin: 14px 0 0;
  font-size: 0.9rem;
  font-weight: 500;
}

.workshop-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  margin: 16px 0;
  padding: 16px;
  background: #f1f3fa;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.workshop-meta div span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

h2 { color: var(--wood); margin-top: 0; }

label {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
  font-size: 0.92rem;
}

input[type=text], input[type=email], input[type=tel], input[type=number] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c9cfe0;
  border-radius: 8px;
  font-size: 1rem;
  background: #ffffff;
}

input:focus { outline: 2px solid var(--amber); border-color: var(--amber); }

.mode-toggle {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.mode-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px solid #c9cfe0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  margin: 0;
  background: #ffffff;
  transition: border-color 0.15s, background 0.15s;
}

.mode-option input[type=radio] {
  width: auto;
  accent-color: var(--amber);
}

.mode-option:has(input:checked) {
  border-color: var(--amber);
  background: #eef1fb;
}

.rating-toggle {
  display: flex;
  gap: 8px;
  margin: 6px 0 4px;
}

.rating-option {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 12px 4px;
  border: 1px solid #c9cfe0;
  border-radius: 8px;
  cursor: pointer;
  margin: 0;
  background: #ffffff;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.rating-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.rating-option .rating-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--wood);
  line-height: 1;
}

.rating-option .rating-label {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.2;
}

.rating-option:has(input:checked) {
  border-color: var(--amber);
  background: #eef1fb;
}

.rating-option:has(input:checked) .rating-num {
  color: var(--amber);
}

.recommend-toggle {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.recommend-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid #c9cfe0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  margin: 0;
  background: #ffffff;
  font-size: 0.9rem;
}

.recommend-option input {
  width: auto;
  accent-color: var(--amber);
}

.recommend-option:has(input:checked) {
  border-color: var(--amber);
  background: #eef1fb;
}

textarea.text-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c9cfe0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #ffffff;
  resize: vertical;
}

.rating-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 10px 0 16px;
}

.rating-summary .big-number {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--wood);
}

.feedback-entry {
  border-bottom: 1px solid #dfe3ef;
  padding: 14px 0;
}

.feedback-entry:last-child {
  border-bottom: none;
}

.feedback-stars {
  color: var(--amber);
  letter-spacing: 2px;
}

.btn {
  display: inline-block;
  background: var(--amber);
  color: #fff;
  border: none;
  padding: 13px 26px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 18px;
  text-decoration: none;
  transition: background 0.15s;
}

.btn:hover { background: #0c1450; }

.btn-secondary {
  background: transparent;
  color: var(--wood);
  border: 1px solid var(--wood);
}

.btn-secondary:hover { background: #e8ebf6; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8a2f2f; }

.error-box {
  background: #fbe4e4;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.info-box {
  background: #eef1fb;
  border: 1px solid var(--amber);
  color: #7a5518;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.qr-wrap {
  text-align: center;
  padding: 20px;
  background: #f1f3fa;
  border-radius: var(--radius);
  margin: 16px 0;
}

.qr-wrap img {
  max-width: 220px;
  border-radius: 8px;
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.upi-id {
  font-family: monospace;
  font-size: 1.1rem;
  background: #fff;
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  margin-top: 10px;
  border: 1px dashed var(--amber);
}

.fee-amount {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--wood);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-pending { background: #fff1dc; color: var(--pending); }
.badge-confirmed { background: #e2f2e5; color: var(--success); }
.badge-rejected { background: #fbe4e4; color: var(--danger); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid #dfe3ef;
}

th { background: #f1f3fa; color: var(--wood); }

tr:hover { background: #f7f8fc; }

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-topbar a { color: var(--amber-light); text-decoration: none; font-size: 0.9rem; }

.admin-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filters select, .filters input {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #c9cfe0;
}

.action-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  color: #fff;
  margin-right: 4px;
}

.confirm-btn { background: var(--success); }
.reject-btn { background: var(--danger); }

.center { text-align: center; }
.muted { color: var(--muted); font-size: 0.88rem; }

footer {
  text-align: center;
  color: var(--amber-light);
  opacity: 0.7;
  font-size: 0.85rem;
  margin-top: 30px;
}

footer a { color: var(--amber-light); }

/* =========================================================
   Student area additions (same palette as the rest of the site)
   ========================================================= */

:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.wide {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.topbar { padding-top: 18px; }

.navrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  max-width: 1000px;
  margin: 0 auto 22px;
  font-size: 0.9rem;
  text-align: left;
}

.navrow .brand { color: var(--amber-light); font-weight: 600; text-decoration: none; }

.navlinks { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }

.navlinks a, .linkbtn {
  color: var(--cream);
  opacity: 0.85;
  text-decoration: none;
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  cursor: pointer;
}

.navlinks a:hover, .linkbtn:hover { opacity: 1; color: var(--amber-light); }
.navlinks a[aria-current="page"] { color: var(--amber-light); opacity: 1; border-bottom: 2px solid var(--amber); }

form.inline { display: inline; margin: 0; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.success-box {
  background: #e2f2e5;
  border: 1px solid var(--success);
  color: var(--success);
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

input[type=password], select.field {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c9cfe0;
  border-radius: 8px;
  font-size: 1rem;
  background: #ffffff;
}

.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }

.form-foot { margin-top: 18px; color: var(--muted); font-size: 0.9rem; }
.form-foot a { color: var(--wood); font-weight: 600; }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Home tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 18px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--cream);
  border: 1px solid #dfe3ef;
  border-radius: var(--radius);
  padding: 22px;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  border-top: 4px solid var(--amber);
  transition: transform 0.15s, border-color 0.15s;
}

.tile:hover { transform: translateY(-2px); border-color: var(--amber); }
.tile .icon { font-size: 1.8rem; line-height: 1; }
.tile h2 { margin: 0; font-size: 1.2rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.tile .count { margin-top: auto; padding-top: 6px; font-size: 0.85rem; color: var(--pending); font-weight: 600; }

.welcome { color: var(--cream); opacity: 0.9; margin: 0 0 18px; }

/* Exercise list */
.ex-list { list-style: none; margin: 0; padding: 0; }

.ex-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #dfe3ef;
  text-decoration: none;
  color: var(--text);
}

.ex-list li:last-child .ex-item { border-bottom: none; }
.ex-item:hover .ex-title { color: var(--wood); text-decoration: underline; }
.ex-title { font-weight: 600; }
.ex-sub { color: var(--muted); font-size: 0.85rem; }

.empty-state { text-align: center; padding: 20px 0 6px; color: var(--muted); }

/* Conversation on an exercise */
.thread { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }

.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #dfe3ef;
}

.bubble.student { align-self: flex-start; border-top-left-radius: 3px; }
.bubble.teacher { align-self: flex-end; background: #eef1fb; border-color: var(--amber); border-top-right-radius: 3px; }
.bubble .who { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.bubble .who b { color: var(--wood); }
.bubble p { margin: 0 0 6px; white-space: pre-wrap; }
.bubble audio { width: 100%; max-width: 360px; height: 40px; display: block; margin-top: 4px; }

.desc { white-space: pre-wrap; margin: 0; }

/* WhatsApp-style recorder */
.recorder {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #c9cfe0;
  border-radius: 999px;
  min-height: 64px;
  margin-top: 6px;
}

.rec-btn {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: var(--wood);
  font-size: 1.1rem;
}

.rec-btn:hover { background: #1d2b94; }
.rec-btn.stop { background: var(--danger); }
.rec-btn.play { background: var(--amber); }
.rec-btn.ghost { background: transparent; color: var(--muted); border: 1px solid #c9cfe0; width: 40px; height: 40px; }
.rec-btn.ghost:hover { color: var(--danger); border-color: var(--danger); background: #fbe4e4; }
.rec-btn svg { width: 20px; height: 20px; fill: currentColor; }

.rec-mid { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.rec-hint { color: var(--muted); font-size: 0.92rem; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: recpulse 1s infinite; flex: 0 0 auto; }
@keyframes recpulse { 50% { opacity: 0.25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); min-width: 42px; }
.rec-wave { flex: 1; height: 34px; min-width: 0; display: block; }
.rec-progress { flex: 1; height: 6px; border-radius: 3px; background: #dfe3ef; overflow: hidden; cursor: pointer; }
.rec-progress i { display: block; height: 100%; width: 0; background: var(--amber); }

.upload-status { margin-top: 10px; font-size: 0.9rem; color: var(--muted); }

/* Tables that scroll on phones */
.table-wrap { overflow-x: auto; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions form { margin: 0; }
.action-btn.neutral { background: var(--wood); }
.action-btn.amber { background: var(--amber); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat {
  flex: 1 1 150px;
  background: var(--cream);
  border-radius: var(--radius);
  padding: 14px 16px;
  border-left: 4px solid var(--amber);
}
.stat b { display: block; font-size: 1.6rem; color: var(--wood); line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.temp-pass { font-family: monospace; font-size: 1.1rem; background: #fff; padding: 4px 10px; border: 1px dashed var(--amber); border-radius: 6px; }

@media (max-width: 560px) {
  .card { padding: 18px; }
  .workshop-meta { grid-template-columns: 1fr; }
  .bubble { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
.bubble .recorder { min-width: min(320px, 100%); border-radius: 999px; min-height: 56px; }
.btn.btn-small { padding: 9px 18px; font-size: 0.85rem; margin-top: 0; }
footer { padding: 0 20px 24px; }

/* Batches and homework */
.badge-batch { background: #e6e9f7; color: var(--wood); text-transform: none; letter-spacing: 0; }
.badge-hw { background: #fff1d1; color: #7a5518; }
.badge-overdue { background: #fbe4e4; color: var(--danger); }
.badges { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid rgba(244, 197, 101, 0.45);
  color: var(--cream); text-decoration: none; font-size: 0.88rem;
}
.chip b { background: rgba(255, 255, 255, 0.14); border-radius: 999px; padding: 0 7px; font-size: 0.78rem; }
.chip:hover { border-color: var(--amber); }
.chip.on { background: var(--amber); border-color: var(--amber); color: #2b1c10; font-weight: 600; }
.chip.on b { background: rgba(0, 0, 0, 0.12); }
.card .chip { color: var(--wood); border-color: #c9cfe0; }
.card .chip.on { color: #2b1c10; }

.batch-picks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0; }
.batch-pick { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 0; font-size: 0.9rem; }
.batch-pick input { width: auto; accent-color: var(--amber); }

.hw-box { background: #eef1fb; border: 1px solid var(--amber); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.hw-box h3 { margin: 0 0 4px; color: var(--wood); font-size: 1rem; }
.hw-box p { margin: 0 0 8px; white-space: pre-wrap; }

.hw-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid #dfe3ef; }
.hw-list li:last-child .hw-item { border-bottom: none; }
.hw-meta { color: var(--muted); font-size: 0.85rem; }

select.field { font-size: 0.95rem; }
.tile .count.ok { color: var(--success); }
.progress-cell { white-space: nowrap; }
.badge { white-space: nowrap; }

/* Add to home screen card */
.install-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--cream); border: 1px solid var(--amber); border-left: 4px solid var(--amber);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.install-card[hidden] { display: none; }
.install-card img { width: 44px; height: 44px; border-radius: 10px; flex: 0 0 auto; }
.install-card .install-text { flex: 1; font-size: 0.92rem; line-height: 1.45; }
.install-card .btn { margin: 0; padding: 9px 18px; font-size: 0.9rem; white-space: nowrap; }
.install-close { background: none; border: none; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 4px 6px; }
.install-close:hover { color: var(--text); }
@media (max-width: 480px) { .install-card { flex-wrap: wrap; } .install-card .install-text { flex-basis: calc(100% - 100px); } }
.install-card [hidden] { display: none !important; }

/* Voice / video switch and video recorder */
.rec-wrap { margin-top: 6px; }
.rec-wrap > .rec-body.recorder { margin-top: 0; }
.rec-modes { display: inline-flex; gap: 0; margin-bottom: 8px; border: 1px solid #c9cfe0; border-radius: 999px; overflow: hidden; background: #ffffff; }
.rec-modes[hidden] { display: none; }
.rec-modes button {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; padding: 7px 16px; font: inherit; font-size: 0.88rem; font-weight: 600;
  color: var(--muted); cursor: pointer;
}
.rec-modes button svg { width: 16px; height: 16px; fill: currentColor; }
.rec-modes button[aria-pressed="true"] { background: var(--wood); color: #fff; }

.vrec { background: #0c0710; border-radius: var(--radius); overflow: hidden; border: 1px solid #2a1340; }
.vstage { position: relative; background: #000; display: flex; justify-content: center; }
.vstage video { display: block; width: 100%; max-height: 60vh; background: #000; aspect-ratio: 16 / 9; object-fit: contain; }
.vstage video.mirror { transform: scaleX(-1); }
.vbadge {
  position: absolute; top: 10px; left: 10px; display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, 0.6); color: #fff; border-radius: 999px; padding: 4px 10px; font-size: 0.85rem;
}
.vbadge[hidden] { display: none; }
.vbadge .rec-time { color: #fff; min-width: 0; }
.vbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; }
.vbar .rec-hint { color: var(--cream); opacity: 0.85; flex: 1; font-size: 0.9rem; }
.vbar .rec-btn.ghost { color: var(--cream); border-color: rgba(250, 243, 232, 0.35); }
.vbar .rec-btn.ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.08); border-color: #fff; }
.rec-btn.big { width: 58px; height: 58px; background: var(--danger); }
.rec-btn.big svg { width: 26px; height: 26px; }
.rec-btn.big.stop { background: var(--danger); }
.vspacer { width: 40px; }

/* Saved videos in the conversation and homework */
.vplay-saved { display: block; width: 100%; max-width: 480px; max-height: 60vh; border-radius: 10px; background: #000; margin-top: 6px; }
.bubble .vplay-saved { max-width: 100%; }
.media-gone { color: var(--muted); font-style: italic; font-size: 0.9rem; margin: 4px 0 0; }

/* Videos never wider than their box, portrait or landscape (v4.1) */
video { max-width: 100%; }
.vplay-saved { width: 100%; max-width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
@media (min-width: 700px) { .vplay-saved { max-width: 480px; } .bubble .vplay-saved { max-width: 100%; } }
.vstage video { aspect-ratio: auto; width: 100%; height: auto; min-height: 200px; max-height: 65vh; object-fit: contain; }
.bubble, .card, .hw-box { min-width: 0; overflow-wrap: anywhere; }
.thread { min-width: 0; }


/* =========================================================
   Viji's Academy theme (light): header, nav, buttons, footer
   ========================================================= */
.topbar {
  background: #fff;
  color: var(--text);
  border-bottom: 3px solid var(--amber);
  box-shadow: 0 2px 12px rgba(18, 29, 108, 0.08);
  padding: 14px 20px 26px;
}
.topbar h1 { color: var(--wood); text-shadow: none; font-size: 1.55rem; }
.topbar p { color: var(--muted); opacity: 1; }
.navrow { margin-bottom: 16px; }
.navrow .brand { display: inline-flex; align-items: center; }
.navrow .brand img { display: block; height: 64px; width: auto; }
.navlinks a, .linkbtn { color: var(--wood); opacity: 1; font-weight: 500; }
.navlinks a:hover, .linkbtn:hover { color: var(--amber); }
.navlinks a[aria-current="page"] { color: var(--amber); border-bottom-color: var(--amber); }
@media (max-width: 560px) { .navrow .brand img { height: 44px; } }

.btn { background: var(--wood); }
.btn:hover { background: var(--wood-dark); }
.btn-secondary { background: transparent; color: var(--wood); border: 1px solid var(--wood); }
.btn-secondary:hover { background: #e8ebf6; }
.btn-danger { background: var(--danger); }

.card, .tile, .stat { box-shadow: 0 2px 14px rgba(18, 29, 108, 0.08); }
.tile { border-top-color: var(--amber); }
.tile:hover { border-color: var(--wood); border-top-color: var(--amber); }
.welcome { color: var(--text); }
.welcome a { color: var(--amber); font-weight: 600; }

.chip { border-color: #c9cfe0; color: var(--wood); background: #fff; }
.chip b { background: #eef1fb; }
.chip:hover { border-color: var(--wood); }
.chip.on { background: var(--wood); border-color: var(--wood); color: #fff; }
.chip.on b { background: rgba(255, 255, 255, 0.2); }
.card .chip.on { color: #fff; }

.info-box { background: #fff4e5; border-color: #e3a64a; color: #7a4a00; }
.badge-hw { background: #fde8e8; color: var(--amber); }
.bubble.teacher { border-color: #b8c0e6; }
.install-card { border-color: #c9cfe0; border-left-color: var(--amber); }

footer { color: var(--muted); opacity: 1; }
footer a { color: var(--wood); }
footer b { color: var(--wood); }

/* "Classroom" tag beside the logo */
.navrow .brand { gap: 12px; text-decoration: none; }
.brand-tag {
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  background: var(--amber); color: #fff;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  line-height: 1.4; white-space: nowrap;
}
@media (max-width: 560px) { .navrow .brand { gap: 8px; } .brand-tag { font-size: 0.7rem; padding: 3px 9px; } }


/* =========================================================
   v5 "Bright" theme: friendly for kids and adults alike.
   Brand navy and red stay; four happy colours for sections.
   ========================================================= */
:root {
  --coral: #ff5f57;  --sun: #ffb020;  --teal: #10b3a3;  --violet: #7b5cff;  --sky: #3b8bff;
  --page-bg: #f7f4ff;
  --radius: 18px;
}
body {
  font-family: 'Nunito', 'Segoe UI', Roboto, Arial, sans-serif;
  background-color: var(--page-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg fill='%23121d6c' fill-opacity='0.035'%3E%3Cpath d='M40 30v38a9 7 0 1 1-4-6V30z'/%3E%3Cpath d='M150 100h24v-6h-24zM150 94v34a9 7 0 1 1-4-6V94zM174 94v30a9 7 0 1 1-4-6V94z'/%3E%3Cpath d='M70 160v34a9 7 0 1 1-4-6v-28c10 2 14 8 16 14-4-4-8-6-12-6z'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(180deg, #f7f4ff 0%, #eef5ff 100%);
  background-attachment: scroll, fixed;
}
h1, h2, h3, .tile h2, .btn, .stat b { font-family: 'Nunito', 'Segoe UI', Arial, sans-serif; }
h2 { font-weight: 800; }

/* Header: colourful band with floating notes and a wavy bottom edge */
.topbar {
  position: relative;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='180'%3E%3Cg fill='%23ffffff' fill-opacity='0.13'%3E%3Cpath d='M30 40v40a10 8 0 1 1-4-6V40z'/%3E%3Cpath d='M180 30h28v-7h-28zM180 23v40a10 8 0 1 1-4-6V23zM208 23v36a10 8 0 1 1-4-6V23z'/%3E%3Cpath d='M110 110v34a9 7 0 1 1-4-6v-28c10 2 14 8 16 14-4-4-8-6-12-6z'/%3E%3Ccircle cx='235' cy='140' r='5'/%3E%3Ccircle cx='70' cy='150' r='3'/%3E%3C/g%3E%3C/svg%3E"), linear-gradient(120deg, #121d6c 0%, #3b2fb0 45%, #7b5cff 75%, #ff5f57 120%);
  border-bottom: none; box-shadow: none;
  padding: 14px 16px 54px; margin-bottom: 26px;
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 34px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 40' preserveAspectRatio='none'%3E%3Cpath d='M0 22 C150 2 300 2 450 20 S750 40 900 20 S1100 4 1200 16 V40 H0z' fill='%23f7f4ff'/%3E%3C/svg%3E") center bottom / 100% 100% no-repeat;
}
.navrow {
  background: #fff; border-radius: 22px; padding: 8px 18px;
  box-shadow: 0 8px 24px rgba(10, 10, 60, 0.18); margin-bottom: 26px;
}
.navrow .brand img { height: 54px; }
.topbar h1 { color: #fff; font-weight: 900; font-size: clamp(1.6rem, 4.5vw, 2.2rem); letter-spacing: 0.2px; text-shadow: 0 2px 10px rgba(0,0,0,.18); }
.topbar p { color: rgba(255,255,255,.92); font-size: 1.02rem; font-weight: 600; }
@media (max-width: 560px) { .navrow { border-radius: 18px; padding: 8px 12px; } .navrow .brand img { height: 42px; } }

/* Cards and buttons: rounder and softer */
.card { border-radius: var(--radius); border: none; box-shadow: 0 6px 22px rgba(43, 42, 158, 0.08); }
.btn { border-radius: 999px; padding: 12px 26px; font-weight: 800;
        background: linear-gradient(135deg, #121d6c, #3b2fb0); box-shadow: 0 6px 16px rgba(43,42,158,.25);
        transition: transform .15s, box-shadow .15s; }
.btn:hover { background: linear-gradient(135deg, #0c1450, #2e2590); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(43,42,158,.32); }
.btn-secondary { background: #fff; box-shadow: none; border: 2px solid #121d6c; }
.btn-secondary:hover { background: #eef1fb; box-shadow: none; }
.btn-danger { background: var(--coral); box-shadow: none; }
.btn.btn-small { padding: 8px 18px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], select.field, textarea.text-input {
  border-radius: 14px; border: 2px solid #e2e4f3;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(123,92,255,.15); }

/* Home tiles: each one its own colour */
.tiles { gap: 20px; }
.tile {
  --tc: var(--violet); --tbg: #f1edff;
  position: relative; overflow: hidden; border: none; border-radius: 22px; padding: 24px 22px 22px;
  box-shadow: 0 8px 26px rgba(43, 42, 158, 0.10);
}
.tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--tc); }
.tile::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--tbg); z-index: 0; }
.tile > * { position: relative; z-index: 1; }
.tiles .tile:nth-child(4n+1) { --tc: var(--coral);  --tbg: #fff0ef; }
.tiles .tile:nth-child(4n+2) { --tc: var(--teal);   --tbg: #e6faf7; }
.tiles .tile:nth-child(4n+3) { --tc: var(--violet); --tbg: #f1edff; }
.tiles .tile:nth-child(4n+4) { --tc: var(--sun);    --tbg: #fff6e0; }
.tile .icon {
  width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; font-size: 1.9rem;
  background: var(--tbg); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--tc) 25%, transparent);
}
.tile h2 { font-size: 1.25rem; font-weight: 900; }
.tile p { font-size: 0.95rem; }
.tile:hover { transform: translateY(-4px) rotate(-0.3deg); box-shadow: 0 14px 32px rgba(43, 42, 158, 0.16); border: none; }
.tile .count { display: inline-block; align-self: flex-start; background: var(--tbg); color: var(--tc); filter: saturate(1.2) brightness(.85);
               padding: 4px 12px; border-radius: 999px; font-weight: 800; }
.tile .count.ok { background: #e3f7ea; color: var(--success); filter: none; }

/* Teacher stats in four colours */
.stat { border-left: none; border-radius: 18px; position: relative; overflow: hidden; padding: 16px 18px;
         box-shadow: 0 6px 20px rgba(43, 42, 158, 0.08); }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--sc, var(--violet)); }
.stat b { color: var(--sc, var(--violet)); font-weight: 900; font-size: 1.9rem; }
.stat-row .stat:nth-child(4n+1) { --sc: var(--coral); }
.stat-row .stat:nth-child(4n+2) { --sc: var(--teal); }
.stat-row .stat:nth-child(4n+3) { --sc: var(--violet); }
.stat-row .stat:nth-child(4n+4) { --sc: #e08a00; }

/* Chips, badges, lists */
.chip { border: 2px solid #e2e4f3; font-weight: 700; }
.chip.on { background: linear-gradient(135deg, #121d6c, #7b5cff); border-color: transparent; }
.badge { border-radius: 999px; font-weight: 800; }
.badge-batch { background: #efeaff; color: #4b33c9; }
.badge-hw { background: #fff0ef; color: #d63b33; }
.ex-item { border-bottom-color: #eceefa; }
.ex-title { font-weight: 800; }

/* Conversation bubbles */
.bubble { border-radius: 18px; border: none; background: #f4f5fd; }
.bubble.student { border-top-left-radius: 6px; }
.bubble.teacher { background: #fff4e6; border-top-right-radius: 6px; }
.hw-box { border-radius: 16px; border: 2px dashed #ffb020; background: #fffaf0; }

/* Recorder: brighter buttons */
.recorder { border: 2px solid #e2e4f3; }
.rec-btn { background: linear-gradient(135deg, #3b2fb0, #7b5cff); }
.rec-btn.play { background: linear-gradient(135deg, #ff8a3d, #ff5f57); }
.rec-btn.stop, .rec-btn.big { background: var(--coral); }
.rec-btn.ghost { background: transparent; }
.rec-progress i { background: linear-gradient(90deg, #ff8a3d, #ff5f57); }
.rec-modes { border: 2px solid #e2e4f3; }
.rec-modes button[aria-pressed="true"] { background: linear-gradient(135deg, #121d6c, #7b5cff); }

.install-card { border: none; border-left: 6px solid var(--teal); border-radius: 18px; }
.welcome a { color: var(--violet); }
footer { padding-top: 10px; }

@media (prefers-reduced-motion: reduce) { .tile:hover, .btn:hover { transform: none; } }
/* v5 fixes: colour strip above the corner circle; readable count pills */
.tile::before { z-index: 2; }
.tiles .tile:nth-child(4n+1) { --tt: #c0352d; }
.tiles .tile:nth-child(4n+2) { --tt: #0b7f74; }
.tiles .tile:nth-child(4n+3) { --tt: #5a3fd6; }
.tiles .tile:nth-child(4n+4) { --tt: #a86400; }
.tile .count { filter: none; color: var(--tt, var(--wood)); }

/* =========================================================
   Community chat and teacher notes (v6)
   ========================================================= */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
             background: var(--coral); color: #fff; font-size: 0.72rem; font-weight: 900; vertical-align: 2px; }
.faded { opacity: 0.6; }

.ctabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; align-items: center; }
.ctabs a { background: #fff; border: 2px solid #e2e4f3; border-radius: 999px; padding: 8px 16px; font-weight: 800; color: var(--wood); text-decoration: none; }
.ctabs a b { background: #efeaff; color: #4b33c9; border-radius: 999px; padding: 0 7px; font-size: 0.8rem; }
.ctabs a[aria-current="page"] { background: linear-gradient(135deg, #121d6c, #7b5cff); color: #fff; border-color: transparent; }
.ctabs a[aria-current="page"] b { background: rgba(255,255,255,.22); color: #fff; }
.ctabs .ctab-back { margin-left: auto; border: none; background: none; font-weight: 700; color: var(--muted); }

.rules { background: #eef7ff; border-radius: 16px; padding: 10px 14px; margin-bottom: 12px; font-size: 0.92rem; color: #1d3b66; }
.rules.kids { background: #fff8e1; color: #6b4a00; border: 2px dashed var(--sun); }
.mod-bar { display: flex; flex-direction: column; gap: 8px; background: #fff; border-radius: 16px; padding: 10px 14px; margin-bottom: 12px; font-size: 0.9rem; }
.mod-bar form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0; }
.pinned-strip { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.pinned-strip a { background: #fff6e0; border-left: 5px solid var(--sun); border-radius: 12px; padding: 8px 12px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.92rem; }

.chat { padding: 16px; }
.chat .older { display: block; margin: 0 auto 12px; width: fit-content; }
.thread-chat { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 92%; scroll-margin: 90px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.avatar { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 0.85rem;
          color: #fff; background: hsl(var(--h) 70% 52%); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.msg-body { background: #f4f5fd; border-radius: 18px; border-top-left-radius: 6px; padding: 8px 12px 6px; min-width: 0; }
.msg.mine .msg-body { background: #e9f8f5; border-radius: 18px; border-top-right-radius: 6px; }
.msg.by-teacher .msg-body { background: #fff4e6; box-shadow: inset 0 0 0 2px #ffd59a; }
.msg.pinned .msg-body { box-shadow: inset 0 0 0 2px var(--sun); }
.msg.flash .msg-body { animation: flash 1.6s ease-out 1; }
@keyframes flash { 0%, 40% { box-shadow: inset 0 0 0 3px var(--violet); } }
.msg-head { font-size: 0.82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.msg-head b { color: var(--wood); font-size: 0.9rem; }
.msg-head time { margin-left: 2px; }
.badge-teacher { background: var(--wood); color: #fff; font-size: 0.65rem; padding: 1px 8px; }
.badge-pin { background: #fff1d1; color: #8a5a00; font-size: 0.65rem; padding: 1px 8px; text-transform: none; }
.msg-text { margin: 4px 0 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-deleted { margin: 4px 0; color: var(--muted); font-style: italic; }
.msg-quote { display: block; margin: 4px 0; padding: 4px 10px; border-left: 4px solid var(--violet); background: rgba(123,92,255,.08);
             border-radius: 8px; font-size: 0.85rem; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.msg-quote b { color: #4b33c9; }
.msg-photo img { display: block; max-width: min(280px, 100%); max-height: 320px; border-radius: 12px; margin: 6px 0 2px; object-fit: cover; }
.msg-body .recorder { margin: 6px 0 2px; min-height: 52px; min-width: min(260px, 60vw); }
.msg-actions { display: flex; gap: 10px; align-items: center; margin-top: 2px; }
.msg-link { background: none; border: none; padding: 4px 0; font: inherit; font-size: 0.82rem; font-weight: 800; color: #4b33c9; cursor: pointer; }
.msg-more { position: relative; }
.msg-more summary { list-style: none; cursor: pointer; color: var(--muted); font-weight: 900; padding: 2px 8px; border-radius: 8px; font-size: 0.85rem; }
.msg-more summary::-webkit-details-marker { display: none; }
.msg-more[open] summary { background: #e8e9f7; }
.msg-more .menu { position: absolute; z-index: 5; top: 100%; left: 0; min-width: 200px; background: #fff; border-radius: 14px; padding: 6px;
                  box-shadow: 0 10px 30px rgba(20,20,80,.2); }
.msg.mine .msg-more .menu { left: auto; right: 0; }
.menu .inline-form { margin: 0; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: none; padding: 10px 12px; border-radius: 10px; font: inherit; font-size: 0.9rem; cursor: pointer; color: var(--text); }
.menu-item:hover { background: #f1f2fb; }

.composer { padding: 14px; box-shadow: 0 -4px 26px rgba(43, 42, 158, 0.14); scroll-margin-bottom: 16px; }
.composer textarea { min-height: 52px; }
.composer .btn { margin-top: 10px; }
.replying { display: flex; justify-content: space-between; gap: 8px; align-items: center; background: rgba(123,92,255,.08); border-left: 4px solid var(--violet);
            border-radius: 10px; padding: 6px 10px; margin-bottom: 8px; font-size: 0.88rem; }
.replying[hidden], .photo-preview[hidden] { display: none; }
.replying span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.photo-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.composer-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.photo-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 0 14px; height: 52px; border-radius: 999px;
             border: 2px solid #e2e4f3; background: #fff; font-weight: 800; color: var(--wood); cursor: pointer; }
.photo-btn:focus-within { border-color: var(--violet); }
.composer-row .voice { flex: 1; min-width: 0; margin-top: 0; min-height: 52px; padding: 4px 8px; }
.composer-row .voice .rec-btn { width: 42px; height: 42px; }
.composer-row .voice .rec-hint { font-size: 0.85rem; }
@media (max-width: 480px) { .photo-btn span { display: none; } .photo-btn { padding: 0 14px; } .msg { max-width: 100%; } }

/* Notes */
.note-compose summary { cursor: pointer; list-style: none; }
.note-compose summary::-webkit-details-marker { display: none; }
.fmt-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.fmt-bar button { border: 2px solid #e2e4f3; background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--wood); cursor: pointer; }
.note { border-top: 6px solid var(--teal); }
.note.pinned { border-top-color: var(--sun); }
.note-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.note-head h2 { margin: 0; }
.note-body p { margin: 0 0 8px; }
.note-body ul { margin: 0 0 8px; padding-left: 22px; }
pre.notation, .notation-box {
  font-family: 'Noto Sans Mono', 'DejaVu Sans Mono', Menlo, Consolas, monospace; font-size: 1rem; line-height: 1.7;
  background: #fffaf0; border: 2px dashed var(--sun); border-radius: 12px; padding: 10px 14px; margin: 8px 0;
  white-space: pre; overflow-x: auto; color: #3a2a00;
}
.notation-box { white-space: pre-wrap; }
textarea.mono-ish { font-family: 'Noto Sans Mono', 'DejaVu Sans Mono', Menlo, Consolas, monospace; font-size: 0.95rem; }
.tile .count.note-count { background: #f1f2fb; color: var(--wood); }
.report-card { border-top: 6px solid var(--coral); }
code { background: #f1f2fb; border-radius: 6px; padding: 1px 6px; }
.no-compose [data-reply] { display: none; }

/* =========================================================
   Phones: tables become cards, one per row (v6.1)
   ========================================================= */
@media (max-width: 760px) {
  .table-wrap.cards-ready { overflow: visible; }
  .table-wrap.cards-ready table, .table-wrap.cards-ready tbody, .table-wrap.cards-ready tr, .table-wrap.cards-ready td { display: block; width: 100%; }
  .table-wrap.cards-ready tr.head-row { display: none; }
  .table-wrap.cards-ready tr {
    background: #fff; border: 2px solid #eceefa; border-radius: 16px; padding: 12px 14px; margin-bottom: 12px;
  }
  .table-wrap.cards-ready tr:hover { background: #fff; }
  .table-wrap.cards-ready td { border: none; padding: 5px 0; display: flex; gap: 10px; align-items: baseline; text-align: left; overflow-wrap: anywhere; }
  .table-wrap.cards-ready td::before {
    content: attr(data-label); flex: 0 0 92px; font-size: 0.78rem; font-weight: 800; color: var(--muted);
  }
  .table-wrap.cards-ready td.no-label::before, .table-wrap.cards-ready td:not([data-label])::before { display: none; }
  .table-wrap.cards-ready td:first-child { font-size: 1.05rem; padding-top: 0; }
  .table-wrap.cards-ready td:first-child::before { display: none; }
  .table-wrap.cards-ready td:first-child > *, .table-wrap.cards-ready td:first-child { display: block; }
  .table-wrap.cards-ready td.no-label { padding-top: 10px; margin-top: 6px; border-top: 1px dashed #e2e4f3; }
  .table-wrap.cards-ready .actions { width: 100%; }
  .table-wrap.cards-ready .action-btn { padding: 9px 14px; font-size: 0.88rem; border-radius: 999px; }
  .table-wrap.cards-ready .batch-picks { flex-direction: column; gap: 8px; }
  .table-wrap.cards-ready .batch-pick { font-size: 0.95rem; }
}

/* Filter + sort toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .filters { margin: 0; }
.toolbar form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 0 auto; }
.toolbar label { margin: 0; font-size: 0.85rem; font-weight: 800; color: var(--muted); }
.toolbar select { padding: 9px 12px; border-radius: 12px; border: 2px solid #e2e4f3; background: #fff; font: inherit; font-size: 0.9rem; max-width: 100%; }
@media (max-width: 560px) {
  .toolbar form { margin: 0; width: 100%; }
  .toolbar form > div { flex: 1 1 140px; display: flex; flex-direction: column; gap: 4px; }
  .toolbar select { width: 100%; }
  .filters { gap: 8px; }
  .filters .btn-small { padding: 8px 14px; font-size: 0.82rem; }
}
.badge-batch { white-space: normal; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.badges { max-width: 100%; }
.actions select, form select { max-width: 100%; }
.actions > label { flex: 0 0 auto; }
.action-btn.amber { background: var(--teal); }
@media (max-width: 760px) {
  .table-wrap.cards-ready td { display: block; position: relative; padding-left: 102px; min-height: 26px; }
  .table-wrap.cards-ready td::before { position: absolute; left: 0; top: 6px; width: 92px; }
  .table-wrap.cards-ready td:first-child, .table-wrap.cards-ready td.no-label, .table-wrap.cards-ready td:not([data-label]) { padding-left: 0; }
}
.ex-item > .btn, .ex-item > .badge, .ex-item > .progress-cell { flex: 0 0 auto; white-space: nowrap; }
.ex-item > span:first-child { min-width: 0; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); }
.msg-more .menu { width: max-content; min-width: 0; max-width: min(250px, calc(100vw - 110px)); }
.menu-item { white-space: normal; }
/* Phones: message options open as a sheet at the bottom of the screen */
@media (max-width: 560px) {
  .msg-more .menu, .msg.mine .msg-more .menu {
    position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; max-width: none; z-index: 50;
    padding: 10px; border-radius: 18px; box-shadow: 0 -6px 40px rgba(20, 20, 80, 0.35);
  }
  .menu-item { padding: 14px 14px; font-size: 1rem; }
}
@media (max-width: 560px) {
  .stat-row { gap: 10px; }
  .stat { flex: 1 1 calc(50% - 5px); min-width: 0; padding: 12px 14px; }
  .stat b { font-size: 1.6rem; }
}
@media (max-width: 760px) {
  .table-wrap.cards-ready td:has(.batch-picks) { padding-left: 0; }
  .table-wrap.cards-ready td:has(.batch-picks)::before { position: static; display: block; width: auto; margin-bottom: 6px; }
}
@media (max-width: 560px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; }
}
fieldset.batch-choose { border: 2px solid #e2e4f3; border-radius: 16px; padding: 10px 14px 6px; margin: 14px 0 4px; }
fieldset.batch-choose legend { font-weight: 800; padding: 0 6px; font-size: 0.92rem; }
fieldset.batch-choose legend .muted { font-weight: 600; }
.quick-picks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.82rem; font-weight: 700; color: var(--muted); margin: 4px 0 10px; }
.quick-picks .chip { padding: 5px 12px; font-size: 0.82rem; cursor: pointer; font-family: inherit; }
@media (max-width: 560px) { fieldset.batch-choose .batch-picks { flex-direction: column; gap: 8px; } }

/* Upload a video instead of recording */
.rec-upload { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 0 14px; height: 44px; border-radius: 999px;
              border: 2px solid #e2e4f3; background: #fff; font-weight: 800; font-size: 0.88rem; color: var(--wood); cursor: pointer; }
.rec-upload svg { width: 18px; height: 18px; fill: currentColor; }
.rec-upload:focus-within, .rec-upload:hover { border-color: var(--violet); }
.vrec .vbar .btn-small { margin: 0; white-space: nowrap; }
.convert-wrap { padding: 16px; }
.convert { display: flex; flex-direction: column; gap: 10px; color: var(--cream); }
.convert .rec-hint { color: var(--cream); opacity: 0.95; margin: 0; }
.convert-bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.15); overflow: hidden; }
.convert-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffb020, #ff5f57); transition: width .3s; }
.convert .btn-secondary { align-self: flex-start; background: transparent; color: var(--cream); border-color: rgba(255,255,255,.5); }
@media (max-width: 480px) {
  .recorder:has(.rec-upload) { flex-wrap: wrap; border-radius: 22px; }
  .recorder:has(.rec-upload) .rec-mid { flex: 1 1 calc(100% - 60px); }
  .recorder:has(.rec-upload) .rec-upload { margin-left: 58px; }
}
.details-card summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.details-card summary::-webkit-details-marker { display: none; }
.details-card[open] summary .btn { display: none; }
.details-card summary .muted { display: block; overflow-wrap: anywhere; }
.cant-play { flex: 1; font-size: 0.82rem; color: var(--muted); line-height: 1.3; }
.rec-btn:disabled { opacity: .45; cursor: default; }

/* v7.3: list rows never squeeze the title. The left side takes the space it needs;
   the status badge or button moves underneath on narrow screens. */
.ex-item { flex-wrap: wrap; row-gap: 8px; }
.ex-item > span:first-child { flex: 1 1 220px; min-width: 0; }
.ex-item > .badge, .ex-item > .btn, .ex-item > .progress-cell { flex: 0 0 auto; }
.ex-item .badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 2px 0; }
.ex-item .ex-title { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .ex-item { align-items: flex-start; }
  .ex-item > span:first-child { flex-basis: 100%; }
  .ex-item .badges { display: flex; margin-top: 4px; }
}
.badge { max-width: 100%; }
@media (max-width: 560px) { .ex-item .badges + br { display: none; } }

/* =========================================================
   v7.5 Class Notes
   ========================================================= */
.tiles .tile:nth-child(5) { --tc: var(--sky); --tbg: #e8f1ff; --tt: #1f5fc4; }
.code-chip { display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; font-weight: 700;
  background: #eef1fb; color: var(--wood); border-radius: 6px; padding: 1px 7px; letter-spacing: .03em; white-space: nowrap; }
.badge-new { background: var(--coral); color: #fff; }

.cn-search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.cn-search input[type=search] { flex: 1 1 200px; min-width: 0; margin: 0; }
.cn-search select { flex: 0 1 220px; width: auto; margin: 0; }
.cn-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.cn-toolbar .cn-search { margin: 0; flex: 1 1 320px; justify-content: flex-end; }

.cn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cn-item { display: flex; gap: 14px; align-items: center; background: #fff; border-radius: 18px; padding: 14px 16px;
  box-shadow: 0 6px 20px rgba(43, 42, 158, 0.08); color: var(--text); text-decoration: none; border-left: 6px solid var(--sky); }
.cn-item:hover { box-shadow: 0 10px 26px rgba(43, 42, 158, 0.14); transform: translateY(-1px); }
.cn-item.unseen { border-left-color: var(--coral); }
.cn-date { flex: 0 0 auto; width: 58px; text-align: center; background: #e8f1ff; color: #1f5fc4; border-radius: 14px; padding: 6px 0; font-weight: 800;
  font-size: .8rem; text-transform: uppercase; line-height: 1.1; }
.cn-date b { display: block; font-size: 1.45rem; font-weight: 900; }
.cn-date small { display: block; font-size: .68rem; opacity: .75; }
.cn-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cn-title { font-weight: 800; color: var(--wood); overflow-wrap: anywhere; }
.cn-main .badges { display: flex; flex-wrap: wrap; gap: 4px; }
.cn-contents { color: var(--muted); font-size: .86rem; }
.cn-opened { flex: 0 0 auto; text-align: center; font-size: .75rem; color: var(--muted); }
.cn-opened b { display: block; font-size: 1.1rem; color: var(--wood); }
@media (max-width: 420px) { .cn-item { padding: 12px; gap: 10px; } .cn-date { width: 50px; } }

.cn-back { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.cn-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.cn-head .badges { display: flex; flex-wrap: wrap; gap: 4px; }
.cn-preview-title { margin: 26px 0 10px; font-size: 1.05rem; color: var(--muted); }
.cn-block h2 { font-size: 1.1rem; margin-top: 0; }
.cn-yt-list { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cn-yt { background: #e62117; border-color: #e62117; }
.cn-yt:hover { background: #c4120a; border-color: #c4120a; }
.note-body p { margin: 0 0 8px; }

/* Protected viewing: no long-press save, no selection */
.cn-protect, .cn-lightbox { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.cn-protect img, .cn-protect canvas, .cn-lightbox img { -webkit-user-drag: none; user-drag: none; pointer-events: none; }
.cn-guard { position: absolute; inset: 0; background: transparent; }
@media print { body * { visibility: hidden !important; } body::after { content: "Class notes can't be printed."; visibility: visible; } }

.cn-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 45%), 1fr)); gap: 10px; }
.cn-shot { position: relative; display: block; padding: 0; border: 2px solid #e2e4f3; border-radius: 12px; overflow: hidden; background: #f3f5fb;
  aspect-ratio: 4 / 3; cursor: zoom-in; }
.cn-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cn-shot:hover { border-color: var(--violet); }

.cn-noscroll { overflow: hidden; }
.cn-lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(8, 10, 30, .94); display: flex; flex-direction: column; }
.cn-lightbox[hidden] { display: none; }
.cn-lb-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #fff; padding-top: max(10px, env(safe-area-inset-top)); }
.cn-lb-count { flex: 1; font-weight: 700; }
.cn-lb-top button, .cn-lb-prev, .cn-lb-next { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 999px; width: 42px; height: 42px; font-size: 1.2rem; cursor: pointer; }
.cn-lb-stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 8px; }
.cn-lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cn-lightbox.zoomed .cn-lb-stage { align-items: flex-start; justify-content: flex-start; }
.cn-lightbox.zoomed .cn-lb-stage img { max-width: none; max-height: none; width: 220%; }
.cn-lightbox.zoomed .cn-lb-stage .cn-guard { display: none; }
.cn-lb-prev, .cn-lb-next { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 1.8rem; }
.cn-lb-prev { left: 8px; } .cn-lb-next { right: 8px; }

.cn-pdf-head { display: flex; align-items: center; gap: 12px; }
.cn-pdf-icon { font-size: 1.8rem; }
.cn-pdf-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.cn-pdf { margin-top: 14px; background: #eceef6; border-radius: 12px; overflow: hidden; }
.cn-pdf-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; justify-content: space-between; background: #121d6c; color: #fff; padding: 8px 10px; }
.cn-pdf-status { font-weight: 700; font-size: .9rem; }
.cn-pdf-zoom { display: flex; gap: 6px; }
.cn-pdf-zoom button { background: rgba(255,255,255,.16); color: #fff; border: 0; border-radius: 8px; min-width: 40px; height: 34px; font-weight: 800; cursor: pointer; }
.cn-pdf .cn-pages-wrap, .cn-pdf { overflow-x: auto; }
.cn-pages { display: flex; flex-direction: column; gap: 10px; padding: 10px; width: 100%; box-sizing: border-box; }
.cn-page { position: relative; width: 100%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.cn-page canvas { display: block; width: 100%; height: 100%; }
.cn-page:not(.ready)::before { content: "Loading page…"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.cn-page-no { position: absolute; left: 8px; bottom: 6px; font-size: .72rem; color: #8a90a6; }
.cn-pdf.cn-full { position: fixed; inset: 0; z-index: 1000; margin: 0; border-radius: 0; overflow: auto; }

/* Teacher form: attachments */
.cn-row2 { display: grid; grid-template-columns: minmax(0, 240px); gap: 12px; }
.cn-files { border: 2px dashed #d6daf0; border-radius: 14px; padding: 12px; background: #fafbff; }
.cn-files.drop { border-color: var(--violet); background: #f1edff; }
.cn-file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cn-file-list:not(:empty) { margin-bottom: 12px; }
.cn-file { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid #e2e4f3; border-radius: 12px; padding: 8px; }
.cn-file img, .cn-file-pdf { flex: 0 0 auto; width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #f3f5fb; }
.cn-file-pdf { display: grid; place-items: center; background: #ffe9e7; color: #c80000; font-weight: 900; font-size: .8rem; }
.cn-file-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 700; font-size: .92rem; overflow-wrap: anywhere; }
.cn-file-name small { font-weight: 600; color: var(--muted); }
.cn-file.failed { border-color: var(--danger); background: #fff3f2; }
.cn-file.failed small { color: var(--danger); }
.cn-bar { display: none; height: 5px; background: #e6e8f5; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.cn-file.uploading .cn-bar { display: block; }
.cn-bar i { display: block; height: 100%; width: 0; background: var(--violet); transition: width .2s; }
.cn-file-btns { display: flex; gap: 4px; flex: 0 0 auto; }
.cn-file-btns button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid #d6daf0; background: #fff; cursor: pointer; font-weight: 800; color: var(--wood); }
.cn-file-btns button[data-remove] { color: var(--danger); }
.cn-add-files { cursor: pointer; }
.cn-has-audio { background: #f1edff; border-radius: 12px; padding: 10px 12px; margin: 6px 0 10px; }
.cn-watch tr.not-opened td { background: #fff8f0; }
@media (max-width: 420px) { .cn-file-btns button { width: 30px; } .cn-file img, .cn-file-pdf { width: 46px; height: 46px; } }
.cn-search input[type=search] { font: inherit; padding: 10px 14px; border: 2px solid #e2e4f3; border-radius: 12px; background: #fff; color: var(--text); -webkit-appearance: none; appearance: none; }
.cn-lb-prev, .cn-lb-next { background: rgba(255,255,255,.24); }
.cn-search select { font: inherit; padding: 9px 12px; border: 2px solid #e2e4f3; border-radius: 12px; background: #fff; color: var(--text); }
