/* ==========================================================================
   MyLMS Official Design System — Identidade Visual Padrão (Dark & Light)
   Extraído de packages/web/src/app/globals.css + tenant-branding.ts
   ========================================================================== */

:root {
  /* Light Theme Tokens (MyLMS Default Light) */
  --radius: 12px;
  --background: #f8f7f5;
  --background-fade: #f8f7f5;
  --foreground: #23221f;
  --card: #ffffff;
  --card-foreground: #23221f;
  --surface-990: #ffffff;
  --surface-970: #f3f2f0;
  --surface-950: #eae9e8;
  --surface-900: #e0dfde;
  --border: #d3d1ce;
  --muted: #f3f2f0;
  --muted-foreground: #736f67;

  /* MyLMS Official Brand Gold / Amber */
  --primary: #fdb913;
  --brand-color: #fdb913;
  --brand-500: #f79c09;
  --brand-600: #db7504;
  --primary-foreground: #09090b;
  --button-gradient: linear-gradient(to right, #fdb913, #f79c09);
  --button-gradient-hover: linear-gradient(to right, #f79c09, #db7504);

  /* Semantic Status Colors */
  --success: #059669;
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --error: #fb2c36;
  --error-bg: #fff2f1;
  --error-text: #a22012;
  --dots-opacity: 0.06;
  --topbar-bg: rgba(255, 255, 255, 0.94);
}

html.dark {
  /* Dark Theme Tokens (MyLMS Default Dark — AVA Student Standard) */
  --background: #0a0a0a;
  --background-fade: #0e0e0e;
  --foreground: #fafafa;
  --card: #121212;
  --card-foreground: #fafafa;
  --surface-990: #0e0e0e;
  --surface-970: #151515;
  --surface-950: #1c1c1c;
  --surface-900: #2e2e2e;
  --border: #2e2e2e;
  --muted: #302f2b;
  --muted-foreground: #afada8;

  /* MyLMS Official Brand Gold / Yellow */
  --primary: #fdb913;
  --brand-color: #ffbb00;
  --brand-500: #f79c09;
  --brand-600: #db7504;
  --primary-foreground: #1c1c1c;
  --button-gradient: linear-gradient(to right, #ffbb00, #f79c09);
  --button-gradient-hover: linear-gradient(to right, #f79c09, #db7504);

  --success: #00c950;
  --success-bg: rgba(4, 120, 87, 0.25);
  --success-text: #6ee7b7;
  --error: #fb2c36;
  --error-bg: rgba(162, 32, 18, 0.28);
  --error-text: #fca5a5;
  --dots-opacity: 0.16;
  --topbar-bg: rgba(10, 10, 10, 0.92);
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-900) transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: var(--background);
  color: var(--foreground);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* Topbar MyLMS */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 60px;
  padding: 0 18px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--foreground);
  min-width: 0;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
  padding: 2px;
  border: 1px solid rgba(253, 185, 19, 0.35);
  flex-shrink: 0;
}

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

.brand-title {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.brand-badge {
  background: var(--button-gradient);
  color: #1c1c1c;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted-foreground);
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  min-height: 32px;
  white-space: nowrap;
}

.pill-online {
  background: rgba(5, 150, 105, 0.16);
  color: #34d399;
  border: 1px solid rgba(5, 150, 105, 0.4);
}

html:not(.dark) .pill-online {
  color: #065f46;
}

.pill-offline {
  background: rgba(253, 185, 19, 0.16);
  color: var(--brand-color);
  border: 1px solid rgba(253, 185, 19, 0.45);
}

/* Buttons MyLMS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  min-width: 36px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-950);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
}

.btn:hover:not(:disabled) {
  border-color: var(--primary);
}

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

.btn-icon {
  padding: 6px 10px;
}

.btn-primary {
  background: var(--button-gradient);
  border-color: var(--primary);
  color: #111111;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(253, 185, 19, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: var(--button-gradient-hover);
  transform: translateY(-1px);
}

.btn-ghost-brand {
  background: transparent;
  border-color: transparent;
  color: var(--brand-color);
  font-weight: 700;
}

.btn-ghost-brand:hover:not(:disabled) {
  background: rgba(253, 185, 19, 0.1);
  border-color: rgba(253, 185, 19, 0.3);
}

.btn-sync {
  background: rgba(253, 185, 19, 0.14);
  border-color: rgba(253, 185, 19, 0.45);
  color: var(--brand-color);
}

html:not(.dark) .btn-sync {
  color: #933e0d;
}

@media (max-width: 580px) {
  .brand-sub,
  .brand-badge {
    display: none;
  }
  .topbar {
    padding: 0 10px;
    gap: 6px;
  }
  .brand-logo {
    width: 28px;
    height: 28px;
  }
  .brand-title {
    font-size: 13px;
  }
  .pill {
    padding: 4px 7px;
    font-size: 10px;
  }
  .topbar-actions .btn {
    padding: 5px 8px;
    font-size: 11px;
  }
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 18px 16px 76px;
}

/* Hero Banner (Estilo LastAccessedBanner de packages/web/src/app/[lang]/(student)/(private)/home/page.tsx) */
.mylms-hero {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #fffdf7 0%, #fffbeb 55%, #fef3c7 100%);
  color: var(--foreground);
  padding: 24px 22px;
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 8px 24px rgba(35, 34, 31, 0.06);
}

html.dark .mylms-hero {
  background: #0e131f;
  color: #fafafa;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.mylms-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.12;
  z-index: 0;
}

html.dark .mylms-hero-bg {
  opacity: 0.85;
}

.mylms-hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 251, 235, 0.88) 65%, rgba(254, 243, 199, 0.75) 100%);
  z-index: 1;
}

