/* Classica Hub - App Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Instrument+Sans:wght@400;500;600;700&family=Schibsted+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --cream: #FBF9F7;
    --dark: #2B261C;
    --gold: #F9A01B;
    --mid: #6F5C44;
    --tan: #C6B5A1;
    --dark-warm: #1E1A14;
    --sidebar-w: 240px;
    --danger: #C0392B;
    --success: #27AE60;
}

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

body {
    font-family: var(--school-font-body, 'Instrument Sans', sans-serif);
    background: var(--cream);
    color: var(--dark);
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: var(--school-font-heading, 'Instrument Serif', serif); font-weight: 400; }

.label, .nav-label, .stat-label, .meta {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
}

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--school-sidebar, var(--dark-warm));
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-logo {
    padding: 0;
    border-bottom: none;
}

.sidebar-logo img {
    height: 24px;
    filter: brightness(0) invert(1);
}

.sidebar-logo .logo-icon {
    display: none;
    height: 28px;
}

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section {
    padding: 0.5rem 1.5rem 0.25rem;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.nav-item.active {
    color: var(--school-accent, var(--gold));
    background: rgba(249,160,27,0.08);
    border-left-color: var(--school-accent, var(--gold));
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }
.nav-item i[class*="ph-"] { font-size: 1.25rem; flex-shrink: 0; opacity: 0.7; line-height: 1; }
.nav-item.active i[class*="ph-"] { opacity: 1; }

.nav-item-signout { padding-left: 0; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: rgba(255,255,255,0.7);
    margin-top: 0.75rem;
}

.sidebar-user:hover { color: #fff; }

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--mid);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.user-avatar-img {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--mid);
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.8125rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.6875rem; color: rgba(255,255,255,0.4); text-transform: capitalize; }

/* Unread badge (sidebar) */
.unread-badge {
    background: var(--gold);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 99px;
    margin-left: auto;
    line-height: 1.4;
    font-family: 'Schibsted Grotesk', sans-serif;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 2rem 2.5rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.page-title {
    font-size: 60px;
    font-weight: 300;
    color: var(--dark);
}

/* Page count - top right aligned to title bottom */
.page-count {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--mid);
    white-space: nowrap;
    align-self: flex-end;
    padding-bottom: 0.35rem;
}

/* Page header actions (right side) */
.page-header-actions {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding-bottom: 0.35rem;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.card-title {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--dark);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 1.25rem 1.5rem;
}

.stat-value {
    font-family: 'Instrument Serif', serif;
    font-size: 45px;
    color: var(--dark);
    line-height: 1.1;
}

.stat-label {
    margin-top: 0.25rem;
}

/* Stat value color variants */
.stat-value-present { color: #2E7D32; }
.stat-value-absent { color: #C62828; }
.stat-value-tardy { color: #F57F17; }
.stat-value-excused { color: #1565C0; }
.stat-value-remote { color: #757575; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }

/* List items */
.list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.list-item:last-child { border-bottom: none; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary { background: var(--school-accent, var(--gold)); color: #fff; }
.btn-primary:hover { background: var(--school-accent-dark, #e8920f); }
.btn-outline { background: transparent; border: 1px solid var(--tan); color: var(--dark); }
.btn-outline:hover { border-color: var(--mid); }

/* Badge */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-gold { background: rgba(249,160,27,0.12); color: #b87300; }
.badge-green { background: rgba(39,174,96,0.12); color: #1e8449; }

/* Dashboard badge offset */
.badge-role-offset { position: relative; top: -1.5rem; }
.badge-inline-ml { margin-left: 0.5rem; }
.badge-attendance-ml { margin-left: 6px; }

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cream);
    padding: 2rem;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.06);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img { height: 28px; }

.login-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--mid);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    margin-bottom: 0.4rem;
}

.form-input {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--tan);
    border-radius: 8px;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.9375rem;
    color: var(--dark);
    background: var(--cream);
    transition: border-color 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(249,160,27,0.12);
}

.form-select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: 1px solid var(--tan);
    border-radius: 8px;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.9375rem;
    color: var(--dark);
    background: var(--cream);
    appearance: none;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(249,160,27,0.12);
}

.btn-login {
    width: 100%;
    padding: 0.8rem;
    background: var(--school-accent, var(--gold));
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-login:hover { background: var(--school-accent-dark, #e8920f); }

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.login-footer a {
    color: var(--mid);
    font-size: 0.8125rem;
    text-decoration: none;
}

.login-footer a:hover { color: var(--gold); }
.btn-reset-demo {
    background: none;
    border: 1px solid var(--tan);
    border-radius: 4px;
    padding: 0.4rem 0.8rem;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.8125rem;
    color: var(--mid);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-reset-demo:hover { border-color: var(--gold); color: var(--gold); }

/* Supplements grid */
.onboarding-supplements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.onboarding-supplement-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(198,181,161,0.3);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}
.onboarding-supplement-card:hover {
    border-color: var(--tan);
}
.onboarding-supplement-card.selected {
    border-color: var(--gold);
    background: rgba(249,160,27,0.06);
}
.onboarding-supplement-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark);
}
.onboarding-supplement-subject {
    font-size: 0.75rem;
    color: var(--mid);
    margin-top: 2px;
}

/* Curriculum logos in onboarding */
.curriculum-logo {
    max-height: 60px;
    max-width: 140px;
    object-fit: contain;
}
.curriculum-icon-fallback {
    font-size: 2.5rem;
    color: var(--mid);
}

/* Curriculum card layout: logo centered, text at bottom */
.onboarding-curriculum-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-top: 1.5rem;
}
.onboarding-curriculum-card .curriculum-logo,
.onboarding-curriculum-card .curriculum-icon-fallback {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.onboarding-curriculum-name {
    margin-bottom: 2px;
}
.onboarding-curriculum-desc {
    margin-top: 0;
}

/* Step 5 wider + font grid 3 across */
.onboarding-branding-layout {
    max-width: 900px;
}
.onboarding-font-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

/* 6th font: Minimal (Inter) */
.font-minimal-heading { font-family: 'Inter', sans-serif; font-weight: 600; }
.font-minimal-body { font-family: 'Inter', sans-serif; font-weight: 400; }

/* Preview dashboard card */
.onboarding-preview-heading {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--dark);
}
.onboarding-preview-stats {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.onboarding-preview-stat-card {
    flex: 1;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
    padding: 0.5rem;
    text-align: center;
}
.onboarding-preview-stat-num {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
}
.onboarding-preview-stat-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mid);
}
.onboarding-preview-logo img {
    max-height: 80px;
    max-width: 160px;
    object-fit: contain;
}

/* Launch curriculum logo */
.launch-curriculum-logo {
    max-height: 40px;
    max-width: 120px;
    object-fit: contain;
}

/* Reset demo spacing */
.btn-reset-demo + p { margin-top: 0.75rem; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.alert-error {
    background: rgba(192,57,43,0.08);
    color: var(--danger);
    border: 1px solid rgba(192,57,43,0.15);
}

/* Quick links */
.quick-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--dark);
    background: var(--cream);
    transition: all 0.15s;
    font-size: 0.8125rem;
    font-weight: 500;
}

.quick-link:hover { background: rgba(249,160,27,0.08); color: var(--gold); }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

table thead th {
    background: var(--dark);
    color: #fff;
    padding: 0.75rem 1rem;
    text-align: left;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 5;
}

table tbody td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    vertical-align: middle;
}

table tbody tr:hover { background: rgba(249,160,27,0.04); }

table tbody tr:last-child td { border-bottom: none; }

.table-wrap {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.table-wrap table { margin: 0; }

/* Clickable table row */
.clickable-row { cursor: pointer; }

/* Tabs (course tabs, filter tabs) */
.tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
}

.tab {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--mid);
    background: rgba(0,0,0,0.03);
    white-space: nowrap;
    transition: all 0.15s;
    flex-shrink: 0;
}

.tab:hover { background: rgba(0,0,0,0.06); color: var(--dark); }

.tab.active {
    background: var(--gold);
    color: #fff;
    font-weight: 600;
}

/* Gradebook tab course name/code */
.tab-course-name {
    display: block;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}
.tab-course-code {
    display: block;
    font-size: 0.6875rem;
    font-weight: 400;
    opacity: 0.7;
    line-height: 1.2;
}

/* Gradebook subject tabs */
.gb-subject-tabs {
    margin-bottom: 0.5rem;
    border-bottom: 2px solid rgba(198,181,161,0.2);
}
.gb-subject-tab {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}
.gb-subject-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(198,181,161,0.2);
    border-radius: 10px;
    font-size: 0.625rem;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 4px;
}
.gb-subject-tab.active .gb-subject-count {
    background: var(--gold);
    color: #fff;
}
.gb-course-tabs {
    margin-bottom: 1rem;
}
.gb-course-tabs .tab {
    font-size: 0.8125rem;
}

/* Filter row - full width with gap */
.filter-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.filter-row > * { flex: 1; min-width: 120px; }
.filter-row > .filter-search { flex: 2; min-width: 200px; }
.filter-row > .filter-action { flex: 0 0 auto; min-width: auto; }

.filter-row .form-control { width: 100%; }

/* Filters (legacy) */
.filter-bar, .filters {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mid);
}

.form-control {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--tan);
    border-radius: 4px;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.875rem;
    color: var(--dark);
    background: #fff;
    transition: border-color 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(249,160,27,0.12);
}

