:root {
    --brand-primary: #1a3c34;
    --brand-primary-dark: #12281f;
    --brand-accent: #c9982f;
    --bg: #f6f5f2;
    --card-bg: #ffffff;
    --text: #1f2724;
    --muted: #6b7570;
    --border: #e3e1db;
    --sidebar-width: 248px;
    --bottom-nav-height: 60px;

    --success: #2f9e64;
    --success-bg: #e8f3ec;
    --warning: #d6a13a;
    --warning-bg: #fbf1de;
    --danger: #c9564f;
    --danger-bg: #fbe7e7;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(26,40,31,0.06);
    --shadow-md: 0 6px 18px rgba(26,40,31,0.08);
    --shadow-lg: 0 16px 40px rgba(26,40,31,0.14);

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Fraunces', Georgia, 'Iowan Old Style', serif;
    color: var(--brand-primary);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h1 { margin-top: 0; font-size: 1.85rem; }
h2 { font-size: 1.2rem; }

.icon { display: inline-block; vertical-align: -4px; flex-shrink: 0; }


/* ---------- Sidebar ---------- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--brand-primary);
    background-image: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
    color: #eef1ef;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.sidebar-brand {
    padding: 1.5rem 1.3rem 1.1rem;
}
.sidebar-logo { max-height: 34px; max-width: 100%; object-fit: contain; }

.sidebar-nav {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.5rem 0.9rem;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #cfe0d8;
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    border-left: 3px solid transparent;
    transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease);
}
.sidebar-nav a .icon { opacity: 0.85; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.07); color: #fff; transform: translateX(2px); }
.sidebar-nav a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-left-color: var(--brand-accent);
    font-weight: 600;
}
.sidebar-nav a.active .icon { opacity: 1; color: var(--brand-accent); }

.sidebar-group-label {
    margin: 1.1rem 0 0.2rem;
    padding: 0 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.4);
}

.sidebar-footer {
    padding: 1rem 1.3rem 1.3rem;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.sidebar-user { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.75rem; }
.sidebar-avatar {
    width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 50%;
    background: var(--brand-accent);
    color: #2a2110;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.85rem;
}
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-name { color: #fff; font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,0.5); font-size: 0.78rem; text-transform: capitalize; }
.sidebar-logout {
    display: flex; align-items: center; gap: 0.5rem;
    color: var(--brand-accent); text-decoration: none; font-size: 0.85rem; font-weight: 600;
}
.sidebar-logout:hover { text-decoration: underline; }

.sidebar-overlay { display: none; }

.sidebar-toggle-checkbox { display: none; }
.sidebar-toggle-btn {
    display: none;
    position: fixed;
    top: 0.9rem;
    left: 1rem;
    z-index: 30;
    width: 42px;
    height: 42px;
    background: var(--brand-primary);
    color: #fff;
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.page-with-sidebar {
    margin-left: var(--sidebar-width);
}

/* ---------- Bottom nav (mobile) ---------- */

.bottom-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--bottom-nav-height);
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.06);
    z-index: 25;
    align-items: stretch;
}
.bottom-nav a, .bottom-nav-more {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    cursor: pointer;
}
.bottom-nav a.active { color: var(--brand-primary); }
.bottom-nav a.active .icon { color: var(--brand-primary); }


/* ---------- Page content ---------- */

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.75rem 3rem;
}

.muted { color: var(--muted); }

.panel {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-sm);
    animation: barb-rise 0.25s var(--ease) both;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand-accent);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-icon {
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    background: #eaf1ee;
    color: var(--brand-primary);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.6rem;
}

.stat-number { font-size: 2rem; font-weight: 700; color: var(--brand-primary); font-family: 'Fraunces', Georgia, serif; }
.stat-label { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }

.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td {
    text-align: left;
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.02em; }
.table tbody tr { transition: background 0.12s var(--ease); }
.table tbody tr:hover { background: #faf9f6; }

.audit-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.audit-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.audit-list li:last-child { border-bottom: none; }

.resource-links a { white-space: nowrap; font-size: 0.88rem; }

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(circle at top, rgba(26,60,52,0.06), transparent 60%), var(--bg);
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: barb-rise 0.3s var(--ease) both;
}

.auth-logo { height: 48px; margin-bottom: 0.75rem; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 0.1rem; }
.auth-tagline { color: var(--brand-accent); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 1.5rem; }

