/* ============================================================================
   MATN Platform — Editorial Azhari Design System (100% Thmanyah Typography)
   ============================================================================ */

:root {
  --font-sans: "Thmanyah Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Thmanyah Serif Display", "Thmanyah Sans", Georgia, serif;
  --font-serif: "Thmanyah Serif Text", "Thmanyah Sans", Georgia, serif;

  /* 60-30-10 Dark Azhari Palette */
  --bg-main: #06130e;
  --bg-surface: #0b1e16;
  --bg-card: #10291f;
  --bg-card-hover: #153528;
  --bg-elevated: #143226;
  --bg-glass: rgba(11, 30, 22, 0.92);
  --bg-navbar: rgba(6, 19, 14, 0.92);
  --bg-bottom-nav: rgba(8, 23, 17, 0.96);
  --bg-soft-panel: rgba(255, 255, 255, 0.035);

  --gold-200: #f6e7c1;
  --gold-300: #ebd194;
  --gold-400: #d6b262;
  --gold-500: #c49a3a;
  --gold-600: #9f7922;

  --emerald-accent: #10b981;
  --emerald-deep: #0b3d2c;
  --emerald-mid: #12503b;
  --success-text: #6ee7b7;
  --danger-text: #fecdd3;
  --warning-text: #fde68a;

  --text-primary: #f7f9f6;
  --text-secondary: #c5d7cd;
  --text-muted: #9ab5a7;

  --border-subtle: rgba(214, 178, 98, 0.2);
  --border-strong: rgba(214, 178, 98, 0.34);
  --border-gold: rgba(214, 178, 98, 0.48);

  --danger: #f43f5e;
  --success: #10b981;
  --warning: #d6b262;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 22px 54px rgba(0, 0, 0, 0.48);

  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;

  --nav-height: 64px;
  --ribbon-visible: 34px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-main: #f4f6f1;
  --bg-surface: #ffffff;
  --bg-card: #eef2ea;
  --bg-card-hover: #e3eadc;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.96);
  --bg-navbar: rgba(255, 255, 255, 0.95);
  --bg-bottom-nav: rgba(255, 255, 255, 0.98);
  --bg-soft-panel: rgba(11, 61, 44, 0.055);

  --gold-200: #5c3f06;
  --gold-300: #6e4e0a;
  --gold-400: #0b3d2c;
  --gold-500: #b58927;
  --gold-600: #876214;

  --emerald-accent: #0b5d42;
  --success-text: #065f46;
  --danger-text: #991b1b;
  --warning-text: #92400e;

  --text-primary: #0d1f17;
  --text-secondary: #2c4338;
  --text-muted: #4b6257;

  --border-subtle: rgba(11, 61, 44, 0.16);
  --border-strong: rgba(11, 61, 44, 0.3);
  --border-gold: rgba(154, 116, 31, 0.52);

  --danger: #b91c1c;
  --success: #0b3d2c;
  --warning: #92400e;

  --shadow-sm: 0 2px 10px rgba(11, 61, 44, 0.06);
  --shadow-md: 0 10px 26px rgba(11, 61, 44, 0.1);
  --shadow-lg: 0 20px 46px rgba(11, 61, 44, 0.16);
}

/* ============================================================================
   BASE & RESET
   ============================================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  background-image:
    radial-gradient(ellipse 65% 42% at 12% 0%, rgba(196, 154, 58, 0.08), transparent 62%),
    radial-gradient(ellipse 55% 40% at 88% 95%, rgba(16, 185, 129, 0.07), transparent 60%);
  color: var(--text-primary);
  min-height: 100dvh;
  direction: rtl;
  line-height: 1.65;
  font-feature-settings: "kern" 1;
  user-select: none;
  -webkit-user-select: none;
  text-rendering: optimizeLegibility;
}

body.modal-open,
body.drawer-open {
  overflow: hidden;
  touch-action: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  text-wrap: balance;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6, p, span, div, td, th, label, a, button {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

button, input, textarea, select {
  font-family: var(--font-sans);
}

input, textarea, select {
  user-select: text;
  -webkit-user-select: text;
  max-width: 100%;
}

a {
  color: inherit;
}

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

.amiri-font {
  font-family: var(--font-display);
}

.matn-serif-text {
  font-family: var(--font-serif);
}

.matn-svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.fade-in {
  animation: fadeInView 0.24s var(--ease-out);
}

@keyframes fadeInView {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================================
   TOP PROMOTIONAL RIBBON (Desktop only — hidden on mobile to protect viewport)
   ============================================================================ */

.top-ribbon {
  background: var(--emerald-deep);
  color: #f7f4eb;
  border-bottom: 1px solid rgba(214, 178, 98, 0.55);
  height: 34px;
  overflow: hidden;
  display: flex;
  align-items: center;
  position: relative;
  font-size: 0.78rem;
  font-weight: 500;
}

.marquee-track {
  display: flex;
  align-items: center;
  width: max-content;
  white-space: nowrap;
  animation: matnMarquee 36s linear infinite;
}

.top-ribbon:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-group {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  padding-inline-end: 24px;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.marquee-item svg {
  color: #ebd194;
}

.marquee-sep {
  color: rgba(235, 209, 148, 0.65);
  font-weight: 700;
}

@keyframes matnMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(50%); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   TOP NAVBAR (Compact single-row on both desktop & mobile)
   ============================================================================ */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--nav-height);
  background: var(--bg-navbar);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px clamp(12px, 3vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 2px 0;
  text-align: right;
  color: inherit;
  transition: opacity 0.18s var(--ease-out);
}

.brand-wrap:hover {
  opacity: 0.9;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--gold-500);
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(196, 154, 58, 0.22);
}

.brand-titles {
  min-width: 0;
}

.brand-titles h1 {
  font-family: var(--font-display);
  font-size: clamp(0.96rem, 2vw, 1.16rem);
  font-weight: 900;
  color: var(--gold-400);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-title-short {
  display: none;
}

.brand-titles p {
  font-size: 0.74rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-role-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-300);
  padding-inline: 10px;
  border-inline-end: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.nav-role-meta.is-active {
  color: var(--success-text);
}

.nav-role-meta.is-expired {
  color: var(--danger-text);
}

.nav-bell-btn {
  position: relative;
}

.navbar .nav-mobile-menu-btn {
  display: none;
}

.nav-reg-short {
  display: none;
}

.nav-auth-btn {
  white-space: nowrap;
}

.nav-notif-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.16s var(--ease-out), background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid transparent;
  text-decoration: none;
  text-align: center;
  line-height: 1.35;
  max-width: 100%;
  min-height: 40px;
}

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

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-block {
  width: 100%;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #061810;
  font-weight: 700;
  border-color: rgba(235, 209, 148, 0.35);
  box-shadow: 0 4px 14px rgba(196, 154, 58, 0.22);
}

.btn-gold:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 6px 18px rgba(196, 154, 58, 0.32);
}

