:root {
  --navy-950: #0a1526;
  --navy-900: #0f1e36;
  --navy-800: #182d4f;
  --navy-700: #233f6b;
  --crimson-800: #701530;
  --crimson-700: #8c1d40;
  --crimson-600: #a6244d;
  --gold-600: #b3891b;
  --gold-500: #c59b27;
  --gold-400: #dfc05a;
  --gold-200: #f3e4b2;
  --ivory-100: #fbf8f1;
  --ivory-200: #f3ede0;
  --ivory-300: #e6decb;
  --slate-900: #161d26;
  --slate-700: #3d4856;
  --slate-600: #556274;
  --emerald-700: #176b45;
  --emerald-100: #e3f7ed;
  --amber-100: #fef5d9;
  --shadow-soft: 0 10px 30px -8px rgba(15, 30, 54, 0.10), 0 4px 12px -2px rgba(15, 30, 54, 0.06);
  --shadow-elevated: 0 20px 45px -12px rgba(10, 21, 38, 0.25);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--ivory-100);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(197, 155, 39, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 88% 15%, rgba(140, 29, 64, 0.06) 0%, transparent 40%);
  color: var(--slate-900);
  line-height: 1.6;
  min-block-size: 100dvh;
  display: flex;
  flex-direction: column;
}

.visually-hidden {
  position: absolute;
  clip-path: inset(50%);
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.mono-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
}

/* --- TOP UNIVERSITY HEADER (Static / Non-Fixed) --- */
.uni-header {
  background: linear-gradient(135deg, var(--navy-950) 0%, var(--navy-900) 60%, var(--navy-800) 100%);
  color: var(--ivory-100);
  border-block-end: 3px solid var(--gold-500);
  position: relative;
  box-shadow: 0 4px 20px rgba(10, 21, 38, 0.35);
}

.brand-crest {
  display: flex;
  align-items: safe center;
  gap: 0.95rem;
  text-decoration: none;
  color: inherit;
}

.uni-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  gap: 0.85rem;
}

.nav-link {
  color: var(--ivory-200);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.nav-link[aria-current="page"] {
  color: var(--gold-400);
  border-block-end: 2px solid var(--gold-500);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.btn-secondary-light {
  display: inline-flex;
  align-items: safe center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1.5px solid rgba(197, 155, 39, 0.65);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1.05rem;
  min-block-size: 44px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.btn-secondary-light:hover {
  background: rgba(255, 255, 255, 0.16);
}

.uni-header-inner {
  max-inline-size: 1420px;
  margin-inline: auto;
  padding: 0.9rem 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand-crest {
  display: flex;
  align-items: safe center;
  gap: 0.95rem;
}

.crest-shield {
  inline-size: 44px;
  block-size: 48px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.uni-sub {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--gold-400);
  font-weight: 700;
}

.uni-name {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #ffffff;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: safe center;
  gap: 1rem;
}

.course-switcher-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.switcher-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-200);
  font-weight: 600;
}

.course-select {
  background-color: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  border: 1px solid rgba(197, 155, 39, 0.55);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  min-block-size: 42px;
  cursor: pointer;
}

.course-select option {
  background-color: var(--navy-900);
  color: #ffffff;
}

.rag-status-pill {
  display: inline-flex;
  align-items: safe center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ivory-200);
}

.status-dot {
  inline-size: 9px;
  block-size: 9px;
  border-radius: 50%;
  background-color: var(--gold-400);
  box-shadow: 0 0 8px var(--gold-400);
}

.status-dot.connected {
  background-color: #2ce58b;
  box-shadow: 0 0 10px #2ce58b;
}

/* --- BUTTONS & INTERACTIVE CONTROLS --- */
.btn-gold-crest {
  display: inline-flex;
  align-items: safe center;
  justify-content: center;
  gap: 0.55rem;
  background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-600) 100%);
  color: var(--navy-950);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.65rem 1.2rem;
  min-block-size: 46px;
  border: 1px solid var(--gold-400);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 4px 14px rgba(197, 155, 39, 0.3);
}

.btn-gold-crest:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-primary-navy {
  display: inline-flex;
  align-items: safe center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--navy-900), var(--crimson-700));
  color: #ffffff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.7rem 1.35rem;
  min-block-size: 48px;
  border: 1px solid var(--gold-500);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter 0.15s ease;
}

.btn-primary-navy:hover {
  filter: brightness(1.12);
}

.btn-secondary-outline {
  display: inline-flex;
  align-items: safe center;
  justify-content: center;
  background: transparent;
  color: var(--navy-900);
  border: 1.5px solid var(--navy-800);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  min-block-size: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-secondary-outline:hover {
  background-color: rgba(15, 30, 54, 0.06);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold-500);
  outline-offset: 2px;
}

/* --- MAIN UNIVERSITY BOARD CONTAINER --- */
.uni-main {
  max-inline-size: 1420px;
  inline-size: 100%;
  margin-inline: auto;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex: 1;
}

/* --- HERO COURSE BANNER --- */
.course-hero-banner {
  background: linear-gradient(165deg, #ffffff 0%, var(--ivory-200) 100%);
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: clip;
  position: relative;
}

.hero-ornament-bar {
  block-size: 6px;
  background: linear-gradient(90deg, var(--navy-900) 0%, var(--crimson-700) 50%, var(--gold-500) 100%);
}

.hero-content-grid {
  padding: 1.85rem 2rem;
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 2rem;
  align-items: start;
}

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

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  flex-wrap: balance;
  gap: 0.55rem;
  margin-block-end: 0.85rem;
}

.badge-code,
.badge-term,
.badge-credits,
.badge-rag,
.badge-verified {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
}

.badge-code {
  background-color: var(--navy-900);
  color: var(--gold-400);
  border: 1px solid var(--gold-500);
}

.badge-term {
  background-color: var(--crimson-700);
  color: #ffffff;
}

.badge-credits {
  background-color: var(--ivory-300);
  color: var(--navy-900);
}

.badge-rag,
.badge-verified {
  background-color: var(--emerald-100);
  color: var(--emerald-700);
  border: 1px solid rgba(23, 107, 69, 0.25);
}

.hero-course-title {
  margin: 0 0 0.65rem 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.85rem, 3vw, 2.55rem);
  font-weight: 700;
  line-height: 1.18;
  color: var(--navy-950);
}

.hero-course-summary {
  margin: 0 0 1.4rem 0;
  color: var(--slate-700);
  font-size: 0.98rem;
  max-inline-size: 78ch;
}

.hero-meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  padding-block-start: 1.15rem;
  border-block-start: 1px solid var(--ivory-300);
}

.meta-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.meta-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--crimson-700);
  font-weight: 700;
}

.meta-val {
  font-size: 0.95rem;
  color: var(--navy-950);
}

.meta-sub {
  font-size: 0.82rem;
  color: var(--slate-600);
}

/* Stamp Provenance Card */
.hero-stamp-card {
  background: var(--ivory-100);
  border: 1.5px dashed var(--gold-500);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.stamp-seal {
  display: flex;
  justify-content: center;
}

.seal-ring {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--crimson-700);
  background: rgba(140, 29, 64, 0.08);
  border: 1px solid rgba(140, 29, 64, 0.3);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
}

