/* ========== TEACHER HOME DASHBOARD ========== */
/* Prefixed .th-* to avoid conflicts                  */

/* Warm off-white page background for the home route only */
.main-content.th-home-mode {
    background: #faf8f3;
}

/* Override main-content in home mode. The page itself does not scroll —
   internal cards (agenda, students to watch, to grade) scroll instead. */
.main-content.th-home-mode {
    align-items: stretch;
    padding: 0;
}
.main-content.th-home-mode .cal-container {
    width: 100%;
    max-width: none;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    align-items: center; /* horizontal centering of th-page in column flex */
}
/* Long-form pages (analytics, lesson-plans) let the container scroll vertically
   — content exceeds the viewport and there's no internal scroll surface. */
.main-content.th-home-mode.th-scroll-mode .cal-container {
    overflow-y: auto;
    overflow-x: hidden;
}
/* Page outer — stacks hero + grid */
.th-page {
    max-width: 1320px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 28px 24px;
    color: #1a1a1a;
    font-family: inherit;
}
.th-page-noscroll {
    height: 100%;
    overflow: hidden;
}
.th-page-noscroll .th-grid {
    flex: 1;
    min-height: 0;
}

/* Shared serif treatment */
.th-page em,
.th-page .th-italic {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.01em;
}

/* ============================================================
   HERO  — greeting, subcopy, stats, date card
   ============================================================ */
.th-hero {
    display: flex;
    gap: 28px;
    align-items: stretch;
    justify-content: space-between;
    padding: 24px 28px;
    background: linear-gradient(135deg, #faf6ec 0%, #f4f5ee 55%, #eff5ec 100%);
    border: 1px solid #ece7dd;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}

.th-hero-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.th-hero-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #6b7280;
    margin-bottom: 8px;
}

.th-hero-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-weight: 400;
    font-size: 38px;
    line-height: 1.08;
    letter-spacing: -0.015em;
    color: #111;
    margin: 0 0 12px;
    max-width: 720px;
}
.th-hero-title em {
    color: #2f6844;
}
.th-hero-greet { display: inline; }
.th-hero-mood { display: inline; }

.th-hero-sub {
    font-size: 14px;
    line-height: 1.55;
    color: #4b5563;
    margin: 0 0 16px;
    max-width: 640px;
}
.th-hero-sub em {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    color: #2f6844;
}

.th-hero-stats {
    display: flex;
    gap: 0;
    margin-top: auto;
    align-items: flex-end;
}
.th-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 28px;
    border-left: 1px solid rgba(0,0,0,0.08);
}
.th-stat:first-child {
    padding-left: 0;
    border-left: 0;
}
.th-stat-num {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    font-size: 32px;
    line-height: 1;
    color: #2f6844;
    letter-spacing: -0.01em;
}
.th-stat-label {
    font-size: 11.5px;
    color: #6b7280;
    letter-spacing: 0.2px;
}

/* Top-right hero aside — weather widget */
.th-hero-aside {
    flex: 0 0 auto;
    min-width: 220px;
    display: flex;
    align-items: flex-start;
}
.th-weather {
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 14px;
    padding: 16px 20px;
    text-align: right;
    width: 100%;
}
.th-weather-date {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    font-size: 22px;
    color: #2f6844;
    line-height: 1.1;
    margin-bottom: 8px;
}
.th-weather-temp {
    font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace;
    font-size: 13px;
    color: #1a1a1a;
    margin-bottom: 4px;
    letter-spacing: 0.2px;
}
.th-weather-meta {
    font-size: 11.5px;
    color: #6b7280;
    letter-spacing: 0.2px;
}


/* ============================================================
   BUTTONS
   ============================================================ */
.th-btn-primary,
.th-btn,
.th-btn-ghost {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.th-btn-primary {
    color: #fff;
    background: #2f6844;
    border: 1px solid #2f6844;
}
.th-btn-primary:hover {
    background: #264f35;
    border-color: #264f35;
}
.th-btn {
    color: #2f6844;
    background: #fff;
    border: 1px solid #d6d0c2;
}
.th-btn:hover {
    background: #f4f1e8;
    border-color: #c1b9a6;
}
.th-btn-ghost {
    color: #4b5563;
    background: transparent;
    border: 1px dashed #d6d0c2;
}
.th-btn-ghost:hover {
    color: #2f6844;
    border-color: #2f6844;
    background: #f7faf6;
}
.th-btn-arrow { display: inline-block; transform: translateY(-0.5px); }

/* ============================================================
   GRID — 2-col layout, no page scroll, internal card scroll
   ============================================================ */
.th-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 22px;
    align-items: stretch;
    min-height: 0;
}
.th-col {
    display: grid;
    gap: 18px;
    min-height: 0;
}
/* Left column = Today's Agenda only, full height. */
.th-col-left { grid-template-rows: minmax(0, 1fr); }
/* Right column = Your Focus + To Grade, 50/50. */
.th-col-right { grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }

/* Cards in the no-scroll grid use flex column with internal scroll on body */
.th-page-noscroll .th-agenda,
.th-page-noscroll .th-tograde,
.th-page-noscroll .th-focus {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.th-page-noscroll .th-agenda-list,
.th-page-noscroll .th-tograde-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.th-page-noscroll .th-focus .th-focus-empty,
.th-page-noscroll .th-focus .th-focus-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

@media (max-width: 1100px) {
    .th-page-noscroll { overflow: auto; height: auto; }
    .main-content.th-home-mode .cal-container { overflow: auto; }
    .th-grid { grid-template-columns: 1fr; }
    .th-col-left, .th-col-right { grid-template-rows: auto; }
    .th-hero { flex-direction: column; align-items: stretch; gap: 16px; padding: 18px 20px; }
    .th-hero-aside { min-width: 0; }
    .th-weather { text-align: left; }
    .th-page-noscroll .th-agenda-list,
    .th-page-noscroll .th-tograde-list { overflow: visible; }
}

/* ============================================================
   SECTION HEADERS (shared)
   ============================================================ */
.th-section-over {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #8a7f6a;
    margin-bottom: 10px;
}
.th-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.th-section-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: normal;
    font-weight: 400;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: #111;
    margin: 0;
}
.th-section-title em {
    font-style: italic;
    color: #2f6844;
}
.th-section-link {
    font-size: 12.5px;
    font-weight: 600;
    color: #2f6844;
    text-decoration: none;
}
.th-section-link:hover {
    text-decoration: underline;
}

/* ============================================================
   AGENDA (list)
   ============================================================ */