html.dark .mylms-hero-gradient {
  background: linear-gradient(90deg, rgba(10, 10, 10, 0.94) 0%, rgba(10, 10, 10, 0.78) 60%, rgba(10, 10, 10, 0.55) 100%);
}

.mylms-hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
}

.mylms-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #b65107;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

html.dark .mylms-hero-kicker {
  color: var(--primary);
}

.mylms-hero h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--foreground);
}

html.dark .mylms-hero h1 {
  color: #ffffff;
}

.mylms-hero p {
  margin: 0;
  font-size: 13px;
  color: var(--muted-foreground);
  line-height: 1.5;
}

html.dark .mylms-hero p {
  color: #d6d5d4;
}

.mylms-hero-actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(253, 185, 19, 0.16);
  border: 1px solid rgba(219, 117, 4, 0.35);
  color: #79340e;
}

html.dark .tag {
  background: rgba(28, 28, 28, 0.85);
  border: 1px solid rgba(253, 185, 19, 0.35);
  color: #fee689;
}

/* Section Header */
.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.section-bar h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Course Cards Grid (Estilo CourseCardMy + Explorer MyLMS) */
.grid-courses {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.course-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  border-color: rgba(253, 185, 19, 0.55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.course-cover {
  position: relative;
  height: 156px;
  width: 100%;
  background: linear-gradient(135deg, #1c1c1c, #302e2a);
  overflow: hidden;
}

.course-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.course-card:hover .course-cover img {
  transform: scale(1.04);
}

.course-cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 10, 10, 0.92) 6%, rgba(10, 10, 10, 0.25) 55%, rgba(10, 10, 10, 0.4) 100%);
}

.course-cover-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  z-index: 2;
}

.badge-status {
  font-size: 10px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

.badge-downloaded {
  background: rgba(5, 150, 105, 0.9);
  color: #ffffff;
}

.badge-cloud {
  background: rgba(18, 18, 18, 0.82);
  color: #fdb913;
  border: 1px solid rgba(253, 185, 19, 0.45);
}

.badge-size {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.82);
  color: #fafafa;
}

.course-cover-title {
  position: absolute;
  bottom: 10px;
  left: 12px;
  right: 12px;
  z-index: 2;
}

.course-cover-title span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  font-weight: 800;
  display: block;
  margin-bottom: 2px;
}

.course-cover-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  gap: 12px;
}

.course-desc {
  margin: 0;
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
}

/* MyLMS 10-Segment Progress Bar (Igual ao CourseCardMy e LessonProgressBarV2) */
.mylms-seg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}

.mylms-seg-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--foreground);
}