.stamp-details {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.83rem;
}

.stamp-details div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border-block-end: 1px solid rgba(0, 0, 0, 0.06);
  padding-block-end: 0.35rem;
}

.stamp-details dt {
  color: var(--slate-600);
  font-weight: 500;
}

.stamp-details dd {
  margin: 0;
  font-weight: 700;
  color: var(--navy-900);
  text-align: end;
  min-inline-size: 0;
  overflow: clip;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- TWO-COLUMN BOARD: BOOK & COURSE --- */
.board-columns {
  display: grid;
  grid-template-columns: minmax(380px, 5fr) minmax(440px, 7fr);
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .board-columns {
    grid-template-columns: 1fr;
  }
}

.board-panel {
  background: #ffffff;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.panel-header {
  border-block-end: 2px solid var(--ivory-200);
  padding-block-end: 0.9rem;
}

.panel-tag {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--crimson-700);
  margin-block-end: 0.25rem;
}

.panel-title {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy-950);
}

/* --- 3D HARDCOVER TEXTBOOK STAGE --- */
.book-display-stage {
  display: grid;
  grid-template-columns: 165px 1fr;
  gap: 1.5rem;
  align-items: center;
  background: linear-gradient(135deg, var(--ivory-100) 0%, var(--ivory-200) 100%);
  padding: 1.35rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--ivory-300);
}

@media (max-width: 560px) {
  .book-display-stage {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.book-3d-cover {
  position: relative;
  inline-size: 150px;
  block-size: 215px;
  border-radius: 4px 10px 10px 4px;
  background: linear-gradient(145deg, var(--navy-900) 0%, var(--navy-950) 65%, var(--crimson-800) 100%);
  box-shadow:
    -6px 6px 16px rgba(10, 21, 38, 0.35),
    inset 0 0 0 2px rgba(197, 155, 39, 0.55);
  display: flex;
  overflow: clip;
  flex-shrink: 0;
}

.book-spine {
  inline-size: 16px;
  background: linear-gradient(90deg, rgba(255,255,255,0.18) 0%, rgba(0,0,0,0.45) 100%);
  border-inline-end: 1px solid rgba(197, 155, 39, 0.45);
}

.book-front {
  flex: 1;
  padding: 0.95rem 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  color: var(--ivory-100);
}

.book-crest-mini {
  font-family: 'Cinzel', serif;
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  color: var(--gold-400);
  border-block-end: 1px solid rgba(197, 155, 39, 0.4);
  padding-block-end: 0.35rem;
}

.book-cover-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  line-clamp: 4;
  overflow: clip;
}

.book-cover-author {
  font-size: 0.7rem;
  color: var(--gold-200);
  font-weight: 500;
}

.book-cover-edition {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(197, 155, 39, 0.22);
  color: var(--gold-400);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
}

.book-biblio-details {
  min-inline-size: 0;
}

.book-edition-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--crimson-700);
  background: rgba(140, 29, 64, 0.1);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  margin-block-end: 0.4rem;
}

.book-main-title {
  margin: 0 0 0.25rem 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.22;
  color: var(--navy-950);
}

.book-authors {
  margin: 0 0 0.9rem 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--slate-700);
}

.biblio-grid {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem 1rem;
}

.biblio-item dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-600);
  font-weight: 600;
}

.biblio-item dd {
  margin: 0.1rem 0 0 0;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--navy-900);
}

.book-rationale-box {
  background: var(--amber-100);
  border-inline-start: 4px solid var(--gold-500);
  padding: 1rem 1.15rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.book-rationale-box h5 {
  margin: 0 0 0.35rem 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy-900);
}

.book-rationale-box p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--slate-900);
}

.sub-heading {
  margin: 0 0 0.75rem 0;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy-800);
  font-weight: 700;
}

.chapters-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.chapter-card {
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
}

.chapter-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-block-end: 0.2rem;
}

.chapter-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--crimson-700);
}

.chapter-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy-950);
}

.chapter-relevance {
  margin: 0;
  font-size: 0.82rem;
  color: var(--slate-600);
}

.companion-list {
  margin: 0;
  padding-inline-start: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.86rem;
  color: var(--slate-700);
}

/* --- RIGHT COLUMN: COURSE SYLLABUS DETAILS --- */
.syllabus-block {
  display: flex;
  flex-direction: column;
}

.objectives-list {
  margin: 0;
  padding-inline-start: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.92rem;
  color: var(--slate-900);
}

.objectives-list li::marker {
  font-weight: 700;
  color: var(--crimson-700);
}

.grading-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 0.85rem;
}

.grading-card {
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  border-block-start: 3px solid var(--navy-800);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.grading-weight {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1;
  color: var(--crimson-700);
}

.grading-comp {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--navy-950);
}

.grading-details {
  font-size: 0.78rem;
  color: var(--slate-600);
}

/* Schedule & Filter */
.schedule-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: safe center;
  gap: 0.75rem;
  margin-block-end: 0.75rem;
}

.schedule-header-row .sub-heading {
  margin: 0;
}

.schedule-search-form input {
  font: inherit;
  font-size: max(0.88rem, 14px);
  padding: 0.45rem 0.8rem;
  min-block-size: 38px;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  background: var(--ivory-100);
  min-inline-size: 240px;
}

.weekly-timeline {
  max-block-size: 420px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-inline-end: 0.35rem;
}

.week-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 0.85rem;
  padding: 0.75rem 0.95rem;
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  align-items: start;
}

.week-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--navy-900);
  background: var(--gold-200);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-align: center;
}

.week-topic {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy-950);
  margin: 0 0 0.2rem 0;
}

.week-reading {
  margin: 0;
  font-size: 0.82rem;
  color: var(--crimson-700);
  font-weight: 600;
}

/* --- BOTTOM RAG INTELLIGENCE DECK --- */
.rag-intelligence-deck {
  background: #ffffff;
  border: 1.5px solid var(--gold-500);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.deck-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  border-block-end: 1px solid var(--ivory-300);
  padding-block-end: 1rem;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  flex-wrap: balance;
  gap: 0.5rem;
}

.prompt-chip {
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  color: var(--navy-900);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.prompt-chip:hover {
  background: var(--gold-200);
  border-color: var(--gold-500);
}

.rag-workspace-grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 1.5rem;
  align-items: stretch;
}

@media (max-width: 980px) {
  .rag-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.rag-chat-box {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-md);
  background: var(--ivory-100);
  overflow: clip;
}

