/* =========================================================
   1. THEME TOKENS
   ========================================================= */

:root {
  --brand-bg: #faf7ed;
  --brand-dark: #596e5e;
  --brand-text: #262b26;
  --brand-muted: #6f746b;
  --brand-accent: #adb58f;
  --brand-surface: #ffffff;
  --divider-subtle: #dde2d5;
  --border-soft: rgba(89,110,94,0.25);
  --shadow-soft: 0 10px 28px rgba(63, 62, 55, 0.08);
}

/* =========================================================
   2. BASE PAGE / APP HEADER
   ========================================================= */

.lesson-plans-gate-shell {
  max-width: 90rem;
  margin-left: auto;
  margin-right: auto;
  padding: 32px 64px 64px;
}

.lesson-plans-gate-shell .section-title {
  font-family: "Plantin MT Pro", "Times New Roman", serif;
  font-size: 48px;
  font-weight: 200;
  margin-bottom: 0.5rem;
  color: var(--brand-text);
}

@media (max-width: 1024px) {
  .lesson-plans-gate-shell {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 640px) {
  .lesson-plans-gate-shell {
    padding: 24px 16px 48px;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 300;
}

a {
  color: inherit;
  text-decoration: none;
}

.logo-title {
  font-family: "Circular Pro", system-ui, sans-serif;
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  color: var(--brand-dark);
}

.logo-text-block {
  display: flex;
  flex-direction: column;
}

.directory-shell {
  max-width: 90rem;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

@media (max-width: 640px) {
  .directory-shell {
    padding: 22px 16px 40px;
  }

  .logo-title {
    font-size: 28px;
  }
}

.lesson-member-loading-message {
  margin-left: auto;
  color: var(--brand-muted);
  font-size: 12px;
  font-weight: 400;
}

/* =========================================================
   3. LESSON PLANS INTRO
   ========================================================= */

.lesson-intro-section {
  margin-bottom: 22px;
}

.lesson-intro-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.lesson-title-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.lesson-intro-flex {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 28px;
  align-items: start;
}

.lesson-intro-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lesson-intro-side .av-video-inline {
  width: 100%;
}

.lesson-intro-side .av-video-row {
  width: 100%;
}

.directory-title {
  margin: 0;
  font-family: "Plantin MT Pro", Georgia, "Times New Roman", serif;
  font-size: 48px;
  font-weight: 200;
  line-height: 1.06;
  color: var(--brand-text);
}

.directory-subtext {
  max-width: 760px;
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--brand-text);
}

.lesson-intro-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 0;
}

.lesson-intro-section.is-collapsed .lesson-intro-details {
  display: none;
}

.lesson-working-top-anchor {
  scroll-margin-top: 110px;
}

.directory-subtext a {
  color: var(--brand-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.directory-subtext a:hover {
  color: var(--brand-text);
}

@media (max-width: 980px) {
  .directory-title {
    font-size: 40px;
  }
}

@media (max-width: 640px) {
  .directory-title {
    font-size: 34px;
  }

  .directory-subtext {
    font-size: 15px;
  }

  .lesson-intro-title-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .lesson-intro-flex {
     grid-template-columns: 1fr;
   }
   
   .lesson-intro-side {
     max-width: 420px;
   }
}

/* =========================================================
   4. FILTER PANEL
   Copied to match Book Details structure.
   ========================================================= */

.book-controls {
  margin: 22px 0 24px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.48);
  backdrop-filter: blur(4px);
  overflow: hidden;
}

.book-controls-header {
  min-height: 38px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.book-controls-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-text);
}

.book-controls-toggle,
.clear-filters-link,
.book-member-mode-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  padding: 0;
}

.book-controls-toggle {
  cursor: pointer;
}