.mylms-segments {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mylms-seg {
  width: 6px;
  height: 12px;
  border-radius: 3px;
  background: var(--surface-900);
  transition: background 0.25s ease;
}

.mylms-seg.done {
  background: var(--primary);
}

/* ==========================================================================
   AVA Lesson Screen Layout (Idêntico ao ContentLesson + LessonsAside do MyLMS)
   ========================================================================== */

.ava-header-bar {
  width: 100%;
  min-height: 64px;
  padding: 10px 16px;
  background: var(--surface-990);
  border: 1px solid var(--surface-970);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ava-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--brand-color);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
}

.ava-exit-btn:hover {
  background: rgba(253, 185, 19, 0.1);
}

.ava-exit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  color: var(--brand-color);
  font-weight: 800;
}

.player-shell {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 10px;
  align-items: start;
}

@media (max-width: 960px) {
  .player-shell {
    grid-template-columns: 1fr;
  }
  .player-shell .ava-main-col {
    order: 1;
  }
  .player-shell .sidebar-card {
    order: 2;
    max-height: 360px;
    overflow-y: auto;
  }
}

.ava-main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slide-card {
  position: relative;
  background: var(--surface-990);
  border: 1px solid var(--surface-970);
  border-radius: 16px;
  padding: 24px 22px;
  min-height: 380px;
  overflow: hidden;
}

.slide-dots-bg {
  position: absolute;
  inset: 0;
  background-image: url("/dots.png");
  background-repeat: repeat;
  opacity: var(--dots-opacity);
  pointer-events: none;
  z-index: 0;
}

.slide-inner {
  position: relative;
  z-index: 2;
  max-width: 820px;
  margin: 0 auto;
}

.slide-content {
  font-size: 15px;
  line-height: 1.7;
  color: var(--foreground);
  overflow-wrap: break-word;
}

.slide-content img,
.slide-content video {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 12px 0;
}

/* Barra Inferior do AVA (Anterior / Pular / Seguinte) */
.ava-bottom-bar {
  min-height: 68px;
  padding: 12px 20px;
  background: var(--surface-990);
  border: 1px solid var(--surface-970);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Sidebar Direita do AVA (Estilo LessonsAside do MyLMS) */
.sidebar-card {
  background: var(--surface-990);
  border: 1px solid var(--surface-970);
  border-radius: 16px;
  padding: 14px;
}

.module-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 10px 4px 6px;
}

.lesson-btn {
  width: 100%;
  text-align: left;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--foreground);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-bottom: 4px;
  transition: background 0.15s ease;
}

.lesson-btn:hover {
  background: var(--surface-950);
}

.lesson-btn.active {
  background: var(--surface-950);
  border-color: rgba(253, 185, 19, 0.35);
  color: var(--primary);
  font-weight: 700;
}

.lesson-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-900);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--primary);
}

.lesson-icon-box.done {
  color: #10b981;
}

/* QuestionOptionButton (Idêntico a packages/web/src/components/questions/question-option-button.tsx) */
.option-btn {
  width: 100%;
  text-align: left;
  min-height: 58px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-950);
  color: var(--foreground);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.18s ease;
}

.option-btn:hover {
  border-color: var(--primary);
}

.option-letter,
.option-num {
  min-width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-900);
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.option-btn.selected {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

.option-btn.selected .option-letter,
.option-btn.selected .option-num {
  background: #1d4ed8;
  color: #ffffff;
}

.option-btn.correct {
  background: #047857;
  border-color: #065f46;
  color: #ffffff;
}

.option-btn.correct .option-letter,
.option-btn.correct .option-num {
  background: #065f46;
  color: #ffffff;
}

.option-btn.wrong {
  background: #a22012;
  border-color: #862116;
  color: #ffffff;
}

.option-btn.wrong .option-letter,
.option-btn.wrong .option-num {
  background: #862116;
  color: #ffffff;
}

.feedback-box {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
  line-height: 1.5;
}

.feedback-ok {
  background: var(--success-bg);
  border: 1px solid #059669;
  color: var(--success-text);
}

.feedback-err {
  background: var(--error-bg);
  border: 1px solid #a22012;
  color: var(--error-text);
}

/* Tutor IA Box (Estilo Copilot / Chatbot MyLMS) */
.tutor-box {
  background: var(--surface-990);
  border: 1px solid var(--surface-970);
  border-radius: 16px;
  padding: 16px;
}

.chat-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 8px;
}

