:root {
  /* Platform default accent (auth/marketing pages, before a tenant's own
     color is known). Tenant-scoped pages override --tenant-accent once
     the tenant loads — see TenantContext.tsx. A restrained, trustworthy
     blue — matches the schema's own tenant default (#2563eb) — rather
     than the earlier violet/rose/amber multi-color treatment, which
     read as playful/template-y rather than professional. --accent-2/
     --accent-3 stay defined for status accents (badges etc.) but are
     no longer used for gradients across buttons/nav/headings. */
  --tenant-accent: #2563eb;
  --tenant-accent-contrast: #ffffff;
  --accent-2: #0f766e;
  --accent-3: #b45309;
  --accent-gradient: linear-gradient(135deg, var(--tenant-accent), #1e3a8a);

  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-hover: #f0f2f5;
  --border: #e1e4ea;
  --text: #52586b;
  --text-h: #151a2e;
  --text-muted: #8a8fa3;

  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
  --success: #0d9668;
  --success-bg: rgba(13, 150, 104, 0.12);
  --warning: #b45309;
  --warning-bg: rgba(180, 83, 9, 0.12);

  --radius-sm: 7px;
  --radius-md: 11px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(21, 26, 46, 0.06);
  --shadow-md: 0 10px 28px rgba(21, 26, 46, 0.1);
  --shadow-glow: 0 6px 18px -6px color-mix(in srgb, var(--tenant-accent) 40%, transparent);

  /* Spacing/type scale — for new work going forward; existing ad hoc
     rem/px literals elsewhere don't need a retroactive sweep. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 28px;

  --sans: 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
  --heading: 'Plus Jakarta Sans', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;

  font: 15px/1.5 var(--sans);
  color-scheme: light dark;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --surface: #161a2c;
    --surface-hover: #1e2338;
    --border: #2b3049;
    --text: #a7acc4;
    --text-h: #f1f2f8;
    --text-muted: #6d7288;

    --danger: #f0645f;
    --danger-bg: rgba(240, 100, 95, 0.14);
    --success: #3ecf8e;
    --success-bg: rgba(62, 207, 142, 0.14);
    --warning: #e0a940;
    --warning-bg: rgba(224, 169, 64, 0.14);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

#root {
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  font-family: var(--heading);
  font-weight: 700;
  color: var(--text-h);
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 30px;
  letter-spacing: -0.5px;
}
h2 {
  font-size: 21px;
  letter-spacing: -0.3px;
}
h3 {
  font-size: 16px;
  font-weight: 600;
}
h4 {
  font-size: 14px;
  font-weight: 600;
}

p {
  margin: 0;
}

a {
  color: var(--tenant-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-hover);
  color: var(--text-h);
}
/* =========================================================
   BUTTONS
   Default is a neutral outline button; add .btn-primary to the
   page's main action, .btn-danger for destructive actions, .btn-ghost
   for low-emphasis actions (e.g. sign out, prev/next).
   ========================================================= */
button {
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-h);
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
button:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: var(--tenant-accent);
  border-color: var(--tenant-accent);
  color: var(--tenant-accent-contrast);
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--tenant-accent) 88%, black);
  border-color: color-mix(in srgb, var(--tenant-accent) 88%, black);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-danger,
.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled),
.danger:hover:not(:disabled) {
  background: var(--danger-bg);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-h);
}

/* =========================================================
   FORMS
   ========================================================= */
.auth-form,
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.auth-form label,
.form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-h);
}

.auth-form input,
.auth-form textarea,
.auth-form select,
.form input,
.form textarea,
.form select,
.inline-form input {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-h);
  transition: border-color 0.15s ease;
}

.auth-form input:focus,
.auth-form textarea:focus,
.auth-form select:focus,
.form input:focus,
.form textarea:focus,
.form select:focus,
.inline-form input:focus {
  outline: none;
  border-color: var(--tenant-accent);
}

.auth-form .checkbox-label,
.form .checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.auth-form .checkbox-label input,
.form .checkbox-label input {
  width: auto;
}

.auth-form button,
.form > button {
  align-self: flex-start;
}

.auth-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-error {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
  font-size: 13.5px;
}

.auth-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.inline-form input {
  flex: 1;
}

