/* Gator Class — one design system for the whole app.
   Light, friendly, educational. Tokens first, then components. */
:root {
  --bg: #f4f7fb;          /* app background (soft blue-white) */
  --panel: #ffffff;       /* cards / surfaces */
  --panel-2: #f1f5fa;     /* subtle raised / hover */
  --line: #e4e9f1;        /* borders */
  --text: #1f2a37;        /* primary readable text */
  --muted: #667085;       /* secondary text */
  --accent: #16a34a;      /* primary / success (green) */
  --accent-2: #2f6fed;    /* links / info (blue) */
  --danger: #e11d48;
  --warn: #d97706;
  --tint: #e9f6ef;        /* green tint (selected/success bg) */
  --tint-2: #eaf1fe;      /* blue tint (info bg) */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.07);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- buttons ---------- */
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 550;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.05s, opacity 0.12s;
}
button:hover { background: var(--panel-2); }
button:active { transform: translateY(1px); }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.25);
}
button.primary:hover { background: #15913f; border-color: #15913f; }
button.secondary { background: var(--tint-2); border-color: transparent; color: var(--accent-2); font-weight: 600; }
button.secondary:hover { background: #dde9fe; }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { background: var(--panel-2); color: var(--text); }
button.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: #fdeef2; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- inputs ---------- */
input, select, textarea {
  font: inherit;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #9aa6b5; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15);
}
input:disabled { background: var(--panel-2); color: var(--muted); }
label { display: block; font-size: 13px; font-weight: 550; color: var(--text); margin: 14px 0 6px; }

/* ---------- auth (landing + login) ---------- */
.auth {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: 40px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 28px;
}
.auth-hero { max-width: 460px; }
.auth-hero .brand { margin-bottom: 22px; }
.auth-hero h2 { font-size: clamp(24px, 3.5vw, 34px); line-height: 1.2; margin: 0 0 14px; letter-spacing: -0.02em; }
.auth-hero .lead { color: var(--muted); font-size: 16px; margin: 0 0 22px; }
.auth-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text); }
.auth-points .ic { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--tint); font-size: 14px; }
.auth-points li.blue .ic { background: var(--tint-2); }
.auth-card { width: 100%; max-width: 420px; justify-self: end; }