[data-theme="light"] .btn-gold {
  background: linear-gradient(135deg, #0b3d2c, #12503b);
  color: #ffffff;
  border-color: rgba(196, 154, 58, 0.45);
  box-shadow: 0 4px 14px rgba(11, 61, 44, 0.2);
}

.btn-outline-gold {
  background: transparent;
  color: var(--gold-300);
  border-color: var(--border-gold);
}

.btn-outline-gold:hover:not(:disabled) {
  background: rgba(196, 154, 58, 0.12);
  border-color: var(--gold-500);
}

[data-theme="light"] .btn-outline-gold {
  color: #0b3d2c;
  border-color: rgba(11, 61, 44, 0.28);
}

[data-theme="light"] .btn-outline-gold:hover:not(:disabled) {
  background: rgba(11, 61, 44, 0.07);
  border-color: #0b3d2c;
}

.btn-ghost-subtle {
  background: var(--bg-soft-panel);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-ghost-subtle:hover:not(:disabled) {
  border-color: var(--border-gold);
  background: rgba(196, 154, 58, 0.08);
}

.btn-emerald {
  background: var(--emerald-deep);
  color: #f7f8f5;
  border-color: rgba(196, 154, 58, 0.42);
}

.btn-emerald:hover:not(:disabled) {
  background: var(--emerald-mid);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.16);
  color: var(--danger-text);
  border-color: rgba(244, 63, 94, 0.4);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.26);
}

[data-theme="light"] .btn-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

[data-theme="light"] .btn-danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #ef4444;
}

.btn-whatsapp {
  background: #0b4c35;
  color: #ffffff;
  border-color: rgba(196, 154, 58, 0.45);
  font-weight: 700;
}

.btn-whatsapp:hover:not(:disabled) {
  background: #0f5f43;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 9px;
  min-height: 36px;
}

/* ============================================================================
   HERO & LANDING PAGE
   ============================================================================ */

.hero-section {
  max-width: 1200px;
  width: calc(100% - 28px);
  margin: 20px auto 16px;
  padding: clamp(22px, 3.6vw, 42px);
  background: linear-gradient(155deg, var(--bg-surface) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  display: grid;
  grid-template-columns: 1.32fr 0.68fr;
  gap: clamp(20px, 3vw, 36px);
  align-items: center;
  position: relative;
  overflow: hidden;
}

.hero-content {
  min-width: 0;
}

/* Editorial Eyebrow — Zero-Pill Discipline */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-300);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--border-gold);
}

[data-theme="light"] .hero-eyebrow {
  color: #0b3d2c;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.4vw, 2.55rem);
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 12px;
}

.hero-title span {
  color: var(--gold-400);
}

.hero-title-accent {
  color: var(--gold-300);
}

[data-theme="light"] .hero-title-accent {
  color: #9a741f;
}

.hero-subtitle {
  font-size: clamp(0.92rem, 1.6vw, 1.02rem);
  color: var(--text-secondary);
  margin-bottom: 22px;
  max-width: 590px;
  line-height: 1.75;
}

.hero-cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.hero-metrics-strip {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.hero-metric-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hero-metric-item strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--gold-400);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.hero-metric-item span {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.hero-metric-sep {
  width: 1px;
  height: 28px;
  background: var(--border-subtle);
}

.hero-logo-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.hero-logo-frame {
  width: clamp(210px, 23vw, 276px);
  height: clamp(210px, 23vw, 276px);
  border-radius: 50%;
  padding: 6px;
  background: linear-gradient(135deg, var(--gold-300), var(--gold-600));
  box-shadow: 0 16px 46px rgba(196, 154, 58, 0.28);
}

.hero-logo-frame img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-main);
  display: block;
}

/* Courses Showcase — Architectural Editorial Grid + Stage Filter */
.courses-section {
  margin: 0 0 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.courses-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.courses-section-sub,
.section-subtitle-muted {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-top: 4px;
  margin-bottom: 4px;
}

.courses-stage-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.courses-stage-tabs::-webkit-scrollbar {
  display: none;
}

.stage-filter-btn {
  padding: 7px 14px;
  min-height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.stage-filter-btn:hover {
  color: var(--text-primary);
  background: var(--bg-soft-panel);
}

.stage-filter-btn.active {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #061810;
}

[data-theme="light"] .stage-filter-btn.active {
  background: #0b3d2c;
  color: #ffffff;
}

.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 272px), 1fr));
  gap: 16px;
}

.course-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-out), border-color 0.2s ease, box-shadow 0.2s ease;
}

.course-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-500), var(--emerald-accent));
  opacity: 0.45;
  transition: opacity 0.2s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold);
  box-shadow: var(--shadow-md);
}

.course-card:hover::before {
  opacity: 1;
}

.course-card-top {
  padding: 18px 18px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.course-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(196, 154, 58, 0.13);
  border: 1px solid var(--border-gold);
  color: var(--gold-300);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="light"] .course-card-icon {
  background: rgba(11, 61, 44, 0.08);
  border-color: rgba(11, 61, 44, 0.18);
  color: #0b3d2c;
}

.course-card-meta-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
}

.course-index {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gold-500);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.course-stage-caption {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: left;
}

.course-card-body {
  padding: 2px 18px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.course-card-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.3;
}

.course-card-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.course-card-syllabus {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.5;
}

.course-card-footer {
  padding: 12px 18px;
  background: var(--bg-soft-panel);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}

.course-instructor {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.course-instructor svg {
  color: var(--gold-500);
}

.course-cta-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--gold-400);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.83rem;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 7px;
  transition: background-color 0.16s ease, transform 0.16s ease;
}

.course-cta-link:hover {
  background: rgba(196, 154, 58, 0.12);
}

/* Editorial Pillars Strip */
.pillars-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 4px 0 24px;
}

.pillar-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.pillar-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(196, 154, 58, 0.12);
  color: var(--gold-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="light"] .pillar-icon {
  background: rgba(11, 61, 44, 0.08);
  color: #0b3d2c;
}

.pillar-item h4 {
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.pillar-item p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* Structured Multi-Column Editorial Footer */
.site-footer {
  margin-top: 28px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-gold);
}

.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 44px) clamp(16px, 3vw, 28px) 24px;
  display: grid;
  grid-template-columns: 1.45fr 1fr 1fr;
  gap: clamp(20px, 3vw, 40px);
}

.footer-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.footer-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-500);
  object-fit: cover;
  flex-shrink: 0;
}

.footer-brand-title {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--gold-400);
  line-height: 1.25;
}

.footer-brand-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.footer-mission {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.75;
  max-width: 420px;
}

.footer-col-title {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.footer-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 4px 0;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  text-align: right;
  cursor: pointer;
  transition: color 0.16s ease;
}

.footer-link-btn svg {
  color: var(--gold-500);
}

.footer-link-btn:hover {
  color: var(--gold-400);
}

.footer-info-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 4px;
}

.footer-info-note svg {
  color: var(--gold-500);
}

.site-footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px clamp(16px, 3vw, 28px) 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ============================================================================
   STANDALONE AUTH PAGES (#/login, #/register, #/forgot-password)
   ============================================================================ */

.auth-page-wrap {
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(18px, 3.6vw, 40px) clamp(12px, 3vw, 24px) 52px;
  min-height: calc(100dvh - var(--nav-height) - 34px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-split-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
}

.auth-split-card.is-wide {
  grid-template-columns: 1.32fr 0.78fr;
}

.auth-single-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: clamp(22px, 3.4vw, 34px);
}

.auth-form-pane {
  padding: clamp(22px, 3.4vw, 38px);
  display: flex;
  flex-direction: column;
}

.auth-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.auth-back-link,
.auth-switch-link,
.auth-text-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 2px;
  transition: color 0.16s ease;
}

.auth-back-link:hover,
.auth-switch-link:hover,
.auth-text-action:hover {
  color: var(--gold-400);
}