.clear-filters-link:hover,
.book-member-mode-toggle:hover {
  color: var(--brand-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.filter-quick-actions {
  grid-column: 1;
  justify-self: start;
  align-self: center;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 18px;
  white-space: nowrap;
}

.filter-quick-actions .clear-filters-link {
  grid-column: auto;
  justify-self: start;
}

.book-controls.is-collapsed .book-controls-body,
.book-controls.is-collapsed .book-member-toolbar {
  display: none;
}

.book-controls-body {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.85fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr);
  gap: 12px 20px;
  padding: 18px 28px 18px;
  align-items: end;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.control-group label,
.mini-filter-group label {
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 600;
}

.control-view {
  grid-column: 1;
}

.control-search {
  grid-column: 1 / -1;
}

.control-group,
   .mini-filter-group {
     gap: 4px;
   }

.control-group select,
.control-group input,
.book-mini-select {
  min-height: 36px;
  padding: 6px 42px 6px 13px;
}

.book-search-row {
  gap: 8px 20px;
}

/* =========================================================
   5. FILTER INPUTS / SELECTS / CLEAR BUTTONS
   ========================================================= */

.book-base-toggle {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.book-base-button {
  appearance: none;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 13px;
  white-space: nowrap;
}

.book-base-button.is-active {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.select-row {
  position: relative;
}

.select-row .clear-select {
  display: none;
}

.select-row:has(select option:checked:not([value=""])) .clear-select {
  display: inline-flex;
}

.control-group select,
.control-group input,
.book-mini-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: #fff;
  padding: 8px 42px 8px 13px;
  font: inherit;
  font-size: 14px;
  color: var(--brand-text);
}

.control-group select,
.book-mini-select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #9aa097 50%),
    linear-gradient(135deg, #9aa097 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.clear-select {
  position: absolute;
  right: 29px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--brand-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  z-index: 2;
  opacity: 0.7;
}

.clear-select:hover {
  color: var(--brand-dark);
  opacity: 1;
}

.book-search-row {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.85fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr);
  gap: 12px 20px;
  align-items: end;
}

.mini-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.clear-filters-link {
  grid-column: 1;
  justify-self: start;
  align-self: center;
}

.mini-filter-search {
  grid-column: 2;
}

.mini-filter-students {
  grid-column: 3;
}

.mini-filter-planning {
  grid-column: 4;
}

.mini-filter-tracking {
  grid-column: 5;
}

/* =========================================================
   6. MEMBER TOOLS SHELL
   ========================================================= */

.member-tool-only {
  display: none;
}

body.member-tools-enabled .member-tool-only {
  display: block;
}

body.member-tools-enabled .book-member-toolbar-body {
  display: flex;
}

.book-member-toolbar-spacer {
  flex: 1;
}

.book-member-mode-toggle,
.member-mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.book-member-mode-toggle.is-active,
.member-mini-toggle.is-active {
  color: #6f766d;
}

.book-member-mode-toggle.is-active .mini-toggle-switch,
.member-mini-toggle.is-active .mini-toggle-switch {
  background: #bec5a6;
  border: 1px solid rgba(89,110,94,0.18);
}

.member-tool-link + .member-tool-link {
  margin-left: 18px;
}

.book-member-toolbar {
  border-top: 1px solid var(--divider-subtle);
  padding: 9px 28px;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.book-member-toolbar-body {
  display: none;
  align-items: center;
  gap: 16px;
  flex: 1;
  flex-wrap: wrap;
}

.member-mini-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  padding: 0;
  cursor: pointer;
}

.mini-toggle-switch {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #d8d8d1;
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  transition: background 0.15s ease;
}

.mini-toggle-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  left: 2px;
  top: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 0.15s ease;
}

.book-member-mode-toggle.is-active .mini-toggle-knob,
.member-mini-toggle.is-active .mini-toggle-knob {
  transform: translateX(14px);
}

.member-tool-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}

/* =========================================================
   7. DIRECTORY RESULTS WRAPPER
   ========================================================= */

.book-controls + .directory-view {
  margin-top: 8px;
}

.directory-view {
  display: none;
}

.directory-view.is-active {
  display: block;
}

.topic-group-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  border: 1px dashed var(--divider-subtle);
  border-radius: 4px;
  padding: 16px;
  background: rgba(255,255,255,0.55);
  color: var(--brand-muted);
  font-size: 14px;
}

/* =========================================================
   7B. GROUP HEADERS (GRADE / SUBJECT)
   ========================================================= */

.directory-render-group {
  margin-bottom: 42px;
}

.directory-render-group-header {
  margin-bottom: 18px;

  font-family: "Plantin MT Pro", Georgia, "Times New Roman", serif;
  font-size: 42px;
  line-height: 1.08;
  font-weight: 200;
  color: var(--brand-text);
}

