/* ============================================================
   NBCWC Lessons — Airbnb-inspired Design System
   Mobile-first, CSS custom properties
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --primary: #FF385C;
  --primary-dark: #E31C3D;
  --primary-light: #FF6B81;
  --dark: #222222;
  --gray-1: #717171;
  --gray-2: #B0B0B0;
  --gray-3: #EBEBEB;
  --gray-4: #F7F7F7;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition: 0.2s ease;
  --nav-height: 60px;
  --bottom-bar-height: 68px;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--dark);
  background: var(--gray-4);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
input, button, select, textarea { font-family: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: clamp(1.5rem, 5vw, 2rem); font-weight: 800; line-height: 1.2; }
h2 { font-size: clamp(1.2rem, 4vw, 1.5rem); font-weight: 700; line-height: 1.3; }
h3 { font-size: clamp(1rem, 3vw, 1.2rem); font-weight: 600; line-height: 1.4; }
p  { font-size: .9375rem; line-height: 1.65; color: var(--gray-1); }

/* ── Layout ─────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-content {
  padding-top: calc(var(--nav-height) + 16px);
  padding-bottom: 32px;
  min-height: 100vh;
}

/* ── Navigation ─────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-3);
  z-index: 100;
  display: flex;
  align-items: center;
}

.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary);
  white-space: nowrap;
}

.nav-logo svg { flex-shrink: 0; }

/* ── Admin Visibility Control ───────────────────────────────── */
.visibility-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.visibility-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  min-width: 72px;
  justify-content: center;
}

.visibility-label .vis-icon { flex-shrink: 0; }
.visibility-label .vis-icon-off { display: none; }
.visibility-label.is-hidden .vis-icon-on  { display: none; }
.visibility-label.is-hidden .vis-icon-off { display: block; }

.visibility-label.is-visible {
  background: #E6F7EE;
  color: #058246;
}

.visibility-label.is-hidden {
  background: #F4F4F5;
  color: #717171;
}

/* ── Table of Contents Drawer ───────────────────────────────── */
.toc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 998;
  transition: background .3s ease;
}

.toc-backdrop.visible { background: rgba(0,0,0,.5); }

.toc-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  height: 100dvh;
  width: 88%;
  max-width: 380px;
  background: #fff;
  z-index: 999;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,.15);
}

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

.toc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid #F0F0F0;
  flex-shrink: 0;
}

.toc-header-content { flex: 1; min-width: 0; }

.toc-eyebrow {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #1E3A5F;
  margin-bottom: 4px;
}

.toc-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  margin: 0;
  letter-spacing: -.01em;
}

.toc-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #F4F4F5;
  border: none;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}

.toc-close:hover { background: #E5E7EB; color: #111; }

.toc-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.toc-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  text-decoration: none;
  color: #222;
  border-left: 3px solid transparent;
  transition: all .15s;
}

.toc-item:hover,
.toc-item:active {
  background: #FAFBFC;
  border-left-color: #1E3A5F;
}

.toc-item-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .75rem;
  font-weight: 700;
  color: #1E3A5F;
  background: #EEF2FF;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  line-height: 1;
  align-self: center;
}

.toc-item-text {
  font-size: .9375rem;
  font-weight: 600;
  color: #222;
  line-height: 1.4;
}

.toc-empty {
  padding: 32px 20px;
  text-align: center;
  color: #9CA3AF;
  font-size: .875rem;
}

.toc-footer {
  display: flex;
  gap: 8px;
  padding: 14px 20px 22px;
  border-top: 1px solid #F0F0F0;
  flex-shrink: 0;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}

.toc-footer .btn {
  flex: 1;
  justify-content: center;
  font-size: .8125rem;
}

/* ── Nav Saved (Bookmarks) Button ───────────────────────────── */
.nav-saved-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--gray-4);
  border: 1.5px solid transparent;
  color: var(--dark);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition);
}

.nav-saved-btn:hover {
  background: var(--white);
  border-color: var(--gray-3);
  box-shadow: var(--shadow-sm);
}

.nav-saved-btn.active {
  background: #1E3A5F;
  color: #fff;
  border-color: #1E3A5F;
}

.nav-saved-btn.active .nav-saved-icon { fill: currentColor; }

.nav-saved-count {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
  line-height: 1;
}

/* ── Search Bar ─────────────────────────────────────────────── */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 480px;
}

.search-bar input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 44px;
  border: 1.5px solid var(--gray-3);
  border-radius: var(--radius-full);
  background: var(--gray-4);
  font-size: .875rem;
  color: var(--dark);
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-bar input:focus {
  border-color: var(--dark);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(34,34,34,.06);
}