/* Grade cells */
.grade-cell { text-align: center; font-family: 'Schibsted Grotesk', sans-serif; font-size: 0.8125rem; }
.grade-cell.grade-a { color: #1e8449; }
.grade-cell.grade-b { color: #2471a3; }
.grade-cell.grade-c { color: var(--mid); }
.grade-cell.grade-d { color: #b87300; }
.grade-cell.grade-f { color: var(--danger); }

/* Display toggles (gradebook % / Letter / Points) */
.display-toggle {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    cursor: pointer;
    border: 1px solid var(--tan);
    background: #fff;
    color: var(--mid);
    transition: all 0.15s;
}

.display-toggle.active {
    background: var(--dark);
    color: #fff;
    border-color: var(--dark);
}

.hidden { display: none !important; }

/* Stats row */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stats-row .stat-card { flex: 1; min-width: 140px; }

/* Course cards */
.course-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.15s;
    text-decoration: none;
    color: var(--dark);
}

.course-card:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* Course title - 30px */
.course-title {
    font-size: 30px;
    margin: 24px 0 12px;
}

.course-title i[class*="ph-"] { vertical-align: text-top; margin-right: 8px; font-size: 2.25rem; }

/* Subject color coding - subtle left border */
/* Subject color system - hue families from brand palette */
/* Languages (deep warm browns/ambers) */
.subject-latin         { --subject-color: #4E3D28; }
.subject-greek         { --subject-color: #5A4530; }
.subject-language_arts { --subject-color: #6B4F0A; }
.subject-spanish       { --subject-color: #7A5A18; }

/* Humanities (deep warm golds) */
.subject-history       { --subject-color: #6A5228; }
.subject-rhetoric      { --subject-color: #5C4830; }
.subject-logic         { --subject-color: #4F422C; }

/* Sciences/Math (deep blues) */
.subject-mathematics   { --subject-color: #2B4A6E; }
.subject-science       { --subject-color: #1E3D5E; }

/* Faith/Philosophy (deep golds) */
.subject-theology      { --subject-color: #6A5210; }

/* Arts (deep muted roses) */
.subject-fine_arts     { --subject-color: #6B3E3E; }
.subject-music         { --subject-color: #5E3A3A; }

/* Other */
.subject-physical_education { --subject-color: #2E5A4A; }
.subject-other         { --subject-color: var(--mid); }

/* Apply subject color to title, icon, and thead */
.course-title { color: var(--subject-color, var(--dark)); }
.course-title i[class*="ph-"] { color: var(--subject-color, var(--dark)); }
.subject-thead th { background: var(--subject-color, var(--dark)); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--mid);
    font-size: 0.9375rem;
}

/* Subtitle */
.subtitle {
    color: var(--mid);
    font-size: 0.9375rem;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

/* Badge variants */
.badge-red, .badge-danger { background: rgba(192,57,43,0.12); color: #922b21; }
.badge-blue { background: rgba(36,113,163,0.12); color: #1a5276; }
.badge-gray { background: rgba(0,0,0,0.06); color: var(--mid); }
.badge-active, .badge-enrolled { background: rgba(39,174,96,0.12); color: #1e8449; }
.badge-draft { background: rgba(0,0,0,0.06); color: var(--mid); }
.badge-archived { background: rgba(0,0,0,0.06); color: var(--mid); }

/* Utility classes */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 0.5rem; }
.gap-16 { gap: 1rem; }
.mb-8 { margin-bottom: 0.5rem; }
.mb-16 { margin-bottom: 1rem; }
.mb-24 { margin-bottom: 1.5rem; }
.text-sm { font-size: 0.8125rem; }
.text-muted { color: var(--mid); }
.text-center { text-align: center; }
.text-placeholder { color: var(--mid); font-size: 0.875rem; }

/* Button variants */
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.8125rem; }
.btn-secondary { background: #fff; border: 1px solid var(--tan); color: var(--dark); }
.btn-secondary:hover { border-color: var(--mid); }
.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--mid); }
.btn-ghost:hover { background: rgba(0,0,0,0.04); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-nowrap { white-space: nowrap; }

/* Attendance status badges */
.badge-present, .badge-green { background: rgba(39,174,96,0.12); color: #1e8449; }
.badge-absent, .badge-red { background: rgba(192,57,43,0.12); color: #922b21; }
.badge-tardy, .badge-gold { background: rgba(249,160,27,0.12); color: #b87300; }
.badge-excused, .badge-blue { background: rgba(36,113,163,0.12); color: #1a5276; }
.badge-remote { background: rgba(142,68,173,0.12); color: #6c3483; }

/* Attendance link - non-blue */
.attendance-link {
    color: var(--dark);
    text-decoration: none;
    font-weight: 500;
}
.attendance-link:hover { text-decoration: underline; }

/* Attendance radio center */
.attendance-radio-cell { text-align: center; vertical-align: middle; }
.attendance-radio-cell input[type="radio"] { margin: 0 auto; display: block; }
.attendance-notes { width: 100%; }

/* Attendance notes input */
.attendance-notes {
    padding: 4px 8px;
    font-size: 13px;
}

/* Attendance radio grid */
.attendance-grid input[type="radio"] { accent-color: var(--gold); }

/* Gradebook - sticky student col */
.gb-sticky-header {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--dark);
    min-width: 180px;
}

.gb-sticky-cell {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #fff;
    font-weight: 600;
    font-size: 13px;
}

.gb-cell-center { text-align: center; cursor: pointer; font-size: 13px; }
.gb-assignment-header { text-align: center; min-width: 80px; font-size: 11px; line-height: 1.3; }
.gb-pts-sub { font-weight: 400; color: #999; }
.gb-avg-header { text-align: center; min-width: 80px; background: var(--mid); color: #fff; }
.gb-avg-cell { text-align: center; font-weight: 700; font-size: 14px; }

/* Gradebook average row - dark bg white text */
.avg-row td {
    background: var(--mid) !important;
    color: #fff !important;
    font-weight: 700;
}

/* Gradebook card no padding */
.card-flush { padding: 0; overflow: hidden; }

/* Gradebook table wrap scroll */
.gb-table-scroll { max-height: calc(100vh - 280px); overflow: auto; }

/* Gradebook student link */
.gb-student-link { color: var(--dark-warm); text-decoration: none; }
.gb-student-link:hover { text-decoration: underline; }

/* Gradebook submitted marker */
.gb-submitted { color: #1565C0; }
.gb-missing { color: #ccc; }

/* Gradebook inline edit input */
.gb-edit-input {
    width: 60px;
    padding: 4px 6px;
    text-align: center;
    font-size: 13px;
    margin: 0 auto;
}

/* Breadcrumbs */
.breadcrumb {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    color: var(--mid);
    margin-bottom: 0.25rem;
}

.breadcrumb a { color: var(--gold); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 0.35rem; color: var(--tan); }

/* Detail stat boxes (side by side) */
.detail-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.detail-stats .stat-card { flex: 1; }

.teacher-name { font-size: 18px; margin-bottom: 4px; }
.parent-entry { margin-bottom: 12px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.flex-wrap { flex-wrap: wrap; }
.detail-stat-item { flex: 1; min-width: 200px; }
.detail-stat-value { font-size: 18px; font-weight: 600; }
.section-divider { margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(0,0,0,0.08); }
.description-text { font-size: 14px; line-height: 1.6; }
.text-success { color: #2E7D32; }
.section-title { font-family: 'Instrument Serif', serif; font-size: 20px; }
.col-narrow { width: 80px; }
.col-feedback { width: 200px; }
.badge-inline-ml { margin-left: 4px; }
.parent-name { font-weight: 500; }
.card-header { font-family: 'Schibsted Grotesk', sans-serif; font-size: 0.875rem; font-weight: 600; margin-bottom: 1rem; color: var(--dark); display: flex; justify-content: space-between; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: rgba(249,160,27,0.06); }

/* Detail tables (view pages) */
.detail-table { box-shadow: none; }
.detail-label { width: 140px; font-weight: 600; color: var(--mid); }

/* Grid 4 column */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* Phosphor icon utilities */
.feature-disabled-icon-lg { font-size: 48px; color: var(--tan); }

.icon-sm { font-size: 16px; }

/* Lucide icons inline sizing */
/* Quick link icons */
.quick-link i[class*="ph-"] { font-size: 1.25rem; }

/* Export link */
a[href*="export"], .export-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--mid);
    font-size: 0.8125rem;
    text-decoration: none;
}

a[href*="export"]:hover, .export-link:hover { color: var(--gold); }

/* Save status text */
.save-status { font-size: 13px; color: #6B6560; align-self: center; }
.save-status-success { color: #2E7D32; }
.save-status-error { color: #C62828; }

/* Feature disabled state */
.feature-disabled { text-align: center; padding: 3rem; }
.feature-disabled-icon { font-size: 48px; color: var(--tan); }
.feature-disabled h3 { margin-top: 1rem; }
.feature-disabled p { margin-top: 0.5rem; }
.feature-disabled .btn { margin-top: 1rem; }

/* Student grid/card view */
.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.student-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 1.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.15s;
    cursor: pointer;
}

.student-card:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.avatar-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--tan);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 auto 0.75rem;
}
img.avatar-circle.avatar-img {
    object-fit: cover;
    background: none;
}

.student-card-name { font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.25rem; }
.student-card-meta { font-size: 0.8125rem; color: var(--mid); }

/* View toggle buttons */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--tan);
    border-radius: 8px;
    overflow: hidden;
}

.view-toggle-btn {
    padding: 0.35rem 0.7rem;
    background: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    color: var(--mid);
    transition: all 0.15s;
}

.view-toggle-btn.active {
    background: var(--dark);
    color: #fff;
}

/* Content wrapper for pages without card wrapping */
.content {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Calendar */
.cal-layout { display: flex; gap: 1.5rem; }
.cal-main { flex: 1; min-width: 0; }
.cal-sidebar { width: 300px; flex-shrink: 0; }

.cal-month-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.cal-month-title { font-size: 40px; flex: 1; text-align: center; margin: 0; }

.cal-filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.cal-filter-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 100px;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--tan);
    background: #fff;
    color: var(--mid);
    cursor: pointer;
    transition: all 0.15s;
}
.cal-filter-btn.active { border-color: transparent; color: #fff; }
.cal-filter-btn.cal-type-school.active { background: #5B7B6A; }
.cal-filter-btn.cal-type-class.active { background: #6A85A8; }
.cal-filter-btn.cal-type-assignment.active { background: #A8896A; }
.cal-filter-btn.cal-type-meeting.active { background: #8A7BA8; }
.cal-filter-btn.cal-type-holiday.active { background: #C4956A; }
.cal-filter-btn.cal-type-other.active { background: var(--mid); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
}

.cal-dow {
    padding: 0.5rem;
    text-align: center;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    background: rgba(0,0,0,0.02);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.cal-day {
    min-height: 80px;
    padding: 0.4rem;
    border-right: 1px solid rgba(0,0,0,0.04);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    cursor: pointer;
    transition: background 0.1s;
}
.cal-day:hover { background: rgba(249,160,27,0.04); }
.cal-day-empty { background: rgba(0,0,0,0.015); cursor: default; }
.cal-day-empty:hover { background: rgba(0,0,0,0.015); }
.cal-day-today { background: rgba(249,160,27,0.06); }
.cal-day-today .cal-day-num { color: var(--gold); font-weight: 700; }
.cal-day-selected { background: rgba(249,160,27,0.1); }

.cal-day-num {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--dark);
}

.cal-day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.cal-day-event {
    display: flex;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
}

.cal-day-event-name {
    font-size: 0.65rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--dark);
}

.cal-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.cal-type-school .cal-dot { background: #5B7B6A; }
.cal-type-class .cal-dot { background: #6A85A8; }
.cal-type-assignment .cal-dot { background: #A8896A; }
.cal-type-meeting .cal-dot { background: #8A7BA8; }
.cal-type-holiday .cal-dot { background: #C4956A; }
.cal-type-other .cal-dot { background: var(--mid); }

.cal-dot-more {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.625rem;
    color: var(--mid);
    line-height: 8px;
}

.cal-sidebar-title {
    font-size: 24px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cal-upcoming-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    text-decoration: none;
    color: var(--dark);
    transition: color 0.1s;
}
.cal-upcoming-item:hover { color: var(--gold); }
.cal-upcoming-item .cal-dot { margin-top: 5px; }
.cal-upcoming-info { flex: 1; min-width: 0; }
.cal-upcoming-title { font-size: 0.875rem; font-weight: 500; }
.cal-upcoming-meta { font-size: 0.75rem; color: var(--mid); margin-top: 2px; }

/* Calendar badges (view page) */
.cal-badge-school { background: rgba(91,123,106,0.12); color: #3d5a4a; }
.cal-badge-class { background: rgba(106,133,168,0.12); color: #4a6a8a; }
.cal-badge-assignment { background: rgba(168,137,106,0.12); color: #7a6240; }
.cal-badge-meeting { background: rgba(138,123,168,0.12); color: #5e5080; }
.cal-badge-holiday { background: rgba(196,149,106,0.12); color: #8a6030; }
.cal-badge-other { background: rgba(0,0,0,0.06); color: var(--mid); }

/* Calendar form */
.cal-form-full { width: 100%; }
.cal-textarea { resize: vertical; }
.cal-allday-label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.cal-allday-label input { accent-color: var(--gold); }

/* Modal overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-header h3 { margin: 0; }

/* Report Card */
.report-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--dark);
}

.report-card-school {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.report-card-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.report-card-logo-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--tan);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.75rem;
}

.report-card-school-name {
    font-size: 24px;
    margin: 0;
}

.report-card-school-sub {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mid);
    margin-top: 2px;
}

.report-card-term-info { text-align: right; }

.report-card-term-name {
    font-family: 'Instrument Serif', serif;
    font-size: 18px;
}

.report-card-term-dates {
    font-size: 0.8125rem;
    color: var(--mid);
    margin-top: 2px;
}

.report-card-term-year {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mid);
    margin-top: 4px;
}

.report-card-student-bar {
    display: flex;
    gap: 2rem;
    padding: 1rem 2rem;
    background: rgba(0,0,0,0.02);
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.report-card-student-field { display: flex; flex-direction: column; }

.report-card-field-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mid);
}

.report-card-field-value {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-top: 2px;
}

.report-card-section {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.report-card-section:last-child { border-bottom: none; }

.report-card-section-title {
    font-size: 18px;
    margin-bottom: 0.75rem;
}

.report-card-table { width: 100%; border-collapse: collapse; }

.report-card-table thead th {
    background: var(--dark);
    color: #fff;
    padding: 0.6rem 0.75rem;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
}

.report-card-table tbody td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 0.875rem;
}

.report-card-table tfoot td {
    padding: 0.75rem;
    font-weight: 600;
    background: rgba(0,0,0,0.02);
    border-top: 2px solid var(--dark);
}

.report-card-gpa-row td { font-size: 0.875rem; }

.report-card-attendance {
    display: flex;
    gap: 2rem;
}

.report-card-att-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.report-card-att-value {
    font-family: 'Instrument Serif', serif;
    font-size: 28px;
    line-height: 1.1;
}

.report-card-att-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    margin-top: 4px;
}

.report-card-comments {
    min-height: 60px;
    padding: 0.75rem;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
}

.report-card-footer-bar {
    display: flex;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(0,0,0,0.02);
    border-top: 1px solid rgba(0,0,0,0.06);
}

.report-card-footer-field { display: flex; flex-direction: column; }

/* Print styles */
@media print {
    .sidebar, .page-header, .breadcrumb, .filter-row,
    .detail-stats, .nav-item, .btn, .modal-overlay { display: none !important; }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .report-card {
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .report-card-header { border-bottom: 3px solid #000; }
    .report-card-table thead th { background: #333 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-card-table tfoot td { border-top: 3px solid #000; }
    .badge { border: 1px solid #ccc; }

    body { background: #fff; }
    .app-layout { display: block; }
}

/* Analytics Charts */
.analytics-bar-chart { display: flex; flex-direction: column; gap: 0.6rem; }

.bar-row { display: flex; align-items: center; gap: 0.75rem; }
.bar-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--mid);
    min-width: 72px;
    text-align: right;
    flex-shrink: 0;
}
.bar-track {
    flex: 1;
    height: 20px;
    background: rgba(0,0,0,0.04);
    border-radius: 4px;
    overflow: hidden;
}
.bar-track-inline { display: inline-block; width: 80px; height: 10px; vertical-align: middle; margin-right: 6px; }
.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}
.bar-fill-gold { background: var(--gold); }
.bar-fill-green { background: var(--success); }
.bar-fill-blue { background: #2471a3; }
.bar-fill-tan { background: var(--tan); }
.bar-fill-red { background: var(--danger); }
.bar-fill-dark { background: var(--dark); }
.bar-value {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dark);
    min-width: 36px;
    text-align: right;
    flex-shrink: 0;
}

/* Vertical bar chart */
.analytics-bar-chart-vertical {
    flex-direction: row;
    align-items: flex-end;
    justify-content: center;
    gap: 1.25rem;
    height: 180px;
    padding-top: 1rem;
}
.vbar-col { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; flex: 1; height: 100%; }
.vbar-count {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dark);
}
.vbar-track {
    flex: 1;
    width: 100%;
    max-width: 48px;
    background: rgba(0,0,0,0.04);
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.vbar-fill {
    width: 100%;
    border-radius: 4px;
    transition: height 0.4s ease;
    min-height: 2px;
}
.vbar-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mid);
}

/* Stacked bar */
.analytics-stacked-bar {
    display: flex;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(0,0,0,0.04);
}
.stacked-segment { transition: width 0.4s ease; min-width: 1px; }
.stacked-present { background: var(--success); }
.stacked-absent { background: var(--danger); }
.stacked-tardy { background: var(--gold); }
.stacked-excused { background: #2471a3; }

/* Legend */
.analytics-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.75rem; }
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    color: var(--mid);
}
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-dot-present { background: var(--success); }
.legend-dot-absent { background: var(--danger); }
.legend-dot-tardy { background: var(--gold); }
.legend-dot-excused { background: #2471a3; }

/* Big stat number */
.analytics-big-number {
    font-family: 'Instrument Serif', serif;
    font-size: 48px;
    color: var(--dark);
    line-height: 1.1;
}

/* At-risk rows */
.at-risk-severe td { background: rgba(192,57,43,0.06); }
.at-risk-moderate td { background: rgba(249,160,27,0.06); }

/* Trend indicators */
.analytics-trend-up { color: var(--success); font-size: 1.1rem; }
.analytics-trend-down { color: var(--danger); font-size: 1.1rem; }
.analytics-trend-stable { color: var(--mid); font-size: 1.1rem; }

/* Utility */
.mt-16 { margin-top: 1rem; }

/* ========================================
   Onboarding Wizard
   ======================================== */

.onboarding-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--cream);
}

.onboarding-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 2.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    background: #fff;
}

.onboarding-logo img {
    height: 35px;
}

.onboarding-exit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--mid);
    text-decoration: none;
    font-size: 0.8125rem;
    font-family: 'Schibsted Grotesk', sans-serif;
    transition: color 0.15s;
}

.onboarding-exit:hover { color: var(--dark); }

.onboarding-progress-wrap {
    padding: 1.5rem 0 0;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.onboarding-progress-bar {
    height: 6px;
    background: rgba(198,181,161,0.3);
    border-radius: 100px;
    overflow: hidden;
}

.onboarding-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold) 0%, #1a365d 100%);
    border-radius: 100px;
    transition: width 0.4s ease;
    width: 16.66%;
}

.onboarding-step-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mid);
    margin-top: 0.5rem;
    text-align: center;
}

.onboarding-body {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 2.5rem 6rem;
}

.onboarding-container {
    width: 100%;
    max-width: 900px;
}

.onboarding-step {
    display: none;
    animation: onboardFadeIn 0.35s ease;
}

.onboarding-step.active { display: block; }

@keyframes onboardFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.onboarding-step-icon {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 0;
}

.onboarding-step-icon-launch {
    font-size: 4rem;
}

.onboarding-title-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 0.5rem;
}

.onboarding-title {
    font-family: 'Instrument Serif', serif;
    font-size: 4rem;
    font-weight: 400;
    color: var(--dark);
    margin-bottom: 0;
    line-height: 1.1;
}

.onboarding-subtitle {
    color: var(--mid);
    font-size: 1rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

.onboarding-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.onboarding-form .form-group { margin-bottom: 1.25rem; }

.onboarding-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.onboarding-form-row-3 {
    grid-template-columns: 2fr 1fr 1fr;
}

.onboarding-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Curriculum cards */
.onboarding-curriculum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.onboarding-curriculum-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: 'Instrument Sans', sans-serif;
}

.onboarding-curriculum-card i {
    font-size: 2rem;
    color: var(--mid);
    transition: color 0.2s;
}

.onboarding-curriculum-card:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 16px rgba(249,160,27,0.1);
}

.onboarding-curriculum-card:hover i { color: var(--gold); }

.onboarding-curriculum-card.selected {
    border-color: var(--gold);
    background: rgba(249,160,27,0.04);
    box-shadow: 0 4px 16px rgba(249,160,27,0.12);
}

.onboarding-curriculum-card.selected i { color: var(--gold); }

.onboarding-curriculum-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--dark);
}

.onboarding-curriculum-desc {
    font-size: 0.75rem;
    color: var(--mid);
    line-height: 1.4;
}

/* Courses step */
.onboarding-course-stage { margin-bottom: 1.5rem; }

.onboarding-course-stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.onboarding-section-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.25rem;
    color: var(--dark);
}

.onboarding-course-toggle-all {
    display: flex;
    gap: 0.5rem;
}

.onboarding-course-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.onboarding-course-item:hover { border-color: var(--gold); }

.onboarding-course-item input[type="checkbox"] {
    accent-color: var(--gold);
    margin-top: 4px;
    flex-shrink: 0;
}

.onboarding-course-info { flex: 1; min-width: 0; }
.onboarding-course-info strong { font-size: 0.9375rem; }

/* Import users step */
.onboarding-import-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.onboarding-import-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.onboarding-import-option i { font-size: 1.5rem; color: var(--mid); flex-shrink: 0; }
.onboarding-import-option strong { display: block; font-size: 0.9375rem; }

.onboarding-import-option:hover { border-color: var(--gold); }

.onboarding-import-option.selected {
    border-color: var(--gold);
    background: rgba(249,160,27,0.04);
}

.onboarding-import-option.selected i { color: var(--gold); }

.onboarding-csv-section { margin-bottom: 1.5rem; }

.onboarding-csv-section .onboarding-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.onboarding-template-link {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    color: var(--gold);
    text-decoration: none;
    margin-left: auto;
    font-weight: 500;
}

.onboarding-template-link:hover { text-decoration: underline; }

/* Dropzone */
.onboarding-dropzone {
    border: 2px dashed var(--tan);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.6);
}

.onboarding-dropzone:hover,
.onboarding-dropzone.dragover {
    border-color: var(--gold);
    background: rgba(249,160,27,0.04);
}

.onboarding-dropzone i {
    font-size: 2rem;
    color: var(--tan);
    display: block;
    margin-bottom: 0.5rem;
}

.onboarding-dropzone:hover i,
.onboarding-dropzone.dragover i { color: var(--gold); }

.onboarding-dropzone p {
    font-size: 0.9375rem;
    color: var(--mid);
    margin-bottom: 0.25rem;
}

.onboarding-csv-preview {
    margin-top: 1rem;
}

.onboarding-csv-preview .table-wrap {
    max-height: 200px;
    overflow-y: auto;
}

/* Logo dropzone */
.onboarding-logo-dropzone {
    padding: 1.5rem;
}

.onboarding-logo-dropzone img {
    max-width: 140px;
    max-height: 100px;
    object-fit: contain;
}

/* Branding layout */
.onboarding-branding-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.onboarding-branding-controls { display: flex; flex-direction: column; gap: 0; }
.onboarding-branding-controls .form-group { margin-bottom: 1.25rem; }

/* Color picker */
.onboarding-color-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.onboarding-color-row .form-group {
    text-align: center;
}
.onboarding-color-row .onboarding-color-hex {
    display: block;
    margin-top: 0.25rem;
}

.onboarding-color-picker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.onboarding-color-picker input[type="color"] {
    width: 48px;
    height: 40px;
    border: 1px solid var(--tan);
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    background: #fff;
}

.onboarding-color-hex {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    color: var(--mid);
    text-transform: uppercase;
}

/* Brand preview */
.onboarding-preview-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.08);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.onboarding-preview-header {
    padding: 1.5rem;
    text-align: center;
    background: #1a365d;
    transition: background-color 0.3s;
}

.onboarding-preview-logo {
    margin-bottom: 0.5rem;
}

.onboarding-preview-logo i { font-size: 2rem; color: #fff; }
.onboarding-preview-logo img { max-height: 40px; filter: brightness(0) invert(1); }

.onboarding-preview-school {
    color: #fff;
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
}

.onboarding-preview-body { padding: 1.5rem; }

.onboarding-preview-field {
    height: 36px;
    border: 1px solid var(--tan);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    background: var(--cream);
}

.onboarding-preview-btn {
    width: 100%;
    padding: 0.65rem;
    background: #c9a227;
    color: #fff;
    border-radius: 8px;
    text-align: center;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background-color 0.3s;
}

/* Launch step */
.onboarding-launch-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.onboarding-launch-stat {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 1.5rem;
    text-align: center;
}

.onboarding-launch-stat-value {
    font-family: 'Instrument Serif', serif;
    font-size: 2.5rem;
    color: var(--dark);
    line-height: 1.1;
}

.onboarding-launch-stat-value i { font-size: 2rem; color: var(--success); }

.onboarding-launch-stat-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    margin-top: 0.35rem;
}

.onboarding-launch-action { text-align: center; }

.onboarding-launch-btn {
    padding: 1rem 3rem;
    font-size: 1.125rem;
    border-radius: 12px;
}

.onboarding-launch-btn i { font-size: 1.25rem; }

/* Footer nav */
.onboarding-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 1rem 2.5rem;
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.06);
    z-index: 50;
}

.onboarding-btn-back,
.onboarding-btn-next {
    min-width: 120px;
}

/* Confetti canvas */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    display: none;
}

#confettiCanvas.active { display: block; }

/* Onboarding: right-aligned Next button */
.onboarding-footer {
    justify-content: flex-end;
    gap: 1rem;
}

.onboarding-footer .onboarding-btn-back {
    margin-right: auto;
}

/* Onboarding: Course prefix hint */
.onboarding-course-prefix-hint {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: var(--mid);
    background: rgba(249,160,27,0.06);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.onboarding-course-prefix-hint i {
    color: var(--gold);
    font-size: 1rem;
    flex-shrink: 0;
}

/* Onboarding: Multi-curricula panel */
.onboarding-multi-panel {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
}

.onboarding-multi-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.onboarding-multi-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: background 0.15s;
}

.onboarding-multi-check:hover {
    background: rgba(249,160,27,0.04);
}

.onboarding-multi-check input[type="checkbox"] {
    accent-color: var(--gold);
}

/* Onboarding: Other curriculum panel */
.onboarding-other-panel {
    margin-top: 1.5rem;
}

/* Onboarding: Demo data sliders */
.onboarding-slider-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
}

.onboarding-slider {
    width: 100%;
    height: 6px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--tan);
    border-radius: 100px;
    outline: none;
    margin-top: 0.5rem;
}

.onboarding-slider::-webkit-slider-track {
    height: 6px;
    background: var(--tan);
    border-radius: 100px;
}

.onboarding-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--dark);
    border: 3px solid var(--gold);
    cursor: pointer;
    margin-top: -7px;
}

.onboarding-slider::-moz-range-track {
    height: 6px;
    background: var(--tan);
    border-radius: 100px;
    border: none;
}

.onboarding-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--dark);
    border: 3px solid var(--gold);
    cursor: pointer;
}

.onboarding-slider::-moz-range-progress {
    background: var(--gold);
    height: 6px;
    border-radius: 100px;
}

/* Onboarding: Font pairing grid */
.onboarding-font-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.onboarding-font-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: #fff;
    border: 2px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: inherit;
}

.onboarding-font-card:hover {
    border-color: var(--gold);
}

.onboarding-font-card.selected {
    border-color: var(--gold);
    background: rgba(249,160,27,0.04);
    box-shadow: 0 4px 16px rgba(249,160,27,0.12);
}

.onboarding-font-card-heading {
    font-size: 1.125rem;
    color: var(--dark);
    line-height: 1.3;
}

.onboarding-font-card-body {
    font-size: 0.75rem;
    color: var(--mid);
    line-height: 1.4;
}

/* Font preview classes */
.font-classic-heading { font-family: 'Instrument Serif', serif; }
.font-classic-body { font-family: 'Instrument Sans', sans-serif; }
.font-traditional-heading { font-family: 'Playfair Display', serif; }
.font-traditional-body { font-family: 'Source Sans 3', sans-serif; }
.font-modern-heading { font-family: 'DM Serif Display', serif; }
.font-modern-body { font-family: 'DM Sans', sans-serif; }
.font-elegant-heading { font-family: 'Cormorant Garamond', serif; }
.font-elegant-body { font-family: 'Proza Libre', sans-serif; }
.font-clean-heading { font-family: 'Libre Baskerville', serif; }
.font-clean-body { font-family: 'Nunito Sans', sans-serif; }

/* Onboarding: Launch logo */
.onboarding-launch-logo-wrap {
    text-align: center;
    margin-bottom: 1.5rem;
}

.onboarding-launch-logo {
    max-height: 80px;
    max-width: 200px;
    object-fit: contain;
}

/* Onboarding: 4-column launch stats */
.onboarding-launch-stats {
    grid-template-columns: repeat(4, 1fr);
}

/* Share demo button */
.btn-share-demo {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: rgba(249,160,27,0.1);
    color: var(--gold);
    border: 1px solid rgba(249,160,27,0.25);
    border-radius: 8px;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-share-demo:hover {
    background: rgba(249,160,27,0.18);
    border-color: var(--gold);
}

.btn-share-demo i {
    font-size: 1rem;
}

/* Spinning icon for loading state */
@keyframes phSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ph-spin { animation: phSpin 0.8s linear infinite; }

/* Responsive */
@media (max-width: 768px) {
    .onboarding-header { padding: 1rem 1.5rem; }
    .onboarding-progress-wrap { padding: 1rem 1.5rem 0; }
    .onboarding-body { padding: 1.5rem 1.5rem 5rem; }
    .onboarding-footer { padding: 1rem 1.5rem; }
    .onboarding-title { font-size: 1.75rem; }
    .onboarding-form-row { grid-template-columns: 1fr; }
    .onboarding-form-row-3 { grid-template-columns: 1fr; }
    .onboarding-curriculum-grid { grid-template-columns: 1fr 1fr; }
    .onboarding-branding-layout { grid-template-columns: 1fr; }
    .onboarding-launch-stats { grid-template-columns: 1fr 1fr; }
    .onboarding-font-grid { grid-template-columns: 1fr; }
    .onboarding-slider-group { grid-template-columns: 1fr; }
    .onboarding-multi-checks { grid-template-columns: 1fr; }
}

/* ========================================
   Settings / Branding
   ======================================== */

.settings-form .form-group { margin-bottom: 1.25rem; }
.settings-input { width: 100%; }
.settings-textarea { resize: vertical; min-height: 80px; }
.settings-actions { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }

/* Logo preview */
.logo-preview-area {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    margin-bottom: 1rem;
    background: var(--cream);
    border-radius: 8px;
    padding: 1rem;
}

.logo-preview-img { max-height: 80px; max-width: 100%; object-fit: contain; }

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    color: var(--tan);
    font-size: 0.875rem;
}

.logo-placeholder i { font-size: 2rem; }

/* Upload zone */
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border: 2px dashed var(--tan);
    border-radius: 8px;
    background: rgba(249,160,27,0.03);
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone:hover,
.upload-zone.upload-zone-active {
    border-color: var(--gold);
    background: rgba(249,160,27,0.06);
}

.upload-zone i { font-size: 1.75rem; color: var(--gold); }
.upload-zone-text { font-size: 0.875rem; font-weight: 500; color: var(--dark); }
.upload-zone-hint { font-size: 0.75rem; color: var(--mid); }

.upload-progress {
    margin-top: 0.5rem;
    height: 4px;
    background: rgba(0,0,0,0.06);
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 100%;
    background: var(--gold);
    animation: uploadPulse 1s ease-in-out infinite;
}

@keyframes uploadPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Color picker */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.color-picker-input {
    width: 48px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--tan);
    border-radius: 4px;
    cursor: pointer;
    background: none;
}

.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-input::-webkit-color-swatch { border: none; border-radius: 2px; }
.color-picker-input::-moz-color-swatch { border: none; border-radius: 2px; }

.color-hex-input {
    width: 100px;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

/* Branding preview card */
.branding-preview-card { box-shadow: 0 4px 24px rgba(0,0,0,0.06); }

.preview-section { margin-bottom: 1.25rem; }
.preview-section:last-child { margin-bottom: 0; }

.preview-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mid);
    margin-bottom: 0.5rem;
}

/* Preview: Login */
.preview-login {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
}

.preview-login-bar {
    padding: 0.75rem 1rem;
    color: #fff;
    font-family: 'Instrument Serif', serif;
    font-size: 0.9375rem;
}

.preview-login-body { padding: 0.75rem 1rem; background: #fff; }

.preview-login-field {
    height: 24px;
    background: var(--cream);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.preview-login-btn {
    padding: 0.35rem;
    border-radius: 4px;
    color: #fff;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Preview: Sidebar */
.preview-sidebar {
    border-radius: 8px;
    overflow: hidden;
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    padding: 0.5rem 0;
}

.preview-sidebar-logo {
    padding: 0.5rem 0.75rem;
    font-family: 'Instrument Serif', serif;
    font-size: 0.875rem;
    color: #fff;
    border-bottom: 2px solid;
    margin-bottom: 0.25rem;
}

.preview-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.preview-sidebar-item.active { color: #fff; }
.preview-sidebar-item i { font-size: 0.875rem; }

/* Preview: Report Card */
.preview-report {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.06);
}

.preview-report-bar {
    padding: 0.75rem 1rem;
    color: #fff;
    border-bottom: 3px solid;
}

.preview-report-name {
    font-family: 'Instrument Serif', serif;
    font-size: 0.9375rem;
    display: block;
}

.preview-report-sub {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

/* Branding page extras */
.branding-image-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.branding-thumb-sm { width: 32px; height: 32px; object-fit: contain; border-radius: 4px; }
.branding-thumb-lg { max-width: 200px; max-height: 60px; object-fit: cover; border-radius: 6px; }

.preview-login-tagline {
    display: block;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.625rem;
    opacity: 0.7;
    margin-top: 2px;
}

.preview-typography {
    padding: 1rem;
    background: var(--cream);
    border-radius: 8px;
}

.preview-heading {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.preview-body-text {
    font-size: 0.8125rem;
    color: var(--mid);
    line-height: 1.5;
}

.preview-buttons {
    display: flex;
    gap: 0.5rem;
}

.preview-btn-sample {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

.preview-btn-sample-outline {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1.5px solid;
    background: transparent;
}

/* Login page branded background */
.login-wrapper-branded {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.login-wrapper-branded .login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
}

.login-banner {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.login-tagline {
    text-align: center;
    color: var(--mid);
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
    font-style: italic;
}

/* Subdomain */
.subdomain-input-row {
    display: flex;
    align-items: center;
    gap: 0;
}

.subdomain-field {
    border-radius: 4px 0 0 4px;
    flex: 1;
}

.subdomain-suffix {
    padding: 0.5rem 0.85rem;
    background: rgba(0,0,0,0.04);
    border: 1px solid var(--tan);
    border-left: none;
    border-radius: 0 4px 4px 0;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--mid);
    white-space: nowrap;
}

.subdomain-status {
    font-size: 0.8125rem;
    margin-top: 0.5rem;
    min-height: 1.25em;
}

.subdomain-status-success { color: var(--success); }
.subdomain-status-error { color: var(--danger); }
.subdomain-status-neutral { color: var(--mid); }

.subdomain-rules { margin-top: 0.5rem; }

.alert-subdomain-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    background: rgba(249,160,27,0.08);
    color: var(--mid);
    border: 1px solid rgba(249,160,27,0.15);
}

.alert-subdomain-warning i { font-size: 1.1rem; color: var(--gold); flex-shrink: 0; }

/* Toast (shared with features) */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    background: var(--success);
    z-index: 999;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
    pointer-events: none;
}

.toast.error { background: var(--danger); }
.toast.show { opacity: 1; transform: translateY(0); }

/* ========================================
   Teacher & Student Dashboard Components
   ======================================== */

/* Teacher courses grid */
.teacher-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

/* Course card enhancements for dashboard */
.course-card-name {
    font-family: 'Instrument Serif', serif;
    font-size: 1.25rem;
    color: var(--subject-color, var(--dark));
}

.course-card-code {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--mid);
}

.course-card-meta-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.course-card-students {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--mid);
}

.course-card-students i { font-size: 1rem; }

.course-card-teacher {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--mid);
}

.course-card-teacher i { font-size: 1rem; }

/* Course card grade row (student dashboard) */
.course-card-grade-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.course-card-grade-letter {
    font-family: 'Instrument Serif', serif;
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 1;
}

.course-card-grade-pct {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    color: var(--mid);
}

/* Grade colors */
.grade-color-default { color: #999; }
.grade-color-a { color: #2E7D32; }
.grade-color-b { color: #1565C0; }
.grade-color-c { color: #F57F17; }
.grade-color-d { color: #E65100; }
.grade-color-f { color: #C62828; }

/* List item body layout */
.list-item-body { flex: 1; min-width: 0; }

.list-item-title {
    font-size: 0.875rem;
    font-weight: 500;
}

.list-item-meta {
    font-size: 0.75rem;
    color: var(--mid);
    margin-top: 2px;
}

.list-item-right {
    flex-shrink: 0;
    text-align: right;
}

.list-item-grade {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.list-item-score {
    font-size: 0.875rem;
    font-weight: 600;
}

.list-item-letter {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
}

/* Quick attendance grid (teacher) */
.quick-attendance-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-attendance-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.quick-attendance-item:last-child { border-bottom: none; }

.quick-attendance-name {
    font-size: 0.875rem;
    font-weight: 500;
}

.quick-attendance-code {
    font-size: 0.75rem;
    color: var(--mid);
}

/* Student welcome row */
.page-header-with-avatar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.student-header-avatar {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    border: 5px solid var(--school-primary, #1a365d);
    object-fit: cover;
    flex-shrink: 0;
}

/* Attendance summary counts (student) */
.attendance-summary-counts {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
}

.attendance-summary-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    color: var(--mid);
}

.attendance-summary-value {
    font-weight: 700;
    color: var(--dark);
}

/* ========================================
   Parent Dashboard Components
   ======================================== */

.parent-children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.parent-child-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.15s;
    display: block;
}

.parent-child-card:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.parent-child-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.parent-child-avatar {
    width: 48px;
    height: 48px;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.parent-child-name {
    font-size: 1.125rem;
    font-weight: 600;
}

.parent-child-meta {
    font-size: 0.8125rem;
    color: var(--mid);
}

.parent-child-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.parent-child-stat {
    text-align: center;
    padding: 0.75rem;
    background: var(--cream);
    border-radius: 8px;
}

.parent-child-stat-value {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    color: var(--dark);
    line-height: 1.1;
}

.parent-child-stat-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 1.5rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .page-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .filter-row { flex-direction: column; }
    .report-card-header { flex-direction: column; gap: 1rem; }
    .report-card-term-info { text-align: left; }
    .report-card-student-bar { flex-wrap: wrap; gap: 1rem; }
    .report-card-attendance { flex-wrap: wrap; }
    .teacher-courses-grid { grid-template-columns: 1fr; }
    .parent-children-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 2rem 1.5rem; }
    .attendance-summary-counts { flex-wrap: wrap; }
}

/* ========================================
   Transcripts
   ======================================== */

.transcript-wrapper {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 2.5rem;
    margin-bottom: 1.5rem;
}

.transcript-document {
    max-width: 800px;
    margin: 0 auto;
    font-family: 'Instrument Sans', sans-serif;
}

.transcript-header {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--dark);
    margin-bottom: 1.5rem;
}

.transcript-school-logo {
    height: 48px;
    margin-bottom: 0.5rem;
}

.transcript-school-name {
    font-family: 'Instrument Serif', serif;
    font-size: 1.75rem;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.transcript-school-address {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    color: var(--mid);
    letter-spacing: 0.02em;
}

.transcript-title {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--dark);
    margin-top: 1rem;
}

.transcript-student-info {
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: rgba(0,0,0,0.015);
}

.transcript-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.transcript-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.transcript-info-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
}

.transcript-info-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
}

.transcript-year-block {
    margin-bottom: 1.5rem;
}

.transcript-year-title {
    font-family: 'Instrument Serif', serif;
    font-size: 1.125rem;
    color: var(--dark);
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--dark);
    margin-bottom: 0.5rem;
}

.transcript-term-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.transcript-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    margin-bottom: 0.75rem;
}

.transcript-table thead th {
    background: var(--dark);
    color: #fff;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.transcript-table tbody td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.transcript-table tfoot td {
    padding: 0.5rem 0.75rem;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    background: rgba(0,0,0,0.025);
    border-top: 1px solid rgba(0,0,0,0.12);
}

.transcript-center {
    text-align: center;
}

.transcript-term-summary td {
    font-weight: 500;
}

.transcript-cumulative {
    border: 2px solid var(--dark);
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.transcript-cumulative-title {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--dark);
    margin-bottom: 0.75rem;
}

.transcript-cumulative-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
}

.transcript-cumulative-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.transcript-cumulative-value {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    color: var(--dark);
}

.transcript-gpa-scale {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.02);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 4px;
}

.transcript-gpa-scale-title {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    margin-bottom: 0.35rem;
}

.transcript-gpa-scale-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.6875rem;
    color: var(--dark);
}