.chat-messages {
  block-size: 340px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.chat-msg {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.chat-msg.user-msg {
  flex-direction: row-reverse;
}

.msg-avatar {
  inline-size: 34px;
  block-size: 34px;
  border-radius: 50%;
  background: var(--navy-900);
  color: var(--gold-400);
  font-family: 'Cinzel', serif;
  font-size: 0.76rem;
  font-weight: 700;
  display: grid;
  place-content: center;
  flex-shrink: 0;
}

.user-msg .msg-avatar {
  background: var(--crimson-700);
  color: #ffffff;
}

.msg-bubble {
  background: #ffffff;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.05rem;
  font-size: 0.9rem;
  max-inline-size: 85%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.user-msg .msg-bubble {
  background: var(--navy-900);
  color: #ffffff;
  border-color: var(--navy-800);
}

.msg-bubble p {
  margin: 0 0 0.5rem 0;
}

.msg-bubble p:last-child {
  margin-block-end: 0;
}

.msg-meta-tag {
  display: inline-block;
  margin-block-start: 0.5rem;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--emerald-700);
  background: var(--emerald-100);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.rag-chat-form {
  border-block-start: 1px solid var(--ivory-300);
  background: #ffffff;
  padding: 0.75rem;
}

.chat-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.chat-input-row textarea {
  flex: 1;
  font: inherit;
  font-size: max(1rem, 1em);
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  resize: vertical;
  min-block-size: 52px;
}

/* RAG Chunks Inspector */
.rag-chunks-inspector {
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-md);
  background: var(--ivory-100);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.inspector-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inspector-top h4 {
  margin: 0;
  font-size: 0.92rem;
  color: var(--navy-950);
}

.chunk-counter-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--navy-900);
  color: var(--gold-400);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.inspector-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--slate-600);
}

.chunks-scroll-list {
  max-block-size: 330px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chunk-item {
  background: #ffffff;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  font-size: 0.8rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.chunk-item.highlighted {
  border: 2px solid var(--gold-500);
  background: var(--amber-100);
}

.chunk-item-head {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--crimson-700);
  margin-block-end: 0.25rem;
}

.chunk-item-body {
  margin: 0;
  color: var(--slate-700);
  white-space: pre-line;
}

/* --- NATIVE MODAL DIALOG (Modern Web Guidance Compliant) --- */
dialog.admin-dialog {
  border: 2px solid var(--gold-500);
  border-radius: var(--radius-lg);
  padding: 0;
  max-inline-size: 680px;
  inline-size: calc(100% - 2rem);
  background: #ffffff;
  color: var(--slate-900);
  box-shadow: var(--shadow-elevated);
}

/* MANDATORY scroll containment rules from Modern Web Guidance */
dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(10, 21, 38, 0.68);
  backdrop-filter: blur(4px);
}

.admin-dialog-inner {
  padding: 1.75rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.admin-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  border-block-end: 1px solid var(--ivory-300);
  padding-block-end: 0.85rem;
}

.admin-dialog-title {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.65rem;
  color: var(--navy-950);
}

.dialog-close-btn {
  background: var(--ivory-200);
  border: 1px solid var(--ivory-300);
  border-radius: 50%;
  inline-size: 38px;
  block-size: 38px;
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-content: center;
  color: var(--navy-950);
}

.admin-dialog-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--slate-700);
}

.admin-Sample-presets {
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.95rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.preset-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy-900);
  inline-size: 100%;
}

.btn-preset {
  background: #ffffff;
  border: 1px solid var(--navy-800);
  color: var(--navy-900);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
}

.btn-preset:hover {
  background: var(--gold-200);
}

.admin-upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--navy-950);
}

.file-drop-zone {
  position: relative;
  border: 2px dashed var(--gold-500);
  background: var(--ivory-100);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
}

.file-input-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  inline-size: 100%;
  block-size: 100%;
}

.drop-zone-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--slate-700);
}

.selected-file-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  background: var(--navy-900);
  color: var(--gold-400);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
}

.divider-or {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--slate-600);
  position: relative;
}

.field-group input[type="text"],
.field-group textarea {
  font: inherit;
  font-size: max(1rem, 1em);
  padding: 0.65rem 0.85rem;
  border: 1px solid #767676;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.upload-status-banner {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 600;
  background: var(--emerald-100);
  color: var(--emerald-700);
  border: 1px solid rgba(23, 107, 69, 0.3);
}

.upload-status-banner.error {
  background: #fde8ec;
  color: var(--crimson-800);
  border-color: rgba(140, 29, 64, 0.3);
}

.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-block-start: 0.4rem;
}

/* --- ADMIN DEDICATED PAGE LAYOUT (SIDE MENU + MAIN STEP VIEW) --- */
.admin-workspace-layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 980px) {
  .admin-workspace-layout {
    grid-template-columns: 1fr;
  }
}

.admin-sidebar-card {
  background: #ffffff;
  border: 1px solid var(--ivory-300);
  border-block-start: 4px solid var(--navy-900);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 1.25rem;
}

.admin-sidebar-header {
  border-block-end: 1px solid var(--ivory-300);
  padding-block-end: 0.75rem;
}

.admin-sidebar-title {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy-950);
}

.admin-side-tablist {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.admin-side-tab {
  position: relative;
  inline-size: 100%;
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: start;
  font: inherit;
  color: var(--slate-700);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.admin-side-tab:hover {
  background: var(--ivory-200);
  color: var(--navy-950);
}

.admin-side-tab[aria-selected="true"] {
  background: var(--navy-900);
  color: #ffffff;
}

.admin-side-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  border-inline-start: 4px solid var(--gold-500);
}

.side-step-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--crimson-700);
}

.admin-side-tab[aria-selected="true"] .side-step-badge {
  color: var(--gold-400);
}

.side-step-name {
  font-size: 0.94rem;
  font-weight: 700;
}

.admin-panels-stage {
  min-inline-size: 0;
}

.admin-courses-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.admin-course-card {
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-course-card.active-course {
  border: 2px solid var(--gold-500);
  background: var(--amber-100);
}

.admin-course-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.admin-course-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-block-end: 0.15rem;
}

.admin-course-title {
  font-size: 1rem;
  color: var(--navy-950);
}

.admin-course-meta {
  font-size: 0.78rem;
  color: var(--slate-600);
}

.admin-course-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.btn-delete-course {
  background: #fde8ec;
  color: var(--crimson-800);
  border: 1px solid rgba(140, 29, 64, 0.3);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  min-block-size: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-delete-course:hover {
  background: #f9d0d9;
}

.admin-active-summary {
  border-block-start: 1px solid var(--ivory-300);
  padding-block-start: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* --- STEP 3: ADMIN CHATBOT & TONE CONTROL CENTER --- */
.admin-chatbot-control-panel {
  border-block-start: 4px solid var(--gold-500);
}

.chatbot-config-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.chatbot-control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 980px) {
  .chatbot-control-grid {
    grid-template-columns: 1fr;
  }
}

.chatbot-fieldset {
  margin: 0;
  padding: 1.25rem;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-md);
  background: var(--ivory-100);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.fieldset-legend {
  padding-inline: 0.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--crimson-700);
}

.field-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 640px) {
  .field-row-2col {
    grid-template-columns: 1fr;
  }
}

.admin-select,
.chatbot-config-form input[type="text"],
.chatbot-config-form textarea {
  inline-size: 100%;
  font: inherit;
  font-size: max(0.92rem, 16px);
  padding: 0.55rem 0.8rem;
  min-block-size: 42px;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--slate-900);
}

.range-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.admin-range-input {
  inline-size: 100%;
  accent-color: var(--crimson-700);
  cursor: pointer;
}