.search-bar input::placeholder { color: var(--gray-2); }

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-1);
  pointer-events: none;
}

/* ── Category Pills ─────────────────────────────────────────── */
.category-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-3);
  padding: 12px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }

.category-bar .container {
  display: flex;
  gap: 8px;
  width: max-content;
  padding: 0 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-size: .8125rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
  border: 1.5px solid var(--gray-3);
  background: var(--white);
  color: var(--gray-1);
  user-select: none;
}

.pill:hover {
  border-color: var(--dark);
  color: var(--dark);
}

.pill.active {
  background: var(--dark);
  border-color: var(--dark);
  color: var(--white);
}

/* ── Chip (smaller badge) ───────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip-white {
  background: rgba(255,255,255,.22);
  color: var(--white);
  backdrop-filter: blur(4px);
}

.chip-dark {
  background: rgba(34,34,34,.08);
  color: var(--gray-1);
}

/* ── Lesson Cards ───────────────────────────────────────────── */
.lessons-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  padding: 20px 0;
}

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card:active {
  transform: translateY(-1px);
}

.card-header {
  height: 140px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  overflow: hidden;
}

.card-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.08) 0%, rgba(0,0,0,.15) 100%);
}

.card-header-initial {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--white);
}

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

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-subtitle {
  font-size: .8125rem;
  color: var(--gray-1);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-divider {
  height: 1px;
  background: var(--gray-3);
  margin: 4px 0;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: var(--gray-2);
  margin-top: auto;
}

.card-meta span { display: flex; align-items: center; gap: 3px; }
.card-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--gray-2); }

/* ── Skeleton Loading ───────────────────────────────────────── */
@keyframes skeleton-pulse {
  0% { opacity: 1; }
  50% { opacity: .4; }
  100% { opacity: 1; }
}

.skeleton { animation: skeleton-pulse 1.5s ease-in-out infinite; }

.skeleton-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.skeleton-header {
  height: 140px;
  background: var(--gray-3);
}

.skeleton-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }

.skeleton-line {
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--gray-3);
}

.skeleton-line.short { width: 60%; }
.skeleton-line.xshort { width: 40%; }

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  gap: 12px;
}

.empty-state svg { color: var(--gray-2); }
.empty-state h3 { color: var(--dark); }
.empty-state p { max-width: 280px; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: .9375rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: none;
  outline: none;
  text-decoration: none;
  user-select: none;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-dark {
  background: var(--dark);
  color: var(--white);
}
.btn-dark:hover { background: #333; }

.btn-ghost {
  background: transparent;
  color: var(--dark);
  border: 1.5px solid var(--gray-3);
}
.btn-ghost:hover {
  border-color: var(--dark);
  background: var(--gray-4);
}

.btn-white {
  background: var(--white);
  color: var(--dark);
}
.btn-white:hover { background: var(--gray-4); }

.btn-sm {
  height: 38px;
  padding: 0 14px;
  font-size: .8125rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  background: var(--gray-4);
  color: var(--dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  transition: background var(--transition);
}
.btn-icon:hover { background: var(--gray-3); }
.btn-icon.outline {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.4);
  color: var(--white);
}
.btn-icon.outline:hover { background: rgba(255,255,255,.1); }

.btn-full { width: 100%; }

/* ── Bottom Bar ─────────────────────────────────────────────── */
.bottom-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-bar-height);
  background: var(--white);
  border-top: 1.5px solid var(--gray-3);
  display: flex;
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,.07);
}

.bar-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px 8px;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.bar-btn:active { background: var(--gray-4); }

.bar-btn__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: color var(--transition);
}

.bar-btn__label {
  font-size: .72rem;
  font-weight: 600;
  color: #555;
  letter-spacing: .01em;
  text-transform: uppercase;
  transition: color var(--transition);
}

/* Listen active states */
.bar-btn--listen.playing .bar-btn__icon,
.bar-btn--listen.playing .bar-btn__label {
  color: var(--primary);
}

.bar-btn--listen.paused .bar-btn__icon,
.bar-btn--listen.paused .bar-btn__label {
  color: #C8A000;
}

