/* e-skul PNG - Modern Professional Design */
:root {
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --primary-light: #e0f2fe;
    --primary-dark: #0369a1;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --nav-bg: #0f172a;
    --nav-text: #f8fafc;
    --nav-hover: #1e293b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --topbar-height: 40px;
}

* { box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; width: 100%; }
.main-content { padding: 32px 0 80px; min-height: calc(100vh - 120px); }
.app-main .container { padding-left: 24px; padding-right: 24px; }

/* Full-bleed page wrapper - breaks a section out of the centered .container to span the
   full viewport width. Used on dense/table-heavy pages (marks, students, staff, etc). */
.page-full-bleed {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100vw;
    max-width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 0 16px;
    box-sizing: border-box;
}

/* Table wrapper - horizontal scroll for wide tables alongside sidebar */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -28px;
    padding: 0 28px;
}
.card .table-wrapper { margin: 0 -28px; padding: 0 28px; }
.table-wrapper table { min-width: 500px; }

/* App layout - sidebar + main */
body.app-layout {
    display: flex;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin-left: 8px;
}

/* Tab bar */
.tab-bar {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
    padding: 0 12px;
    height: var(--topbar-height);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
}
.topbar-brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    letter-spacing: -0.02em;
    padding-right: 12px;
    margin-right: 4px;
    border-right: 1px solid var(--border);
    height: 24px;
}
.topbar-brand:hover { color: var(--primary); text-decoration: none; }
.tab-bar-inner {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: flex-end;
    overflow-x: auto;
    scrollbar-width: none;
    height: 38px;
    gap: 1px;
}
.tab-bar-inner::-webkit-scrollbar { display: none; }

/* Page search */
.tab-search-wrap {
    flex-shrink: 0;
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
}
.tab-search-icon {
    position: absolute;
    left: 10px;
    display: flex;
    align-items: center;
    pointer-events: none;
    color: var(--text-muted);
    transition: color 0.15s;
}
.tab-search-wrap:focus-within .tab-search-icon { color: var(--primary); }
.tab-search-input {
    height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 12px 0 32px;
    font-size: 0.82rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    width: 170px;
    outline: none;
    transition: width 0.18s ease, border-color 0.15s, box-shadow 0.15s;
}
.tab-search-input::placeholder { color: var(--text-muted); }
.tab-search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    width: 220px;
}
.tab-search-dropdown {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    list-style: none;
    margin: 0;
    padding: 4px 0;
    z-index: 9999;
    min-width: 220px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}
.tab-search-dropdown.open { display: block; }
.tab-search-result {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tab-search-result:hover,
.tab-search-result.psr-selected {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.tab-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 32px;
    border-radius: 6px 6px 0 0;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid transparent;
    border-bottom: none;
    flex-shrink: 0;
    max-width: 160px;
    transition: background 0.12s, color 0.12s;
    margin-top: 6px;
}
.tab-item:hover { background: #e2eaf3; color: var(--text); text-decoration: none; }
.tab-item.tab-active {
    background: var(--surface);
    color: var(--primary);
    border-color: var(--border);
    border-bottom-color: var(--surface);
    margin-top: 4px;
    height: 34px;
    margin-bottom: -2px;
}
.tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    white-space: nowrap;
}
.tab-close {
    display: none;
    background: none;
    border: none;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    font-size: 0.72rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}
.tab-item:hover .tab-close,
.tab-item.tab-active .tab-close { display: inline-flex; }
.tab-close:hover { background: rgba(0,0,0,0.08); color: var(--text); }

/* Sidebar */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--nav-bg);
    padding: 20px 0;
    box-shadow: 2px 0 12px rgba(0,0,0,0.08);
    border-radius: 0 16px 16px 0;
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow: visible;
    z-index: 90;
    transform: translateX(calc(-100% + 8px));
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.sidebar:hover,
.sidebar:focus-within {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.28);
}
.sidebar-scroll {
    height: 100%;
    overflow-y: auto;
}
.sidebar-hint {
    position: absolute;
    top: 50%;
    left: 100%;
    width: 28px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border-radius: 0 14px 14px 0;
    box-shadow: 3px 0 14px rgba(14,165,233,0.45);
    animation: sidebarHintPeek 2.8s ease-in-out infinite;
    animation-delay: 1.2s;
}
.sidebar:hover .sidebar-hint { opacity: 0; animation: none; }
.sidebar-hint svg {
    animation: sidebarPinPop 2.8s ease-in-out infinite;
    animation-delay: 1.2s;
}
@keyframes sidebarPinPop {
    0%, 18%, 100% { transform: scale(1) rotate(0deg); }
    9% { transform: scale(1.2) rotate(-10deg); }
}
@keyframes sidebarHintPeek {
    0%, 18%, 100% { transform: translateY(-50%) translateX(0); }
    9% { transform: translateY(-50%) translateX(7px); }
}
.sidebar-school-brand {
    padding: 12px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.sidebar-school-logo {
    max-width: 100%;
    max-height: 48px;
    object-fit: contain;
}
.sidebar-school-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--nav-text);
    text-align: center;
    line-height: 1.2;
}
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 12px;
}
.sidebar-nav li { margin-bottom: 2px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #94a3b8;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
}
.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    opacity: 0.85;
}
.sidebar-icon svg {
    width: 20px;
    height: 20px;
}
.sidebar-nav a:hover .sidebar-icon,
.sidebar-nav a.active .sidebar-icon {
    opacity: 1;
}
.sidebar-nav a:hover {
    background: var(--nav-hover);
    color: var(--nav-text);
    text-decoration: none;
}
.sidebar-nav a.active {
    background: var(--primary);
    color: white;
    text-decoration: none;
}
.sidebar-nav a.active:hover {
    background: var(--primary-hover);
    color: white;
}
.sidebar-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
.sidebar-dropdown { position: relative; }
.sidebar-dropdown-trigger {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.sidebar-chevron {
    margin-left: auto;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid rgba(255,255,255,0.6);
    transition: transform 0.2s;
}
.sidebar-dropdown.open .sidebar-chevron { transform: rotate(180deg); }
.sidebar-dropdown.has-active > .sidebar-dropdown-trigger {
    background: rgba(255,255,255,0.08);
    color: var(--nav-text);
}
.sidebar-submenu {
    list-style: none;
    margin: 0;
    padding: 0 0 4px 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-out;
}
.sidebar-dropdown.open .sidebar-submenu { max-height: 500px; }
.sidebar-submenu li { margin: 0; }
.sidebar-submenu a {
    display: block;
    padding: 8px 20px 8px 48px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
}
.sidebar-submenu a:hover {
    background: var(--nav-hover);
    color: var(--nav-text);
}
.sidebar-submenu a.active {
    background: var(--primary);
    color: white;
}
.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 12px 0;
    list-style: none;
}
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    list-style: none;
}
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.18);
}
.sidebar-user-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.sidebar-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--nav-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 0.73rem;
    color: #64748b;
}

@media (max-width: 768px) {
    body.app-layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        min-width: 0;
        height: auto;
        position: relative;
        top: auto;
        padding: 12px 16px;
        transform: none;
        z-index: auto;
    }
    .sidebar-hint { display: none; }
    .app-main { margin-left: 0; }
    .sidebar-school-brand { padding: 8px 12px 12px; margin-bottom: 8px; }
    .sidebar-school-logo { max-height: 36px; }
    .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 0; }
    .sidebar-nav li { margin-bottom: 0; }
    .sidebar-nav a { padding: 8px 12px; }
    .sidebar-dropdown { flex: 1 1 auto; min-width: 140px; }
    .sidebar-dropdown.open { flex: 1 1 100%; }
    .sidebar-submenu { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0 0 !important; }
    .sidebar-submenu li { flex: 1 1 auto; }
    .sidebar-submenu a { padding: 6px 12px; border-radius: 6px; }
    .sidebar-divider { display: none; }
    .app-layout .app-footer { left: 0; }
    .table-wrapper { margin: 0 -24px; padding: 0 24px; }
}

/* Table wrapper - reduce edge bleed on narrow content area */
@media (max-width: 1100px) {
    .table-wrapper { margin: 0 -24px; padding: 0 24px; }
}