.chat-user {
  background: rgba(253, 185, 19, 0.14);
  border: 1px solid rgba(253, 185, 19, 0.35);
  margin-left: 20px;
}

.chat-ai {
  background: var(--surface-950);
  border: 1px solid var(--border);
  margin-right: 20px;
}

.mylms-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-950);
  color: var(--foreground);
  font-size: 13px;
}

.mylms-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Mobile Drawer MyLMS */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 60;
  display: none;
}

.drawer-overlay.open {
  display: block;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(85vw, 320px);
  background: var(--card);
  border-right: 1px solid var(--border);
  z-index: 70;
  padding: 18px;
  overflow-y: auto;
  transform: translateX(-102%);
  transition: transform 0.22s ease;
}

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

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-desc {
  font-size: 12px;
  color: var(--muted-foreground);
  margin: 0 0 14px;
  line-height: 1.45;
}

.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.drawer-btn {
  justify-content: flex-start;
  width: 100%;
}

.drawer-account {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.drawer-section-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 8px;
}

/* ==========================================================================
   MyLMS Official Login Modal, Course Dashboard & Mobile-First Responsiveness
   ========================================================================== */

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.76);
  backdrop-filter: blur(6px);
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-modal-overlay.open {
  display: flex;
}

.auth-modal-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.auth-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-950);
  color: var(--foreground);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.otp-slots-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.otp-slot-input {
  width: 100%;
  height: 48px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-950);
  color: var(--foreground);
  text-transform: uppercase;
}

.otp-slot-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(253, 185, 19, 0.25);
}

/* Course Overview Dashboard (Idêntico ao /home/course/[slug] do MyLMS) */
.course-dash-hero {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.course-dash-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.course-dash-info {
  flex: 1;
  min-width: 240px;
}

.course-dash-info h1 {
  margin: 6px 0 8px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
}

.course-dash-info p {
  margin: 0;
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.55;
}

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

.module-accordion-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 20px;
  margin-bottom: 14px;
}

.module-accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.module-badge-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(253, 185, 19, 0.16);
  color: var(--brand-color);
  font-size: 12px;
  font-weight: 800;
}

html:not(.dark) .module-badge-idx {
  color: #933e0d;
}

.lesson-dash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--surface-970);
  color: var(--foreground);
  text-align: left;
  cursor: pointer;
  margin-bottom: 6px;
  transition: all 0.15s ease;
}

.lesson-dash-row:hover {
  border-color: var(--primary);
  background: var(--surface-950);
}

.lesson-dash-row.current {
  border-color: var(--primary);
  background: rgba(253, 185, 19, 0.1);
}

/* Admin Curation Grid inside MyLMS Pocket */
.curation-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
}

/* Responsive Tables, Pre & Media inside Slide Markdown */
.slide-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.slide-content th,
.slide-content td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.slide-content th {
  background: var(--surface-950);
  font-weight: 700;
}

.slide-content pre {
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface-950);
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
}

.slide-content audio {
  width: 100%;
  max-width: 100%;
  margin: 10px 0;
}

/* Mobile-First Refinements (320px - 640px) */
@media (max-width: 640px) {
  .container {
    padding: 12px 10px 64px;
  }

  .mylms-hero {
    padding: 18px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
  }

  .mylms-hero h1 {
    font-size: 18px;
  }

  .mylms-hero-actions {
    width: 100%;
    min-width: 0;
  }

  .mylms-hero-actions .btn {
    width: 100%;
  }

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

  .ava-header-bar {
    padding: 10px 12px;
    gap: 8px;
  }

  .slide-card {
    padding: 16px 14px;
    min-height: 280px;
    border-radius: 14px;
  }

  .slide-inner h1 {
    font-size: 18px !important;
  }

  .slide-content {
    font-size: 14px;
    line-height: 1.6;
  }

  .option-btn {
    padding: 10px 12px;
    min-height: 50px;
    font-size: 14px;
    gap: 8px;
  }

  .ava-bottom-bar {
    padding: 10px 12px;
  }

  .course-dash-hero {
    padding: 16px 14px;
  }

  .course-dash-info h1 {
    font-size: 19px;
  }

  .module-accordion-card {
    padding: 14px 12px;
  }
}