/* Highlight active state */
.bar-btn.highlight-active .bar-btn__icon { color: #C8A000; }
.bar-btn.highlight-active .bar-btn__label { color: #C8A000; }
.bar-btn.highlight-active { background: #FFFBEB; }

/* Font bump active flash */
.bar-btn.font-bumped .bar-btn__icon { color: var(--primary); }

.bar-divider {
  width: 1px;
  background: var(--gray-3);
  margin: 12px 0;
  flex-shrink: 0;
}

.bottom-bar .btn {
  flex: 1;
  height: 44px;
  font-size: .875rem;
}

/* ── Lesson Header ──────────────────────────────────────────── */
.lesson-header {
  position: relative;
  padding: calc(var(--nav-height) + 24px) 20px 32px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.lesson-header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.45) 100%);
}

.lesson-header-content {
  position: relative;
  z-index: 1;
}

.lesson-header .chip { margin-bottom: 10px; }

.lesson-header h1 {
  color: var(--white);
  font-size: clamp(1.4rem, 6vw, 2rem);
  margin-bottom: 8px;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.lesson-header .subtitle {
  color: rgba(255,255,255,.88);
  font-size: .9375rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.lesson-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lesson-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .8125rem;
  color: rgba(255,255,255,.85);
  font-weight: 500;
}

/* ── Back/Nav buttons on lesson ─────────────────────────────── */
.lesson-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 200;
  background: transparent;
  transition: background var(--transition);
}

.lesson-nav.scrolled {
  background: var(--white);
  border-bottom: 1px solid var(--gray-3);
}

.lesson-nav.scrolled .btn-icon {
  background: var(--gray-4);
  color: var(--dark);
}

/* ── Lesson Content ─────────────────────────────────────────── */
.lesson-content {
  background: var(--white);
  margin: 0 0 20px;
  padding: 28px 22px;
}

.lesson-content h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: #111;
  margin: 32px 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  letter-spacing: -.01em;
}

.lesson-content h2:first-child { margin-top: 0; }

.lesson-content h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111;
  margin: 24px 0 10px;
}

.lesson-content p {
  font-size: 1.125rem;
  color: #222;
  line-height: 1.85;
  margin-bottom: 16px;
}

.lesson-content ul,
.lesson-content ol {
  padding-left: 26px;
  margin-bottom: 18px;
}

.lesson-content li {
  font-size: 1.1rem;
  color: #222;
  line-height: 1.8;
  margin-bottom: 10px;
}

.lesson-content strong { color: #000; font-weight: 700; }
.lesson-content em { color: #1E3A5F; font-style: italic; }

/* ── Steps Layout ───────────────────────────────────────────── */
.step-indicator {
  display: flex;
  gap: 6px;
  padding: 16px 20px;
  background: var(--white);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid var(--gray-3);
}
.step-indicator::-webkit-scrollbar { display: none; }

.step-dot {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  background: var(--gray-3);
  color: var(--gray-1);
  cursor: pointer;
  transition: all var(--transition);
}

.step-dot.active {
  background: var(--primary);
  color: var(--white);
  transform: scale(1.1);
}

.step-dot.completed {
  background: var(--dark);
  color: var(--white);
}

.steps-container { background: var(--white); }

.step-panel {
  display: none;
  padding: 24px 20px;
  animation: fadeIn .25s ease;
}

.step-panel.active { display: block; }

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

.step-nav {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  background: var(--white);
  border-top: 1px solid var(--gray-3);
}

.step-nav .btn { flex: 1; height: 44px; }

/* ── Outline Layout ─────────────────────────────────────────── */
.outline-section {
  border-bottom: 1px solid var(--gray-3);
  background: var(--white);
}

.outline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  cursor: pointer;
  transition: background var(--transition);
  min-height: 60px;
}

.outline-header:hover { background: var(--gray-4); }

.outline-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #111;
  margin: 0;
  flex: 1;
  line-height: 1.4;
}

.outline-chevron {
  color: var(--gray-1);
  transition: transform var(--transition);
  flex-shrink: 0;
  margin-left: 12px;
}

.outline-section.open .outline-chevron {
  transform: rotate(180deg);
}

.outline-body {
  display: none;
  padding: 0 20px 20px;
}

.outline-section.open .outline-body { display: block; }

/* ── Slides Layout ──────────────────────────────────────────── */
.slides-wrapper {
  overflow: hidden;
  background: var(--gray-4);
  padding: 20px 0;
}

.slide-container {
  display: flex;
  transition: transform .35s cubic-bezier(.25,.46,.45,.94);
  will-change: transform;
  cursor: grab;
}
.slide-container.dragging { cursor: grabbing; transition: none; }

.slide {
  flex: 0 0 calc(100% - 40px);
  margin: 0 10px;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  min-height: 200px;
}

.slide-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  background: var(--white);
}

.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-3);
  cursor: pointer;
  transition: all var(--transition);
}