.auth-text-action {
  color: var(--gold-400);
}

.auth-heading-block {
  margin-bottom: 18px;
}

.auth-page-title {
  font-family: var(--font-display);
  font-size: clamp(1.38rem, 2.5vw, 1.78rem);
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 5px;
  line-height: 1.25;
}

.auth-page-subtitle {
  font-size: 0.87rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.auth-inline-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: -4px 0 14px;
}

.auth-submit-btn {
  min-height: 46px;
  font-size: 0.94rem;
}

.auth-privacy-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.6;
}

.auth-request-code-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.auth-bottom-switch {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.auth-brand-pane {
  background: linear-gradient(160deg, #0b3d2c 0%, #062118 100%);
  color: #f5f7f4;
  padding: clamp(26px, 3.6vw, 40px);
  border-inline-start: 1px solid rgba(214, 178, 98, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.auth-brand-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.auth-brand-logo {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid #d6b262;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.auth-brand-kicker {
  font-size: 0.76rem;
  font-weight: 700;
  color: #ebd194;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(214, 178, 98, 0.4);
}

.auth-brand-heading {
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.3;
}

.auth-brand-teacher {
  font-size: 0.88rem;
  color: #cfe0d7;
}

.auth-brand-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 6px;
  width: 100%;
}

.auth-brand-points li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.84rem;
  color: #e4efe9;
  line-height: 1.5;
}

.auth-brand-points svg {
  color: #ebd194;
  margin-top: 2px;
}

.auth-guide-btn {
  margin-top: 6px;
  color: #f6e7c1 !important;
  border-color: rgba(235, 209, 148, 0.45) !important;
}

.auth-guide-btn:hover {
  background: rgba(235, 209, 148, 0.14) !important;
}

/* ============================================================================
   APP SHELL (Executive Collapsible Sidebar Rail + Mobile RTL Slide-Over Drawer)
   ============================================================================ */

.app-shell {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  min-height: calc(100dvh - var(--nav-height) - var(--ribbon-visible, 0px));
  max-width: 1440px;
  margin: 0 auto;
  align-items: start;
  transition: grid-template-columns 0.22s var(--ease-out);
}

.sidebar-drawer-backdrop {
  display: none;
}

.app-sidebar {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  padding: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--nav-height);
  height: calc(100dvh - var(--nav-height) - var(--ribbon-visible, 0px));
  overflow: hidden;
  z-index: 30;
}

[data-theme="light"] .app-sidebar {
  background: #ffffff;
  border-left-color: rgba(15, 23, 42, 0.09);
  box-shadow: -1px 0 0 rgba(11, 61, 44, 0.03);
}

/* Anchored Editorial Profile Header */
.sidebar-header {
  padding: 15px 14px 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 46px;
  position: relative;
}

.sidebar-profile-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--border-gold);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-card);
}

[data-theme="light"] .sidebar-profile-avatar {
  border-color: rgba(11, 61, 44, 0.28);
  box-shadow: 0 2px 8px rgba(11, 61, 44, 0.1);
}

.sidebar-profile-meta {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-profile-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.sidebar-profile-sub {
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-status-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.71rem;
  font-weight: 700;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.sidebar-status-line.is-active {
  color: var(--success-text);
}

.sidebar-status-line.is-expired {
  color: var(--danger-text);
}

.sidebar-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--bg-soft-panel);
  border-color: var(--border-gold);
  color: var(--gold-300);
}

[data-theme="light"] .sidebar-collapse-btn {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

[data-theme="light"] .sidebar-collapse-btn:hover {
  background: rgba(11, 61, 44, 0.08);
  border-color: rgba(11, 61, 44, 0.28);
  color: #0b3d2c;
}

.sidebar-collapse-btn svg {
  transition: transform 0.2s var(--ease-out);
}

.sidebar-drawer-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.sidebar-drawer-close:hover {
  background: var(--bg-soft-panel);
  color: var(--text-primary);
}

/* Scrollable Navigation Body */
.sidebar-scroll-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 154, 58, 0.26) transparent;
}

.sidebar-scroll-body::-webkit-scrollbar {
  width: 4px;
}

.sidebar-scroll-body::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(196, 154, 58, 0.26);
  border-radius: 999px;
}

[data-theme="light"] .sidebar-scroll-body {
  scrollbar-color: rgba(11, 61, 44, 0.18) transparent;
}

[data-theme="light"] .sidebar-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(11, 61, 44, 0.18);
}

.sidebar-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-group + .sidebar-group {
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 10px 4px;
  letter-spacing: 0.015em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Executive Sidebar Links with Icon Tiles */
.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  border-radius: 11px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.855rem;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
  text-align: right;
  width: 100%;
  min-height: 42px;
}

.sidebar-link .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

[data-theme="light"] .sidebar-link .nav-icon {
  background: rgba(15, 23, 42, 0.045);
  color: #475569;
}

.sidebar-link:hover {
  background: var(--bg-soft-panel);
  color: var(--text-primary);
}

.sidebar-link:hover .nav-icon {
  background: rgba(196, 154, 58, 0.14);
  color: var(--gold-300);
}

[data-theme="light"] .sidebar-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .sidebar-link:hover .nav-icon {
  background: rgba(11, 61, 44, 0.1);
  color: #0b3d2c;
}

/* Refined Active State (Subtle Tinted Row + Illuminated Icon Tile) */
.sidebar-link.active {
  background: rgba(196, 154, 58, 0.12);
  border-color: rgba(196, 154, 58, 0.34);
  color: #f6e7c1;
  font-weight: 700;
}

.sidebar-link.active .nav-icon {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #061810;
  box-shadow: 0 3px 10px rgba(196, 154, 58, 0.28);
}

[data-theme="light"] .sidebar-link.active {
  background: rgba(11, 61, 44, 0.085);
  border-color: rgba(11, 61, 44, 0.22);
  color: #083022;
  font-weight: 700;
}

[data-theme="light"] .sidebar-link.active .nav-icon {
  background: linear-gradient(135deg, #0b3d2c, #13553e);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(11, 61, 44, 0.2);
}

/* Student Subject Selection State */
.sidebar-link.is-sub-active {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.28);
  color: #a7f3d0;
  font-weight: 700;
}

.sidebar-link.is-sub-active .nav-icon {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

[data-theme="light"] .sidebar-link.is-sub-active {
  background: rgba(180, 126, 20, 0.09);
  border-color: rgba(180, 126, 20, 0.26);
  color: #74500c;
  font-weight: 700;
}

[data-theme="light"] .sidebar-link.is-sub-active .nav-icon {
  background: rgba(180, 126, 20, 0.16);
  color: #8b5e0c;
}

.sidebar-link-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Clean Unboxed Tabular Counts (Semantic Highlights Only for Alerts) */
.sidebar-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.sidebar-link:hover .sidebar-count {
  color: var(--text-secondary);
}

.sidebar-link.active .sidebar-count {
  color: var(--gold-300);
}

[data-theme="light"] .sidebar-link.active .sidebar-count {
  color: #0b3d2c;
}

.sidebar-count.is-accent {
  min-width: 22px;
  padding: 0 6px;
  background: rgba(196, 154, 58, 0.16);
  border-color: rgba(196, 154, 58, 0.34);
  color: var(--gold-300);
}

[data-theme="light"] .sidebar-count.is-accent {
  background: rgba(180, 126, 20, 0.13);
  border-color: rgba(180, 126, 20, 0.32);
  color: #855a0a;
}

.sidebar-count.is-danger {
  min-width: 22px;
  padding: 0 6px;
  background: rgba(244, 63, 94, 0.15);
  border-color: rgba(244, 63, 94, 0.36);
  color: var(--danger-text);
}

[data-theme="light"] .sidebar-count.is-danger {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.28);
  color: #b91c1c;
}

