/* System LHR — one stylesheet, no build step. */

/* ---------- Tokens ---------- */
:root {
    --brand: #15803d;
    --brand-hover: #116a32;
    --brand-ink: #ffffff;
    --brand-line: #126b33;
    --brand-soft: #e8f5ec;

    --bg: #f2f3f5;
    --surface: #ffffff;
    --surface-2: #f7f8fa;
    --surface-3: #eceef1;
    --border: #e1e4e8;
    --border-strong: #c9cdd4;

    --text: #15171b;
    --text-2: #3b414b;
    --muted: #697180;

    --danger: #c42b2b;
    --danger-bg: #fdeceb;
    --danger-line: #f3c2bf;
    --success: #18753a;
    --success-bg: #e6f5eb;
    --success-line: #b8e2c5;

    --st-present: #15803d;
    --st-absent: #be123c;
    --st-late: #a21caf;
    --st-legal_late: #1d4ed8;
    --st-leave: #92400e;
    --st-online: #0f766e;
    --st-ink: #ffffff;
    --warning: #9a5b00;
    --warning-bg: #fff4dc;
    --warning-line: #f1d39a;
    --topbar: var(--brand);
    --topbar-ink: var(--brand-ink);
    --mark-bg: #ffffff;
    --mark-ink: #15803d;

    --shadow-sm: 0 1px 2px rgba(16, 20, 28, .06);
    --shadow-md: 0 6px 24px rgba(16, 20, 28, .10), 0 1px 3px rgba(16, 20, 28, .06);
    --shadow-lg: 0 24px 60px rgba(16, 20, 28, .22);
    --focus: 0 0 0 3px rgba(22, 163, 74, .4);

    --radius: 14px;
    --radius-sm: 9px;
    --sidebar-w: 264px;
    --topbar-h: 60px;

    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --brand: #22c55e;
        --brand-hover: #4ade80;
        --brand-ink: #03240f;
        --brand-line: #22c55e;
        --brand-soft: #12301d;
        --bg: #0d0f12;
        --surface: #16191e;
        --surface-2: #1b1f25;
        --surface-3: #242931;
        --border: #2a3038;
        --border-strong: #3b424d;
        --text: #eceef1;
        --text-2: #c4c9d1;
        --muted: #8f97a4;
        --danger: #ff8a85;
        --danger-bg: #351819;
        --danger-line: #5c2a2a;
        --success: #5fd68a;
        --success-bg: #112a1b;
        --success-line: #1f4a30;
        --st-present: #4ade80;
        --st-absent: #fb7185;
        --st-late: #e879f9;
        --st-legal_late: #7aa7ff;
        --st-leave: #f0a85a;
        --st-online: #2dd4bf;
        --st-ink: #0b0d10;
        --warning: #f5c26b;
        --warning-bg: #3a2c10;
        --warning-line: #5c4518;
        --topbar: #16191e;
        --topbar-ink: #eceef1;
        --mark-bg: var(--brand);
        --mark-ink: var(--brand-ink);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-md: 0 8px 28px rgba(0, 0, 0, .45);
        --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
        --focus: 0 0 0 3px rgba(34, 197, 94, .45);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --brand: #22c55e;
    --brand-hover: #4ade80;
    --brand-ink: #03240f;
    --brand-line: #22c55e;
    --brand-soft: #12301d;
    --bg: #0d0f12;
    --surface: #16191e;
    --surface-2: #1b1f25;
    --surface-3: #242931;
    --border: #2a3038;
    --border-strong: #3b424d;
    --text: #eceef1;
    --text-2: #c4c9d1;
    --muted: #8f97a4;
    --danger: #ff8a85;
    --danger-bg: #351819;
    --danger-line: #5c2a2a;
    --success: #5fd68a;
    --success-bg: #112a1b;
    --success-line: #1f4a30;
    --st-present: #4ade80;
    --st-absent: #fb7185;
    --st-late: #e879f9;
    --st-legal_late: #7aa7ff;
    --st-leave: #f0a85a;
    --st-online: #2dd4bf;
    --st-ink: #0b0d10;
    --warning: #f5c26b;
    --warning-bg: #3a2c10;
    --warning-line: #5c4518;
    --topbar: #16191e;
    --topbar-ink: #eceef1;
    --mark-bg: var(--brand);
    --mark-ink: var(--brand-ink);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, .45);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .6);
    --focus: 0 0 0 3px rgba(34, 197, 94, .45);
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.icon { flex: none; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 100;
    background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: 8px; font-weight: 600;
}
.skip-link:focus { top: 12px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link { color: var(--text-2); font-weight: 500; text-decoration: underline; text-decoration-color: var(--brand-line); text-decoration-thickness: 2px; text-underline-offset: 3px; font-size: 14px; }
.link:hover { color: var(--text); text-decoration-color: var(--brand); }
.link-strong { font-weight: 600; text-decoration: none; }
.link-strong:hover { text-decoration: underline; text-decoration-color: var(--brand-line); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.optional { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 4px; }
.lead { color: var(--text-2); max-width: 70ch; margin: -4px 0 20px; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand__mark {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--mark-bg); color: var(--mark-ink);
    font-weight: 800; font-size: 12px; letter-spacing: .04em;
}
.brand__mark--lg { width: 56px; height: 56px; border-radius: 14px; font-size: 17px; background: var(--brand); color: var(--brand-ink); }
.brand__name { font-weight: 750; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
}
.sidebar__brand {
    height: var(--topbar-h); flex: none;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px 0 18px;
    background: var(--topbar); color: var(--topbar-ink);
    border-bottom: 1px solid var(--brand-line);
}
.sidebar__nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar__foot { padding: 10px 12px 14px; border-top: 1px solid var(--border); }
.nav-label {
    margin: 18px 10px 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; color: var(--muted);
}
.nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 10px;
    text-decoration: none; color: var(--text-2); font-weight: 520; font-size: 14.5px;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.is-active { background: var(--brand); color: var(--brand-ink); font-weight: 650; }
.nav-link--sub { padding-top: 7px; padding-bottom: 7px; font-size: 14px; }
.nav-initial {
    display: inline-grid; place-items: center; flex: none;
    width: 22px; height: 22px; border-radius: 6px;
    background: var(--surface-3); color: var(--text-2);
    font-size: 11.5px; font-weight: 700;
}
.nav-link.is-active .nav-initial { background: var(--brand-ink); color: var(--brand); }

.nav-group { margin-top: 2px; }
.nav-group__head {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
    list-style: none; cursor: pointer; color: var(--text); font-weight: 650; font-size: 14px; line-height: 1.3;
}
.nav-group__head::-webkit-details-marker { display: none; }
.nav-group__head:hover { background: var(--surface-3); }
.nav-badge {
    flex: none; min-width: 34px; height: 26px; padding: 0 6px; border-radius: 7px;
    display: grid; place-items: center; font-size: 11.5px; font-weight: 800; letter-spacing: .03em;
    background: var(--surface-3); color: var(--text-2);
}
.nav-group.is-current .nav-badge { background: var(--brand); color: var(--brand-ink); }
.nav-group__name { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nav-group__chevron { color: var(--muted); transition: transform .15s; }
.nav-group[open] .nav-group__chevron { transform: rotate(180deg); }
.nav-group__items { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 8px 26px; padding-left: 10px; border-left: 2px solid var(--border); }
.nav-group.is-current .nav-group__items { border-left-color: var(--brand); }

.shell { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 24px;
    background: var(--topbar); color: var(--topbar-ink);
    border-bottom: 1px solid var(--brand-line);
}
.topbar__spacer { flex: 1; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 28px 64px; outline: none; }

.sidebar-backdrop { display: none; }

/* ---------- Theme toggle & user menu ---------- */
.theme-toggle, .btn-icon {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; border-radius: 10px;
    border: 0; background: transparent; color: inherit; cursor: pointer;
}
.theme-toggle:hover, .btn-icon:hover { background: rgba(0, 0, 0, .08); }
.sidebar__close, .topbar__menu, .brand--compact { display: none; }
.topbar .btn-icon:hover, .topbar .theme-toggle:hover, .sidebar__brand .btn-icon:hover,
.user-menu__trigger:hover { background: rgba(255, 255, 255, .16) !important; }
:root[data-theme="dark"] .theme-toggle:hover, :root[data-theme="dark"] .btn-icon:hover { background: rgba(255, 255, 255, .08); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle:hover, :root:not([data-theme="light"]) .btn-icon:hover { background: rgba(255, 255, 255, .08); }
}
.theme-icon { display: none; }
:root:not([data-theme]) .theme-icon--system,
:root[data-theme="light"] .theme-icon--light,
:root[data-theme="dark"] .theme-icon--dark { display: block; }
.theme-toggle--floating {
    position: fixed; top: 16px; right: 16px;
    background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.theme-toggle--floating:hover { background: var(--surface-3) !important; }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown__menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
    min-width: 230px; padding: 6px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-md);
}
.dropdown__header { display: flex; flex-direction: column; padding: 10px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; font-size: 14px; }
.dropdown__header .muted { font-size: 13px; }
.dropdown__item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border-radius: 8px; border: 0; background: none;
    text-decoration: none; font-size: 14px; cursor: pointer; text-align: left;
}
.dropdown__item:hover { background: var(--surface-3); }

.user-menu__trigger { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; }
.user-menu__text { display: flex; flex-direction: column; line-height: 1.2; }
.user-menu__name { font-weight: 650; font-size: 14px; }
.user-menu__role { font-size: 12px; opacity: .75; }
.user-menu[open] .user-menu__chevron { transform: rotate(180deg); }

.avatar {
    display: inline-grid; place-items: center; flex: none;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--mark-bg); color: var(--mark-ink);
    font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.avatar--sm { width: 34px; height: 34px; font-size: 12.5px; background: var(--surface-3); color: var(--text-2); }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-header__text { min-width: 0; }
.page-header__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-title { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-subtitle { color: var(--muted); margin-top: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; margin-bottom: 10px; }
.back-link:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 8px 16px;
    border-radius: 10px; border: 1px solid transparent;
    font-weight: 600; font-size: 14.5px; line-height: 1.2;
    text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand-line); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-danger { background: var(--danger); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #2a0c0b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #2a0c0b; } }
.btn-danger:hover { filter: brightness(1.08); }
.btn-ghost-danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn-ghost-danger:hover { background: var(--danger-bg); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; border-radius: 9px; gap: 6px; }
.btn-lg { min-height: 48px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-square { width: 34px; padding: 0; }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ---------- Cards & layout ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; box-shadow: var(--shadow-sm);
}
.card + .card, .grid + .card, .stats + .card, .card + .grid { margin-top: 20px; }
.grid > .card { margin-top: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card--danger { border-color: var(--danger-line); }
.card--soon { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.card__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card__header .card__title { margin-bottom: 0; }
.card__title { font-size: 16.5px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.01em; }
.card__intro { color: var(--muted); margin: -8px 0 16px; font-size: 14px; }

.grid { display: grid; gap: 20px; }
.grid--main { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.stack-lg > .card + .card { margin-top: 0; }
.course-stack { margin: 20px 0; }
.course-stack .table .input--sm { min-width: 140px; }
.section + .section { margin-top: 36px; }
.section__header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section__title { font-size: 19px; font-weight: 720; }
.section__intro { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    display: flex; flex-direction: column; gap: 4px;
    padding: 18px 20px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); text-decoration: none;
    position: relative; overflow: hidden;
}
a.stat::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--brand); transform: scaleX(0); transform-origin: left; transition: transform .2s; }
a.stat:hover::after { transform: scaleX(1); }
.stat__label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.stat__value { font-size: 30px; font-weight: 760; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat__value--text { font-size: 21px; padding: 4px 0 3px; }
.stat__hint { color: var(--muted); font-size: 13px; }

/* ---------- Badges & chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 650; line-height: 1.5; white-space: nowrap;
    background: var(--surface-3); color: var(--text-2);
}
.badge--brand { background: var(--brand); color: var(--brand-ink); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }
.chip {
    display: inline-flex; align-items: center; gap: 6px; margin: 2px 4px 2px 0;
    padding: 2px 4px 2px 9px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface-2); font-size: 12.5px; font-weight: 550; white-space: nowrap;
}
.chip__sub { padding: 0 6px; border-radius: 5px; background: var(--surface-3); color: var(--muted); font-weight: 600; font-size: 11.5px; }

/* ---------- Alerts / notes ---------- */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; margin-bottom: 20px;
    border-radius: 12px; border: 1px solid; font-weight: 550; font-size: 14.5px;
}
.alert--success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.alert--error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.alert > span { flex: 1; color: var(--text); }
.alert__close { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 4px; border-radius: 6px; display: grid; }
.alert__close:hover { color: var(--text); }
.note {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 12px; margin-bottom: 16px; border-radius: 10px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 14px;
}

/* ---------- Forms ---------- */
.form-layout { max-width: 860px; display: flex; flex-direction: column; gap: 20px; }
.form-layout .card + .card { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field__label { font-weight: 600; font-size: 14px; color: var(--text); padding: 0; }
.field__help { color: var(--muted); font-size: 13px; }
.field__error { color: var(--danger); font-size: 13.5px; font-weight: 550; }
.field__static { padding: 9px 0; font-weight: 550; }

.input, .select, .textarea {
    width: 100%; min-height: 42px; padding: 9px 12px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 10px;
    transition: border-color .15s, box-shadow .15s;
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-line); box-shadow: var(--focus); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input--short { max-width: 200px; text-transform: uppercase; }
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.select {
    appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23697180' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center;
}
.select--sm { min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 14px; width: auto; min-width: 150px; }

.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 46px; }
.input-group__btn {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 34px; display: grid; place-items: center;
    border: 0; background: none; color: var(--muted); border-radius: 8px; cursor: pointer;
}
.input-group__btn:hover { color: var(--text); background: var(--surface-3); }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 36px; }

.checkbox { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14.5px; }
.checkbox input, .choice-card input {
    appearance: none; -webkit-appearance: none; flex: none;
    width: 20px; height: 20px; margin: 1px 0 0; border-radius: 6px;
    border: 1.5px solid var(--border-strong); background: var(--surface);
    display: grid; place-items: center; cursor: pointer; transition: background .12s, border-color .12s;
}
.checkbox input::after {
    content: ""; width: 10px; height: 6px; margin-top: -2px;
    border: solid var(--brand-ink); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) scale(0);
    transition: transform .12s;
}
.checkbox input:checked, .checkbox input:indeterminate { background: var(--brand); border-color: var(--brand-line); }
.checkbox input:checked::after { transform: rotate(-45deg) scale(1); }
.checkbox input:indeterminate::after { width: 10px; height: 0; margin: 0; border-width: 0 0 2.5px 0; transform: none; }
.checkbox input:focus-visible { box-shadow: var(--focus); }
.checkbox--strong { font-weight: 700; }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 550; padding: 6px 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track {
    position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px;
    background: var(--border-strong); transition: background .15s;
}
.switch__track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s;
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: var(--brand-ink); }
.switch input:focus-visible + .switch__track { box-shadow: var(--focus); }
.switch input:disabled + .switch__track { opacity: .5; }

