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

:root {
    --bg:           #f5f0e8;
    --bg2:          #ede7d9;
    --surface:      #faf7f2;
    --surface2:     #f0ebe0;
    --border:       #d8cfc0;
    --border-light: #e8e2d8;
    --ink:          #1a1612;
    --ink2:         #3d3528;
    --ink3:         #6b5f4f;
    --ink4:         #9a8e7e;
    --ink5:         #c4b8a8;
    --red:          #c0392b;
    --red-bg:       #fdf0ee;
    --red-border:   #e8b5b0;
    --green:        #2d6a4f;
    --green-bg:     #eef5f1;
    --green-border: #a8cdb9;
    --gold:         #8b6914;
    --gold-bg:      #fdf6e3;
    --gold-border:  #d4b56a;
    --blue:         #1a4a7a;
    --blue-bg:      #eef2f8;
    --blue-border:  #a8bcd8;

    --radius-sm: 6px;
    --radius:    12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(26,22,18,0.06), 0 1px 2px rgba(26,22,18,0.04);
    --shadow:    0 4px 16px rgba(26,22,18,0.08), 0 2px 6px rgba(26,22,18,0.04);
    --shadow-lg: 0 12px 40px rgba(26,22,18,0.12), 0 4px 12px rgba(26,22,18,0.06);
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Epilogue', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

/* ─── TEXTURE ─── */
body::before {
    content: '';
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background-image:
            repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 24px,
                    rgba(26,22,18,0.018) 24px,
                    rgba(26,22,18,0.018) 25px
            );
}

/* ─── SCREENS ─── */
.screen { display: none; position: relative; z-index: 1; min-height: 100dvh; }
.screen.active { display: flex; }

/* ════════════════════════════════════════
   LOGIN SCREEN
════════════════════════════════════════ */
#screen-login {
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 1.5rem) 1.5rem env(safe-area-inset-bottom, 1.5rem);
    background: var(--bg);
}

.login-wrap {
    width: 100%;
    max-width: 400px;
    position: relative;
}

/* Big decorative number */
.login-decor-num {
    position: absolute;
    top: -60px;
    right: -20px;
    font-family: 'Fraunces', serif;
    font-size: 180px;
    font-weight: 700;
    color: rgba(26,22,18,0.04);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.login-tag {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 5px 14px 5px 8px;
    margin-bottom: 2rem;
}
.login-tag-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px var(--green-bg);
}
.login-tag span {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink3);
}

.login-h1 {
    font-family: 'Fraunces', serif;
    font-size: clamp(2.4rem, 9vw, 3.2rem);
    font-weight: 600;
    color: var(--ink);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}
.login-h1 em {
    font-style: italic;
    font-weight: 300;
    color: var(--ink3);
}

.login-sub {
    font-size: 14px;
    color: var(--ink4);
    margin-bottom: 2.5rem;
    font-weight: 300;
}

/* ─── FIELDS ─── */
.field { margin-bottom: 1rem; }
.field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink3);
    margin-bottom: 6px;
}
.field input, .field select {
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 13px 16px;
    color: var(--ink);
    font-family: 'Epilogue', sans-serif;
    font-size: 15px;
    font-weight: 400;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    -webkit-appearance: none;
    appearance: none;
}
.field input:focus, .field select:focus {
    border-color: var(--ink2);
    box-shadow: 0 0 0 3px rgba(26,22,18,0.06);
    background: #fff;
}
.field input::placeholder { color: var(--ink5); }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b5f4f' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.field select option { background: #fff; color: var(--ink); }

/* ─── BUTTONS ─── */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; border: none; cursor: pointer;
    font-family: 'Epilogue', sans-serif; font-weight: 600;
    transition: all 0.18s; position: relative; overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    width: 100%;
    background: var(--ink);
    color: var(--bg);
    padding: 15px 24px;
    border-radius: var(--radius);
    font-size: 15px;
    margin-top: 0.5rem;
    letter-spacing: 0.02em;
}
.btn-primary:hover:not(:disabled) {
    background: var(--ink2);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--ink3);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.btn-outline:hover { border-color: var(--ink3); color: var(--ink); }

.btn-danger-soft {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    color: var(--red);
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.btn-danger-soft:hover { background: #fae4e1; }

/* ─── MESSAGES ─── */
.msg {
    margin-top: 1rem; padding: 12px 16px;
    border-radius: var(--radius); font-size: 14px; display: none;
}
.msg.show { display: flex; align-items: flex-start; gap: 10px; opacity: 1; transition: opacity 0.4s ease; }
.msg.show.msg-fade { opacity: 0; }
.msg-error { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red); }
.msg-success { background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); }
.msg-icon { flex-shrink: 0; font-size: 15px; margin-top: 1px; }