.th-agenda {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 16px;
    padding: 18px 20px 12px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-agenda-sub {
    font-size: 12px;
    color: #9ca3af;
    margin: -6px 0 14px;
    letter-spacing: 0.1px;
}
.th-agenda-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.th-empty-row {
    padding: 24px 8px;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
}

/* Wrapper around row + (optional) inline expansion */
.th-agenda-rowwrap {
    border-top: 1px solid #f3efe6;
}
.th-agenda-rowwrap:first-child { border-top: 0; }

.th-agenda-row {
    --b-color: #d6d0c2;
    display: grid;
    grid-template-columns: 72px 2px 1fr auto auto auto;
    gap: 14px;
    align-items: center;
    padding: 12px 8px;
    background: transparent;
    text-align: left;
    width: 100%;
}

/* Class rows are clickable to expand inline */
.th-agenda-row-toggle {
    cursor: pointer;
    transition: background 0.15s;
}
.th-agenda-row-toggle:hover { background: #faf8f3; }
.th-agenda-row-toggle:focus-visible { outline: 2px solid #2f6844; outline-offset: -2px; }
.th-agenda-chev {
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s, color 0.15s;
}
.th-agenda-row-toggle:hover .th-agenda-chev { color: #2f6844; }
.th-agenda-row-expanded .th-agenda-chev {
    transform: rotate(180deg);
    color: #2f6844;
}

/* Inline expansion (Students to watch) */
.th-agenda-expand {
    padding: 4px 12px 14px 86px;     /* aligns under the body column past time + rail */
    background: #fbfaf5;
    border-top: 1px dashed #ece7dd;
}
.th-agenda-expand-head {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #8a7f6a;
    margin: 10px 0 6px;
}
.th-agenda-expand-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    font-size: 12.5px;
    padding: 6px 0;
}
.th-agenda-expand-empty svg { color: #cbd5e1; flex-shrink: 0; }

/* Inline per-row action buttons (class events only) */
.th-agenda-actions {
    display: flex;
    gap: 6px;
}
.th-agenda-btn {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 7px;
    border: 1px solid #d6d0c2;
    color: #2f6844;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.25;
    white-space: nowrap;
}
.th-agenda-btn:hover {
    background: #f4f1e8;
    border-color: #c1b9a6;
}
.th-agenda-btn-primary {
    color: #fff;
    background: #2f6844;
    border-color: #2f6844;
}
.th-agenda-btn-primary:hover {
    background: #264f35;
    border-color: #264f35;
    color: #fff;
}
/* Phase 2 — past-tense Lesson finalized state on the homepage agenda row.
 * Still clickable (opens read-only review modal). */
.th-agenda-btn-finalized {
    color: #475569;
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.th-agenda-btn-finalized:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #334155;
}

.th-agenda-time {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    line-height: 1.05;
}
.th-agenda-time-num {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    font-size: 22px;
    color: #111;
    letter-spacing: -0.01em;
}
.th-agenda-time-ampm {
    font-size: 11px;
    letter-spacing: 0.3px;
    color: #9ca3af;
    margin-top: 2px;
}

.th-agenda-rail {
    width: 2px;
    align-self: stretch;
    background: var(--b-color);
    border-radius: 1px;
    opacity: 0.6;
}

.th-agenda-body {
    min-width: 0;
}
.th-agenda-title {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    line-height: 1.3;
    letter-spacing: -0.05px;
}
.th-agenda-sub-row {
    font-size: 12.5px;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.4;
}

.th-agenda-phase-now {
    background: #f1f8f3;
}
.th-agenda-phase-now .th-agenda-rail {
    background: #2f6844;
    opacity: 1;
    width: 3px;
}
.th-agenda-phase-now .th-agenda-title { color: #0f172a; }

/* Phase 2 (2026-05-25) — rows no longer dim once class is over. The only
 * thing that signals state is the inline button (Link → Finalize → Lesson
 * finalized → Dashboard). Per teacher: "nothing changes between them just
 * the idea that I can finalize." */
.th-agenda-phase-past {
    /* opacity left at 1.0 intentionally */
}

/* ============================================================
   CHIPS  (shared between agenda rows + focus tags)
   ============================================================ */
.th-chip {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 4px 12px;
    border-radius: 999px;
    background: #f3efe6;
    color: #6b7280;
    white-space: nowrap;
    line-height: 1;
}
.th-chip-class    { background: #e8f2ec; color: #2f6844; }
.th-chip-meeting  { background: #fff2d8; color: #8a5a00; }
.th-chip-duty     { background: #fde7d8; color: #a24613; }
.th-chip-pd       { background: #ece4fb; color: #5a3fb0; }
.th-chip-prep     { background: #e4ecf7; color: #1f4b8a; }
.th-chip-other    { background: #f3efe6; color: #6b7280; }
.th-chip-now {
    background: #2f6844;
    color: #fff;
    letter-spacing: 0.8px;
}

/* ============================================================
   YOUR FOCUS — right rail
   ============================================================ */
.th-focus {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 16px;
    padding: 18px 20px 14px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-focus .th-section-head { margin-bottom: 6px; }
.th-focus-tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #2f6844;
    background: #e8f2ec;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}
.th-focus-sub {
    font-size: 12.5px;
    color: #6b7280;
    margin: 0 0 14px;
    line-height: 1.5;
}
.th-focus-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.th-focus-item {
    display: flex;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3efe6;
}
.th-focus-item:first-child { border-top: 0; padding-top: 0; }
.th-focus-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
}
.th-focus-dot-amber { background: #d29100; }
.th-focus-dot-blue  { background: #2b60c2; }
.th-focus-dot-green { background: #2f6844; }
.th-focus-body { flex: 1; min-width: 0; }
.th-focus-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}
.th-focus-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #111;
    line-height: 1.35;
}
.th-focus-itemsub {
    font-size: 12px;
    color: #6b7280;
    margin-top: 3px;
    line-height: 1.45;
}
.th-focus-action {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #2f6844;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    white-space: nowrap;
}
.th-focus-action:hover { text-decoration: underline; }
.th-focus-empty {
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #9ca3af;
    font-size: 13px;
}
.th-focus-empty svg { color: #cbd5e1; }

/* Variant tag colors used by Students-to-Watch and To-Grade headers */
.th-focus-tag-blue {
    color: #1f4b8a;
    background: #e4ecf7;
}
.th-focus-tag-amber {
    color: #8a5a00;
    background: #fff2d8;
}

/* ============================================================
   STUDENTS TO WATCH — tabbed by today's classes
   ============================================================ */
.th-watch {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 16px;
    padding: 18px 20px 14px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-watch .th-section-head { margin-bottom: 10px; }
.th-watch-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid #f0ece1;
    margin: 0 -4px 10px;
    padding: 0 4px;
    overflow-x: auto;
}
.th-watch-tab {
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: #6b7280;
    background: none;
    border: none;
    padding: 8px 4px 10px;
    margin-right: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.th-watch-tab:hover { color: #2f6844; }
.th-watch-tab.active {
    color: #111;
    border-bottom-color: #2f6844;
}
.th-watch-loading {
    padding: 16px 0;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
}
.th-watch-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}
.th-watch-row {
    display: flex;
    gap: 12px;
    padding: 10px 4px;
    border-top: 1px solid #f5f1e8;
    align-items: flex-start;
}
.th-watch-row:first-child { border-top: 0; }
.th-watch-dot {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-top: 6px;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.6);
}
.th-watch-dot-red    { background: #c2410c; }
.th-watch-dot-yellow { background: #c98a00; }
.th-watch-dot-green  { background: #2f6844; }
.th-watch-rowbody { flex: 1; min-width: 0; }
.th-watch-rowtop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.th-watch-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #111;
    line-height: 1.3;
}
.th-watch-actions {
    display: inline-flex;
    gap: 4px;
    flex-shrink: 0;
}
.th-watch-iconbtn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 4px 6px;
    cursor: pointer;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.th-watch-iconbtn:hover {
    color: #2f6844;
    border-color: #cfe2d6;
    background: #f3f8f4;
}
.th-watch-reason {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.45;
}
.th-watch-more {
    text-align: center;
    font-size: 11.5px;
    color: #9ca3af;
    padding: 6px 0 2px;
}

/* ============================================================
   TO GRADE — pending assignments, oldest first
   ============================================================ */
.th-tograde {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 16px;
    padding: 18px 20px 14px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-tograde .th-section-head { margin-bottom: 10px; }
.th-tograde-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.th-tograde-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 8px;
    background: none;
    border: none;
    border-top: 1px solid #f5f1e8;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.th-tograde-row:first-child { border-top: 0; }
.th-tograde-row:hover { background: #faf8f3; }
.th-tograde-rowmain { min-width: 0; flex: 1; }
.th-tograde-title {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.th-tograde-student {
    color: #2f6844;
    font-weight: 600;
}
.th-tograde-sub {
    font-size: 11.5px;
    color: #8a7f6a;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.th-tograde-meta {
    font-size: 11.5px;
    color: #c98a00;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ============================================================
   MY CLASSES GRID (bottom)
   ============================================================ */
.th-classes-grid-sec { margin-top: 4px; }
.th-classes-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 1100px) {
    .th-classes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .th-classes-grid { grid-template-columns: 1fr; }
}

.th-class-card {
    --b-color: #6366f1;
    position: relative;
    background: #fff;
    border: 1px solid #ece7dd;
    border-top: 2px solid var(--b-color);
    border-radius: 14px;
    padding: 20px 20px 18px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 140px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-class-card:hover {
    border-color: #d6cfbd;
    box-shadow: 0 6px 18px rgba(40, 30, 10, 0.06);
    transform: translateY(-1px);
}
.th-class-rail { display: none; }
.th-class-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #8a7f6a;
    text-transform: uppercase;
}
.th-class-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-size: 22px;
    line-height: 1.15;
    color: #111;
    letter-spacing: -0.01em;
    margin-top: -2px;
}
.th-class-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.th-class-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}
.th-class-num {
    font-size: 22px;
    font-weight: 600;
    color: #111;
    letter-spacing: -0.01em;
}
.th-class-unit {
    font-size: 12px;
    color: #6b7280;
}
.th-class-next {
    font-size: 12px;
    color: #6b7280;
}
.th-class-next strong {
    color: #2f6844;
    font-weight: 600;
}

/* ============================================================
   LESSON PLANS / ANALYTICS OVERVIEW (top-left landing pages)
   Compact page eyebrow → AI composer card (chips + heading + thread
   + textarea) → class badges / charts. Dropped the big editorial hero
   so the composer sits near the top instead of mid-page.
   ============================================================ */
.th-lp-page { gap: 18px; padding-top: 18px; }

.th-page-header {
    padding: 0 4px 2px;
}
.th-page-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #8a7f6a;
}

.th-lp-composer-sec {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.th-lp-composer-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.th-lp-composer-actions {
    display: inline-flex;
    gap: 8px;
}

.th-lp-chip {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #d6d0c2;
    color: #4b5563;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    transition: all 0.15s;
}
.th-lp-chip:hover {
    border-color: #2f6844;
    color: #2f6844;
}
.th-lp-chip.active {
    background: #e8f2ec;
    border-color: #2f6844;
    color: #2f6844;
}
.th-lp-chip svg { flex-shrink: 0; }

.th-lp-scope-meta {
    font-size: 12px;
    color: #8a7f6a;
    letter-spacing: 0.2px;
}
.th-lp-digest-status {
    margin-left: 8px;
    color: #9ca3af;
    font-size: 11.5px;
}
.th-lp-digest-status.error { color: #b45309; }

/* ----- Scope panel (drops below composer header) ----- */
.th-lp-scope-panel,
.th-lp-history-panel {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 14px;
    padding: 18px 20px 16px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-lp-scope-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.th-lp-scope-title {
    font-size: 13px;
    font-weight: 700;
    color: #111;
    letter-spacing: 0.2px;
}
.th-lp-scope-reset {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #2f6844;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.th-lp-scope-reset:hover { text-decoration: underline; }
.th-lp-scope-sub {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 12px;
}
.th-lp-scope-empty {
    padding: 12px 0;
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
}
.th-lp-scope-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.th-lp-scope-class {
    border: 1px solid #f0ece1;
    border-radius: 10px;
    padding: 10px 12px;
    transition: border-color 0.15s, background 0.15s;
}
.th-lp-scope-class.active {
    border-color: #d6e4d3;
    background: #f7faf6;
}
.th-lp-scope-class-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.th-lp-scope-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    color: #111;
    font-weight: 500;
}
.th-lp-scope-check input[type="checkbox"] {
    accent-color: #2f6844;
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.th-lp-scope-expand {
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.th-lp-scope-expand:hover { color: #2f6844; }
.th-lp-scope-units {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ece7dd;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.th-lp-scope-unit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #374151;
    cursor: pointer;
}
.th-lp-scope-unit input[type="checkbox"] {
    accent-color: #2f6844;
    width: 13px;
    height: 13px;
    cursor: pointer;
}

/* ----- History panel ----- */
.th-lp-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
}
.th-lp-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #f0ece1;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.th-lp-history-item:hover {
    border-color: #d6e4d3;
    background: #f7faf6;
}
.th-lp-history-main { min-width: 0; }
.th-lp-history-title {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.th-lp-history-meta {
    font-size: 11.5px;
    color: #8a7f6a;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.th-lp-history-del {
    font-family: inherit;
    font-size: 20px;
    line-height: 1;
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}
.th-lp-history-del:hover {
    background: #fde2e2;
    color: #b91c1c;
}

/* ----- Composer card ----- */
.th-lp-composer-card {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 16px;
    padding: 22px 24px 20px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.th-lp-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.th-lp-card-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}
.th-lp-card-title-status {
    font-size: 11.5px;
    color: #9ca3af;
    letter-spacing: 0.2px;
    white-space: nowrap;
    /* Fade in softly when the status appears, then out when it clears —
       without nudging the neighboring title. */
    animation: th-lp-status-fade 0.2s ease;
}
@keyframes th-lp-status-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.th-lp-card-title-status .th-lp-digest-status {
    margin-left: 0;
}
.th-lp-card-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-weight: 400;
    font-size: 34px;
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: #111;
    margin: 0;
    min-width: 0;
}
.th-lp-card-title em {
    color: #2f6844;
    font-style: italic;
}
.th-lp-card-actions {
    display: inline-flex;
    gap: 8px;
    flex-shrink: 0;
    padding-top: 4px;
}
.th-lp-card-meta {
    font-size: 12px;
    color: #8a7f6a;
    letter-spacing: 0.2px;
    margin-top: -8px;
}

.th-lp-empty {
    padding: 12px 2px;
    color: #6b7280;
}
.th-lp-empty-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-size: 22px;
    color: #111;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}
.th-lp-empty-sub {
    font-size: 13px;
    line-height: 1.6;
    color: #6b7280;
    max-width: 680px;
}
.th-lp-empty-sub em {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    color: #2f6844;
}

/* ----- Conversation thread ----- */
.th-lp-thread {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 580px;
    overflow-y: auto;
    padding-right: 4px;
}
.th-lp-msg {
    display: flex;
    gap: 12px;
}
.th-lp-msg-user {
    justify-content: flex-end;
}
.th-lp-msg-user .th-lp-msg-body {
    background: #e8f2ec;
    color: #0f172a;
    padding: 10px 14px;
    border-radius: 14px 14px 4px 14px;
    max-width: 82%;
    font-size: 14px;
    line-height: 1.55;
    white-space: pre-wrap;
}
.th-lp-msg-ai {
    align-items: flex-start;
}
.th-lp-msg-mark {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f0ece1;
    color: #2f6844;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}
.th-lp-msg-ai .th-lp-msg-body {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    line-height: 1.65;
    color: #1a1a1a;
}
.th-lp-msg-body p { margin: 0 0 10px; }
.th-lp-msg-body p:last-child { margin-bottom: 0; }
.th-lp-msg-body ul,
.th-lp-msg-body ol {
    margin: 6px 0 10px;
    padding-left: 22px;
}
.th-lp-msg-body li { margin-bottom: 4px; }
.th-lp-msg-body code {
    background: #f3efe6;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 12.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.th-lp-thinking {
    display: inline-flex;
    gap: 6px;
    padding: 12px 0;
}
.th-lp-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2f6844;
    opacity: 0.4;
    animation: th-lp-bounce 1.3s infinite ease-in-out;
}
.th-lp-dot:nth-child(2) { animation-delay: 0.15s; }
.th-lp-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes th-lp-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

/* ----- Input row ----- */
.th-lp-composer-input {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
.th-lp-textarea {
    flex: 1;
    min-width: 0;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.55;
    color: #111;
    background: #faf8f3;
    border: 1px solid #e5dfd2;
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    max-height: 200px;
}
.th-lp-textarea:focus {
    border-color: #2f6844;
    background: #fff;
}
.th-lp-textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.th-lp-send {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #2f6844;
    border: 1px solid #2f6844;
    border-radius: 10px;
    padding: 11px 16px;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}
.th-lp-send:hover { background: #264f35; border-color: #264f35; }
.th-lp-send.sending,
.th-lp-send:disabled {
    background: #9ea7a1;
    border-color: #9ea7a1;
    cursor: wait;
}
.th-lp-kbd {
    font-size: 10.5px;
    font-weight: 700;
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 5px;
    letter-spacing: 0.4px;
}

/* ----- Class badge footer additions ----- */
.th-lp-card-next-title {
    font-size: 12.5px;
    color: #6b7280;
    line-height: 1.4;
    margin-top: -4px;
}
.th-lp-card-cta {
    font-size: 12px;
    font-weight: 600;
    color: #2f6844;
}

/* ----- Prep status pills on class cards ----- */
.th-lp-prep-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: -2px;
}
.th-lp-prep-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1px;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid transparent;
    line-height: 1.1;
    white-space: nowrap;
}
.th-lp-prep-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.th-lp-prep-ready {
    background: #eaf5ee;
    border-color: #cfe4d4;
    color: #2f6844;
}
.th-lp-prep-todo {
    background: #fdf3e3;
    border-color: #f2dfba;
    color: #9a5b15;
}

/* ----- Ask frame: scope bar + textarea as one surface ----- */
.th-lp-ask-frame {
    flex: 1;
    min-width: 0;
    position: relative;
    background: #faf8f3;
    border: 1px solid #e5dfd2;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, background 0.15s;
}
.th-lp-ask-frame:focus-within {
    border-color: #2f6844;
    background: #fff;
}
.th-lp-scope-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #ece7dd;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px 12px 0 0;
}
.th-lp-ask-frame:focus-within .th-lp-scope-bar {
    background: #f7f4ec;
}
.th-lp-scope-bar-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #8a7f6a;
    text-transform: uppercase;
    margin-right: 4px;
}
.th-lp-scope-chip {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #d6d0c2;
    color: #4b5563;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    transition: all 0.15s;
}
.th-lp-scope-chip:hover {
    border-color: #2f6844;
    color: #2f6844;
}
.th-lp-scope-chip.narrowed {
    border-color: #2f6844;
    color: #2f6844;
}
.th-lp-scope-chip.active {
    background: #e8f2ec;
    border-color: #2f6844;
    color: #2f6844;
}
.th-lp-scope-chip svg { flex-shrink: 0; }
.th-lp-chip-caret {
    opacity: 0.7;
    margin-left: 1px;
}
.th-lp-scope-bar-reset {
    margin-left: auto;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: #2f6844;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
}
.th-lp-scope-bar-reset:hover { text-decoration: underline; }

/* Popover anchors under the scope bar. Absolute so it overlays without
   pushing the textarea down. */
.th-lp-scope-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-width: 520px;
    z-index: 30;
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 12px;
    padding: 14px 16px 12px;
    box-shadow: 0 12px 28px rgba(40, 30, 10, 0.10);
    max-height: 360px;
    overflow-y: auto;
}
.th-lp-scope-pop-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}
.th-lp-scope-pop-title {
    font-size: 12px;
    font-weight: 700;
    color: #111;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.th-lp-scope-pop-sub {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 10px;
}

/* Textarea sits below the scope bar, no top border so the surface is unified. */
.th-lp-textarea-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
}
.th-lp-ask-frame .th-lp-textarea {
    background: transparent;
    border: none;
    border-radius: 0 0 12px 12px;
    padding: 12px 14px;
    flex: 1;
    min-width: 0;
}
.th-lp-ask-frame .th-lp-textarea:focus {
    background: transparent;
    border: none;
}

/* Animated placeholder overlay (typewriter). Sits over the textarea; hides
   when textarea has content or focus. Pointer-events:none so clicking the
   overlay still focuses the textarea. */
.th-lp-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.55;
    color: #9a9486;
    pointer-events: none;
    transition: opacity 0.15s;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
}
.th-lp-placeholder-hidden { opacity: 0; }
.th-lp-ph-prefix {
    color: #8a7f6a;
    font-weight: 600;
    margin-right: 2px;
}
.th-lp-ph-text {
    font-style: italic;
    color: #8a7f6a;
}
.th-lp-ph-caret {
    display: inline-block;
    width: 1px;
    height: 14px;
    background: #8a7f6a;
    margin-left: 2px;
    transform: translateY(2px);
    animation: th-lp-ph-blink 1s steps(2, start) infinite;
}
@keyframes th-lp-ph-blink {
    to { visibility: hidden; }
}

/* ============================================================
   ANALYTICS OVERVIEW (top-left landing page)
   Re-uses .th-lp-* composer styling. Adds compact class badges,
   line charts, per-class data table, students-to-watch list.
   ============================================================ */
.th-ap-page .th-lp-composer-card .th-lp-thread {
    max-height: 420px;
}

/* ----- Scope panel tabs (extra scope dimensions) ----- */
.th-ap-scope-tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: #f4f1e8;
    border-radius: 999px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.th-ap-scope-tab {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
}
.th-ap-scope-tab:hover { color: #2f6844; }
.th-ap-scope-tab.active {
    background: #fff;
    color: #2f6844;
    box-shadow: 0 1px 3px rgba(40, 30, 10, 0.06);
}
.th-ap-scope-tab-badge {
    background: #2f6844;
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 10.5px;
    letter-spacing: 0.3px;
}
.th-ap-scope-students {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 16px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 6px;
}
@media (max-width: 800px) {
    .th-ap-scope-students { grid-template-columns: 1fr; }
}
.th-ap-scope-student-cls {
    color: #9ca3af;
    font-size: 11px;
    margin-left: 6px;
}

/* ----- Compact class badge row ----- */
.th-ap-badge-row-sec {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: -4px;
}
.th-ap-badge-row-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #8a7f6a;
}
.th-ap-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.th-ap-badge {
    --b-color: #6366f1;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px 7px 12px;
    border: 1px solid #ece7dd;
    background: #fff;
    border-radius: 999px;
    text-decoration: none;
    color: inherit;
    font-size: 12.5px;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-ap-badge:hover {
    border-color: var(--b-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(40, 30, 10, 0.05);
}
.th-ap-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.th-ap-badge-name {
    font-weight: 600;
    color: #111;
}
.th-ap-badge-metric {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    color: #2f6844;
    font-size: 14px;
    letter-spacing: -0.01em;
}

/* ----- Analytics tab strip (All Classes + per-class) ----- */
.th-ap-tab-sec {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 4px;
    position: relative;
}
.th-ap-tab-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    overflow: visible;
    border-bottom: 1px solid #ece7dd;
    padding-bottom: 0;
}
.th-ap-tab {
    --t-color: #6366f1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px 11px 14px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    border-radius: 0;
    cursor: pointer;
    font-size: 13px;
    color: #5b5341;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    white-space: nowrap;
    font-family: inherit;
}
.th-ap-tab:hover {
    color: #111;
    background: rgba(47, 104, 68, 0.04);
}
.th-ap-tab-active {
    color: #111;
    border-bottom-color: var(--t-color);
    background: rgba(47, 104, 68, 0.04);
}
.th-ap-tab--all .th-ap-tab-allicon {
    font-size: 14px;
    color: #8a7f6a;
    letter-spacing: -0.02em;
    transform: translateY(-1px);
}
.th-ap-tab--all.th-ap-tab-active {
    border-bottom-color: #2f6844;
}
.th-ap-tab--all.th-ap-tab-active .th-ap-tab-allicon {
    color: #2f6844;
}
.th-ap-tab-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.th-ap-tab-name {
    font-weight: 600;
}
.th-ap-tab-metric {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    color: #2f6844;
    font-size: 14px;
    letter-spacing: -0.01em;
    margin-left: 2px;
}
.th-ap-tab-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px 10px;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    color: #6b6555;
    font-size: 12px;
    font-family: inherit;
    border-radius: 0;
}
.th-ap-tab-more:hover {
    color: #111;
    background: rgba(47, 104, 68, 0.04);
}
.th-ap-tab-more-caret {
    font-size: 9px;
    opacity: 0.6;
}
.th-ap-tab-morepop {
    position: absolute;
    z-index: 50;
    background: #fff;
    border: 1px solid #e5dfd2;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(40, 30, 10, 0.10);
    padding: 6px;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.th-ap-morepop-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 13px;
    color: #111;
    border-radius: 6px;
    text-align: left;
    font-family: inherit;
}
.th-ap-morepop-item:hover {
    background: rgba(47, 104, 68, 0.07);
}
.th-ap-tab-body {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding-top: 22px;
}
.th-ap-tab-placeholder {
    --p-color: #6366f1;
    background: #fff;
    border: 1px solid #ece7dd;
    border-left: 3px solid var(--p-color);
    border-radius: 14px;
    padding: 32px 36px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.th-ap-tab-placeholder-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #8a7f6a;
}
.th-ap-tab-placeholder-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-size: 28px;
    line-height: 1.05;
    color: #111;
    letter-spacing: -0.015em;
}
.th-ap-tab-placeholder-sub {
    color: #5b5341;
    font-size: 13.5px;
    line-height: 1.55;
    max-width: 56ch;
}
.th-ap-tab-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 64px 24px;
    color: #6b6555;
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-ap-tab-loading-name {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-size: 24px;
    color: #111;
    letter-spacing: -0.01em;
}
.th-ap-tab-loading-spin {
    width: 32px;
    height: 32px;
    border: 3px solid #ece7dd;
    border-top-color: #2f6844;
    border-radius: 50%;
    animation: th-ap-spin 0.8s linear infinite;
}
.th-ap-tab-loading-sub {
    font-size: 13px;
    color: #8a7f6a;
}
@keyframes th-ap-spin {
    to { transform: rotate(360deg); }
}

/* ----- Per-class empty state (zero grades yet) ----- */
.th-ap-empty-card {
    --p-color: #2f6844;
    background: #fff;
    border: 1px solid #ece7dd;
    border-left: 3px solid var(--p-color);
    border-radius: 14px;
    padding: 36px 40px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-ap-empty-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #8a7f6a;
    text-transform: uppercase;
}
.th-ap-empty-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: normal;
    font-weight: 400;
    font-size: 32px;
    line-height: 1.1;
    margin: 0;
    color: #111;
    letter-spacing: -0.015em;
}
.th-ap-empty-title em {
    font-style: italic;
    color: var(--p-color);
}
.th-ap-empty-sub {
    margin: 0;
    color: #5b5341;
    font-size: 13.5px;
    line-height: 1.55;
    max-width: 56ch;
}
.th-ap-empty-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}
.th-ap-empty-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    background: #fdfaf2;
    border: 1px solid #ece7dd;
    border-radius: 10px;
    color: #111;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.th-ap-empty-step:hover {
    border-color: var(--p-color);
    background: #fff;
    transform: translateY(-1px);
}
.th-ap-empty-step-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--p-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-size: 15px;
    font-style: italic;
}
.th-ap-empty-step-text {
    font-size: 13.5px;
    line-height: 1.55;
    color: #2f2a1d;
}
.th-ap-empty-step-text b {
    font-weight: 700;
    color: #111;
}

/* ----- Per-class analytics overrides for the home tab body context -----
   facelift.css assumes .ca-wrap fills #placeholderContent (a flex container
   with bounded height). Inside the home tab body the parent is the long
   scrollable page, so flex:1-style growth would collapse content to 0.
   Override with natural block flow and an explicit row split. */
.th-ap-tab-body.fl-mode .ca-wrap {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
}
.th-ap-tab-body.fl-mode .ca-wrap > .title-actions-row {
    border-bottom: 1px solid #ece7dd;
    padding: 4px 0 18px;
    margin-bottom: 18px;
}
.th-ap-tab-body.fl-mode .ca-wrap .page-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-weight: 400;
    font-size: 30px;
    color: #111;
    letter-spacing: -0.015em;
    margin: 0;
}
.th-ap-tab-body.fl-mode .ca-wrap .page-title[data-eyebrow]::before {
    content: attr(data-eyebrow);
    display: block;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #8a7f6a;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.th-ap-tab-body.fl-mode .ca-columns {
    display: flex !important;
    flex: none !important;
    min-height: 0 !important;
    gap: 18px;
    align-items: stretch !important;
}
.th-ap-tab-body.fl-mode .ca-col {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0 !important;
    display: flex;
    flex-direction: column;
}
.th-ap-tab-body.fl-mode .ca-col .ph-panel {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex;
    flex-direction: column;
}
/* The .ca-tab-content scroll surface — make it grow with content rather
   than fixing a viewport-relative height (which class.html's full-page
   layout could afford but the tab body can't). */
.th-ap-tab-body.fl-mode .ca-tab-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 14px 18px 20px;
}
/* Narrow viewports — stack the two columns. */
@media (max-width: 900px) {
    .th-ap-tab-body.fl-mode .ca-columns {
        flex-direction: column !important;
    }
    .th-ap-tab-body.fl-mode .ca-col {
        flex: 1 1 auto;
    }
}

/* ----- Summary strip ----- */
.th-ap-summary-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 14px;
    padding: 18px 22px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
@media (max-width: 900px) {
    .th-ap-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.th-ap-summary-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-left: 1px solid #f3efe6;
    padding-left: 16px;
}
.th-ap-summary-stat:first-child {
    border-left: 0;
    padding-left: 0;
}
.th-ap-summary-num {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-size: 30px;
    line-height: 1;
    color: #111;
    letter-spacing: -0.01em;
}
.th-ap-summary-num em {
    font-style: italic;
    color: #2f6844;
}
.th-ap-summary-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #8a7f6a;
    text-transform: uppercase;
}

/* ----- Charts grid ----- */
.th-ap-charts-sec { display: flex; flex-direction: column; gap: 14px; }
.th-ap-legend {
    display: inline-flex;
    gap: 8px;
}
.th-ap-legend-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    background: #f3efe6;
    color: #6b7280;
    letter-spacing: 0.2px;
}
.th-ap-charts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
@media (max-width: 900px) {
    .th-ap-charts-grid { grid-template-columns: 1fr; }
}
.th-ap-chart-card {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 14px;
    padding: 18px 20px 14px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.th-ap-chart-card-wide {
    grid-column: 1 / -1;
}
.th-ap-chart-title {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-size: 20px;
    color: #111;
    letter-spacing: -0.01em;
    line-height: 1.15;
}
.th-ap-chart-sub {
    font-size: 12px;
    color: #6b7280;
    letter-spacing: 0.1px;
    margin-bottom: 4px;
}

.th-ap-chart {
    width: 100%;
    height: auto;
    display: block;
}
.th-ap-chart-grid {
    stroke: #f0ece1;
    stroke-width: 1;
}
.th-ap-chart-axis-label {
    font-size: 10px;
    fill: #9ca3af;
    font-family: inherit;
}
.th-ap-chart-line {
    fill: none;
    stroke: #2f6844;
    stroke-width: 2.2;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.th-ap-chart-area {
    fill: rgba(47, 104, 68, 0.08);
    stroke: none;
}
.th-ap-chart-dot {
    fill: #fff;
    stroke: #2f6844;
    stroke-width: 1.8;
}
.th-ap-chart-multiline {
    stroke-linejoin: round;
    stroke-linecap: round;
    fill: none;
}
.th-ap-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #ece7dd;
}
.th-ap-chart-legend-item {
    font-size: 11.5px;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.th-ap-chart-legend-dot {
    width: 8px;
    height: 2.5px;
    border-radius: 2px;
}
.th-ap-chart-empty text {
    font-family: inherit;
}

/* ----- Trends row: tabbed chart (left) + tabbed students-to-watch (right) ----- */
.th-ap-trends-row { display: flex; flex-direction: column; gap: 14px; }
.th-ap-trends-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 16px;
}
@media (max-width: 1100px) {
    .th-ap-trends-grid { grid-template-columns: 1fr; }
}

/* Tab strip — shared between charts card and watch card. Pill-style, sits at
   the top of each card and scrolls horizontally on narrow widths. */
.th-ap-tabbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: #f4f1e8;
    border-radius: 999px;
    margin-bottom: 10px;
    max-width: 100%;
    overflow-x: auto;
}
.th-ap-tabbar::-webkit-scrollbar { display: none; }
.th-ap-tab {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.1;
    transition: background 0.15s, color 0.15s;
}
.th-ap-tab:hover { color: #2f6844; }
.th-ap-tab.active {
    background: #fff;
    color: #2f6844;
    box-shadow: 0 1px 3px rgba(40, 30, 10, 0.06);
}
.th-ap-watch-tab-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Empty-state wrapper so the chart holds its size even with no data. */
.th-ap-chart-empty-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

/* ----- Students to Watch card (right column) ----- */
.th-ap-watch-card {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 14px;
    padding: 18px 20px 14px;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 320px;
}
.th-ap-watch-tabbar { margin-bottom: 6px; }
.th-ap-watch-body {
    margin-top: 6px;
    overflow-y: auto;
    max-height: 360px;
}
.th-ap-watch-meta {
    font-size: 11.5px;
    color: #8a7f6a;
    margin-bottom: 8px;
    letter-spacing: 0.1px;
}
.th-ap-watch-meta em {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    color: #2f6844;
}
.th-ap-watch-loading {
    padding: 28px 0;
    text-align: center;
    color: #9ca3af;
    font-size: 12.5px;
}
.th-ap-watch-empty {
    padding: 28px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #2f6844;
    font-size: 12.5px;
}
.th-ap-watch-empty svg { color: #2f6844; }

.th-ap-watch-list-v2 {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.th-ap-watch-row-v2 {
    --b-color: #6366f1;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #f0ece1;
    border-radius: 10px;
    background: #fff;
    border-left: 3px solid var(--b-color);
    transition: border-color 0.15s, background 0.15s;
}
.th-ap-watch-row-v2:hover { background: #faf8f3; }
.th-ap-watch-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}
.th-ap-watch-dot-red { background: #dc2626; }
.th-ap-watch-dot-yellow { background: #eab308; }
.th-ap-watch-dot-green { background: #059669; }
.th-ap-watch-rowbody {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.th-ap-watch-rowtop {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.th-ap-watch-name-v2 {
    font-weight: 600;
    font-size: 13px;
    color: #111;
}
.th-ap-watch-classchip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 600;
    color: #4b5563;
    background: #f4f1e8;
    border-radius: 999px;
    padding: 2px 8px;
    letter-spacing: 0.2px;
}
.th-ap-watch-classchip-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.th-ap-watch-actions-v2 {
    margin-left: auto;
    display: inline-flex;
    gap: 4px;
}
.th-ap-watch-iconbtn {
    border: 1px solid transparent;
    background: transparent;
    color: #6b7280;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.th-ap-watch-iconbtn:hover {
    background: #f4f1e8;
    color: #2f6844;
    border-color: #ece7dd;
}
.th-ap-watch-reason-v2 {
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
}
/* Little pill after the name showing whether the row came from a teacher-
   finalized flag or an analytics trend signal. Keeps the two concepts visually
   distinct even when they sit in the same list. */
.th-ap-watch-source {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 999px;
    line-height: 1.2;
}
.th-ap-watch-source-teacher {
    color: #2f6844;
    background: #e8f2ec;
}
.th-ap-watch-source-analytics {
    color: #9a5b15;
    background: #fdf3e3;
}

/* ----- Students to watch ----- */
.th-ap-watch-sec { display: flex; flex-direction: column; gap: 12px; }
.th-ap-watch-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-ap-watch-row {
    --b-color: #6366f1;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 18px;
    padding: 14px 18px;
    border-top: 1px solid #f3efe6;
    border-left: 3px solid var(--b-color);
    transition: background 0.15s;
}
.th-ap-watch-row:first-child { border-top: 0; }
.th-ap-watch-row:hover { background: #f7faf6; }
.th-ap-watch-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.th-ap-watch-cls {
    font-size: 11.5px;
    font-weight: 500;
    color: #8a7f6a;
    letter-spacing: 0.1px;
}
.th-ap-watch-stats {
    display: flex;
    gap: 18px;
}
.th-ap-watch-stat { text-align: right; }
.th-ap-watch-stat-num {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-style: italic;
    font-size: 18px;
    color: #111;
    line-height: 1;
    letter-spacing: -0.01em;
}
.th-ap-watch-stat-num.pos { color: #2f6844; }
.th-ap-watch-stat-num.neg { color: #b91c1c; }
.th-ap-watch-stat-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #9ca3af;
    text-transform: uppercase;
    margin-top: 3px;
}
.th-ap-watch-link {
    font-size: 12px;
    font-weight: 600;
    color: #2f6844;
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid #d6d0c2;
    border-radius: 999px;
    background: #fff;
    white-space: nowrap;
}
.th-ap-watch-link:hover {
    border-color: #2f6844;
    background: #f4f1e8;
}
@media (max-width: 700px) {
    .th-ap-watch-row { grid-template-columns: 1fr; gap: 10px; }
    .th-ap-watch-stats { justify-content: flex-start; }
    .th-ap-watch-stat { text-align: left; }
}

/* ----- Classes at a glance table ----- */
.th-ap-classes-sec { display: flex; flex-direction: column; gap: 12px; }
.th-ap-classes-table {
    background: #fff;
    border: 1px solid #ece7dd;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(40, 30, 10, 0.02);
}
.th-ap-classes-head,
.th-ap-classes-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 80px 80px 80px 60px 140px;
    gap: 14px;
    align-items: center;
    padding: 12px 18px;
}
.th-ap-classes-head {
    background: #faf8f3;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: #8a7f6a;
    text-transform: uppercase;
    border-bottom: 1px solid #ece7dd;
}
.th-ap-classes-row {
    --b-color: #6366f1;
    border-top: 1px solid #f3efe6;
    color: inherit;
    text-decoration: none;
    font-size: 13.5px;
    color: #111;
    transition: background 0.15s;
}
.th-ap-classes-row:first-of-type { border-top: 0; }
.th-ap-classes-row:hover { background: #f7faf6; }
.th-ap-classes-col-name {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    min-width: 0;
}
.th-ap-classes-rail {
    width: 3px;
    height: 22px;
    background: var(--b-color);
    border-radius: 2px;
    flex-shrink: 0;
}
.th-ap-classes-col-spark svg { display: block; }
.th-ap-spark {
    width: 120px;
    height: 28px;
}
@media (max-width: 900px) {
    .th-ap-classes-head { display: none; }
    .th-ap-classes-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
    }
    .th-ap-classes-col:not(.th-ap-classes-col-name):not(.th-ap-classes-col-spark) {
        display: none;
    }
}

/* ============================================================
   PLACEHOLDERS (Maintenance / AI Chat)
   ============================================================ */
.th-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: #6b7280;
    text-align: center;
    padding: 40px 20px;
}
.th-placeholder-icon { color: #9ca3af; margin-bottom: 16px; }
.th-placeholder-title {
    font-size: 20px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 6px;
}
.th-placeholder-sub { font-size: 14px; color: #6b7280; }

/* ============================================================
   GHOST (no classes yet)
   ============================================================ */
.th-ghost-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    width: 100%;
}
.th-ghost-content {
    flex: 1;
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
    filter: grayscale(0.4);
    /* Center the inner .th-page so the faded hero aligns with the
       welcome modal that floats on top. Without this it sits left. */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Welcome modal overlay — 2-column onboarding card mirroring the
   per-class dashboard's dh-onb-* structure (LEFT actions / RIGHT
   video + purpose copy). */
.th-welcome-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}
.th-welcome-modal {
    background: linear-gradient(180deg, #fefdfb 0%, #f8f5ee 100%);
    border-radius: 24px;
    border: 1px solid #ece7dd;
    box-shadow:
        0 24px 64px rgba(40, 30, 10, 0.10),
        0 8px 24px rgba(40, 30, 10, 0.04),
        0 1px 0 rgba(255, 255, 255, 0.8) inset;
    padding: 44px 52px 48px;
    max-width: 940px;
    width: 95%;
    animation: th-welcome-enter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes th-welcome-enter {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Headline */
.th-welcome-headline { text-align: center; margin-bottom: 32px; }
.th-welcome-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: #2f6844;
    margin-bottom: 8px;
}
.th-welcome-modal h2 {
    font-family: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
    font-weight: 400;
    font-size: 36px;
    color: #1a1a1a;
    margin: 0 0 10px;
    letter-spacing: -0.015em;
    line-height: 1.1;
}
.th-welcome-modal h2 em {
    color: #2f6844;
    font-style: italic;
}
.th-welcome-headline p {
    font-size: 15px;
    color: #4b5563;
    line-height: 1.6;
    margin: 0 auto;
    max-width: 540px;
}

/* Body grid */
.th-welcome-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 32px;
    align-items: start;
}
@media (max-width: 820px) {
    .th-welcome-body { grid-template-columns: 1fr; }
}

/* LEFT — action cards stack */
.th-welcome-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.th-welcome-action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: #fff;
    border: 1.5px solid #ece7dd;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease;
}
.th-welcome-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(47, 104, 68, 0.10);
}
.th-welcome-action-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.th-welcome-action-primary {
    background: linear-gradient(135deg, #2f6844 0%, #264f35 100%);
    border-color: #2f6844;
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 104, 68, 0.22);
}
.th-welcome-action-primary:hover {
    box-shadow: 0 6px 18px rgba(47, 104, 68, 0.30);
    border-color: #264f35;
}
.th-welcome-action-primary .th-welcome-action-icon { background: rgba(255, 255, 255, 0.18); color: #fff; }
.th-welcome-action-primary .th-welcome-action-desc { color: rgba(255, 255, 255, 0.82); }
.th-welcome-action-primary .th-welcome-action-arrow { color: #fff; }
.th-welcome-action-google:hover { border-color: #93c5fd; }
.th-welcome-action-google .th-welcome-action-icon { background: #eff6ff; }
.th-welcome-action-link:hover { border-color: #a7d4b6; }
.th-welcome-action-link .th-welcome-action-icon { background: #ecf5ef; }
.th-welcome-action-settings:hover { border-color: #d1d5db; }
.th-welcome-action-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.th-welcome-action-title {
    font-size: 14px;
    font-weight: 700;
    color: inherit;
}
.th-welcome-action-desc {
    font-size: 12.5px;
    color: #6b7280;
    line-height: 1.4;
}
.th-welcome-action-arrow {
    flex-shrink: 0;
    font-size: 18px;
    color: #9ca3af;
    transition: transform 0.15s, color 0.15s;
}
.th-welcome-action:hover .th-welcome-action-arrow { transform: translateX(3px); color: #2f6844; }

/* RIGHT — video + purpose */
.th-welcome-right {
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.th-welcome-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
    background: #1a1a1a;
    box-shadow: 0 8px 20px rgba(40, 30, 10, 0.12);
}
.th-welcome-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.th-welcome-video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background:
        radial-gradient(circle at 30% 20%, rgba(47, 104, 68, 0.18), transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(47, 104, 68, 0.10), transparent 60%),
        linear-gradient(135deg, #f0eee8 0%, #e8e4d8 100%);
}
.th-welcome-video-placeholder svg {
    opacity: 0.85;
    transition: transform 0.2s ease;
}
.th-welcome-video-placeholder:hover svg { transform: scale(1.05); }
.th-welcome-video-caption {
    font-size: 12.5px;
    color: #6b5d3f;
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Purpose copy block */
.th-welcome-purpose {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid #ece7dd;
    border-radius: 12px;
}
.th-welcome-purpose-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #2f6844;
    margin-bottom: 12px;
}
.th-welcome-purpose-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.th-welcome-purpose-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    color: #374151;
    line-height: 1.5;
}
.th-welcome-purpose-list li svg { flex-shrink: 0; margin-top: 2px; }
.th-welcome-purpose-list strong { color: #1a1a1a; font-weight: 700; }

@media (max-width: 640px) {
    .th-welcome-modal { padding: 28px 22px 32px; border-radius: 18px; }
    .th-welcome-modal h2 { font-size: 28px; }
    .th-welcome-headline p { font-size: 14px; }
}

/* ============================================================
   CONNECT GOOGLE BADGE (floating top-right, post-signup)
   ============================================================ */
.th-google-banner {
    position: fixed;
    top: 78px;
    right: 24px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 240px;
    padding: 22px 18px 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.08),
        0 2px 6px rgba(15, 23, 42, 0.04);
    animation: th-banner-slide-in 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes th-banner-slide-in {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}
.th-google-banner-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #9ca3af;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}
.th-google-banner-dismiss:hover { background: #f3f4f6; color: #4b5563; }
.th-google-banner-icon { margin-bottom: 10px; line-height: 0; }
.th-google-banner-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    text-align: center;
}
.th-google-banner-sub {
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
    text-align: center;
    margin-bottom: 16px;
}
.th-google-banner-connect {
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #2f6844;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: background 0.15s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(47, 104, 68, 0.18);
}
.th-google-banner-connect:hover {
    background: #264f35;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 104, 68, 0.25);
}

/* ===== FIRST-UNIT-PLAN GET-STARTED MODAL =====
   Centered overlay on the home page, mirrors the empty-roster .er-modal
   shape (white card, rounded corners, dim backdrop) but lives in app.html
   where class-placeholder.css isn't loaded — so styles are self-contained.
*/
.th-fum-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.th-fum-modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 60px rgba(0, 0, 0, 0.25);
    width: 560px;
    max-width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
/* Split variant — left nav of next-step buttons + right detail pane.
   Wider than the legacy single-column modal so two columns fit cleanly. */
.th-fum-modal-split {
    width: 820px;
}
@media (max-width: 900px) {
    .th-fum-modal-split { width: 100%; }
}
.th-fum-header {
    padding: 20px 28px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.th-fum-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: #2f6844;
}
.th-fum-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}
.th-fum-close:hover { color: #111827; }

.th-fum-body {
    padding: 14px 28px 22px;
    overflow-y: auto;
}
.th-fum-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-size: 30px;
    line-height: 1.18;
    color: #0f172a;
    margin: 6px 0 10px;
}
.th-fum-title em { font-style: italic; color: #2f6844; }
.th-fum-sub {
    font-size: 14px;
    line-height: 1.55;
    color: #475569;
    margin: 0 0 18px;
}

.th-fum-steps {
    list-style: none;
    margin: 0 0 22px;
    padding: 14px 16px;
    background: #f8fafb;
    border: 1px solid #e8efe9;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.th-fum-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #94a3b8;
}
.th-fum-stepnum {
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.th-fum-step-done { color: #2f6844; }
.th-fum-step-done .th-fum-stepnum {
    background: #2f6844;
    color: #fff;
}
.th-fum-step-active { color: #0f172a; font-weight: 600; }
.th-fum-step-active .th-fum-stepnum {
    background: #fff;
    color: #2f6844;
    border: 2px solid #2f6844;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.th-fum-picker-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 10px;
}
.th-fum-classes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.th-fum-class {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 110px;
}
.th-fum-class:hover {
    border-color: #2f6844;
    background: #f6fbf7;
}
.th-fum-class[aria-pressed="true"] {
    border-color: #2f6844;
    background: #ecf6ef;
    box-shadow: 0 0 0 3px rgba(47, 104, 68, 0.12);
}
.th-fum-class-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}
.th-fum-class-sub {
    font-size: 11px;
    color: #64748b;
}

.th-fum-footer {
    padding: 16px 28px 22px;
    border-top: 1px solid #eef2f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fdfdfc;
}
.th-fum-skip {
    background: none;
    border: none;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    padding: 8px 4px;
    transition: color 0.15s;
}
.th-fum-skip:hover { color: #0f172a; text-decoration: underline; }

.th-fum-cta {
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #2f6844;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 2px 6px rgba(47, 104, 68, 0.18);
}
.th-fum-cta:hover {
    background: #264f35;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(47, 104, 68, 0.25);
}

/* ============================================================
   First-unit modal — SPLIT LAYOUT (post-2026-05-14 redesign)
   ------------------------------------------------------------
   .th-fum-modal-split swaps the legacy vertical step list for a
   2-column nav + detail pane. Hero band sits above the split so
   the title still reads "Next up: …" without losing the
   editorial feel of the original.
   ============================================================ */
.th-fum-modal-split .th-fum-hero {
    padding: 4px 28px 18px;
}
.th-fum-modal-split .th-fum-hero .th-fum-title {
    margin: 0 0 8px;
}
.th-fum-modal-split .th-fum-hero .th-fum-sub {
    margin: 0;
}

.th-fum-split {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    border-top: 1px solid #eef2f0;
}
@media (max-width: 760px) {
    .th-fum-split {
        grid-template-columns: 1fr;
    }
}

.th-fum-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 14px;
    background: #f7faf6;
    border-right: 1px solid #eef2f0;
    overflow-y: auto;
    min-height: 0;
}
@media (max-width: 760px) {
    .th-fum-nav {
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #eef2f0;
        padding: 12px;
    }
}

.th-fum-nav-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s, transform 0.08s;
    font-family: inherit;
    color: #1f2937;
}
.th-fum-nav-btn:hover {
    background: #fff;
    border-color: #d6e6dc;
}
.th-fum-nav-btn.is-active {
    background: #fff;
    border-color: #2f6844;
    box-shadow: 0 1px 3px rgba(47, 104, 68, 0.12);
}
/* Locked tab — visible but not interactive. Matches the .gh-split-tab.is-locked
   treatment in class-placeholder.css so the cross-modal language reads the
   same: greyed out, no hover, no click target. */
.th-fum-nav-btn.is-locked,
.th-fum-nav-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}
.th-fum-nav-btn.is-locked:hover,
.th-fum-nav-btn[disabled]:hover {
    background: transparent;
    border-color: transparent;
}
.th-fum-nav-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ecf6ef;
    color: #2f6844;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
}
.th-fum-nav-btn.is-active .th-fum-nav-icon {
    background: #2f6844;
    color: #fff;
}
.th-fum-nav-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.th-fum-nav-label {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.1px;
}
.th-fum-nav-sub {
    font-size: 11.5px;
    color: #64748b;
    line-height: 1.35;
}

/* Right detail pane — content swaps based on the active left button.
   Fixed height (not just min-height) pins the modal shape across tab
   switches so it stays the same size regardless of which option the
   teacher clicks. The "Plan a unit" pane is the densest (class chips
   + CTA) and sets the floor. Shorter panes (Connect Google / Open
   settings) keep the same shell; any pane that overflows scrolls
   internally rather than stretching the modal.
   Flex column + margin-top:auto on the CTA row pins the action button
   to the bottom-right of the pane regardless of how much content sits
   above it. Same trick used in gh-split placeholders for visual parity. */
.th-fum-detail {
    padding: 22px 28px 18px;
    overflow-y: auto;
    height: 440px;
    display: flex;
    flex-direction: column;
}
.th-fum-detail-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.7px;
    text-transform: uppercase;
    color: #2f6844;
    margin-bottom: 6px;
}
.th-fum-detail-title {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: 22px;
    color: #0f172a;
    margin: 0 0 8px;
    line-height: 1.2;
}
.th-fum-detail-sub {
    font-size: 13.5px;
    line-height: 1.55;
    color: #475569;
    margin: 0 0 16px;
}
.th-fum-detail-list {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #475569;
}
.th-fum-detail-list li {
    padding: 8px 12px;
    background: #f8fafb;
    border: 1px solid #e8efe9;
    border-radius: 8px;
}
.th-fum-detail-list strong {
    color: #0f172a;
    font-weight: 700;
}
.th-fum-detail-cta-row {
    display: flex;
    justify-content: flex-end;
    /* margin-top: auto pushes the CTA to the bottom of the flex-column
       pane so the button anchors to the bottom-right of the modal — not
       the bottom of the content above it. */
    margin-top: auto;
    padding-top: 12px;
}
.th-fum-cta-secondary {
    background: #fff;
    color: #2f6844;
    border: 1px solid #2f6844;
    box-shadow: none;
}
.th-fum-cta-secondary:hover {
    background: #ecf6ef;
    color: #1f4d31;
    border-color: #1f4d31;
}