form label { display: block; text-align: left; font-size: 0.85rem; font-weight: 600; margin: 0.9rem 0 0.3rem; color: var(--muted); }
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form select {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: #fff;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
    font-family: inherit;
}
form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="password"]:focus,
form input[type="date"]:focus,
form select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(26,60,52,0.12);
}
form input[type="color"] { width: 60px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1.4rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-primary); color: #fff; width: 100%; margin-top: 1.5rem; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-primary-dark); box-shadow: var(--shadow-md); }

.settings-form { max-width: 480px; }
.settings-form .btn-primary { width: auto; }

.alert {
    position: relative;
    padding: 0.75rem 2.2rem 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: var(--danger-bg); color: #9b2c2c; border: 1px solid #f3c6c6; }
.alert-success { background: var(--success-bg); color: #1a3c34; border: 1px solid #c6e6d2; }
.alert-animated { animation: barb-slide-down 0.25s var(--ease) both; }
.alert-close {
    position: absolute;
    top: 0.4rem; right: 0.5rem;
    background: none; border: none;
    font-size: 1.2rem; line-height: 1;
    color: inherit; opacity: 0.5;
    cursor: pointer; padding: 0.2rem 0.4rem;
}
.alert-close:hover { opacity: 1; }

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.22rem 0.6rem;
    border-radius: var(--radius-pill);
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: #eaf1ee; color: var(--brand-primary); }

/* ---------- Empty states ---------- */

.empty-state {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--muted);
}
.empty-state .icon { color: var(--border); margin-bottom: 0.75rem; }
.empty-state p { margin: 0.2rem 0 0; }

/* ---------- Confirm modal ---------- */

.barb-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(20,28,24,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    padding: 1rem;
    animation: barb-fade-in 0.15s var(--ease) both;
}
.barb-modal-backdrop[hidden] {
    display: none;
}
.barb-modal {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    max-width: 380px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: barb-rise 0.2s var(--ease) both;
}
.barb-modal-msg { margin: 0 0 1.25rem; font-size: 0.98rem; color: var(--text); }
.barb-modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; }
.barb-modal-actions .btn { width: auto; margin: 0; }

/* ---------- Charts ---------- */

.chart-svg { width: 100%; height: auto; display: block; }
.chart-gridline { stroke: var(--border); stroke-width: 1; }
.chart-label { font-size: 9px; fill: var(--muted); font-family: -apple-system, sans-serif; }
.chart-bar { transition: opacity 0.15s var(--ease); }
.chart-bar:hover { opacity: 0.85; }
.chart-bar-high { fill: var(--success); }
.chart-bar-mid { fill: var(--warning); }
.chart-bar-low { fill: var(--danger); }

@keyframes barb-rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes barb-slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes barb-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 3rem; }

.chat-feed {
    height: 360px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    background: #fafaf8;
}
.chat-message { padding: 0.35rem 0; font-size: 0.92rem; border-bottom: 1px solid #f0efe9; }
.chat-message:last-child { border-bottom: none; }
.chat-message-system { color: var(--muted); font-size: 0.85rem; text-align: center; }
.chat-delete-btn {
    background: none; border: none; color: #9b2c2c; cursor: pointer;
    font-size: 1rem; margin-left: 0.4rem; line-height: 1;
}

.wb-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.wb-tool-group { display: flex; gap: 0.35rem; align-items: center; }
.wb-tool-btn {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    cursor: pointer;
    font-size: 1rem;
}
.wb-tool-btn.active { border-color: var(--brand-primary); background: #eaf1ee; }
#wb-undo, #wb-clear, #wb-prev-page, #wb-next-page, #wb-add-page {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    font-size: 0.85rem;
}
#wb-page-label { font-size: 0.85rem; color: var(--muted); }
.wb-canvas-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fafaf8; }
#wb-canvas { width: 100%; height: auto; display: block; touch-action: none; cursor: crosshair; }

.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

/* ---------- Mobile: sidebar becomes a toggleable drawer ---------- */