.directory-render-group-body {
  display: grid;
  gap: 18px;
}

/* =========================================================
   8. COURSE / TOPIC CARDS
   ========================================================= */

.directory-card,
.topic-card {
  display: block;
  border-radius: 4px;
  border: 1px solid var(--divider-subtle);
  background: var(--brand-surface);
  padding: 18px 18px 16px;
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

.directory-card:hover,
.topic-card:hover {
  border-color: rgba(89,110,94,0.42);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.directory-card .card-action-link.is-primary {
  border-color: var(--brand-dark);
  background: #bdc5bf;
  color: var(--brand-text);
}

.directory-card .card-action-link.is-primary .card-action-icon {
  background: #fbfbf9;
}

.card-topline,
.topic-group-topline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.card-title,
.topic-group-title {
  margin: 0;
  font-family: "Circular Pro", "DM Sans", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--brand-text);
}

.topic-card .card-title {
  font-size: 16px;
}

.title-grade {
  margin-left: 8px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--brand-muted);
  white-space: nowrap;
}

.card-mini {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--border-soft);
  background: rgba(173,181,143,0.14);
  color: var(--brand-dark);
  font-size: 11px;
  line-height: 1;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topic-group,
.topic-group-course-only,
.directory-card,
.topic-card {
  border-color: var(--subject-color, var(--divider-subtle));
}

.topic-card {
  border-color: var(--subject-color, #adb58f);
}

.lesson-bookmark-display {
  pointer-events: none;
  cursor: default;
}

.lesson-bookmark-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.card-topline .lesson-bookmark-display,
.topic-group-topline .lesson-bookmark-stack,
.topic-group-topline .lesson-bookmark-display {
  flex: 0 0 auto;
}

/* =========================================================
   9. ACTION BUTTONS
   ========================================================= */

.card-actions {
  margin-top: 14px;
}

.card-action-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

.card-action-link {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: #fbfbf9;
  color: var(--brand-dark);
  display: inline-grid;
  grid-template-columns: 22px auto 12px;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.card-action-link:hover {
  border-color: rgba(89,110,94,0.42);
  background: #ffffff;
}

.card-action-link.is-disabled,
.card-action-link:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}

.card-action-link.is-disabled:hover,
.card-action-link:disabled:hover {
  border-color: var(--divider-subtle);
  background: #fbfbf9;
}

.card-action-link.is-editable-highlight {
  border-color: #3b413b;
  background: #e5e8e5;
  color: #3b413b;
}

.card-action-link.is-editable-highlight:hover {
  border-color: #596e5e;
  background: #e5e8e5;
  color: #596e5e;
}

.card-action-link.is-editable-highlight .card-action-icon {
  background: #fbfbf9;
}

.card-action-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #e5e8e5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.card-action-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-action-arrow {
  font-size: 16px;
  opacity: 0.75;
}

/* =========================================================
   10. FINAL COURSE / TOPIC HIERARCHY
   ========================================================= */

.topic-group {
  background: #dee1d2;
  border: 1px solid var(--subject-color, var(--divider-subtle));
  border-radius: 8px;
  overflow: hidden;
}

.topic-group-head {
  padding: 14px 16px 14px;
  background: #ffffff;
}

.topic-group-head .card-mini {
  background: #f3f4f1;
  border-color: #cfd8cf;
}

.topic-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #dee1d2;
  padding: 12px;
}

.topic-card {
  border-color: #adb58f;
  background: #ffffff;
}

.topic-card:hover {
  border-color: #cfd8cf;
}

.topic-group-course-only {
  border: 1px solid var(--subject-color, var(--divider-subtle));
  background: #ffffff;
  padding: 14px 16px 14px;
  border-radius: 8px;
  overflow: hidden;
}

.topic-group-course-only .directory-card {
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  transform: none;
}