/* Page header - consistent across all pages */
.page-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.page-header h1 {
    margin: 0 0 8px;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.page-subtitle, .page-header .hint {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Dashboard - professional home */
.dashboard-header {
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.dashboard-title {
    margin: 0 0 4px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}
.dashboard-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.dashboard-role {
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}
.dashboard-meta-sep { color: var(--border); }
.dashboard-section {
    margin-bottom: 28px;
}
.dashboard-section-title {
    margin: 0 0 12px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* Stat strip - dense row of numbers instead of a grid of icon tiles */
.dashboard-stats {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid var(--border);
}
.dashboard-stats-tight { max-width: 640px; }
.dashboard-stat {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    flex: 1 1 140px;
    padding: 16px 20px;
    border-right: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}
.dashboard-stat:last-child { border-right: none; }
.dashboard-stat:not(.dashboard-stat-muted):hover { background: var(--bg); }
.dashboard-stat-muted { cursor: default; }
.dashboard-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.dashboard-stat-value.dashboard-stat-subject { font-size: 1rem; font-weight: 600; }
.dashboard-stat-value.dashboard-stat-danger { color: #dc2626; }
.dashboard-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Quick actions - dense list rows, not icon tiles */
.dashboard-actions {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}
.dashboard-action-row {
    display: grid;
    grid-template-columns: 22px 200px 1fr 20px;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}
.dashboard-action-row:last-child { border-bottom: none; }
.dashboard-action-row:hover { background: var(--bg); text-decoration: none; }
.dashboard-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.dashboard-action-icon svg { width: 18px; height: 18px; }
.dashboard-action-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.dashboard-action-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.dashboard-action-arrow {
    justify-self: end;
    font-size: 1rem;
    color: var(--text-muted);
    transition: transform 0.15s;
}
.dashboard-action-row:hover .dashboard-action-arrow {
    color: var(--primary);
    transform: translateX(3px);
}
@media (max-width: 640px) {
    .dashboard-action-row { grid-template-columns: 20px 1fr 20px; }
    .dashboard-action-desc { display: none; }
}

.dashboard-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
}
.dashboard-link {
    padding: 9px 16px;
    background: var(--surface);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.dashboard-link:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}

/* Gate violations tags */
.dashboard-violation-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0;
}
.dashboard-violation-tag {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #fff7ed;
    color: #ea580c;
    border: 1px solid #fed7aa;
}
.dashboard-violation-tag-high {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
.dashboard-more-link {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}
.dashboard-more-link:hover { text-decoration: underline; }

/* Student Bio data form */
.bio-filter-form .bio-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}
.bio-filter-form .form-group { margin-bottom: 0; }
.bio-form-card { padding: 28px; }
.bio-form-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.bio-back-link {
    font-size: 0.9rem;
    color: var(--primary);
    text-decoration: none;
}
.bio-back-link:hover { text-decoration: underline; color: var(--primary-hover); }
.bio-form-title { margin: 0; font-size: 1.25rem; font-weight: 600; }
.bio-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
@media (max-width: 900px) {
    .bio-form-grid { grid-template-columns: 1fr; }
}
.bio-form-col h3 {
    margin: 0 0 16px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.bio-form-col .form-group { margin-bottom: 16px; }
.bio-form-col .form-group input[disabled] {
    background: #f1f5f9;
    color: var(--text-muted);
}
.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.bio-grade-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}
@media (max-width: 600px) {
    .bio-grade-row { grid-template-columns: 1fr 1fr; }
}
.bio-form-actions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.bio-display-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 900px) { .bio-display-grid { grid-template-columns: 1fr; } }
.bio-display-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; }
.bio-display-list dt { font-weight: 500; color: var(--text-secondary); font-size: 0.9rem; }
.bio-display-list dd { margin: 0; font-size: 0.95rem; }
.bio-display-list dd:empty::before { content: '—'; color: var(--text-muted); }
.bio-display-grade-row { grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr; }

/* Bio list - organized table */
.bio-list-card { padding: 0; overflow: hidden; }
.bio-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.bio-list-title { margin: 0; font-size: 1.1rem; font-weight: 600; }
.bio-list-count { font-size: 0.9rem; color: var(--text-muted); }
.bio-list-table { margin: 0; }
.bio-list-table th,
.bio-list-table td { padding: 12px 20px; }
.bio-list-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.bio-list-num { width: 48px; color: var(--text-muted); font-size: 0.9rem; }
.bio-list-no { width: 100px; font-size: 0.9rem; color: var(--text-secondary); }
.bio-list-link {
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}
.bio-list-link:hover { text-decoration: underline; }
.bio-list-table tbody tr:hover { background: #f8fafc; }
.bio-list-table tbody tr { cursor: pointer; }
.bio-list-table tbody tr:hover .bio-list-link { color: var(--primary-hover); }
.bio-list-card .table-wrapper { margin: 0; padding: 0; }

/* Staff Bio (staff.php) list table styled like User Management: frozen #/Name columns,
   sticky header. Scoped to .staff-users-* so the shared .bio-list-* classes (also used by
   student_bio.php / staff_bio.php) are untouched. */
.staff-users-card { overflow: visible; }
.staff-users-table { table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.staff-users-table th,
.staff-users-table td { white-space: nowrap; }
.staff-users-table th { position: sticky; top: var(--topbar-height, 40px); z-index: 3; background: var(--surface); }
.staff-users-table th:nth-child(1), .staff-users-table td:nth-child(1) {
    width: 48px; position: sticky; left: 0; z-index: 2;
    background: var(--surface); box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}
.staff-users-table th:nth-child(2), .staff-users-table td:nth-child(2) {
    width: 200px; position: sticky; left: 48px; z-index: 2;
    background: var(--surface); box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}
.staff-users-table th:nth-child(1) { z-index: 4; }
.staff-users-table th:nth-child(2) { z-index: 4; }
.staff-users-table th:nth-child(3) { width: 110px; }
.staff-users-table th:nth-child(4) { width: 140px; }
.staff-users-table th:nth-child(5) { width: 200px; }
.staff-users-table tbody tr:hover td:nth-child(1),
.staff-users-table tbody tr:hover td:nth-child(2) { background: #f8fafc; }
.bio-status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}
.bio-status-complete { background: var(--success-bg); color: var(--success); }
.bio-status-half { background: #fef3c7; color: #b45309; }
.bio-status-none { background: #f1f5f9; color: var(--text-muted); }
.bio-role-badge { padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.bio-role-teacher { background: #dbeafe; color: #1d4ed8; }
.bio-role-hod { background: #e0e7ff; color: #4338ca; }
.bio-list-row-selected { background: #eff6ff !important; }
.profile-upload-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.profile-photo-preview { max-width: 120px; max-height: 120px; margin-top: 8px; display: block; border-radius: 8px; object-fit: cover; }
.profile-sig-preview { max-width: 140px; max-height: 50px; margin-top: 8px; display: block; object-fit: contain; }
.staff-photo-section { margin-bottom: 20px; }
.staff-photo-img { max-width: 100px; max-height: 100px; border-radius: 8px; object-fit: cover; }
.staff-sig-preview { max-height: 40px; max-width: 120px; object-fit: contain; }

/* Evaluation form */
.eval-filter-form .eval-filter-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end; }
.eval-filter-form .form-group { margin-bottom: 0; }
.eval-form-card { padding: 28px; }
.eval-form-header { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.eval-form-title { margin: 0; font-size: 1.25rem; font-weight: 600; }
.eval-profile-section, .eval-absences-section, .eval-table-section { margin-bottom: 28px; }
.eval-profile-section h3, .eval-absences-section h3, .eval-table-section h3 { margin: 0 0 16px; font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.eval-profile-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .eval-profile-grid { grid-template-columns: 1fr; } }
.eval-absences-row { display: flex; gap: 20px; }
.eval-absences-row .form-group { margin-bottom: 0; }

/* Report comments - larger textarea for proofreading */
.comments-table td:last-child { min-width: 420px; }
.comment-textarea {
    width: 100%;
    min-width: 400px;
    min-height: 120px;
    padding: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
}
.eval-absences-row input { width: 80px; }
.eval-keys-box { margin-bottom: 12px; padding: 12px 16px; background: #f8fafc; border-radius: var(--radius); font-size: 0.9rem; color: var(--text-secondary); }
.eval-table { width: 100%; border-collapse: collapse; }
.eval-table th, .eval-table td { padding: 10px 12px; border: 1px solid var(--border); text-align: left; }
.eval-table th { background: #f8fafc; font-weight: 600; font-size: 0.85rem; }
.eval-table .eval-criterion { font-size: 0.9rem; min-width: 200px; }
.eval-table select { width: 100%; min-width: 70px; padding: 6px 8px; }
.eval-actions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; gap: 12px; }
.eval-list-card { padding: 0; overflow: hidden; }
.eval-list-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.eval-list-title { margin: 0; font-size: 1.1rem; font-weight: 600; }
.eval-list-count { font-size: 0.9rem; color: var(--text-muted); }
.eval-list-table { margin: 0; }
.eval-list-table th, .eval-list-table td { padding: 12px 20px; }
.eval-list-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.eval-list-table tbody tr { cursor: pointer; }
.eval-list-table tbody tr:hover { background: #f8fafc; }
.eval-list-table a { font-weight: 500; color: var(--primary); text-decoration: none; }
.eval-list-table a:hover { text-decoration: underline; }

/* Bio modal */
.modal-box-bio {
    max-width: 1000px;
    width: 96vw;
    max-height: 94vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 28px 32px;
    -webkit-overflow-scrolling: touch;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 1.15rem; }
.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: #f1f5f9; color: var(--text); }
.bio-form-modal .bio-form-col h4 { margin: 16px 0 12px; font-size: 0.95rem; }
.bio-form-modal .bio-form-col h4:first-child { margin-top: 0; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.card h1 { margin: 0 0 8px; font-size: 1.35rem; font-weight: 600; }
.card .hint { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }
.card h3 { margin: 0 0 16px; font-size: 1.1rem; }

/* Admin Control — sharp corners, no rounded containers */
body.page-admin_control .card,
body.page-admin_control table,
body.page-admin_control .table-wrapper table,
body.page-admin_control .btn,
body.page-admin_control input,
body.page-admin_control select,
body.page-admin_control textarea,
body.page-admin_control .badge,
body.page-admin_control .alert,
body.page-admin_control [style*="border-radius"] {
    border-radius: 0 !important;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.15s ease;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); color: white; text-decoration: none; }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.btn-danger {
    background: var(--surface);
    color: var(--error);
    border: 1px solid var(--error);
}
.btn-danger:hover { background: var(--error-bg); color: var(--error); text-decoration: none; }

/* Forms */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 360px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--surface);
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
th, td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--border); }
th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
}
.toolbar label { margin-right: 4px; color: var(--text-secondary); font-size: 0.9rem; }
.toolbar select { max-width: 180px; min-width: 120px; }
.toolbar form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.toolbar .form-group { margin-bottom: 0; }

/* Form layout - for add/edit forms */
.form-layout { max-width: 480px; }
.form-layout .form-group input,
.form-layout .form-group select { max-width: none; }

/* Footer - fixed at bottom of main area */
.app-layout .app-footer {
    position: fixed;
    bottom: 0;
    left: 8px;
    right: 0;
    text-align: center;
    padding: 14px 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 50;
}

/* Login page - split layout (modernized) */
.login-split-page {
    height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 25%, #1e3a5f 60%, #0c1929 100%);
    background-attachment: fixed;
}
.login-split-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(14,165,233,0.12) 0%, transparent 50%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(99,102,241,0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.02) 0%, transparent 70%);
    pointer-events: none;
}
.login-split-float {
    width: 100%;
    max-width: 1050px;
    max-height: calc(100vh - 40px);
    display: flex;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 
        0 25px 50px -12px rgba(0,0,0,0.4),
        0 0 0 1px rgba(255,255,255,0.05);
    position: relative;
    z-index: 1;
}
.login-split-left {
    flex: 1;
    background: linear-gradient(152deg, #0c1929 0%, #1a365d 35%, #0f172a 100%);
    padding: 36px 48px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border-radius: 28px 0 0 28px;
}
.login-split-bg-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(14,165,233,0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(99,102,241,0.3) 0%, transparent 45%);
}
.login-split-bg-pattern::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 80%;
    height: 120%;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.03) 100%);
    border-radius: 50%;
    transform: rotate(-15deg);
}
.login-split-content {
    flex: 1;
    position: relative;
    z-index: 1;
    color: white;
    animation: loginFadeIn 0.6s ease-out;
}
@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-split-title {
    margin: 0 0 12px;
    font-size: 1.65rem;
    font-weight: 700;
    color: white;
    line-height: 1.25;
    letter-spacing: -0.02em;
}
.login-split-tagline {
    margin: 0 0 28px;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
}
.login-quote-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 120px;
}
.login-quote {
    margin: 0;
    padding: 0;
    border: none;
    transition: opacity 0.2s ease;
}
.login-quote.login-quote-fade {
    opacity: 0.4;
}
.login-quote-text {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-style: italic;
    color: rgba(255,255,255,0.95);
    line-height: 1.6;
}
.login-quote-cite {
    display: block;
    font-size: 0.9rem;
    font-style: normal;
    color: rgba(255,255,255,0.7);
}
.login-split-footer {
    margin-top: auto;
    padding-top: 16px;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    position: relative;
    z-index: 1;
}
.login-split-right {
    flex: 1;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px;
    border-radius: 0 28px 28px 0;
}
.login-split-content-right {
    width: 100%;
    max-width: 360px;
    animation: loginFormIn 0.5s ease-out 0.15s both;
}
@keyframes loginFormIn {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}
.login-split-brand {
    margin: 0 0 6px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: -0.01em;
}
.login-split-welcome {
    margin: 0 0 6px;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
}
.login-split-subtitle {
    margin: 0 0 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.login-form .form-group { margin-bottom: 18px; }
.login-form .form-group input {
    max-width: none;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-form .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}
.login-btn {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    font-weight: 600;
    border-radius: 10px;
    transition: transform 0.15s, box-shadow 0.2s;
}
.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14,165,233,0.35);
}
.login-split-right .alert { border-radius: 10px; }