.field-hint {
  font-size: 0.78rem;
  color: var(--slate-600);
}

.checkbox-group-stack {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding-block-start: 0.25rem;
}

.admin-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--slate-900);
  cursor: pointer;
  padding: 0.45rem 0.65rem;
  background: #ffffff;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
}

.admin-checkbox-label input[type="checkbox"] {
  inline-size: 20px;
  block-size: 20px;
  margin-block-start: 0.1rem;
  accent-color: var(--navy-900);
  flex-shrink: 0;
  cursor: pointer;
}

.chatbot-config-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.85rem;
  border-block-start: 1px solid var(--ivory-300);
  padding-block-start: 1rem;
}

.btn-gold-crest,
.btn-secondary-outline {
  text-decoration: none;
}

.footer-link {
  color: var(--gold-400);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}

/* --- OSTHATH-AI INTERACTIVE STUDY PAGE --- */
@media (min-width: 1041px) {
  body:has(.osthath-header) {
    block-size: 100dvh;
    max-block-size: 100dvh;
    overflow: hidden;
  }
}

.osthath-header .uni-header-inner.osthath-header-inner {
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  padding-block: 0.65rem;
}

.osthath-header ~ .uni-main {
  padding-block: 1rem;
  gap: 1rem;
  flex: 1 1 0;
  min-block-size: 0;
  overflow: hidden;
}

.osthath-header-bottom-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  inline-size: 100%;
}

.header-progress-dropdown-wrap {
  position: relative;
  margin-inline-start: auto;
}

.header-progress-trigger {
  anchor-name: --progress-trigger;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(197, 155, 39, 0.55);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.95rem;
  min-inline-size: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: start;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.header-progress-trigger:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--gold-400);
}

.dropdown-hint {
  color: #ffffff;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.header-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  inline-size: 100%;
}

.header-progress-title {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-400);
  font-weight: 700;
}

.header-progress-stats {
  color: var(--ivory-100);
  font-size: 0.78rem;
}

.header-progress-stats strong {
  color: var(--gold-400);
  margin-inline-end: 0.2rem;
}

/* Syllabus Topics Dropdown Popover anchored to the Bottom-Right Progress Bar button */
[popover].topics-dropdown-popover {
  position-anchor: --progress-trigger;
  inset: auto;
  top: anchor(bottom);
  right: anchor(right);
  margin: 0.45rem 0 0 0;
  inline-size: min(460px, calc(100dvw - 2rem));
  max-block-size: 75dvh;
  background: #ffffff;
  color: var(--slate-900);
  border: 2px solid var(--gold-500);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  box-shadow: var(--shadow-elevated);
}

[popover].topics-dropdown-popover:is(:popover-open, .\:popover-open) {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.topics-popover-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border-block-end: 1px solid var(--ivory-300);
  padding-block-end: 0.65rem;
}

.topics-popover-title {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.35rem;
  color: var(--navy-950);
}

/* 70% Left Interactive Study | 30% Right Chat */
.osthath-study-grid {
  flex: 1 1 0;
  min-block-size: 0;
  display: grid;
  grid-template-columns: 7fr 3fr;
  grid-template-rows: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}

@media (max-width: 1040px) {
  .osthath-study-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
  .osthath-right-chat-panel:not(.chat-popup-expanded) {
    block-size: 520px;
    max-block-size: 75dvh;
  }
  .header-left-stack {
    inline-size: 100%;
  }
  .header-progress-trigger {
    inline-size: 100%;
  }
}

.osthath-panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.study-active-topic-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Clean Interactive Study Canvas */
.interactive-study-canvas {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.study-module-card {
  background: linear-gradient(135deg, var(--ivory-100) 0%, var(--ivory-200) 100%);
  border: 1px solid var(--ivory-300);
  border-inline-start: 4px solid var(--gold-500);
  border-radius: var(--radius-md);
  padding: 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.study-module-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.study-reading-pill {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--crimson-700);
}

.study-module-title {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy-950);
}

.study-module-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--slate-700);
}

.study-syllabus-segments {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.study-segment-card {
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.25rem;
}

.study-segment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-block-end: 0.45rem;
}

.study-segment-sec {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy-800);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.study-segment-body {
  margin: 0;
  font-size: 0.9rem;
  color: var(--slate-900);
  white-space: pre-line;
}

.btn-sm-check {
  padding: 0.35rem 0.75rem;
  min-block-size: 34px;
  font-size: 0.78rem;
}

.osthath-left-panel,
.osthath-right-chat-panel {
  display: flex;
  flex-direction: column;
  padding: 1.15rem;
  gap: 0.75rem;
  min-block-size: 0;
  max-block-size: 100%;
  overflow: hidden;
}

/* Popup expand / collapse (chat and Interactive Study): only the panel that opens or closes is an animated layer
   (window.osthathPopTransition names it «ost-pop» for that one transition), and its old and new pictures are never shown
   together: opening shows only the new (big) panel growing out of the small one, closing shows only the big panel
   shrinking back, then the small one. The two panels keep their own grid columns, so nothing else moves meanwhile. */
.osthath-study-grid > .osthath-left-panel { grid-column: 1; grid-row: 1; }
.osthath-study-grid > .osthath-right-chat-panel { grid-column: 2; grid-row: 1; }
@media (max-width: 1040px) {
  .osthath-study-grid > .osthath-left-panel { grid-column: 1; grid-row: 1; }
  .osthath-study-grid > .osthath-right-chat-panel { grid-column: 1; grid-row: 2; }
}
::view-transition-group(ost-pop) {
  animation-duration: 0.4s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  overflow: clip;
  border-radius: 18px;
  background: var(--ivory-50, #fffdf8);   /* a solid box grows / shrinks; the panel picture is scaled inside it */
  box-shadow: 0 24px 60px -20px rgba(8, 14, 28, 0.45);
}
::view-transition-old(ost-pop),
::view-transition-new(ost-pop) {
  inline-size: 100%;
  block-size: 100%;
  object-fit: contain;           /* the whole panel, scaled, never stretched or cut */
  object-position: top center;
}
html.ost-vt-open::view-transition-old(ost-pop) { animation: none; opacity: 0; }
html.ost-vt-open::view-transition-new(ost-pop) { animation: none; opacity: 1; }
html.ost-vt-close::view-transition-old(ost-pop) { animation: none; opacity: 1; }
html.ost-vt-close::view-transition-new(ost-pop) { animation: none; opacity: 0; }
html.ost-vt-open::view-transition-old(root),
html.ost-vt-open::view-transition-new(root),
html.ost-vt-close::view-transition-old(root),
html.ost-vt-close::view-transition-new(root) { animation-duration: 0.3s; }

/* Expand / Collapse Icon Button in Top-Right of Chat Panel */
.chat-expand-icon-btn {
  inline-size: 38px;
  block-size: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ivory-300);
  background: var(--ivory-100);
  color: var(--navy-900);
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chat-expand-icon-btn:hover {
  background: var(--gold-200);
  border-color: var(--gold-500);
  color: var(--navy-950);
}

.chat-expand-icon-btn .icon-collapse {
  display: none;
}

.osthath-right-chat-panel.chat-popup-expanded .chat-expand-icon-btn {
  background: var(--navy-900);
  color: var(--gold-400);
  border-color: var(--gold-500);
}

.osthath-right-chat-panel.chat-popup-expanded .chat-expand-icon-btn .icon-expand {
  display: none;
}

.osthath-right-chat-panel.chat-popup-expanded .chat-expand-icon-btn .icon-collapse {
  display: block;
}

/* Backdrop & Expanded Popup State Over the Page */
.chat-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 21, 38, 0.62);
  backdrop-filter: blur(4px);
  z-index: 990;
  opacity: 1;
  transition:
    display,
    opacity 0.28s ease-out;
  transition-behavior: allow-discrete;
}