.transcript-signature {
    margin-top: 2.5rem;
    padding-top: 1rem;
}

.transcript-signature-line {
    display: flex;
    justify-content: space-between;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    color: var(--dark);
}

.transcript-empty {
    text-align: center;
    padding: 2rem;
    color: var(--mid);
    font-size: 0.9375rem;
}

/* Print-only body for standalone print page */
.transcript-print-body {
    background: #fff;
    padding: 1.5rem;
    margin: 0;
}

/* Print styles */
@media print {
    .sidebar, .sidebar-footer, .page-header, .nav-item, .btn { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .transcript-wrapper { border: none; padding: 0; box-shadow: none; }

    .transcript-document { max-width: 100%; }

    .transcript-header { border-bottom: 2px solid #000; }
    .transcript-school-name { color: #000; }
    .transcript-title { color: #000; }
    .transcript-year-title { color: #000; border-bottom-color: #000; }
    .transcript-cumulative { border-color: #000; }

    .transcript-table thead th {
        background: #000 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .transcript-table tbody td { border-bottom: 1px solid #ccc; }

    body { font-size: 11pt; }

    .page-header-actions { display: none !important; }

    @page { margin: 0.75in; }
}

/* Demo Login */
.demo-login-home {
    text-align: center;
    margin-bottom: 1.5rem;
}

.demo-login-top-logo {
    height: 40px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.demo-login-top-logo:hover {
    opacity: 1;
}

.demo-login-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 2.5rem;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.06);
}
.demo-login-header {
    text-align: center;
    margin-bottom: 2rem;
}
.demo-login-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(249,160,27,0.1);
    color: var(--gold);
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 1rem;
}
.demo-login-school {
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
    font-weight: 400;
    color: var(--dark);
    margin-bottom: 0.5rem;
}
.demo-login-subtitle {
    color: var(--mid);
    font-size: 0.9375rem;
}
.demo-role-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.demo-role-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem;
    border: 2px solid rgba(198,181,161,0.3);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    text-align: center;
}
.demo-role-card:hover {
    border-color: var(--tan);
    transform: translateY(-1px);
}
.demo-role-card.selected {
    border-color: var(--gold);
    background: rgba(249,160,27,0.04);
}
.demo-role-icon {
    font-size: 2rem;
    color: var(--mid);
    margin-bottom: 0.5rem;
}
.demo-role-card.selected .demo-role-icon {
    color: var(--gold);
}
.demo-role-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--dark);
    margin-bottom: 2px;
}
.demo-role-email {
    font-size: 0.75rem;
    color: var(--mid);
}
.demo-login-btn {
    width: 100%;
}
.demo-login-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.demo-login-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(198,181,161,0.2);
}
.demo-real-login {
    font-size: 0.8125rem;
    color: var(--mid);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.demo-real-login:hover {
    color: var(--dark);
}
.demo-login-powered {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 1.5rem;
}
.demo-login-classica-logo {
    height: 16px;
}

@media (max-width: 540px) {
    .demo-login-card {
        padding: 1.5rem 1.25rem;
        margin: 0 0.75rem;
        border-radius: 12px;
    }
    .demo-login-school {
        font-size: 1.5rem;
    }
    .demo-login-subtitle {
        font-size: 0.85rem;
    }
    .demo-role-grid {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }
    .demo-role-card {
        flex-direction: row;
        padding: 1rem 1.25rem;
        gap: 0.75rem;
        text-align: left;
    }
    .demo-role-icon {
        font-size: 1.5rem;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .demo-role-label {
        font-size: 0.9375rem;
    }
    .demo-role-email {
        font-size: 0.75rem;
        word-break: break-all;
    }
    .demo-login-home img {
        height: 32px;
    }
}

/* Tuition Plan Cards */
.tuition-plan-card {
    background: #fff;
    border: 1px solid rgba(198,181,161,0.25);
    border-radius: 10px;
    padding: 1.25rem;
}
.tuition-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.tuition-plan-header h3 {
    font-size: 1.0625rem;
    font-weight: 600;
}
.tuition-plan-amount {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.75rem;
}
.tuition-plan-details {
    font-size: 0.8125rem;
    color: var(--mid);
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 1rem;
}
.tuition-plan-actions {
    display: flex;
    gap: 0.5rem;
}
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    margin-top: 0.5rem;
}
.section-header h2 {
    font-family: 'Instrument Serif', serif;
    font-size: 1.375rem;
    font-weight: 400;
}

/* Application link */
.application-link {
    display: inline-block;
    background: rgba(198,181,161,0.15);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--mid);
    user-select: all;
}

/* Status action buttons */
.status-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.btn-success {
    background: #38a169;
    color: #fff;
    border: 1px solid #38a169;
}
.btn-success:hover { background: #2f855a; }
.btn-danger {
    background: #e53e3e;
    color: #fff;
    border: 1px solid #e53e3e;
}
.btn-danger:hover { background: #c53030; }
.badge-lg {
    font-size: 0.875rem;
    padding: 6px 14px;
}
.badge-orange {
    background: rgba(237,137,54,0.12);
    color: #c05621;
}

/* Detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.detail-card {
    background: #fff;
    border: 1px solid rgba(198,181,161,0.25);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.detail-card h3 {
    font-family: 'Instrument Serif', serif;
    font-size: 1.125rem;
    font-weight: 400;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(198,181,161,0.15);
    font-size: 0.9375rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label {
    color: var(--mid);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ── Recent Grades Cards ── */
.recent-grades-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}
@media (max-width: 900px) {
    .recent-grades-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .recent-grades-grid { grid-template-columns: repeat(2, 1fr); }
}
.grade-card {
    background: #fff;
    border: 1px solid rgba(198,181,161,0.2);
    border-radius: 10px;
    padding: 0.875rem;
    text-align: center;
    transition: box-shadow 0.15s;
}
.grade-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.grade-card-letter {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2px;
}
.grade-card-score {
    font-size: 0.8125rem;
    color: var(--mid);
    margin-bottom: 6px;
}
.grade-card-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.grade-card-meta {
    font-size: 0.75rem;
    color: var(--mid);
    margin-top: 2px;
}
.grade-color-a .grade-card-letter { color: #38a169; }
.grade-color-b .grade-card-letter { color: #3182ce; }
.grade-color-c .grade-card-letter { color: #d69e2e; }
.grade-color-d .grade-card-letter { color: #dd6b20; }
.grade-color-f .grade-card-letter { color: #e53e3e; }
.grade-card.grade-color-a { border: 1px solid #38a169; }
.grade-card.grade-color-b { border: 1px solid #3182ce; }
.grade-card.grade-color-c { border: 1px solid #d69e2e; }
.grade-card.grade-color-d { border: 1px solid #dd6b20; }
.grade-card.grade-color-f { border: 1px solid #e53e3e; }

/* Grade percentage badges */
.grade-pct-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid currentColor;
}
.grade-pct-badge-a { color: #38a169; border-color: #38a169; }
.grade-pct-badge-b { color: #3182ce; border-color: #3182ce; }
.grade-pct-badge-c { color: #d69e2e; border-color: #d69e2e; }
.grade-pct-badge-d { color: #dd6b20; border-color: #dd6b20; }
.grade-pct-badge-f { color: #e53e3e; border-color: #e53e3e; }

/* ── Student Grades Page ── */
.student-course-grade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.student-course-avg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.student-course-avg-letter {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
}
.student-course-avg-pct {
    font-size: 0.875rem;
    color: var(--mid);
}
.grade-a .student-course-avg-letter { color: #38a169; }
.grade-b .student-course-avg-letter { color: #3182ce; }
.grade-c .student-course-avg-letter { color: #d69e2e; }
.grade-d .student-course-avg-letter { color: #dd6b20; }
.grade-f .student-course-avg-letter { color: #e53e3e; }
.student-grades-table {
    width: 100%;
    font-size: 0.875rem;
}
.student-grades-table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
    padding: 8px 12px;
    border-bottom: 1px solid rgba(198,181,161,0.2);
}
.student-grades-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(198,181,161,0.1);
}

/* ── Attendance Calendar (Student View) ── */
.att-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin: 1rem 0;
}
.att-cal-dow {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mid);
    padding: 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.att-cal-day {
    padding: 6px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(198,181,161,0.04);
    aspect-ratio: 2 / 1;
    min-height: auto;
}
.att-cal-empty {
    background: transparent;
}
.att-cal-num {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
}
.att-cal-today {
    background: rgba(249,160,27,0.08);
    border: 1px solid rgba(249,160,27,0.3);
}
.att-cal-weekend {
    background: rgba(198,181,161,0.08);
}
.att-cal-weekend .att-cal-num {
    color: var(--mid);
}
.att-cal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.att-cal-present { background: #38a169; }
.att-cal-absent { background: #e53e3e; }
.att-cal-tardy { background: #d69e2e; }
.att-cal-excused { background: #3182ce; }
.att-cal-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    padding: 0.75rem 0;
    font-size: 0.8125rem;
    color: var(--mid);
}
.att-cal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Calendar: Taller day cells ── */
.cal-day {
    min-height: 90px;
}

/* ── Parent Attendance Calendar ── */
.parent-att-month-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    text-align: center;
}
.parent-att-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.parent-att-dow {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mid);
    padding: 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.parent-att-day {
    aspect-ratio: 2 / 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
}
.parent-att-day-default {
    background: #f5f5f5;
    color: #ccc;
}
.parent-att-day-present {
    background: #E8F5E9;
    color: #2E7D32;
}
.parent-att-day-absent {
    background: #FFEBEE;
    color: #C62828;
}
.parent-att-day-tardy {
    background: #FFF8E1;
    color: #F57F17;
}
.parent-att-day-excused {
    background: #E3F2FD;
    color: #1565C0;
}
.parent-att-day-weekend {
    background: transparent;
    color: #e0e0e0;
}
.parent-att-day-empty {
    background: transparent;
}
.parent-att-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.6875rem;
    color: var(--mid);
}
.parent-att-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    margin-right: 3px;
}
.parent-att-legend-dot-present { background: #E8F5E9; }
.parent-att-legend-dot-absent { background: #FFEBEE; }
.parent-att-legend-dot-tardy { background: #FFF8E1; }
.parent-att-legend-dot-excused { background: #E3F2FD; }

/* ── Parent Dashboard Course Cards (stacked, centered) ── */
.parent-course-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.parent-course-card {
    background: var(--white, #fff);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s ease;
}
.parent-course-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.parent-course-card-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--dark);
}
.parent-course-card-code {
    font-size: 0.75rem;
    color: var(--mid);
}
.parent-course-card-grade {
    font-size: 1.125rem;
    font-weight: 700;
    margin-top: 0.25rem;
}
.parent-course-card-pct {
    font-size: 0.8125rem;
    color: var(--mid);
}

/* ── Parent Child Detail Page ── */
.parent-child-back {
    margin-bottom: 0.5rem;
}
.parent-child-back a {
    font-size: 0.8125rem;
    color: var(--mid);
    text-decoration: none;
}
.parent-child-back-link {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--mid);
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.parent-child-back-link:hover {
    color: var(--dark);
}

.parent-child-header-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.parent-child-header-avatar {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--school-primary, #1a365d);
}

.parent-child-header-avatar-initials {
    background: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
}

.parent-child-header-grade {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--dark);
    margin-top: 0.375rem;
    text-align: center;
}

.parent-child-profile {
    display: none;
}
.parent-child-profile-avatar {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    font-family: 'Schibsted Grotesk', sans-serif;
}

.parent-child-profile-img {
    object-fit: cover;
    border: 3px solid var(--school-primary, #1a365d);
}
.parent-child-grade-level {
    font-size: 0.8125rem;
    color: var(--mid);
}
.parent-child-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.parent-sub-empty {
    color: var(--mid);
    font-size: 0.875rem;
}
.parent-sub-item {
    padding: 0.5rem 0;
    align-items: center;
}
.parent-sub-body {
    flex: 1;
}
.parent-sub-title {
    font-size: 0.875rem;
    font-weight: 500;
}
.parent-sub-course {
    font-size: 0.75rem;
    color: var(--mid);
}
.parent-sub-feedback {
    font-size: 0.75rem;
    color: var(--mid);
    margin-top: 4px;
    font-style: italic;
}
.parent-sub-score-col {
    text-align: right;
}
.parent-sub-score {
    font-weight: 700;
    font-size: 0.875rem;
}
.parent-sub-letter {
    font-size: 1rem;
    color: white;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 3px;
}
.parent-sub-letter.grade-bg-a { background: #2E7D32; }
.parent-sub-letter.grade-bg-b { background: #1565C0; }
.parent-sub-letter.grade-bg-c { background: #F9A825; }
.parent-sub-letter.grade-bg-d { background: #E65100; }
.parent-sub-letter.grade-bg-f { background: #C62828; }

/* ── Parent Grades Detail Page ── */
.parent-grades-back {
    margin-bottom: 0.5rem;
}
.parent-grades-back a {
    font-size: 0.8125rem;
    color: var(--mid);
    text-decoration: none;
}
.parent-grades-subtitle {
    font-size: 0.875rem;
    color: var(--mid);
    margin-bottom: 2rem;
}
.parent-grades-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.parent-grades-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mid);
}
.parent-grades-table th.text-center {
    text-align: center;
}
.parent-grades-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.parent-grades-table td.text-center {
    text-align: center;
}
.parent-grades-table .cat-name {
    font-weight: 500;
}
.parent-grades-table .cat-weight {
    color: var(--mid);
}
.parent-grades-table .assignment-name {
    font-weight: 500;
}
.parent-grades-table .assignment-missing {
    color: #C62828;
    font-size: 0.75rem;
    margin-left: 4px;
}
.parent-grades-table .cat-meta {
    color: var(--mid);
    font-size: 0.8125rem;
}
.parent-grades-table .grade-bold {
    font-weight: 700;
}
.parent-grades-empty {
    color: var(--mid);
    font-size: 0.875rem;
}

/* ─── Lesson Plans ─── */

.lesson-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.lesson-course-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lesson-course-selector label {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}

.lesson-course-selector select {
    min-width: 280px;
}

.term-legend {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.term-legend-item {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    font-family: 'Schibsted Grotesk', sans-serif;
}

.term-legend-item.term-q1 { background: #E3F2FD; color: #1565C0; }
.term-legend-item.term-q2 { background: #FFF3E0; color: #E65100; }
.term-legend-item.term-q3 { background: #E8F5E9; color: #2E7D32; }
.term-legend-item.term-q4 { background: #F3E5F5; color: #7B1FA2; }

.week-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.week-card {
    background: #fff;
    border: 1px solid #e0dcd6;
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: box-shadow 0.15s, border-color 0.15s;
    min-height: 140px;
}

.week-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.week-card.term-q1 { border-left: 3px solid #1565C0; }
.week-card.term-q2 { border-left: 3px solid #E65100; }
.week-card.term-q3 { border-left: 3px solid #2E7D32; }
.week-card.term-q4 { border-left: 3px solid #7B1FA2; }

.week-card.week-current {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(249, 160, 27, 0.25);
}

.week-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.week-number {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--mid);
}

.week-card-dates {
    font-size: 0.75rem;
    color: var(--mid);
}

.week-card-title {
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.3;
}

.week-card-meta {
    font-size: 0.75rem;
    color: var(--mid);
    display: flex;
    align-items: center;
    gap: 4px;
}

.week-card-link {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gold);
    text-decoration: none;
    margin-top: auto;
}

.week-card-link:hover {
    text-decoration: underline;
}

.week-card-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.badge-current {
    background: var(--gold);
    color: #fff;
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    font-family: 'Schibsted Grotesk', sans-serif;
}

.badge-draft { background: #e0dcd6; color: var(--mid); }
.badge-published { background: #E8F5E9; color: #2E7D32; }
.badge-archived { background: #f5f5f5; color: #9e9e9e; }
.badge-term { background: #E3F2FD; color: #1565C0; }

/* Week Editor */
.lesson-week-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.lesson-week-nav {
    display: flex;
    gap: 8px;
}

.lesson-week-info h2 {
    margin-bottom: 4px;
}

.lesson-week-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 0.875rem;
    color: var(--mid);
}

.lesson-section {
    margin-bottom: 20px;
    padding: 20px;
}

.lesson-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 1.125rem;
}

.lesson-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.lesson-section-header .lesson-section-title {
    margin-bottom: 0;
}

.lesson-notes-hint {
    font-size: 0.75rem;
    color: var(--mid);
    margin-bottom: 8px;
    font-style: italic;
}

/* Activity Items */
.activity-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 12px;
    background: var(--cream);
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #e0dcd6;
}

.activity-drag {
    cursor: grab;
    color: var(--tan);
    padding-top: 6px;
}

.activity-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.activity-row-top {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.activity-type-select { max-width: 130px; }
.activity-day-select { max-width: 100px; }
.activity-duration { max-width: 80px; }

.activity-remove { color: var(--danger); }

/* Resource Items */
.resource-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 12px;
    background: var(--cream);
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #e0dcd6;
}

.resource-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.resource-row-top,
.resource-row-bottom {
    display: flex;
    gap: 8px;
}

.resource-row-top select { max-width: 130px; }

/* Save Bar */
.lesson-save-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e0dcd6;
    border-radius: 8px;
    margin-bottom: 40px;
    position: sticky;
    bottom: 16px;
    z-index: 10;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.lesson-status-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lesson-status-toggle label {
    font-weight: 600;
    font-size: 0.875rem;
}

.lesson-status-toggle select { max-width: 140px; }

.lesson-save-actions {
    display: flex;
    gap: 8px;
}

/* View Page */
.lesson-view-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.lesson-view-title {
    margin-bottom: 24px;
}

.lesson-view-title h2 {
    margin-bottom: 8px;
}

.lesson-view-meta {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--mid);
}

.lesson-view-activities {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lesson-view-activity {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--cream);
    border-radius: 6px;
}

.activity-type-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 16px;
    white-space: nowrap;
    font-family: 'Schibsted Grotesk', sans-serif;
}

.activity-type-read { background: #E3F2FD; color: #1565C0; }
.activity-type-discuss { background: #FFF3E0; color: #E65100; }
.activity-type-watch { background: #F3E5F5; color: #7B1FA2; }
.activity-type-do { background: #FBE9E7; color: #BF360C; }
.activity-type-narrate { background: #E8F5E9; color: #2E7D32; }
.activity-type-recite { background: #FCE4EC; color: #C2185B; }
.activity-type-write { background: #ECEFF1; color: #455A64; }
.activity-type-listen { background: #E0F7FA; color: #00838F; }
.activity-type-explore { background: #FFF8E1; color: #F9A825; }

.activity-content {
    flex: 1;
}

.activity-content strong {
    display: block;
    margin-bottom: 2px;
}

.activity-content p {
    font-size: 0.875rem;
    color: var(--mid);
    margin-top: 4px;
}

.activity-meta-info {
    display: flex;
    gap: 8px;
    align-items: center;
}

.activity-day {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mid);
}

.activity-duration-badge {
    font-size: 0.75rem;
    background: #e0dcd6;
    padding: 2px 8px;
    border-radius: 10px;
    color: var(--mid);
    white-space: nowrap;
}

.lesson-view-resources {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lesson-view-resource {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: var(--cream);
    border-radius: 6px;
}

.lesson-view-resource i {
    font-size: 1.25rem;
    color: var(--mid);
    margin-top: 2px;
}

/* Year Management */
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    min-width: 140px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    cursor: pointer;
}

.inline-form {
    display: inline;
}

.term-row {
    padding: 12px;
    background: var(--cream);
    border-radius: 6px;
    border: 1px solid #e0dcd6;
}

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.alert-success {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.alert-error {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

.mb-16 { margin-bottom: 16px; }

.btn-outline {
    background: transparent;
    border: 1px solid #e0dcd6;
    color: var(--dark);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    transition: background 0.15s;
}

.btn-outline:hover {
    background: var(--cream);
}

/* Print styles */
@media print {
    .sidebar, .lesson-week-nav, .lesson-save-bar,
    .lesson-week-actions, .lesson-view-header,
    .no-print { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .week-grid { grid-template-columns: repeat(5, 1fr); }
    .card { box-shadow: none; border: 1px solid #ccc; }
}

/* Honeypot - hidden from humans, visible to bots */
.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────
   FILE MANAGER
   ───────────────────────────────────────────────────────────── */

/* Search bar */
.file-search-bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}
.file-search-bar .search-input-wrap {
    position: relative;
    flex: 1;
    max-width: 400px;
}
.file-search-bar .search-input-wrap i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted, #94a3b8);
}
.file-search-bar .search-input-wrap input {
    padding-left: 2.25rem;
}

/* Toolbar */
.file-toolbar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

/* File Grid */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.file-card {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.file-card:hover {
    border-color: var(--primary, #1a365d);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.file-card-icon {
    font-size: 2.5rem;
    color: var(--primary, #1a365d);
    text-align: center;
}
.file-card-info {
    flex: 1;
    min-width: 0;
}
.file-card-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}
.file-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
}
.file-card-uploader {
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    margin-top: 0.125rem;
}
.file-card-actions {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
}

/* File List View */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.file-list .file-card {
    flex-direction: row;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}
.file-list .file-card-icon {
    font-size: 1.5rem;
    min-width: 2rem;
    text-align: center;
}
.file-list .file-card-info {
    flex: 1;
}
.file-list .file-card-name {
    margin-bottom: 0;
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-color, #e2e8f0);
    border-radius: 0.75rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary, #1a365d);
    background: var(--primary-light, #f0f4ff);
}
.upload-dropzone i {
    font-size: 3rem;
    color: var(--primary, #1a365d);
    display: block;
    margin-bottom: 0.75rem;
}
.upload-dropzone p {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}
.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
}

/* Upload Progress */
.upload-progress-list {
    margin-top: 1rem;
}
.upload-progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    font-size: 0.875rem;
}
.upload-progress-item.success .upload-status { color: var(--success, #16a34a); }
.upload-progress-item.error .upload-status { color: var(--danger, #dc2626); }
.upload-file-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 1rem;
}

/* File Picker Component */
.file-picker {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.5rem;
    padding: 1rem;
}
.file-picker-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.file-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-muted, #f8fafc);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}
.file-picker-item i { color: var(--primary, #1a365d); }
.file-picker-item .file-picker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-item .btn-remove {
    background: none;
    border: none;
    color: var(--danger, #dc2626);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1rem;
}

/* File Picker Modal */
.file-picker-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}
.file-picker-modal.active { display: flex; }
.file-picker-modal-content {
    background: var(--card-bg, #fff);
    border-radius: 0.75rem;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
}
.file-picker-browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}
.file-picker-browse-item {
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s;
    font-size: 0.8rem;
}
.file-picker-browse-item:hover,
.file-picker-browse-item.selected {
    border-color: var(--primary, #1a365d);
    background: var(--primary-light, #f0f4ff);
}
.file-picker-browse-item i {
    font-size: 1.75rem;
    color: var(--primary, #1a365d);
    display: block;
    margin-bottom: 0.375rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color, #e2e8f0);
    overflow-x: auto;
}
.tab {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #64748b);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text-primary, #1e293b); }
.tab.active {
    color: var(--primary, #1a365d);
    border-bottom-color: var(--primary, #1a365d);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   CHANNELS — Slack-like Messaging System
   ═══════════════════════════════════════════════════════════ */

/* Override main-content padding for channels page */
.channels-app {
    display: flex;
    height: calc(100vh - 0px);
    margin: -2rem;
    overflow: hidden;
}

/* ── Left Panel: Channel Sidebar ── */
.channels-sidebar {
    width: 280px;
    min-width: 280px;
    background: #2B261C;
    color: #e8e0d4;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.channels-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem 0.75rem;
}

.channels-sidebar-header h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.channels-sidebar-actions {
    display: flex;
    gap: 0.25rem;
}

.channels-sidebar .btn-icon {
    color: #c4b89a;
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: background 0.15s;
}

.channels-sidebar .btn-icon:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.channels-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 0 0.75rem 0.5rem;
    background: rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #a09585;
}

.channels-search i {
    font-size: 0.875rem;
}

.channels-search input {
    border: none;
    background: transparent;
    color: #e8e0d4;
    font-size: 0.8125rem;
    width: 100%;
    outline: none;
}

.channels-search input::placeholder {
    color: #8a7d6b;
}

.channels-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

.channels-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a7d6b;
    padding: 1rem 0.75rem 0.375rem;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    margin-bottom: 1px;
}

.channel-item:hover {
    background: rgba(255,255,255,0.06);
}

.channel-item.active {
    background: rgba(249,160,27,0.15);
    color: #fff;
}

.channel-item-icon {
    font-size: 1rem;
    color: #8a7d6b;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.channel-item.active .channel-item-icon {
    color: #F9A01B;
}

.channel-item-info {
    flex: 1;
    min-width: 0;
}

.channel-item-name {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-item.has-unread .channel-item-name {
    font-weight: 700;
    color: #fff;
}

.channel-item-preview {
    font-size: 0.6875rem;
    color: #8a7d6b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-unread-badge {
    background: #F9A01B;
    color: #1a1611;
    font-size: 0.6875rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
}

.channels-sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.channels-directory-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: #c4b89a;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    transition: background 0.12s;
}

.channels-directory-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

/* ── Center Panel: Message Feed ── */
.channels-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    background: #fff;
}

.channels-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9e9588;
    gap: 0.75rem;
}

.channels-empty-state i {
    font-size: 3rem;
    color: #d4cdc2;
}

.channels-empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #5a5347;
    margin: 0;
}

.channels-empty-state p {
    margin: 0;
    font-size: 0.875rem;
}

.channels-feed {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.channels-feed-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #e8e2d9;
    background: #fff;
    gap: 0.75rem;
    flex-shrink: 0;
}

.channels-back-btn {
    display: none;
}

.channels-feed-title {
    flex: 1;
    min-width: 0;
}

.channels-feed-title h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #2B261C;
}

.channels-feed-meta {
    font-size: 0.75rem;
    color: #9e9588;
}

.channels-feed-actions {
    display: flex;
    gap: 0.25rem;
}

.channels-feed-actions .btn-icon {
    color: #7a7265;
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.channels-feed-actions .btn-icon:hover {
    background: #f0ebe4;
}

/* Messages area */
.channels-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.channels-messages-list {
    padding: 0 1.25rem;
}

/* Date divider */
.msg-date-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0 0.75rem;
}

.msg-date-divider::before,
.msg-date-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e8e2d9;
}

.msg-date-divider span {
    padding: 0 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #9e9588;
    white-space: nowrap;
}

/* Message row */
.msg-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    position: relative;
}

.msg-row:hover {
    background: #faf8f5;
    border-radius: 6px;
    margin: 0 -0.5rem;
    padding: 0.5rem;
}

.msg-row:hover .msg-actions {
    opacity: 1;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #e8e2d9;
    color: #5a5347;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.msg-avatar.small {
    width: 28px;
    height: 28px;
    font-size: 0.625rem;
    border-radius: 6px;
}

.msg-body {
    flex: 1;
    min-width: 0;
}

.msg-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.125rem;
}

.msg-sender {
    font-weight: 700;
    font-size: 0.875rem;
    color: #2B261C;
}

.msg-role-tag {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 1px 6px;
    border-radius: 3px;
}

.msg-role-admin { background: #fef3cd; color: #856404; }
.msg-role-teacher { background: #d4edda; color: #155724; }
.msg-role-student { background: #d1ecf1; color: #0c5460; }
.msg-role-parent { background: #e2d5f1; color: #4a2d7a; }

.msg-time {
    font-size: 0.6875rem;
    color: #b5ad9f;
}

.msg-edited {
    font-size: 0.6875rem;
    color: #b5ad9f;
    font-style: italic;
}

.msg-content {
    font-size: 0.875rem;
    color: #3d362d;
    line-height: 1.5;
    word-wrap: break-word;
}

.msg-content a {
    color: #b8860b;
    text-decoration: underline;
}

/* Reactions */
.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.375rem;
}

.msg-reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid #e8e2d9;
    background: #faf8f5;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.12s;
}

.msg-reaction-pill:hover {
    border-color: #F9A01B;
    background: #fef9f0;
}

.msg-reaction-pill.mine {
    border-color: #F9A01B;
    background: #fef3cd;
}

/* Thread link */
.msg-thread-link {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #b8860b;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
    font-weight: 600;
}

.msg-thread-link:hover {
    text-decoration: underline;
}

/* Message actions (hover) */
.msg-actions {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    display: flex;
    gap: 0.125rem;
    opacity: 0;
    transition: opacity 0.12s;
    background: #fff;
    border: 1px solid #e8e2d9;
    border-radius: 6px;
    padding: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.msg-actions button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    color: #7a7265;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.msg-actions button:hover {
    background: #f0ebe4;
    color: #2B261C;
}

.msg-actions .msg-delete-btn:hover {
    background: #fde8e8;
    color: #c53030;
}

/* Typing indicator */
.channels-typing {
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    color: #9e9588;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.typing-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #9e9588;
    margin: 0 1px;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
}

/* Message input */
.channels-input {
    padding: 0.75rem 1.25rem 1rem;
    border-top: 1px solid #e8e2d9;
    background: #fff;
    flex-shrink: 0;
}

.channels-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: #f5f1eb;
    border: 1px solid #e0d9cf;
    border-radius: 12px;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
}

.channels-input-bar textarea {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.875rem;
    color: #2B261C;
    resize: none;
    outline: none;
    font-family: inherit;
    line-height: 1.5;
    max-height: 120px;
    min-height: 24px;
}

.channels-input-bar textarea::placeholder {
    color: #b5ad9f;
}

.channels-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: #F9A01B;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: background 0.15s;
    flex-shrink: 0;
}

.channels-send-btn:hover {
    background: #e08f17;
}

/* ── Right Panel: Details ── */
.channels-details {
    width: 300px;
    min-width: 300px;
    border-left: 1px solid #e8e2d9;
    background: #faf8f5;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.channels-details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e8e2d9;
}

.channels-details-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #2B261C;
}

.channels-details-header .btn-icon {
    color: #7a7265;
    background: transparent;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.channels-details-body {
    padding: 1rem 1.25rem;
}

.channels-details-section {
    margin-bottom: 1.5rem;
}

.channels-details-section h4 {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #5a5347;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.channels-count-badge {
    font-size: 0.6875rem;
    color: #9e9588;
    font-weight: 400;
}

.channels-members-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0;
}

.member-info {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.member-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #2B261C;
}

/* ── Thread Panel ── */
.channels-thread {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 380px;
    background: #fff;
    border-left: 1px solid #e8e2d9;
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: -4px 0 12px rgba(0,0,0,0.06);
}

.channels-thread-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e8e2d9;
}

.channels-thread-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.channels-thread-header .btn-icon {
    color: #7a7265;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.channels-thread-parent {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #e8e2d9;
    background: #faf8f5;
}

.channels-thread-replies {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1.25rem;
}

.channels-thread-input {
    border-top: 1px solid #e8e2d9;
}

/* ── Emoji Picker ── */
.emoji-picker {
    position: fixed;
    background: #fff;
    border: 1px solid #e8e2d9;
    border-radius: 10px;
    padding: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 100;
}

.emoji-picker-grid {
    display: flex;
    gap: 0.25rem;
}

.emoji-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover {
    background: #f0ebe4;
}

/* ── Modals ── */
.modal-overlay.channels-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.channels-modal {
    background: #fff;
    border-radius: 12px;
    width: 460px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e8e2d9;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.modal-header .btn-icon {
    color: #7a7265;
    background: transparent;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
}

.modal-body .channels-search {
    margin: 0 0 0.75rem;
    background: #f5f1eb;
}

.modal-body .channels-search input {
    color: #2B261C;
}

/* User results in modals */
.channels-user-results {
    max-height: 300px;
    overflow-y: auto;
}

.user-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s;
}

.user-result-item:hover {
    background: #f5f1eb;
}

.user-result-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-result-info span:first-child {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Selected members chips */
.channels-selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.selected-member-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    background: #f0ebe4;
    border-radius: 16px;
    font-size: 0.8125rem;
}

.selected-member-chip button {
    border: none;
    background: none;
    cursor: pointer;
    color: #7a7265;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
}

/* Search results */
.channels-search-results {
    margin-top: 0.75rem;
}

.search-result-item {
    padding: 0.75rem;
    border-bottom: 1px solid #f0ebe4;
    cursor: pointer;
    border-radius: 6px;
}

.search-result-item:hover {
    background: #f5f1eb;
}

.search-result-channel {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #b8860b;
}

.search-result-sender {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #2B261C;
}

.search-result-content {
    font-size: 0.8125rem;
    color: #5a5347;
    margin: 0.25rem 0;
}

.search-result-time {
    font-size: 0.6875rem;
    color: #b5ad9f;
}

.channels-empty-msg {
    padding: 2rem;
    text-align: center;
    color: #9e9588;
    font-size: 0.875rem;
}

/* ── Directory Page ── */
.directory-page {
    padding: 0;
}

.directory-header {
    margin-bottom: 1.5rem;
}

.directory-filters {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.directory-search-bar {
    margin: 0;
    background: #f5f1eb;
    max-width: 400px;
}

.directory-search-bar input {
    color: #2B261C;
}

.directory-role-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.directory-role-btn {
    padding: 0.375rem 1rem;
    border: 1px solid #e0d9cf;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #5a5347;
    transition: all 0.12s;
}

.directory-role-btn:hover {
    border-color: #F9A01B;
    color: #F9A01B;
}

.directory-role-btn.active {
    background: #F9A01B;
    border-color: #F9A01B;
    color: #fff;
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.directory-card {
    background: #fff;
    border: 1px solid #e8e2d9;
    border-radius: 10px;
    padding: 1.5rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: box-shadow 0.15s;
}

.directory-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.directory-card-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #e8e2d9;
    color: #5a5347;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
}

.directory-card-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2B261C;
}

.directory-dm-btn {
    margin-top: 0.5rem;
}

/* Form styling in modals */
.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body .form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: #5a5347;
}

.modal-body .form-group input,
.modal-body .form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e0d9cf;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #fff;
    color: #2B261C;
}

.modal-body .form-group input:focus,
.modal-body .form-group select:focus {
    outline: none;
    border-color: #F9A01B;
    box-shadow: 0 0 0 3px rgba(249,160,27,0.15);
}

.modal-body .btn-primary {
    width: 100%;
    padding: 0.625rem;
    background: #F9A01B;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.modal-body .btn-primary:hover {
    background: #e08f17;
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
    .channels-app {
        position: relative;
    }

    .channels-sidebar {
        position: absolute;
        inset: 0;
        width: 100%;
        min-width: unset;
        z-index: 20;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .channels-sidebar.show {
        transform: translateX(0);
    }

    .channels-main {
        width: 100%;
    }

    .channels-main.show .channels-feed,
    .channels-main.show .channels-empty-state {
        display: flex;
    }

    .channels-back-btn {
        display: flex;
    }

    .channels-details {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 15;
        width: 100%;
        min-width: unset;
    }

    .channels-thread {
        width: 100%;
    }

    .directory-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Initial mobile state */
@media (max-width: 768px) {
    .channels-sidebar {
        transform: translateX(0);
    }
}

/* ─────────────────────────────────────────────────────────────
   HOUSES SYSTEM
   ───────────────────────────────────────────────────────────── */

/* Leaderboard */
.house-leaderboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.house-leaderboard-card {
    background: #fff;
    border-radius: 12px;
    border: 2px solid rgba(0,0,0,0.06);
    border-top: 4px solid var(--house-color, var(--mid));
    padding: 1.5rem;
    text-align: center;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.house-leaderboard-card:hover {
    border-color: var(--house-color, var(--gold));
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.house-leaderboard-card.house-card-mine {
    border-color: var(--house-color, var(--gold));
    background: rgba(249,160,27,0.03);
}

.house-rank {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--house-color, var(--mid));
}

.house-card-icon {
    font-size: 2.5rem;
    color: var(--house-color, var(--mid));
    line-height: 1;
}

.house-card-name {
    font-family: 'Instrument Serif', serif;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--dark);
    margin: 0;
}

.house-card-points {
    font-family: 'Instrument Serif', serif;
    font-size: 2.5rem;
    color: var(--house-color, var(--dark));
    line-height: 1.1;
}

.house-card-points-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mid);
}

.house-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 100px;
    overflow: hidden;
    margin: 0.25rem 0;
}

.house-progress-fill {
    height: 100%;
    background: var(--house-color, var(--gold));
    border-radius: 100px;
    transition: width 0.4s ease;
}

.house-card-members {
    font-size: 0.8125rem;
    color: var(--mid);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.house-card-members i { font-size: 1rem; }

/* House dot (color indicator) */
.house-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--house-color, var(--mid));
    flex-shrink: 0;
}

/* Hero section */
.house-hero {
    background: linear-gradient(135deg, var(--house-color, #333) 0%, color-mix(in srgb, var(--house-color, #333) 70%, #000) 100%);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    margin-bottom: 1.5rem;
    color: #fff;
}

.house-hero-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.house-hero-icon {
    font-size: 4rem;
    opacity: 0.9;
}

.house-hero-name {
    font-family: 'Instrument Serif', serif;
    font-size: 3rem;
    font-weight: 400;
    margin: 0;
    color: #fff;
}

.house-hero-motto {
    font-size: 1.125rem;
    opacity: 0.85;
    font-style: italic;
    margin-top: 0.25rem;
}

/* Members grid */
.house-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.house-member-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.1s;
}

.house-member-item:hover { background: rgba(0,0,0,0.02); }

.house-member-leader {
    background: rgba(249,160,27,0.04);
    border: 1px solid rgba(249,160,27,0.15);
}

.house-member-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.house-member-info { min-width: 0; }

.house-member-name {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.house-member-meta {
    font-size: 0.75rem;
    color: var(--mid);
}

.house-member-role {
    color: var(--gold);
    font-weight: 600;
}

/* Assign page */
.house-assign-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.house-assign-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.house-assign-item input[type="checkbox"] {
    accent-color: var(--gold);
}

.house-assign-select {
    width: auto;
    min-width: 120px;
}

/* Dashboard widget */
.house-widget {
    padding: 1rem 1.25rem;
}

.house-widget-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.house-widget-row:last-child { border-bottom: none; }

.house-widget-mine {
    background: rgba(249,160,27,0.04);
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    margin: 0 -0.5rem;
}

.house-widget-rank {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--mid);
    min-width: 28px;
}

.house-widget-name {
    font-size: 0.8125rem;
    font-weight: 500;
    min-width: 80px;
}

.house-widget-bar {
    flex: 1;
    height: 6px;
    background: rgba(0,0,0,0.04);
    border-radius: 100px;
    overflow: hidden;
}

.house-widget-bar-fill {
    height: 100%;
    background: var(--house-color, var(--gold));
    border-radius: 100px;
    transition: width 0.4s ease;
}

.house-widget-pts {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--dark);
    min-width: 36px;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .house-leaderboard { grid-template-columns: repeat(2, 1fr); }
    .house-hero { padding: 1.5rem; }
    .house-hero-name { font-size: 2rem; }
    .house-hero-icon { font-size: 2.5rem; }
    .house-members-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .house-leaderboard { grid-template-columns: 1fr; }
}

/* ========================================
   SUPER ADMIN PANEL
   ======================================== */

/* Impersonation Banner */
.impersonation-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #8B5CF6, #A855F7);
    color: #fff;
    text-align: center;
    padding: 0.5rem 1rem;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.impersonation-banner a {
    color: #FDE68A;
    text-decoration: underline;
    margin-left: 0.5rem;
    font-weight: 700;
}
.impersonation-banner ~ .app-layout { margin-top: 2.25rem; }
.impersonation-banner ~ .app-layout .sidebar { top: 2.25rem; }

/* Super Admin Body */
.super-admin-body { background: #F5F3F0; }

/* Super Admin Sidebar */
.super-sidebar {
    background: #0F0D0A !important;
}
.super-sidebar .sidebar-logo {
    padding: 1.25rem 1rem;
}
.super-logo-text {
    font-family: 'Instrument Serif', serif;
    font-size: 1.25rem;
    color: #F9A01B;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.super-logo-text i { font-size: 1.4rem; }
.super-sidebar .nav-item.active {
    background: rgba(249, 160, 27, 0.15);
    color: #F9A01B;
}
.super-sidebar .nav-section {
    color: #6F5C44;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.75rem 1rem 0.25rem;
}

/* Platform Admin link in regular sidebar */
.nav-item-super {
    color: #F9A01B !important;
    border-top: 1px solid rgba(255,255,255,0.08);
    margin-top: 0.25rem;
    padding-top: 0.75rem !important;
}

/* Super Admin Metrics Row */
.super-metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.super-stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 1px solid rgba(0,0,0,0.06);
}
.super-stat-card.super-stat-sm { padding: 1rem; }
.super-stat-card.super-stat-revenue {
    background: linear-gradient(135deg, #1E1A14, #2B261C);
    color: #fff;
}
.super-stat-card.super-stat-revenue .super-stat-label { color: #C6B5A1; }
.super-stat-icon {
    font-size: 1.5rem;
    color: var(--gold);
    margin-bottom: 0.25rem;
}
.super-stat-revenue .super-stat-icon { color: #F9A01B; }
.super-stat-value {
    font-family: 'Instrument Serif', serif;
    font-size: 2rem;
    line-height: 1.1;
}
.super-stat-sm .super-stat-value { font-size: 1.5rem; }
.super-stat-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
}

/* Super Admin Grid */
.super-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) {
    .super-grid-2 { grid-template-columns: 1fr; }
}

/* Super Admin Panel */
.super-panel {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
}
.super-panel-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dark);
}
.super-panel-title i { color: var(--gold); }
.super-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.super-panel-header .super-panel-title { margin-bottom: 0; }

/* Super Admin Table */
.super-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.super-table th {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid rgba(0,0,0,0.08);
    font-weight: 600;
}
.super-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    vertical-align: middle;
}
.super-table tr:hover td { background: rgba(0,0,0,0.015); }
.super-table a { color: var(--dark); font-weight: 500; }
.super-table a:hover { color: var(--gold); }

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: 'Schibsted Grotesk', sans-serif;
}
.status-active { background: #D1FAE5; color: #065F46; }
.status-trialing { background: #DBEAFE; color: #1E40AF; }
.status-suspended { background: #FED7AA; color: #9A3412; }
.status-canceled { background: #FEE2E2; color: #991B1B; }
.status-past_due { background: #FEF3C7; color: #92400E; }

/* Plan Badges */
.plan-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: 'Schibsted Grotesk', sans-serif;
    background: #F3F4F6;
    color: #374151;
}
.plan-academy { background: #FEF3C7; color: #92400E; }
.plan-growth { background: #D1FAE5; color: #065F46; }
.plan-starter { background: #DBEAFE; color: #1E40AF; }
.plan-tutorials { background: #E0E7FF; color: #3730A3; }
.plan-hearth { background: #FCE7F3; color: #9D174D; }
.plan-trial { background: #F3F4F6; color: #6B7280; }
.plan-custom { background: #EDE9FE; color: #5B21B6; }

/* Activity Feed */
.activity-feed { display: flex; flex-direction: column; gap: 0.75rem; }
.activity-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.activity-action {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--dark);
    text-transform: capitalize;
}
.activity-action::before { content: ''; }
.activity-detail {
    font-size: 0.8rem;
    color: var(--mid);
    margin-top: 0.15rem;
}
.activity-school { color: var(--gold); font-weight: 500; }
.activity-user { font-weight: 500; }
.activity-time {
    font-size: 0.7rem;
    color: #9CA3AF;
    margin-top: 0.15rem;
}

/* Activity Timeline */
.activity-timeline { position: relative; }
.activity-date-header {
    font-family: 'Instrument Serif', serif;
    font-size: 1rem;
    color: var(--dark);
    margin: 1rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
.activity-date-header:first-child { margin-top: 0; }
.activity-timeline-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
}
.activity-timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    margin-top: 0.4rem;
    flex-shrink: 0;
}
.activity-timeline-content { flex: 1; }

/* Health Indicators */
.health-indicators {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}
.health-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}
.health-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.health-green { background: #10B981; }
.health-yellow { background: #F59E0B; }
.health-red { background: #EF4444; }

/* Super Admin Toolbar / Filters */
.super-toolbar {
    margin-bottom: 1.5rem;
}
.super-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.super-filters .form-input,
.super-filters .form-select {
    padding: 0.4rem 0.75rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 8px;
    font-size: 0.8rem;
    background: #fff;
    font-family: 'Instrument Sans', sans-serif;
}
.super-filters .form-input { min-width: 200px; }
.super-result-count {
    font-size: 0.8rem;
    color: var(--mid);
    margin-bottom: 0.75rem;
}

/* Super Admin Bulk Actions */
.super-bulk-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* Super Admin Detail Page */
.super-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.super-detail-sub {
    font-size: 0.875rem;
    color: var(--mid);
    margin-bottom: 0.5rem;
}
.super-detail-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Inline forms */
.inline-form { display: inline; }

/* Feature Toggle */
.feature-flags-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.feature-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}
.feature-name {
    font-size: 0.8rem;
    font-weight: 500;
}
.toggle-btn {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    border: none;
    cursor: pointer;
    letter-spacing: 0.04em;
}
.toggle-on { background: #D1FAE5; color: #065F46; }
.toggle-off { background: #F3F4F6; color: #9CA3AF; }

/* Revenue Plan Breakdown */
.plan-breakdown { display: flex; flex-direction: column; gap: 0.75rem; }
.plan-row {
    display: grid;
    grid-template-columns: 80px 100px 80px 1fr;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
}
.plan-count { color: var(--mid); }
.plan-revenue { font-weight: 600; text-align: right; }
.plan-bar {
    height: 6px;
    background: #F3F4F6;
    border-radius: 3px;
    overflow: hidden;
}
.plan-bar-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 3px;
    min-width: 2px;
}

/* Estimate List */
.estimate-list { display: flex; flex-direction: column; gap: 0.75rem; }
.estimate-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 0.875rem;
}
.estimate-row span:last-child { font-weight: 600; }

/* Buttons for super admin */
.btn-warning {
    background: #F59E0B;
    color: #fff;
    border: none;
    cursor: pointer;
}
.btn-warning:hover { background: #D97706; }
.btn-success {
    background: #10B981;
    color: #fff;
    border: none;
    cursor: pointer;
}
.btn-success:hover { background: #059669; }
.btn-danger {
    background: #EF4444;
    color: #fff;
    border: none;
    cursor: pointer;
}
.btn-danger:hover { background: #DC2626; }
.btn-ghost {
    background: transparent;
    color: var(--mid);
    border: 1px solid rgba(0,0,0,0.12);
}
.btn-xs {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    border-radius: 6px;
    background: #F3F4F6;
    border: none;
    cursor: pointer;
}
.btn-xs:hover { background: #E5E7EB; }

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}
.alert-success { background: #D1FAE5; color: #065F46; }

/* Settings form elements */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--dark);
}
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: 'Instrument Sans', sans-serif;
    resize: vertical;
}
.form-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--mid);
    margin-top: 0.25rem;
}
.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.form-actions {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.empty-state {
    text-align: center;
    color: var(--mid);
    padding: 2rem;
    font-size: 0.875rem;
}

/* ============================================
   AI ASSISTANT
   ============================================ */

/* Layout */
.ai-assistant-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}

/* Prompt Type Selector */
.ai-type-selector {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.ai-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--mid);
}

.ai-type-card i {
    font-size: 1.25rem;
}

.ai-type-card:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ai-type-card.active {
    border-color: var(--primary);
    background: var(--primary-light, rgba(var(--primary-rgb, 79, 70, 229), 0.06));
    color: var(--primary);
    font-weight: 600;
}

/* Form */
.ai-form {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.ai-form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ai-form-fields .form-group:last-child {
    grid-column: 1 / -1;
}

.ai-optional {
    font-weight: 400;
    color: var(--mid);
    font-size: 0.75rem;
}

.ai-generate-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9375rem;
}

.ai-generate-btn i {
    margin-right: 0.25rem;
}

/* Loading */
.ai-loading {
    text-align: center;
    padding: 3rem 1rem;
}

.ai-loading-sparkle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-light, rgba(var(--primary-rgb, 79, 70, 229), 0.08));
    margin-bottom: 1rem;
    animation: ai-pulse 1.5s ease-in-out infinite;
}

.ai-loading-sparkle i {
    font-size: 1.75rem;
    color: var(--primary);
}

@keyframes ai-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

.ai-loading p {
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.ai-loading-sub {
    font-weight: 400 !important;
    color: var(--mid) !important;
    font-size: 0.8125rem;
    margin-top: 0.25rem !important;
}

/* Results */
.ai-results {
    margin-top: 1.5rem;
}

.ai-result-card {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.ai-result-title {
    font-size: 1.125rem;
    margin: 0 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-result-title i {
    color: var(--primary);
}

.ai-result-overview {
    color: var(--mid);
    margin: 0;
    line-height: 1.6;
}

.ai-result-card h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--dark);
}

.ai-result-card h4 i {
    color: var(--primary);
}

.ai-result-list {
    margin: 0;
    padding-left: 1.25rem;
}

.ai-result-list li {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    color: var(--dark);
}

.ai-result-list-numbered {
    list-style: decimal;
}

/* Activity items in results */
.ai-activities-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ai-activity-item {
    padding: 0.75rem;
    background: var(--bg, #f8f9fa);
    border-radius: 8px;
}

.ai-activity-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    flex-wrap: wrap;
}

.ai-activity-header strong {
    font-size: 0.875rem;
}

.ai-activity-day {
    font-size: 0.75rem;
    color: var(--mid);
    margin-left: auto;
}

.ai-activity-duration {
    font-size: 0.75rem;
    color: var(--mid);
    background: var(--white);
    padding: 0.125rem 0.5rem;
    border-radius: 100px;
}

.ai-activity-item p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--mid);
    line-height: 1.5;
}

/* Badge variants for activity types */
.badge-activity-read { background: #dbeafe; color: #1e40af; }
.badge-activity-discuss { background: #fce7f3; color: #9d174d; }
.badge-activity-watch { background: #e0e7ff; color: #3730a3; }
.badge-activity-do { background: #d1fae5; color: #065f46; }
.badge-activity-narrate { background: #fef3c7; color: #92400e; }
.badge-activity-recite { background: #ede9fe; color: #5b21b6; }
.badge-activity-write { background: #f3e8ff; color: #6b21a8; }
.badge-activity-listen { background: #cffafe; color: #155e75; }
.badge-activity-explore { background: #ecfccb; color: #3f6212; }

/* Resources in results */
.ai-resources-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-resource-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.ai-resource-link {
    color: var(--primary);
}

/* Result actions */
.ai-result-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Error */
.ai-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

/* History Panel */
.ai-history-panel {
    position: sticky;
    top: 1rem;
}

.ai-history-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--dark);
}

.ai-history-empty {
    font-size: 0.8125rem;
    color: var(--mid);
}

.ai-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-history-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.ai-history-item:hover {
    border-color: var(--primary);
}

.ai-history-item-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.25rem;
}

.ai-history-type {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary);
}

.ai-history-item-text {
    font-size: 0.8125rem;
    color: var(--dark);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-history-item-meta {
    font-size: 0.6875rem;
    color: var(--mid);
    margin-top: 0.25rem;
}

/* AI Suggest button on lesson plan page */
.ai-suggest-btn {
    border-color: var(--primary);
    color: var(--primary);
}

.ai-suggest-btn:hover {
    background: var(--primary);
    color: var(--white);
}

/* Settings Page */
.ai-settings-section {
    margin-bottom: 1.5rem;
}

.ai-settings-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-settings-desc {
    color: var(--mid);
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

/* Toggle */
.ai-toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}

.ai-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ai-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 100px;
    transition: 0.2s;
}

.ai-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.ai-toggle input:checked + .ai-toggle-slider {
    background: var(--primary);
}

.ai-toggle input:checked + .ai-toggle-slider::before {
    transform: translateX(20px);
}

/* Worldview Grid */
.ai-worldview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.ai-worldview-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.375rem;
    padding: 1.25rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--white);
}

.ai-worldview-card input[type="radio"] {
    display: none;
}

.ai-worldview-card i {
    font-size: 1.5rem;
    color: var(--mid);
}

.ai-worldview-card strong {
    font-size: 0.875rem;
}

.ai-worldview-card span {
    font-size: 0.75rem;
    color: var(--mid);
    line-height: 1.4;
}

.ai-worldview-card:hover {
    border-color: var(--primary);
}

.ai-worldview-card.active {
    border-color: var(--primary);
    background: var(--primary-light, rgba(var(--primary-rgb, 79, 70, 229), 0.04));
}

.ai-worldview-card.active i {
    color: var(--primary);
}

/* Stats */
.ai-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.ai-stat-card {
    text-align: center;
    padding: 1rem;
    background: var(--bg, #f8f9fa);
    border-radius: 10px;
}

.ai-stat-value {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.ai-stat-label {
    font-size: 0.75rem;
    color: var(--mid);
    margin-top: 0.25rem;
}

.ai-settings-actions {
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .ai-assistant-layout {
        grid-template-columns: 1fr;
    }
    .ai-type-selector {
        grid-template-columns: repeat(3, 1fr);
    }
    .ai-form-fields {
        grid-template-columns: 1fr;
    }
    .ai-worldview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ai-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ai-history-panel {
        position: static;
    }
}

@media (max-width: 480px) {
    .ai-type-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    .ai-worldview-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   SCHOOL YEARS - Year Turnover System
   ============================================ */

/* Timeline */
.year-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 1.5rem 0;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.year-timeline-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding: 0 1rem;
}

.year-timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -0.5rem;
    top: 50%;
    width: 1.5rem;
    height: 2px;
    background: var(--border);
}

.year-timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
}

.year-timeline-item.year-active .year-timeline-dot {
    background: var(--green, #22c55e);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
}

.year-timeline-item.year-archived .year-timeline-dot {
    background: var(--mid);
}

.year-timeline-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.year-timeline-name {
    font-weight: 600;
    font-size: 0.875rem;
}

/* Year Cards */
.year-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.year-card {
    background: var(--white, #fff);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: box-shadow 0.2s;
}

.year-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.year-card-active {
    border-color: var(--green, #22c55e);
    border-width: 2px;
}

.year-card-archived {
    opacity: 0.7;
}

.year-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.year-card-name {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
}

.year-card-dates {
    font-size: 0.8125rem;
    color: var(--mid);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.year-card-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.year-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.year-stat-value {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.year-stat-label {
    font-size: 0.6875rem;
    color: var(--mid);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.year-card-actions {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

/* Quick Links */
.year-quicklinks {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.year-quicklink {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--white, #fff);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.year-quicklink:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.year-quicklink i {
    font-size: 1.25rem;
}

/* Wizard Steps */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
    position: relative;
}

.wizard-step:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -1rem;
    top: 50%;
    width: 2rem;
    height: 2px;
    background: var(--border);
}

.wizard-step-active:not(:last-child)::after {
    background: var(--primary);
}

.wizard-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--border);
    color: var(--mid);
}

.wizard-step-active .wizard-step-num {
    background: var(--primary);
    color: white;
}

.wizard-step-done .wizard-step-num {
    background: var(--green, #22c55e);
    color: white;
}

.wizard-step-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--mid);
}

.wizard-step-active .wizard-step-label {
    color: var(--dark);
}

/* Clone Results */
.clone-results {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
}

.clone-result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg, #f8f9fa);
    border-radius: 10px;
    min-width: 120px;
}

.clone-result-value {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--green, #22c55e);
    line-height: 1;
}

.clone-result-label {
    font-size: 0.75rem;
    color: var(--mid);
    margin-top: 0.25rem;
}

/* Clone Options */
.clone-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.clone-suboption {
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
}

.clone-select-all {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

/* Clone Review */
.clone-review {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg, #f8f9fa);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.review-row {
    font-size: 0.875rem;
}

/* Promote */
.promote-bulk-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.promote-select {
    min-width: 160px;
}

/* Compare */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.compare-stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.compare-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.compare-stat-value {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.compare-stat-label {
    font-size: 0.75rem;
    color: var(--mid);
}

.compare-changes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compare-change-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.compare-change-label {
    font-weight: 500;
}

.compare-change-value {
    font-weight: 600;
}

.text-green { color: var(--green, #22c55e); }
.text-red { color: var(--red, #ef4444); }

/* Last Year This Week Widget */
.lytw-widget {
    border-left: 3px solid var(--primary);
}

.lytw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.lytw-card {
    background: var(--bg, #f8f9fa);
    border-radius: 8px;
    padding: 1rem;
}

.lytw-course {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mid);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.lytw-title {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
}

.lytw-meta {
    font-size: 0.8125rem;
    color: var(--mid);
    margin-bottom: 0.5rem;
}

.lytw-actions {
    display: flex;
    gap: 0.375rem;
}

/* Archive */
.archive-warning {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: start;
    margin-bottom: 1.5rem;
}

.archive-info ul {
    margin: 0.5rem 0 1rem;
    padding-left: 1.25rem;
}

.archive-info li {
    margin-bottom: 0.375rem;
}

.archive-stats {
    display: flex;
    gap: 1.5rem;
}

/* Year View */
.year-view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.year-view-actions {
    display: flex;
    gap: 0.375rem;
}

/* Term Preview */
.term-week-preview {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.term-preview-item {
    font-size: 0.8125rem;
    color: var(--mid);
    padding: 0.25rem 0.75rem;
    background: var(--bg, #f8f9fa);
    border-radius: 6px;
}

/* Badge colors */
.badge-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.badge-yellow {
    background: rgba(234, 179, 8, 0.1);
    color: #ca8a04;
}

.badge-red {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Responsive */
@media (max-width: 768px) {
    .year-cards { grid-template-columns: 1fr; }
    .compare-grid { grid-template-columns: 1fr; }
    .wizard-step-label { display: none; }
    .archive-warning { grid-template-columns: 1fr; }
    .year-quicklinks { flex-direction: column; }
    .lytw-grid { grid-template-columns: 1fr; }
}

/* ===== Parent Dashboard ===== */

.dashboard-date {
    color: var(--mid);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Parent Dashboard - Child-Specific View */
.pd-child-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.pd-child-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--mid);
    background: #fff;
    border: 1px solid var(--tan);
    transition: all 0.15s;
}

.pd-child-pill:hover {
    border-color: var(--gold);
    color: var(--dark);
}

.pd-child-pill--active {
    background: var(--gold);
    color: #fff;
    border-color: var(--gold);
}

.pd-child-pill--active:hover {
    color: #fff;
}

.pd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.pd-date {
    color: var(--mid);
    font-size: 0.9rem;
}

.pd-grade-badge {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--cream);
    border: 1px solid var(--tan);
    border-radius: 6px;
    padding: 0.25rem 0.75rem;
    color: var(--mid);
}

.pd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (min-width: 960px) {
    .pd-grid {
        grid-template-columns: 65fr 35fr;
    }
}

.pd-main { display: flex; flex-direction: column; gap: 1.25rem; }
.pd-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }

.pd-view-link {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gold);
    text-decoration: none;
}

.pd-view-link:hover {
    text-decoration: underline;
}

.pd-empty {
    padding: 1.25rem 1rem;
    color: var(--mid);
    font-size: 0.9rem;
}

/* Announcements */
.pd-announcements-list {
    display: flex;
    flex-direction: column;
}

.pd-announcement-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.pd-announcement-item:last-child { border-bottom: none; }

.pd-announcement-subject {
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.pd-announcement-meta {
    font-size: 0.8rem;
    color: var(--mid);
}

/* Assignment Items */
.pd-assignment-list {
    display: flex;
    flex-direction: column;
}

.pd-assignment-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.pd-assignment-item:last-child { border-bottom: none; }

.pd-assignment-check {
    color: var(--tan);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.pd-assignment-icon {
    color: var(--mid);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.pd-assignment-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.pd-assignment-title {
    font-weight: 500;
    font-size: 0.9rem;
}

.pd-assignment-course {
    font-size: 0.8rem;
    color: var(--mid);
}

.pd-assignment-due {
    font-size: 0.8rem;
    color: var(--mid);
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.pd-assignment-item--overdue {
    color: var(--danger);
}

.pd-assignment-item--overdue .pd-assignment-course {
    color: var(--danger);
    opacity: 0.7;
}

/* Overdue Card */
.pd-overdue-card {
    border-left: 4px solid var(--danger);
    background: #fef6f5;
}

.pd-overdue-card .card-header h3 {
    color: var(--danger);
}

/* Grades */
.pd-grades-list {
    display: flex;
    flex-direction: column;
}

.pd-grade-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.pd-grade-item:last-child { border-bottom: none; }

.pd-grade-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.pd-grade-title {
    font-weight: 500;
    font-size: 0.9rem;
}

.pd-grade-course {
    font-size: 0.8rem;
    color: var(--mid);
}

.pd-grade-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.pd-grade-badge {
    font-weight: 700;
    font-size: 0.9rem;
}

.pd-grade-badge.grade-a { color: var(--success); }
.pd-grade-badge.grade-b { color: #1abc9c; }
.pd-grade-badge.grade-c { color: var(--gold); }
.pd-grade-badge.grade-d { color: #e67e22; }
.pd-grade-badge.grade-f { color: var(--danger); }

.pd-grade-pct {
    font-size: 0.8rem;
    color: var(--mid);
}

.pd-grade-date {
    font-size: 0.75rem;
    color: var(--tan);
}

/* Subjects */
.pd-subjects-list {
    display: flex;
    flex-direction: column;
}

.pd-subject-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 0.9rem;
    cursor: default;
}

.pd-subject-item:last-child { border-bottom: none; }

.pd-subject-item i {
    color: var(--mid);
    font-size: 1.1rem;
}

/* Attendance */
.pd-attendance {
    text-align: center;
    padding: 1rem;
}

.pd-attendance-pct {
    font-family: 'Instrument Serif', serif;
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.pd-attendance-label {
    font-family: 'Schibsted Grotesk', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mid);
    margin-bottom: 0.5rem;
}

.pd-attendance-details {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--mid);
}

/* Responsive */
@media (max-width: 959px) {
    .pd-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Sidebar Collapse + Accordion Submenus
   ======================================== */

/* Sidebar header with toggle */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .sidebar-logo {
    padding: 0;
    border-bottom: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Sidebar transitions */
.sidebar {
    transition: width 0.2s ease;
}

.main-content {
    /* no transition — prevents content shift on page load */
}

/* Collapsed sidebar (desktop) — auto-expand on hover */
.sidebar-collapsed .sidebar {
    width: 60px;
    overflow: hidden;
    transition: width 0.25s ease;
    z-index: 100;
}

.sidebar-collapsed .sidebar:hover {
    width: 220px;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-collapsed .sidebar .nav-item span,
.sidebar-collapsed .sidebar .nav-submenu-chevron,
.sidebar-collapsed .sidebar .unread-badge,
.sidebar-collapsed .sidebar .nav-section,
.sidebar-collapsed .nav-submenu,
.sidebar-collapsed .sidebar-footer .user-info {
    display: none;
}

.sidebar-collapsed .sidebar:hover .nav-item span,
.sidebar-collapsed .sidebar:hover .nav-submenu-chevron,
.sidebar-collapsed .sidebar:hover .unread-badge,
.sidebar-collapsed .sidebar:hover .nav-section,
.sidebar-collapsed .sidebar:hover .nav-submenu,
.sidebar-collapsed .sidebar:hover .sidebar-footer .user-info {
    display: unset;
}

.sidebar-collapsed .sidebar:hover .nav-submenu {
    display: block;
    max-height: 0;
}

.sidebar-collapsed .sidebar:hover .nav-submenu.open {
    max-height: 500px;
}

.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 1.25rem 0.5rem;
}

.sidebar-collapsed .sidebar:hover .sidebar-header {
    justify-content: space-between;
    padding: 1.25rem 1rem;
}

.sidebar-collapsed .sidebar .logo-full {
    display: none;
}

.sidebar-collapsed .sidebar .logo-icon {
    display: block;
}

.sidebar-collapsed .sidebar:hover .logo-full {
    display: block;
}

.sidebar-collapsed .sidebar:hover .logo-icon {
    display: none;
}

.sidebar-collapsed .sidebar-toggle i::before {
    content: "\e148"; /* caret-right */
}

.sidebar-collapsed .sidebar .nav-item {
    justify-content: center;
    padding: 0.55rem 0;
    border-left: 3px solid transparent;
}

.sidebar-collapsed .sidebar:hover .nav-item {
    justify-content: flex-start;
    padding: 0.55rem 1rem 0.55rem 1.25rem;
}

.sidebar-collapsed .sidebar .nav-item i[class*="ph-"] {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-collapsed .sidebar-footer {
    padding: 1rem 0.5rem;
}

.sidebar-collapsed .sidebar:hover .sidebar-footer {
    padding: 1rem;
}

.sidebar-collapsed .sidebar-footer .nav-item {
    justify-content: center;
    padding-left: 0;
}

.sidebar-collapsed .sidebar:hover .sidebar-footer .nav-item {
    justify-content: flex-start;
    padding-left: 1.25rem;
}

.sidebar-collapsed .sidebar-user {
    justify-content: center;
}

.sidebar-collapsed .sidebar:hover .sidebar-user {
    justify-content: flex-start;
}

.sidebar-collapsed .main-content {
    margin-left: 60px;
}

/* Accordion submenus */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.nav-submenu.open {
    max-height: 500px;
}

.nav-submenu-item {
    display: block;
    padding: 0.4rem 1.5rem 0.4rem 2.75rem;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 0.15s, background 0.15s;
    border-left: 3px solid transparent;
}

.nav-submenu-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.nav-submenu-item.active {
    color: var(--gold);
    border-left-color: var(--gold);
    background: rgba(249,160,27,0.06);
}

/* Submenu chevron */
.nav-submenu-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.nav-submenu-chevron.rotated {
    transform: rotate(180deg);
}

/* Has-submenu: ensure badge + chevron spacing */
.nav-item.has-submenu {
    flex-wrap: nowrap;
}

/* Mobile top bar (hidden on desktop) */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--dark-warm);
    z-index: 101;
    align-items: center;
    padding: 0 1rem;
}

.mobile-hamburger {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
}

.mobile-topbar-title {
    flex: 1;
    text-align: center;
    color: #fff;
    font-family: 'Instrument Serif', serif;
    font-size: 1.125rem;
    margin-right: 1.5rem; /* offset for hamburger centering */
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile responsive */
@media (max-width: 767px) {
    .mobile-topbar {
        display: flex;
    }

    .sidebar-toggle {
        display: none;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 100;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding-top: calc(50px + 1.5rem);
    }

    /* Override collapsed state on mobile */
    .sidebar-collapsed .sidebar {
        width: var(--sidebar-w);
        transform: translateX(-100%);
    }

    .sidebar-collapsed .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-collapsed .sidebar .nav-item span,
    .sidebar-collapsed .sidebar .nav-submenu-chevron,
    .sidebar-collapsed .sidebar .unread-badge,
    .sidebar-collapsed .sidebar .nav-section,
    .sidebar-collapsed .nav-submenu,
    .sidebar-collapsed .sidebar-footer .user-info {
        display: revert;
    }

    .sidebar-collapsed .sidebar-header {
        justify-content: space-between;
        padding: 1.25rem 1.5rem;
    }

    .sidebar-collapsed .sidebar-header .sidebar-logo {
        display: block;
    }

    .sidebar-collapsed .sidebar .nav-item {
        justify-content: flex-start;
        padding: 0.6rem 1.5rem;
    }

    .sidebar-collapsed .sidebar-footer {
        padding: 1rem 1.5rem;
    }

    .sidebar-collapsed .main-content {
        margin-left: 0;
    }
}

/* ============================================
   Parent Lesson Plans
   ============================================ */

.parent-lessons-page { position: relative; }

/* Child selector pills */
.child-pills { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.child-pill {
    padding: 6px 16px;
    border-radius: 20px;
    background: #fff;
    border: 1.5px solid var(--tan);
    color: var(--dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.child-pill.active,
.child-pill:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}

/* Header */
.pl-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}
.pl-header h1 { margin-bottom: 8px; }
.pl-view-toggles { display: flex; gap: 0; }
.pl-view-btn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    background: #fff;
    border: 1px solid var(--tan);
    color: var(--mid);
    text-decoration: none;
    transition: all 0.15s;
}
.pl-view-btn:first-child { border-radius: 6px 0 0 6px; }
.pl-view-btn:last-child { border-radius: 0 6px 6px 0; }
.pl-view-btn + .pl-view-btn { border-left: none; }
.pl-view-btn.active {
    background: var(--dark);
    color: #fff;
    border-color: var(--dark);
}

/* Progress circle */
.pl-progress-circle {
    position: relative;
    width: 72px;
    height: 72px;
}
.pl-progress-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pl-progress-bg {
    fill: none;
    stroke: var(--tan);
    stroke-width: 3;
    opacity: 0.3;
}
.pl-progress-fill {
    fill: none;
    stroke: var(--gold);
    stroke-width: 3;
    stroke-linecap: round;
}
.pl-progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.pl-progress-num { font-size: 14px; font-weight: 600; color: var(--dark); }
.pl-progress-label { font-size: 10px; color: var(--mid); text-transform: uppercase; letter-spacing: 0.05em; }

/* Date navigation */
.pl-date-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.pl-nav-arrow {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--tan);
    color: var(--dark);
    text-decoration: none;
    transition: background 0.15s;
}
.pl-nav-arrow:hover { background: var(--gold); color: #fff; }
.pl-date-range { font-family: 'Instrument Serif', serif; font-size: 20px; }
.pl-week-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--mid);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 4px;
}

/* Week layout: main + dock */
.pl-week-layout {
    display: flex;
    gap: 16px;
}
.pl-week-main { flex: 1; min-width: 0; }

/* Week grid */
.assignments-week-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}
.assignments-day-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.assignments-day-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--tan);
}
.assignments-day-header.is-today {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
}
.assignments-day-num { font-family: 'Instrument Serif', serif; font-size: 22px; }
.assignments-day-name { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
.assignments-day-empty { padding: 12px 8px; font-size: 12px; color: var(--mid); opacity: 0.6; }

/* Assignment cards */
.assignment-card {
    background: #fff;
    border-radius: 4px;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    position: relative;
}
.assignment-card.assignment-done { opacity: 0.6; }
.assignment-card-subject {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--subject-color, var(--mid));
    margin-bottom: 2px;
}
.assignment-card-title { font-size: 14px; color: var(--dark); }
.assignment-card-check {
    position: absolute;
    top: 10px;
    right: 8px;
    font-size: 16px;
    color: var(--subject-color, var(--mid));
}
.assignment-card.assignment-done .assignment-card-check { color: var(--success); }

/* Large card (day view) */
.assignment-card-lg { padding: 16px; }
.assignment-card-lg .assignment-card-title { font-size: 16px; margin-bottom: 6px; }
.assignment-card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.assignment-card-header-row .assignment-card-check { position: static; }
.assignment-card-desc { font-size: 13px; color: var(--mid); margin-bottom: 8px; line-height: 1.5; }
.assignment-card-meta { display: flex; gap: 16px; font-size: 12px; color: var(--mid); }
.assignment-card-meta i { margin-right: 2px; }

.pl-day-list { display: flex; flex-direction: column; gap: 12px; max-width: 640px; }

/* Week Dock */
.week-dock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--tan);
    position: relative;
    flex-shrink: 0;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    scrollbar-width: thin;
}
.week-dock-item {
    width: 36px;
    height: 28px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease-out;
    text-decoration: none;
    color: var(--mid);
    background: transparent;
    flex-shrink: 0;
}
.week-dock-item.current {
    background: var(--gold);
    color: #fff;
    font-weight: 600;
}
.week-dock-item.selected {
    border: 2px solid var(--gold);
}
.week-dock-item.current.selected {
    border: 2px solid var(--dark);
}
.week-dock-tooltip {
    display: none;
    position: absolute;
    right: calc(100% + 8px);
    background: var(--dark);
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

/* Mobile week strip */
.week-strip-mobile { display: none; }

/* Month grid */
.pl-month-grid { margin-top: 16px; }
.pl-month-header-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    margin-bottom: 4px;
}
.pl-month-day-label {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--mid);
    padding: 4px;
}
.pl-month-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}
.pl-month-cell {
    background: #fff;
    border: 1px solid var(--tan);
    border-radius: 4px;
    min-height: 64px;
    padding: 6px;
    text-decoration: none;
    color: var(--dark);
    transition: background 0.15s;
    display: flex;
    flex-direction: column;
}
.pl-month-cell:hover { background: #f5f0ea; }
.pl-month-cell.is-today { border-color: var(--gold); border-width: 2px; }
.pl-month-cell-blank { background: transparent; border-color: transparent; }
.pl-month-cell-num { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.pl-month-cell-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.pl-month-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--subject-color, var(--mid));
}

.pl-back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--mid);
    text-decoration: none;
    margin-bottom: 12px;
}
.pl-back-link:hover { color: var(--dark); }

/* Mobile */
@media (max-width: 768px) {
    .week-dock { display: none !important; }
    .week-strip-mobile {
        display: flex;
        overflow-x: auto;
        gap: 4px;
        padding: 8px 0;
        margin-bottom: 12px;
        -webkit-overflow-scrolling: touch;
    }
    .week-strip-mobile .week-dock-item { flex-shrink: 0; }
    .assignments-week-grid {
        grid-template-columns: 1fr;
    }
    .pl-month-body,
    .pl-month-header-row {
        grid-template-columns: repeat(7, 1fr);
        font-size: 11px;
    }
    .pl-month-cell { min-height: 44px; padding: 4px; }
}

/* Announcement dismiss */
.pd-announcement-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: opacity 0.25s ease, max-height 0.25s ease;
}

.pd-announcement-content {
    flex: 1;
    min-width: 0;
}

.pd-dismiss-btn {
    background: none;
    border: none;
    color: var(--tan);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease;
}

.pd-dismiss-btn:hover {
    color: var(--dark);
    background: rgba(0, 0, 0, 0.05);
}

.pd-dismiss-btn i {
    font-size: 0.85rem;
}

/* Announcements Archive */
.pd-announcements-archive {
    max-width: 800px;
}

.pd-archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.pd-back-link {
    color: var(--gold);
    text-decoration: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pd-back-link:hover {
    text-decoration: underline;
}

.pd-archive-count {
    color: var(--mid);
    font-size: 0.875rem;
}

.pd-archive-card {
    margin-bottom: 1rem;
}

.pd-archive-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.pd-archive-subject {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.pd-archive-date {
    color: var(--mid);
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 1rem;
}

.pd-archive-sender {
    color: var(--mid);
    font-size: 0.8rem;
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pd-archive-body {
    color: var(--dark);
    font-size: 0.9rem;
    line-height: 1.6;
}

.pd-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pd-page-btn {
    color: var(--gold);
    text-decoration: none;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pd-page-info {
    color: var(--mid);
    font-size: 0.875rem;
}

/* ============================================================
   Messages - CSS Classes (replaces inline styles)
   ============================================================ */

.msg-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.msg-filters {
    display: flex;
    gap: 0.5rem;
}

.msg-filters .btn-filter {
    font-size: 0.8125rem;
    padding: 0.4rem 0.75rem;
}

.msg-list {
    padding: 0;
}

.msg-empty {
    text-align: center;
    padding: 60px;
    color: var(--mid);
}

.msg-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    text-decoration: none;
    color: var(--dark);
    transition: background 0.15s;
}

.msg-item:hover {
    background: rgba(0,0,0,0.02);
}

.msg-item--unread {
    background: rgba(249,160,27,0.04);
}

.msg-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--tan);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8125rem;
    flex-shrink: 0;
    font-family: 'Schibsted Grotesk', sans-serif;
}

.msg-avatar--unread {
    background: var(--gold);
}

.msg-content {
    flex: 1;
    min-width: 0;
}

.msg-content-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.msg-sender {
    font-weight: 500;
    font-size: 0.875rem;
}

.msg-sender--unread {
    font-weight: 700;
}

.msg-role {
    font-size: 0.6875rem;
    color: var(--mid);
    text-transform: capitalize;
}

.msg-subject {
    font-size: 0.8125rem;
    color: var(--mid);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-subject--unread {
    font-weight: 600;
    color: var(--dark);
}

.msg-preview {
    font-size: 0.75rem;
    color: var(--mid);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.msg-meta {
    text-align: right;
    flex-shrink: 0;
}

.msg-date {
    font-size: 0.75rem;
    color: var(--mid);
}

.msg-unread-badge {
    display: inline-block;
    margin-top: 4px;
    background: var(--gold);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 99px;
}


/* ============================================================
   Loading / Skeleton States
   ============================================================ */

@keyframes skeleton-shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background: linear-gradient(90deg, #e8e0d8 25%, #f0e9e2 50%, #e8e0d8 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 0.875rem;
    width: 100%;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg, #e8e0d8 25%, #f0e9e2 50%, #e8e0d8 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-card {
    height: 120px;
    background: linear-gradient(90deg, #e8e0d8 25%, #f0e9e2 50%, #e8e0d8 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, #e8e0d8 25%, #f0e9e2 50%, #e8e0d8 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.loading-spinner::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--tan);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.page-loading {
    position: fixed;
    inset: 0;
    background: rgba(251,249,247,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.page-loading::after {
    content: '';
    width: 48px;
    height: 48px;
    border: 4px solid var(--tan);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}


/* ============================================================
   Accessibility
   ============================================================ */

.skip-nav {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--gold);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0 0 4px 4px;
    z-index: 10000;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-nav:focus {
    top: 0;
}

*:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.nav-item:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
    background: rgba(255,255,255,0.08);
}


/* ============================================================
   404 Page
   ============================================================ */

.error-404-icon {
    font-size: 4rem;
    color: var(--gold);
    margin: 1rem 0;
}


/* ============================================================
   Dark Mode
   ============================================================ */

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --cream: #1a1816;
        --dark: #F5F0EB;
        --mid: #A89880;
        --tan: #4A4035;
        --dark-warm: #141210;
    }

    :root:not([data-theme="light"]) body {
        background: #1a1816;
        color: #F5F0EB;
    }

    :root:not([data-theme="light"]) .card,
    :root:not([data-theme="light"]) .stat-card {
        background: #231f1b;
        border: 1px solid #3a3430;
    }

    :root:not([data-theme="light"]) .form-input,
    :root:not([data-theme="light"]) .form-select,
    :root:not([data-theme="light"]) textarea.form-input {
        background: #2a2520;
        border-color: #4A4035;
        color: #F5F0EB;
    }

    :root:not([data-theme="light"]) table thead {
        background: #231f1b;
    }

    :root:not([data-theme="light"]) table tbody tr {
        border-color: #3a3430;
    }

    :root:not([data-theme="light"]) table tbody tr:hover {
        background: #2a2520;
    }

    :root:not([data-theme="light"]) .page-loading {
        background: rgba(26,24,22,0.85);
    }

    :root:not([data-theme="light"]) .skeleton,
    :root:not([data-theme="light"]) .skeleton-text,
    :root:not([data-theme="light"]) .skeleton-card,
    :root:not([data-theme="light"]) .skeleton-circle {
        background: linear-gradient(90deg, #2a2520 25%, #3a3430 50%, #2a2520 75%);
        background-size: 200px 100%;
    }

    :root:not([data-theme="light"]) .msg-item {
        border-bottom-color: #3a3430;
    }

    :root:not([data-theme="light"]) .msg-item:hover {
        background: rgba(255,255,255,0.03);
    }

    :root:not([data-theme="light"]) .login-card {
        background: #231f1b;
        border-color: #3a3430;
    }

    :root:not([data-theme="light"]) .btn-outline {
        border-color: #4A4035;
        color: #F5F0EB;
    }
}

[data-theme="dark"] {
    --cream: #1a1816;
    --dark: #F5F0EB;
    --mid: #A89880;
    --tan: #4A4035;
    --dark-warm: #141210;
}

[data-theme="dark"] body,
body[data-theme="dark"] {
    background: #1a1816;
    color: #F5F0EB;
}

[data-theme="dark"] .card,
[data-theme="dark"] .stat-card {
    background: #231f1b;
    border: 1px solid #3a3430;
}

[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea.form-input {
    background: #2a2520;
    border-color: #4A4035;
    color: #F5F0EB;
}

[data-theme="dark"] table thead {
    background: #231f1b;
}

[data-theme="dark"] table tbody tr {
    border-color: #3a3430;
}

[data-theme="dark"] table tbody tr:hover {
    background: #2a2520;
}

[data-theme="dark"] .page-loading {
    background: rgba(26,24,22,0.85);
}

[data-theme="dark"] .skeleton,
[data-theme="dark"] .skeleton-text,
[data-theme="dark"] .skeleton-card,
[data-theme="dark"] .skeleton-circle {
    background: linear-gradient(90deg, #2a2520 25%, #3a3430 50%, #2a2520 75%);
    background-size: 200px 100%;
}

[data-theme="dark"] .msg-item {
    border-bottom-color: #3a3430;
}

[data-theme="dark"] .msg-item:hover {
    background: rgba(255,255,255,0.03);
}

[data-theme="dark"] .login-card {
    background: #231f1b;
    border-color: #3a3430;
}

[data-theme="dark"] .btn-outline {
    border-color: #4A4035;
    color: #F5F0EB;
}

[data-theme="dark"] .page-header {
    border-color: #3a3430;
}

[data-theme="dark"] .breadcrumb a {
    color: var(--mid);
}

[data-theme="dark"] .detail-table td {
    border-color: #3a3430;
}

[data-theme="dark"] .card-header {
    border-color: #3a3430;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    width: 100%;
    text-align: left;
}

.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }


/* ============================================================
   Print Stylesheet - Gradebook
   ============================================================ */

@media print {
    .sidebar,
    .mobile-topbar,
    .sidebar-overlay,
    .page-header .btn,
    .skip-nav,
    .theme-toggle,
    .nav-item-signout,
    .impersonation-banner {
        display: none !important;
    }

    .app-layout {
        display: block !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 11pt;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
        break-inside: avoid;
    }

    table {
        width: 100% !important;
        border-collapse: collapse;
    }

    table th,
    table td {
        border: 1px solid #ccc !important;
        padding: 4px 8px !important;
        font-size: 10pt;
    }

    table thead {
        background: #f0f0f0 !important;
    }

    .page-title::before {
        content: attr(data-school-name) " — ";
    }

    h1.page-title {
        font-size: 16pt;
        margin-bottom: 0.5rem;
    }

    a { color: #000 !important; text-decoration: none !important; }

    .badge { border: 1px solid #999; }
}


/* ============================================================
   Teacher Course Card Hover
   ============================================================ */

.course-card,
.teacher-courses-grid a {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.course-card:hover,
.teacher-courses-grid a:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    border-color: var(--gold);
}
