/* =====================================================================
   Course Certification Platform — Styles
   Palette: deep indigo ink + marigold thread. Type: Mukta (supports
   Devanagari, so Marathi/Hindi course titles render well).
   ===================================================================== */

:root {
    --ink: #1D2B53;
    --ink-hover: #2B3D72;
    --marigold: #E3A018;
    --marigold-soft: #FBF0D5;
    --paper: #F5F6F9;
    --surface: #FFFFFF;
    --text: #1B2130;
    --muted: #586177;
    --line: #DADFE8;
    --leaf: #2F7A57;
    --leaf-soft: #E3F1EA;
    --danger: #B3261E;
    --danger-soft: #FBE9E7;

    --font: "Mukta", "Noto Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --step--1: 0.875rem;
    --step-0: 1.0625rem;
    --step-1: 1.25rem;
    --step-2: 1.625rem;
    --step-3: 2.125rem;
    --step-4: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);

    --wrap: 1180px;
    --radius: 10px;
    --radius-small: 7px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--step-0);
    line-height: 1.55;
    color: var(--text);
    background: var(--paper);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; padding-bottom: 4rem; }

img { max-width: 100%; display: block; }

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink-hover); }

h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -0.01em; }

:focus-visible {
    outline: 3px solid var(--marigold);
    outline-offset: 2px;
    border-radius: 3px;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.25rem; }

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 1rem; top: -3rem; z-index: 100;
    background: var(--ink); color: #fff; padding: .5rem 1rem; border-radius: var(--radius-small);
}
.skip-link:focus { top: 1rem; color: #fff; }

/* ---------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font: inherit; font-weight: 700; font-size: var(--step-0);
    padding: .6rem 1.25rem;
    border: 2px solid var(--ink);
    border-radius: var(--radius-small);
    background: var(--ink); color: #fff;
    text-decoration: none; cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: #fff; }
.btn:disabled { background: var(--line); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-small { padding: .3rem .9rem; font-size: var(--step--1); }
.btn-block { width: 100%; }
.btn-quiet { background: transparent; color: var(--ink); }
.btn-quiet:hover { background: var(--ink); color: #fff; }

.link-button {
    font: inherit; background: none; border: 0; padding: 0; color: inherit; cursor: pointer;
    text-decoration: underline; text-underline-offset: 3px;
}

/* ---------------------------------------------------------------------
   Header / footer
   --------------------------------------------------------------------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 64px; }

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-mark {
    width: 26px; height: 26px; border-radius: 6px; background: var(--ink); position: relative; flex: none;
}
.brand-mark::after {
    content: ""; position: absolute; left: 5px; right: 5px; bottom: 6px; height: 4px;
    background: var(--marigold); border-radius: 2px;
}
.brand-name { font-weight: 800; font-size: var(--step-1); letter-spacing: -0.01em; }

.site-nav { display: flex; align-items: center; gap: 1.25rem; }
.site-nav > a:not(.btn) { text-decoration: none; font-weight: 500; color: var(--text); }
.site-nav > a:not(.btn):hover { color: var(--ink); text-decoration: underline; }
.nav-user { color: var(--muted); font-size: var(--step--1); max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-logout { margin: 0; }
.nav-logout .link-button { color: var(--muted); font-size: var(--step--1); }

.nav-toggle { display: none; }

@media (max-width: 760px) {
    .nav-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--radius-small);
        background: var(--surface); cursor: pointer;
    }
    .nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
        display: block; width: 18px; height: 2px; background: var(--ink); position: relative; content: "";
    }
    .nav-toggle-bar::before { position: absolute; top: -6px; }
    .nav-toggle-bar::after { position: absolute; top: 6px; }

    .site-nav {
        display: none; position: absolute; left: 0; right: 0; top: 64px; z-index: 20;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem 1.25rem 1rem;
    }
    .site-nav.is-open { display: flex; }
    .site-nav > * { padding: .7rem 0; border-bottom: 1px solid var(--line); }
    .site-nav > *:last-child { border-bottom: 0; }
    .site-nav .btn { margin-top: .5rem; }
    .nav-user { max-width: none; }
    .site-header { position: relative; }
}

.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 2rem 0; font-size: var(--step--1); color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem; }
.footer-brand { margin: 0; font-weight: 800; color: var(--ink); }
.site-footer nav { display: flex; gap: 1.25rem; }
.site-footer a { color: var(--muted); }
.footer-copy { margin: 0 0 0 auto; }

/* ---------------------------------------------------------------------
   Flash messages & shared bits
   --------------------------------------------------------------------- */
.flash-stack { padding-top: 1rem; }
.flash {
    margin: 0 0 .5rem; padding: .7rem 1rem; border-radius: var(--radius-small);
    border-left: 4px solid var(--ink); background: var(--surface);
}
.flash-success { border-left-color: var(--leaf); background: var(--leaf-soft); }
.flash-info { border-left-color: var(--marigold); background: var(--marigold-soft); }
.flash-error { border-left-color: var(--danger); background: var(--danger-soft); }

.page-title { font-size: var(--step-3); color: var(--ink); margin: 0 0 .75rem; }
.lede { font-size: var(--step-1); color: var(--muted); margin: 0 0 1.5rem; max-width: 60ch; }
.hint { color: var(--muted); font-size: var(--step--1); margin: .35rem 0 0; }
.section-heading { font-size: var(--step-2); color: var(--ink); margin: 3rem 0 1rem; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; font-size: var(--step--1); color: var(--muted); margin: 0 0 1rem; }
.breadcrumb a { color: var(--muted); }

.empty {
    background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
    padding: 2rem; text-align: center; color: var(--muted);
}
.empty p { margin: 0 0 1rem; }
.empty p:last-child { margin: 0; }
.empty-page { padding-top: 4rem; }

.tag {
    font-size: .75rem; font-weight: 700; color: var(--ink);
    background: var(--marigold-soft); border-radius: 4px; padding: .05rem .45rem;
}

/* ---------------------------------------------------------------------
   The thread — marigold progress line used across the platform
   --------------------------------------------------------------------- */
.thread { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.thread > span { display: block; height: 100%; background: var(--marigold); border-radius: 3px; transition: width .4s ease; }
.thread-light { background: rgba(255,255,255,.2); }
.thread-label { font-size: var(--step--1); color: var(--muted); margin: .35rem 0 0; }

/* ---------------------------------------------------------------------
   Catalog
   --------------------------------------------------------------------- */
.catalog-intro { padding-top: 3.5rem; padding-bottom: 2rem; }

.hero-title {
    font-size: var(--step-4); color: var(--ink); max-width: 20ch;
    margin: 0 0 1rem; letter-spacing: -0.025em; line-height: 1.05;
}
.hero-lede { font-size: var(--step-1); color: var(--muted); margin: 0 0 2rem; max-width: 50ch; }

.search { display: flex; gap: .5rem; max-width: 560px; margin-bottom: 1.5rem; }
.search input {
    flex: 1; min-width: 0; font: inherit; padding: .6rem .9rem;
    border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--surface);
}
.search input:focus { border-color: var(--ink); outline: none; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
    text-decoration: none; font-size: var(--step--1); font-weight: 500;
    padding: .3rem .9rem; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface); color: var(--text);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.result-count { color: var(--muted); margin: 0 0 1rem; }

.course-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.course-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.course-card:hover { border-color: var(--ink); }
.course-link { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.course-link:hover { color: inherit; }
.course-body { padding: 1rem 1.1rem .75rem; flex: 1; }
.course-cat { font-size: var(--step--1); color: var(--muted); margin: 0 0 .25rem; }
.course-title { font-size: var(--step-1); color: var(--ink); margin: 0 0 .35rem; }
.course-instructor { font-size: var(--step--1); color: var(--muted); margin: 0; }
.course-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: var(--step--1); color: var(--muted); margin: .75rem 0 0; }
.price { font-weight: 700; color: var(--text); margin-left: auto; }
.price.is-free { color: var(--leaf); }
.course-card .thread { margin: 0 1.1rem; }
.course-card .thread-label { padding: 0 1.1rem 1rem; }

/* Course covers — image, or typographic cover built from the title */
.cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.cover-type {
    position: relative; display: flex; align-items: flex-end;
    padding: 1.1rem 1.1rem 1.1rem 1.5rem; overflow: hidden;
    background: var(--ink); color: #fff;
}
.cover-type::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--marigold);
}
.cover-words {
    font-weight: 800; font-size: 1.55rem; line-height: 1.05; letter-spacing: -0.02em;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-v2 { background: #1F4D3A; }
.cover-v3 { background: #4A2B4E; }
.cover-v4 { background: #1D4757; }
.cover-aside .cover-words { font-size: 1.8rem; }
.cover-thumb { width: 132px; flex: none; border-radius: var(--radius-small); }
.cover-thumb.cover-type { padding: .6rem .6rem .6rem .9rem; }
.cover-thumb.cover-type::before { width: 4px; }
.cover-thumb .cover-words { font-size: .8rem; -webkit-line-clamp: 3; }

/* ---------------------------------------------------------------------
   Course landing page
   --------------------------------------------------------------------- */
.course-page {
    display: grid; column-gap: 2.5rem; padding-top: 2.5rem;
    grid-template-columns: minmax(0, 1fr) 340px; align-items: start;
    grid-template-areas: "head aside" "details aside";
}
.course-head { grid-area: head; min-width: 0; }
.course-details { grid-area: details; min-width: 0; }
.course-aside { grid-area: aside; }

.facts { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin: 0 0 2rem; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { min-width: 0; }
.facts dt { font-size: var(--step--1); color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 2rem; }
.panel h2, .prose h2, .curriculum h2 { font-size: var(--step-2); color: var(--ink); margin: 0 0 1rem; }
.learn-points ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .6rem 2rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.learn-points li { position: relative; padding-left: 1.6rem; }
.learn-points li::before {
    content: ""; position: absolute; left: 0; top: .45em; width: .7rem; height: .4rem;
    border-left: 2px solid var(--leaf); border-bottom: 2px solid var(--leaf); transform: rotate(-45deg);
}

.prose { max-width: 68ch; margin-bottom: 2.5rem; }
.prose p { margin: 0 0 1rem; }
.prose h3 { font-size: var(--step-1); margin: 1.5rem 0 .5rem; }
.prose pre { background: #F0F2F6; padding: 1rem; border-radius: var(--radius-small); overflow-x: auto; font-size: .9rem; }
.prose code { font-size: .92em; }

.curriculum .section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .75rem; }
.curriculum summary {
    display: flex; justify-content: space-between; gap: 1rem; cursor: pointer;
    padding: 1rem 1.25rem; font-weight: 700; list-style: none;
}
.curriculum summary::-webkit-details-marker { display: none; }
.curriculum summary::before {
    content: ""; width: .5rem; height: .5rem; flex: none; margin-top: .55rem;
    border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg);
    transition: transform .15s;
}
.curriculum details[open] summary::before { transform: rotate(45deg); }
.section-title { flex: 1; }
.section-count { font-weight: 400; color: var(--muted); font-size: var(--step--1); white-space: nowrap; }

.lesson-list { list-style: none; margin: 0; padding: 0 1.25rem 1rem; }
.lesson-row {
    display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap;
    padding: .55rem 0; border-top: 1px solid var(--line);
}
.lesson-row a, .lesson-row > span:nth-child(2) { flex: 1; min-width: 12rem; }
.lesson-type { font-size: .75rem; font-weight: 700; color: var(--muted); width: 4.2rem; flex: none; }
.lesson-time { font-size: var(--step--1); color: var(--muted); }
.done-mark {
    width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--leaf); position: relative; flex: none; align-self: center;
}
.done-mark::after {
    content: ""; position: absolute; left: .32rem; top: .22rem; width: .3rem; height: .52rem;
    border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg);
}

.course-aside { position: sticky; top: 1.5rem; }
.enroll-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.enroll-inner { padding: 1.25rem; }
.enroll-price { font-size: var(--step-3); font-weight: 800; margin: 0 0 1rem; color: var(--text); }
.enroll-price.is-free { color: var(--leaf); }
.enroll-status { font-weight: 700; color: var(--leaf); margin: 0 0 .75rem; }
.enroll-box .thread-label { margin-bottom: 1rem; }
.enroll-note { font-size: var(--step--1); color: var(--muted); margin: .5rem 0 0; text-align: center; }
.includes { margin: 1.25rem 0 0; padding: 1rem 0 0; border-top: 1px solid var(--line); list-style: none; font-size: var(--step--1); color: var(--muted); display: grid; gap: .4rem; }

@media (max-width: 900px) {
    /* Phones: title, then the enroll box, then the details */
    .course-page { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "aside" "details"; }
    .course-aside { position: static; margin-bottom: 2rem; }
    .course-aside .cover { display: none; }
}

/* ---------------------------------------------------------------------
   Forms & auth
   --------------------------------------------------------------------- */
.auth { padding-top: 3rem; display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; }
.auth-alt { font-size: var(--step--1); color: var(--muted); margin: 1rem 0 0; text-align: center; }

.form { display: grid; gap: 1.1rem; }
.field label { display: block; font-weight: 700; margin-bottom: .3rem; }
.optional { font-weight: 400; color: var(--muted); }
.field input {
    width: 100%; font: inherit; padding: .6rem .8rem;
    border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--surface);
}
.field input:focus { border-color: var(--ink); outline: none; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: var(--step--1); margin: .35rem 0 0; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: .7rem 1rem; border-radius: var(--radius-small); margin: 0 0 1rem; }

/* ---------------------------------------------------------------------
   Dashboard
   --------------------------------------------------------------------- */
.dashboard { padding-top: 2.5rem; }
.my-courses { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.my-course {
    display: flex; align-items: center; gap: 1.25rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem;
}
.my-course-body { flex: 1; min-width: 0; }
.my-course-title { font-size: var(--step-1); margin: 0 0 .2rem; }
.my-course-title a { text-decoration: none; color: var(--ink); }
.my-course .course-instructor { margin-bottom: .6rem; }
.my-course .thread { max-width: 360px; }

@media (max-width: 600px) {
    .my-course { flex-wrap: wrap; }
    .my-course .cover-thumb { width: 96px; }
    .my-course > .btn { width: 100%; }
}

.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.data-table th, .data-table td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th { color: var(--muted); font-weight: 500; }
.data-table tr:last-child td { border-bottom: 0; }
.status { font-weight: 700; }
.status-published { color: var(--leaf); }
.status-draft { color: var(--marigold); }
.status-archived { color: var(--muted); }

/* ---------------------------------------------------------------------
   Lesson player
   --------------------------------------------------------------------- */
body.is-player { background: var(--surface); }
body.is-player main { padding-bottom: 0; }
body.is-player .site-footer { display: none; }

.player-bar {
    display: flex; align-items: center; gap: 1.25rem;
    background: var(--ink); color: #fff; padding: .6rem 1.25rem; min-height: 52px;
}
.player-back { color: #fff; font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.player-back::before { content: "‹ "; }
.player-back:hover { color: var(--marigold); }
.player-progress { display: flex; align-items: center; gap: .75rem; margin-left: auto; flex: none; }
.player-progress .thread { width: 140px; }
.player-progress-label { font-size: var(--step--1); color: rgba(255,255,255,.8); white-space: nowrap; }
.outline-toggle { display: none; }

.player-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: calc(100vh - 116px); }

.outline { border-right: 1px solid var(--line); background: var(--paper); overflow-y: auto; max-height: calc(100vh - 116px); position: sticky; top: 0; }
.outline-section { padding: 1rem 0 .5rem; border-bottom: 1px solid var(--line); }
.outline-section-title { font-weight: 800; font-size: var(--step--1); color: var(--ink); margin: 0 1rem .4rem; }
.outline ol { list-style: none; margin: 0; padding: 0; }
.outline-link {
    display: grid; grid-template-columns: 1.1rem 1fr; column-gap: .6rem;
    padding: .5rem 1rem; text-decoration: none; color: var(--text); font-size: var(--step--1); line-height: 1.35;
    border-left: 3px solid transparent;
}
.outline-link:hover { background: #ECEFF4; color: var(--ink); }
.outline-link.is-current { background: var(--surface); border-left-color: var(--marigold); font-weight: 700; color: var(--ink); }
.outline-check { grid-row: span 2; width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid #B9C0CD; margin-top: .1rem; position: relative; }
.outline-link.is-done .outline-check { background: var(--leaf); border-color: var(--leaf); }
.outline-link.is-done .outline-check::after {
    content: ""; position: absolute; left: .26rem; top: .1rem; width: .25rem; height: .5rem;
    border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg);
}
.outline-type { font-size: .75rem; color: var(--muted); font-weight: 400; }

.lesson { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 3rem; min-width: 0; }
.lesson-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.lesson-title { font-size: var(--step-2); color: var(--ink); }
.lesson-status { margin: 0; font-size: var(--step--1); font-weight: 700; color: var(--leaf); background: var(--leaf-soft); padding: .1rem .6rem; border-radius: 4px; }
.lesson-status[hidden] { display: none; }
.lesson-text { max-width: 72ch; }
.lesson-complete { margin-top: 1.5rem; }
.lesson-hint { margin-top: 1rem; }
.lesson-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.lesson-nav .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.video-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

@media (max-width: 860px) {
    .player-layout { grid-template-columns: 1fr; }
    .outline {
        display: none; position: static; max-height: 60vh; border-right: 0; border-bottom: 1px solid var(--line);
    }
    .outline.is-open { display: block; }
    .outline-toggle {
        display: inline-block; font: inherit; font-size: var(--step--1); font-weight: 700;
        background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4);
        border-radius: var(--radius-small); padding: .3rem .8rem; cursor: pointer; flex: none;
    }
    .player-progress .thread { width: 70px; }
    .player-progress { margin-left: auto; }
}
@media (max-width: 480px) {
    .player-progress-label { display: none; }
}

/* ---------------------------------------------------------------------
   PDF slide viewer
   --------------------------------------------------------------------- */
.pdf-viewer { background: #2A2F3B; border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.pdf-toolbar {
    display: flex; align-items: center; gap: .4rem; padding: .5rem .75rem;
    background: #20242E; color: #fff;
}
.pdf-btn {
    font: inherit; font-size: 1.25rem; line-height: 1; min-width: 40px; height: 36px;
    background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: var(--radius-small);
    cursor: pointer;
}
.pdf-btn:hover { background: rgba(255,255,255,.1); }
.pdf-btn:disabled { opacity: .35; cursor: default; }
.pdf-btn-text { font-size: var(--step--1); padding: 0 .8rem; }
.pdf-page { font-size: var(--step--1); padding: 0 .5rem; white-space: nowrap; }
.pdf-spacer { flex: 1; }

.pdf-stage {
    position: relative; overflow: auto; padding: 1.25rem; min-height: 240px;
    display: flex; justify-content: center; align-items: flex-start;
    touch-action: pan-y pinch-zoom;
}
.pdf-stage:focus-visible { outline-offset: -3px; }
.pdf-sheet { position: relative; box-shadow: 0 6px 30px rgba(0,0,0,.35); background: #fff; line-height: 0; }
.pdf-sheet canvas { display: block; max-width: none; }
.pdf-loading { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: rgba(255,255,255,.85); }
.pdf-loading[hidden] { display: none; }

.pdf-pagebar { height: 4px; background: rgba(255,255,255,.12); }
.pdf-pagebar span { display: block; height: 100%; width: 0; background: var(--marigold); transition: width .25s ease; }

.pdf-viewer:fullscreen { border-radius: 0; }
.pdf-viewer:fullscreen .pdf-stage { flex: 1; min-height: 0; }

@media (max-width: 600px) {
    .pdf-stage { padding: .5rem; min-height: 200px; }
    .pdf-btn-text { display: none; }
    .lesson { padding-left: .75rem; padding-right: .75rem; }
}

/* ---------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* =====================================================================
   Phase 2: quiz, certificates, notes, read aloud, instructor pages
   ===================================================================== */
.wrap.narrow { max-width: 820px; padding-top: 2.5rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 .5rem; }
.mt-s { margin-top: .6rem; }
.danger-link { color: var(--danger); font-size: var(--step--1); }
.row-links { display: flex; gap: 1rem; }
.manage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.manage-head .section-heading { margin: 2.5rem 0 1rem; }
.status-failed { color: var(--danger); }

/* Quiz */
.rules { margin: 0 0 1.5rem; padding-left: 1.2rem; display: grid; gap: .35rem; }
.result-pass { border-left: 6px solid var(--leaf); }
.result-fail { border-left: 6px solid var(--marigold); }
.result-pass h2, .result-fail h2 { font-size: var(--step-2); margin-bottom: .5rem; }
.result-score { font-size: var(--step-4); font-weight: 800; color: var(--ink); margin: 0; line-height: 1; }
.result-title { font-size: var(--step-2); color: var(--ink); margin: .5rem 0; }

.quiz-bar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem;
    background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 0 0 var(--radius) var(--radius); margin-bottom: 1.25rem;
}
.quiz-bar-title { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quiz-answered { font-size: var(--step--1); color: rgba(255,255,255,.8); white-space: nowrap; }
.quiz-timer { font-weight: 800; font-size: var(--step-1); font-variant-numeric: tabular-nums; background: rgba(255,255,255,.12); padding: .1rem .7rem; border-radius: var(--radius-small); }
.quiz-timer.is-low { background: var(--danger); }
.quiz-warning { background: var(--danger-soft); color: var(--danger); padding: .7rem 1rem; border-radius: var(--radius-small); margin: 0 0 1rem; }
.quiz-warning[hidden] { display: none; }

.question-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.question { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.question fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.question legend, .q-text { font-weight: 700; margin: 0 0 .75rem; padding: 0; }
.q-num { color: var(--muted); margin-right: .25rem; }
.option {
    display: flex; gap: .7rem; align-items: flex-start; padding: .6rem .75rem; margin-top: .4rem;
    border: 1px solid var(--line); border-radius: var(--radius-small); cursor: pointer;
}
.option:hover { border-color: var(--ink); }
.option input { margin-top: .35rem; accent-color: var(--ink); flex: none; }
.option:has(input:checked) { border-color: var(--ink); background: #EEF1F8; }
.quiz-submit { margin: 1.5rem 0 3rem; }

.review .question.is-right { border-left: 4px solid var(--leaf); }
.review .question.is-wrong { border-left: 4px solid var(--danger); }
.review-options { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.review-options li { padding: .45rem .7rem; border-radius: var(--radius-small); background: var(--paper); display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; }
.review-options li.opt-correct { background: var(--leaf-soft); font-weight: 700; }
.review-options li.opt-wrong { background: var(--danger-soft); }
.opt-label { font-size: .75rem; font-weight: 700; color: var(--muted); }
.explanation { margin: .75rem 0 0; font-size: var(--step--1); color: var(--muted); border-left: 3px solid var(--marigold); padding-left: .75rem; }
.question form { margin-top: .6rem; }

/* Verification */
.verify-badge { font-size: var(--step-1); font-weight: 800; color: var(--ink); margin: 0 0 1rem; }
.result-pass .verify-badge { color: var(--leaf); }
.verify-list { display: grid; gap: .75rem 2rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin: 0; }
.verify-list dt { font-size: var(--step--1); color: var(--muted); }
.verify-list dd { margin: 0; font-weight: 700; }
.verify-page .search { margin-top: 1.5rem; }

/* Dashboard actions */
.my-course-actions { display: flex; flex-direction: column; gap: .5rem; flex: none; }
@media (max-width: 600px) { .my-course-actions { width: 100%; } .my-course-actions .btn { width: 100%; } }

/* Notes panel (lesson page) */
.notes-panel { margin-top: 1.5rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.notes-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.notes-head h2 { font-size: var(--step-1); color: var(--ink); }
.notes-page { font-weight: 700; font-size: var(--step--1); color: var(--ink); background: var(--marigold-soft); padding: 0 .5rem; border-radius: 4px; }
.notes-status { font-size: var(--step--1); color: var(--muted); margin-left: auto; }
.notes-panel textarea {
    width: 100%; font: inherit; padding: .6rem .8rem; resize: vertical; min-height: 5rem;
    border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--surface);
}
.notes-panel textarea:focus { border-color: var(--ink); outline: none; }
.notes-mini { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .35rem; }
.notes-mini-item {
    width: 100%; text-align: left; font: inherit; font-size: var(--step--1); display: flex; gap: .75rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-small); padding: .45rem .7rem; cursor: pointer;
}
.notes-mini-item:hover, .notes-mini-item.is-current { border-color: var(--ink); }
.notes-mini-page { font-weight: 700; color: var(--ink); white-space: nowrap; }
.notes-mini-text { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.pdf-btn.is-on { color: var(--marigold); border-color: var(--marigold); }
.read-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
    background: #181C25; color: rgba(255,255,255,.85); padding: .45rem .9rem; font-size: var(--step--1);
}
.read-bar[hidden] { display: none; }
.read-status { flex: 1; min-width: 12rem; }
.read-bar select { font: inherit; font-size: var(--step--1); padding: .1rem .3rem; border-radius: 4px; margin-left: .3rem; }
.read-bar input { accent-color: var(--marigold); }

/* My notes page */
.notes-course { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.notes-course-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.notes-course-head h2 { font-size: var(--step-1); color: var(--ink); }
.notes-section { font-size: var(--step-0); color: var(--ink); margin: 1.25rem 0 .25rem; }
.notes-lesson { font-weight: 700; margin: .75rem 0 .35rem; color: var(--muted); font-size: var(--step--1); }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.note-list li { border-left: 3px solid var(--marigold); padding-left: .75rem; }
.note-page { font-weight: 700; font-size: var(--step--1); }
.note-text { margin: .15rem 0 0; }

/* Printable notes → Save as PDF */
.print-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.notes-doc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; margin: 1rem 0 3rem; }
.notes-doc-head { border-bottom: 3px solid var(--marigold); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.notes-doc-site { font-weight: 800; color: var(--ink); text-transform: uppercase; letter-spacing: .04em; font-size: var(--step--1); margin: 0; }
.notes-doc h1 { font-size: var(--step-3); color: var(--ink); margin: .25rem 0 .5rem; }
.notes-doc-meta { color: var(--muted); margin: 0; }
.notes-doc h2 { font-size: var(--step-2); color: var(--ink); margin: 2rem 0 .5rem; }
.notes-doc h3 { font-size: var(--step-1); margin: 1.25rem 0 .5rem; }
.notes-doc-note { border-left: 3px solid var(--line); padding: .1rem 0 .1rem .9rem; margin-bottom: .9rem; break-inside: avoid; }
.notes-doc-note p { margin: .2rem 0; }
.notes-doc-page { font-weight: 700; font-size: var(--step--1); color: var(--muted); }
.notes-doc-star { color: #A86F00; margin-left: .5rem; }

@media print {
    @page { size: A4; margin: 16mm 14mm; }
    body { background: #fff; }
    .site-header, .site-footer, .flash-stack, .no-print, .skip-link { display: none !important; }
    main { padding: 0; }
    .wrap.narrow { max-width: none; padding: 0; }
    .notes-doc { border: 0; padding: 0; margin: 0; border-radius: 0; }
    .notes-doc h2, .notes-doc h3 { break-after: avoid; }
    a { color: inherit; text-decoration: none; }
}

/* Instructor pages */
.signature-preview { max-width: 260px; max-height: 90px; background: #fff; border: 1px dashed var(--line); padding: .5rem; margin-bottom: .75rem; border-radius: var(--radius-small); }
.steps-mini { margin: 0 0 1.25rem; padding-left: 1.2rem; display: grid; gap: .35rem; }
.radio-row { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.radio-row input { accent-color: var(--ink); }
.settings-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-items: end; }
.field textarea, .field select { width: 100%; font: inherit; }
.form input[type=file] { font: inherit; font-size: var(--step--1); }

/* Study time on the lesson page */
.study-time { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: -.5rem 0 1.25rem; font-size: var(--step--1); }
.study-time-text { display: flex; gap: .5rem; align-items: baseline; }
.study-time-label { font-weight: 700; color: var(--ink); }
#study-time-value { color: var(--muted); font-variant-numeric: tabular-nums; }
.study-time .thread { flex: 1; min-width: 120px; max-width: 280px; }
.study-time .thread[hidden] { display: none; }
.study-time.is-met .thread > span { background: var(--leaf); }

/* Study timer inside the PDF toolbar (visible in full screen too) */
.pdf-time {
    display: inline-flex; align-items: center; gap: .35rem; margin-left: .5rem;
    font-size: var(--step--1); font-variant-numeric: tabular-nums; white-space: nowrap;
    padding: .15rem .6rem; border-radius: var(--radius-small);
    background: rgba(255,255,255,.08); color: rgba(255,255,255,.9);
}
.pdf-time.is-met { background: rgba(47,122,87,.35); color: #fff; }
.pdf-time-icon { font-size: .95em; }
@media (max-width: 600px) { .pdf-time { margin-left: .25rem; padding: .1rem .45rem; } .pdf-time-icon { display: none; } }

/* Study-time chip in the top bar, which stays pinned while scrolling */
.player-bar { position: sticky; top: 0; z-index: 30; }
.outline { top: 52px; max-height: calc(100vh - 52px); }
.time-chip {
    display: inline-flex; align-items: center; gap: .3rem; flex: none; margin-left: auto;
    font-size: var(--step--1); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
    background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; padding: .15rem .7rem;
}
.time-chip.is-met { background: var(--leaf); }
.player-bar .time-chip + .player-progress { margin-left: 0; }
@media (max-width: 860px) {
    .outline { max-height: 60vh; }
    .player-bar { gap: .6rem; padding-left: .75rem; padding-right: .75rem; }
    .player-bar .player-progress { display: none; }
}

/* =====================================================================
   Strict quiz: one question at a time, question panel, overlay
   ===================================================================== */
body.is-quiz { background: var(--paper); -webkit-user-select: none; user-select: none; }
body.is-quiz .site-header, body.is-quiz .site-footer, body.is-quiz .flash-stack { display: none; }
body.is-quiz main { padding-bottom: 0; }
.quiz-exam { max-width: 1180px; margin: 0 auto; padding: 0 1rem 2rem; }
.quiz-exam .quiz-bar { border-radius: 0 0 var(--radius) var(--radius); }
.quiz-warn-count { font-size: var(--step--1); font-weight: 700; background: rgba(255,255,255,.12); padding: .1rem .6rem; border-radius: 999px; white-space: nowrap; }
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 1.25rem; align-items: start; }
.quiz-main { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; min-height: 360px; display: flex; flex-direction: column; }
.exam-q { border: 0; margin: 0; padding: 0; min-width: 0; flex: 1; }
.exam-q[hidden] { display: none; }
.exam-q legend { padding: 0; margin-bottom: 1rem; }
.exam-q-num { display: block; font-size: var(--step--1); font-weight: 700; color: var(--muted); margin-bottom: .4rem; }
.exam-q-text { display: block; font-size: var(--step-1); font-weight: 700; color: var(--text); line-height: 1.4; }
.exam-q .option { padding: .8rem 1rem; }
.exam-nav { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.exam-nav #q-next { margin-left: auto; }
.exam-nav .btn { font-size: var(--step--1); padding: .5rem 1rem; }

.quiz-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; position: sticky; top: 4.5rem; }
.quiz-panel-title { font-weight: 800; color: var(--ink); margin: 0 0 .6rem; }
.palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.pal {
    font: inherit; font-weight: 700; font-size: var(--step--1); aspect-ratio: 1; min-width: 0;
    border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--paper); color: var(--text); cursor: pointer;
}
.pal.is-answered { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.pal.is-marked { background: var(--marigold); border-color: var(--marigold); color: var(--text); }
.pal.is-answered.is-marked { background: var(--marigold); box-shadow: inset 0 -4px 0 var(--leaf); }
.pal.is-current { outline: 3px solid var(--ink); outline-offset: 1px; }
.pal-legend { list-style: none; margin: 1rem 0 .5rem; padding: 0; display: grid; gap: .3rem; font-size: .8rem; color: var(--muted); }
.pal-legend li { display: flex; align-items: center; gap: .5rem; }
.pal-demo { width: 1rem; height: 1rem; aspect-ratio: auto; padding: 0; cursor: default; display: inline-block; border-width: 2px; border-style: solid; }
.quiz-panel .quiz-answered { color: var(--muted); font-size: var(--step--1); margin: .5rem 0 .75rem; }

.quiz-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15,20,35,.82); display: grid; place-items: center; padding: 1rem; }
.quiz-overlay[hidden] { display: none; }
.quiz-overlay-box { background: var(--surface); border-radius: var(--radius); padding: 1.75rem; max-width: 480px; width: 100%; display: flex; flex-direction: column; gap: .75rem; }
.quiz-overlay-title { font-size: var(--step-2); font-weight: 800; color: var(--ink); margin: 0; }
.quiz-overlay-box p { margin: 0; }
.quiz-overlay-box .btn { width: 100%; }

@media (max-width: 860px) {
    .quiz-layout { grid-template-columns: 1fr; }
    .quiz-panel { position: static; }
    .palette { grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr)); }
    .pal-legend { grid-template-columns: 1fr 1fr; }
    .quiz-main { padding: 1.1rem; min-height: 0; }
    .exam-nav #q-next { margin-left: 0; }
    .exam-nav .btn { flex: 1 1 45%; }
}
@media print { body.is-quiz * { display: none !important; } }

.field-wide { grid-column: 1 / -1; }
.field select { padding: .55rem .7rem; border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--surface); }

/* =====================================================================
   Phase 3: instructor and admin panel
   ===================================================================== */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); margin: 0 0 1.5rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); font-weight: 700; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--marigold); }

