/* One stylesheet for both products. Colours, fonts and shadows come from the
   theme file the profile names (spec 060); this file never names a colour. */
*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 10% -10%, var(--paper-glow), transparent 60%),
        radial-gradient(900px 500px at 100% 0%, var(--paper-glow), transparent 55%),
        var(--paper);
    line-height: 1.5;
}
a { color: var(--accent); }
a:hover { color: var(--accent-strong); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; margin-top: 1.2rem; }
p { margin: 0 0 0.75rem; }
.muted { color: var(--muted); }

/* ── Header ──────────────────────────────────────────────────────── */
.site-header {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: 0.6rem clamp(1rem, 3vw, 2.5rem);
    background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 10px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.15rem; margin-left: 0.5rem; }
.site-nav a {
    padding: 0.4rem 0.7rem; border-radius: 8px; color: var(--muted);
    text-decoration: none; font-size: 0.95rem; font-family: var(--font-ui);
}
.site-nav a:hover { color: var(--ink); background: var(--panel); }
.site-nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.who { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line-strong); }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; background: var(--accent); color: var(--accent-ink); font-family: var(--font-ui); }
.who em { font-style: normal; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--panel); color: var(--ink); font-size: 0.8rem; margin-left: 0.25rem; }
.icon-button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0; border-radius: 10px; border: 1px solid var(--line);
    background: var(--card); color: var(--ink); cursor: pointer;
}
.icon-button:hover { border-color: var(--line-strong); }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: inline; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun { display: none; }
    :root:not([data-theme="light"]) .icon-moon { display: inline; }
}

/* ── Main ────────────────────────────────────────────────────────── */
.site-main {
    flex: 1; width: 100%; max-width: 1200px; margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 3vw, 2.5rem);
}
body.public .site-main { max-width: 520px; }
.hero { text-align: center; padding: 1rem 0 1.5rem; }
.hero img { border-radius: 24px; box-shadow: var(--shadow); }
.hero h1 { font-size: 1.9rem; margin-top: 0.75rem; }
.hero p { color: var(--muted); }

.card {
    background: var(--card); border: 1px solid var(--line); border-radius: 16px;
    padding: clamp(1rem, 2.5vw, 1.75rem); box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.card h2 { margin-top: 0; }

/* ── Forms and buttons ───────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label, form label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 0.3rem; font-family: var(--font-ui); }
input, select, textarea {
    font: inherit; font-family: var(--font-ui); color: var(--ink);
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 0.6rem 0.75rem; width: 100%; max-width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 0.4rem; }
input[type="file"] { padding: 0.4rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea { min-height: 5rem; resize: vertical; }
form { margin-bottom: 1rem; }
/* Single-line forms (a field or two and a button) flow inline; forms built from .form-group stack. */
form.inline, form:not(:has(.form-group)):has(> input:not([type=hidden]), > select) { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
form.inline > input, form.inline > select, form:not(:has(.form-group)) > input:not([type=hidden]), form:not(:has(.form-group)) > select { flex: 1 1 12rem; width: auto; }

button, .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    font: inherit; font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem;
    padding: 0.6rem 1.1rem; border-radius: 10px; border: 1px solid var(--accent);
    background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none;
    transition: transform 80ms ease, background 120ms ease;
}
button:hover, .btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: default; }
.btn-secondary, button.btn-secondary, button.unregister, button.deactivate, button.delete-entry, button.download {
    background: var(--card); color: var(--ink); border-color: var(--line-strong);
}
.btn-secondary:hover, button.btn-secondary:hover, button.unregister:hover, button.deactivate:hover, button.delete-entry:hover, button.download:hover {
    background: var(--panel); color: var(--ink); border-color: var(--line-strong);
}
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-view { font-size: 0.85rem; padding: 0.35rem 0.7rem; }
.btn-google { display: none; }
.footer-link { text-align: center; color: var(--muted); margin-top: 0.5rem; }
.back-link { display: inline-block; margin-bottom: 0.75rem; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--ink); }