.topic-group-course-only .directory-card:hover {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

.topic-group-head .card-action-link,
.topic-group-course-only .card-action-link {
  border-color: var(--brand-dark);
}

.topic-group-head .card-action-link.is-primary,
.topic-group-course-only .card-action-link.is-primary {
  border-color: var(--brand-dark);
  background: #bdc5bf;
  color: var(--brand-text);
}

.topic-card .card-action-link {
  border-color: #adb58f;
}

.topic-card .card-action-link.is-primary {
  border-color: #adb58f;
  background: #dee1d2;
  color: var(--brand-text);
}

.topic-group-head .card-action-link.is-primary .card-action-icon,
.topic-group-course-only .card-action-link.is-primary .card-action-icon,
.topic-card .card-action-link.is-primary .card-action-icon {
  background: #fbfbf9;
}

/* =========================================================
   11. BACK TO TOP
   ========================================================= */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 1px solid rgba(89,110,94,0.25);
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  color: #596e5e;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(63, 62, 55, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease,
    background 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #ffffff;
}

/* =========================================================
   12. FILTER RESPONSIVE BEHAVIOR
   ========================================================= */

@media (max-width: 1220px) {
  .book-controls-body,
  .book-search-row {
    grid-template-columns:
      minmax(160px, 1fr)
      minmax(220px, 1.25fr)
      minmax(220px, 1.25fr);
  }

  .control-view {
    grid-column: 1;
  }

  .control-group:nth-of-type(2) {
    grid-column: 2;
  }

  .control-group:nth-of-type(3) {
    grid-column: 3;
  }

  .control-group:nth-of-type(4) {
    grid-column: 2;
  }

  .control-group:nth-of-type(5) {
    grid-column: 3;
  }

  .control-search {
    grid-column: 1 / -1;
  }

  .clear-filters-link {
     grid-column: 1;
     justify-self: start;
   }
   
   .mini-filter-search {
     grid-column: 2;
   }
   
   .mini-filter-students {
     grid-column: 3;
   }
   
   .mini-filter-planning {
     grid-column: 2;
   }
   
   .mini-filter-tracking {
     grid-column: 3;
   }
}

@media (max-width: 900px) {
  .book-controls-body,
  .book-search-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .control-view {
    grid-column: 1;
    grid-row: 1;
  }

  .control-group:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .control-group:nth-of-type(3) {
    grid-column: 2;
    grid-row: 2;
  }

  .control-group:nth-of-type(4) {
    grid-column: 1;
    grid-row: 2;
  }

  .control-group:nth-of-type(5) {
    grid-column: 1;
    grid-row: 3;
  }

  .control-search {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .mini-filter-search {
    grid-column: 1 / -1;
  }

  .mini-filter-planning {
    grid-column: 1;
  }

  .mini-filter-students {
    grid-column: 2;
  }

   .mini-filter-tracking {
     grid-column: 2;
   }

  .clear-filters-link {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 820px) {
  .book-controls-body {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px 20px 22px;
  }

  .book-controls-body > .control-view,
  .book-controls-body > .control-group,
  .book-controls-body > .control-search {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    min-width: 0;
  }

  .control-view,
  .control-group:not(.control-search) {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .control-search {
    display: block;
  }

  .book-base-toggle {
    flex-wrap: wrap;
    min-width: 0;
  }

  .book-search-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .mini-filter-search,
   .mini-filter-planning,
   .mini-filter-students,
   .mini-filter-tracking {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
  }

  .mini-filter-group label {
    grid-column: 1;
    margin: 0;
  }

  .mini-filter-group input,
  .mini-filter-group select {
    grid-column: 2;
    min-width: 0;
    width: 100%;
  }

  .clear-filters-link {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    justify-self: start;
    align-self: center;
    padding-top: 2px;
  }

  .book-member-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 20px;
  }

  .book-member-toolbar-body {
    width: 100%;
  }

  .book-member-toolbar-spacer {
    display: none;
  }

  .card-topline,
  .topic-group-topline {
    flex-direction: column;
  }

  .card-mini {
    align-self: flex-start;
  }
}

@media (max-width: 640px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
  }
}

/* =========================================================
   13. TEMPORARY MEMBER / NAV VISIBILITY
   ========================================================= */

/* Keep Alveary logo visible */
.app-header {
  display: block;
}

/* Hide legacy nav only; keep app-step-nav visible */
.app-nav {
  display: none !important;
}

.lesson-plans-page.is-auth-checking .lesson-intro-section,
.lesson-plans-page.is-auth-checking .book-controls,
.lesson-plans-page.is-auth-checking .directory-view {
  display: none;
}

.lesson-page-loading {
  max-width: 90rem;
  margin: 72px auto 0;
  padding: 0 24px;
}

.lesson-page-loading-card {
  border: 1px solid var(--divider-subtle);
  background: rgba(255, 255, 255, 0.62);
  border-radius: 14px;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.lesson-page-loading-card h2 {
  margin: 0 0 4px;
  font-family: "Plantin MT Pro", Georgia, serif;
  font-size: 30px;
  font-weight: 200;
}

.lesson-page-loading-card p {
  margin: 0;
  color: var(--brand-muted);
  font-size: 14px;
}

/* =========================================================
   VERSION 2 LESSON PLAN ACTIONS
   ========================================================= */

.lesson-helper-card {
  margin-top: 14px;
  max-width: 760px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.58);
  padding: 14px 16px;
}

.lesson-helper-title {
  margin: 0 0 8px;
  font-family: "Circular Pro", "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--brand-dark);
}

.lesson-helper-lines,
.lesson-helper-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--brand-text);
}