/* =========================================================
   AUTH PAGES — centered card on a muted page background
   ========================================================= */
body:has(.auth-page) {
  background: var(--bg);
}

.auth-page {
  position: relative;
  max-width: 400px;
  margin: 8vh auto;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--tenant-accent);
}

.auth-logo {
  max-height: 40px;
  margin-bottom: 1rem;
}

/* =========================================================
   APP SHELL — sidebar + content, used by both dashboards
   ========================================================= */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
}

.sidebar-brand {
  font-family: var(--heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-h);
  padding: 0.4rem 0.6rem 1.25rem;
  line-height: 1.3;
}
.sidebar-brand span {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.15rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}
.sidebar-nav a:hover {
  background: var(--surface-hover);
  color: var(--text-h);
  text-decoration: none;
  transform: translateX(2px);
}
.sidebar-nav a.active {
  background: var(--tenant-accent);
  color: var(--tenant-accent-contrast);
}
.sidebar-nav a.active:hover {
  transform: none;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.sidebar-footer button {
  width: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Legacy header classes kept for pages that haven't moved into the
   sidebar shell (auth-adjacent screens) */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  text-align: left;
}
.dashboard-nav {
  display: flex;
  gap: 1rem;
}

/* =========================================================
   CARDS + GRID
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.item-card {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  color: inherit;
  text-decoration: none;
  transition:
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}
.item-card:hover {
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--tenant-accent) 35%, var(--border));
  text-decoration: none;
  transform: translateY(-2px);
}
.item-card h3 {
  margin-bottom: 0.4rem;
}
.item-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  padding: 1.5rem 0;
}

/* =========================================================
   LISTS (sub-lists within a detail page — modules, lessons, results)
   ========================================================= */
.list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  text-align: left;
}
.list li {
  padding: 0.6rem 0.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.list li:last-child {
  border-bottom: none;
}
.list a {
  color: var(--text-h);
  font-weight: 500;
}
.list a:hover {
  color: var(--tenant-accent);
}

/* =========================================================
   BADGES
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-success {
  background: var(--success-bg);
  color: var(--success);
}
.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge-live {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--danger);
  margin-right: 0.35rem;
  animation: badge-live-pulse 1.6s ease-in-out infinite;
}
@keyframes badge-live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
.badge-accent {
  background: color-mix(in srgb, var(--tenant-accent) 15%, transparent);
  color: var(--tenant-accent);
  font-weight: 700;
}

/* =========================================================
   MISC CONTENT BLOCKS
   ========================================================= */
.upload-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: left;
}

.module-block {
  text-align: left;
  margin-bottom: 1.5rem;
}

.lesson-text {
  text-align: left;
  white-space: pre-wrap;
  line-height: 1.7;
}

.session-actions {
  margin-bottom: 1rem;
  text-align: left;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.slow-mode-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.slow-mode-control select {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-h);
}

.attendee-name {
  flex: 1;
}

.student-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
}
.student-row-courses {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* =========================================================
   STUDENTS PAGE — search/sort toolbar + card grid, see
   StudentsListPage.tsx
   ========================================================= */
.students-toolbar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}
.students-search {
  flex: 1;
  max-width: 320px;
  font: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-h);
}
.students-toolbar select {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-h);
}

.student-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.student-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.student-email {
  font-size: 12.5px;
}

.student-card-courses {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.student-course-row {
  display: block;
  color: inherit;
  text-decoration: none;
  padding: 0.4rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}
.student-course-row:hover {
  background: var(--surface-hover);
  text-decoration: none;
}
.student-course-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-h);
  margin-bottom: 0.3rem;
}

.item-card-progress {
  margin-bottom: 0.4rem;
}

.progress-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-hover);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--tenant-accent);
  border-radius: inherit;
}