@media (max-width: 420px) {
  #btnSyncNow span.sync-label-text {
    display: none;
  }
  #btnAuthHeader span.auth-label-text {
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.topbar .brand-link,
.topbar button,
.topbar a {
  min-height: 36px;
  min-width: 36px;
}

/* ==========================================================================
   Player Layout, Sidebar Lessons, Course Thumbnails & Topbar Mobile Polish
   ========================================================================== */

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

.section-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.section-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted-foreground);
}

.tab-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.course-thumb {
  position: relative;
  height: 164px;
  background: linear-gradient(135deg, #1b1a17 0%, #2c2618 100%);
  overflow: hidden;
}

.course-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.course-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #fdb913;
  letter-spacing: 0.08em;
}

.course-thumb-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.course-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--foreground);
}

.course-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-900);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--button-gradient);
  transition: width 0.25s ease;
}

.pill-cached {
  background: rgba(253, 185, 19, 0.16);
  border-color: rgba(253, 185, 19, 0.45);
  color: var(--brand-color);
}

html:not(.dark) .pill-cached {
  background: rgba(253, 185, 19, 0.22);
  color: #7c3409;
}

/* Player 2-Column Desktop / 1-Column Mobile Layout */
.player-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar-lessons {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.lesson-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  margin: 14px 4px 6px;
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--foreground);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lesson-item:hover {
  background: var(--surface-950);
  border-color: var(--border);
}

.lesson-item.active {
  background: rgba(253, 185, 19, 0.16);
  border-color: rgba(253, 185, 19, 0.55);
  font-weight: 800;
}

.lesson-check {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--surface-900);
  color: var(--muted-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.lesson-check.done {
  background: rgba(36, 161, 72, 0.18);
  color: var(--success);
}

@media (max-width: 1023px) {
  .player-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-lessons {
    display: none;
  }
}

@media (max-width: 560px) {
  #netStatusPill {
    display: none;
  }
  .brand-text {
    display: none;
  }
  .topbar {
    padding: 0 10px;
  }
  .topbar-actions {
    gap: 6px;
  }
}

/* ==========================================================================
   Player Column Overflow Guard, Tutor Panel, Question Box & Toast Styling
   ========================================================================== */

.player-layout > * {
  min-width: 0;
  max-width: 100%;
}

.ava-header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ava-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.question-box {
  margin-top: 22px;
  padding: 18px;
  border-radius: 16px;
  background: var(--surface-970);
  border: 1px solid var(--border);
}

.question-box h4 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
}

.feedback-banner {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
}

.feedback-banner.ok {
  background: rgba(36, 161, 72, 0.14);
  border: 1px solid rgba(36, 161, 72, 0.45);
  color: var(--foreground);
}

.feedback-banner.err {
  background: rgba(218, 30, 40, 0.12);
  border: 1px solid rgba(218, 30, 40, 0.45);
  color: var(--foreground);
}

.tutor-panel {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  max-width: 100%;
}

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

.tutor-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 92%;
  word-break: break-word;
}

.msg p {
  margin: 0;
}

.msg-ai {
  background: var(--surface-970);
  border: 1px solid var(--border);
  align-self: flex-start;
}

.msg-user {
  background: rgba(253, 185, 19, 0.18);
  border: 1px solid rgba(253, 185, 19, 0.45);
  align-self: flex-end;
  font-weight: 600;
}

.tutor-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
}

.tutor-input-row .input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-970);
  color: var(--foreground);
  font-size: 13px;
}

.input {
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-970);
  color: var(--foreground);
  font-size: 14px;
}

.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  left: 18px;
  max-width: 420px;
  margin: 0 auto;
  z-index: 95;
  background: #161614;
  color: #f4f4f6;
  border: 1px solid rgba(253, 185, 19, 0.45);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
  .ava-step-progress {
    width: 100%;
    justify-content: space-between;
  }
  .tutor-panel {
    padding: 14px 12px;
  }
  .question-box {
    padding: 14px 12px;
  }
}