.lesson-helper-text {
  margin-top: 8px;
}

.card-action-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.card-action-divider {
  color: var(--brand-dark);
  opacity: 0.45;
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
}

.card-tool-slot {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  padding-bottom: 2px;
}

.card-tool-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.card-inline-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 2px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.card-inline-toggle:hover {
  text-decoration: underline;
}

.card-topic-toggle {
  text-align: left;
}

.topic-items {
  display: none;
}

.topic-group.is-topics-open .topic-items {
  display: flex;
}

@media (max-width: 760px) {
  .card-action-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .card-tool-slot {
    order: 3;
    flex-basis: 100%;
  }

  .card-topic-toggle {
    margin-left: 0;
  }
}

.lesson-student-chip-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.lesson-student-chip {
  height: 22px;
  padding: 0 10px;
}

.lesson-member-icon-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.lesson-planning-tag-fallback {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef1e8;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
}

.lesson-member-icon-stack {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.lesson-planning-tag-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.lesson-planning-tag-pill {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  overflow: hidden;
}

.lesson-planning-tag-pill .planning-tag-img {
  width: 24px;
  height: 24px;
  display: block;
  object-fit: cover;
}

.lesson-note-display {
  pointer-events: none;
  cursor: default;
}

.lesson-note-display svg {
  width: 18px;
  height: 18px;
}

/* =========================================================
   PRINT DELIVERY INTRO + GRADE BUNDLE MODAL
   ========================================================= */

.lesson-intro-card-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: 14px;
  align-items: stretch;
}

.lesson-intro-card-grid .lesson-helper-card {
  margin-top: 0;
  max-width: none;
}

.lesson-delivery-card {
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.58);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.lesson-delivery-icon {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #eef1e8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex: 0 0 auto;
}

.lesson-delivery-content {
  min-width: 0;
  flex: 1;
}

.lesson-delivery-coming-soon {
  margin: 8px 0 0;
  color: var(--brand-dark);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
}

.lesson-delivery-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lesson-delivery-button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: #fbfbf9;
  color: var(--brand-dark);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lesson-delivery-button:hover {
  border-color: rgba(89,110,94,0.42);
  background: #ffffff;
}

.lesson-delivery-button.is-disabled,
.lesson-delivery-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}

.grade-bundle-modal[hidden] {
  display: none;
}

.grade-bundle-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.grade-bundle-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38,43,38,0.38);
}

body.grade-bundle-modal-open {
  overflow: hidden;
}

.grade-bundle-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--divider-subtle);
  background: var(--brand-bg);
  padding: 24px;
  box-shadow: 0 22px 60px rgba(38,43,38,0.24);
}

.grade-bundle-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.grade-bundle-header h2 {
  margin: 0;
  font-family: "Plantin MT Pro", Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 200;
  color: var(--brand-text);
}

.grade-bundle-header p {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--brand-muted);
}