.color-field {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.color-field input[type='color'] {
  width: 44px;
  height: 38px;
  padding: 0.2rem;
  flex-shrink: 0;
}
.color-field input[type='text'],
.color-field input:not([type]) {
  flex: 1;
}

.domain-verify-card {
  max-width: 420px;
}
.domain-verify-card code {
  word-break: break-all;
}
.domain-verify-card button {
  margin-top: 0.75rem;
}

.data-request-row {
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.data-request-info {
  flex: 1;
  min-width: 0;
}
.data-request-info p {
  margin-top: 0.25rem;
}

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}
.star-rating-star {
  background: none;
  border: none;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: var(--border);
  cursor: default;
}
button.star-rating-star {
  cursor: pointer;
}
.star-rating-star.filled {
  color: var(--warning);
}
.star-rating-count {
  margin-left: 0.4rem;
  font-size: 12.5px;
  color: var(--text-muted);
}

.review-form-card {
  max-width: 480px;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.review-form-card textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-h);
}
.review-form-card button {
  align-self: flex-start;
}

.review-row-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.checkout-card {
  max-width: 360px;
  margin-bottom: 1.5rem;
}
.checkout-card .form,
.checkout-card label {
  margin-top: 0;
}
.checkout-card button {
  margin-top: 0.75rem;
  width: 100%;
}

/* =========================================================
   OVERVIEW DASHBOARDS — teacher/student home page, see
   TeacherOverviewPage.tsx / StudentOverviewPage.tsx
   ========================================================= */
.overview-header h1 {
  margin-bottom: 0.3rem;
}

.overview-stats {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 1.5rem;
}
.overview-stat {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.overview-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.overview-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 16px;
  border-radius: 999px;
}
.overview-stat-icon-accent {
  background: color-mix(in srgb, var(--tenant-accent) 15%, transparent);
}
.overview-stat-icon-success {
  background: var(--success-bg);
}
.overview-stat-icon-warning {
  background: var(--warning-bg);
}
.overview-stat-value {
  font-family: var(--heading);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-h);
}

.overview-chart-card,
.overview-actions-card,
.overview-recent-card {
  margin-bottom: 1.5rem;
}
.overview-chart-card h3,
.overview-actions-card h3 {
  margin-bottom: 1rem;
}

.sparkline-svg {
  width: 100%;
  height: 160px;
  display: block;
}
.sparkline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 12px;
  color: var(--text-muted);
}

.overview-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.overview-recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.overview-recent-name {
  font-weight: 500;
  color: var(--text-h);
}
.overview-recent-time {
  margin-left: auto;
}

.analytics-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.analytics-stat {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.analytics-stat-value {
  font-family: var(--heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-h);
}
.analytics-stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* =========================================================
   LIVE SESSION ROOM — video/content main column + chat/poll rail
   ========================================================= */
.session-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .session-layout {
    grid-template-columns: 1fr;
  }
}

.session-main {
  min-width: 0;
}
.session-recording-note {
  margin-bottom: 0.6rem;
}

/* =========================================================
   STREAM SETUP — the "paste your YouTube Live link here" card shown
   in place of the video before a teacher goes live, see
   StreamSetupCard.tsx
   ========================================================= */
.stream-setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: left;
}
.stream-steps {
  margin: 0.75rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}
.stream-thumb {
  display: block;
  width: 100%;
  max-width: 320px;
  margin-top: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.stream-setup-linked {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stream-setup-linked .stream-thumb {
  width: 120px;
  max-width: 120px;
  margin-top: 0;
  flex-shrink: 0;
}

.session-rail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 1.5rem;
}

/* Stable wrapper — the YouTube Player API replaces the mount div
   inside it with its own <iframe>, discarding any className we put
   directly on that div, so sizing targets whatever ends up inside via
   a descendant selector instead. */
.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-container {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Our own fullscreen target — see VideoFrame.tsx. YouTube's native
   fullscreen button is disabled (fs=0) specifically so this is the
   only path in, keeping the watermark inside the fullscreened element
   instead of left behind as a sibling of the player. */
.video-container:fullscreen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 0;
}
.video-container:fullscreen .video-embed {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.video-controls {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  left: 0.6rem;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}
.video-controls button {
  font-size: 12px;
  padding: 0.3rem 0.65rem;
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}
.video-controls button:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.75);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Sits between the iframe (z-index: auto) and everything else — blocks
   every click from reaching YouTube's own UI, since our .video-controls
   buttons (above this) are the only intended way to control playback. */
.video-click-blocker {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: transparent;
  cursor: default;
}

.watermark-overlay {
  position: absolute;
  pointer-events: none;
  user-select: none;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--mono);
  transition:
    top 1s ease,
    left 1s ease,
    right 1s ease,
    bottom 1s ease;
  z-index: 2;
}