@starting-style {
  .chat-popup-backdrop {
    opacity: 0;
  }
}

.chat-popup-backdrop[hidden] {
  display: none;
  opacity: 0;
}

.osthath-right-chat-panel.chat-popup-expanded {
  position: fixed;
  inset: 6dvh 0 auto 0;
  margin-inline: auto;
  inline-size: min(880px, calc(100dvw - 2.5rem));
  block-size: 86dvh;
  z-index: 1000;
  border: 2px solid var(--gold-500);
  box-shadow: var(--shadow-elevated);
  padding: 1.5rem;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }

  .chat-popup-backdrop {
    transition-duration: 0.1s;
  }
}

.osthath-left-panel .panel-header,
.osthath-right-chat-panel .panel-header {
  padding-block-end: 0.55rem;
}

.osthath-left-panel .panel-title,
.osthath-right-chat-panel .panel-title {
  font-size: 1.35rem;
}

.osthath-chat-container {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-block-size: 0;
  overflow: hidden;
}

.osthath-chat-container .chat-messages {
  flex: 1 1 0;
  block-size: 0;
  min-block-size: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0.85rem;
  gap: 0.65rem;
}

.osthath-chat-container .msg-bubble {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.streaming-cursor {
  display: inline-block;
  inline-size: 7px;
  block-size: 1.05em;
  background-color: var(--crimson-700);
  vertical-align: text-bottom;
  margin-inline-start: 3px;
  border-radius: 1px;
  animation: cursorBlink 0.8s steps(2, start) infinite;
}

@keyframes cursorBlink {
  to {
    opacity: 0;
  }
}

.osthath-right-chat-panel .rag-chat-form {
  padding: 0.6rem;
  flex-shrink: 0;
}

.osthath-right-chat-panel .chat-input-row {
  flex-direction: row;
  align-items: flex-end;
  gap: 0.5rem;
}

.osthath-right-chat-panel .chat-input-row textarea {
  min-block-size: 42px;
  max-block-size: 88px;
  block-size: 42px;
  padding: 0.45rem 0.7rem;
  resize: none;
  overflow-y: auto;
}

.osthath-right-chat-panel .btn-primary-navy {
  inline-size: auto;
  padding: 0.5rem 0.95rem;
  min-block-size: 42px;
  flex-shrink: 0;
}

/* Interactive Study Stage Box: Center Text + Center-Bottom AI Ostath Icon */
.interactive-study-stage {
  flex: 1;
  position: relative;
  min-block-size: 280px;
  background: linear-gradient(180deg, var(--ivory-100) 0%, #ffffff 100%);
  border: 1.5px solid var(--ivory-300);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
}

.study-stage-center-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.45rem;
  max-inline-size: 56ch;
  padding-block: 1rem;
}

.study-stage-prompt-text {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.45rem, 2.2vw, 1.9rem);
  font-weight: 700;
  color: var(--navy-950);
  letter-spacing: 0.01em;
}

.study-stage-subtext {
  font-size: 0.85rem;
  color: var(--slate-600);
  font-weight: 500;
}

.study-stage-bottom-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  inline-size: 100%;
  padding-block-start: 0.5rem;
}

.osthath-ai-icon-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 0;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  font: inherit;
  color: var(--navy-950);
  transition: transform 0.18s ease;
}

.osthath-ai-icon-btn:hover {
  transform: translateY(-2px);
}

.osthath-icon-circle {
  inline-size: 58px;
  block-size: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 100%);
  color: var(--gold-400);
  border: 2px solid var(--gold-500);
  box-shadow: 0 6px 18px rgba(15, 30, 54, 0.22);
  display: grid;
  place-content: center;
  transition: box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.osthath-ai-icon-btn:hover .osthath-icon-circle {
  box-shadow: 0 8px 22px rgba(197, 155, 39, 0.4);
  border-color: var(--gold-400);
}

.osthath-ai-icon-btn.active-osthath .osthath-icon-circle {
  background: linear-gradient(135deg, var(--crimson-700) 0%, var(--crimson-800) 100%);
  color: #ffffff;
  border-color: var(--gold-400);
  animation: osthathPulseRing 1.6s infinite;
}

@keyframes osthathPulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(140, 29, 64, 0.55);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(140, 29, 64, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(140, 29, 64, 0);
  }
}

.osthath-icon-label {
  font-family: 'Cinzel', serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy-900);
}

/* Styled Native <progress> in Blue Header (Modern Web Guidance `progress` compliant) */
progress#courseProgressBar {
  appearance: none;
  border: 0 solid;
  overflow: clip;
  inline-size: 100%;
  block-size: 10px;
  --progress-bar-radius: 999px;
  border-radius: var(--progress-bar-radius);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.25);
  pointer-events: none;
}

progress#courseProgressBar::-webkit-progress-bar {
  background: transparent;
}

progress#courseProgressBar::-webkit-progress-value {
  background: linear-gradient(90deg, var(--gold-400) 0%, var(--gold-500) 55%, #2ce58b 100%);
  border-radius: var(--progress-bar-radius);
  transition: inline-size 0.3s ease;
}

progress#courseProgressBar::-moz-progress-bar {
  background: linear-gradient(90deg, var(--gold-400) 0%, var(--gold-500) 55%, #2ce58b 100%);
  border-radius: var(--progress-bar-radius);
  transition: inline-size 0.3s ease;
}

.syllabus-topics-list {
  max-block-size: 380px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-inline-end: 0.25rem;
}

.syllabus-topic-item {
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  background: var(--ivory-100);
  overflow: clip;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.syllabus-topic-item.selected-topic {
  border: 2px solid var(--navy-900);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 30, 54, 0.08);
}

.topic-select-btn {
  inline-size: 100%;
  background: transparent;
  border: 0;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-align: start;
  font: inherit;
  cursor: pointer;
}

.topic-select-btn:hover {
  background: rgba(197, 155, 39, 0.08);
}

.topic-check-indicator {
  inline-size: 26px;
  block-size: 26px;
  border-radius: 50%;
  background: var(--ivory-300);
  color: var(--navy-900);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-content: center;
  flex-shrink: 0;
  margin-block-start: 0.1rem;
}

.completed-topic .topic-check-indicator {
  background: var(--emerald-700);
  color: #ffffff;
}

.topic-item-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-inline-size: 0;
  flex: 1;
}

.topic-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.topic-week-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--crimson-700);
}