.grade-bundle-close {
  appearance: none;
  border: 1px solid var(--divider-subtle);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  width: 34px;
  height: 34px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.grade-bundle-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.grade-bundle-tile {
  min-height: 74px;
  border: 1px solid var(--divider-subtle);
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand-dark);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.grade-bundle-tile:hover {
  border-color: rgba(89,110,94,0.42);
  box-shadow: var(--shadow-soft);
}

.grade-bundle-tile.is-disabled,
.grade-bundle-tile:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
}

.grade-bundle-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--brand-muted);
}

@media (max-width: 860px) {
  .lesson-intro-card-grid {
    grid-template-columns: 1fr;
  }

  .grade-bundle-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .grade-bundle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grade-bundle-dialog {
    padding: 18px;
  }

  .grade-bundle-header h2 {
    font-size: 28px;
  }
}

/* =========================================================
   MEMBER STATE CHIPS
   ========================================================= */

.member-card-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.member-meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  border: 1px solid var(--divider-subtle);
  background: #fbfbf9;
  color: var(--brand-dark);
  font-size: 12px;
  line-height: 1;
  font-weight: 600;
}

.member-meta-bookmark {
  background: rgba(173,181,143,0.18);
  border-color: rgba(89,110,94,0.22);
}

.member-meta-student {
  border-color: color-mix(in srgb, var(--student-color) 55%, white);
  background: color-mix(in srgb, var(--student-color) 18%, white);
  color: var(--brand-text);
}

.member-meta-tag {
  background: #f3f4f1;
}

.member-meta-note {
  background: rgba(255,255,255,0.75);
}

/* =========================================================
   UNIVERSAL STUDENT MANAGER MODAL - LESSON PLANS PHASE
   ========================================================= */

.lesson-student-modal[hidden] {
  display: none;
}

.lesson-student-modal {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lesson-student-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38,43,38,0.38);
}

body.lesson-student-modal-open {
  overflow: hidden;
}

.lesson-student-modal-dialog {
  position: relative;
  width: min(620px, 100%);
  max-height: min(680px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--divider-subtle);
  background: var(--brand-bg);
  padding: 22px;
  box-shadow: 0 22px 60px rgba(38,43,38,0.24);
}

.lesson-student-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.lesson-student-modal-header h2 {
  margin: 0;
  font-family: "Plantin MT Pro", Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 200;
  color: var(--brand-text);
}

.lesson-student-modal-header p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--brand-muted);
}

.lesson-student-modal-close {
  appearance: none;
  border: 1px solid var(--divider-subtle);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  width: 34px;
  height: 34px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.lesson-student-manager {
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lesson-student-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 390px;
  overflow-y: auto;
  padding-right: 4px;
}

.lesson-student-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.lesson-student-row .student-swatches {
  grid-column: 2 / 4;
}

.lesson-student-empty {
  margin: 0;
  color: var(--brand-muted);
  font-size: 13px;
}

@media (max-width: 560px) {
  .lesson-student-modal-dialog {
    padding: 18px;
  }

  .lesson-student-modal-header h2 {
    font-size: 28px;
  }
}

/* =========================================================
   BULK DOWNLOAD MODAL
   ========================================================= */

.bulk-download-modal[hidden] {
  display: none;
}

.bulk-download-modal {
  position: fixed;
  inset: 0;
  z-index: 2600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.bulk-download-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(38,43,38,0.38);
}

.bulk-download-dialog {
  position: relative;
  width: min(720px, 100%);
  background: var(--brand-bg);
  border: 1px solid var(--divider-subtle);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 22px 60px rgba(38,43,38,0.24);
}

.bulk-download-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

.bulk-download-header h2 {
  margin: 0;
  font-family: "Plantin MT Pro", Georgia, serif;
  font-size: 34px;
  font-weight: 200;
}

.bulk-download-header p {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--brand-muted);
}

.bulk-download-close {
  flex: 0 0 auto;
  color: var(--brand-dark);
  font-size: 22px;
  line-height: 1;
}

.bulk-download-section {
  margin-top: 24px;
}

.bulk-download-section h3 {
  margin-bottom: 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.bulk-download-option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
}

.bulk-download-footer {
  margin-top: 24px;
}

.bulk-download-close {
  appearance: none;
  border: 1px solid var(--divider-subtle);
  border-radius: 999px;
  background: #fff;
  width: 34px;
  height: 34px;
  cursor: pointer;
}