.slide-dot.active {
  background: var(--primary);
  width: 24px;
  border-radius: 4px;
}

.slide--image {
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.slide-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
}

/* ── QR Section ─────────────────────────────────────────────── */
.qr-section {
  background: var(--white);
  padding: 28px 20px;
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.qr-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
}

.qr-section p {
  font-size: .8125rem;
  color: var(--gray-1);
  max-width: 240px;
}

#qrcode {
  background: var(--white);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--gray-3);
  display: inline-block;
}

#qrcode canvas,
#qrcode img { display: block; }

.qr-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Page Section ───────────────────────────────────────────── */
.section-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-1);
  padding: 0 20px 12px;
}

.content-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* ── Toast Notification ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-bar-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--dark);
  color: var(--white);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: .875rem;
  font-weight: 500;
  opacity: 0;
  transition: all .25s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 999;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Admin Layout ───────────────────────────────────────────── */
.admin-body {
  background: var(--gray-4);
  min-height: 100vh;
}

.admin-nav {
  background: var(--white);
  border-bottom: 1px solid var(--gray-3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--dark);
}

.admin-nav-logo span { color: var(--primary); }

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 14px 60px;
  padding-bottom: max(60px, env(safe-area-inset-bottom));
}

@media (min-width: 600px) {
  .admin-main {
    padding: 28px 20px 60px;
  }
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.admin-page-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark);
}

/* ── Stats ──────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: .75rem;
  color: var(--gray-1);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Admin Table / List ─────────────────────────────────────── */
.admin-table {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.admin-table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-3);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-1);
}

.lesson-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-3);
  transition: background var(--transition);
}

.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: var(--gray-4); }

.lesson-row-color {
  width: 10px;
  height: 48px;
  border-radius: 4px;
  flex-shrink: 0;
}

.lesson-row-info { flex: 1; min-width: 0; }

.lesson-row-title {
  font-weight: 600;
  font-size: .9375rem;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.lesson-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  color: var(--gray-1);
  flex-wrap: wrap;
}

.layout-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--gray-3);
  color: var(--gray-1);
}

.layout-badge.card   { background: #FFF0F3; color: var(--primary); }
.layout-badge.steps  { background: #F0F3FF; color: #6366F1; }
.layout-badge.outline{ background: #F0FFF4; color: #10B981; }
.layout-badge.slides { background: #FFFBF0; color: #F59E0B; }

.lesson-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Toggle Switch ──────────────────────────────────────────── */
.toggle {
  position: relative;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--white);
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Admin Form ─────────────────────────────────────────────── */
.admin-form {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  box-shadow: var(--shadow-sm);
  overflow-x: hidden;
}

@media (min-width: 600px) {
  .admin-form {
    padding: 28px 24px;
  }
}

.form-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--gray-3);
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.form-section-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gray-1);
  margin-bottom: 18px;
}

/* AI Auto Fill — mobile-first */
.ai-autofill-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.ai-autofill-header .hint {
  font-size: .75rem;
  color: var(--gray-1);
  display: block;
  line-height: 1.4;
}

.ai-autofill-header #aiAutofillToggle {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

.ai-autofill-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1.5px solid var(--gray-3);
  border-radius: var(--radius-sm);
  background: var(--gray-4);
  max-width: 100%;
}

.ai-autofill-panel .ai-source-text {
  min-height: 140px;
  max-height: 50vh;
  width: 100%;
  font-family: inherit;
  font-size: 16px; /* avoid iOS focus zoom */
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

.ai-autofill-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.ai-autofill-actions .btn {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

.ai-autofill-status {
  margin-top: 10px;
  font-size: .8125rem;
  color: var(--gray-1);
  min-height: 1.25em;
  line-height: 1.4;
  word-break: break-word;
}

.ai-autofill-status.is-error {
  color: #EF4444;
}

@media (min-width: 600px) {
  .ai-autofill-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
  }

  .ai-autofill-header #aiAutofillToggle {
    width: auto;
    flex-shrink: 0;
  }

  .ai-autofill-panel {
    padding: 16px;
  }

  .ai-autofill-panel .ai-source-text {
    min-height: 160px;
    max-height: none;
    font-size: .9375rem;
  }

  .ai-autofill-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .ai-autofill-actions .btn {
    width: auto;
  }
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--dark);
}

.form-group .hint {
  font-size: .75rem;
  color: var(--gray-1);
  margin-top: 2px;
}

.form-control {
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-3);
  border-radius: var(--radius-sm);
  font-size: 16px; /* avoid iOS zoom on focus */
  color: var(--dark);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--dark);
  box-shadow: 0 0 0 3px rgba(34,34,34,.06);
}

