/* TANGLAW LMS — (c) 2026 RSC Softwares. All rights reserved. */
:root {
    --brand: #4f46e5;
    --brand-2: #0ea5e9;
    --brand-grad: linear-gradient(135deg, #4f46e5 0%, #0ea5e9 100%);
    --sidebar-w: 250px;
    --radius: 14px;
    --app-bg: #f4f6fb;
    --card-bg: #ffffff;
    --border: rgba(15, 23, 42, .08);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[data-bs-theme="dark"] {
    --app-bg: #0b1020;
    --card-bg: #121a2e;
    --border: rgba(255, 255, 255, .08);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --bs-body-bg: #0b1020;
    --bs-link-color-rgb: 129, 140, 248;
}
body { background: var(--app-bg); font-size: .935rem; }
.btn-primary { --bs-btn-bg: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; }
.btn-outline-primary { --bs-btn-color: #4f46e5; --bs-btn-border-color: #4f46e5; --bs-btn-hover-bg: #4f46e5; --bs-btn-hover-border-color: #4f46e5; --bs-btn-active-bg: #4f46e5; --bs-btn-active-border-color: #4f46e5; }
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #a5b4fc; --bs-btn-border-color: #6366f1; }
.text-primary { color: #4f46e5 !important; }
[data-bs-theme="dark"] .text-primary { color: #a5b4fc !important; }
.form-control:focus, .form-select:focus { border-color: #818cf8; box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15); }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); position: fixed; inset: 0 auto 0 0; z-index: 1040;
    background: var(--card-bg); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.25rem; text-decoration: none; color: inherit; font-weight: 800; letter-spacing: .5px; font-size: 1.2rem; }
.brand small { font-size: .65rem; font-weight: 700; margin-left: .3rem; padding: .1rem .4rem; border-radius: 6px; background: var(--brand-grad); color: #fff; vertical-align: middle; }
.side-nav { padding: .5rem .75rem; overflow-y: auto; flex: 1; }
.side-nav a {
    display: flex; align-items: center; gap: .7rem; padding: .58rem .8rem; margin-bottom: 2px;
    border-radius: 10px; color: var(--bs-body-color); text-decoration: none; opacity: .85;
    transition: background .15s, color .15s, opacity .15s;
}
.side-nav a i { font-size: 1.1rem; }
.side-nav a:hover { background: rgba(79, 70, 229, .07); opacity: 1; }
.side-nav a.active { background: rgba(79, 70, 229, .12); color: #4f46e5; font-weight: 600; opacity: 1; }
[data-bs-theme="dark"] .side-nav a.active { color: #a5b4fc; }
.side-label { font-size: .7rem; text-transform: uppercase; letter-spacing: 1px; opacity: .55; margin: 1.1rem .8rem .4rem; font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.side-foot { padding: 1rem 1.25rem; font-size: .75rem; opacity: .55; border-top: 1px solid var(--border); }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
    padding: .7rem 1.5rem; background: color-mix(in srgb, var(--app-bg) 85%, transparent);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.content { padding: 1.5rem; flex: 1; }
.app-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: 1rem 1.5rem; font-size: .8rem; border-top: 1px solid var(--border); }
.btn-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 0; }
.btn-icon:hover { background: rgba(79, 70, 229, .08); }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; border-radius: 30px; padding: .25rem .6rem .25rem .25rem; }
.btn-user:hover { background: rgba(79, 70, 229, .08); }
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
    .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 1030; }
    .main { margin-left: 0; }
    .content { padding: 1rem; }
    .topbar { padding: .6rem 1rem; }
}

/* Cards */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: .9rem 1.1rem; font-weight: 600; }
.stat-card { padding: 1.1rem 1.2rem; display: flex; flex-direction: row; gap: 1rem; align-items: center; transition: transform .15s; }
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: .8rem; opacity: .65; }
.bg-soft-primary { background: rgba(79, 70, 229, .12); color: #4f46e5; }
.bg-soft-success { background: rgba(16, 185, 129, .14); color: #059669; }
.bg-soft-warning { background: rgba(245, 158, 11, .16); color: #d97706; }
.bg-soft-danger { background: rgba(239, 68, 68, .13); color: #dc2626; }
.bg-soft-info { background: rgba(14, 165, 233, .14); color: #0284c7; }

/* Subject cards */
.subject-card { overflow: hidden; text-decoration: none; color: inherit; display: block; height: 100%; transition: transform .18s, box-shadow .18s; }
.subject-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(15, 23, 42, .12); color: inherit; }
.subject-cover { padding: 1.1rem 1.2rem; color: #fff; min-height: 110px; position: relative; overflow: hidden; }
.subject-cover::after { content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, .13); }
.subject-cover::before { content: ""; position: absolute; right: 40px; bottom: -50px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.subject-cover .code { font-size: .78rem; font-weight: 700; letter-spacing: .5px; opacity: .9; }
.subject-cover h5 { font-weight: 700; margin: .25rem 0 0; font-size: 1.05rem; line-height: 1.3; }
.subject-banner { border-radius: var(--radius); color: #fff; padding: 1.6rem 1.6rem 1.3rem; position: relative; }
.subject-banner::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(circle at calc(100% - 70px) 70px, rgba(255, 255, 255, .12) 130px, transparent 131px); }
.subject-banner .dropdown-menu { z-index: 1060; }
.subject-banner h2 { font-weight: 800; font-size: 1.5rem; }
.join-chip { background: rgba(255, 255, 255, .2); border: 1px dashed rgba(255, 255, 255, .6); color: #fff; border-radius: 10px; padding: .3rem .7rem; font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: 1px; cursor: pointer; position: relative; z-index: 1; }

/* Tabs */
.lms-tabs { border-bottom: 1px solid var(--border); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; }
.lms-tabs .nav-link { border: 0; border-bottom: 3px solid transparent; color: var(--bs-body-color); opacity: .7; font-weight: 500; padding: .75rem 1rem; white-space: nowrap; border-radius: 0; }
.lms-tabs .nav-link:hover { opacity: 1; }
.lms-tabs .nav-link.active { opacity: 1; color: #4f46e5; border-bottom-color: #4f46e5; background: transparent; font-weight: 600; }
[data-bs-theme="dark"] .lms-tabs .nav-link.active { color: #a5b4fc; border-bottom-color: #a5b4fc; }

/* Lists */
.list-item { display: flex; align-items: center; gap: .9rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); transition: background .12s; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: rgba(79, 70, 229, .035); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; color: inherit; text-decoration: none; }
.list-item a.title:hover { color: #4f46e5; }
.meta { font-size: .8rem; opacity: .65; }
.file-icon { font-size: 1.9rem; line-height: 1; flex-shrink: 0; }
.fi-ppt { color: #ea580c; } .fi-pdf { color: #dc2626; } .fi-doc { color: #2563eb; } .fi-xls { color: #16a34a; }
.fi-zip { color: #a16207; } .fi-img { color: #db2777; } .fi-media { color: #7c3aed; } .fi-code { color: #0d9488; } .fi-other { color: #64748b; }
.act-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }

/* Avatars */
.avatar { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.4rem; }

/* Dropzone */
.dropzone { border: 2px dashed rgba(79, 70, 229, .35); border-radius: var(--radius); padding: 1.5rem; text-align: center; cursor: pointer; transition: background .15s, border-color .15s; position: relative; }
.dropzone:hover, .dropzone.drag { background: rgba(79, 70, 229, .06); border-color: #4f46e5; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-icon { font-size: 2rem; color: #4f46e5; }
.dz-files { text-align: left; margin-top: .6rem; font-size: .85rem; }
.dz-files div { padding: .15rem 0; }
.upload-progress { height: 6px; display: none; margin-top: .8rem; }

/* Gradebook */
.gradebook-wrap { overflow: auto; max-height: 72vh; border-radius: var(--radius); }
.gradebook { font-size: .85rem; margin: 0; border-collapse: separate; border-spacing: 0; }
.gradebook th, .gradebook td { white-space: nowrap; vertical-align: middle; border-bottom: 1px solid var(--border); padding: .45rem .55rem; background: var(--card-bg); }
.gradebook thead th { position: sticky; top: 0; z-index: 2; font-weight: 600; font-size: .78rem; }
.gradebook thead tr:nth-child(2) th { top: 33px; }
.gradebook .sticky-col { position: sticky; left: 0; z-index: 1; min-width: 210px; box-shadow: 1px 0 0 var(--border); overflow: hidden; text-overflow: ellipsis; }
.gradebook thead .sticky-col { z-index: 3; }
.gradebook .comp-head { text-align: center; border-left: 2px solid var(--border); }
.gradebook .act-head { max-width: 110px; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.gradebook .comp-start { border-left: 2px solid var(--border); }
.score-input { width: 64px; text-align: center; padding: .2rem .3rem; font-size: .85rem; border-radius: 8px; border: 1px solid var(--border); background: transparent; color: inherit; transition: background .3s, border-color .2s; }
.score-input:focus { outline: none; border-color: #6366f1; background: rgba(79, 70, 229, .06); }
.score-input.saved { background: rgba(16, 185, 129, .22); }
.score-input.error { background: rgba(239, 68, 68, .22); }
.gradebook .summary { font-weight: 700; text-align: center; background: color-mix(in srgb, var(--card-bg) 92%, #4f46e5); }

/* Grade pills */
.grade-pill { font-weight: 800; font-size: 1.05rem; padding: .25rem .65rem; border-radius: 10px; display: inline-block; }
.grade-big { font-size: 2.6rem; font-weight: 900; line-height: 1; }
.progress { border-radius: 20px; background: rgba(100, 116, 139, .15); }

/* Misc */
.empty-state { text-align: center; padding: 2.5rem 1rem; opacity: .7; }
.empty-state > i { font-size: 2.8rem; display: block; margin-bottom: .5rem; opacity: .5; }
.instructions { white-space: normal; line-height: 1.65; }
.fade-in { animation: fadeIn .35s ease backwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: fadeIn .35s ease backwards; }
.stagger > *:nth-child(2) { animation-delay: .04s; } .stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .12s; } .stagger > *:nth-child(5) { animation-delay: .16s; }
.stagger > *:nth-child(6) { animation-delay: .2s; }
.post-box { border-radius: var(--radius); }
.btn-loading { pointer-events: none; opacity: .75; }
.table > :not(caption) > * > * { background: transparent; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(circle at 85% 15%, rgba(251, 191, 36, .28), transparent 45%), linear-gradient(160deg, #111827 0%, #1e1b4b 60%, #312e81 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::after { content: ""; position: absolute; width: 520px; height: 520px; right: -170px; bottom: -170px; background: rgba(251, 191, 36, .12);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: heroSpin 60s linear infinite; }
@keyframes heroSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .auth-hero::after { animation: none; } }
.auth-hero::before { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .08); left: -60px; top: 30%; }
.auth-hero h1 { font-weight: 900; font-size: 2.6rem; line-height: 1.15; }
.auth-feature { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: 1rem; position: relative; z-index: 1; }
.auth-feature i { font-size: 1.3rem; background: rgba(255, 255, 255, .18); border-radius: 10px; padding: .35rem .55rem; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { width: 100%; max-width: 420px; }
.role-pick input { display: none; }
.role-pick label { border: 2px solid var(--border); border-radius: 12px; padding: .8rem; text-align: center; cursor: pointer; width: 100%; transition: all .15s; }
.role-pick input:checked + label { border-color: #4f46e5; background: rgba(79, 70, 229, .07); color: #4f46e5; font-weight: 600; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } }
.btn-check:checked + .rounded-circle { outline: 3px solid #94a3b8; outline-offset: 2px; }
@media print {
    .sidebar, .topbar, .app-footer, .card-header .btn, .card-header input, nav.small { display: none !important; }
    .main { margin: 0; } .gradebook-wrap { max-height: none; overflow: visible; }
    .score-input { border: 0; }
}

/* Attendance grid (colors match the class record) */
.att-cell { width: 34px; height: 30px; border-radius: 8px; border: 1px solid transparent; font-weight: 700; font-size: .8rem; cursor: pointer; transition: transform .08s, filter .15s; }
.att-cell:hover { filter: brightness(.95); transform: scale(1.06); }
.att-cell.saving { opacity: .6; }
.att-P { background: #c6efce; color: #006100; }
.att-A { background: #ffc7ce; color: #9c0006; }
.att-E { background: #ffeb9c; color: #9c5700; }
.att-none { background: transparent; color: #94a3b8; border-color: var(--border); }
.att-legend { display: inline-grid; place-items: center; width: 24px; height: 22px; border-radius: 6px; font-weight: 700; font-size: .75rem; }
[data-bs-theme="dark"] .att-P { background: rgba(34, 197, 94, .25); color: #86efac; }
[data-bs-theme="dark"] .att-A { background: rgba(239, 68, 68, .25); color: #fca5a5; }
[data-bs-theme="dark"] .att-E { background: rgba(234, 179, 8, .25); color: #fde68a; }

/* Gradebook: class-record colors */
.gradebook .eq-col { background: color-mix(in srgb, var(--card-bg) 82%, #b4a7d6); white-space: normal; min-width: 84px; }
.gradebook .period-col { background: color-mix(in srgb, var(--card-bg) 75%, #8e7cc3); }
.gradebook .final-col { background: color-mix(in srgb, var(--card-bg) 75%, #cfe2f3); }
.gradebook .period-head { background: color-mix(in srgb, var(--card-bg) 88%, #9900ff); }

/* Welcome + tour */
.welcome-hero { background: var(--brand-grad); }
.tour-shield { position: fixed; inset: 0; z-index: 2000; }
.tour-spot { position: fixed; z-index: 2001; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(15, 23, 42, .6); outline: 2px solid #a5b4fc;
    transition: top .3s ease, left .3s ease, width .3s ease, height .3s ease; pointer-events: none; }
.tour-pop { position: fixed; z-index: 2002; border-radius: 14px; transition: top .3s ease, left .3s ease; animation: fadeIn .25s ease backwards; }

/* Notifications */
.notif-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff;
    font-size: .65rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--app-bg); animation: pop .3s ease; }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }
.notif-dropdown { width: min(380px, calc(100vw - 24px)); border-radius: 14px; overflow: hidden; }
.notif-list { max-height: min(420px, 60vh); overflow-y: auto; }
.notif-item { display: flex; gap: .7rem; align-items: flex-start; padding: .7rem 1rem; text-decoration: none; color: inherit; border-bottom: 1px solid var(--border); transition: background .12s; }
.notif-item:hover { background: rgba(79, 70, 229, .05); color: inherit; }
.notif-item .act-icon { width: 34px; height: 34px; font-size: 1rem; border-radius: 10px; }
.notif-item.unread, .notif-row.unread { background: rgba(79, 70, 229, .05); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: #4f46e5; flex-shrink: 0; margin-top: 6px; }
.min-w-0 { min-width: 0; }

/* ---------- Responsive: phones & tablets ---------- */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035; display: flex; background: color-mix(in srgb, var(--card-bg) 92%, transparent);
    backdrop-filter: blur(12px); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; color: var(--bs-body-color); opacity: .6;
    text-decoration: none; border-radius: 12px; font-size: 1.25rem; transition: opacity .15s, background .15s; }
.bottom-nav a small { font-size: .66rem; font-weight: 600; }
.bottom-nav a.active { opacity: 1; color: #4f46e5; }
[data-bs-theme="dark"] .bottom-nav a.active { color: #a5b4fc; }
.bottom-nav a:active { background: rgba(79, 70, 229, .1); }
.bottom-nav .notif-badge { top: -4px; right: -10px; }
@media (max-width: 991.98px) {
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    .toast-container { bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
}
.lms-tabs { scroll-behavior: smooth; scrollbar-width: none; -webkit-mask-image: none; }
.lms-tabs::-webkit-scrollbar { display: none; }
.lms-tabs.can-right { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.lms-tabs.can-left { -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%); mask-image: linear-gradient(90deg, transparent, #000 15%); }
.lms-tabs.can-left.can-right { -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
@media (max-width: 575.98px) {
    .content { padding: .85rem; }
    .lms-tabs .nav-link { padding: .65rem .7rem; font-size: .88rem; }
    .subject-banner { padding: 1.1rem 1.1rem 1rem; }
    .subject-banner h2 { font-size: 1.2rem; }
    .stat-card { padding: .8rem; gap: .65rem; }
    .stat-icon { width: 38px; height: 38px; font-size: 1.05rem; }
    .stat-value { font-size: 1.25rem; }
    .stat-compact { flex-direction: column; text-align: center; gap: .3rem; }
    .gradebook .sticky-col { min-width: 140px; max-width: 150px; width: 150px; }
    /* long names wrap to two lines instead of spilling over the first date/score column */
    .gradebook td.sticky-col { white-space: normal !important; overflow: hidden; line-height: 1.2; word-break: break-word;
        display: table-cell; font-size: .82rem; }
    .gradebook td.sticky-col .fw-semibold { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .gradebook .sticky-col .meta { display: none; }
    .list-item { padding: .75rem .85rem; gap: .7rem; }
    .card-header { padding: .75rem .85rem; }
    .modal-dialog { margin: .5rem; }
    .btn-user { padding: .2rem; }
    .page-title { font-size: 1.02rem; }
    .topbar { gap: .35rem; }
}
@media (hover: none) {
    .score-input { width: 70px; padding: .35rem; font-size: 1rem; }  /* bigger tap targets, no iOS zoom */
    .form-control, .form-select { font-size: 16px; }
    .att-cell { width: 38px; height: 34px; }
}

/* Term filter */
.term-pills .btn { min-width: 64px; }
@media (max-width: 575.98px) { .term-bar .term-pills { width: 100%; } .term-bar .term-pills .btn { flex: 1; min-width: 0; } }

.late-note { font-size: .68rem; color: #dc2626; line-height: 1; margin-top: 2px; }
.score-input:disabled { opacity: .55; cursor: not-allowed; }

/* Quiz */
.quiz-text { white-space: pre-wrap; word-break: break-word; }
.quiz-choice { display: flex; align-items: center; gap: .65rem; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 12px; margin-bottom: .45rem; cursor: pointer; transition: background .12s, border-color .12s; }
.quiz-choice:hover { background: rgba(79, 70, 229, .04); }
.quiz-choice input { accent-color: #4f46e5; width: 18px; height: 18px; flex-shrink: 0; }
.quiz-choice:has(input:checked) { border-color: #6366f1; background: rgba(79, 70, 229, .08); }
.quiz-letter { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: .8rem; background: rgba(100, 116, 139, .12); flex-shrink: 0; }
.quiz-bar { top: 64px; z-index: 1010; }
@media (max-width: 991.98px) { .quiz-bar { top: 58px; } }

.att-L { background: #fce5cd; color: #b45f06; }
[data-bs-theme="dark"] .att-L { background: rgba(249, 115, 22, .25); color: #fdba74; }

/* Recitation picker */
.picker-card { min-height: 360px; display: flex; flex-direction: column; justify-content: center; }
.picker-name { font-size: clamp(1.8rem, 5vw, 3.2rem); font-weight: 900; min-height: 1.3em; transition: transform .2s; }
.picker-name.spinning { color: #94a3b8; }
.picker-name.picked { color: #4f46e5; transform: scale(1.12); }
[data-bs-theme="dark"] .picker-name.picked { color: #a5b4fc; }

/* ---------- Review: code viewer with inline comments ---------- */
.code-view { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; line-height: 1.5; overflow-x: auto; max-height: 75vh; overflow-y: auto; padding: .25rem 0; }
.code-view .cl { display: flex; min-width: max-content; }
.code-view .cl:hover { background: var(--bs-tertiary-bg); }
.code-view .cl.has-ann { background: rgba(255, 193, 7, .12); }
.code-view .cl.flash { background: rgba(255, 193, 7, .45); transition: background .3s; }
.code-view .ln { flex: 0 0 3.5rem; text-align: right; padding-right: .75rem; color: var(--bs-secondary-color); user-select: none; cursor: pointer; border-right: 1px solid var(--bs-border-color); }
.code-view .ln:hover { color: var(--bs-primary); font-weight: 700; }
.code-view .lc { white-space: pre; padding-left: .75rem; }
.ann-row, .ann-form { margin: .25rem .75rem .5rem 4.25rem; font-family: var(--bs-body-font-family); font-size: .85rem; max-width: 640px; }
.ann-row .ann, #generalList .ann { border-left: 3px solid var(--bs-warning); background: var(--bs-body-bg); border-radius: .5rem; padding: .4rem .6rem; margin-bottom: .35rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
#generalList .ann { border-left-color: var(--bs-info); }
.review-frame { height: 78vh; display: block; }
@media (max-width: 575.98px) { .ann-row, .ann-form { margin-left: .5rem; } .code-view .ln { flex-basis: 2.6rem; padding-right: .4rem; } }
.sim-hl { background: rgba(220, 53, 69, .16); }

/* ---------- Progress tracker, badges, leaderboard ---------- */
.need-chip { border: 1px solid var(--bs-border-color); border-radius: .75rem; padding: .35rem .6rem; text-align: center; min-width: 84px; background: var(--bs-body-bg); }
.need-chip.safe { border-color: var(--bs-success); background: var(--bs-success-bg-subtle); }
.need-chip.hard { border-color: var(--bs-warning); background: var(--bs-warning-bg-subtle); }
.need-chip.off { opacity: .45; }
.badge-chip { display: inline-flex; align-items: center; gap: .3rem; border-radius: 999px; padding: .25rem .65rem; font-size: .78rem; font-weight: 600; border: 1px solid transparent; }
.badge-chip.sm { padding: .1rem .35rem; font-size: .7rem; margin-right: .15rem; }
.bc-warning { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); border-color: var(--bs-warning-border-subtle); }
.bc-success { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); border-color: var(--bs-success-border-subtle); }
.bc-primary { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); border-color: var(--bs-primary-border-subtle); }
.bc-danger { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); border-color: var(--bs-danger-border-subtle); }
.bc-info { background: var(--bs-info-bg-subtle); color: var(--bs-info-text-emphasis); border-color: var(--bs-info-border-subtle); }
.badge-locked .badge-chip { filter: grayscale(1); opacity: .4; }
.leaderboard { padding-left: 1.6rem; }
.leaderboard li { padding: .3rem .4rem; border-bottom: 1px solid var(--bs-border-color-translucent); }
.leaderboard li > * { vertical-align: middle; }
.leaderboard li { display: list-item; }
.leaderboard li .grow { display: inline-block; min-width: 45%; }
.leaderboard li strong { float: right; }
.leaderboard li.me { background: var(--bs-primary-bg-subtle); border-radius: .4rem; font-weight: 600; }

/* ---------- Discussion ---------- */
.post-body { line-height: 1.6; overflow-wrap: anywhere; }
.post-code { background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-radius: .5rem; padding: .6rem .75rem; font-size: .8rem; margin: .5rem 0; white-space: pre; overflow-x: auto; }
.post-teacher { border-left: 4px solid var(--bs-primary) !important; }
.min-w-0 { min-width: 0; }

/* ---------- Modules / lessons ---------- */
.module-no { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bs-primary); color: #fff; font-weight: 700; font-size: .85rem; flex: 0 0 28px; }
.module-card.is-locked .module-no { background: var(--bs-secondary); }
.item-locked { opacity: .55; }

/* ---------- Calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { text-align: center; font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--bs-secondary-color); padding: .4rem 0; border-bottom: 1px solid var(--bs-border-color); }
.cal-day { min-height: 96px; border-right: 1px solid var(--bs-border-color-translucent); border-bottom: 1px solid var(--bs-border-color-translucent); padding: .25rem; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.empty { background: var(--bs-tertiary-bg); }
.cal-num { font-size: .75rem; font-weight: 600; color: var(--bs-secondary-color); margin-bottom: .15rem; }
.cal-day.today .cal-num { background: var(--bs-primary); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal-ev { display: block; font-size: .7rem; line-height: 1.25; padding: .15rem .3rem; margin-bottom: .15rem; border-radius: .3rem; text-decoration: none; color: var(--bs-body-color);
  background: color-mix(in srgb, var(--c) 16%, transparent); border-left: 3px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.done { opacity: .5; text-decoration: line-through; }
@media (max-width: 575.98px) {
  .cal-day { min-height: 58px; padding: .15rem; }
  .cal-ev span { display: none; }
  .cal-ev { display: inline-block; padding: .1rem .25rem; margin-right: 1px; }
}
.auth-card.wide { max-width: 720px; }
.reg-section { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); margin: .75rem 0 .35rem; }
img.avatar { object-fit: cover; padding: 0; background: var(--bs-tertiary-bg); }
.avatar.xl { width: 112px; height: 112px; font-size: 2.4rem; }
.avatar-edit { width: 112px; }
.avatar-cam { position: absolute; right: -2px; bottom: -2px; width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 3px solid var(--bs-body-bg); }
.idle-warn { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 2000; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: 14px; padding: 14px 16px; width: min(92vw, 320px); }
#navBar { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 3000; background: linear-gradient(90deg, #fbbf24, #4f46e5); opacity: 0; transition: width .25s ease, opacity .3s; pointer-events: none; }
#navBar.go { opacity: 1; width: 70%; transition: width 6s cubic-bezier(.1,.7,.2,1), opacity .1s; }
#navBar.done { opacity: 0; width: 100%; }

/* ---------- Moving background: drifting glows + twinkling stars (tala) ---------- */
.bg-anim { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blob { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(60px); opacity: .16; will-change: transform; }
.bg-blob.b1 { background: #6366f1; top: -18vmax; left: -12vmax; animation: blobA 26s ease-in-out infinite alternate; }
.bg-blob.b2 { background: #fbbf24; bottom: -22vmax; right: -14vmax; opacity: .12; animation: blobB 32s ease-in-out infinite alternate; }
.bg-blob.b3 { background: #14b8a6; top: 35%; left: 45%; width: 30vmax; height: 30vmax; opacity: .08; animation: blobC 38s ease-in-out infinite alternate; }
@keyframes blobA { to { transform: translate(18vw, 22vh) scale(1.15); } }
@keyframes blobB { to { transform: translate(-20vw, -18vh) scale(1.1); } }
@keyframes blobC { 0% { transform: translate(-30vw, 10vh); } 100% { transform: translate(20vw, -25vh) scale(1.3); } }
.bg-star { position: absolute; width: var(--s); height: var(--s); background: #f59e0b; opacity: 0;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: twinkle var(--t) ease-in-out var(--d) infinite, floatUp calc(var(--t) * 6) linear var(--d) infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.6) rotate(0); } 50% { opacity: .75; transform: scale(1) rotate(45deg); } }
@keyframes floatUp { from { translate: 0 0; } to { translate: 0 -12vh; } }
[data-bs-theme="dark"] .bg-blob { opacity: .22; }
[data-bs-theme="dark"] .bg-star { background: #fde68a; }
.bg-dot { position: absolute; width: var(--s); height: var(--s); border-radius: 50%; background: #94a3b8; opacity: .15; animation: dust var(--t) ease-in-out var(--d) infinite; }
@keyframes dust { 0%, 100% { opacity: .12; } 50% { opacity: .7; } }
[data-bs-theme="dark"] .bg-dot { background: #f8fafc; box-shadow: 0 0 4px rgba(255,255,255,.6); }
.bg-shoot { position: absolute; width: 140px; height: 2px; border-radius: 2px; opacity: 0; transform: rotate(28deg); transform-origin: right center;
  background: linear-gradient(90deg, rgba(253,230,138,0), rgba(253,230,138,.9)); animation: shoot 24s linear var(--d) infinite; }
@keyframes shoot { 0% { opacity: 0; translate: 0 0; } 1% { opacity: 1; } 4% { opacity: 0; translate: 32vw 17vw; } 100% { opacity: 0; translate: 32vw 17vw; } }
[data-bs-theme="light"] .bg-shoot { background: linear-gradient(90deg, rgba(245,158,11,0), rgba(245,158,11,.7)); }
@media (prefers-reduced-motion: reduce) { .bg-blob, .bg-star, .bg-dot, .bg-shoot { animation: none; } .bg-star { opacity: .3; } .bg-shoot { display: none; } }

/* ---------- Public pages (About, Privacy, Terms, Contact) ---------- */
.pub-nav { background: color-mix(in srgb, var(--bs-body-bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--bs-border-color-translucent); }
.pub-hero { background: radial-gradient(circle at 85% 20%, rgba(251, 191, 36, .3), transparent 45%), linear-gradient(160deg, #111827, #1e1b4b 60%, #312e81); color: #fff; border-radius: 1.25rem; padding: 2.5rem; }
.pub-hero h1 { font-weight: 900; }
.legal-doc h2 { font-size: 1.05rem; font-weight: 700; margin-top: 1.4rem; }
.legal-doc h2:first-child { margin-top: 0; }
.legal-doc { line-height: 1.7; }
.legal-doc li { margin-bottom: .25rem; }
.terms-box { border: 1px solid var(--bs-border-color); border-radius: .75rem; padding: .75rem .9rem; background: var(--bs-tertiary-bg); }
.value-card { border-radius: 1rem; padding: 1.25rem; height: 100%; }
.value-card i { font-size: 1.6rem; color: #f59e0b; }
.linked-head { display: flex; align-items: center; gap: .5rem; margin-top: .35rem; margin-bottom: -.35rem; font-size: .9rem; }
.linked-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.sec-checks { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 38px; align-items: center; }
.cal-class { display: block; font-size: .68rem; line-height: 1.2; padding: .1rem .3rem; margin-bottom: .15rem; border-radius: .3rem; text-decoration: none; color: var(--bs-body-color);
  border: 1px dashed var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-class .t { font-weight: 700; color: var(--c); }
@media (max-width: 575.98px) { .cal-class span:not(.t) { display: none; } .cal-class { display: inline-block; margin-right: 1px; } }

/* ---------- Term countdown ---------- */
.term-countdown { padding: 1rem 1.25rem; background: linear-gradient(120deg, color-mix(in srgb, #111827 6%, var(--bs-body-bg)), var(--bs-body-bg)); }
.tc-num { width: 92px; height: 92px; border-radius: 22px; background: #111827; color: #fbbf24; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 0 0 92px; position: relative; overflow: hidden; }
.tc-num::after { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 70%, rgba(251, 191, 36, .35) 85%, transparent); animation: tcSpin 6s linear infinite; }
.tc-num > * { position: relative; z-index: 1; }
.tc-num span { font-size: 2rem; font-weight: 900; line-height: 1; }
.tc-num small { font-size: .7rem; color: #fde68a; text-transform: uppercase; letter-spacing: .04em; margin-top: .2rem; }
.tc-bar { background: linear-gradient(90deg, #fbbf24, #4f46e5); }
.tc-chip { display: flex; gap: .5rem; align-items: center; border: 1px solid var(--bs-border-color); border-radius: .9rem; padding: .5rem .75rem; }
.tc-chip i { font-size: 1.3rem; color: #f59e0b; }
@keyframes tcSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tc-num::after { animation: none; } }

/* ---------- Speed grader ---------- */
.comment-bank { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 180px; overflow-y: auto; }
.bank-chip { display: inline-flex; align-items: center; gap: .25rem; font-size: .78rem; padding: .25rem .5rem; border-radius: 999px; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); cursor: pointer; max-width: 100%; }
.bank-chip:hover { background: var(--bs-primary-border-subtle); }
.bank-x { border: 0; background: none; color: inherit; opacity: .55; padding: 0 0 0 .15rem; line-height: 1; }
.bank-x:hover { opacity: 1; }
.grader-bar kbd { font-size: .7rem; }

/* ---------------- Seat plan ---------------- */
.seatplan-card { overflow-x: auto; }
.seat-front { text-align: center; font-weight: 700; font-size: .8rem; letter-spacing: .06em; padding: .45rem; border-radius: 10px; margin-bottom: 1rem;
    background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }
.seat-grid { display: grid; gap: .5rem; min-width: max-content; }
.seat { min-height: 64px; border-radius: 12px; border: 2px dashed var(--bs-border-color); display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: .3rem; text-align: center; font-size: .78rem; transition: transform .08s, background .15s, border-color .15s; user-select: none; }
.seat.taken { border-style: solid; background: var(--bs-body-bg); cursor: pointer; }
.seat.taken:hover { transform: translateY(-2px); }
.seat.mine { border-color: var(--bs-primary); box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .25); }
.seat.saving { opacity: .6; }
.seat.drop-hover, .seat-pool.drop-hover { border-color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), .08); }
.seat-no { color: var(--bs-secondary-color); font-size: .7rem; }
.seat-name { font-weight: 600; line-height: 1.15; word-break: break-word; }
.seat-name[draggable="true"] { cursor: grab; }
.seat-name.picked { outline: 2px solid var(--bs-primary); border-radius: 6px; }
.seat-status { font-weight: 800; font-size: .95rem; margin-top: 2px; }
.seat.taken.att-P { background: #c6efce; } .seat.taken.att-L { background: #fce5cd; } .seat.taken.att-A { background: #ffc7ce; } .seat.taken.att-E { background: #ffeb9c; }
[data-bs-theme="dark"] .seat.taken.att-P { background: rgba(34,197,94,.25); } [data-bs-theme="dark"] .seat.taken.att-L { background: rgba(249,115,22,.25); }
[data-bs-theme="dark"] .seat.taken.att-A { background: rgba(239,68,68,.25); } [data-bs-theme="dark"] .seat.taken.att-E { background: rgba(234,179,8,.25); }
.seat.att-P, .seat.att-L, .seat.att-A, .seat.att-E { border-color: transparent; }
.seat-pool { border: 2px dashed transparent; max-height: 70vh; overflow-y: auto; }
.pool-name { padding: .35rem .55rem; border-radius: 8px; background: var(--bs-tertiary-bg); margin-bottom: .35rem; font-size: .82rem; }

.join-live { animation: joinPulse 1.6s ease-in-out infinite; }
@keyframes joinPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(25,135,84,.55); } 50% { box-shadow: 0 0 0 8px rgba(25,135,84,0); } }
@media (prefers-reduced-motion: reduce) { .join-live { animation: none; } }

/* Star rating input (peer evaluation) */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 1.25rem; color: var(--bs-border-color); cursor: pointer; transition: color .1s, transform .1s; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: #f5b301; }
.star-input input:focus-visible + label { outline: 2px solid var(--bs-primary); border-radius: 4px; }
.star-input label:active { transform: scale(1.2); }

/* Consultation booking */
.consult-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; max-height: 420px; overflow-y: auto; }
.consult-day { padding: .6rem; border-radius: 10px; background: var(--bs-tertiary-bg); }

/* ---------------- Grading system editor (category cards) ---------------- */
.gw-list { display: flex; flex-direction: column; gap: .4rem; }
.gw-row { border: 1px solid var(--bs-border-color); border-radius: 10px; background: var(--bs-body-bg); transition: border-color .15s, background .15s; }
.gw-main { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; }
.gw-icon { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-size: 1.2rem; background: var(--bs-tertiary-bg); flex: none; }
.gw-title { flex: 1; min-width: 0; }
.gw-title .gw-name { font-weight: 600; border-color: transparent; background: transparent; padding-left: .25rem; }
.gw-title .gw-name:hover, .gw-title .gw-name:focus { border-color: var(--bs-border-color); background: var(--bs-body-bg); }
.gw-rules { font-size: .78rem; text-decoration: none; }
.gw-weight { width: 112px; flex: none; }
.gw-weight input[readonly] { background: var(--bs-tertiary-bg); }
.gw-btn { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--bs-secondary-color); flex: none; }
.gw-btn:hover { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.gw-lock.on { color: var(--bs-body-color); }
.gw-exclude.on { color: #9333ea; }
.gw-chev i { transition: transform .2s; }
.gw-row.open .gw-chev i { transform: rotate(180deg); }
.gw-detail { display: none; padding: .2rem .8rem .8rem 3.6rem; border-top: 1px dashed var(--bs-border-color); padding-top: .7rem; }
.gw-row.open .gw-detail { display: block; }
.gw-row.excluded { background: var(--bs-tertiary-bg); }
.gw-row.excluded .gw-title, .gw-row.excluded .gw-icon { opacity: .55; }
.gw-group { margin-bottom: 1.1rem; padding: .7rem; border-radius: 12px; background: rgba(var(--bs-primary-rgb), .03); border: 1px solid transparent; }
.gw-group.bad { border-color: rgba(var(--bs-danger-rgb), .35); }
.gw-group-head { font-weight: 700; margin-bottom: .5rem; }
.gw-total { font-weight: 700; padding-top: .35rem; border-top: 2px solid var(--bs-border-color); min-width: 140px; text-align: right; }
.gw-total.good { color: var(--bs-success); } .gw-total.bad { color: var(--bs-danger); }
@media (max-width: 575.98px) { .gw-main { flex-wrap: wrap; } .gw-title { flex-basis: calc(100% - 50px); } .gw-weight { margin-left: auto; } .gw-detail { padding-left: .8rem; } }

/* Copy content */
.cc-ic { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 1.3rem; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); flex: none; }
.cc-row:hover { background: var(--bs-tertiary-bg); }
.cc-head { display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem; cursor: pointer; margin: 0; min-width: 0; }
.cc-body { display: none; border-top: 1px solid var(--bs-border-color); padding: .4rem .6rem .6rem; max-height: 460px; overflow-y: auto; }
.cc-folder.open .cc-body { display: block; }
.cc-folder.open .cc-tog i { transform: rotate(180deg); }
.cc-tog i { display: inline-block; transition: transform .2s; }
.cc-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .5rem; border-radius: 8px; cursor: pointer; margin: 0; min-width: 0; }
.cc-item:hover { background: var(--bs-tertiary-bg); }
.cc-item > span { min-width: 0; }
.cc-sub { font-size: .78rem; font-weight: 600; color: var(--bs-secondary-color); padding: .5rem .5rem .15rem; }
.cc-bar { box-shadow: 0 8px 30px rgba(0,0,0,.12); }

/* Quiz delivery + lockdown */
.quiz-dots { display: flex; flex-wrap: wrap; gap: .35rem; }
.quiz-dot { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); font-size: .8rem; font-weight: 600; }
.quiz-dot.done { background: rgba(var(--bs-success-rgb), .15); border-color: rgba(var(--bs-success-rgb), .5); }
.quiz-dot.active { outline: 2px solid var(--bs-primary); }
.quiz-locked #quizForm, .quiz-locked .quiz-bar { user-select: none; -webkit-user-select: none; }
.quiz-locked #quizForm input[type=text] { user-select: text; -webkit-user-select: text; }
#quizForm.quiz-hidden { filter: blur(14px); pointer-events: none; }
.lock-gate { position: fixed; inset: 0; z-index: 3000; background: rgba(15, 23, 42, .85); display: grid; place-items: center; padding: 1rem; backdrop-filter: blur(8px); }
:fullscreen body, body:fullscreen { overflow-y: auto; }

.quiz-code { background: #0f172a; color: #e2e8f0; padding: .75rem 1rem; border-radius: 10px; white-space: pre; overflow-x: auto; font-size: .82rem; }
.quiz-answer-box { background: var(--bs-tertiary-bg); border-radius: 10px; padding: .6rem .8rem; white-space: pre-wrap; word-break: break-word; font-size: .9rem; }
.quiz-match .form-select { min-width: 140px; }
.quiz-part-head { margin: 1.2rem 0 .6rem; padding: .6rem .9rem; border-left: 4px solid var(--bs-primary); background: rgba(var(--bs-primary-rgb), .06); border-radius: 0 10px 10px 0; }

/* Breadcrumbs */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; padding: .55rem 1.5rem 0; font-size: .82rem; color: var(--bs-secondary-color); }
.crumbs a { color: var(--bs-secondary-color); text-decoration: none; padding: .1rem .35rem; border-radius: 6px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a:hover { color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), .08); }
.crumbs span[aria-current] { color: var(--bs-body-color); font-weight: 600; padding: .1rem .35rem; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-sep { font-size: .65rem; opacity: .6; }
@media (max-width: 575.98px) { .crumbs { padding: .5rem 1rem 0; } .crumbs a, .crumbs span[aria-current] { max-width: 140px; } }
.activity-row > .list-item { border-bottom: 1px solid var(--border); }
.activity-row:last-child > .list-item { border-bottom: 0; }

/* Show / hide password */
.pw-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.pw-host { position: relative; }
.pw-input { padding-right: 2.6rem !important; }
.pw-eye { position: absolute; top: 50%; right: .45rem; transform: translateY(-50%); z-index: 5; border: 0; background: transparent;
  color: var(--bs-secondary-color); padding: .25rem .4rem; line-height: 1; border-radius: .4rem; }
.pw-eye:hover, .pw-eye:focus-visible { color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
.form-control-sm.pw-input + .pw-eye { padding: .1rem .3rem; font-size: .85rem; }

/* Gradebook / attendance cells need a solid background (the generic .table rule above makes cells transparent,
   which lets rows show through the sticky header and name column) */
.table.gradebook > :not(caption) > * > * { background: var(--card-bg); }
.table.gradebook > thead > tr > th { background: color-mix(in srgb, var(--card-bg) 88%, var(--bs-body-color)); box-shadow: inset 0 -1px 0 var(--border); }
.table.gradebook .summary { background: color-mix(in srgb, var(--card-bg) 92%, #4f46e5); }

/* Attendance table: quiet Present, strong Late / Absent / Excused, clear selection */
.attendance-table td, .attendance-table th { padding: .28rem .35rem; }
.table.attendance-table > tbody > tr:nth-child(even) > td { background: color-mix(in srgb, var(--card-bg) 95%, var(--bs-body-color)); }
.attendance-table thead th:not(.sticky-col) { min-width: 48px; text-align: center; }
.attendance-table .att-cell { width: 30px; height: 26px; border-radius: 7px; font-size: .74rem; }
.attendance-table .att-cell:hover { transform: none; filter: none; box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), .5); }
.attendance-table .att-P { background: transparent; color: var(--bs-secondary-color); opacity: .45; font-weight: 600; border-color: transparent; }
[data-bs-theme="dark"] .attendance-table .att-P { background: transparent; color: #94a3b8; opacity: .45; }
.attendance-table .att-A { box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .55); }
.attendance-table .att-L { box-shadow: inset 0 0 0 1px rgba(249, 115, 22, .55); }
.attendance-table .att-E { box-shadow: inset 0 0 0 1px rgba(234, 179, 8, .55); }
/* The cell you are on: solid, impossible to miss */
.attendance-table .att-cell:focus, .attendance-table .att-cell:focus-visible { outline: none; opacity: 1; background: var(--bs-primary) !important; color: #fff !important;
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .45) !important; transform: scale(1.12); position: relative; z-index: 1; }
/* Row + date column of that cell */
.table.attendance-table > tbody > tr.att-hl > td { background: color-mix(in srgb, var(--card-bg) 80%, var(--bs-primary)) !important; }
.table.attendance-table > tbody > tr > td.att-hl, .table.attendance-table > thead > tr > th.att-hl { background: color-mix(in srgb, var(--card-bg) 88%, var(--bs-primary)) !important; }
.table.attendance-table > thead > tr > th.att-hl { color: var(--bs-primary-text-emphasis); }
/* Near / over the absence limit: readable in light and dark */
.table.attendance-table > tbody > tr.att-near > td.sticky-col { box-shadow: inset 4px 0 0 #f59e0b, 1px 0 0 var(--border); }
.table.attendance-table > tbody > tr.att-over > td.sticky-col { box-shadow: inset 4px 0 0 #ef4444, 1px 0 0 var(--border); }
.attendance-table tr.att-over [data-att="absent"] { color: #ef4444; }
.attendance-table tr.att-near [data-att="absent"] { color: #f59e0b; }
.att-wrap { overscroll-behavior-x: contain; }
.att-wrap::-webkit-scrollbar { height: 12px; width: 10px; }
.att-wrap::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--bs-body-color) 30%, transparent); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
/* Seat plan keyboard focus */
.seat[tabindex]:focus-visible, .seat[tabindex]:focus { outline: 3px solid var(--bs-primary); outline-offset: 2px; }
.att-wrap { scroll-padding-left: 240px; scroll-padding-top: 44px; }
.table.attendance-table > tbody > tr > td.sticky-col { z-index: 2; }
.table.attendance-table > thead > tr > th { z-index: 3; }
.table.attendance-table > thead > tr > th.sticky-col { z-index: 4; }
/* Dark mode: stronger row / date highlight in attendance */
[data-bs-theme="dark"] .table.attendance-table > tbody > tr.att-hl > td { background: #26306b !important; }
[data-bs-theme="dark"] .table.attendance-table > tbody > tr > td.att-hl { background: #1f2a5c !important; }
[data-bs-theme="dark"] .table.attendance-table > tbody > tr.att-hl > td.att-hl { background: #34408f !important; }
[data-bs-theme="dark"] .table.attendance-table > thead > tr > th.att-hl { background: #34408f !important; color: #fff; }
[data-bs-theme="dark"] .table.attendance-table > tbody > tr.att-hl > td.sticky-col { color: #fff; box-shadow: inset 4px 0 0 #818cf8, 1px 0 0 var(--border); }
[data-bs-theme="dark"] .attendance-table tr.att-hl .att-P { opacity: .8; color: #c7d2fe; }
[data-bs-theme="dark"] .attendance-table .att-cell:focus { background: #6366f1 !important; box-shadow: 0 0 0 3px #a5b4fc !important; }
/* Light mode: same idea */
:root:not([data-bs-theme="dark"]) .table.attendance-table > tbody > tr.att-hl > td { background: #e0e7ff !important; }
:root:not([data-bs-theme="dark"]) .table.attendance-table > tbody > tr > td.att-hl { background: #eef2ff !important; }
:root:not([data-bs-theme="dark"]) .table.attendance-table > tbody > tr.att-hl > td.att-hl, :root:not([data-bs-theme="dark"]) .table.attendance-table > thead > tr > th.att-hl { background: #c7d2fe !important; }

/* Grade not complete yet: muted, "so far" */
.gradebook .so-far { color: var(--bs-secondary-color); font-style: italic; font-weight: 600; }
.gradebook .comp-hidden { opacity: .65; }

/* Gradebook: component grades are editable (typed value overrides the computed one) */
.comp-input { width: 58px; text-align: center; font-weight: 700; padding: .2rem .25rem; font-size: .85rem; border-radius: 8px; border: 1px solid transparent; background: transparent; color: inherit; }
.comp-input:hover:not(:disabled) { border-color: var(--border); }
.comp-input:focus { outline: none; border-color: var(--bs-primary); background: var(--bs-body-bg); box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), .25); }
.comp-input.is-override { border-color: #f59e0b; border-style: dashed; color: #b45309; }
[data-bs-theme="dark"] .comp-input.is-override { color: #fbbf24; }
.comp-input.saved { border-color: #10b981; } .comp-input.error { border-color: #ef4444; }
.comp-link:hover { text-decoration: underline !important; color: var(--bs-primary) !important; }

/* Live quiz */
.live-stage { min-height: 420px; }
.live-pin { font-size: clamp(3rem, 9vw, 6.5rem); font-weight: 800; letter-spacing: .12em; font-family: ui-monospace, monospace; color: var(--bs-primary); line-height: 1.1; margin: .4rem 0 1rem; }
.live-players .badge { font-size: .9rem; margin: .15rem; }
.live-timer { width: 72px; height: 72px; border-radius: 50%; background: var(--bs-primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 800; flex-shrink: 0; }
.live-q { font-size: clamp(1.2rem, 2.4vw, 2rem); font-weight: 700; line-height: 1.25; }
.live-choice { color: #fff; border-radius: 14px; padding: 1.1rem 1.2rem; font-size: clamp(1rem, 1.8vw, 1.4rem); font-weight: 700; display: flex; align-items: center; gap: .8rem; min-height: 80px; transition: opacity .3s; }
.live-choice .shape, .live-btn .shape { font-size: 1.6rem; opacity: .9; }
.live-choice.dim, .live-btn.dim { opacity: .3; }
.live-btn { color: #fff; border: 0; border-radius: 14px; padding: 1rem .8rem; min-height: 110px; font-weight: 700; font-size: 1.05rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.live-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.live-podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: end; max-width: 560px; margin: 0 auto; }
.live-podium .bar { margin-top: .5rem; border-radius: 10px 10px 0 0; color: #fff; font-size: 2rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.live-podium .pod-1 .bar { height: 150px; background: #f59e0b; } .live-podium .pod-2 .bar { height: 110px; background: #94a3b8; } .live-podium .pod-3 .bar { height: 80px; background: #b45309; }
.live-host:fullscreen { overflow: auto; background: var(--bs-body-bg); }
.live-host:fullscreen .live-stage { min-height: calc(100vh - 60px); }

/* Group activities grade table */
.gtask-table .gt-name { min-width: 150px; position: sticky; left: 0; background: var(--bs-body-bg); z-index: 1; }
.gtask-table .gt-col { min-width: 110px; max-width: 160px; }
.gtask-table .gtask-cell { width: 90px; margin: 0; flex: none; }
.gtask-rem { color: var(--bs-secondary-color); line-height: 1; }
.gtask-rem.has-rem { color: var(--bs-primary); }
.gtask-remark { color: var(--bs-body-color); opacity: .9; }

/* Q&A board */
.qa-vote { min-width: 52px; line-height: 1.1; }
.qa-count { min-width: 52px; color: var(--bs-secondary-color); }
.qa-answered .qa-body { opacity: .75; }
.qa-body { font-size: 1.02rem; white-space: normal; }
body.qa-projector #qaList { position: fixed; inset: 0; z-index: 2000; overflow: auto; padding: 2rem 3rem 4rem; background: var(--bs-body-bg); }
body.qa-projector #qaList::before { content: "Q&A — press Esc to exit"; display: block; font-weight: 700; opacity: .6; margin-bottom: 1rem; }
body.qa-projector #qaList .btn, body.qa-projector #qaList .collapse { display: none !important; }
body.qa-projector .qa-body { font-size: 1.7rem; font-weight: 600; }
body.qa-projector .qa-count { font-size: 1.4rem; }

.gtask-add input[name=title] { width: 190px; }
.gtask-add input[name=task_date] { width: 150px; }
@media (max-width: 575.98px) {
    .gtask-add { width: 100%; }
    .gtask-add input[name=title] { flex: 1 1 100%; width: auto; }
    .gtask-add input[name=task_date] { flex: 1 1 0; width: auto; min-width: 0; }
}

/* Groups table on phones: one activity column at a time */
@media (max-width: 575.98px) {
    .gtask-table.one-col [data-col]:not(.col-on) { display: none; }
}

/* Install-app nudge (phones) */
.install-nudge{position:fixed;left:.75rem;right:.75rem;bottom:calc(.75rem + env(safe-area-inset-bottom));z-index:1080;display:flex;align-items:center;gap:.65rem;padding:.75rem .85rem;border-radius:1rem;background:var(--bs-body-bg);border:1px solid var(--bs-border-color);animation:nudgeIn .35s ease-out}
.install-nudge img{border-radius:.7rem;flex:none}
@keyframes nudgeIn{from{transform:translateY(120%);opacity:0}to{transform:none;opacity:1}}