/* =========================================================
   PANELS (chat, poll) — used stacked in .session-rail
   ========================================================= */
.panel,
.chat-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
}
.panel h3,
.chat-panel h3 {
  margin-bottom: 0.75rem;
}

.chat-messages {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.chat-message {
  font-size: 13.5px;
  line-height: 1.4;
}
.chat-message strong {
  color: var(--text-h);
}

.poll-current {
  margin-bottom: 1rem;
}

/* =========================================================
   QUIZ
   ========================================================= */
.quiz-question {
  text-align: left;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.quiz-question:last-of-type {
  border-bottom: none;
}

/* =========================================================
   PDF VIEWER
   ========================================================= */
.pdf-viewer {
  margin-top: 1rem;
}
.pdf-viewer canvas {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.pdf-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* =========================================================
   MODAL — used by ConfirmDialog and directly for any custom dialog
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 14, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  text-align: left;
}
.modal-title {
  margin-bottom: 0.75rem;
}
.modal-message {
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* =========================================================
   TOASTS — ephemeral success/error feedback, see Toast.tsx
   ========================================================= */
.toast-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 320px;
}
.toast {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  color: #fff;
  animation: toast-in 0.15s ease;
}
.toast-success {
  background: var(--success);
}
.toast-error {
  background: var(--danger);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   MOBILE APP SHELL — the fixed sidebar above has no responsive
   behavior on its own; below ~768px it becomes a slide-out drawer
   behind a fixed top bar. See AppShell.tsx.
   ========================================================= */
.mobile-topbar {
  display: none;
}
.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3.25rem;
    padding: 0 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 60;
  }
  .mobile-nav-toggle {
    padding: 0.4rem 0.65rem;
    font-size: 16px;
    line-height: 1;
  }
  .mobile-topbar-brand {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-h);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-topbar-brand span {
    display: none; /* role subtitle — skip in the compact bar */
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 260px;
    max-width: 80vw;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 70;
  }
  .sidebar-open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 14, 0.4);
    z-index: 65;
  }

  .main-content {
    padding: calc(3.25rem + 1.25rem) 1.25rem 1.5rem;
  }
}

/* =========================================================
   LANDING PAGE — root-domain marketing page, see LandingPage.tsx
   ========================================================= */
/* Marketing pages commit to one look rather than following the
   viewer's OS theme — reuses every existing token-driven component
   (.card, .btn-*, .badge...) by just overriding the neutral tokens,
   so nothing else needs a landing-specific rewrite. */
body:has(.landing-page) {
  --bg: #0a0a0f;
  --surface: #131320;
  --surface-hover: #1b1b2c;
  --border: #232333;
  --text: #a8a8b8;
  --text-h: #f5f5fa;
  --text-muted: #6e6e80;
}

.landing-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0 2.5rem;
}
.landing-header-sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin: 0 -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
.landing-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.landing-page .btn-primary {
  border-radius: 999px;
}
.landing-brand {
  font-family: var(--heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-h);
}

.landing-section-title {
  text-align: center;
  margin-bottom: 2rem;
}

.landing-hero {
  position: relative;
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
  padding: 3.5rem 1rem 3.5rem;
  border-bottom: 1px solid var(--border);
}
.landing-hero::before {
  content: '';
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 320px;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--tenant-accent) 22%, transparent), transparent 70%);
  filter: blur(20px);
  z-index: -1;
  pointer-events: none;
}

.landing-eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.landing-hero h1 {
  font-size: 44px;
  line-height: 1.15;
  letter-spacing: -0.8px;
  margin-bottom: 1.25rem;
}
.landing-gradient-text {
  background: linear-gradient(120deg, var(--tenant-accent), #7dd3fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.landing-subhead {
  font-size: 17px;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 2rem;
}
.landing-hero-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}
.landing-hero-actions .btn-primary,
.landing-final-cta .btn-primary {
  padding: 0.9rem 2rem;
  font-size: 15.5px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--tenant-accent), color-mix(in srgb, var(--tenant-accent) 60%, #7c3aed));
  border-color: transparent;
  box-shadow: 0 8px 28px -8px color-mix(in srgb, var(--tenant-accent) 65%, transparent);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.landing-hero-actions .btn-primary:hover,
.landing-final-cta .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -6px color-mix(in srgb, var(--tenant-accent) 75%, transparent);
}
.landing-existing-note {
  margin-top: 1.5rem;
}