/* Anchored Sidebar Footer */
.sidebar-footer {
  padding: 12px 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

[data-theme="light"] .sidebar-footer {
  background: #ffffff;
}

.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-refresh-btn {
  flex: 1;
  min-width: 0;
  justify-content: center;
}

.sidebar-guide-quick-btn {
  width: 36px;
  height: 36px;
  padding: 0 !important;
  flex-shrink: 0;
  border-radius: 9px;
  border: 1px solid var(--border-subtle) !important;
  background: var(--bg-card) !important;
  color: var(--text-secondary) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-guide-quick-btn:hover {
  border-color: var(--border-gold) !important;
  color: var(--gold-300) !important;
  background: rgba(196, 154, 58, 0.12) !important;
}

[data-theme="light"] .sidebar-guide-quick-btn {
  background: #f8fafc !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  color: #475569 !important;
}

[data-theme="light"] .sidebar-guide-quick-btn:hover {
  border-color: rgba(11, 61, 44, 0.32) !important;
  background: rgba(11, 61, 44, 0.08) !important;
  color: #0b3d2c !important;
}

.sidebar-security-note {
  font-size: 0.73rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Desktop Collapsible Mini-Icon Rail (> 920px only) */
@media (min-width: 921px) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .app-shell.sidebar-collapsed .sidebar-header {
    padding: 12px 10px;
  }

  .app-shell.sidebar-collapsed .sidebar-profile {
    flex-direction: column;
    gap: 8px;
    justify-content: center;
  }

  .app-shell.sidebar-collapsed .sidebar-profile-avatar {
    width: 38px;
    height: 38px;
  }

  .app-shell.sidebar-collapsed .sidebar-profile-meta {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
  }

  .app-shell.sidebar-collapsed .sidebar-scroll-body {
    padding: 12px 8px;
    gap: 10px;
    align-items: center;
  }

  .app-shell.sidebar-collapsed .sidebar-group {
    width: 100%;
    align-items: center;
    gap: 4px;
  }

  .app-shell.sidebar-collapsed .sidebar-group + .sidebar-group {
    padding-top: 10px;
  }

  .app-shell.sidebar-collapsed .sidebar-group-label {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-nav {
    width: 100%;
    align-items: center;
    gap: 4px;
  }

  .app-shell.sidebar-collapsed .sidebar-link {
    width: 46px;
    height: 46px;
    min-height: 46px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
  }

  .app-shell.sidebar-collapsed .sidebar-link .nav-icon {
    width: 34px;
    height: 34px;
  }

  .app-shell.sidebar-collapsed .sidebar-link:not(.active):not(.is-sub-active) .nav-icon {
    background: transparent;
  }

  .app-shell.sidebar-collapsed .sidebar-link:not(.active):not(.is-sub-active):hover .nav-icon {
    background: rgba(196, 154, 58, 0.14);
  }

  [data-theme="light"] .app-shell.sidebar-collapsed .sidebar-link:not(.active):not(.is-sub-active):hover .nav-icon {
    background: rgba(11, 61, 44, 0.1);
  }

  .app-shell.sidebar-collapsed .sidebar-link-label {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-count {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-count.is-accent,
  .app-shell.sidebar-collapsed .sidebar-count.is-danger {
    display: inline-flex;
    position: absolute;
    top: 2px;
    left: 2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    font-size: 0.62rem;
    border-radius: 999px;
    line-height: 1;
  }

  .app-shell.sidebar-collapsed .sidebar-footer {
    padding: 10px 8px 12px;
    align-items: center;
  }

  .app-shell.sidebar-collapsed .sidebar-footer-actions {
    flex-direction: column;
    width: 100%;
    gap: 6px;
  }

  .app-shell.sidebar-collapsed .sidebar-footer-label {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-refresh-btn,
  .app-shell.sidebar-collapsed .sidebar-support-btn,
  .app-shell.sidebar-collapsed .sidebar-guide-quick-btn {
    width: 42px;
    height: 38px;
    padding: 0 !important;
    justify-content: center;
  }

  .app-shell.sidebar-collapsed .sidebar-security-note {
    display: none;
  }
}

.app-main {
  padding: clamp(14px, 2.8vw, 28px);
  padding-bottom: 92px;
  min-width: 0;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 110;
  background: var(--bg-bottom-nav);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.14);
  padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
}

.mobile-nav-item {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px 4px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.mobile-nav-item.active {
  color: var(--gold-300);
  background: rgba(196, 154, 58, 0.1);
}

.mobile-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 2.5px;
  border-radius: 999px;
  background: var(--gold-400);
}

[data-theme="light"] .mobile-nav-item.active {
  color: #0b3d2c;
  background: rgba(11, 61, 44, 0.08);
}

[data-theme="light"] .mobile-nav-item.active::before {
  background: #0b3d2c;
}

.mobile-nav-item span:last-child {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Mobile Scrollable Admin Tabs */
.mobile-admin-tabs {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  margin-bottom: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.mobile-admin-tabs::-webkit-scrollbar {
  display: none;
}

.mobile-admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 8px 13px;
  min-height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.mobile-admin-chip.active {
  background: var(--gold-500);
  color: #061810;
  border-color: var(--gold-500);
}

[data-theme="light"] .mobile-admin-chip.active {
  background: #0b3d2c;
  color: #ffffff;
  border-color: #0b3d2c;
}

/* ============================================================================
   CARDS, CONTAINERS & GRIDS
   ============================================================================ */

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 14px clamp(12px, 3vw, 24px) 72px;
}

.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(14px, 2.6vw, 24px);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.04rem, 2.1vw, 1.24rem);
  font-weight: 900;
  color: var(--gold-400);
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 195px), 1fr));
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 255px), 1fr));
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: 16px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 195px), 1fr));
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 155px), 1fr));
  gap: 10px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-box .stat-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-box .stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.5vw, 1.65rem);
  font-weight: 900;
  color: var(--gold-400);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}

/* Student In-Portal Course Selector Grid */
.student-courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 165px), 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.student-course-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px 13px;
  text-align: right;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), border-color 0.18s ease, background-color 0.18s ease;
  color: var(--text-primary);
}

.student-course-card:hover {
  border-color: var(--gold-500);
  transform: translateY(-1px);
}

.student-course-card.active {
  background: var(--emerald-deep);
  color: #ffffff;
  border-color: var(--gold-500);
  box-shadow: 0 6px 16px rgba(11, 61, 44, 0.24);
}

.student-course-card.active .student-course-count {
  color: #f0d79c;
}

.student-course-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.student-course-icon {
  color: var(--gold-500);
  display: inline-flex;
}

.student-course-count {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.student-course-name {
  font-weight: 700;
  font-size: 0.9rem;
}

/* Subject Filter Tabs */
.tabs-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 15px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
}

.tab-btn:hover {
  border-color: var(--gold-500);
  color: var(--text-primary);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #061810;
  border-color: transparent;
}

[data-theme="light"] .tab-btn.active {
  background: #0b3d2c;
  color: #ffffff;
}