/* ─── SPINNER ─── */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(245,240,232,0.3);
    border-top-color: var(--bg);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
.spinner-dark {
    border-color: rgba(26,22,18,0.15);
    border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   DASHBOARD — DESKTOP (≥ 800px)
════════════════════════════════════════ */
#screen-dashboard { flex-direction: column; }

.app-layout {
    display: flex;
    min-height: 100dvh;
    width: 100%;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 28px 18px;
    position: sticky;
    top: 0;
    height: 100dvh;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 24px;
}
.logo-mark {
    width: 40px; height: 40px;
    background: var(--ink);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.logo-text-main {
    font-family: 'Fraunces', serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
}
.logo-text-sub {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink4);
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink5);
    padding: 0 10px;
    margin-bottom: 4px;
    margin-top: 18px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink3);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { background: var(--bg2); color: var(--ink); }
.nav-item.active { background: var(--ink); color: var(--bg); }
.nav-item.active .nav-icon { opacity: 1; }
.nav-icon {
    font-size: 15px; width: 22px; text-align: center;
    opacity: 0.7; flex-shrink: 0;
}

.sidebar-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 18px;
    margin-top: auto;
}
.user-chip {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg2);
    margin-bottom: 10px;
}
.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Fraunces', serif;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.3; }
.user-role-label { font-size: 11px; color: var(--ink4); }

.logout-btn {
    width: 100%;
    display: flex; align-items: center; gap: 8px;
    background: transparent; border: none;
    color: var(--ink4); font-family: 'Epilogue', sans-serif;
    font-size: 13px; font-weight: 500;
    padding: 8px 10px; border-radius: var(--radius-sm);
    cursor: pointer; transition: all 0.15s;
}
.logout-btn:hover { background: var(--red-bg); color: var(--red); }

/* MAIN */
.main-content {
    flex: 1;
    padding: 44px 52px;
    overflow-y: auto;
    max-width: 100%;
}

.page { display: none; }
.page.active {
    display: block;
    animation: fadeUp 0.28s cubic-bezier(0.16,1,0.3,1);
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-header { margin-bottom: 36px; }
.page-header h1 {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
}
.page-header p {
    color: var(--ink4);
    font-size: 14px;
    margin-top: 5px;
    font-weight: 300;
}


/* ─── ADMIN TABS ─── */
.admin-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface2);
    border-radius: var(--radius);
    padding: 4px;
    margin-bottom: 24px;
    max-width: 580px;
}
.admin-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-family: 'Epilogue', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink3);
    cursor: pointer;
    transition: all 0.15s;
}
.admin-tab.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; animation: fadeUp 0.2s ease; }
.wip-placeholder {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius);
    margin-top: 16px;
}

/* ─── ADMIN CARD ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 32px 36px;
    max-width: 580px;
    box-shadow: var(--shadow-sm);
}
.card-head { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border-light); }
.card-title {
    font-family: 'Fraunces', serif;
    font-size: 1.3rem; font-weight: 600;
    color: var(--ink); margin-bottom: 3px;
}
.card-desc { font-size: 13px; color: var(--ink4); font-weight: 300; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── ROLE BADGES ─── */
.role-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px; border-radius: 100px;
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase;
}
.role-ADMIN      { background: var(--gold-bg);  color: var(--gold);  border: 1px solid var(--gold-border); }
.role-TEACHER    { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.role-NUTRITIONIST { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-border); }

/* ════════════════════════════════════════
   MOBILE BOTTOM NAV (≤ 799px)
════════════════════════════════════════ */
.mobile-header {
    display: none;
    position: sticky; top: 0; z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 14px 20px;
    padding-top: max(14px, env(safe-area-inset-top));
    align-items: center;
    justify-content: space-between;
}
.mobile-logo {
    font-family: 'Fraunces', serif;
    font-size: 18px; font-weight: 600;
    color: var(--ink);
}
.mobile-logo em { font-style: italic; font-weight: 300; color: var(--ink3); }
.mobile-avatar {
    width: 34px; height: 34px;
    border-radius: 50%; background: var(--ink);
    color: var(--bg); display: flex;
    align-items: center; justify-content: center;
    font-family: 'Fraunces', serif;
    font-size: 13px; font-weight: 600;
}

.mobile-bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    padding: 10px 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(26,22,18,0.06);
}
.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.mobile-nav-item {
    display: flex; flex-direction: column;
    align-items: center; gap: 3px;
    padding: 6px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    min-width: 64px;
}
.mobile-nav-item.active .mob-nav-icon { background: var(--ink); }
.mobile-nav-item.active .mob-nav-icon span { filter: invert(1); }
.mobile-nav-item.active .mob-nav-label { color: var(--ink); }