@media (max-width: 900px) {
    .login-split-float { flex-direction: column; max-height: none; border-radius: 28px; }
    .login-split-left { padding: 32px 24px; border-radius: 28px 28px 0 0; }
    .login-split-right { padding: 32px 24px; border-radius: 0 0 28px 28px; }
    .login-split-content-right { padding: 0; }
}

/* Legacy login (centered box) - kept for fallback */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
}
.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}
.login-box h1 { margin: 0 0 8px; font-size: 1.5rem; color: var(--text); }
.login-box .subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 0.9rem; }
.login-box .btn { width: 100%; padding: 12px; margin-top: 8px; }

/* Marks grid input */
/* Marks page - modernized */
.marks-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100vw;
    max-width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 0 16px 130px;
    box-sizing: border-box;
}
.marks-filter-card,
.marks-table-card { margin-bottom: 0; border-radius: 0; }
.marks-table-card { padding-bottom: 16px; }
.marks-filter-form .form-group,
.marks-add-form .form-group { margin-bottom: 0; }
.marks-filter-grid,
.marks-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px 24px;
    align-items: end;
}
.marks-filter-grid > .form-group,
.marks-add-grid > .form-group { min-width: 0; }
.marks-filter-actions .btn { margin-bottom: 0; }
.marks-std-input { width: 80px; }
.marks-out-input { width: 80px; }
.marks-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
    padding: 6px 0;
    cursor: pointer;
    white-space: normal;
}
.marks-checkbox-label input[type="checkbox"] { width: 16px; height: 16px; margin: 0; cursor: pointer; }
@media (min-width: 640px) {
    .marks-filter-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* Marks table - spreadsheet layout (Excel-like) */
/* Marks validation modal - professional prompt */
.marks-validation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
}
.marks-validation-modal.marks-validation-modal-visible {
    display: flex;
    pointer-events: auto;
}
.marks-validation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
}
.marks-validation-box {
    position: relative;
    background: var(--surface);
    border-radius: 12px;
    padding: 28px 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
}
.marks-validation-modal-visible .marks-validation-box {
    animation: marks-validation-fade 0.2s ease-out;
}
@keyframes marks-validation-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.marks-validation-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 50%;
}
.marks-validation-icon svg {
    width: 28px;
    height: 28px;
}
.marks-validation-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}
.marks-validation-message {
    margin: 0 0 24px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.marks-validation-btn {
    min-width: 100px;
}
.marks-delete-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.marks-export-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.marks-export-option { width: 100%; }

/* App popup — simple, square-cornered, no backdrop blur. Intended as the shared/universal
   popup style for the system; currently only used on User Management. */
.app-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    pointer-events: none;
}
.app-popup.app-popup-visible {
    display: flex;
    pointer-events: auto;
}
.app-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
}
.app-popup-box {
    position: relative;
    background: var(--surface);
    border-radius: 0;
    padding: 28px 32px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
}
.app-popup-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
}
.app-popup-message {
    margin: 0 0 24px;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
}
.app-popup-btn { min-width: 100px; }
.app-popup-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.marks-table-wrapper {
    margin: 0 -28px;
    padding: 0;
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    -webkit-overflow-scrolling: touch;
}