.current-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--navy-900);
  color: var(--gold-400);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.topic-item-name {
  font-size: 0.88rem;
  color: var(--navy-950);
}

.topic-item-reading {
  font-size: 0.78rem;
  color: var(--slate-600);
}

/* --- RAG TOPIC IMAGES & VISUAL AIDS (ADMIN & STUDENT STAGE / CHAT) --- */
.admin-topic-images-section {
  margin-block-start: 0.5rem;
}

.topic-image-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--ivory-100);
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.topic-image-form input[type="text"],
.topic-image-form input[type="url"],
.topic-image-form textarea {
  inline-size: 100%;
  font: inherit;
  font-size: max(0.88rem, 16px);
  padding: 0.5rem 0.75rem;
  min-block-size: 40px;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.topic-file-input {
  font: inherit;
  font-size: 0.84rem;
}

.url-preset-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.url-preset-row input {
  flex: 1;
}

.admin-topic-images-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-block-size: 290px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.admin-topic-image-card {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #ffffff;
  border: 1px solid var(--ivory-300);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
}

.admin-topic-thumb {
  inline-size: 96px;
  block-size: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--ivory-300);
  background: var(--navy-950);
  flex-shrink: 0;
}

.admin-topic-image-info {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.admin-topic-image-title {
  font-size: 0.88rem;
  color: var(--navy-950);
}

.admin-topic-image-desc {
  margin: 0;
  font-size: 0.76rem;
  color: var(--slate-600);
}

/* Interactive Study Stage Visual Aid Figure */
.study-stage-visual-container {
  inline-size: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.85rem;
  margin-block-end: 0.35rem;
}

.stage-topic-figure {
  margin: 0;
  background: #ffffff;
  border: 1.5px solid var(--gold-500);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  box-shadow: var(--shadow-soft);
  max-inline-size: 520px;
  inline-size: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.stage-topic-img {
  inline-size: 100%;
  max-block-size: 195px;
  block-size: auto;
  object-fit: contain;
  border-radius: 6px;
  background: var(--navy-950);
}

.stage-topic-caption {
  font-size: 0.82rem;
  color: var(--navy-950);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.stage-topic-note {
  color: var(--slate-600);
  font-size: 0.78rem;
}

/* Chat Inline Visual Aid Figure */
.chat-topic-figure {
  margin: 0.65rem 0 0.35rem 0;
  background: var(--ivory-100);
  border: 1px solid var(--gold-500);
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chat-topic-img {
  inline-size: 100%;
  max-block-size: 150px;
  block-size: auto;
  object-fit: contain;
  border-radius: 4px;
  background: var(--navy-950);
}

.chat-topic-caption {
  font-size: 0.76rem;
  color: var(--navy-950);
  text-align: center;
}

/* --- FOOTER --- */
.uni-footer {
  background: var(--navy-950);
  color: var(--ivory-300);
  border-block-start: 2px solid var(--gold-500);
  padding: 1.1rem 1.75rem;
  font-size: 0.82rem;
}

.uni-footer-inner {
  max-inline-size: 1420px;
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
}

.auto-images-box {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  margin-block-end: 1.25rem;
  border: 1px dashed rgba(23, 107, 69, 0.45);
  border-radius: var(--radius-sm);
}
.auto-images-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.auto-images-log { margin: 0.4rem 0 0; padding-inline-start: 1.1rem; font-weight: 500; }

/* STEP 1: course materials */
.mat-new-course { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.mat-block { border: 1px solid rgba(197, 155, 39, 0.45); border-radius: var(--radius-md); padding: 1rem 1.1rem 1.1rem; display: grid; gap: 0.75rem; margin: 0; min-inline-size: 0; }
.mat-block legend { font-weight: 800; color: var(--navy-950); padding-inline: 0.4rem; display: flex; align-items: center; gap: 0.5rem; }
.mat-block.mat-off { opacity: 0.45; pointer-events: none; }
.mat-num { display: inline-grid; place-items: center; inline-size: 1.6rem; block-size: 1.6rem; border-radius: 50%; background: var(--navy-900); color: var(--gold-400, #e2c063); font-size: 0.85rem; }
.mat-hint { margin: 0; font-size: 0.86rem; color: var(--slate-700); }
.mat-hint code { font-size: 0.8rem; }
.mat-check { display: flex; gap: 0.55rem; align-items: flex-start; font-size: 0.88rem; cursor: pointer; }
.mat-check input { margin-block-start: 0.2rem; }
.mat-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.mat-grow { flex: 1 1 240px; }
.mat-resources { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.mat-res { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "type name btn" "type meta btn"; gap: 0.1rem 0.75rem; align-items: center; padding: 0.6rem 0.75rem; border: 1px solid #e3ddd0; border-radius: var(--radius-sm); background: #fff; }
.mat-res-type { grid-area: type; font: 700 0.7rem/1 'JetBrains Mono', monospace; background: var(--navy-900); color: #fff; border-radius: 6px; padding: 0.35rem 0.45rem; }
.mat-res-name { grid-area: name; font-weight: 700; overflow-wrap: anywhere; }
.mat-res-meta { grid-area: meta; font-size: 0.8rem; color: var(--slate-600); }
.mat-res .btn-delete-course { grid-area: btn; }
.mat-empty { font-size: 0.86rem; color: var(--slate-600); }
.mat-choice { display: flex; gap: 0.65rem; align-items: flex-start; padding: 0.7rem 0.8rem; border: 1px solid #e3ddd0; border-radius: var(--radius-sm); background: #fff; cursor: pointer; font-size: 0.9rem; }
.mat-choice:has(input:checked) { border-color: var(--gold-500); box-shadow: inset 0 0 0 1px var(--gold-500); }
.mat-choice input { margin-block-start: 0.25rem; }
.mat-saved { font-size: 0.82rem; color: var(--emerald-700); min-block-size: 1.1em; }
#adminPanelStep1 .board-panel { display: grid; gap: 1rem; }
#adminPanelStep1 input[type="file"]:not(.file-input-native) { font-size: 0.85rem; }
/* stacked layout (narrow screens): the step menu sits above the panel and must not stay pinned over it */
@media (max-width: 960px) { .admin-sidebar-card { position: static; } }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.9rem 1.1rem; }
.mat-grid .field-hint { font-size: 0.78rem; color: var(--slate-600); min-block-size: 2.2em; }
/* Admin → Course Materials → Exams */
.exam-admin-list { display: grid; gap: 0.75rem; }
.exam-admin-card { border: 1px solid #e3ddd0; border-radius: var(--radius-sm); background: #fff; padding: 0.75rem 0.85rem; display: grid; gap: 0.6rem; }
.exam-admin-head { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.exam-admin-name { flex: 1 1 180px; font-weight: 700; font-size: 0.95rem; padding: 0.4rem 0.55rem; border: 1px solid var(--ivory-300); border-radius: var(--radius-sm); }
.exam-admin-count { font-size: 0.8rem; color: var(--slate-600); }
.exam-admin-all { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.exam-admin-weeks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.exam-week-chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.6rem; border: 1px solid var(--ivory-300); border-radius: 999px; font-size: 0.82rem; cursor: pointer; background: var(--ivory-100); user-select: none; }
.exam-week-chip input { margin: 0; accent-color: var(--navy-800); }
.exam-week-chip.on { background: var(--navy-900); border-color: var(--navy-900); color: #fff; }
.exam-week-chip:focus-within { outline: 2px solid var(--gold-500); outline-offset: 2px; }

/* Step 5: whether each API key is set in .env (keys never reach the browser) */
.key-status { margin: 0; font-weight: 700; color: var(--emerald-700); font-size: 0.9rem; }
.key-status.missing { color: var(--crimson-700); }

/* STEP 5 · 2 voice model choice */
.voice-engines { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0.6rem; }
.voice-engine { position: relative; display: flex; flex-direction: column; gap: 0.35rem; padding: 0.8rem 0.9rem 0.8rem 2.3rem; border: 1.5px solid var(--line, #d9d2c3); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.voice-engine:hover { border-color: var(--gold-500, #c59b27); }
.voice-engine input { position: absolute; left: 0.85rem; top: 0.95rem; margin: 0; accent-color: var(--navy-900, #0f1e36); }
.voice-engine:has(input:checked) { border-color: var(--navy-900, #0f1e36); box-shadow: 0 0 0 2px rgba(197, 155, 39, 0.35); }
.voice-engine:has(input:focus-visible) { outline: 2px solid var(--gold-500, #c59b27); outline-offset: 2px; }
.ve-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 0.6rem; }
.ve-name { font-weight: 700; color: var(--navy-900, #0f1e36); }
.ve-price { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 600; color: var(--emerald-700, #1d6b4f); white-space: nowrap; }
.ve-note { font-size: 0.82rem; line-height: 1.4; color: var(--ink-600, #5b5648); }
.field-group[hidden] { display: none !important; }

/* ---------- admin: places the lesson's pen can point at (spot editor) ---------- */
.spot-chip { align-self: flex-start; margin-top: 0.15rem; font-size: 0.72rem; font-weight: 600; border-radius: 999px; padding: 0.12rem 0.55rem;
  background: var(--ivory-200); color: var(--slate-600); }
.spot-chip.ok { background: var(--emerald-100); color: var(--emerald-700); }
.spot-chip.check { background: var(--amber-100); color: #8a5a00; }
.btn-spots-topic-img { flex-shrink: 0; padding: 0.35rem 0.8rem !important; font-size: 0.8rem !important; min-block-size: 0 !important; }

.spot-editor { inline-size: min(1180px, 96vw); max-block-size: 94vh; padding: 0; border: 0; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated); background: var(--ivory-100); color: var(--slate-900); }
.spot-editor[open] { display: flex; flex-direction: column; }
.spot-editor::backdrop { background: rgba(10, 21, 38, 0.55); backdrop-filter: blur(3px); }
.spot-ed-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem 0.75rem; border-bottom: 1px solid var(--ivory-300); }
.spot-ed-kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--crimson-700); }
.spot-ed-head h2 { margin: 0.1rem 0 0; font-size: 1.15rem; color: var(--navy-900); }
.spot-ed-sum { margin: 0.15rem 0 0; font-size: 0.82rem; color: var(--slate-600); }
.spot-ed-x { border: 0; background: none; font-size: 1.7rem; line-height: 1; color: var(--slate-600); cursor: pointer; padding: 0.1rem 0.4rem; border-radius: 6px; }
.spot-ed-x:hover { background: var(--ivory-200); }
.spot-ed-body { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 1rem; padding: 1rem 1.25rem; min-block-size: 0; flex: 1; overflow: hidden; }
.spot-ed-stage-wrap { min-inline-size: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.spot-ed-stage { position: relative; align-self: center; max-inline-size: 100%; line-height: 0; background: #fff; border: 1px solid var(--ivory-300); border-radius: 8px;
  cursor: crosshair; user-select: none; touch-action: none; }
.spot-ed-stage img { display: block; max-inline-size: 100%; max-block-size: 64vh; inline-size: auto; block-size: auto; border-radius: 8px; }
.spot-ed-boxes { position: absolute; inset: 0; }
.spot-box { position: absolute; border: 2px dashed #d08a00; background: rgba(255, 196, 0, 0.16); border-radius: 4px; cursor: move; }
.spot-box.ok { border: 2px solid var(--emerald-700); background: rgba(23, 107, 69, 0.12); }
.spot-box.sel, .spot-box.hover { outline: 3px solid var(--gold-500); outline-offset: 1px; background: rgba(255, 213, 0, 0.3); }
.spot-box-n { position: absolute; inset-block-start: -10px; inset-inline-start: -10px; min-inline-size: 20px; block-size: 20px; padding: 0 4px; border-radius: 10px;
  background: var(--navy-900); color: #fff; font: 700 11px/20px system-ui, sans-serif; text-align: center; }
.spot-box-h { position: absolute; inset-block-end: -6px; inset-inline-end: -6px; inline-size: 12px; block-size: 12px; border-radius: 3px; background: var(--navy-900); cursor: nwse-resize; }
.spot-ed-hint { margin: 0; font-size: 0.8rem; color: var(--slate-600); text-align: center; }
.spot-ed-side { display: flex; flex-direction: column; gap: 0.6rem; min-block-size: 0; }
.spot-ed-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.spot-ed-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; overflow-y: auto; min-block-size: 0; flex: 1; max-block-size: 60vh; }
.spot-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.55rem; border-radius: var(--radius-sm); background: #fff; border: 1px solid #f0d58a; }
.spot-row.ok { border-color: #bfe3cf; }
.spot-row.sel { box-shadow: 0 0 0 2px var(--gold-500); }
.spot-row-n { flex: none; inline-size: 22px; block-size: 22px; border-radius: 11px; background: var(--navy-900); color: #fff; font: 700 11px/22px system-ui, sans-serif; text-align: center; }
.spot-row-main { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.spot-row-main input { inline-size: 100%; font: inherit; font-size: 0.88rem; padding: 0.25rem 0.4rem; border: 1px solid var(--ivory-300); border-radius: 5px; background: var(--ivory-100); }
.spot-row-main input:focus { outline: 2px solid var(--gold-500); outline-offset: 0; background: #fff; }
.spot-row-src { font-size: 0.7rem; color: var(--slate-600); }
.spot-row-ok { flex: none; display: flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; color: var(--slate-700); cursor: pointer; }
.spot-row-del { flex: none; border: 0; background: none; color: var(--crimson-700); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0.1rem 0.35rem; border-radius: 5px; }
.spot-row-del:hover { background: #fbe9ee; }
.spot-empty { font-size: 0.85rem; color: var(--slate-600); padding: 0.6rem; }
.spot-ed-foot { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1.25rem; border-top: 1px solid var(--ivory-300); }
.spot-ed-msg { flex: 1; font-size: 0.82rem; color: var(--slate-700); }
@media (max-width: 820px) { .spot-ed-body { grid-template-columns: 1fr; overflow-y: auto; } .spot-ed-list { max-block-size: none; } }

/* ---------- admin Step 6 · Course Review ---------- */
.rv-top { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; margin-block: 0.5rem 1rem; }
.rv-top .field-group { flex: 1; min-inline-size: 240px; margin: 0; }
.rv-body h3.sub-heading { margin: 1.4rem 0 0.5rem; }
.rv-body h4 { margin: 0.9rem 0 0.4rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--crimson-700); }
.rv-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; }
.rv-stats > div { background: #fff; border: 1px solid var(--ivory-300); border-radius: var(--radius-md); padding: 0.7rem 0.9rem; display: flex; flex-direction: column; }
.rv-stats b { font-size: 1.35rem; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.rv-stats span { font-size: 0.78rem; color: var(--slate-600); }
.rv-how { font-size: 0.85rem; color: var(--slate-700); margin: 0.8rem 0 0; }
.rv-warn { background: var(--amber-100); color: #7a5200; border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; font-size: 0.85rem; margin: 0.5rem 0; }
.rv-try { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.rv-try select { flex: 0 0 auto; inline-size: auto; }
.rv-try input { flex: 1; min-inline-size: 220px; font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--ivory-300); border-radius: var(--radius-sm); background: #fff; }
.rv-tryout { margin-top: 0.6rem; padding: 0.4rem 0.9rem 0.8rem; background: #fff; border: 1px solid var(--gold-200); border-radius: var(--radius-md); }
.rv-weeks { display: flex; flex-direction: column; gap: 0.45rem; }
.rv-week { background: #fff; border: 1px solid var(--ivory-300); border-radius: var(--radius-md); }
.rv-week.empty { border-color: #f0d58a; }
.rv-week > summary { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; padding: 0.65rem 0.9rem; cursor: pointer; list-style: none; }
.rv-week > summary::-webkit-details-marker { display: none; }
.rv-week > summary::before { content: '▸'; color: var(--gold-600); transition: transform 0.15s ease; }
.rv-week[open] > summary::before { transform: rotate(90deg); }
.rv-wk { font-weight: 700; color: var(--crimson-700); font-size: 0.85rem; white-space: nowrap; }
.rv-topic { flex: 1; min-inline-size: 180px; font-weight: 600; color: var(--navy-900); }
.rv-meta { font-size: 0.78rem; color: var(--slate-600); white-space: nowrap; }
.rv-week-body { padding: 0 0.9rem 0.9rem 2rem; }
.rv-reading { font-size: 0.85rem; color: var(--slate-700); margin: 0; }
.rv-refs { margin: 0; padding-inline-start: 1.2rem; display: flex; flex-direction: column; gap: 0.35rem; }
.rv-ref-open { display: flex; flex-direction: column; gap: 0.1rem; inline-size: 100%; text-align: start; font: inherit; background: var(--ivory-100); border: 1px solid var(--ivory-300); border-radius: var(--radius-sm); padding: 0.45rem 0.65rem; cursor: pointer; }
.rv-ref-open:hover { border-color: var(--gold-400); }
.rv-ref-open[aria-expanded="true"] { border-color: var(--gold-500); background: #fff; }
.rv-ref-src { font-size: 0.74rem; color: var(--slate-600); }
.rv-ref-sec { font-size: 0.85rem; font-weight: 600; color: var(--navy-900); }
.rv-ref-pre { font-size: 0.82rem; color: var(--slate-700); line-height: 1.45; }
.rv-ref-full pre { white-space: pre-wrap; font: 0.82rem/1.55 ui-monospace, Menlo, monospace; background: #fff; border: 1px solid var(--ivory-300); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); margin: 0; padding: 0.6rem 0.75rem; max-block-size: 360px; overflow: auto; }
.rv-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.5rem; }
.rv-thumbs figure { margin: 0; background: #fff; border: 1px solid var(--ivory-300); border-radius: var(--radius-sm); padding: 0.35rem; }
.rv-thumbs img { display: block; inline-size: 100%; block-size: 86px; object-fit: contain; background: #fafafa; border-radius: 4px; }
.rv-thumbs figcaption { font-size: 0.74rem; color: var(--slate-700); margin-top: 0.25rem; line-height: 1.3; }
.rv-resources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.rv-res { background: #fff; border: 1px solid var(--ivory-300); border-radius: var(--radius-md); padding: 0.7rem 0.9rem; }
.rv-res-head { display: flex; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; }
.rv-res-head span { font-size: 0.78rem; color: var(--slate-600); }
.rv-facts { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin-top: 0.35rem; font-size: 0.82rem; color: var(--slate-700); }
.rv-facts .warn { color: #8a5a00; }
.rv-skipped { margin-top: 0.5rem; font-size: 0.82rem; }
.rv-skipped summary { cursor: pointer; color: var(--navy-700); }
.rv-skipped .rv-thumbs { margin-top: 0.5rem; }
.mat-plan-book { margin-top: 0.6rem; align-items: flex-end; }

/* admin side menu groups: Courses · Build a course · Admin */
.admin-side-group { display: block; margin: 0.6rem 0 -0.15rem; padding-inline-start: 0.2rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--slate-600); }
.admin-side-group:first-child { margin-top: 0; }
.rv-all { margin-top: 0.8rem; }
.rv-all > summary { cursor: pointer; font-weight: 600; color: var(--navy-700); font-size: 0.88rem; }
.rv-all > .rv-refs { margin-top: 0.4rem; }

/* Course Review: a week's material as one continuous text */
.rv-chapter { background: #fffdf8; border: 1px solid var(--ivory-300); border-radius: var(--radius-md); }
.rv-ch-note { margin: 0; padding: 0.55rem 0.9rem; font-size: 0.78rem; color: var(--slate-600); border-bottom: 1px solid var(--ivory-300); }
.rv-start-key { background: rgba(255, 213, 0, 0.35); padding: 0 0.3rem; border-radius: 3px; color: var(--slate-900); }
.rv-ch-text { max-block-size: 70vh; overflow-y: auto; padding: 0.4rem 1rem 1rem; scrollbar-width: thin; }
.rv-ch-text section + section { margin-top: 0.4rem; }
.rv-ch-text h5 { position: sticky; top: -0.4rem; z-index: 1; display: flex; justify-content: space-between; gap: 1rem; margin: 0.6rem -1rem 0.2rem; padding: 0.4rem 1rem;
  background: #fffdf8; border-bottom: 1px solid var(--ivory-200); font-size: 0.95rem; color: var(--navy-900); }
.rv-pg { font-weight: 500; font-size: 0.74rem; color: var(--slate-600); white-space: nowrap; }
.rv-piece { position: relative; }
.rv-piece pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: 0.88rem/1.6 "Plus Jakarta Sans", system-ui, sans-serif; color: var(--slate-900); }
.rv-piece.start { background: rgba(255, 213, 0, 0.16); box-shadow: inset 3px 0 0 var(--gold-500); padding: 0.3rem 0.6rem; margin: 0.2rem -0.6rem; border-radius: 4px; }
.rv-start-tag { display: inline-block; margin-bottom: 0.15rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #8a5a00; }
.rv-start-tag.ocr { color: var(--slate-600); margin-inline-start: 0.5rem; }