.mob-nav-icon {
    width: 48px; height: 30px;
    border-radius: 100px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
    font-size: 17px;
}
.mob-nav-label {
    font-size: 10px; font-weight: 500;
    color: var(--ink4); letter-spacing: 0.02em;
}

/* Mobile main content */
.mobile-main {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
}
.mobile-page { display: none; }
.mobile-page.active { display: block; animation: fadeUp 0.25s ease; }

/* ─── MOBILE HOME ─── */
.mob-home {
    padding: 24px 20px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.mob-greeting-card {
    background: var(--ink);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 20px;
    position: relative; overflow: hidden;
}
.mob-greeting-card::before {
    content: '';
    position: absolute; top: -30px; right: -30px;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: rgba(245,240,232,0.05);
}
.mob-greeting-eyebrow {
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: rgba(245,240,232,0.45);
    margin-bottom: 6px;
    position: relative; z-index: 1;
}
.mob-greeting-name {
    font-family: 'Fraunces', serif;
    font-size: 1.9rem; font-weight: 600;
    color: var(--bg); line-height: 1.15;
    position: relative; z-index: 1;
}
.mob-greeting-name em { font-style: italic; font-weight: 300; }
.mob-greeting-role {
    margin-top: 12px;
    display: inline-flex;
    position: relative; z-index: 1;
}
.mob-role-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 12px; border-radius: 100px;
    background: rgba(245,240,232,0.1);
    border: 1px solid rgba(245,240,232,0.15);
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: rgba(245,240,232,0.7);
}

.mob-status-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.mob-stat {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px;
}
.mob-stat-label {
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink4); margin-bottom: 6px;
}
.mob-stat-value {
    font-family: 'Fraunces', serif;
    font-size: 1.4rem; color: var(--ink); font-weight: 600;
}
.mob-stat-sub { font-size: 11px; color: var(--ink4); margin-top: 3px; font-weight: 300; }

.mob-info-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
}
.mob-info-row {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}
.mob-info-row:last-child { border-bottom: none; padding-bottom: 0; }
.mob-info-row:first-child { padding-top: 0; }
.mob-info-key { color: var(--ink4); font-size: 13px; font-weight: 300; }
.mob-info-val { color: var(--ink); font-weight: 500; font-size: 13px; }

/* ─── MOBILE PROFILE PAGE ─── */
.mob-profile {
    padding: 24px 20px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

/* ─── MOBILE ADMIN PAGE ─── */
.mob-admin {
    padding: 24px 20px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}
.mob-profile-head {
    display: flex; align-items: center; gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.mob-profile-avatar {
    width: 56px; height: 56px;
    border-radius: 50%; background: var(--ink);
    color: var(--bg); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Fraunces', serif;
    font-size: 22px; font-weight: 600;
}
.mob-profile-name {
    font-family: 'Fraunces', serif;
    font-size: 1.2rem; font-weight: 600; color: var(--ink);
}
.mob-profile-role { font-size: 12px; color: var(--ink4); margin-top: 3px; font-weight: 300; }

.mob-section-title {
    font-size: 10px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--ink4); padding: 0 4px;
    margin-bottom: 8px; margin-top: 20px;
}

.mob-menu-list {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.mob-menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px; font-weight: 500; color: var(--ink);
    cursor: pointer; transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
}
.mob-menu-item:last-child { border-bottom: none; }
.mob-menu-item:active { background: var(--bg2); }
.mob-menu-item.danger { color: var(--red); }
.mob-menu-icon { font-size: 16px; width: 24px; text-align: center; opacity: 0.8; }
.mob-menu-arrow { margin-left: auto; color: var(--ink5); font-size: 12px; }

/* ─── SESSION STATUS ─── */
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 3px var(--green-bg);
    display: inline-block;
}

/* ─── RESPONSIVE BREAKPOINT ─── */
@media (max-width: 799px) {
    .sidebar { display: none; }
    .main-content { display: none; }
    .mobile-header { display: flex; }
    .mobile-bottom-nav { display: flex; }
    .mobile-main { display: flex; }
    #screen-dashboard { flex-direction: column; }
    .app-layout { flex-direction: column; min-height: 0; }
}

@media (min-width: 800px) {
    .mobile-header { display: none !important; }
    .mobile-bottom-nav { display: none !important; }
    .mobile-main { display: none !important; }
}

/* Divider */
.divider {
    height: 1px; background: var(--border-light);
    margin: 20px 0;
}