/* Lesson Cards */
.lesson-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 13px;
  transition: transform 0.18s var(--ease-out), border-color 0.18s ease;
}

.lesson-card:hover:not(.locked) {
  transform: translateY(-2px);
  border-color: var(--border-gold);
}

.lesson-card.locked {
  background: rgba(244, 63, 94, 0.055);
  border-color: rgba(244, 63, 94, 0.3);
}

.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.assessment-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-soft-panel);
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* Status Indicators & Badges (Clean Hairline Style) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  max-width: 100%;
  white-space: normal;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.badge-gold {
  background: rgba(196, 154, 58, 0.18);
  color: var(--gold-200);
  border: 1px solid rgba(214, 178, 98, 0.42);
}

.badge-success {
  background: rgba(16, 185, 129, 0.18);
  color: var(--success-text);
  border: 1px solid rgba(16, 185, 129, 0.42);
}

.badge-danger {
  background: rgba(244, 63, 94, 0.18);
  color: var(--danger-text);
  border: 1px solid rgba(244, 63, 94, 0.42);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.18);
  color: var(--warning-text);
  border: 1px solid rgba(245, 158, 11, 0.42);
}

[data-theme="light"] .badge-gold {
  background: #fef3c7;
  color: #6e4e0a;
  border-color: #d97706;
}

[data-theme="light"] .badge-success {
  background: #d1fae5;
  color: #065f46;
  border-color: #10b981;
}

[data-theme="light"] .badge-danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #ef4444;
}

[data-theme="light"] .badge-warning {
  background: #ffedd5;
  color: #9a3412;
  border-color: #f97316;
}

/* ============================================================================
   FORMS & UPLOAD DROPZONES
   ============================================================================ */

.form-group {
  margin-bottom: 13px;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--gold-300);
  margin-bottom: 6px;
}

[data-theme="light"] .form-group label {
  color: #0b3d2c;
}

.form-control {
  width: 100%;
  padding: 10px 13px;
  min-height: 44px;
  background: var(--bg-main);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: var(--font-sans);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control::placeholder {
  color: var(--text-muted);
  opacity: 0.95;
}

[data-theme="light"] .form-control {
  background: #ffffff;
  border-color: rgba(11, 61, 44, 0.24);
  color: #0d1f17;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(196, 154, 58, 0.2);
}

.upload-zone {
  background: var(--bg-soft-panel);
  border: 1.5px dashed var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 15px;
  text-align: center;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.upload-zone:hover {
  background: rgba(196, 154, 58, 0.06);
  border-color: var(--gold-500);
}

/* ============================================================================
   PROTECTED VIDEO STUDIO & PDF VIEWER
   ============================================================================ */

.protected-player-wrapper {
  width: 100%;
  background: #000000;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.protected-player-wrapper:fullscreen,
.protected-player-wrapper:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  justify-content: space-between;
}

.video-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  overflow: hidden;
  flex: 1;
}

.protected-video-element,
.protected-canvas-stream {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.dynamic-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-16deg);
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.32);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.65);
  padding: 6px 14px;
  font-size: clamp(0.78rem, 2vw, 1.15rem);
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.anti-capture-curtain {
  position: absolute;
  inset: 0;
  z-index: 45;
  background: rgba(5, 17, 12, 0.97);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--gold-400);
}

.anti-capture-curtain.active {
  display: flex;
}

.custom-video-controls {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.progress-slider {
  flex: 1;
  min-width: 110px;
  accent-color: var(--gold-500);
  cursor: pointer;
}

.protected-pdf-viewer {
  position: relative;
  background: #0c1914;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: clamp(12px, 2.5vw, 24px);
  max-height: 76dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

[data-theme="light"] .protected-pdf-viewer {
  background: #eae6da;
}

.pdf-page-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto 18px;
  background: #fcf9f2;
  color: #12241b;
  border: 1.5px solid #0b3d2c;
  border-radius: 10px;
  padding: clamp(16px, 4vw, 32px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  font-family: var(--font-serif);
}

.pdf-page-watermark-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  overflow: hidden;
}

.pdf-page-watermark-overlay span {
  transform: rotate(-24deg);
  font-size: clamp(0.82rem, 2vw, 1.15rem);
  font-weight: 900;
  color: rgba(11, 61, 44, 0.07);
  text-align: center;
}

/* ============================================================================
   EXAM ARENA & QUESTION NAVIGATOR
   ============================================================================ */

.exam-timer-bar {
  position: sticky;
  top: var(--nav-height);
  z-index: 80;
  background: var(--bg-surface);
  border: 1.5px solid var(--gold-500);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  box-shadow: var(--shadow-md);
  font-variant-numeric: tabular-nums;
}

.question-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(14px, 2.5vw, 20px);
  margin-bottom: 14px;
}

.option-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-subtle);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
  font-weight: 500;
  min-height: 46px;
}

.option-label:hover,
.option-label.selected {
  background: rgba(196, 154, 58, 0.14);
  border-color: var(--gold-500);
  color: var(--text-primary);
}

.option-letter-circle {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--gold-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.qnav-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 16px;
}

.qnav-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.qnav-pill {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.qnav-pill:hover {
  transform: translateY(-1px);
  border-color: var(--gold-500);
}

.qnav-pill.answered {
  background: rgba(16, 185, 129, 0.16);
  border-color: #10b981;
  color: var(--success-text);
}

.qnav-pill.flagged {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: var(--warning-text);
}

/* ============================================================================
   TABLES & SCRATCH CARDS
   ============================================================================ */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.matn-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.matn-table th,
.matn-table td {
  padding: 11px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.matn-table th {
  background: var(--bg-main);
  color: var(--gold-400);
  font-weight: 700;
  white-space: nowrap;
}

.matn-table tbody tr:hover {
  background: var(--bg-soft-panel);
}

.voucher-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 255px), 1fr));
  gap: 14px;
}

.scratch-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 15px;
}

.scratch-code-box {
  background: #fcf9f2;
  color: #061810;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 9px;
  border-radius: 8px;
  border: 1.5px dashed var(--gold-600);
  margin: 10px 0;
}

/* ============================================================================
   GAMIFICATION, NOTES, FILTERS & CHARTS
   ============================================================================ */

.gamification-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.streak-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-surface));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.badge-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.77rem;
  font-weight: 700;
  background: rgba(196, 154, 58, 0.14);
  border: 1px solid var(--border-gold);
  color: var(--gold-300);
}

.badge-chip.locked {
  opacity: 0.45;
  background: var(--bg-soft-panel);
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.lesson-filters-bar {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.lesson-notes-panel {
  margin-top: 16px;
}

.note-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 11px;
  padding: 10px 13px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.note-ts-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(196, 154, 58, 0.15);
  border: 1px solid var(--border-gold);
  color: var(--gold-300);
  padding: 4px 10px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-500), var(--emerald-accent));
  transition: width 0.35s var(--ease-out);
}

/* Skeleton Loaders */
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-line {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--bg-surface) 25%, var(--border-subtle) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.35s infinite linear;
}

.skeleton-line.lg { height: 22px; width: 65%; }
.skeleton-line.sm { height: 11px; width: 40%; }

/* ============================================================================
   ADMIN PAGE TOPBAR, CONTEXTUAL STEP-BY-STEP GUIDE & EXAMS STUDIO
   ============================================================================ */