/* Marks page: whole page stays fixed (sidebar, topbar, filters, pagination bar) —
   only the table of student rows scrolls internally. The vertical clip lives on
   body ONLY (its box exactly matches the viewport, so it never cuts off the
   horizontal full-bleed .marks-section/.marks-table-wrapper rely on). None of the
   intermediate ancestors get overflow set — CSS forces overflow-x to auto whenever
   overflow-y is non-visible on the same box, and 'auto' still visually clips until
   scrolled, so setting it anywhere but body reintroduces the chopped-off-sides bug.
   .marks-table-wrapper clips its own rows via its own overflow-y:auto (below),
   independent of these ancestors, so vertical containment still works fine. */
body.page-marks { height: 100vh; overflow-y: hidden; }
body.page-marks .app-main { height: 100vh; }
body.page-marks .main-content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding-bottom: 0; }
body.page-marks .marks-section { flex: 1; min-height: 0; padding-bottom: 16px; }
body.page-marks .marks-table-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.page-marks #marks-form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.page-marks .marks-table-wrapper { flex: 1; min-height: 0; max-height: none; }
body.page-marks .marks-pagination,
body.page-marks .marks-save-actions,
body.page-marks .app-footer { flex-shrink: 0; }
.marks-table {
    width: max-content;
    min-width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    background: #fff;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
}
.marks-table th,
.marks-table td {
    border: 1px solid #cbd5e1;
    padding: 0;
    vertical-align: middle;
}
.marks-table th {
    padding: 8px 10px;
    text-align: center;
    background: #fff;
    color: #0f172a;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
.marks-col-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 5;
    touch-action: none;
}
.marks-col-resize-handle:hover,
.marks-col-resize-handle.marks-col-resizing { background: rgba(14,165,233,0.4); }
.marks-table th.marks-col-id { width: 48px; min-width: 48px; position: sticky; left: 0; z-index: 3; background: #f1f5f9; }
.marks-table th.marks-col-name { width: 140px; min-width: 140px; text-align: left; padding-left: 10px; position: sticky; left: 48px; z-index: 3; background: #f1f5f9; box-shadow: 2px 0 6px rgba(0,0,0,0.06); }
.marks-table th.marks-col-given { width: 120px; min-width: 120px; text-align: left; padding-left: 10px; position: sticky; left: 188px; z-index: 3; background: #f1f5f9; box-shadow: 2px 0 6px rgba(0,0,0,0.06); }
.marks-table td.marks-col-given { width: 120px; min-width: 120px; padding: 0 10px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #f1f5f9; position: sticky; left: 188px; z-index: 1; box-shadow: 2px 0 6px rgba(0,0,0,0.06); }
.marks-table tbody tr:hover td.marks-col-given { background: #e2e8f0; }
.marks-table th.marks-col-gender { width: 56px; min-width: 56px; position: sticky; left: 308px; z-index: 3; background: #f1f5f9; box-shadow: 2px 0 6px rgba(0,0,0,0.06); }
.marks-table td.marks-col-gender { width: 56px; min-width: 56px; text-align: center; font-size: 0.85rem; background: #f1f5f9; position: sticky; left: 308px; z-index: 1; box-shadow: 2px 0 6px rgba(0,0,0,0.06); }
.marks-table tbody tr:hover td.marks-col-gender { background: #e2e8f0; }
.marks-table th.marks-col-input { width: 64px; min-width: 64px; }
.marks-table th.marks-col-total { width: 72px; min-width: 72px; }
.marks-table th.marks-col-std { width: 88px; min-width: 88px; }
.marks-table th.marks-col-pct { width: 56px; min-width: 56px; }
.marks-table th.marks-col-grade { width: 52px; min-width: 52px; }
.marks-table th.marks-col-rank { width: 64px; min-width: 64px; }
.marks-table td.marks-col-id {
    padding: 0 8px;
    text-align: center;
    font-size: 0.85rem;
    background: #f1f5f9;
    position: sticky;
    left: 0;
    z-index: 1;
    box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}
.marks-table td.marks-col-name {
    padding: 0 10px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: #f1f5f9;
    position: sticky;
    left: 48px;
    z-index: 1;
    box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}
.marks-table td.marks-col-input {
    padding: 0;
    text-align: center;
    width: 64px;
    min-width: 64px;
}
.marks-table td.marks-col-total { width: 72px; min-width: 72px; }
.marks-table td.marks-col-std { width: 88px; min-width: 88px; }
.marks-table td.marks-col-total,
.marks-table td.marks-col-std,
.marks-table td.marks-col-pct {
    text-align: center;
    font-weight: 500;
    font-size: 0.85rem;
}
.marks-table td.marks-col-grade { text-align: center; }
.marks-table td.marks-col-rank { text-align: center; font-size: 0.85rem; }
.marks-table tbody tr:hover td { background: #f8fafc; }
.marks-table tbody tr:hover td.marks-col-id,
.marks-table tbody tr:hover td.marks-col-name { background: #e2e8f0; }
.marks-table tbody tr { cursor: pointer; }
.marks-table tbody tr.marks-row-selected td { background: #e0f2fe; }
.marks-table tbody tr.marks-row-selected td.marks-col-id,
.marks-table tbody tr.marks-row-selected td.marks-col-name,
.marks-table tbody tr.marks-row-selected td.marks-col-given,
.marks-table tbody tr.marks-row-selected td.marks-col-gender { background: #bae6fd; }

/* Spreadsheet input cells */
.marks-input {
    width: 64px;
    min-width: 64px;
    height: 34px;
    padding: 0 6px;
    margin: 0;
    border: none;
    border-radius: 0;
    font-size: 0.9rem;
    text-align: center;
    background: #fff;
    box-sizing: border-box;
}
.marks-input:hover { background: #fafafa; }
.marks-input:focus {
    outline: none;
    background: #fff;
    box-shadow: inset 0 0 0 2px #0ea5e9;
}
.marks-input::placeholder { color: #94a3b8; }

/* Grade badges */
.grade-badge {
    display: inline-block;
    min-width: 28px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
}
.grade-a { background: #dcfce7; color: #166534; }
.grade-b { background: #dbeafe; color: #1e40af; }
.grade-c { background: #fef3c7; color: #92400e; }
.grade-d { background: #fed7aa; color: #c2410c; }
.grade-e { background: #fecaca; color: #b91c1c; }
.grade-f { background: #fee2e2; color: #991b1b; }

.marks-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.marks-pagination-size {
    display: flex;
    align-items: center;
    gap: 8px;
}
.marks-pagination-size label { font-weight: 600; white-space: nowrap; }
.marks-pagination-size select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--surface);
}
.marks-pagination-info { white-space: nowrap; }
.marks-pagination-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}
.marks-pagination-btn {
    padding: 6px 12px;
    font-size: 0.82rem;
}
.marks-pagination-disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.marks-pagination-page {
    font-weight: 600;
    white-space: nowrap;
    padding: 0 4px;
}

.marks-export-bar {
    position: sticky;
    bottom: 49px;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 28px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}
@media (max-width: 768px) {
    .marks-export-bar { padding: 12px 16px; flex-wrap: wrap; }
}
.marks-selected-student {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
    font-size: 0.85rem;
    color: var(--text);
    min-width: 0;
}
.marks-selected-student .msd-item { white-space: nowrap; }
.marks-selected-student .msd-label { font-weight: 600; color: var(--text-secondary); margin-right: 4px; }

.users-details-bar {
    position: sticky;
    bottom: 49px;
    z-index: 40;
    padding: 20px 28px 24px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
    min-height: 140px;
}
.users-details-heading {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.users-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 18px 28px;
}
.users-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.users-detail-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.users-detail-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}
@media (max-width: 768px) {
    .users-details-bar { padding: 16px; }
}

.users-table {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    overflow: visible;
    min-width: 880px;
}
.users-table th, .users-table td { white-space: nowrap; }
.users-table tbody tr { cursor: pointer; }
.users-table tbody tr:hover td { background: #f8fafc; }
.users-table tbody tr.row-selected td { background: #e0f2fe; }

/* Full name frozen left; Username + Role + Date Added scroll; Read Only + Actions frozen right */
.users-table th:nth-child(1), .users-table td:nth-child(1) {
    width: 200px; position: sticky; left: 0; z-index: 2;
    background: var(--surface); box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}
.users-table th:nth-child(2), .users-table td:nth-child(2) { width: 160px; }
.users-table th:nth-child(3), .users-table td:nth-child(3) { width: 130px; }
.users-table th:nth-child(4), .users-table td:nth-child(4) { width: 120px; }
.users-table th:nth-child(5), .users-table td:nth-child(5) {
    width: 110px; position: sticky; right: 160px; z-index: 2;
    background: var(--surface); box-shadow: -2px 0 6px rgba(0,0,0,0.06);
}
.users-table th:nth-child(6), .users-table td:nth-child(6) {
    width: 160px; position: sticky; right: 0; z-index: 2;
    background: var(--surface); box-shadow: -2px 0 6px rgba(0,0,0,0.06);
}
.users-table tbody tr:hover td:nth-child(1),
.users-table tbody tr:hover td:nth-child(5),
.users-table tbody tr:hover td:nth-child(6) { background: #f8fafc; }
.users-table tbody tr.row-selected td:nth-child(1),
.users-table tbody tr.row-selected td:nth-child(5),
.users-table tbody tr.row-selected td:nth-child(6) { background: #e0f2fe; }
.users-table thead th:nth-child(1),
.users-table thead th:nth-child(5),
.users-table thead th:nth-child(6) { z-index: 3; }

.roles-filter-fixed {
    position: sticky;
    top: var(--topbar-height, 40px);
    z-index: 45;
    margin-bottom: 0;
}
.roles-list-heading {
    margin: 0 0 16px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.roles-staff-role {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--surface2, #f1f5f9);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 10px;
}
.roles-staff-tag {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
}
.roles-staff-tag-saved { background: transparent; color: #16a34a; }
.roles-current-perms {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.roles-current-perms-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 4px;
}
.roles-current-perms-empty { font-size: 0.85rem; color: var(--text-muted); font-style: italic; }

/* Container 2, split in half: staff list left, selected user's permissions right */
.roles-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
    width: 100%;
}
@media (max-width: 900px) {
    .roles-split { grid-template-columns: 1fr; }
}
.roles-split-left,
.roles-split-right {
    max-height: 65vh;
    overflow-y: auto;
    border-radius: 0;
}
/* Users table inside the left split container — styled like User Management: sticky
   header (relative to this container's own bounded scroll box), frozen Name column. */
.roles-users-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    overflow: visible;
}
.roles-users-table th,
.roles-users-table td { padding: 10px 12px; text-align: left; vertical-align: middle; }
.roles-users-table tbody tr { cursor: pointer; }
.roles-users-table tbody tr:hover td { background: #f8fafc; }
.roles-users-table tbody tr.row-selected td { background: var(--primary-light); }
.roles-users-table th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--surface);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.roles-users-table th:nth-child(1), .roles-users-table td:nth-child(1) {
    width: 180px;
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--surface);
    box-shadow: 2px 0 6px rgba(0,0,0,0.06);
}
.roles-users-table th:nth-child(1) { z-index: 4; }
.roles-users-table th:nth-child(2), .roles-users-table td:nth-child(2) { width: 130px; }
.roles-users-table tbody tr:hover td:nth-child(1) { background: #f8fafc; }
.roles-users-table tbody tr.row-selected td:nth-child(1) { background: var(--primary-light); }

.roles-perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px 20px;
}
.roles-perm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}
.roles-perm-item input {
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    margin-right: 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.icon-btn-danger { color: var(--error); border-color: #fecaca; }
.icon-btn.icon-btn-danger:hover { background: var(--error-bg); border-color: var(--error); }

.icon-btn[data-tooltip] { position: relative; }
.icon-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: none;
    z-index: 20;
}
.icon-btn[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

.marks-save-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}
.marks-unsaved-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Audit log specific */
.audit-card { padding: 0; overflow: hidden; }
.audit-table-wrapper { overflow-x: auto; max-height: 65vh; overflow-y: auto; }
.audit-table th { position: sticky; top: 0; z-index: 1; background: #f8fafc !important; }
.audit-time { white-space: nowrap; color: var(--text-secondary); font-size: 0.9rem; }
.audit-details { max-width: 300px; word-break: break-word; font-size: 0.9rem; color: var(--text-secondary); }

/* Action badges */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-create { background: #dcfce7; color: #166534; }
.badge-update { background: #dbeafe; color: #1e40af; }
.badge-delete { background: #fef2f2; color: #991b1b; }
.badge-default { background: #e2e8f0; color: #475569; }

.audit-empty { padding: 64px 24px; text-align: center; color: var(--text-secondary); }
.audit-empty p { margin: 0 0 8px; font-size: 1.1rem; }
.audit-empty-hint { font-size: 0.9rem; color: var(--text-muted); }

/* Modal overlay - centered popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}
#addAssessmentModal { display: none; }
#addAssessmentModal.modal-open { display: flex; }
.modal-box {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
.modal-box-sm { max-width: 300px; padding: 20px; }
.modal-box-sm .modal-actions { margin-top: 16px; }
.modal-box h3 { margin: 0 0 20px; font-size: 1.2rem; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }

/* Marks - delete assessment (subtle, shows on hover) */
.marks-table th.marks-col-input {
    position: relative;
    padding-right: 28px;
}
.marks-col-header { display: block; }
.marks-outof-input {
    width: 34px;
    border: none;
    border-bottom: 1px dashed #94a3b8;
    background: transparent;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 600;
    color: inherit;
    padding: 0;
    -moz-appearance: textfield;
}
.marks-outof-input::-webkit-outer-spin-button,
.marks-outof-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.marks-outof-input:focus { outline: none; border-bottom-color: #2E5090; background: #f0f4ff; }
.marks-delete-btn {
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #94a3b8;
    border-radius: 2px;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.marks-table th.marks-col-input:hover .marks-delete-btn {
    opacity: 1;
    color: #b91c1c;
    background: #fee2e2;
}
.marks-delete-btn:hover {
    opacity: 1;
    color: #b91c1c;
    background: #fecaca;
}

/* ── Progress page ───────────────────────────────────────────────────────── */

/* Filter bar */
.prog-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
}
.prog-filter-form label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.prog-filter-form select { max-width: 160px; margin: 0; }

/* Overview stat cards (top row) */
.prog-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 800px) { .prog-overview { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .prog-overview { grid-template-columns: 1fr 1fr; } }

.prog-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px 16px;
    box-shadow: var(--shadow-sm);
}
.prog-stat-fraction {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    margin-bottom: 2px;
}
.prog-stat-fraction.prog-stat-ok { color: var(--success); }
.prog-stat-of { font-size: 1.1rem; font-weight: 500; color: var(--text-muted); }
.prog-stat-label { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.prog-stat-sub { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 12px; }
.prog-stat-bar-wrap { height: 5px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.prog-stat-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }
.prog-stat-bar-fill.ok { background: var(--success); }

/* Tab strip */
.prog-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    background: var(--surface-alt, #f1f5f9);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    scrollbar-width: none;
}
.prog-tabs::-webkit-scrollbar { display: none; }
.prog-tab-btn {
    flex-shrink: 0;
    padding: 9px 20px;
    background: transparent;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.4;
    letter-spacing: 0.01em;
}
.prog-tab-btn:hover {
    background: rgba(255, 255, 255, 0.65);
    color: var(--text, #1e293b);
    text-decoration: none;
}
.prog-tab-btn.active {
    background: #ffffff;
    color: var(--primary, #0ea5e9);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(14, 165, 233, 0.12);
}
.prog-tab-count {
    padding: 2px 7px;
    border-radius: 10px;
    background: #e2e8f0;
    color: var(--text-muted, #94a3b8);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.4;
}
.prog-tab-btn.active .prog-tab-count { background: #e0f2fe; color: #0369a1; }
.prog-tab-count.all-done { background: #dcfce7; color: var(--success); }

/* Panel header (description + chips) */
.prog-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}
.prog-panel-desc { margin: 0; font-size: 0.88rem; color: var(--text-secondary); max-width: 620px; line-height: 1.5; }
.prog-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.prog-chip {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.prog-chip-ok   { background: #dcfce7; color: #16a34a; }
.prog-chip-warn { background: #fef3c7; color: #b45309; }
.prog-chip-none { background: #f1f5f9; color: #64748b; }

/* Empty state */
.prog-empty { padding: 28px; color: var(--text-secondary); margin: 0; }

/* Table: row highlight colors */
.prog-row-ok td  { background: #f0fdf4; }
.prog-row-warn td { background: #fffbeb; }

/* Status badge */
.prog-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}
.prog-badge-ok   { background: #dcfce7; color: #16a34a; }
.prog-badge-warn { background: #fef3c7; color: #b45309; }
.prog-badge-none { background: #f1f5f9; color: #64748b; }

/* Class chip in table */
.prog-class-chip {
    display: inline-block;
    padding: 3px 10px;
    background: #f1f5f9;
    color: var(--text-secondary);
    border-radius: 5px;
    font-size: 0.82rem;
    font-weight: 500;
}

/* Assessment type mini-chips */
.prog-type-chip {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-left: 4px;
}
.type-test   { background: #dbeafe; color: #1e40af; }
.type-assign { background: #fef9c3; color: #854d0e; }
.type-proj   { background: #ede9fe; color: #5b21b6; }

/* Progress bar in table cell */
.prog-bar-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}
.prog-bar-wrap {
    flex: 1;
    height: 7px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    min-width: 70px;
}
.prog-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.prog-bar-fill-ok   { background: var(--success); }
.prog-bar-fill-warn { background: #f59e0b; }
.prog-bar-fill-none { background: #cbd5e1; }
.prog-bar-pct { font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; min-width: 36px; }

/* Dash for N/A cells */
.prog-dash { color: var(--text-muted); font-size: 0.9rem; }

/* Summary report */
.summary-filter-card { margin-bottom: 24px; }
.summary-filter-form .summary-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}
.summary-filter-form .form-group { margin-bottom: 0; }
.summary-section {
    margin-bottom: 32px;
}
.summary-section-title {
    margin: 0 0 16px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
}
.summary-hint {
    margin: -8px 0 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.summary-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}
.summary-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}
.summary-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}
.summary-stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}
.summary-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.summary-table {
    width: 100%;
    margin: 0;
    border: none;
}
.summary-table th,
.summary-table td { padding: 12px 16px; }
.summary-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}
.summary-badge-ok { background: var(--success-bg); color: var(--success); }
.summary-badge-warn { background: #fef3c7; color: #b45309; }
.summary-readiness {
    max-width: 480px;
}
.summary-readiness-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 12px;
}
.summary-readiness-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 5px;
    transition: width 0.3s ease;
}
.summary-readiness-text { margin: 0; font-size: 0.95rem; }

/* Summary - performance by gender, top students */
.summary-context {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.summary-context-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}
.summary-perf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.summary-perf-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.summary-perf-label { font-weight: 600; font-size: 1rem; display: block; margin-bottom: 4px; }
.summary-perf-value { font-size: 0.9rem; color: var(--text-secondary); display: block; margin-bottom: 12px; }
.summary-perf-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}
.summary-perf-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}
.summary-perf-fill-female { background: #a855f7; }
.summary-grade {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
}
.summary-grade-a { background: #dcfce7; color: #166534; }
.summary-grade-b { background: #dbeafe; color: #1e40af; }
.summary-grade-c { background: #fef3c7; color: #b45309; }
.summary-grade-d { background: #fed7aa; color: #c2410c; }
.summary-grade-e { background: #fecaca; color: #b91c1c; }
.summary-grade-f { background: #fef2f2; color: #991b1b; }
.summary-grade-dist {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.summary-grade-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.summary-grade-count {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
}

/* Report card - single student view */
.reportcard-page {
    width: 100vw;
    max-width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: 0 16px;
    box-sizing: border-box;
}
/* Pinned filter header: the page fills the viewport and only .reportcard-scroll
   scrolls, so the filter card sits outside the scrolling box and never moves.
   Same approach used by the marks page. */
body.page-reportcard { height: 100vh; overflow-y: hidden; }
body.page-reportcard .app-main { height: 100vh; }
body.page-reportcard .main-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 0;
}
body.page-reportcard .reportcard-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.reportcard-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 60px;
}
.reportcard-filter-card {
    flex: 0 0 auto;
    margin-bottom: 20px;
    border-radius: 0;
    z-index: 80;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.search-input { padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; min-width: 180px; }
.search-input:focus { outline: none; border-color: var(--primary); }
/* Search box sits beside its select so the group stays one control tall */
.search-select-wrap { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.search-select-wrap .search-input { min-width: 130px; max-width: 150px; }
.toolbar-with-search { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.toolbar-with-search .search-form-inline { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 200px; }
.toolbar-with-search .search-form-inline .search-input { flex: 1; max-width: 320px; }
.bio-filter-form .search-input { min-width: 200px; }

/* Filters on the left, actions pinned right, all on one baseline */
.reportcard-filter-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 24px;
}
.reportcard-filter-bar .reportcard-filter-form { flex: 1 1 auto; min-width: 0; }
.reportcard-filter-form .reportcard-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 18px;
    align-items: flex-end;
}
.reportcard-filter-form .form-group { margin-bottom: 0; }
.reportcard-filter-form select { max-width: 200px; }
.reportcard-filter-form select[name="student_id"] { min-width: 200px; }
.reportcard-filter-form .form-group-narrow select { max-width: 110px; }
/* lifts the checkbox so its text centres line up with the selects beside it */
.reportcard-filter-form .form-group-check { padding-bottom: 5px; }
.reportcard-filter-form .form-group-check .marks-checkbox-label { white-space: nowrap; }
.reportcard-year-static { font-weight: 700; }

/* Admin-only standardize setting, inline in the filter row */
.rc-std-inline { display: flex; align-items: center; gap: 8px; }
.reportcard-filter-form .rc-std-group input[type="number"] { width: 80px; max-width: 80px; }
#rc-std-status { font-size: 0.75rem; white-space: nowrap; }
.reportcard-container { margin-top: 24px; }
.reportcard-alert {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px 20px;
    border-radius: 0;
}
.reportcard-alert-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.reportcard-alert-body { min-width: 0; }
.reportcard-alert-title {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.reportcard-alert-text {
    margin: 0 0 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.reportcard-alert-text:last-child { margin-bottom: 0; }
.reportcard-missing-subjects { display: flex; flex-wrap: wrap; gap: 6px; }
.reportcard-missing-chip {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #f5c26b;
    color: #92400e;
    font-size: 0.8rem;
    font-weight: 600;
}
.reportcard-alert-ok { background: var(--success-bg); border-left: 4px solid var(--success); }
.reportcard-alert-ok .reportcard-alert-icon { background: #fff; color: var(--success); }
.reportcard-alert-warn { background: #fffbeb; border-left: 4px solid #f59e0b; }
.reportcard-alert-warn .reportcard-alert-icon { background: #fef3c7; color: #b45309; }
.reportcard-card { padding: 28px; }
.reportcard-card.reportcard-transcript { padding: 22px 30px; }
.reportcard-custom-header {
    margin-bottom: 16px;
    padding: 12px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.reportcard-custom-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.reportcard-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.reportcard-logo { max-height: 50px; margin-bottom: 12px; display: block; }
.reportcard-school-name { margin: 0 0 4px; font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); }
.reportcard-student-name { margin: 0 0 8px; font-size: 1.5rem; font-weight: 600; }
.reportcard-meta {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.reportcard-table-wrap { margin-bottom: 24px; overflow-x: auto; }
.reportcard-transcript .reportcard-table-wrap { overflow: visible; margin-bottom: 6px; }
.reportcard-table { margin: 0; width: 100%; }
.reportcard-transcript .reportcard-table th:not(.reportcard-col-subject),
.reportcard-transcript .reportcard-table td:not(:first-child) { white-space: nowrap; }
.reportcard-table th { width: auto; }
.reportcard-table-ap1,
.reportcard-table-ap2,
.reportcard-table-ap3 { font-size: 0.9rem; }
.reportcard-table-ap1 thead th,
.reportcard-table-ap2 thead th,
.reportcard-table-ap3 thead th { background: var(--surface-elevated, #f8fafc); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.reportcard-table-ap1 td,
.reportcard-table-ap2 td,
.reportcard-table-ap3 td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.reportcard-table-ap1 td:not(:first-child),
.reportcard-table-ap2 td:not(:first-child),
.reportcard-table-ap3 td:not(:first-child) { text-align: center; }
.reportcard-ap-group { text-align: center; }
.reportcard-col-subject { min-width: 140px; }
.reportcard-assess-col { min-width: 3.5em; font-size: 0.85em; font-weight: 600; }
.reportcard-assess-cell { min-width: 3.5em; font-size: 0.9em; text-align: center; }
.reportcard-table th:last-child,
.reportcard-table th:nth-last-child(2) { font-size: 0.8em; }
.reportcard-table td .reportcard-grade { font-weight: 600; }
.reportcard-row-missing { background: #fef3c7; }
.reportcard-row-missing td { color: var(--text-muted); }
.reportcard-grade {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 6px;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
}
.reportcard-grade-overall { font-size: 1.1rem; }
.reportcard-summary {
    padding: 16px 0;
    border-top: 1px solid var(--border);
    margin-bottom: 24px;
}
.reportcard-summary-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1.1rem;
    font-weight: 600;
}
.reportcard-summary-row span:first-child { min-width: 80px; }
.reportcard-eval-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.reportcard-eval-section h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.reportcard-eval-absences { margin-bottom: 12px; font-size: 0.95rem; }
.reportcard-eval-table-wrap { overflow-x: auto; }
.reportcard-eval-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.reportcard-eval-table th, .reportcard-eval-table td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.reportcard-eval-table th { background: #f8fafc; font-weight: 600; }
.reportcard-eval-grade { font-weight: 600; color: var(--primary); }
.reportcard-comment { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.reportcard-comment h3 { margin: 0 0 8px; font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.reportcard-comment-text {
    margin: 0;
    padding: 14px;
    background: #f8fafc;
    border-radius: var(--radius);
    font-size: 0.95rem;
    line-height: 1.6;
}
.reportcard-comment-text em { color: var(--text-muted); }
.reportcard-toolbar { display: flex; gap: 10px; flex: 0 0 auto; margin-left: auto; flex-wrap: wrap; }

/* ============================================================
   TRANSCRIPT — PROFESSIONAL A4 LAYOUT
   All font sizes use a strict hierarchy for visual consistency
   ============================================================ */

/* BASE SIZE TOKENS (change here to scale everything) */
/* h1 = school name  : 0.88rem bold upper */
/* h2 = doc title    : 0.72rem bold upper */
/* h3 = section head : 0.6rem  bold upper */
/* body               : 0.62rem */
/* table body         : 0.58rem */
/* sub-label          : 0.55rem */

.reportcard-transcript {
    font-family: Inter, sans-serif;
    width: 190mm;
    max-height: 297mm;
    padding: 10mm 12mm;
    background: #fff;
    color: #000;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

/* ── HEADER ── */
.transcript-header {
    text-align: center;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 2px solid #000;
}
.transcript-logos {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    min-height: 56px;
}
.transcript-logo-left, .transcript-logo-right { flex: 0 0 auto; }
.transcript-logo-left img, .transcript-logo-right img { max-height: 56px; max-width: 72px; object-fit: contain; }
.transcript-logo-center { flex: 1; text-align: center; }
.transcript-department { font-size: 0.58rem; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 1px; }
.transcript-school-name { margin: 0 0 1px; font-size: 0.88rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.transcript-address, .transcript-phone { font-size: 0.58rem; margin-bottom: 1px; }

/* ── DOCUMENT TITLE ── */
.transcript-doc-title {
    text-align: center;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 4px 0 2px;
    padding: 3px 0;
    border-top: 1.5px solid #000;
    border-bottom: 1.5px solid #000;
    background: #f0f0f0;
}
.transcript-level {
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* ── STUDENT INFO BOX ── */
.transcript-student-box {
    border: 1.5px solid #000;
    padding: 4px 8px;
    margin-bottom: 5px;
    background: #fafafa;
}
.transcript-student-name { font-size: 0.68rem; font-weight: 700; text-align: center; margin-bottom: 3px; }
.transcript-student-name u { text-decoration: underline; }
.transcript-student-details {
    font-size: 0.62rem;
    border-top: 1px solid #ccc;
    padding-top: 3px;
    margin-top: 3px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2px 12px;
}

/* ── MARKS TABLE ── */
.transcript-table th, .transcript-table td { border: 1px solid #333 !important; padding: 2px 4px; font-size: 0.58rem; }
.transcript-table th { background: #e0e0e0; font-weight: 700; text-align: center; font-size: 0.58rem; }
.transcript-table .reportcard-col-subject { text-align: left; min-width: 70px; width: auto; }
.reportcard-transcript table th,
.reportcard-transcript table td { border: 1px solid #333 !important; }
.reportcard-transcript .reportcard-table-ap1 thead th,
.reportcard-transcript .reportcard-table-ap2 thead th,
.reportcard-transcript .reportcard-table-ap3 thead th { padding: 2px 4px !important; font-size: 0.55rem !important; }
.reportcard-transcript .reportcard-table-ap1 td,
.reportcard-transcript .reportcard-table-ap2 td,
.reportcard-transcript .reportcard-table-ap3 td { padding: 2px 4px !important; font-size: 0.58rem !important; }
.reportcard-transcript .reportcard-grade { padding: 1px 3px !important; font-size: 0.55rem !important; min-width: 16px !important; background: #efefef !important; color: #000 !important; }
.reportcard-transcript .transcript-grade-cell { color: #000 !important; }
.reportcard-transcript .reportcard-table-wrap { border: 1.5px solid #000; margin-bottom: 5px; width: fit-content; min-width: 100%; box-sizing: border-box; }

/* ── VIRTUES + GATE — 50/50 SPLIT ── */
.transcript-virtues-section {
    margin-top: 5px;
    border: 1.5px solid #000;
    overflow: hidden;
}
.transcript-virtues-main-heading {
    text-align: center;
    font-weight: 700;
    font-size: 0.6rem;
    text-transform: uppercase;
    padding: 3px 6px;
    border-bottom: 1.5px solid #000;
    background: #e0e0e0;
    letter-spacing: 0.3px;
}
.transcript-virtues-header-row {
    display: flex;
    border-bottom: 1px solid #555;
}
.transcript-virtues-header-row .transcript-virtues-grading-key,
.transcript-virtues-header-row .transcript-addl-comments-header {
    flex: 0 0 50%;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 3px 6px;
    background: #f5f5f5;
    border-bottom: none;
}
.transcript-virtues-header-row .transcript-virtues-grading-key { border-right: 1px solid #555; }
.transcript-virtues-grading-key { font-size: 0.55rem; padding: 3px 6px; background: #f5f5f5; }
.transcript-virtues-two-col { display: flex; }
.transcript-virtues-block { flex: 0 0 50%; border-right: 1px solid #555; overflow: hidden; }
.transcript-gate-block     { flex: 0 0 50%; overflow: hidden; }
.transcript-virtues-table,
.transcript-gate-table { width: 100%; border-collapse: collapse; font-size: 0.58rem; }
.transcript-virtues-table td,
.transcript-gate-table td { border: 1px solid #bbb; padding: 2px 5px; text-align: left; font-size: 0.58rem; }
.transcript-virtues-table th,
.transcript-gate-table th { border: 1px solid #bbb; padding: 2px 5px; background: #e8e8e8; font-weight: 700; font-size: 0.58rem; }
.transcript-grade-cell { text-align: center !important; font-weight: 700; width: 28px; }
.transcript-gate-empty { font-size: 0.58rem; padding: 4px 6px; color: #555; font-style: italic; }
.transcript-addl-comments-header { background: #f5f5f5; font-weight: 700; font-size: 0.55rem; padding: 3px 6px; }

/* ── ADDITIONAL COMMENTS BOX ── */
.transcript-comments-box {
    margin-top: 4px;
    border: 1.5px solid #000;
    overflow: hidden;
}
.transcript-comments-box-heading {
    background: #e0e0e0;
    font-weight: 700;
    font-size: 0.6rem;
    text-transform: uppercase;
    padding: 3px 8px;
    border-bottom: 1px solid #555;
    letter-spacing: 0.3px;
}
.transcript-comments-box-content {
    min-height: 28px;
    padding: 4px 8px;
    font-size: 0.62rem;
    line-height: 1.4;
}

/* ── ABSENCE LINE (kept for compatibility) ── */
.transcript-absence {
    margin: 4px 0;
    padding: 3px 8px;
    font-size: 0.58rem;
    border: 1px solid #555;
    background: #fafafa;
}

/* ── SIGNATURES — 2×2 GRID ── */
.transcript-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 32px;
    margin: 6px 0 4px;
    padding: 6px 0 4px;
    border-top: 1.5px solid #000;
}
.transcript-sig-row { display: contents; }
.transcript-sig-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
}
.transcript-sig-line { width: 100%; max-width: 160px; height: 36px; border-bottom: 1.5px solid #000; margin-bottom: 1px; }
.transcript-sig-block img.transcript-sig-image { max-height: 36px; max-width: 120px; object-fit: contain; }
.transcript-sig-block strong.transcript-sig-name { font-size: 0.58rem; display: block; text-transform: uppercase; }
.transcript-sig-block span.transcript-sig-title { font-size: 0.58rem; font-weight: 600; display: block; text-transform: uppercase; }

/* ── DISCLAIMER ── */
.transcript-disclaimer {
    text-align: center;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 4px 8px;
    border: 1.5px solid #000;
    margin-top: 4px;
    background: #f0f0f0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

@media print {
    @page { size: A4; margin: 6mm; }
    body { background: white !important; margin: 0 !important; padding: 0 !important; }
    .sidebar, .tab-bar, .app-main .container .page-header, .reportcard-filter-card, .reportcard-toolbar, .reportcard-alert, .btn, .app-footer { display: none !important; }
    .app-main, .container, .main-content { margin: 0 !important; padding: 0 !important; max-width: none !important; }
    /* unwind the pinned-header viewport layout so the whole card prints */
    body.page-reportcard, body.page-reportcard .app-main,
    body.page-reportcard .main-content, body.page-reportcard .reportcard-page,
    .reportcard-scroll {
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        display: block !important;
    }
    .reportcard-card { box-shadow: none !important; margin: 0 !important; }
    .reportcard-card.reportcard-transcript { padding: 14px 20px !important; }
    .reportcard-transcript {
        max-width: 100% !important;
        max-height: 297mm !important;
        overflow: hidden;
        page-break-inside: avoid;
    }
    .reportcard-container { margin: 0 !important; padding: 0 !important; }
    .reportcard-table-wrap { overflow: visible !important; }
    .reportcard-print-tip { display: none !important; }
    .reportcard-transcript,
    .reportcard-transcript * { color: #000 !important; }
    .reportcard-transcript table th,
    .reportcard-transcript table td { border: 1px solid #000 !important; }
    .reportcard-transcript .reportcard-grade {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
}

/* Report card design - template form */
.design-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin: 24px 0;
}
.design-form-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.design-form-section h3 { margin: 0 0 16px; font-size: 1rem; font-weight: 600; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.design-form-section .form-group { margin-bottom: 14px; }
.design-form-section .form-group:last-child { margin-bottom: 0; }
.design-form-full { grid-column: 1 / -1; }
.design-actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }

/* Subject checkbox list - circular checkmarks */
.subject-check-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px 20px;
    max-height: 280px;
    overflow-y: auto;
    padding: 12px;
    background: #f8fafc;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.subject-check-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}
.subject-check-item:hover .subject-check-circle { border-color: var(--primary); }
.subject-check-item input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.subject-check-circle {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: white;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.subject-check-item input:checked + .subject-check-circle {
    background: var(--primary);
    border-color: var(--primary);
}
.subject-check-item input:checked + .subject-check-circle::after {
    content: "✓";
    color: white;
    font-size: 13px;
    font-weight: bold;
}
.subject-check-label { font-size: 0.95rem; }
.subject-check-item--locked { cursor: default; opacity: 0.65; }
.subject-check-item--locked:hover .subject-check-circle { border-color: var(--border); }
.subject-check-item--locked input:checked + .subject-check-circle { background: var(--text-secondary); border-color: var(--text-secondary); }
.subject-class-tag { display: inline-block; font-size: 0.7rem; font-weight: 600; background: var(--border); color: var(--text-secondary); border-radius: 4px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; text-transform: uppercase; letter-spacing: 0.04em; }

/* Report card design editor (legacy blocks) */
.design-editor { display: flex; gap: 24px; margin: 24px 0; min-height: 500px; }
.design-palette {
    width: 200px;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    height: fit-content;
}
.design-palette h3 { margin: 0 0 8px; font-size: 1rem; }
.design-palette-hint { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 16px; }
.design-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    cursor: grab;
    font-size: 0.9rem;
}
.design-block:hover { background: #f1f5f9; border-color: var(--primary); }
.design-block:active { cursor: grabbing; }
.design-block-icon { font-size: 1.2rem; }
.design-palette hr { margin: 20px 0; border: none; border-top: 1px solid var(--border); }
.design-palette h4 { margin: 0 0 12px; font-size: 0.9rem; }
.design-palette .form-group { margin-bottom: 12px; }
.design-palette .form-group label { font-size: 0.85rem; }
.design-logo-preview { max-width: 100%; max-height: 60px; margin-top: 8px; display: block; }
.design-sig-preview { max-width: 140px; max-height: 50px; margin-top: 8px; display: block; object-fit: contain; }
.signature-upload-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.signature-upload-form input[type="file"] { font-size: 0.85rem; }
.logo-upload-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* System profile */
.system-profile-card { padding: 28px; max-width: 480px; }
.system-profile-form .form-group { margin-bottom: 16px; }
.system-profile-divider { margin: 24px 0; border: none; border-top: 1px solid var(--border); }
.system-profile-card .logo-upload-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.system-profile-card .logo-upload-row input[type="file"] { flex: 1; min-width: 180px; }
.logo-preview { margin-top: 16px; }
.logo-preview-img { max-width: 160px; max-height: 80px; object-fit: contain; display: block; }

/* Grading settings */
.grading-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}
.grading-settings-card { padding: 24px; }
.grading-settings-title { margin: 0 0 8px; font-size: 1.1rem; font-weight: 600; }
.grading-settings-desc { margin: 0 0 20px; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.4; }
.grading-keys-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-bottom: 20px; }
.grading-keys-table th, .grading-keys-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.grading-keys-table th { font-weight: 600; color: var(--text-secondary); }
.grading-input { width: 70px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; }
.grading-form-actions { margin-top: 0; }
.grading-hint { margin: 0 0 16px; font-size: 0.85rem; color: var(--text-muted); }
.grading-reset-form { margin-top: 16px; }

/* Announcements */
.announcements-form-card { margin-bottom: 24px; }
.announcements-form-card h3 { margin: 0 0 16px; font-size: 1.1rem; }
.announcements-list-card h3 { margin: 0 0 16px; font-size: 1.1rem; }
.announcements-list { display: flex; flex-direction: column; gap: 20px; }
.announcement-item {
    padding: 20px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.announcement-header { margin-bottom: 12px; }
.announcement-title { margin: 0 0 6px; font-size: 1.05rem; font-weight: 600; }
.announcement-meta { font-size: 0.85rem; color: var(--text-muted); }
.announcement-date { margin-right: 12px; }
.announcement-body { color: var(--text); line-height: 1.5; margin-bottom: 12px; }
.announcement-actions { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.design-canvas-wrap { flex: 1; overflow: auto; background: #e5e7eb; padding: 24px; border-radius: var(--radius); }
.design-canvas {
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    background: white;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    position: relative;
    padding: 20mm;
}
.design-canvas-drag-over { outline: 2px dashed var(--primary); outline-offset: 4px; }
.design-canvas-block {
    position: absolute;
    min-width: 120px;
    padding: 10px 14px;
    background: rgba(14,165,233,0.1);
    border: 2px solid var(--primary);
    border-radius: var(--radius);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.design-canvas-block:hover { background: rgba(14,165,233,0.15); }
.design-block-label { font-size: 0.9rem; font-weight: 500; text-transform: capitalize; }
.design-block-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.design-block-remove:hover { color: var(--error); }
.design-actions { margin-top: 20px; display: flex; gap: 12px; }


/* Withdrawn student badge */
.badge-withdrawn {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 6px;
    border: 1px solid #fecaca;
}
.marks-row-withdrawn td { opacity: 0.55; }

/* Payment entry form */
@media (max-width: 800px) {
    .payment-entry-form { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 500px) {
    .payment-entry-form { grid-template-columns: 1fr !important; }
}

/* ── Shared utility classes ──────────────────────────────────────────────── */

/* Small button */
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* Ghost button */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
    padding: 10px 14px;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); text-decoration: none; border-color: var(--border); }

/* Status / label badges */
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fef2f2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* Stat cards row */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
}
.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Form control — applies input/select/textarea styles outside .form-group */
.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }

/* Form label */
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Form row — horizontal grouping of form groups */
.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 140px; margin-bottom: 18px; }
.form-row .form-group .form-control { max-width: none; }

/* Standalone hint text */
.hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 16px;
}

/* Table wrap — horizontal scroll */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.table-wrap table {
    margin: 0;
    box-shadow: none;
    border-radius: 0;
}