.choice-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.choice-card {
    display: flex; gap: 12px; align-items: flex-start; padding: 14px;
    border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface);
}
.choice-card input { border-radius: 50%; }
.choice-card input:checked { border: 6px solid var(--brand); background: var(--surface); }
.choice-card:has(input:checked) { border-color: var(--brand-line); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--brand-line); }
.choice-card__body { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.choice-card__body span { color: var(--muted); }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.form-actions--sticky {
    position: sticky; bottom: 0; z-index: 5;
    margin: 0 -4px; padding: 14px 4px;
    background: linear-gradient(to bottom, transparent, var(--bg) 35%);
}
.danger-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.danger-form .field { flex: 1 1 260px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar__group { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar__search { flex: 1 1 260px; max-width: 380px; }
.toolbar .select { width: auto; min-width: 160px; }
.toolbar__spacer { flex: 1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
    text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); background: var(--surface-2);
    padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.card:not(.card--flush) .table th:first-child, .card:not(.card--flush) .table td:first-child { padding-left: 0; }
.card:not(.card--flush) .table th { background: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table td.actions > * { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.table td.actions form { display: inline-flex; }
.cell-notes { color: var(--text-2); max-width: 320px; }
.table-foot { color: var(--muted); font-size: 13.5px; margin-top: 10px; }

.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person__name { font-weight: 620; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.person > div { min-width: 0; }
.person__meta { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table .col-person { min-width: 240px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.pagination__info, .pagination__page { color: var(--muted); font-size: 13.5px; }
.pagination__links { display: flex; align-items: center; gap: 10px; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 36px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty__icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); margin-bottom: 6px; }
.empty__title { font-size: 16px; font-weight: 680; }
.empty__text { color: var(--muted); max-width: 42ch; font-size: 14px; }
.empty__actions { margin-top: 12px; display: flex; gap: 10px; }

/* ---------- Dashboard pieces ---------- */
.committee-list { display: flex; flex-direction: column; gap: 8px; }
.committee-tile {
    display: flex; align-items: center; gap: 14px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: 12px; text-decoration: none;
    transition: border-color .15s, background .15s;
}
.committee-tile:hover { border-color: var(--brand-line); background: var(--surface-2); }
.committee-tile__initial {
    display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 11px;
    background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 17px;
}
.committee-tile__initial--text { font-size: 13px; letter-spacing: .02em; }
.committee-tile__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.committee-tile__name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.committee-tile__meta { color: var(--muted); font-size: 13px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.committee-card {
    display: flex; flex-direction: column; gap: 8px; padding: 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.committee-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.committee-card.is-inactive { opacity: .7; }
.committee-card.is-inactive .committee-tile__initial { background: var(--surface-3); color: var(--muted); }
.committee-card__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 4px; }
.committee-card__name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.committee-card__desc { color: var(--muted); font-size: 14px; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.committee-card__stats { display: flex; gap: 16px; color: var(--text-2); font-size: 13.5px; font-weight: 550; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 6px; }
.committee-card__stats span { display: inline-flex; align-items: center; gap: 6px; }

.committee-head { margin-bottom: 24px; }
.committee-head__row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.committee-head__initial {
    display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 15px;
    background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 24px;
}
.committee-head__initial--text { font-size: 17px; letter-spacing: .02em; }
.committee-head__text { flex: 1; min-width: 200px; }

.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--text-2); font-weight: 600; text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.crumbs span { color: var(--muted); }

/* Section cards on a committee overview */
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 20px; }
.section-card {
    display: flex; align-items: flex-start; gap: 14px; padding: 18px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.section-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.section-card__icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.section-card__body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.section-card__name { font-weight: 720; font-size: 16.5px; }
.section-card__full { color: var(--text-2); font-size: 13.5px; font-weight: 550; }
.section-card__desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.section-card__arrow { color: var(--muted); margin-top: 12px; }
.section-card:hover .section-card__arrow { color: var(--brand); }

/* Tiles on a section page */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); text-decoration: none;
}
a.tile { transition: border-color .15s, box-shadow .15s; }
a.tile:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); }
.tile--soon { background: var(--surface-2); border-style: dashed; box-shadow: none; }
.tile__icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.tile--soon .tile__icon { background: var(--surface-3); color: var(--muted); }
.tile__title { font-weight: 700; font-size: 16px; }
.tile__value { font-size: 30px; font-weight: 760; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile__text { color: var(--muted); font-size: 14px; flex: 1; }
.tile__link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-weight: 650; font-size: 14px; color: var(--brand); }

.tabs { display: flex; gap: 4px; margin-top: 22px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs__link {
    position: relative; padding: 10px 14px 12px; color: var(--muted); text-decoration: none;
    font-weight: 600; font-size: 14.5px; white-space: nowrap;
}
.tabs__link:hover { color: var(--text); }
.tabs__link.is-active { color: var(--text); }
.tabs__link.is-active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.bars__row { display: grid; grid-template-columns: minmax(80px, 140px) 1fr 32px; align-items: center; gap: 12px; font-size: 14px; }
.bars__label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars__track { height: 10px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bars__fill { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.bars__value { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Activity ---------- */
.activity { list-style: none; margin: 0; padding: 0; }
.activity__item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.activity__item:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 42px; bottom: -6px; width: 2px; background: var(--border); }
.activity__icon { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.activity__icon--auth { background: var(--brand); color: var(--brand-ink); }
.activity__body { min-width: 0; padding-top: 5px; }
.activity__text { font-size: 14.5px; overflow-wrap: anywhere; }
.activity__meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- Roles ---------- */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.role-card {
    display: flex; flex-direction: column; gap: 8px; padding: 18px 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.role-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.role-card__name { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-card__usage { color: var(--muted); font-size: 13px; white-space: nowrap; padding-top: 2px; }
.role-card__desc { color: var(--text-2); font-size: 14px; }
.role-card__count { color: var(--muted); font-size: 13px; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.meter__fill { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.role-card__perms summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-2); padding: 2px 0; }
.role-card__perms ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.role-card__perms li { display: flex; gap: 6px; align-items: flex-start; }
.role-card__perms li .icon { color: var(--success); margin-top: 3px; }
.role-card__actions { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }

.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.perm-group { border: 1px solid var(--border); border-radius: 12px; padding: 0 16px 14px; margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.perm-group__head { padding: 12px 0 4px; width: 100%; float: left; }
.perm-group__head + * { clear: both; }
.perm { font-size: 14px; color: var(--text-2); }

.membership-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 20px; }
.membership-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 8px 8px 14px; border: 1px solid var(--border); border-radius: 10px;
}
.membership-row.is-member { border-color: var(--brand-line); box-shadow: inset 3px 0 0 var(--brand); }
.membership-row__name { font-weight: 580; font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }

.details { margin: 0 0 14px; }
.details > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.plain-list__row:last-child { border-bottom: 0; }

/* ---------- Modal ---------- */
.modal {
    width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 16px;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.modal--wide { width: min(640px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(10, 12, 16, .55); }
.modal[open] { animation: modal-in .16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal__header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 0; }
.modal__body { display: flex; gap: 14px; padding: 22px 22px 6px; margin: 0; }
.modal__icon { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--danger-bg); color: var(--danger); }
.modal__title { font-size: 17px; font-weight: 700; }
.modal__text { color: var(--text-2); margin-top: 6px; font-size: 14.5px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }
.modal__form { padding: 18px 20px 0; }
.modal__form .modal__actions { padding: 6px 0 20px; }

.segmented { display: flex; gap: 4px; margin: 16px 20px 0; padding: 4px; border-radius: 12px; background: var(--surface-3); }
.segmented__btn { flex: 1; border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); }
.segmented__btn[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }

/* ---------- Guest pages ---------- */
.guest {
    min-height: 100vh;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(22, 163, 74, .38), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(22, 163, 74, .22), transparent 60%),
        var(--bg);
}
.guest__main { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; }
.auth-card {
    width: min(420px, 100%); padding: 34px 30px 28px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-md);
}
.auth-card__brand { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; margin-bottom: 26px; }
.auth-card__brand .brand__mark { margin-bottom: 10px; }
.auth-card__title { font-size: 23px; font-weight: 760; letter-spacing: -.02em; }
.auth-card__subtitle { color: var(--muted); }
.auth-card__foot { text-align: center; color: var(--muted); font-size: 13.5px; margin-top: 20px; }
.error-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.error-card .btn { margin-top: 14px; }
.error-card__code { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .1em; margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .grid--main { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
    .sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 16, .5); }
    .shell { margin-left: 0; }
    .topbar { padding: 0 12px; }
    .topbar__menu, .brand--compact { display: inline-flex; }
    .sidebar__close { display: inline-grid; }
    .content { padding: 22px 16px 56px; }
    .grid--two, .form-grid, .membership-grid, .choice-cards { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    body { font-size: 15px; }
    .user-menu__text, .user-menu__chevron { display: none; }
    .page-title { font-size: 22px; }
    .page-header { align-items: stretch; }
    .page-header__actions { width: 100%; }
    .page-header__actions .btn { flex: 1; }
    .card { padding: 18px 16px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .stat { padding: 14px; }
    .stat__value { font-size: 25px; }
    .toolbar__search { max-width: none; flex-basis: 100%; }
    .toolbar .select { flex: 1 1 140px; min-width: 0; }
    .toolbar__spacer { display: none; }
    .toolbar > .btn { flex: 1; }

    /* Tables become stacked cards: each cell shows its column name. */
    .table--stack thead { display: none; }
    .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
    .table--stack tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
    .table--stack tbody tr:last-child { border-bottom: 0; }
    .table--stack td { border: 0; padding: 4px 0 !important; text-align: left !important; }
    .table--stack td[data-label]:not([data-label="Name"]):not([data-label="Member"]):not([data-label="Committee"])::before {
        content: attr(data-label); display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
        letter-spacing: .05em; color: var(--muted); margin-bottom: 2px;
    }
    .table--stack td.num { width: auto; }
    .table--stack td.is-empty { display: none; }
    .table--stack td[data-label="#"] { display: none; }
    .table--stack td.actions { width: auto; padding-top: 10px !important; display: flex; flex-wrap: wrap; gap: 6px; }
    .table--stack td.actions:empty { display: none; }
    .table--stack td.actions > * { margin-left: 0; }
    .card:not(.card--flush) .table--stack tr { padding-left: 0; padding-right: 0; }

    .form-actions { position: sticky; bottom: 0; }
    .form-actions .btn { flex: 1; }
    .bars__row { grid-template-columns: 90px 1fr 28px; }
    .modal__actions .btn { flex: 1; }
}

/* ======================================================================
   TCI modules: classes, reports, meetings, courses, teachers, proxies, plannings
   ====================================================================== */
.small { font-size: 13px; }
.text-warning { color: var(--warning); font-weight: 600; }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.note--warning { background: var(--warning-bg); border-color: var(--warning-line); color: var(--text); margin: 16px 0 0; }
.note--warning .icon { color: var(--warning); }
.note--success { background: var(--success-bg); border-color: var(--success-line); color: var(--text); }
.note--success .icon { color: var(--success); }
.prose { white-space: normal; line-height: 1.65; }
.subhead { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.link--button { background: none; border: 0; padding: 0; cursor: pointer; margin-top: 12px; }
.textarea--sm { min-height: 64px; }
.input--sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.input--mini { width: 64px; min-height: 34px; padding: 4px 8px; text-align: center; }
.form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.danger-link { margin-top: 18px; }
.stat__of { font-size: 18px; color: var(--muted); font-weight: 600; }
.card__header-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.card__header--padded { padding: 18px 22px 0; margin-bottom: 12px; }
.card__footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.tabs--page { margin: 0 0 20px; }
.btn-icon--sm { width: 32px; height: 32px; color: var(--muted); }
.btn-icon--sm:hover { color: var(--danger); background: var(--danger-bg) !important; }
.details--inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 24px; margin: 0; }
.table--compact th, .table--compact td { padding: 8px 10px; }
.table--compact tbody th { text-align: left; color: var(--muted); font-weight: 600; font-size: 13.5px; text-transform: none; letter-spacing: 0; background: none; }
.row--missing td { background: var(--surface-2); }

.segmented--inline { margin: 0; display: inline-flex; flex-wrap: wrap; }
a.segmented__btn { text-decoration: none; text-align: center; }
.segmented__btn--radio { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 72px; }
.segmented__btn--radio input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented__btn--radio:has(input:checked) { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.segmented__btn--radio:has(input:focus-visible) { box-shadow: var(--focus); }

.copy-field { display: flex; gap: 8px; }
.copy-field .input { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-2); background: var(--surface-2); }

.check-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; padding: 4px 2px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.check-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; font-weight: 550; font-size: 14px; }
.check-card input { width: 18px; height: 18px; accent-color: var(--brand); }
.check-card:has(input:checked) { border-color: var(--brand-line); background: var(--brand-soft); }

.row-list { list-style: none; margin: 0; padding: 0; }
.row-list__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.row-list__item:last-child { border-bottom: 0; }
.row-list__main { min-width: 0; flex: 1; }
.row-list__link { text-decoration: none; }
.row-list__link:hover .row-list__title { color: var(--brand); }
.row-list__title { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-list__meta { color: var(--muted); font-size: 13.5px; }
.row-list__actions { display: flex; gap: 6px; align-items: center; }
.row-list__actions form { display: inline-flex; }

/* Committee structure */
.structure { margin-bottom: 20px; }
.structure__leaders { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px dashed var(--border-strong); }
.person-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.person-pill--lead { border-color: var(--brand-line); background: var(--brand-soft); }
.person-pill--lead .avatar { background: var(--brand); color: var(--brand-ink); }
.person-pill__name { display: block; font-weight: 700; line-height: 1.2; }
.person-pill__role { display: block; font-size: 12.5px; color: var(--muted); }
.structure__sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.structure__section { border: 1px solid var(--border); border-top: 3px solid var(--brand); border-radius: 12px; padding: 14px 16px; background: var(--surface); }
.structure__name { font-size: 15px; font-weight: 720; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.structure__count { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 700; }
.structure__desc { color: var(--muted); font-size: 13px; margin: -4px 0 8px; }
.structure__member { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.structure__member:last-child { border-bottom: 0; }
.structure__member-name { font-weight: 560; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.structure__empty { color: var(--muted); font-size: 13.5px; font-style: italic; }

/* Class cards */
.class-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.class-card:hover { border-color: var(--brand-line); box-shadow: var(--shadow-md); }
.class-card.is-inactive { opacity: .75; }
.class-card__link { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px; text-decoration: none; flex: 1; }
a.class-card.class-card__link { padding: 18px 20px; }
.class-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.class-card__name { font-size: 17px; font-weight: 720; }
.class-card__facts { margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--text-2); }
.class-card__facts > div { display: flex; gap: 8px; align-items: center; }
.class-card__facts dt { color: var(--muted); display: flex; }
.class-card__facts dd { margin: 0; }
.class-card__stats { display: flex; gap: 16px; font-size: 13.5px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--border); margin-top: auto; flex-wrap: wrap; }
.class-card__stats strong { color: var(--text); }
.class-card__foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.pick-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.pick-item { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; box-shadow: var(--shadow-sm); }
.pick-item:hover { border-color: var(--brand-line); }
.pick-item__icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.pick-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pick-item__name { font-weight: 700; font-size: 16px; }
.pick-item__meta { color: var(--muted); font-size: 13.5px; }
.pick-item__arrow { color: var(--muted); }

.meter-inline { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--surface-3); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.meter-inline__fill { display: block; height: 100%; background: var(--brand); }

/* Date and time inputs */
.date-input { position: relative; display: flex; }
.date-input .input { padding-right: 46px; }
.date-input__icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.date-input__field { cursor: pointer; caret-color: transparent; }
.date-input:hover .date-input__field { border-color: var(--border-strong); }
.date-input:hover .date-input__icon { color: var(--brand); }

/* Calendar */
.calendar { width: min(340px, calc(100vw - 24px)); padding: 0; }
.calendar__head { display: flex; flex-direction: column; gap: 2px; padding: 16px 20px 14px; background: var(--brand); color: var(--brand-ink); }
.calendar__year { font-size: 14px; font-weight: 650; opacity: .8; }
.calendar__picked { font-size: 26px; font-weight: 760; letter-spacing: -.01em; line-height: 1.15; }
.calendar__nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 2px; }
.calendar__nav .btn-icon { font-size: 22px; line-height: 1; width: 38px; height: 38px; }
.calendar__title { border: 0; background: transparent; font-weight: 700; font-size: 15px; padding: 8px 12px; border-radius: 9px; cursor: pointer; color: var(--text); }
.calendar__title:hover { background: var(--surface-3); }
.calendar__title:focus-visible { box-shadow: var(--focus); outline: none; }
.calendar__body { padding: 4px 12px 4px; min-height: 284px; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.calendar__dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.calendar__day { aspect-ratio: 1; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--text); font-size: 14.5px; font-weight: 550; cursor: pointer; font-variant-numeric: tabular-nums; }
.calendar__day:hover { background: var(--brand-soft); }
.calendar__day:focus-visible { outline: none; box-shadow: var(--focus); }
.calendar__day.is-outside { color: var(--muted); opacity: .55; }
.calendar__day.is-today { box-shadow: inset 0 0 0 1.5px var(--brand); color: var(--brand); font-weight: 750; }
.calendar__day.is-selected { background: var(--brand); color: var(--brand-ink); box-shadow: none; font-weight: 750; }
.calendar__day:disabled { opacity: .3; cursor: not-allowed; background: transparent; }
.calendar__months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 12px; }
.calendar__month { border: 1.5px solid var(--border); background: var(--surface); border-radius: 10px; padding: 16px 0; font-weight: 650; cursor: pointer; color: var(--text); }
.calendar__month:hover { border-color: var(--brand); }
.calendar__month.is-selected { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.calendar__actions { padding: 8px 16px 16px; }
.time-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; font-variant-numeric: tabular-nums; }
.time-trigger .icon { color: var(--muted); }
.time-trigger.is-empty .time-trigger__text { color: var(--muted); }
.time-trigger.is-empty .time-trigger__text:empty::before { content: "Choose time"; }
.time-trigger:hover { border-color: var(--muted); }

.clock { width: min(340px, calc(100vw - 24px)); padding: 0; }
.clock__display { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 20px 16px 6px; background: var(--brand); color: var(--brand-ink); }
.clock__part { font-size: 40px; font-weight: 760; line-height: 1; border: 0; background: transparent; color: inherit; opacity: .6; padding: 4px 6px; border-radius: 10px; cursor: pointer; font-variant-numeric: tabular-nums; }
.clock__part.is-active { opacity: 1; background: rgba(255, 255, 255, .16); }
.clock__colon { font-size: 36px; font-weight: 700; opacity: .7; }
.clock__ampm { display: flex; flex-direction: column; gap: 4px; margin-left: 12px; }
.clock__ampm button { border: 1.5px solid currentColor; background: transparent; color: inherit; border-radius: 7px; padding: 2px 8px; font-weight: 700; font-size: 13px; cursor: pointer; opacity: .65; }
.clock__ampm button[aria-pressed="true"] { opacity: 1; background: var(--brand-ink); color: var(--brand); border-color: var(--brand-ink); }
.clock__hint { text-align: center; padding: 0 0 12px; background: var(--brand); color: var(--brand-ink); font-size: 13px; opacity: .9; }
.clock__face { position: relative; width: 248px; height: 248px; margin: 18px auto 6px; border-radius: 50%; background: var(--surface-3); touch-action: none; cursor: pointer; user-select: none; }
.clock__face:focus-visible { box-shadow: var(--focus); }
.clock__num { position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 0; background: transparent; color: var(--text); font-weight: 650; font-size: 15px; pointer-events: none; z-index: 1; }
.clock__num.is-selected { background: var(--brand); color: var(--brand-ink); }
.clock__hand { position: absolute; left: 50%; bottom: 50%; width: 2px; height: 40%; margin-left: -1px; background: var(--brand); transform-origin: bottom center; border-radius: 2px; }
.clock__center { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--brand); }
.clock__actions { padding: 12px 16px 16px; }
.clock__spacer { flex: 1; }

/* Report forms */
.report-form { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.report-form .card + .card { margin-top: 0; }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 13px; font-weight: 800; margin-right: 8px; vertical-align: 1px; }
.field__note { font-size: 13px; color: var(--muted); min-height: 1em; }
.field__note.is-warning { color: var(--warning); font-weight: 600; }
.field__note.is-ok { color: var(--success); font-weight: 600; }
.timing-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

.last-report { padding: 0; margin-bottom: 16px; }
.last-report__head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; color: var(--text-2); }
.last-report__head::-webkit-details-marker { display: none; }
.last-report__chevron { margin-left: auto; transition: transform .15s; }
.last-report[open] .last-report__chevron { transform: rotate(180deg); }
.last-report__body { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 10px; }
.summary-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; }
.summary-row dt { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.summary-row dd { margin: 0; font-weight: 650; }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.subject-box { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1.5px solid var(--border); border-radius: 12px; background: var(--surface); transition: border-color .15s; }
.subject-box.is-filled { border-color: var(--brand-line); box-shadow: inset 3px 0 0 var(--brand); }
.subject-box__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.subject-box__name { font-weight: 700; }
.subject-box__std { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.subject-box__row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.input-suffix { position: relative; width: 120px; }
.input-suffix .input { padding-right: 40px; }
.input-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }

.chip-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-choice { position: relative; display: inline-flex; }
.chip-choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip-choice span { padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--border-strong); font-weight: 600; font-size: 14px; }
.chip-choice input:checked + span { background: var(--brand); border-color: var(--brand-line); color: var(--brand-ink); }
.chip-choice input:focus-visible + span { box-shadow: var(--focus); }

/* Attendance */
.status-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.status-count { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.status-count b { color: var(--st, var(--text)); font-size: 14px; }
button.status-count { cursor: pointer; }
button.status-count[aria-pressed="true"] { background: var(--st); border-color: var(--st); color: var(--st-ink); }
button.status-count[aria-pressed="true"] b { color: var(--st-ink); }
.status--present { --st: var(--st-present); }
.status--absent { --st: var(--st-absent); }
.status--late { --st: var(--st-late); }
.status--legal_late { --st: var(--st-legal_late); }
.status--leave { --st: var(--st-leave); }
.status--online { --st: var(--st-online); }
.status-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--st); color: var(--st-ink); }

.att-search { max-width: 320px; margin-bottom: 10px; }
.att-list { list-style: none; margin: 0 0 14px; padding: 0; }
.att-row { display: flex; align-items: center; gap: 10px 16px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.att-row:last-child { border-bottom: 0; }
.att-row__name { flex: 1 1 180px; font-weight: 600; min-width: 0; }
.att-row__meta { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.att-row__pick { display: flex; gap: 6px; align-items: center; flex: 1 1 260px; min-width: 0; }
.att-row__pick .select, .att-row__pick .input { flex: 1; min-width: 0; }
.att-row > .field__error { flex-basis: 100%; }
.att-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.status-buttons { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.status-btn { position: relative; display: inline-flex; }
.status-btn input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.status-btn > span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1.5px solid var(--border-strong); color: var(--st); font-weight: 750; font-size: 13.5px; background: var(--surface); }
.status-btn input:checked + span { background: var(--st); border-color: var(--st); color: var(--st-ink); }
.status-btn input:focus-visible + span { box-shadow: var(--focus); }
.status-btn__full { display: none; }
.att-late, .mode-toggle { display: none; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.att-row[data-status="late"] .att-late, .att-row[data-status="legal_late"] .att-late { display: inline-flex; }
.att-row[data-status="present"] .mode-toggle, .att-row[data-status="late"] .mode-toggle, .att-row[data-status="legal_late"] .mode-toggle { display: inline-flex; }
.mode-toggle { gap: 0; border: 1.5px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.mode-btn { position: relative; display: inline-flex; }
.mode-btn input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.mode-btn span { padding: 6px 10px; font-weight: 650; font-size: 12.5px; color: var(--text-2); }
.mode-btn input:checked + span { background: var(--surface-3); color: var(--text); }
.mode--online input:checked + span { background: var(--st-online); color: var(--st-ink); }
.mode-btn input:focus-visible + span { box-shadow: inset var(--focus); }
.att-extra { border-top: 1px dashed var(--border-strong); padding-top: 4px; }
.att-row--extra { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; border: 0; margin-bottom: 8px; }

.att-view { list-style: none; margin: 0; padding: 0; columns: 2 320px; column-gap: 28px; }
.att-view__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); break-inside: avoid; }
.att-view__name { font-weight: 560; }
.att-view__status { display: inline-flex; gap: 6px; align-items: center; }

.submit-bar {
    position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; margin: 0 -4px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-md);
}
.submit-bar__summary { flex: 1; color: var(--text-2); font-weight: 600; font-size: 14px; }

/* Repeatable lists (agenda, decisions, key points, action items) */
.repeat-list, .action-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.repeat-item { display: flex; align-items: center; gap: 8px; }
.repeat-item .input { flex: 1; }
.repeat-item__num { flex: none; width: 24px; text-align: right; color: var(--muted); font-weight: 700; font-size: 13px; }
.action-item { display: flex; align-items: flex-start; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.action-item .repeat-item__num { margin-top: 10px; }
.action-item__fields { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.action-item__row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.action-item__row .select { width: 100%; }

/* Minutes and reports (read view) */
.minutes { max-width: 900px; }
.minutes__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 24px; margin: 0 0 8px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.minutes__facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.minutes__facts dd { margin: 2px 0 0; font-weight: 600; }
.minutes__heading { font-size: 15px; font-weight: 750; margin: 22px 0 8px; padding-left: 10px; border-left: 3px solid var(--brand); }
.minutes__sub { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.minutes__attendance { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; }
.minutes__attendance p { font-size: 14px; color: var(--text-2); }
.minutes__list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.minutes__foot { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* Proxies */
.proxy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-bottom: 20px; }
.proxy-grid .card + .card { margin-top: 0; }
.proxy-card { scroll-margin-top: 80px; }
.proxy-card:target { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft); }
.proxy-card__head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.proxy-card__head .card__title { margin: 0; }
.proxy-card__teacher { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-2); }
.proxy-list { list-style: none; margin: 0 0 12px; padding: 0; }
.proxy-list__item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-weight: 560; }
.proxy-add > summary, .plan-add > summary { list-style: none; display: inline-flex; }
.proxy-add > summary::-webkit-details-marker, .plan-add > summary::-webkit-details-marker { display: none; }
.proxy-add[open] > summary, .plan-add[open] > summary { margin-bottom: 12px; }

/* Plannings */
.plan-groups { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.plan-groups .card + .card { margin-top: 0; }
.plan-group { scroll-margin-top: 80px; border-top: 3px solid var(--brand); }
.plan-points { list-style: none; margin: 0 0 14px; padding: 0; counter-reset: point; }
.plan-point { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); counter-increment: point; }
.plan-point::before { content: counter(point); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: 13px; }
.plan-point__main { flex: 1; min-width: 0; }
.plan-point__title { font-weight: 650; }
.plan-point__details { color: var(--text-2); font-size: 14px; margin-top: 2px; }
.plan-point__meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.plan-point__actions { display: flex; gap: 4px; }
.plan-point__actions form { display: inline-flex; }

/* Collapsible sidebar (desktop) */
.sidebar__collapse { width: 100%; border: 0; background: none; cursor: pointer; text-align: left; }
@media (min-width: 901px) {
    .sidebar-animating .sidebar, .sidebar-animating .shell { transition: width .18s ease, margin-left .18s ease; }
    .sidebar-collapsed { --sidebar-w: 72px; }
    .sidebar-collapsed .sidebar { overflow: visible; }
    .sidebar-collapsed .sidebar__brand { padding: 0; justify-content: center; }
    .sidebar-collapsed .brand__name,
    .sidebar-collapsed .nav-link > span,
    .sidebar-collapsed .nav-group__name,
    .sidebar-collapsed .nav-group__chevron { display: none; }
    .sidebar-collapsed .nav-label { height: 1px; margin: 12px 8px; background: var(--border); font-size: 0; }
    .sidebar-collapsed .sidebar__nav { padding: 12px 10px; }
    .sidebar-collapsed .sidebar__foot { padding: 10px; }
    .sidebar-collapsed .nav-link { justify-content: center; padding: 10px 0; }
    .sidebar-collapsed .nav-group__head { justify-content: center; padding: 8px 0; }
    .sidebar-collapsed .nav-group__items { margin: 2px 0 6px; padding: 0; border-left: 0; }
    .sidebar-collapsed .nav-group__items .nav-link { padding: 8px 0; }
    .sidebar-collapsed .sidebar__collapse .icon { transform: scaleX(-1); }
}
@media (max-width: 900px) {
    .sidebar__collapse { display: none; }
}

/* Responsive tweaks for the new screens */
@media (max-width: 900px) {
    .timing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid--three { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .att-row { gap: 8px; }
    .att-row__name { flex-basis: 100%; }
    .status-btn > span { min-width: 38px; padding: 0 8px; }
    .submit-bar { margin: 0 -8px; border-radius: 14px 14px 0 0; flex-wrap: wrap; }
    .submit-bar__summary { flex-basis: 100%; }
    .submit-bar .btn { flex: 1; }
    .action-item__row { grid-template-columns: minmax(0, 1fr); }
    .copy-field { flex-direction: column; }
    .row-list__item { padding: 12px 16px; }
    .card__header--padded { padding: 16px 16px 0; }
}

/* ---------- Round 4: link forms, topics, agendas, feedback, achievements, inspections ---------- */
.nav-divider { border: 0; height: 1px; background: var(--border); margin: 6px 10px 6px 4px; }
.stats--five { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.group-heading { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 4px 0 10px; }

/* Standalone forms opened by link (no menu) */
.form-page { min-height: 100vh; }
.form-page__bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px max(16px, calc((100% - 860px) / 2)); background: var(--topbar); color: var(--topbar-ink); box-shadow: var(--shadow-sm); }
.form-page__inner { flex: 1; min-width: 0; }
.form-page__title { font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.form-page__sub { font-size: 14px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-page__bar .theme-toggle { color: inherit; }
.form-page__main { max-width: 860px; margin: 0 auto; padding: 20px 16px 120px; }
.form-page__main > .card, .form-page__main > form > .card { margin-bottom: 16px; }
.form-page__message { max-width: 520px; margin: 40px auto; }
.thanks { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 24px 8px; }
.thanks .icon { color: var(--success); }
.thanks h2 { font-size: 22px; }

/* Repeating rows (topics, agenda) */
.topic-list, .agenda-rows { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: none; }
.topic-row, .agenda-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.repeat-item__num { display: grid; place-items: center; width: 26px; height: 26px; margin-top: 6px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: 13px; }
.topic-row__fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.topic-row__top { display: grid; grid-template-columns: minmax(0, 1fr) 130px 170px; gap: 12px; }
.topic-row .field, .agenda-row .field { margin: 0; }
.agenda-row__fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 150px 150px; gap: 8px; min-width: 0; }
.time-trigger__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-row__error { grid-column: 2 / -1; margin: 0; }
.topics-table td, .agenda-table td { vertical-align: top; }
.topics-table__points { margin: 0; padding-left: 18px; }
.topics-table__points li + li { margin-top: 2px; }

/* Ratings 1-5 */
.rating-field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.rating { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.rating__option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); text-align: center; }
.rating__option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.rating__num { font-size: 18px; font-weight: 750; line-height: 1.1; }
.rating__text { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.rating__option:has(input:checked) { background: var(--brand); border-color: var(--brand-line); color: var(--brand-ink); }
.rating__option:has(input:checked) .rating__text { color: inherit; }
.rating__option:has(input:focus-visible) { box-shadow: var(--focus); }

/* Course report */
.att-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 28px; }
.att-view--single { columns: 1; }
.bars__row--wide { grid-template-columns: minmax(120px, 2fr) minmax(80px, 2fr) 40px; }
.feedback-list { list-style: none; margin: 0; padding: 0; }
.feedback-item { padding: 12px 0; border-top: 1px solid var(--border); }
.feedback-item:first-child { border-top: 0; padding-top: 0; }
.feedback-item__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.feedback-item__text { font-size: 14px; margin-top: 4px; white-space: pre-line; }
.feedback-item__label { font-weight: 650; color: var(--text-2); }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-actions form { margin: 0; }
.input-suffix--wide { width: 170px; }
.input-suffix--wide .input { padding-right: 64px; }

/* Plannings and achievements */
.month-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.chip-choice--sm { display: flex; }
.chip-choice--sm span { flex: 1; text-align: center; padding: 6px 4px; font-size: 13px; border-radius: 8px; }
.achievement--not_started { --ach: var(--muted); --ach-bg: var(--surface-3); }
.achievement--in_progress { --ach: #1d63c9; --ach-bg: #e7f0fd; }
.achievement--on_hold { --ach: var(--warning); --ach-bg: var(--warning-bg); }
.achievement--completed { --ach: var(--success); --ach-bg: var(--success-bg); }
.achievement--dropped { --ach: var(--danger); --ach-bg: var(--danger-bg); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .achievement--in_progress { --ach: #8ab8ff; --ach-bg: #15253d; } }
:root[data-theme="dark"] .achievement--in_progress { --ach: #8ab8ff; --ach-bg: #15253d; }
.badge[class*="achievement--"] { background: var(--ach-bg); color: var(--ach); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ach, var(--brand)); }
.progress-label { display: inline-flex; align-items: center; font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.achievements { list-style: none; margin: 0; padding: 0; }
.achievement { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 16px; padding: 14px 0; border-top: 1px solid var(--border); }
.achievement:first-child { border-top: 0; padding-top: 4px; }
.achievement:not(:has(.achievement__form)) { grid-template-columns: minmax(0, 1fr); }
.achievement__title { font-weight: 650; }
.achievement__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; }
.achievement__meta .icon { display: inline; vertical-align: -1px; }
.achievement__reason { margin-top: 6px; font-size: 14px; color: var(--text-2); padding-left: 10px; border-left: 3px solid var(--ach, var(--border)); white-space: pre-line; }
.achievement__history { margin-top: 6px; font-size: 13px; }
.achievement__history summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.achievement__history ol { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.achievement__form { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.achievement__form .select { width: 100%; }
.achievement__form .btn { align-self: flex-end; }

@media (max-width: 900px) {
    .agenda-row__fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .agenda-row__fields > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .topic-row, .agenda-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px; }
    .topic-row .repeat-item__num, .agenda-row .repeat-item__num { display: none; }
    .topic-row__top { grid-template-columns: minmax(0, 1fr); }
    .agenda-row__error { grid-column: 1 / -1; }
    .rating__text { font-size: 10.5px; }
    .month-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .achievement { grid-template-columns: minmax(0, 1fr); }
    .form-page__main { padding: 16px 12px 120px; }
}

/* ---------- Round 5: course plan and report, meetings ---------- */
.grid--three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.grid--three > .card { margin-bottom: 0; }
.form-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-block--first { margin-top: 0; padding-top: 0; border-top: 0; }
.form-block__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.form-block__head .form-block__title { margin: 0; }
.form-block__title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.form-block__title .optional { font-weight: 500; }
.inline-actions--tight { gap: 14px; margin-bottom: 10px; }
.form-block__head .inline-actions--tight { margin-bottom: 0; }
.agenda-head { display: grid; grid-template-columns: 28px minmax(0, 2fr) minmax(0, 1fr) 150px 150px 34px; gap: 8px; padding: 0 12px 6px 12px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.agenda-head span:first-child { grid-column: 1; }
.person-rows { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.person-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.person-row .repeat-item__num { margin-top: 0; }
.person-row__fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-width: 560px; }
.person-row__fields--two { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); max-width: 680px; }
.person-row__error { grid-column: 2 / -1; margin: 0; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.result-row:last-child { border-bottom: 0; }
.result-row__name { font-weight: 600; }
.result-row > .field__error { flex-basis: 100%; margin: 0; }
.people-list { list-style: none; margin: 0; padding: 0; }
.people-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.people-list li:last-child { border-bottom: 0; }
.chip-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list .chip { display: inline-flex; gap: 6px; align-items: center; }
.badge--sm { font-size: 11px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.check-card > span { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
@media (max-width: 1080px) {
    .grid--three { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
    .agenda-head { display: none; }
}
@media (max-width: 640px) {
    .person-row { grid-template-columns: minmax(0, 1fr) auto; }
    .person-row .repeat-item__num { display: none; }
    .person-row__fields--two { grid-template-columns: minmax(0, 1fr); }
    .person-row__error { grid-column: 1 / -1; }
}

/* Choice buttons keep their own width and stay on one line */
.field > .segmented--inline, .result-row .segmented--inline { align-self: flex-start; }
.segmented__btn { white-space: nowrap; }
@media (max-width: 640px) { .field > .segmented--inline { align-self: stretch; } }

/* Wide tables scroll inside their card instead of widening the page */
.shell, .content { min-width: 0; }
.table td .chip { white-space: normal; }

/* Spacing between fields that sit straight inside a card */
.card > .field + .field, .card > .field + .form-grid, .card > .form-grid + .field, .card > .form-grid + .form-grid,
.card > fieldset + .form-grid, .card > .att-list + .field, .card > .card__header + .form-grid { margin-top: 16px; }
.field--spaced { margin-top: 16px; }
.form-grid > .field--full { grid-column: 1 / -1; }
.input-suffix--full { width: 100%; }
.input-suffix--full .input { padding-right: 44px; }
.topic-row__carried { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12.5px; font-weight: 650; color: var(--brand); background: var(--brand-soft); padding: 3px 10px; border-radius: 999px; margin: 0; }
.chip-choices--sm { gap: 6px; }
.chip-choices--sm .chip-choice span { padding: 5px 12px; font-size: 13px; border-width: 1.5px; }
.topic-status--new { background: var(--surface-3); color: var(--text-2); }
.topic-status--in_progress { background: #e7f0fd; color: #1d63c9; }
.topic-status--on_hold { background: var(--warning-bg); color: var(--warning); }
.topic-status--done { background: var(--success-bg); color: var(--success); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topic-status--in_progress { background: #15253d; color: #8ab8ff; } }
:root[data-theme="dark"] .topic-status--in_progress { background: #15253d; color: #8ab8ff; }
@media (max-width: 640px) {
    .topic-row__top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .topic-row__top > .field:first-child { grid-column: 1 / -1; }
}

/* Print: just the content */
@media print {
    .sidebar, .topbar, .form-page__bar .theme-toggle, .sidebar-backdrop, .page-header__actions, .no-print, .alert, .tabs, .skip-link, .submit-bar, .danger-link { display: none !important; }
    .shell { margin: 0 !important; }
    .content { padding: 0; max-width: none; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
    .status-pill, .status-btn input:checked + span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

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