.admin-page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.admin-page-topbar-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.admin-page-topbar-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(196, 154, 58, 0.18);
  border: 1px solid var(--border-gold);
  color: var(--gold-300);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="light"] .admin-page-topbar-icon {
  background: #e6f2ec;
  border-color: rgba(11, 61, 44, 0.24);
  color: #0b3d2c;
}

.admin-page-topbar-text {
  min-width: 0;
}

.admin-page-topbar-text h2 {
  font-family: var(--font-display);
  font-size: clamp(1.06rem, 2vw, 1.28rem);
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 2px;
}

.admin-page-topbar-text p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.admin-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  min-height: 40px;
  border-radius: var(--radius-md);
  background: rgba(214, 178, 98, 0.16);
  border: 1.5px solid var(--gold-400);
  color: var(--gold-200);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.16s var(--ease-out), background-color 0.18s ease, box-shadow 0.18s ease;
}

.admin-help-btn:hover {
  transform: translateY(-1px);
  background: rgba(214, 178, 98, 0.28);
  box-shadow: 0 4px 14px rgba(196, 154, 58, 0.24);
}

[data-theme="light"] .admin-help-btn {
  background: #0b3d2c;
  border-color: #0b3d2c;
  color: #ffffff;
}

[data-theme="light"] .admin-help-btn:hover {
  background: #12503b;
  box-shadow: 0 4px 14px rgba(11, 61, 44, 0.22);
}

/* Theme-Aware High-Contrast Admin Alerts & Previews */
.admin-alert-warning {
  background: rgba(245, 158, 11, 0.14);
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  border-radius: var(--radius-md);
  padding: 12px 15px;
  margin-bottom: 16px;
  color: var(--warning-text);
}

[data-theme="light"] .admin-alert-warning {
  background: #fffbeb;
  border-color: #d97706;
  color: #78350f;
}

.admin-alert-danger {
  background: rgba(244, 63, 94, 0.16);
  border: 1.5px solid rgba(244, 63, 94, 0.55);
  border-radius: var(--radius-md);
  padding: 12px 15px;
  margin-bottom: 16px;
  color: var(--danger-text);
}

[data-theme="light"] .admin-alert-danger {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
}

.admin-alert-title {
  font-weight: 800;
  font-size: 0.86rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.55;
}

.admin-alert-desc {
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-top: 5px;
  opacity: 0.92;
}

.admin-code-preview {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  padding: 12px 14px;
  border-radius: 10px;
}

/* Contextual Step-by-Step Guide Modal */
.guide-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.guide-modal-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
}

.guide-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: rgba(196, 154, 58, 0.18);
  border: 1px solid var(--border-gold);
  color: var(--gold-300);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="light"] .guide-modal-icon {
  background: #e6f2ec;
  border-color: rgba(11, 61, 44, 0.25);
  color: #0b3d2c;
}

.guide-modal-title {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 3px;
}

.guide-modal-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.guide-steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-step-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.guide-step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #061810;
  font-family: var(--font-display);
  font-size: 0.94rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

[data-theme="light"] .guide-step-num {
  background: #0b3d2c;
  color: #ffffff;
}

.guide-step-body strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.guide-step-body p {
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.guide-tip-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 11px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.36);
  color: var(--text-primary);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.83rem;
  line-height: 1.6;
}

.guide-tip-icon {
  color: var(--success-text);
  flex-shrink: 0;
  margin-top: 2px;
}

[data-theme="light"] .guide-tip-box {
  background: #ecfdf5;
  border-color: #10b981;
  color: #064e3b;
}

/* Admin Exams & Homework Studio */
.exam-studio-tabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  margin-bottom: 16px;
  max-width: 100%;
  flex-wrap: wrap;
}

.exam-studio-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 42px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.exam-studio-tab:hover {
  background: var(--bg-soft-panel);
  color: var(--text-primary);
}

.exam-studio-tab.active {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #061810;
}

[data-theme="light"] .exam-studio-tab.active {
  background: #0b3d2c;
  color: #ffffff;
}

.exam-studio-toolbar {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.exam-search-wrap {
  position: relative;
}

.exam-search-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: inline-flex;
}

.exam-search-wrap .form-control {
  padding-right: 38px;
}

.exam-studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 315px), 1fr));
  gap: 14px;
}

.exam-studio-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s var(--ease-out), border-color 0.18s ease, box-shadow 0.18s ease;
}

.exam-studio-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-gold);
  box-shadow: var(--shadow-sm);
}

.exam-studio-card.is-hidden-exam {
  border-style: dashed;
  opacity: 0.88;
}

.exam-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.exam-card-id {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.exam-card-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1.38;
}

.exam-card-lesson {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--gold-300);
}

[data-theme="light"] .exam-card-lesson {
  color: #0b3d2c;
}

.exam-card-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.exam-card-meta-chips span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.exam-card-stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.exam-mini-stat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.exam-mini-stat strong {
  color: var(--text-primary);
  font-weight: 900;
}

.exam-card-schedule {
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: var(--bg-soft-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.exam-card-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 6px;
}

.exam-empty-state {
  text-align: center;
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.exam-empty-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  color: var(--gold-400);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.exam-empty-state h4 {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.exam-empty-state p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 420px;
}

.exam-builder-step {
  background: var(--bg-soft-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(14px, 2.2vw, 20px);
  margin-bottom: 16px;
}

.exam-step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.exam-step-num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: #061810;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="light"] .exam-step-num {
  background: #0b3d2c;
  color: #ffffff;
}

.exam-step-head h4 {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.exam-step-head p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.exam-summary-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.exam-summary-bar strong {
  color: var(--gold-400);
  font-weight: 900;
}

.exam-summary-sep {
  color: var(--border-gold);
}

.exam-builder-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.admin-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.q-row-num-pill {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(196, 154, 58, 0.2);
  border: 1px solid var(--border-gold);
  color: var(--gold-300);
  font-weight: 900;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

[data-theme="light"] .q-row-num-pill {
  background: #e6f2ec;
  border-color: #0b3d2c;
  color: #0b3d2c;
}

.q-correct-field label {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  color: var(--success-text) !important;
}

.q-correct-field .form-control {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.08);
}

[data-theme="light"] .q-correct-field .form-control {
  border-color: #059669;
  background: #ecfdf5;
  color: #064e3b;
}

/* ============================================================================
   INLINE-EDITABLE QUESTIONS DATA TABLE (Admin Exams Studio)
   ============================================================================ */

.q-inline-workspace {
  padding: 18px 20px;
}

.q-workspace-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.q-workspace-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.q-meta-strip {
  display: grid;
  grid-template-columns: minmax(210px, 1.8fr) minmax(135px, 1fr) 96px repeat(2, minmax(155px, 1.1fr));
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  margin-bottom: 16px;
}

[data-theme="light"] .q-meta-strip {
  background: #f8faf6;
  border-color: rgba(15, 23, 42, 0.1);
}

.q-meta-strip .form-group {
  margin-bottom: 0;
}

.q-meta-strip label {
  font-size: 0.74rem;
  margin-bottom: 4px;
}

.q-meta-strip .form-control {
  padding: 7px 10px;
  font-size: 0.83rem;
}

.q-inline-table-shell {
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--bg-surface);
  overflow: hidden;
}

[data-theme="light"] .q-inline-table-shell {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.q-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .q-table-toolbar {
  background: #f6f8f4;
  border-bottom-color: rgba(15, 23, 42, 0.09);
}

.q-table-toolbar-start {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 240px;
}

.q-table-search-wrap {
  position: relative;
  flex: 1;
  min-width: 190px;
  max-width: 310px;
}

.q-table-search-icon {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: inline-flex;
}

.q-table-search-input {
  padding: 7px 32px 7px 10px !important;
  font-size: 0.8rem !important;
  min-height: 35px;
}

.q-table-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.q-table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 62vh;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 154, 58, 0.28) transparent;
}

.q-inline-table-shell.is-compact .q-table-scroll {
  max-height: 44vh;
}

.q-inline-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
}