.form-control::placeholder { color: var(--gray-2); }

textarea.form-control {
  min-height: 280px;
  resize: vertical;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 16px; /* avoid iOS zoom on focus */
  line-height: 1.6;
}

@media (min-width: 600px) {
  textarea.form-control {
    min-height: 400px;
    font-size: .875rem;
  }
}

.color-picker-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 3px solid transparent;
  outline: none;
}

.color-swatch:hover { transform: scale(1.15); }

.color-swatch.selected {
  border-color: var(--dark);
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--dark);
}

.layout-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.layout-option {
  border: 2px solid var(--gray-3);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.layout-option:hover { border-color: var(--gray-1); }

.layout-option.selected {
  border-color: var(--primary);
  background: #FFF5F7;
}

.layout-option-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.layout-option-name {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--dark);
}

.layout-option-desc {
  font-size: .7rem;
  color: var(--gray-1);
  line-height: 1.4;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
}

.form-actions .btn {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

@media (min-width: 600px) {
  .form-actions {
    flex-direction: row;
  }
  .form-actions .btn {
    width: auto;
  }
}

.form-error {
  background: #FFF5F7;
  border: 1px solid #FFB3BE;
  color: var(--primary-dark);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 20px;
  font-weight: 500;
}

.form-success {
  background: #F0FFF4;
  border: 1px solid #86EFAC;
  color: #166534;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  margin-bottom: 20px;
  font-weight: 500;
}

/* ── Login Page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, #FF6B81 100%);
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.login-logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--dark);
}

.login-logo p {
  font-size: .8125rem;
  color: var(--gray-1);
  text-align: center;
}

/* ── Responsive — Tablet+ ───────────────────────────────────── */
@media (min-width: 600px) {
  .lessons-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid   { grid-template-columns: repeat(4, 1fr); }
  .form-grid.two-col { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .lessons-grid { grid-template-columns: repeat(3, 1fr); }
  .layout-options { grid-template-columns: repeat(4, 1fr); }
}

/* ── No-bottom-bar for desktop ──────────────────────────────── */
@media (min-width: 768px) {
  .bottom-bar { display: none; }
  .page-content {
    padding-bottom: 40px;
  }
  .toast { bottom: 24px; }
}

/* ── Misc helpers ───────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.text-primary { color: var(--primary); }
.text-gray    { color: var(--gray-1); }
.fw-bold      { font-weight: 700; }
.mt-0 { margin-top: 0; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ── Confirm modal ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-md) var(--radius-md);
  width: 100%;
  max-width: 420px;
  padding: 28px 24px 24px;
  transform: translateY(30px);
  transition: transform .25s ease;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal h3 { margin-bottom: 8px; }
.modal p  { margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ── Reading Progress Bar ───────────────────────────────────── */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: var(--primary);
  z-index: 9999;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ── Text Highlight (mark.js) ───────────────────────────────── */
.user-highlight {
  background: #FFF3CD;
  border-radius: 2px;
  padding: 0 2px;
}

mark.user-highlight {
  background: #FFF3CD;
  border-radius: 2px;
  padding: 0 2px;
  color: inherit;
}

/* ── Font Size Controls ─────────────────────────────────────── */
.font-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border: 1.5px solid var(--gray-3);
  border-radius: var(--radius-full);
  padding: 4px 8px;
  box-shadow: var(--shadow-sm);
}

.font-controls button {
  height: 30px;
  min-width: 30px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  font-size: .8125rem;
  font-weight: 700;
  color: var(--gray-1);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.font-controls button:hover {
  background: var(--gray-3);
  color: var(--dark);
}

.font-controls button.active {
  background: var(--dark);
  color: var(--white);
}

.font-controls .font-sep {
  width: 1px;
  height: 18px;
  background: var(--gray-3);
  flex-shrink: 0;
}

/* ── Lesson Toolbar (font + highlight controls) ─────────────── */
.lesson-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-3);
  gap: 10px;
  flex-wrap: wrap;
  position: sticky;
  top: var(--nav-height);
  z-index: 50;
}

.lesson-toolbar-left,
.lesson-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-highlight {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  font-size: .8125rem;
  font-weight: 600;
  border: 1.5px solid var(--gray-3);
  background: var(--white);
  color: var(--gray-1);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-highlight:hover {
  border-color: var(--dark);
  color: var(--dark);
}

.btn-highlight.active {
  background: #FFF3CD;
  border-color: #E6C200;
  color: #7A6500;
}

.btn-clear-highlights {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 500;
  border: 1.5px solid var(--gray-3);
  background: var(--white);
  color: var(--gray-2);
  cursor: pointer;
  transition: all var(--transition);
}

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

/* ── Text-to-Speech ─────────────────────────────────────────── */
.tts-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 600;
  border: 1.5px solid var(--gray-3);
  background: var(--white);
  color: var(--dark);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex: 1;
}