/* ─── TOGGLE SWITCH ─── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px; height: 28px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--red);
    border-radius: 28px;
    transition: background 0.22s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px; width: 20px;
    left: 4px; bottom: 4px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.22s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }
.toggle-switch input:disabled + .toggle-slider { opacity: 0.45; cursor: not-allowed; }

.status-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 1.25rem;
    padding: 16px 20px;
    background: var(--surface2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.status-toggle-label {
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
}

/* ─── CLASSES LIST ─── */
.classes-year-filter { max-width: 220px; margin-bottom: 0.5rem; }

.classes-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}
.classes-filters .field {
    margin-bottom: 0;
    min-width: 130px;
}
.classes-filters .field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}
.classes-filters select {
    padding: 0.35rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s;
    width: 100%;
}
.classes-filters select:focus { outline: none; border-color: var(--ink3); }

.classes-list {
    display: flex;
    flex-direction: column;
}
.class-row {
    display: grid;
    grid-template-columns: 3.5rem 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--border-light);
}
.class-row:last-child { border-bottom: none; }

.class-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    white-space: nowrap;
}
.class-teacher-select {
    width: 100%;
    padding: 0.35rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.15s;
}
.class-teacher-select:focus {
    outline: none;
    border-color: var(--ink3);
}
.classes-empty {
    padding: 1rem 0.25rem;
    color: var(--ink4);
    font-size: 14px;
}

/* Кнопка удаления класса */
.btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--red-border);
    border-radius: var(--radius-sm);
    background: var(--red-bg);
    color: var(--red);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
    line-height: 1;
}
.btn-delete:hover {
    background: #fae0dd;
    border-color: var(--red);
}
.btn-delete:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Кнопка "Добавить класс" под списком */
.classes-add-wrap {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

/* Кнопка "Сохранить все" */
.save-all-wrap {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}
.save-all-wrap .msg { margin-top: 0.75rem; }

/* Маленькая кнопка */
.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

/* ─── MODAL ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(26, 22, 18, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.18s ease;
}
.modal-overlay.hidden { display: none; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 1.75rem;
    animation: slideUp 0.18s ease;
}
@keyframes slideUp {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.modal-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 1.25rem;
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}
.modal-actions .btn {
    flex: 1;
    width: auto;
    margin-top: 0;
}

/* ════════════════════════════════════════
   STUDENTS TAB
════════════════════════════════════════ */

.student-row {
    display: grid;
    grid-template-columns: 2rem 1fr auto auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--border-light);
}
.student-row:last-child { border-bottom: none; }

.btn-edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface2);
    color: var(--ink3);
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.btn-edit:hover { border-color: var(--ink3); color: var(--ink); }

.student-num {
    font-size: 12px;
    color: var(--ink4);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.student-name {
    font-size: 14px;
    color: var(--ink);
}

.student-row-check {
    grid-template-columns: 2rem 1fr auto;
}

.student-checkbox-wrap {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0 0.25rem;
}

.student-checkbox-wrap input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    accent-color: var(--ink);
}

.transfer-target-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-light);
}

/* ─── MODAL TABS ─── */
.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border-light);
}
.modal-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.45rem 0.5rem;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink4);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    text-align: center;
}
.modal-tab.active {
    color: var(--ink);
    border-bottom-color: var(--ink);
}
.modal-tab:hover:not(.active) { color: var(--ink2); }

/* ─── STUDENT SEARCH RESULTS ─── */
.student-search-results {
    max-height: 240px;
    overflow-y: auto;
    margin-top: 0.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.student-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-light);
}
.student-search-item:last-child { border-bottom: none; }
.student-search-item:hover { background: var(--bg2); }

.student-search-name {
    font-size: 13.5px;
    color: var(--ink);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-search-item .btn {
    width: auto;
    flex-shrink: 0;
}

/* ════════════════════════════════════════
   ATTENDANCE
════════════════════════════════════════ */

.attendance-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.attendance-filters .field {
    flex: 1;
    min-width: 160px;
}

.att-class-label {
    padding: 0.55rem 0.85rem;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--ink2);
    font-size: 0.9rem;
    font-weight: 500;
}

.att-day-off-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    background: var(--gold-bg);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-sm);
    color: var(--gold);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.att-day-off-icon {
    font-size: 1.1rem;
}

.att-day-off-notice strong {
    font-weight: 600;
}

.att-add-btn {
    margin-bottom: 1rem;
}

.absence-block {
    background: var(--surface2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
}

.absence-block-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.absence-block-row .field {
    flex: 1;
    min-width: 160px;
    margin-bottom: 0;
}

.absence-remove-btn {
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 0;
}

.attendance-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
}

.attendance-actions .btn {
    min-width: 130px;
}

.att-all-present-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    border-radius: var(--radius-sm);
    color: var(--green);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.att-unfilled-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.85rem 1rem;
    background: #fff8ec;
    border: 1px solid #f0c060;
    border-radius: var(--radius-sm);
    color: #7a5000;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.att-unfilled-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