.q-inline-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: right;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

[data-theme="light"] .q-inline-table thead th {
  background: #edf2ea;
  color: #1e293b;
  border-bottom-color: rgba(15, 23, 42, 0.14);
}

.q-th-idx { width: 56px; text-align: center !important; }
.q-th-question { width: 35%; }
.q-th-type { width: 120px; }
.q-th-options { width: 37%; }
.q-th-points { width: 74px; text-align: center !important; }
.q-th-actions { width: 82px; text-align: center !important; }

.q-inline-table tbody tr.admin-q-row {
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.14s ease;
}

.q-inline-table tbody tr.admin-q-row:hover {
  background: rgba(196, 154, 58, 0.045);
}

.q-inline-table tbody tr.admin-q-row:focus-within {
  background: rgba(196, 154, 58, 0.07);
}

[data-theme="light"] .q-inline-table tbody tr.admin-q-row {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .q-inline-table tbody tr.admin-q-row:hover {
  background: rgba(11, 61, 44, 0.03);
}

[data-theme="light"] .q-inline-table tbody tr.admin-q-row:focus-within {
  background: rgba(11, 61, 44, 0.055);
}

.q-inline-table tbody td {
  padding: 9px 8px;
  vertical-align: top;
}

/* Column 1: Index + Reorder */
.q-idx-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.q-reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.q-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.q-icon-btn.q-move-btn {
  width: 24px;
  height: 20px;
  border-radius: 5px;
  background: transparent;
  border-color: transparent;
}

.q-icon-btn:hover {
  background: rgba(196, 154, 58, 0.15);
  border-color: var(--border-gold);
  color: var(--gold-300);
}

.q-icon-btn.is-danger:hover {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.45);
  color: var(--danger-text);
}