.manage-page { padding-top: 2.5rem; }
.manage-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .9rem; }
.manage-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; display: flex; flex-wrap: wrap; gap: .75rem 2rem; align-items: center; }
.manage-card-main { flex: 1; min-width: 240px; }
.manage-card-meta { margin: 0 0 .2rem; font-size: var(--step--1); color: var(--muted); }
.manage-card-title { font-size: var(--step-1); color: var(--ink); margin: 0 0 .25rem; }
.manage-card-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: var(--step--1); font-weight: 700; }

.unit-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem 1.1rem; margin-bottom: 1rem; }
.unit-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.unit-rename { display: flex; gap: .5rem; flex: 1; min-width: 240px; }
.unit-rename input { flex: 1; min-width: 0; font: inherit; font-weight: 800; color: var(--ink); padding: .35rem .6rem; border: 2px solid transparent; border-radius: var(--radius-small); background: var(--paper); }
.unit-rename input:focus { border-color: var(--ink); outline: none; background: var(--surface); }
.unit-empty { margin: .25rem 0 .75rem; }
.row-tools { display: flex; gap: .3rem; align-items: center; }
.row-tools form { margin: 0; }
.icon-btn {
    display: inline-grid; place-items: center; width: 2rem; height: 2rem; font: inherit; font-size: .95rem; text-decoration: none;
    border: 1px solid var(--line); border-radius: var(--radius-small); background: var(--surface); color: var(--ink); cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { border-color: var(--danger); }
.lesson-admin-list { list-style: none; margin: 0 0 .9rem; padding: 0; }
.lesson-admin { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lesson-admin-main { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.lesson-admin-title { font-weight: 700; text-decoration: none; }
.add-lesson { margin-top: .25rem; }
.add-unit { display: grid; gap: .5rem; }

.slug-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.slug-row input { flex: 1; min-width: 180px; }
.slug-row .hint { margin: 0; }
.add-unit .slug-row input, .unit-rename input { width: auto; }
.add-unit input { font: inherit; padding: .55rem .8rem; border: 2px solid var(--line); border-radius: var(--radius-small); }

.type-picker { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; }
.type-picker legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
.type-option { display: flex; gap: .6rem; align-items: flex-start; border: 2px solid var(--line); border-radius: var(--radius-small); padding: .7rem .8rem; cursor: pointer; }
.type-option:has(input:checked) { border-color: var(--ink); background: #EEF1F8; }
.type-option input { margin-top: .3rem; accent-color: var(--ink); }
.type-option > span { display: flex; flex-direction: column; }
.type-option .hint { margin: 0; }
[data-for][hidden] { display: none; }
.field textarea { padding: .6rem .8rem; border: 2px solid var(--line); border-radius: var(--radius-small); resize: vertical; }
.field textarea:focus, .field select:focus { border-color: var(--ink); outline: none; }
.check-line { display: flex; gap: .55rem; align-items: flex-start; }
.check-line input { margin-top: .35rem; accent-color: var(--ink); }
.cover-preview { max-width: 320px; border-radius: var(--radius-small); border: 1px solid var(--line); margin-bottom: .5rem; }
.advanced { border: 1px dashed var(--line); border-radius: var(--radius-small); padding: .6rem .9rem; }
.advanced summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.advanced[open] summary { margin-bottom: .75rem; }
.advanced .field { margin-bottom: .75rem; }

.password-box { border-left: 6px solid var(--marigold); }
.password-box p { margin: 0 0 .4rem; }
.temp-password { font-family: ui-monospace, Consolas, monospace; font-size: var(--step-2); font-weight: 700; color: var(--ink); letter-spacing: .02em; -webkit-user-select: all; user-select: all; }
.search select { font: inherit; padding: .55rem .6rem; border: 2px solid var(--line); border-radius: var(--radius-small); background: var(--surface); }
.inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.inline-form select, .inline-form input { font: inherit; font-size: var(--step--1); padding: .3rem .45rem; border: 1px solid var(--line); border-radius: var(--radius-small); }
.designation-input { width: 11rem; }
.users-table td { white-space: normal; vertical-align: top; }
.users-table .row-links { flex-direction: column; gap: .3rem; }
.users-table .row-links form { margin: 0; }
tr.is-blocked td { opacity: .65; }

/* Video progress under the player */
.video-progress { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .75rem; }
.video-progress[hidden] { display: none; }
.video-progress .thread { flex: 1; min-width: 140px; max-width: 320px; }
.video-progress .hint { margin: 0; }

/* Unit quizzes and locked units */
.outline-section.is-locked .outline-section-title { color: var(--muted); }
.outline-lock-note { margin: 0 1rem .4rem; font-size: .78rem; color: var(--muted); }
.outline-link.is-locked { opacity: .55; cursor: not-allowed; }
.outline-link.is-locked:hover { background: transparent; color: var(--text); }
.outline-quiz .outline-title { font-weight: 700; }
.pending-units { text-align: left; display: inline-block; margin: 0 0 1rem; }
.unit-quiz-table td, .unit-quiz-table th { white-space: nowrap; }
.unit-quiz-table input { width: 5rem; font: inherit; padding: .3rem .45rem; border: 1px solid var(--line); border-radius: var(--radius-small); }
.unit-tag { font-size: .75rem; font-weight: 700; color: var(--ink); background: var(--marigold-soft); border-radius: 4px; padding: .05rem .45rem; }
.unit-select { font: inherit; font-size: var(--step--1); padding: .2rem .35rem; border: 1px solid var(--line); border-radius: var(--radius-small); max-width: 14rem; }
.q-tools { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; margin-top: .6rem; }
.q-tools form { margin: 0; display: flex; gap: .4rem; align-items: center; }
.unit-results { font-size: var(--step--1); white-space: nowrap; }
.grant-form { display: flex; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.how-quizzes ul { margin: .25rem 0 .5rem; padding-left: 1.2rem; display: grid; gap: .35rem; }
.how-quizzes p { margin: 0; }

/* Delete course */
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8E1D17; border-color: #8E1D17; color: #fff; }
.danger-panel { border-left: 6px solid var(--danger); }
.danger-title { font-weight: 700; color: var(--danger); margin: 0 0 1rem; }
.delete-summary { max-width: 360px; margin-bottom: .75rem; }
.delete-summary th { color: var(--text); font-weight: 500; }
.delete-summary tr.is-important td, .delete-summary tr.is-important th { color: var(--danger); font-weight: 700; }
.danger-zone { margin-top: 2rem; }
.danger-zone p { margin: 0 0 .5rem; }

/* =====================================================================
   Phase 4: reports
   ===================================================================== */
.report-page { padding-top: 2rem; }
.report-page .panel h2 { font-size: var(--step-1); color: var(--ink); margin: 0 0 .5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin: 1.25rem 0 1.5rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .2rem; }
.stat-num { font-size: var(--step-2); font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat-label { font-size: var(--step--1); color: var(--muted); }
.stat-good { border-left: 5px solid var(--leaf); }
.bars { display: flex; align-items: flex-end; gap: .5rem; height: 160px; padding-top: 1.2rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar { width: 100%; max-width: 44px; background: var(--marigold); border-radius: 4px 4px 0 0; }
.bar-n { font-size: .75rem; font-weight: 700; color: var(--ink); margin-bottom: .2rem; }
.bar-label { font-size: .7rem; color: var(--muted); margin-top: .3rem; white-space: nowrap; }
.meter-cell { width: 30%; min-width: 120px; }
.meter { display: block; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ink); }
.q-cell { white-space: normal !important; min-width: 260px; }
.report-table td { white-space: normal; }
@media print {
    .report-page .panel { break-inside: avoid; border: 1px solid #ccc; }
    .report-page .table-scroll { overflow: visible; }
    .report-page .data-table th, .report-page .data-table td { white-space: normal; font-size: 10pt; padding: .3rem .5rem; }
    .bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .meter > span, .meter { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