.bulk-download-option input[type="radio"] {
  accent-color: var(--brand-dark);
}

body.bulk-download-modal-open {
  overflow: hidden;
}

.bulk-download-message {
  margin-top: 18px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.58);
  padding: 12px 14px;
  color: var(--brand-muted);
  font-size: 14px;
  line-height: 1.45;
}

.bulk-download-dialog {
  width: min(900px, 100%);
}

.bulk-download-options-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.bulk-download-section,
.bulk-download-message {
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.58);
  padding: 14px 16px;
}

.bulk-download-section {
  margin-top: 0;
}

.bulk-download-message {
  margin-top: 0;
}

.bulk-download-footer {
  margin-top: 18px;
}

@media (max-width: 720px) {
  .bulk-download-options-grid {
    grid-template-columns: 1fr;
  }
}

.bulk-download-format-helper {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--divider-subtle);
  color: var(--brand-muted);
  font-size: 14px;
  line-height: 1.45;
}

.bulk-download-source-layout {
  display: grid;
  grid-template-columns: minmax(170px, 0.9fr) minmax(180px, 1fr);
  gap: 16px;
  align-items: start;
}

.bulk-download-source-picker {
  border-left: 1px solid var(--divider-subtle);
  padding-left: 16px;
}

.bulk-download-picker-label {
  display: block;
  margin-bottom: 6px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.bulk-download-picker-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: #fff;
  padding: 8px 13px;
  font: inherit;
  font-size: 14px;
  color: var(--brand-text);
}

.bulk-download-picker-note {
  margin: 8px 0 0;
  color: var(--brand-muted);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .bulk-download-source-layout {
    grid-template-columns: 1fr;
  }

  .bulk-download-source-picker {
    border-left: 0;
    border-top: 1px solid var(--divider-subtle);
    padding-left: 0;
    padding-top: 14px;
  }
}

.bulk-download-preview {
  margin-top: 14px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.58);
  padding: 14px 16px;
  color: var(--brand-text);
  font-size: 14px;
  line-height: 1.45;
}

.bulk-download-preview h3 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.bulk-download-preview strong {
  color: var(--brand-dark);
}

.bulk-preview-counts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bulk-preview-toggle {
  margin-top: 12px;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.bulk-preview-audit {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider-subtle);
  max-height: 350px;
  overflow-y: auto;
}

.bulk-preview-audit-section + .bulk-preview-audit-section {
  margin-top: 16px;
}

.bulk-preview-audit-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.bulk-preview-audit-list {
  margin: 0;
  padding-left: 18px;
}

.bulk-preview-audit-list li {
  margin-bottom: 4px;
}

.bulk-download-preview {
  max-height: 45vh;
  overflow-y: auto;
  padding-right: 8px;
}

.bulk-preview-audit {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--divider-subtle);
  max-height: 350px;
  overflow-y: auto;
}

/* =========================================================
   TRACKING TAGS
   ========================================================= */

.lesson-tracking-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.lesson-tracking-tags {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lesson-tracking-tag,
.lesson-tracking-add {
  width: 24px;
  height: 24px;
  border: 1px solid var(--divider-subtle);
  border-radius: 999px;
  background: #fbfbf9;
  color: var(--brand-dark);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lesson-tracking-tag:hover,
.lesson-tracking-add:hover {
  border-color: rgba(89,110,94,0.42);
  background: #ffffff;
}

.lesson-tracking-menu {
  position: fixed;
  left: var(--tracking-menu-left, 0px);
  top: var(--tracking-menu-top, 0px);
  z-index: 9999;
  min-width: 150px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  padding: 22px 6px 6px;
}

.lesson-tracking-menu button {
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.lesson-tracking-menu button:hover,
.lesson-tracking-menu button.is-active {
  background: #eef1e8;
  color: var(--brand-dark);
}

.lesson-tracking-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 18px;
  height: 18px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--brand-muted);
  font-size: 14px;
  line-height: 1;
}

.lesson-tracking-menu .lesson-tracking-close {
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-flex;
  justify-content: center;
  gap: 0;
  text-align: center;
}

.lesson-tracking-menu--global {
  width: 190px;
}

.lesson-tracking-add-wrap {
  position: relative;
}