@media (max-width: 860px) {
    .sidebar-toggle-btn { display: flex; }

    .sidebar {
        width: min(var(--sidebar-width), 85vw);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    }

    .sidebar-toggle-checkbox:checked ~ .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle-checkbox:checked ~ .sidebar-toggle-btn {
        left: calc(min(var(--sidebar-width), 85vw) + 1rem);
    }

    /* Dim/tap-to-close overlay behind the open drawer. */
    .sidebar-toggle-checkbox:checked ~ .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.35);
        z-index: 15;
    }

    .page-with-sidebar {
        margin-left: 0;
        padding-top: 3.5rem;
        padding-bottom: calc(var(--bottom-nav-height) + 1rem);
    }

    .page { padding: 1.25rem 1.1rem 2rem; }

    .bottom-nav { display: flex; }

    /* Wide data tables scroll horizontally instead of forcing the whole
       page to zoom out or overflow sideways. */
    .table { display: block; overflow-x: auto; white-space: nowrap; }

    .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 1.75rem 1.25rem; }
}

/* ---------- Learning Lab ---------- */

.lab-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.lab-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.1rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.lab-card:hover { box-shadow: 0 6px 18px rgba(26,60,52,0.1); transform: translateY(-2px); }
.lab-card h3 { margin: 0.15rem 0 0; font-size: 1.05rem; }
.lab-card-type {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    width: fit-content;
    background: #eaf1ee;
    color: var(--brand-primary);
}
.lab-card-type-multiple_choice { background: #fbeedd; color: #8a5a1c; }
.lab-card-type-matching { background: #eef0fb; color: #3a3f8a; }
.lab-card-class { font-size: 0.8rem; color: var(--brand-accent); font-weight: 600; }
.lab-card-due { font-size: 0.8rem; color: #9b6b1f; }
.lab-card-score { font-size: 0.85rem; font-weight: 600; margin-top: 0.3rem; }
.lab-card-score-empty { color: var(--muted); font-weight: 400; }
.lab-score-high { color: #1a7a4c; }
.lab-score-mid { color: #8a5a1c; }
.lab-score-low { color: #9b2c2c; }

.lab-template-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.75rem; }
.lab-template-btn {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text);
}
.lab-template-btn.active, .lab-template-btn:hover { border-color: var(--brand-primary); background: #eaf1ee; }

.lab-type-badge {
    display: inline-block;
    background: #eaf1ee;
    color: var(--brand-primary);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
}

.lab-item-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem;
    margin-top: 0.6rem;
    background: #fafaf8;
}
.lab-item-row input[type="text"] { flex: 1; min-width: 120px; margin: 0; }
.lab-remove-btn {
    border: none; background: none; color: #9b2c2c; font-size: 1.2rem;
    cursor: pointer; line-height: 1; padding: 0 0.3rem;
}
.lab-mcq-row { flex-direction: column; align-items: stretch; }
.lab-mcq-question { width: 100%; }
.lab-mcq-options { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.4rem; }
.lab-mcq-option { display: flex; align-items: center; gap: 0.5rem; }
.lab-mcq-option input[type="text"] { flex: 1; margin: 0; }

.lab-trace-panel { display: flex; flex-direction: column; gap: 1rem; }
.lab-trace-stepper { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.lab-step {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    min-width: 46px;
    padding: 0.4rem 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}
.lab-step.active { border-color: var(--brand-primary); background: #eaf1ee; }
.lab-step.done { border-color: #bcdfc9; }
.lab-step-score { font-size: 0.65rem; font-weight: 600; color: #1a7a4c; }

.lab-trace-info { display: flex; align-items: center; gap: 1rem; }
.lab-trace-letter {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 3.2rem;
    color: var(--brand-primary);
    line-height: 1;
}
.lab-trace-word { font-weight: 700; font-size: 1.1rem; }

.lab-guide-toggle { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 0.4rem; }

.lab-canvas-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fafaf8; }
#lab-canvas { width: 100%; height: auto; display: block; touch-action: none; cursor: crosshair; }

.lab-trace-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.lab-finish-row { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }

.lab-feedback {
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    font-weight: 700;
    width: fit-content;
}
.lab-feedback-high { background: #e8f3ec; color: #1a7a4c; }
.lab-feedback-mid { background: #fbf1de; color: #8a5a1c; }
.lab-feedback-low { background: #fbe7e7; color: #9b2c2c; }

.lab-quiz-question { margin-bottom: 1.25rem; }
.lab-quiz-question h3 { font-size: 1rem; }
.lab-quiz-option { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0; font-size: 0.95rem; }

@media (max-width: 600px) {
    .lab-trace-letter { font-size: 2.4rem; }
    .lab-trace-info { gap: 0.6rem; }
}

/* ---------- Progress bars (Student Progress dashboard) ---------- */

.progress-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.7rem;
}
.progress-label {
    width: 140px;
    flex-shrink: 0;
    font-size: 0.9rem;
    text-transform: capitalize;
}
.progress-track {
    flex: 1;
    background: #eceae3;
    border-radius: 20px;
    height: 10px;
    overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 20px; }
.progress-fill-high { background: #2f9e64; }
.progress-fill-mid { background: #d6a13a; }
.progress-fill-low { background: #c9564f; }
.progress-value { width: 44px; text-align: right; font-weight: 600; font-size: 0.9rem; }

/* ---------- Scheduling: weekday picker + calendar ---------- */

.weekday-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.4rem; }
.weekday-chip {
    display: flex; align-items: center; gap: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}
.weekday-chip:has(input:checked) { background: #eaf1ee; border-color: var(--brand-primary); color: var(--brand-primary); }
.weekday-chip input { margin: 0; }

.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin: 1rem 0; }
.calendar-nav a { text-decoration: none; font-weight: 600; }
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.calendar-weekday-label {
    background: #f2f1ec;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    padding: 0.5rem 0;
}
.calendar-day {
    background: #fff;
    min-height: 84px;
    padding: 0.35rem;
    font-size: 0.8rem;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.calendar-day.is-empty { background: #fafaf8; }
.calendar-day.is-today { background: #fbf6e8; }
.calendar-day-num { font-weight: 700; font-size: 0.78rem; }
.calendar-session {
    background: var(--brand-primary);
    color: #fff;
    border-radius: 5px;
    padding: 0.1rem 0.35rem;
    font-size: 0.68rem;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.calendar-session.is-live { background: var(--success); }
.calendar-session.is-cancelled { background: var(--muted); text-decoration: line-through; }

.countdown-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--brand-accent);
    background: #fbf1de;
    border-radius: var(--radius-pill);
    padding: 0.15rem 0.6rem;
}

/* ---------- Digital Classroom (live session shell) ---------- */

.page:has(.classroom-shell) { max-width: none; }

.classroom-shell { display: flex; flex-direction: column; height: calc(100vh - 4rem); min-height: 560px; }
.classroom-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.75rem; }
.classroom-top-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.classroom-tabs {
    display: flex;
    gap: 0.3rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}
.classroom-tab {
    display: flex; align-items: center; gap: 0.4rem;
    background: none; border: none;
    border-bottom: 2px solid transparent;
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.12s var(--ease), border-color 0.12s var(--ease);
}
.classroom-tab:hover { color: var(--text); }
.classroom-tab.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

.classroom-panes { flex: 1; min-height: 0; margin-top: 0.75rem; position: relative; }
.classroom-pane { display: none; height: 100%; flex-direction: column; }
.classroom-pane.active { display: flex; }

.classroom-iframe { width: 100%; height: 100%; border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; flex: 1; }

.classroom-controlbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    padding: 0.5rem 0.75rem;
}
.classroom-ctrl-btn {
    display: flex; align-items: center; gap: 0.4rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
}
.classroom-ctrl-btn:hover { border-color: var(--brand-primary); }
.classroom-ctrl-btn.active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.classroom-ctrl-btn-right { margin-left: auto; }
.classroom-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); font-size: 0.85rem; }

.classroom-hands {
    background: var(--warning-bg);
    color: #8a5a1c;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.3rem 0.9rem;
    min-height: 1.6rem;
}

.classroom-video {
    flex: 1;
    min-height: 0;
    background: #000;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
}

@media (max-width: 860px) {
    .classroom-shell { height: calc(100vh - 3.5rem - var(--bottom-nav-height)); }
    .classroom-ctrl-btn span { display: none; }
}

/* ---------- Matching activity player ---------- */

.match-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.match-column { display: flex; flex-direction: column; gap: 0.6rem; }
.match-item {
    border: 2px solid var(--border);
    background: #fff;
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.12s var(--ease), background 0.12s var(--ease), transform 0.1s var(--ease);
}
.match-item:hover { border-color: var(--brand-primary); }
.match-item.selected { border-color: var(--brand-primary); background: #eaf1ee; transform: scale(1.02); }

@media (max-width: 600px) {
    .match-columns { gap: 0.75rem; }
    .match-item { padding: 0.55rem 0.7rem; font-size: 0.88rem; }
}