.landing-features {
  padding: 3rem 0 1rem;
}
.landing-feature {
  text-align: left;
}
.landing-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 19px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--tenant-accent) 10%, transparent);
  margin-bottom: 0.85rem;
}
.landing-feature p {
  margin-top: 0.5rem;
}

/* =========================================================
   PROBLEM / SOLUTION — short before/after pairs, real pain points
   coaching institutes actually have, see LandingPage.tsx
   ========================================================= */
.landing-problems {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border);
}
.landing-problems-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.landing-problem-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
}
.landing-problem-text {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  min-height: 42px;
}
.landing-problem-arrow {
  color: var(--tenant-accent);
  font-size: 18px;
  margin: 0.75rem 0;
}
.landing-solution-text {
  color: var(--text-h);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.5;
}

/* =========================================================
   FEATURE SHOWCASE — alternating text/visual rows
   ========================================================= */
.landing-showcase {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}
.landing-showcase-row {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.5rem;
  align-items: center;
  padding: 2.5rem 0;
}
.landing-showcase-row.reverse {
  grid-template-columns: 0.9fr 1.1fr;
}
.landing-showcase-row.reverse .landing-showcase-visual {
  order: -1;
}
.landing-showcase-text h3 {
  font-size: 22px;
  margin-bottom: 0.75rem;
}
.landing-showcase-text p {
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
}
.landing-showcase-visual {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--tenant-accent) 10%, var(--surface));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.landing-showcase-visual span {
  font-size: 64px;
}

/* =========================================================
   FINAL CTA
   ========================================================= */
.landing-final-cta {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  padding: 4rem 1rem;
  border-top: 1px solid var(--border);
}
.landing-final-cta h2 {
  font-size: 28px;
  margin-bottom: 0.75rem;
}
.landing-final-cta .btn-primary {
  margin-top: 0.5rem;
  padding: 0.85rem 1.75rem;
  font-size: 15.5px;
}

.landing-footer {
  text-align: center;
  padding-top: 3rem;
  border-top: 1px solid var(--border);
}
.landing-footer-brand {
  font-family: var(--heading);
  font-weight: 700;
  color: var(--text-h);
  margin-bottom: 0.5rem;
}

@media (max-width: 640px) {
  .landing-hero h1 {
    font-size: 30px;
  }
  .landing-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  .landing-showcase-row,
  .landing-showcase-row.reverse {
    grid-template-columns: 1fr;
  }
  .landing-showcase-row.reverse .landing-showcase-visual {
    order: 0;
  }
  .landing-showcase-visual {
    aspect-ratio: 16 / 9;
  }
}

/* =========================================================
   TENANT STOREFRONT — public per-institute page, reuses most
   .landing-* classes above, see TenantStorefrontPage.tsx
   ========================================================= */
.storefront-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.storefront-logo {
  max-height: 28px;
}
.storefront-header-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.storefront-hero h1 {
  font-size: 34px;
}
.storefront-hero-banner {
  position: relative;
  max-width: none;
  margin: 0 -1.5rem 2rem;
  padding: 4rem 1.5rem;
  background-size: cover;
  background-position: center;
  border-radius: 0;
  border-bottom: none;
}
.storefront-hero-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 20, 0.55);
}
.storefront-hero-content {
  position: relative;
  z-index: 1;
}
.storefront-hero-banner h1,
.storefront-hero-banner .landing-subhead {
  color: #ffffff;
}

.storefront-about,
.storefront-contact {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border);
}
.storefront-about p,
.storefront-contact p {
  color: var(--text);
  line-height: 1.6;
  margin-top: 0.5rem;
}
.storefront-course-card {
  display: flex;
  flex-direction: column;
}
.storefront-course-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}
.storefront-course-price {
  margin-top: 0.75rem;
  align-self: flex-start;
}