.tts-btn:hover { background: var(--gray-4); border-color: var(--dark); }
.tts-btn.playing { background: var(--primary); color: var(--white); border-color: var(--primary); }
.tts-btn.paused  { background: #FFF3CD; color: #7A6500; border-color: #E6C200; }

.tts-stop {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  border: 1.5px solid var(--gray-3);
  background: var(--white);
  color: var(--gray-1);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.tts-stop.visible { display: inline-flex; }
.tts-stop:hover { border-color: var(--primary); color: var(--primary); }

.reading-now {
  background: #FFFBEB !important;
  border-radius: 4px;
  transition: background 0.3s ease;
}

/* ── Bookmark Button ────────────────────────────────────────── */
.btn-bookmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.4);
  color: var(--white);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-bookmark:hover { background: rgba(255,255,255,.1); }

.btn-bookmark.bookmarked {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.7);
}

.btn-bookmark svg.bookmark-svg { fill: none; }
.btn-bookmark.bookmarked svg.bookmark-svg { fill: currentColor; }

/* Bookmark on index card */
.card-bookmark {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(6px);
  border: 1.5px solid rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all var(--transition);
  color: rgba(255,255,255,.85);
}

.card-bookmark:hover { background: rgba(255,255,255,.32); }

.card-bookmark.bookmarked {
  background: rgba(255,255,255,.3);
  color: var(--white);
  border-color: rgba(255,255,255,.6);
}

.card-bookmark svg.bookmark-svg { fill: none; }
.card-bookmark.bookmarked svg.bookmark-svg { fill: currentColor; }

/* Saved pill */
.pill[data-category="__saved"] {
  border-color: var(--primary);
  color: var(--primary);
}

.pill[data-category="__saved"].active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

/* ── Persistent QR Code Card ────────────────────────────────── */
/* ── Admin Persistent QR Card ───────────────────────────────── */
.admin-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  margin-bottom: 24px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.admin-card-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid #F0F0F0;
  background: linear-gradient(180deg, #FAFBFC 0%, #FFFFFF 100%);
}

.admin-card-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #EEF2FF;
  color: #1E3A5F;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-card-header-text { flex: 1; min-width: 0; }

.admin-card-header-text h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}

.admin-card-header-text p {
  font-size: .8125rem;
  color: #717171;
  line-height: 1.5;
  margin: 0;
}

.pqr-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 24px;
}

@media (min-width: 768px) {
  .pqr-body { grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
}

.pqr-qr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pqr-qr-frame {
  background: #fff;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  display: inline-block;
  line-height: 0;
  box-shadow: 0 2px 8px rgba(30,58,95,.06);
}

#persistentQR canvas,
#persistentQR img { display: block; }

.pqr-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.pqr-actions .btn { flex: 1; min-width: 0; justify-content: center; }

.pqr-info-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pqr-info-col .form-group { margin: 0; }

.pqr-url-box {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8125rem;
  color: #1E3A5F;
  word-break: break-all;
  line-height: 1.5;
  font-weight: 500;
}

.pqr-current {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FAFBFC;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 12px 14px;
  --accent: #1E3A5F;
}

.pqr-current-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  flex-shrink: 0;
}

.pqr-current-meta { flex: 1; min-width: 0; }

.pqr-current-title {
  font-size: .9375rem;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
}

.pqr-current-category {
  font-size: .75rem;
  color: #717171;
  margin-top: 2px;
  font-weight: 500;
}

.pqr-current-empty {
  color: #9CA3AF;
  font-size: .875rem;
  font-style: normal;
  font-weight: 500;
  justify-content: flex-start;
  padding: 14px;
}

.pqr-current-empty svg { color: #B0B0B0; flex-shrink: 0; }

.pqr-change-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

.pqr-change-row select {
  flex: 1;
  min-width: 0;
}

.pqr-change-row .btn { flex-shrink: 0; }

/* Secondary button used in QR card */
.btn-secondary {
  background: #fff;
  color: #333;
  border: 1px solid #E5E7EB;
  font-weight: 600;
}

.btn-secondary:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
}

/* ── Lesson nav scrolled: dark icon colors ──────────────────── */
.lesson-nav.scrolled .btn-bookmark {
  border-color: var(--gray-3);
  color: var(--dark);
  background: var(--gray-4);
}