[data-theme="light"] .q-icon-btn {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

[data-theme="light"] .q-icon-btn.q-move-btn {
  background: transparent;
  border-color: transparent;
}

[data-theme="light"] .q-icon-btn:hover {
  background: rgba(11, 61, 44, 0.09);
  border-color: rgba(11, 61, 44, 0.28);
  color: #0b3d2c;
}

[data-theme="light"] .q-icon-btn.is-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* Column 2: Question Text + Topic + Explanation */
.q-cell-textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.45;
  transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.q-cell-textarea:hover {
  border-color: var(--border-subtle);
  background: var(--bg-card);
}

.q-cell-textarea:focus {
  outline: none;
  border-color: var(--gold-400);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px rgba(214, 178, 98, 0.18);
}

[data-theme="light"] .q-cell-textarea {
  background: #f8faf7;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.08);
}

[data-theme="light"] .q-cell-textarea:focus {
  background: #ffffff;
  border-color: #0b3d2c;
  box-shadow: 0 0 0 2px rgba(11, 61, 44, 0.12);
}

.q-sub-fields {
  display: grid;
  grid-template-columns: minmax(110px, 0.85fr) minmax(130px, 1.15fr);
  gap: 6px;
  margin-top: 6px;
}

.q-cell-sub {
  width: 100%;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

.q-cell-sub:focus {
  outline: none;
  border-color: var(--gold-400);
  background: var(--bg-card);
  color: var(--text-primary);
}

[data-theme="light"] .q-cell-sub {
  border-color: rgba(15, 23, 42, 0.11);
  color: #334155;
  background: #ffffff;
}

[data-theme="light"] .q-cell-sub:focus {
  border-color: #0b3d2c;
  color: #0f172a;
}

/* Column 3: Question Type */
.q-cell-select {
  width: 100%;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.q-cell-select:focus {
  outline: none;
  border-color: var(--gold-400);
}

[data-theme="light"] .q-cell-select {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

/* Column 4: Options 2x2 Inline Grid + True/False Toggle */
.q-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.q-opt-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 4px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.q-opt-item:focus-within {
  border-color: var(--gold-400);
  background: var(--bg-card);
}

.q-opt-item.is-correct {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.1);
}

.q-opt-item.is-correct:focus-within {
  border-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}

[data-theme="light"] .q-opt-item {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
}

[data-theme="light"] .q-opt-item.is-correct {
  background: #ecfdf5;
  border-color: #059669;
}

.q-opt-tag {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

[data-theme="light"] .q-opt-tag {
  background: #f1f5f9;
  color: #475569;
}

.q-opt-tag.is-correct {
  background: #10b981;
  color: #052e16;
}

[data-theme="light"] .q-opt-tag.is-correct {
  background: #059669;
  color: #ffffff;
}

.q-cell-opt {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.79rem;
  font-weight: 600;
  padding: 5px 2px;
}

.q-cell-opt:focus {
  outline: none;
}

.q-opt-item.is-correct .q-cell-opt {
  font-weight: 700;
}

[data-theme="light"] .q-opt-item.is-correct .q-cell-opt {
  color: #064e3b;
}

.q-tf-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.q-tf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.q-tf-btn.is-true.is-selected {
  background: rgba(16, 185, 129, 0.18);
  border-color: #10b981;
  color: #6ee7b7;
}

.q-tf-btn.is-false.is-selected {
  background: rgba(244, 63, 94, 0.18);
  border-color: #f43f5e;
  color: #fecdd3;
}

[data-theme="light"] .q-tf-btn {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}

[data-theme="light"] .q-tf-btn.is-true.is-selected {
  background: #ecfdf5;
  border-color: #059669;
  color: #065f46;
}

[data-theme="light"] .q-tf-btn.is-false.is-selected {
  background: #fef2f2;
  border-color: #dc2626;
  color: #991b1b;
}

/* Column 5: Points */
.q-cell-points {
  width: 58px;
  padding: 7px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  margin: 0 auto;
  display: block;
}

.q-cell-points:focus {
  outline: none;
  border-color: var(--gold-400);
}

[data-theme="light"] .q-cell-points {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

/* Column 6: Row Actions */
.q-row-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Bottom Quick-Add Bar */
.q-table-quickadd {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 14px;
  border: none;
  border-top: 1px dashed var(--border-gold);
  background: rgba(196, 154, 58, 0.06);
  color: var(--gold-300);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.q-table-quickadd:hover {
  background: rgba(196, 154, 58, 0.14);
  color: var(--gold-200);
}

[data-theme="light"] .q-table-quickadd {
  border-top-color: rgba(11, 61, 44, 0.28);
  background: #f4f8f5;
  color: #0b3d2c;
}

[data-theme="light"] .q-table-quickadd:hover {
  background: #e6f2ec;
  color: #07291d;
}

/* ============================================================================
   MODALS & TOAST NOTIFICATIONS
   ============================================================================ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 10, 7, 0.84);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 2.5vw, 20px);
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-xl);
  max-width: 620px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: clamp(16px, 3vw, 26px);
  box-shadow: var(--shadow-lg);
  animation: fadeInView 0.22s var(--ease-out);
}

.toast-container {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.toast-container > * {
  pointer-events: auto;
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS (Tablet & Mobile Polish)
   ============================================================================ */

@media (max-width: 980px) {
  .pillars-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer-inner {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand-col {
    grid-column: 1 / -1;
  }
}

@media (max-width: 920px) {
  .hero-section {
    grid-template-columns: 1fr;
  }

  .hero-logo-showcase {
    order: -1;
  }

  .hero-logo-frame {
    width: 172px;
    height: 172px;
  }

  .auth-split-card,
  .auth-split-card.is-wide {
    grid-template-columns: 1fr;
  }

  .auth-brand-pane {
    display: none;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .navbar .nav-mobile-menu-btn {
    display: inline-flex;
    min-width: 36px;
    padding: 6px 8px !important;
  }

  .sidebar-drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(2, 10, 7, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .sidebar-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  .app-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 260;
    width: min(310px, 86vw);
    height: 100dvh;
    border: none;
    border-radius: 18px 0 0 18px;
    box-shadow: -1px 0 0 var(--border-gold), -12px 0 36px rgba(0, 0, 0, 0.36);
    transform: translateX(108%);
    transition: transform 0.26s var(--ease-out);
    isolation: isolate;
  }

  .app-sidebar.drawer-open {
    transform: translateX(0);
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .sidebar-drawer-close {
    display: inline-flex;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .mobile-admin-tabs {
    display: flex;
  }

  .app-main {
    padding: 14px 12px calc(86px + env(safe-area-inset-bottom, 0px));
  }

  .toast-container {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-height: 56px;
  }

  /* Hide top promotional marquee on mobile so sticky chrome stays <= 14% of viewport */
  .top-ribbon {
    display: none;
  }

  .navbar {
    min-height: 56px;
    padding: 6px 10px;
    gap: 6px;
  }

  .brand-wrap {
    gap: 8px;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .brand-titles h1 {
    font-size: 0.94rem;
  }

  .nav-title-full {
    display: none;
  }

  .nav-title-short {
    display: inline;
  }

  .brand-titles p {
    display: none;
  }

  .nav-desktop-only,
  .nav-label-desktop {
    display: none !important;
  }

  .nav-actions {
    gap: 5px;
  }

  .nav-actions .btn-sm {
    padding: 6px 9px;
    min-height: 36px;
    font-size: 0.76rem;
    gap: 5px;
  }

  .nav-icon-toggle,
  .nav-bell-btn,
  .nav-logout-btn,
  .nav-mobile-menu-btn {
    min-width: 36px;
    padding: 6px 8px !important;
  }

  .hero-section {
    width: calc(100% - 20px);
    margin: 12px auto 10px;
    padding: 20px 16px;
    text-align: center;
    gap: 14px;
  }

  .hero-logo-showcase {
    display: flex;
    order: -1;
    margin-bottom: 2px;
  }

  .hero-logo-frame {
    width: 162px;
    height: 162px;
    padding: 5px;
  }

  .hero-eyebrow {
    justify-content: center;
    margin-inline: auto;
    font-size: 0.77rem;
    margin-bottom: 10px;
  }

  .hero-title {
    font-size: 1.3rem;
    line-height: 1.42;
    text-align: center;
    margin-bottom: 10px;
  }

  .hero-subtitle {
    font-size: 0.86rem;
    line-height: 1.7;
    margin: 0 auto 16px;
    max-width: 34ch;
  }

  .hero-cta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .hero-cta-row .btn:first-child {
    grid-column: 1 / -1;
  }

  .hero-cta-row .btn {
    width: 100%;
    height: 44px;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 0.83rem;
    white-space: nowrap;
  }

  .hero-metrics-strip {
    width: 100%;
    justify-content: space-around;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
  }

  .hero-metric-item {
    align-items: center;
  }

  .courses-section-head {
    align-items: stretch;
  }

  .courses-stage-tabs {
    width: 100%;
    justify-content: space-between;
  }

  .stage-filter-btn {
    flex: 1;
    text-align: center;
    padding: 7px 8px;
    font-size: 0.78rem;
  }

  .pillars-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .site-footer-inner {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .site-footer-bottom {
    justify-content: center;
    text-align: center;
  }

  .auth-page-wrap {
    padding: 14px 12px 36px;
    min-height: auto;
    align-items: flex-start;
  }

  .auth-form-pane,
  .auth-single-card {
    padding: 18px 16px;
  }

  .lesson-filters-bar {
    grid-template-columns: 1fr;
  }

  .student-courses-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .courses-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .grid-2,
  .grid-3,
  .form-row-2,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .section-card {
    padding: 14px;
    border-radius: 14px;
  }

  .section-header {
    gap: 8px;
  }

  .admin-page-topbar {
    padding: 12px 13px;
    gap: 10px;
  }

  .admin-page-topbar-icon {
    width: 36px;
    height: 36px;
  }

  .admin-help-btn {
    width: 100%;
  }

  .exam-studio-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .exam-studio-tab {
    padding: 9px 8px;
    font-size: 0.78rem;
  }

  .exam-studio-toolbar {
    grid-template-columns: 1fr;
  }

  .exam-builder-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .exam-builder-footer .btn-gold {
    width: 100%;
  }

  .q-inline-workspace {
    padding: 12px;
  }

  .q-meta-strip {
    grid-template-columns: 1fr;
  }

  .q-workspace-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .q-table-toolbar {
    padding: 10px;
  }

  .q-table-search-wrap {
    max-width: none;
  }

  .q-table-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .q-table-toolbar-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .custom-video-controls {
    padding: 8px 10px;
    gap: 6px;
  }

  .custom-video-controls .progress-slider {
    order: -1;
    flex: 1 0 100%;
    width: 100%;
  }

  .exam-timer-bar {
    top: 56px;
    padding: 10px 12px;
    border-radius: 12px;
  }

  /* Bottom-sheet modal ergonomics on phones */
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-box {
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    max-height: 90dvh;
    width: 100%;
    max-width: 100% !important;
    padding: 18px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  /* Prevent iOS Safari input auto-zoom */
  .form-control,
  input,
  select,
  textarea {
    font-size: 16px;
  }
}

@media (max-width: 460px) {
  .nav-reg-full {
    display: none;
  }

  .nav-reg-short {
    display: inline;
  }

  .nav-actions .nav-auth-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
  }
}

@media (max-width: 345px) {
  .brand-titles h1 {
    font-size: 0.84rem;
  }

  .hero-cta-row {
    grid-template-columns: 1fr;
  }

  .hero-metrics-strip {
    gap: 8px;
  }

  .hero-metric-sep {
    display: none;
  }
}

/* ============================================================================
   PRINT STYLES (Admin Scratch Cards)
   ============================================================================ */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .navbar,
  .top-ribbon,
  .app-sidebar,
  .mobile-bottom-nav,
  .mobile-admin-tabs,
  .no-print,
  .protected-player-wrapper,
  .protected-pdf-viewer,
  .question-box,
  #videoStage,
  #pdfCanvasPages,
  #realPdfCanvasPagesHost {
    display: none !important;
  }

  .app-shell {
    display: block !important;
  }

  .scratch-card {
    break-inside: avoid;
    border: 2px solid #0b3d2c !important;
    color: #000000 !important;
    background: #f9f6ee !important;
  }
}