/* ── Feedback ────────────────────────────────────────────────────── */
.alert, .flash-error { padding: 0.7rem 0.9rem; border-radius: 10px; margin-bottom: 1rem; border: 1px solid var(--line); background: var(--panel); }
.alert-error, .flash-error { border-color: #d1434b; color: #b3262e; background: rgba(209, 67, 75, 0.08); }
.alert-success { border-color: #2f9e5a; color: #237a45; background: rgba(47, 158, 90, 0.1); }
.badge {
    display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.75rem;
    font-family: var(--font-ui); background: var(--panel); color: var(--muted); border: 1px solid var(--line); vertical-align: middle;
}
.badge.done, .badge-live { background: rgba(47, 158, 90, 0.12); color: #237a45; border-color: rgba(47, 158, 90, 0.3); }
.badge.warn { background: rgba(214, 138, 20, 0.12); color: #9a5f0a; border-color: rgba(214, 138, 20, 0.3); }
.badge-recorded { background: var(--panel); }
.role-badge, .semester-badge { font-size: 0.75rem; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--panel); color: var(--muted); font-family: var(--font-ui); }
.empty-state, .dashboard-note { color: var(--muted); padding: 0.5rem 0; }

/* ── Dashboard pieces ────────────────────────────────────────────── */
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; gap: 1rem; }
.greeting, .student-header .name { font-size: 1.6rem; font-weight: 700; }
.stats-grid, .summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card, .summary-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.stat-card .number, .summary-card .number { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-card .label, .summary-card .label { color: var(--muted); font-size: 0.85rem; margin-top: 0.35rem; font-family: var(--font-ui); }
.progress-bar-wrapper { margin-bottom: 1.25rem; }
.bar-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; margin-bottom: 0.35rem; }
.progress-track, .progress-mini-bar { height: 10px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.progress-fill, .progress-mini-fill { height: 100%; background: var(--accent); border-radius: 999px; width: 0; transition: width 400ms ease; }
.progress-mini { display: flex; align-items: center; gap: 0.5rem; min-width: 160px; }
.progress-mini .pct { font-size: 0.85rem; color: var(--muted); min-width: 3rem; text-align: right; }
.progress-mini-bar { flex: 1; height: 8px; }
.curriculum-section, .students-section, .activity-section { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem 1.5rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.curriculum-section h3, .students-section h3, .activity-section h3 { margin-top: 0; }
.semester-item, .student-row, .subject-row, .activity-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line-soft); }
.semester-item:last-child, .student-row:last-child, .subject-row:last-child, .activity-row:last-child { border-bottom: 0; }
.semester-name, .student-name, .subject-name, .activity-title { font-weight: 600; }
.semester-number, .student-email, .student-meta, .activity-meta, .subject-count, .sem-pct { color: var(--muted); font-size: 0.9rem; }
.student-header { margin-bottom: 1rem; }
.detail-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; color: var(--muted); font-size: 0.9rem; }
.semester-section { margin-bottom: 1rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); margin-right: 0.4rem; }
.dot-done { background: #2f9e5a; }
.dot-partial { background: #d68a14; }
.dot-none { background: var(--line-strong); }

/* ── Lists ───────────────────────────────────────────────────────── */
ul.lesson-list, ul.journal-list, ul.event-list, ul.resource-list, ul.case-list, ul.note-list, ul.document-list, ul.roster, ul.export-list, ul.question-list {
    list-style: none; padding: 0; margin: 0;
}
.lesson-list li, .journal-list li, .event-list li, .resource-list li, .case-list li, .note-list li, .document-list li, .roster li, .export-list li {
    padding: 0.7rem 0; border-bottom: 1px solid var(--line-soft);
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
}
.lesson-list li:last-child, .journal-list li:last-child, .event-list li:last-child, .resource-list li:last-child, .case-list li:last-child, .note-list li:last-child, .document-list li:last-child, .roster li:last-child, .export-list li:last-child { border-bottom: 0; }
.journal-list li p, .event-list li p, .resource-list li p { flex-basis: 100%; margin: 0; }
.journal-list li button, .event-list li button, .resource-list li button, .resource-list li .btn { margin-left: auto; }
.note-list li.system { color: var(--muted); font-style: italic; }
.subject { margin: 0.75rem 0 0.75rem 0.25rem; padding-left: 0.75rem; border-left: 3px solid var(--line); }
details { margin-bottom: 0.75rem; }
details > summary { cursor: pointer; font-weight: 600; padding: 0.5rem 0; list-style: none; display: flex; align-items: center; gap: 0.6rem; }
details > summary::before { content: "▸"; color: var(--muted); font-size: 0.8rem; }
details[open] > summary::before { content: "▾"; }
details.locked > summary { color: var(--muted); }
.program { margin-bottom: 1.5rem; }
.question { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.question legend { font-weight: 600; padding: 0 0.3rem; }
.question .correct { color: #237a45; }
.rating label { display: inline-flex; align-items: center; margin-right: 0.75rem; }
.video-status { color: var(--muted); }
.count { color: var(--muted); font-size: 0.9rem; }

/* ── Tables ──────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-family: var(--font-ui); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
td input, td select { padding: 0.35rem 0.5rem; }
.user-table { overflow-x: auto; display: block; }

/* ── Media ───────────────────────────────────────────────────────── */
video#lesson { width: 100%; border-radius: 12px; background: #000; box-shadow: var(--shadow); }
.embed { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); background: #000; margin-bottom: 1rem; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#feed-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; word-break: break-all; }

/* ── Legal pages ─────────────────────────────────────────────────── */
.legal h2 { margin-bottom: 0.25rem; }
.legal h3 { margin-top: 1.5rem; }
.legal .updated { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.25rem; }

/* ── Footer ──────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--card) 70%, transparent); padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 1.25rem; margin-top: 2rem; }
.footer-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr auto; gap: 1.5rem; align-items: start; }
.footer-brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.footer-brand img { border-radius: 8px; }
.site-footer nav { display: flex; flex-direction: column; gap: 0.35rem; }
.site-footer nav a { color: var(--muted); text-decoration: none; font-family: var(--font-ui); font-size: 0.92rem; }
.site-footer nav a:hover { color: var(--ink); }
.site-footer nav.social { flex-direction: row; gap: 0.5rem; }
.site-footer nav.social a { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
.site-footer nav.social a:hover { border-color: var(--accent); color: var(--accent); }
.copyright { max-width: 1200px; margin: 1.25rem auto 0; color: var(--muted); font-size: 0.85rem; font-family: var(--font-ui); }
.page-footer { display: none; }

@media (max-width: 720px) {
    .site-header { gap: 0.5rem; }
    .site-nav { order: 3; flex-basis: 100%; overflow-x: auto; margin-left: 0; }
    .who { display: none; }
    .footer-grid { grid-template-columns: 1fr; }
    .top-bar { flex-direction: column; align-items: flex-start; }
}