.lesson-nav.scrolled .btn-bookmark.bookmarked {
  background: #FFF0F3;
  border-color: var(--primary);
  color: var(--primary);
}

/* ══════════════════════════════════════════════════════════════
   ── Admin ──
   Polished internal-tool styles. Navy primary, clear hierarchy.
   Palette: #1E3A5F primary · #10B981 success · #EF4444 danger
   ══════════════════════════════════════════════════════════════ */

/* ── Admin Body Background ───────────────────────────────────── */
.admin-body { background: #F9FAFB; }

/* ── Admin Primary Button: Navy Instead of Coral ─────────────── */
.admin-body .btn-primary,
.login-page  .btn-primary {
  background: #1E3A5F;
}
.admin-body .btn-primary:hover,
.login-page  .btn-primary:hover {
  background: #162d49;
}

/* ── Admin Nav ───────────────────────────────────────────────── */
.admin-nav-logo {
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -.01em;
}
.admin-nav-logo span { color: #1E3A5F; }
.admin-nav-logo svg  { color: #1E3A5F; }
.admin-nav-actions   { display: flex; gap: 10px; align-items: center; }

/* ── Page Header Typography ──────────────────────────────────── */
.admin-page-header h1 {
  font-size: 1.625rem;
  font-weight: 800;
  color: #111;
  letter-spacing: -.025em;
  line-height: 1.2;
}
.admin-page-subtitle {
  font-size: .875rem;
  color: #717171;
  margin-top: 3px;
  font-weight: 400;
}

/* ── Stat Card Icons ─────────────────────────────────────────── */
.stat-card        { padding: 18px 16px; }
.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.stat-icon.icon-total      { background: #EFF6FF; color: #1E3A5F; }
.stat-icon.icon-published  { background: #ECFDF5; color: #10B981; }
.stat-icon.icon-drafts     { background: #FFF7ED; color: #F59E0B; }
.stat-icon.icon-categories { background: #F5F3FF; color: #8B5CF6; }

.stat-value {
  font-size: 1.875rem;
  font-weight: 800;
  color: #111;
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #717171;
}

/* ── Flash Banner Messages ───────────────────────────────────── */
.flash-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.5;
  border-width: 1px;
  border-style: solid;
}
.flash-banner svg       { flex-shrink: 0; margin-top: 1px; }
.flash-banner-body      { flex: 1; }
.flash-banner.flash-success {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #065F46;
}
.flash-banner.flash-error {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #991B1B;
}

/* ── Lesson Table Action Buttons (color-coded) ───────────────── */
.btn-icon.btn-view   { background: transparent; color: #1E3A5F; }
.btn-icon.btn-view:hover   { background: #EFF6FF; color: #1E3A5F; }
.btn-icon.btn-edit   { background: transparent; color: #444; }
.btn-icon.btn-edit:hover   { background: #F3F4F6; color: #111; }
.btn-icon.btn-delete { background: transparent; color: #EF4444; }
.btn-icon.btn-delete:hover { background: #FEF2F2; color: #DC2626; }
.btn-icon.btn-photocast-add { background: transparent; color: #7C3AED; }
.btn-icon.btn-photocast-add:hover { background: #F5F3FF; color: #6D28D9; }
.btn-icon.btn-photocast-remove { background: transparent; color: #D97706; }
.btn-icon.btn-photocast-remove:hover { background: #FFFBEB; color: #B45309; }

.photocast-quick-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

/* ── Layout Option: Admin Blue Selected State ────────────────── */
.admin-body .layout-option.selected {
  border-color: #1E3A5F;
  background: #EFF6FF;
}
.admin-body .layout-option:focus-visible {
  outline: 2px solid #1E3A5F;
  outline-offset: 2px;
}

/* ── Toggle: Green Checked State in Admin ────────────────────── */
.admin-body .toggle input:checked + .toggle-slider { background: #10B981; }

/* ── Publish Row in Form ─────────────────────────────────────── */
.publish-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.publish-status {
  font-size: .9375rem;
  font-weight: 600;
  color: #717171;
  transition: color .2s ease;
  cursor: pointer;
  user-select: none;
}
.publish-status.is-published { color: #10B981; }

/* ── Content Textarea: Inner Shadow ─────────────────────────── */
textarea.form-control {
  box-shadow: inset 0 2px 6px rgba(0,0,0,.04);
}
textarea.form-control:focus {
  border-color: var(--dark);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.04), 0 0 0 3px rgba(34,34,34,.06);
}

/* ── Form Section Title Polish ───────────────────────────────── */
.form-section-title {
  letter-spacing: .1em;
  margin-bottom: 20px;
  color: #717171;
}

/* ── PQR Card Heading ────────────────────────────────────────── */
.pqr-heading h2 {
  font-size: 1.0625rem;
  font-weight: 800;
  color: #111;
  margin: 0 0 2px;
  letter-spacing: -.01em;
}
.pqr-heading p {
  margin: 0;
  font-size: .8125rem;
  color: #717171;
  line-height: 1.5;
}

/* ── Admin Empty State ───────────────────────────────────────── */
.admin-empty-state {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 60px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.admin-empty-state svg { color: var(--gray-2); }
.admin-empty-state h3  { color: #111; font-size: 1.125rem; font-weight: 700; margin: 0; }
.admin-empty-state p   { color: #717171; font-size: .875rem; max-width: 280px; margin: 0; }

/* ── Password Show/Hide Toggle ───────────────────────────────── */
.password-field { position: relative; }
.password-field .form-control { padding-right: 48px; }
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #717171;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s;
  outline: none;
  border-radius: 4px;
}
.password-toggle:hover         { color: #222; }
.password-toggle:focus-visible { outline: 2px solid #1E3A5F; }

/* ── Login Card Polish ───────────────────────────────────────── */
.login-card          { max-width: 400px; }
.login-logo h1       { font-size: 1.5rem; letter-spacing: -.025em; color: #111; }
.login-logo p        { font-weight: 500; letter-spacing: .01em; }
.login-logo-icon     { background: #1E3A5F; box-shadow: 0 4px 14px rgba(30,58,95,.3); }

/* ── Admin Table Header ──────────────────────────────────────── */
.admin-table-header {
  background: #F9FAFB;
  color: #717171;
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ── Lesson Row: Alternating Row Backgrounds ─────────────────── */
.lesson-row:nth-child(even) { background: #FAFAFA; }
.lesson-row:nth-child(even):hover { background: var(--gray-4); }

/* ── Scripture Modal ─────────────────────────────────────────── */
.scripture-ref {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #1E3A5F;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(30,58,95,.3);
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 3px;
  transition: background .15s, color .15s;
  display: inline;
}
.scripture-ref:hover, .scripture-ref:active {
  background: #EEF2FF;
  text-decoration-color: #1E3A5F;
}

.scripture-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 1000;
  transition: background .3s;
}
.scripture-backdrop.visible { background: rgba(0,0,0,.5); }

.scripture-modal {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 1001;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0,0,0,.18);
  padding-bottom: env(safe-area-inset-bottom);
}
.scripture-modal.open { transform: translateY(0); }

@media (min-width: 600px) {
  .scripture-modal {
    left: 50%; right: auto;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 520px;
    border-radius: 20px 20px 0 0;
  }
  .scripture-modal.open { transform: translateX(-50%) translateY(0); }
}

.scripture-modal-handle {
  width: 36px; height: 4px;
  background: #E5E7EB;
  border-radius: 2px;
  margin: 12px auto 0;
  flex-shrink: 0;
}

.scripture-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 12px;
  flex-shrink: 0;
}

.scripture-modal-eyebrow {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #1E3A5F;
  margin-bottom: 3px;
}

.scripture-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #111;
  margin: 0;
  letter-spacing: -.01em;
}

.scripture-modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: #F4F4F5;
  color: #555;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}
.scripture-modal-close:hover { background: #E5E7EB; }

.scripture-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 20px 16px;
  -webkit-overflow-scrolling: touch;
}

.scripture-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 0;
  color: #717171;
  font-size: .875rem;
}

.scripture-spinner {
  width: 28px; height: 28px;
  border: 3px solid #E5E7EB;
  border-top-color: #1E3A5F;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.scripture-verses { display: flex; flex-direction: column; gap: 10px; }

.scripture-verse {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.scripture-verse-num {
  font-size: .7rem;
  font-weight: 800;
  color: #1E3A5F;
  background: #EEF2FF;
  padding: 3px 7px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 3px;
  line-height: 1;
}

.scripture-verse-text {
  font-size: 1.05rem;
  color: #111;
  line-height: 1.75;
  font-style: italic;
}

.scripture-error {
  padding: 24px 0;
  text-align: center;
  color: #EF4444;
  font-size: .875rem;
}

.scripture-modal-footer {
  padding: 10px 20px 14px;
  flex-shrink: 0;
  border-top: 1px solid #F0F0F0;
}

.scripture-translation {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #B0B0B0;
}