/* ---------- card ---------- */
.lobby { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1, .brand strong { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.brand .dot { width: 30px; height: 30px; }
.card h2 { margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.full { width: 100%; }
.center { text-align: center; }
.mt8 { margin-top: 8px; }
.divider { height: 1px; background: var(--line); margin: 20px 0; position: relative; }
.divider[data-label]::after {
  content: attr(data-label); position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  background: var(--panel); padding: 0 10px; color: var(--muted); font-size: 12px;
}
.form-error { color: var(--danger); font-size: 13px; margin: 10px 0 0; }

/* demo block on login */
.demo-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.demo-box .demo-label { font-size: 12px; color: var(--muted); margin: 0 0 8px; }

.role-pick { display: flex; gap: 10px; margin-top: 6px; }
.role-pick button { flex: 1; }
.role-pick button[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); color: var(--text); }

/* lobby home / generic lists kept for compatibility */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; gap: 10px; }
.section-title { font-size: 16px; margin: 0; }
.lesson-list { display: flex; flex-direction: column; gap: 8px; }
.lesson-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.lesson-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.lesson-actions { display: flex; gap: 6px; flex-shrink: 0; }
.lesson-actions button { padding: 7px 12px; }
.badge { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 11px; color: var(--muted); }
.invite-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--tint); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 12px 14px; margin: 8px 0 12px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 13px; }
textarea.code {
  width: 100%; min-height: 280px; resize: vertical;
  font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #fbfdff; color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; white-space: pre;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* ---------- Room layout ---------- */
.room { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .grow { flex: 1; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.pill .led { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.online .led { background: var(--accent); }
.pill.connecting .led, .pill.reconnecting .led { background: var(--warn); animation: blink 1s infinite; }
.pill.closed .led { background: var(--danger); }
@keyframes blink { 50% { opacity: 0.3; } }

.stage { display: grid; grid-template-columns: 1fr 320px; min-height: 0; }
.main { min-width: 0; display: grid; grid-template-rows: 1fr auto; }
.side { border-left: 1px solid var(--line); background: var(--panel); display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.sidepanel { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }

.surface { position: relative; margin: 0; background: var(--panel-2); overflow: hidden; }
.slide { position: absolute; inset: 0; padding: 5% 8%; padding-bottom: 96px; overflow: auto; }
.slide h2 { font-size: clamp(20px, 3.5vw, 34px); margin: 0 0 18px; }
.slide p, .slide li { font-size: clamp(15px, 2vw, 20px); color: #33414f; }
.choice { display: block; width: 100%; text-align: left; margin: 8px 0; padding: 12px 14px; }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); }
.fill { max-width: 360px; margin-top: 10px; }
.canvas-wrap { position: absolute; inset: 0; pointer-events: none; }
canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.tb-sep { width: 1px; height: 24px; background: var(--line); }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(0,0,0,.1); padding: 0; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--text); }

.feedback { font-size: 14px; font-weight: 600; margin-top: 12px; }
.feedback.ok { color: var(--accent); }
.feedback.bad { color: var(--danger); }

/* Floating participant tiles — a clean cluster pinned top-right over the stage
   (Meet/Zoom-style), so the slide/board stays the main teaching surface. */
.videos { position: absolute; top: 14px; right: 14px; z-index: 6; display: flex; flex-direction: column; gap: 10px; max-height: calc(100% - 120px); overflow: auto; padding: 0; margin: 0; }
.videos:empty { display: none; }
.tile { position: relative; width: 184px; aspect-ratio: 4 / 3; background: #0b0e13; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(16,24,40,.28); }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile .name { position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,.55); padding: 2px 8px; border-radius: 7px; max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile.muted .name::after { content: " 🔇"; }
.tile .vstatus { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; color: #9aa7b4; background: #0b0e13; }
.tile.connecting .vstatus { color: var(--warn); }
.tile.failed .vstatus { color: var(--danger); }
.tile.connected .vstatus { display: none; }
/* avatar placeholder shown when a participant has no live video (mic-only / cam off) */
.tile .avatar { position: absolute; inset: 0; display: none; place-items: center; background: linear-gradient(135deg, #283548, #0b0e13); color: #e7edf5; font-weight: 700; font-size: 30px; letter-spacing: .02em; }
.tile.novideo video { display: none; }
.tile.novideo .avatar { display: grid; }
.tile .vmic { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; display: none; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.tile .vmic svg { width: 13px; height: 13px; }
.tile.amuted .vmic { display: inline-flex; }

/* ---------- floating call control bar (mic / camera / screen / leave) ----------
   A pinned, translucent pill centered at the bottom of the stage — the standard
   video-call control surface. */
.callbar-wrap { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 20; max-width: calc(100% - 24px); }
.callbar { display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 4px; position: relative;
  background: rgba(255,255,255,.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(16,24,40,.08); border-radius: 999px; box-shadow: 0 10px 34px rgba(16,24,40,.22); padding: 7px 10px; }
.callbar .cb-div { width: 1px; align-self: stretch; background: var(--line); margin: 4px 4px; }
.cb-ico { display: inline-grid; place-items: center; }
.cb-ico svg { width: 21px; height: 21px; display: block; }
.cb-count { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 10px; border-radius: 999px; }
.cb-count .cb-ico svg { width: 15px; height: 15px; }

.cb-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 56px; padding: 6px 8px 5px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--text); font-weight: 600; line-height: 1; }
.cb-btn .cb-cap { font-size: 10.5px; font-weight: 600; letter-spacing: -.01em; }
.cb-btn:hover { background: rgba(16,24,40,.06); }
.cb-btn.cb-busy { opacity: .55; pointer-events: none; }
.cb-btn.active { background: var(--tint-2); color: var(--accent-2); }                            /* device in use */
.cb-btn.muted { background: #fde7eb; color: var(--danger); }                                     /* off / muted = red */
.cb-btn.cb-ghost { min-width: 0; padding: 11px; align-self: center; border-radius: 50%; }
.cb-btn.cb-ghost .cb-ico svg { width: 20px; height: 20px; }
.cb-btn.cb-ghost.active { background: rgba(16,24,40,.06); color: var(--text); }
.cb-leave { background: var(--danger); color: #fff; min-width: 56px; }
.cb-leave:hover { background: #c4153b; }
.cb-leave svg { transform: rotate(135deg); }

.cb-menu { position: absolute; right: 0; bottom: calc(100% + 10px); min-width: 230px; max-width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.cb-menu[hidden] { display: none; }
.cb-mh { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px 2px; }
.cb-msep { height: 1px; background: var(--line); margin: 4px 0; }
.cb-mi { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--text); }
.cb-mi:hover { background: var(--panel-2); }
.cb-mi-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; }
.cb-mi.on .cb-mi-dot { border-color: var(--accent); background: var(--accent); }
.cb-mi.on { color: var(--accent); }

.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; color: var(--muted); padding: 12px; font-weight: 550; }
.tabs button:hover { background: var(--panel-2); }
.tabs button[aria-selected="true"] { color: var(--accent-2); box-shadow: inset 0 -2px 0 var(--accent-2); }
.panel { overflow: auto; padding: 12px; min-height: 0; }
.panel[hidden] { display: none; }

.member { display: flex; align-items: center; gap: 8px; padding: 6px 4px; }
.member .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-2); color: #fff; }
.member.tutor .av { background: var(--accent); color: #fff; }
.tag { font-size: 12px; color: var(--muted); }
.group-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 4px 4px; }

.answer { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 8px; }
.answer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.answer .who { font-size: 13px; font-weight: 600; }
.answer-slide { font-size: 11px; color: var(--muted); margin: 2px 0; }
.answer-val { font-size: 14px; }
.answer-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
.verdict { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); }
.verdict.correct { color: var(--accent); border-color: var(--accent); }
.verdict.wrong { color: var(--danger); border-color: var(--danger); }
.answer.correct { border-color: var(--accent); }
.answer.wrong { border-color: var(--danger); }

.chat-msg { margin-bottom: 8px; }
.chat-msg .who { font-size: 12px; color: var(--muted); }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.composer input { flex: 1; }

/* ---------- empty / loading states ---------- */
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 36px 16px; }
.empty-state { text-align: center; padding: 44px 20px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel); }
.empty-state .ic { font-size: 34px; }
.empty-state h3 { margin: 12px 0 6px; }
.empty-state p { color: var(--muted); margin: 0 auto 16px; max-width: 360px; font-size: 14px; }
.skeleton { background: linear-gradient(90deg, var(--panel-2) 25%, #e9eef5 37%, var(--panel-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: var(--radius-sm); }
.sk-row { height: 60px; margin-bottom: 8px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.loader { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); max-width: min(520px, 92vw); background: var(--text); color: #fff; border-radius: var(--radius-sm); padding: 12px 16px; box-shadow: var(--shadow); font-size: 14px; opacity: 0; transition: opacity .25s, transform .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- AI-lesson panel ---- */
.aipanel { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); max-height: 44vh; overflow: auto; min-height: 0; }
.aipanel:empty { display: none; padding: 0; border: 0; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ai-head strong { font-size: 13px; }
.ai-status { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-led { font-size: 10px; padding: 2px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.ai-led.on { color: var(--accent); border-color: var(--accent); background: var(--tint); }
.ai-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.ai-btn { font-size: 12px; padding: 6px 10px; border-radius: 8px; }
.ai-btn.sm { font-size: 11px; padding: 4px 8px; }
.ai-btn.ghost { background: transparent; }
.ai-btn.on { border-color: var(--accent-2); color: var(--accent-2); }
.ai-btn.rec { border-color: var(--danger); color: var(--danger); animation: blink 1.2s infinite; }
.ai-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.ai-hints { display: flex; flex-direction: column; gap: 8px; padding: 0; overflow: visible; }
.ai-hint { border: 1px solid var(--line); border-left: 3px solid var(--muted); border-radius: 8px; padding: 8px 10px; background: var(--panel); }
.ai-hint.high { border-left-color: var(--danger); }
.ai-hint.medium { border-left-color: var(--warn); }
.ai-hint.low { border-left-color: var(--accent-2); }
.ai-hint.soft { background: var(--tint); border-left-color: var(--accent); }
.ai-hint-top { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.ai-tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ai-prio { font-size: 10px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.ai-prio.high { color: var(--danger); border-color: var(--danger); }
.ai-prio.medium { color: var(--warn); border-color: var(--warn); }
.ai-hint-title { font-weight: 600; font-size: 13px; }
.ai-hint-msg { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ai-hint-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ai-transcript { display: flex; flex-direction: column; gap: 4px; max-height: 22vh; }
.tr-line { font-size: 12px; line-height: 1.35; }
.tr-who { color: var(--muted); margin-right: 6px; font-weight: 600; }
.tr-line.tutor .tr-who { color: var(--accent-2); }
.tr-line.student .tr-who { color: var(--accent); }
.ai-exercise { border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--tint); padding: 10px; }
.ai-ex-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13px; margin-bottom: 8px; }

/* ---- extended exercises ---- */
.ex-line, .ai-ex-body p { font-size: clamp(15px, 2vw, 19px); line-height: 1.8; }
.ex-gap { width: 8em; margin: 0 4px; padding: 2px 8px; border-radius: 6px; }
.ex-preview { color: var(--accent); font-weight: 600; }
.ex-answer-row, .ex-bank { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; min-height: 36px; }
.ex-answer-row { border: 1px dashed var(--line); border-radius: 8px; padding: 6px; }
.ex-chip { font-size: 14px; padding: 6px 10px; border-radius: 8px; }
.ex-chip.picked { border-color: var(--accent-2); background: var(--tint-2); }
.ex-chip.used { opacity: 0.35; }
.ex-pair { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 15px; }
.ex-select { min-width: 140px; }

/* ---------- Cabinet ---------- */
.cab { min-height: 100%; display: grid; grid-template-columns: 248px 1fr; }
.cab-nav { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.cab-brand { display: flex; align-items: center; gap: 8px; padding: 4px 8px 14px; }
.cab-brand strong { font-size: 17px; letter-spacing: -0.01em; }
.cab-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm); background: var(--panel-2); margin-bottom: 10px; }
.cab-user .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--accent-2); color: #fff; }
.cab-user .av.tutor { background: var(--accent); color: #fff; }
.cab-link { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; }
.cab-link:hover { background: var(--panel-2); text-decoration: none; }
.cab-link.active { background: var(--tint); color: #157f3b; font-weight: 600; }
.cab-link .ncount { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.cab-row.notif { cursor: pointer; }
.cab-row.notif:hover { border-color: var(--accent-2); }
.cab-row.notif.unread { border-left: 3px solid var(--accent); background: var(--tint); }

/* ---------- chips (lesson configurator) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 4px; }
.chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; font-weight: 550; }
.chip:hover { border-color: var(--accent-2); background: var(--panel-2); }
.chip.on { border-color: var(--accent); background: var(--tint); color: #157f3b; }
.lesson-cfg input[type="range"] { width: 100%; accent-color: var(--accent); padding: 0; margin-top: 6px; }
.lesson-cfg label { margin: 12px 0 6px; }
.cfg-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.cfg-title h3 { margin: 0; }
.topic-row { display: flex; gap: 8px; }
.topic-row > input { flex: 1; }
.btn-icon-lg { flex: none; padding: 0 14px; min-width: 46px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm); font-size: 17px; line-height: 1; }
.btn-icon-lg:hover { border-color: var(--accent); background: var(--tint); }
.lang-row { display: flex; align-items: flex-end; gap: 8px; }
.lang-col { flex: 1; min-width: 0; }
.lang-cap { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.btn-swap { height: 44px; }
.cfg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.cfg-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
@media (max-width: 560px) { .cfg-row { grid-template-columns: 1fr; } }

/* ---------- deck builder ---------- */
.builder-head { margin-bottom: 14px; }
.builder-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.builder-list { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }

.slide-card { background: var(--panel); border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .12s; }
.slide-card:hover { box-shadow: var(--shadow); }
.slide-card.cat-explain { border-left-color: #cbd5e1; }
.slide-card.cat-question { border-left-color: var(--accent-2); }
.slide-card.cat-exercise { border-left-color: var(--accent); }

.slide-card-h { display: flex; align-items: center; gap: 8px; padding: 11px 14px; cursor: pointer; user-select: none; }
.slide-card-h:hover { background: var(--panel-2); }
.drag-dots { color: #c2cad6; font-size: 13px; letter-spacing: -2px; cursor: grab; }
.slide-badge { background: var(--panel-2); color: var(--text); font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.cat-question .slide-badge { background: var(--tint-2); color: var(--accent-2); }
.cat-exercise .slide-badge { background: var(--tint); color: #157f3b; }
.slide-num { color: var(--muted); font-size: 12px; font-weight: 600; }
.slide-sum { flex: 1; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); font-size: 12px; width: 14px; text-align: center; }

.slide-edit { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.slide-title { font-weight: 600; margin: 10px 0 8px; }
.slide-body { display: flex; flex-direction: column; gap: 8px; }
.slide-body .cab-field { margin: 0; }
.slide-body .cab-field label { margin: 4px 0 4px; }

.icon-btn { padding: 5px 9px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); line-height: 1; font-size: 13px; }
.icon-btn:hover { background: var(--panel); border-color: var(--line); color: var(--text); }
.icon-btn.on { color: var(--accent-2); background: var(--tint-2); }
.icon-btn.danger:hover { color: var(--danger); border-color: var(--danger); background: #fdeef2; }

.opt-row { display: flex; align-items: center; gap: 8px; }
.opt-row > input { flex: 1; }
.opt-row > input.opt-radio { flex: none; }
.opt-radio { width: 18px; height: 18px; accent-color: var(--accent); }

.preview-wrap { margin-top: 12px; padding: 12px 14px; background: #fbfdff; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.preview-label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.preview-wrap .slide h2 { margin: 0 0 8px; font-size: 18px; }
.preview-wrap .slide .choice, .preview-wrap .slide .fill { margin: 4px 0; }

.add-slide { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 16px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--panel-2); }
.builder-bar { display: flex; align-items: center; gap: 8px; position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); }
.cab-nav-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.cab-main { padding: 28px 32px; overflow: auto; min-width: 0; max-width: 1040px; }
.cab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.cab-head h1 { font-size: 24px; margin: 0; }
.cab-head-actions { display: flex; gap: 8px; }
.cab-lede { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.cab-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 8px; }
.cab-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .12s, transform .06s; }
.cab-card:hover { border-color: var(--accent-2); transform: translateY(-1px); }
.cab-card-v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.cab-card-l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cab-section { margin: 26px 0; }
.cab-section > h2 { font-size: 16px; margin: 0 0 12px; }
.cab-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.cab-row-t { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cab-row-a { display: flex; gap: 6px; flex-shrink: 0; }
.cab-row-a button, .cab-row-a a { padding: 7px 12px; font-size: 13px; }
.cab-badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-weight: 550; }
.cab-badge.s-scheduled, .cab-badge.s-assigned { color: var(--accent-2); border-color: var(--accent-2); background: var(--tint-2); }
.cab-badge.s-submitted { color: var(--warn); border-color: var(--warn); background: #fdf3e6; }
.cab-badge.s-completed, .cab-badge.s-reviewed { color: #157f3b; border-color: var(--accent); background: var(--tint); }
.cab-badge.s-cancelled, .cab-badge.s-missed, .cab-badge.s-overdue { color: var(--danger); border-color: var(--danger); background: #fdeef2; }
.cab-form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.cab-form h3 { margin: 0 0 10px; font-size: 15px; }
.cab-field { margin-bottom: 12px; }
.cab-field label { margin: 0 0 5px; }
.cab-checks { display: flex; flex-direction: column; gap: 6px; }
.cab-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.cab-check input { width: auto; }
.cab-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 18px; box-shadow: var(--shadow-sm); }
.cab-kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cab-kv:last-child { border-bottom: 0; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; gap: 24px; padding: 28px 18px; max-width: 460px; }
  .auth-hero { max-width: none; }
  .auth-card { justify-self: stretch; max-width: none; }
}
@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .side { border-left: 0; border-top: 1px solid var(--line); max-height: 46vh; }
  /* Phones: the stage is short, so don't float the bar inside it — pin it to the
     viewport bottom as a centered pill, and lay the tiles as a compact top strip. */
  .videos { top: 8px; right: 8px; left: auto; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-height: none; max-width: calc(100% - 16px); }
  .tile { width: 96px; border-radius: 10px; box-shadow: 0 6px 18px rgba(16,24,40,.3); }
  .callbar-wrap { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 60; }
  .callbar { gap: 2px; padding: 6px 8px; }
  .cb-btn { min-width: 50px; padding: 6px 6px 5px; }
  .cb-count { display: none; }
  .side { padding-bottom: 70px; }   /* leave room under the fixed call pill */
  .topbar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .topbar #roomtitle { font-size: 15px; }
  .topbar #invite { margin-left: auto; }
  .lesson-row, .cab-row { flex-direction: column; align-items: stretch; }
  .cab-row-a { justify-content: flex-end; }
  .invite-banner { flex-direction: column; align-items: stretch; }

  /* cabinet: sidebar -> sticky bottom nav */
  .cab { grid-template-columns: 1fr; }
  .cab-nav {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto;
    flex-direction: row; align-items: center; gap: 2px; padding: 6px 8px;
    border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; z-index: 30;
    box-shadow: 0 -4px 16px rgba(16,24,40,.06);
  }
  .cab-brand, .cab-user, .cab-nav-foot { display: none; }
  .cab-nav nav { display: flex; gap: 2px; width: 100%; justify-content: space-around; }
  .cab-link { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; white-space: nowrap; }
  .cab-main { padding: 18px 16px 84px; max-width: none; }
  .cab-kv { grid-template-columns: 1fr; gap: 2px; }
}
