/**
 * Royal Stars International School
 * School Management and Monitoring System - Stylesheet
 */

/* ==================== CSS VARIABLES ==================== */
:root {
    --primary: #4a7c42;
    --primary-dark: #2d5a27;
    --primary-light: #6b9b63;
    --secondary: #5a8f52;
    --secondary-dark: #3d6b36;
    --accent: #d69e2e;
    --accent-light: #ecc94b;
    --background: #eae6f0;
    --card-bg: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-muted: #a0aec0;
    --success: #38a169;
    --success-light: #c6f6d5;
    --warning: #dd6b20;
    --warning-light: #feebc8;
    --error: #e53e3e;
    --error-light: #fed7d7;
    --border: #e2e8f0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --transition: all 0.3s ease;
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Glassmorphism tokens */
    --glass-bg: rgba(255, 255, 255, 0.42);
    --glass-bg-strong: rgba(255, 255, 255, 0.58);
    --glass-border: rgba(255, 255, 255, 0.55);
    --glass-border-hover: rgba(255, 255, 255, 0.8);
    --glass-blur: 16px;
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    background-image:
        radial-gradient(ellipse at 5% 2%, rgba(74,124,66,0.30) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 0%, rgba(214,158,46,0.25) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 40%, rgba(13,148,136,0.14) 0%, transparent 55%),
        radial-gradient(ellipse at 95% 50%, rgba(124,58,237,0.18) 0%, transparent 42%),
        radial-gradient(ellipse at 15% 75%, rgba(244,114,182,0.15) 0%, transparent 48%),
        radial-gradient(ellipse at 60% 95%, rgba(59,130,246,0.16) 0%, transparent 45%),
        radial-gradient(ellipse at 35% 20%, rgba(251,191,36,0.10) 0%, transparent 40%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Soft floating orbs that drift slowly behind page content. */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(120px);
    will-change: transform;
}
body::before {
    width: 700px;
    height: 700px;
    top: -8%;
    right: -2%;
    background: radial-gradient(circle, rgba(13,148,136,0.30) 0%, transparent 70%);
    animation: orbDrift1 28s ease-in-out infinite;
}
body::after {
    width: 600px;
    height: 600px;
    bottom: -5%;
    left: 8%;
    background: radial-gradient(circle, rgba(124,58,237,0.24) 0%, transparent 70%);
    animation: orbDrift2 34s ease-in-out infinite;
}
@keyframes orbDrift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(30px, 22px) scale(1.06); }
    66%      { transform: translate(-18px, -12px) scale(0.95); }
}
@keyframes orbDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(-22px, -28px) scale(1.08); }
    66%      { transform: translate(28px, 14px) scale(0.94); }
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: var(--primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-light);
}

img {
    max-width: 100%;
    height: auto;
}

/* ==================== LAYOUT ==================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 60%, #1e4420 100%);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
    box-shadow: 2px 0 16px rgba(0,0,0,0.10);
}

.sidebar-header {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.sidebar-logo-icon {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-logo h2 {
    color: white;
    font-size: 1.25rem;
    margin: 0;
}

.sidebar-tagline {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 16px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: var(--transition);
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--accent);
}

.sidebar-nav li a.active {
    background: rgba(255, 255, 255, 0.13);
    box-shadow: inset 3px 0 12px -4px rgba(214, 158, 46, 0.25);
}

.sidebar-nav li a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.sidebar-nav .nav-section {
    padding: 14px 24px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
}

/* Persistent pinned entries below the section-scoped nav list.
   "Help & Guide" triggers the onboarding tour replay; "Give Feedback"
   opens the feedback page. Both sit below a separator line. */
.sidebar-nav li.nav-tour,
.sidebar-nav li.nav-feedback {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}
/* Remove the double border between the two pinned items. */
.sidebar-nav li.nav-feedback {
    margin-top: 0;
    border-top: none;
}

/* Collapsible nav group (e.g. Reports -> Continuous Assessment / Terminal Reports) */
.sidebar-nav .nav-parent > a {
    cursor: pointer;
}
.sidebar-nav .nav-parent .nav-caret {
    margin-left: auto;
    margin-right: 0;
    width: auto;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}
.sidebar-nav .nav-parent.open .nav-caret {
    transform: rotate(180deg);
}
.sidebar-nav .nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
.sidebar-nav .nav-parent.open .nav-submenu {
    max-height: 240px;
}
.sidebar-nav .nav-submenu li a {
    padding-left: 56px;
    font-size: 0.9rem;
}

/* "Back to Hub" shortcut at the top of the sidebar nav, just below the badge. */
.sidebar-nav .sidebar-back {
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-nav .sidebar-back a {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    justify-content: center;
}

/* Bigger, centered arrow when collapsed; it glides left as the label reveals. */
.sidebar-nav .sidebar-back a i {
    font-size: 1.3rem;
    margin-right: 0;
    transition: margin-right 0.3s ease;
}

.sidebar-nav .sidebar-back a:hover i {
    margin-right: 10px;
}

/* Show only the arrow by default; slide the label in on hover. */
.sidebar-nav .sidebar-back a span {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.3s ease, opacity 0.3s ease;
}

.sidebar-nav .sidebar-back a:hover span {
    max-width: 140px;
    opacity: 1;
}

/* On the mobile off-canvas menu (no hover), match other items: label always shown. */
@media (max-width: 768px) {
    .sidebar-nav .sidebar-back a {
        justify-content: flex-start;
    }
    .sidebar-nav .sidebar-back a i {
        margin-right: 12px;
    }
    .sidebar-nav .sidebar-back a span {
        max-width: 140px;
        opacity: 1;
    }
}

/* Browser-style back/forward controls under Back to Hub */
.sidebar-nav .sidebar-history {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-nav .sidebar-history a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    padding: 10px 8px;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-nav .sidebar-history a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav .sidebar-history a i {
    font-size: 1.1rem;
    margin-right: 0;
    transition: margin-right 0.3s ease;
}

.sidebar-nav .sidebar-history a:hover i {
    margin-right: 6px;
}

.sidebar-nav .sidebar-history a span {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.3s ease, opacity 0.3s ease;
}

.sidebar-nav .sidebar-history a:hover span {
    max-width: 80px;
    opacity: 1;
}

@media (max-width: 768px) {
    .sidebar-nav .sidebar-history a {
        justify-content: flex-start;
    }
    .sidebar-nav .sidebar-history a i {
        margin-right: 10px;
    }
    .sidebar-nav .sidebar-history a span {
        max-width: 80px;
        opacity: 1;
    }
}

/* Clickable school badge / name (shortcut to home; see js/main.js). */
.sidebar-logo[role="link"] {
    cursor: pointer;
    transition: var(--transition);
}

.sidebar-logo[role="link"]:hover {
    opacity: 0.85;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.main-header {
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(226,232,240,0.6);
}

.main-header h1 {
    font-size: 1.5rem;
    color: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.user-dropdown-toggle:hover {
    background: rgba(74, 124, 66, 0.06);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1000;
}

.user-dropdown:hover .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-primary);
    transition: var(--transition);
}

.user-dropdown-menu a:hover {
    background: rgba(74, 124, 66, 0.08);
    color: var(--primary);
}

.user-dropdown-menu a i {
    margin-right: 10px;
    width: 18px;
}

/* ==================== NOTIFICATION BELL ==================== */
.notif-bell {
    position: relative;
}

.notif-bell-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--background);
    color: var(--text-secondary);
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
}

.notif-bell-btn:hover {
    background: var(--primary-light);
    color: #fff;
}

.notif-bell.has-unread .notif-bell-btn {
    color: var(--primary);
}

/* Gentle wiggle when there are unread items. */
.notif-bell.has-unread .notif-bell-btn i {
    transform-origin: 50% 4px;
    animation: notif-swing 2.4s ease-in-out infinite;
}

@keyframes notif-swing {
    0%, 82%, 100% { transform: rotate(0); }
    86% { transform: rotate(14deg); }
    90% { transform: rotate(-11deg); }
    94% { transform: rotate(7deg); }
    98% { transform: rotate(-3deg); }
}

.notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: linear-gradient(135deg, #f56565, #e53e3e);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--card-bg, #fff);
    display: none;
}

.notif-bell.has-unread .notif-badge {
    display: block;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    max-width: 88vw;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    z-index: 1200;
    overflow: hidden;
}

.notif-bell.open .notif-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.4);
    font-weight: 700;
    color: var(--text-primary);
}

.notif-dropdown-header button {
    border: none;
    background: none;
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.notif-dropdown-header button:hover {
    text-decoration: underline;
}

.notif-list {
    max-height: 380px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.35);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: rgba(74, 124, 66, 0.06);
}

.notif-item.unread {
    background: rgba(74, 124, 66, 0.1);
}

.notif-item-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: #fff;
    font-size: 0.85rem;
}

.notif-item-icon.type-grade { background: #3182ce; }
.notif-item-icon.type-report { background: var(--accent); }
.notif-item-icon.type-account { background: #805ad5; }
.notif-item-icon.type-announcement { background: var(--primary); }

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-weight: 600;
    font-size: 0.88rem;
    margin: 0 0 2px;
}

.notif-item-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-item-time {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.notif-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.notif-empty i {
    display: block;
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--border);
}

/* "View all notifications" footer link in the bell dropdown */
.notif-view-all {
    display: block;
    text-align: center;
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    border-top: 1px solid rgba(226, 232, 240, 0.4);
    text-decoration: none;
    transition: background 0.15s ease;
}
.notif-view-all:hover {
    background: rgba(74, 124, 66, 0.06);
}
.notif-view-all i {
    font-size: 0.7rem;
    margin-left: 4px;
}

/* Notification bell on hub pages (.hub-topbar) */
.hub-topbar .notif-bell {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
}
.hub-topbar .notif-bell-btn {
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 38px;
    height: 38px;
}
.hub-topbar .notif-bell-btn:hover {
    background: rgba(255,255,255,0.25);
}

/* ==================== NOTIFICATIONS PAGE ==================== */
.notif-page-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.notif-page-item {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    cursor: pointer;
}
.notif-page-item:last-child {
    border-bottom: none;
}
.notif-page-item:hover {
    background: var(--background);
}
.notif-page-item.unread {
    background: rgba(74, 124, 66, 0.05);
    border-left: 3px solid var(--primary);
}
.notif-page-item .notif-page-icon {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: #fff;
    font-size: 1rem;
}
.notif-page-item .notif-page-icon.type-grade { background: #3182ce; }
.notif-page-item .notif-page-icon.type-report { background: var(--accent); }
.notif-page-item .notif-page-icon.type-account { background: #805ad5; }
.notif-page-item .notif-page-icon.type-announcement { background: var(--primary); }
.notif-page-body {
    flex: 1;
    min-width: 0;
}
.notif-page-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0 0 4px;
}
.notif-page-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 6px;
}
.notif-page-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.notif-page-empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
}
.notif-page-empty i {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: var(--border);
}
.notif-page-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.notif-page-actions .btn {
    font-size: 0.85rem;
}

/* ---- Notifications filter side menu ---- */
.notif-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.notif-filters {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 20px;
}
.notif-filters-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin: 0 0 8px;
    padding: 0 8px;
}
.notif-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.notif-filter-item i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}
.notif-filter-item span:nth-of-type(1) {
    flex: 1;
}
.notif-filter-item:hover {
    background: var(--background);
    color: var(--text);
}
.notif-filter-item.active {
    background: rgba(74, 124, 66, 0.1);
    color: var(--primary);
    font-weight: 600;
}
.notif-filter-count {
    background: var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    min-width: 22px;
    text-align: center;
}
.notif-filter-item.active .notif-filter-count {
    background: var(--primary);
    color: #fff;
}
.notif-filters-action {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.notif-content {
    flex: 1;
    min-width: 0;
}

/* Notification item row with archive button */
.notif-page-item-wrap {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}
.notif-page-item-wrap:last-child {
    border-bottom: none;
}
.notif-page-item-wrap:hover {
    background: var(--background);
}
/* Override the per-item hover/border from the old layout. */
.notif-page-item-wrap .notif-page-item {
    border-bottom: none;
    flex: 1;
    min-width: 0;
}
.notif-page-item-wrap .notif-page-item:hover {
    background: transparent;
}

/* Archive / restore button */
.notif-archive-form {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: 0 12px;
}
.notif-archive-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.85rem;
}
.notif-archive-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(74, 124, 66, 0.08);
}

/* Archived items get a muted look. */
.notif-page-item.archived {
    opacity: 0.65;
}
.notif-page-item.archived .notif-page-icon {
    filter: grayscale(0.4);
}

/* "NEW" badge inside the title line. */
.notif-new-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* Responsive: stack the filter menu above the list on narrow screens. */
@media (max-width: 768px) {
    .notif-layout {
        flex-direction: column;
        gap: 16px;
    }
    .notif-filters {
        flex: 1 1 auto;
        flex-direction: row;
        flex-wrap: wrap;
        position: static;
        gap: 4px;
    }
    .notif-filters-title {
        width: 100%;
        margin-bottom: 4px;
    }
    .notif-filter-item {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .notif-filters-action {
        width: 100%;
    }
}

.main-body {
    padding: 32px;
    animation: pageEnter 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* Page enter: gentle scale + fade (no harsh directional slide). */
@keyframes pageEnter {
    from { opacity: 0; transform: scale(0.97) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Exit animation applied just before the browser navigates away. */
.main-body.page-exit,
.hub-main.page-exit {
    animation: pageExit 0.26s cubic-bezier(0.55, 0.06, 0.68, 0.19) both;
}
@keyframes pageExit {
    from { opacity: 1; transform: scale(1) translateY(0); }
    to   { opacity: 0; transform: scale(0.97) translateY(10px); }
}

/* ==================== CARDS ==================== */
.card {
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.5);
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06), 0 12px 28px rgba(0,0,0,0.04);
    transform: translateY(-2px);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.1rem;
    color: var(--primary);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--background);
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow);
    border-color: var(--glass-border-hover);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: rgba(26, 54, 93, 0.1);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon.secondary {
    background: rgba(197, 48, 48, 0.1);
    color: var(--secondary);
}

.stat-icon.accent {
    background: rgba(214, 158, 46, 0.1);
    color: var(--accent);
}

.stat-content h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-content h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin: 4px 0;
}

.stat-content p {
    font-size: 0.85rem;
    color: var(--success);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    box-shadow: 0 4px 12px rgba(74, 124, 66, 0.25);
    transform: translateY(-1px);
    color: white;
}

.btn-secondary {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(74, 124, 66, 0.15);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, #c53030 100%);
    color: white;
}

.btn-danger:hover {
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.25);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #2f855a 100%);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.25);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #c05621 100%);
    color: white;
}

.btn-warning:hover {
    box-shadow: 0 4px 12px rgba(221, 107, 32, 0.25);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 8px;
}

.btn-lg {
    padding: 14px 30px;
    font-size: 1.1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    color: var(--text-primary);
}

.form-control:hover {
    border-color: var(--glass-border-hover);
    background: rgba(255, 255, 255, 0.65);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(74, 124, 66, 0.12), 0 2px 8px rgba(74, 124, 66, 0.06);
    background: var(--glass-bg-strong);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.10);
}

.form-error {
    color: var(--error);
    font-size: 0.85rem;
    margin-top: 4px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234a7c42'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    padding-right: 44px;
    cursor: pointer;
}

.form-select option {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-primary);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* Textarea gets a slightly taller, softer feel. */
textarea.form-control {
    min-height: 100px;
    resize: vertical;
    line-height: 1.55;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ==================== TABLES ==================== */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: rgba(240, 247, 239, 0.6);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--background);
}

.table tbody tr:nth-child(even) {
    background: rgba(247, 250, 252, 0.5);
}

.table tbody tr:nth-child(even):hover {
    background: var(--background);
}

/* Broadsheet detail layout (P1, P2, Total, Grade per subject) */
.broadsheet-detail th,
.broadsheet-detail td {
    padding: 6px 4px;
    font-size: 0.82rem;
    white-space: nowrap;
}
.broadsheet-detail .subj-group {
    background: rgba(26, 54, 93, 0.08);
    border-bottom: 2px solid rgba(26, 54, 93, 0.2);
    font-size: 0.78rem;
    letter-spacing: 0.3px;
    text-transform: none;
    min-width: 140px;
}
.broadsheet-detail .sub-col {
    padding: 4px 2px;
    font-size: 0.72rem;
    min-width: 30px;
    text-transform: uppercase;
}
.broadsheet-detail .sub-col.p1 { color: #6366f1; }
.broadsheet-detail .sub-col.p2 { color: #0891b2; }
.broadsheet-detail .sub-col.tot { background: #fdf6ec; font-weight: 700; }
.broadsheet-detail .sub-col.grd { background: #e8f5e9; font-weight: 600; min-width: 28px; }
.broadsheet-detail td.sub-col.p1 { color: var(--text-secondary); font-size: 0.8rem; }
.broadsheet-detail td.sub-col.p2 { color: var(--text-secondary); font-size: 0.8rem; }
.broadsheet-detail td.sub-col.tot { font-weight: 600; color: var(--text); }
.broadsheet-detail td.sub-col.grd { font-weight: 700; color: #2d6a4f; }

/* ==================== BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-primary {
    background: rgba(26, 54, 93, 0.1);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--error-light);
    color: var(--error);
}

.badge-secondary {
    background: rgba(113, 128, 150, 0.1);
    color: var(--text-secondary);
}

/* ==================== TIMETABLE TYPE TABS ==================== */
.tt-type-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.04);
    border-radius: 12px;
    padding: 4px;
    width: fit-content;
}
.tt-type-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.tt-type-tab:hover {
    background: rgba(255,255,255,0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--text-dark);
}
.tt-type-tab.active {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Timetable filter row */
.tt-filters {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.tt-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}
.tt-filter-group .form-label {
    font-size: 0.8rem;
    margin-bottom: 0;
}

/* Inline form row (for add slot forms) */
.tt-inline-form {
    margin-top: 8px;
}
.tt-form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.tt-form-row .form-group {
    min-width: 120px;
    flex: 1;
}

/* ==================== DUTY ROSTER GRID ==================== */
.duty-roster-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    border-top: 1px solid rgba(0,0,0,0.08);
}
.duty-day-card {
    border-right: 1px solid rgba(0,0,0,0.08);
    min-height: 120px;
}
.duty-day-card:last-child {
    border-right: none;
}
.duty-day-header {
    background: var(--primary);
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    padding: 10px 8px;
    text-transform: uppercase;
}
.duty-day-body {
    padding: 8px;
}
.duty-entry {
    background: rgba(74, 124, 66, 0.06);
    border: 1px solid rgba(74, 124, 66, 0.15);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.duty-entry:last-child {
    margin-bottom: 0;
}
.duty-entry-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.duty-entry-main strong {
    font-size: 0.85rem;
    color: var(--text-dark);
}
.duty-label {
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
}
.duty-entry-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.btn-xs {
    padding: 2px 6px;
    font-size: 0.7rem;
    border-radius: 4px;
}

/* Responsive: stack duty roster on mobile */
@media (max-width: 768px) {
    .duty-roster-grid {
        grid-template-columns: 1fr;
    }
    .duty-day-card {
        border-right: none;
        border-bottom: 1px solid rgba(0,0,0,0.08);
    }
    .tt-filters {
        flex-direction: column;
    }
    .tt-form-row {
        flex-direction: column;
    }
}

/* ==================== GRID-BASED TIMETABLES ==================== */

/* View switcher (List / Grid buttons) */
.tt-view-switcher {
    display: inline-flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--card);
}
.tt-view-switcher .btn {
    border: none;
    border-radius: 0;
    padding: 6px 14px;
    font-size: 0.82rem;
    line-height: 1.4;
    background: transparent;
    color: var(--text-muted, #555);
}
.tt-view-switcher .btn + .btn {
    border-left: 1px solid var(--border);
}
.tt-view-switcher .btn-primary {
    background: var(--primary, #2b7a4a);
    color: #fff;
}
.tt-view-switcher .btn-secondary {
    background: transparent;
    color: var(--text-muted, #555);
}
.tt-view-switcher .btn:hover {
    opacity: 0.85;
}

/* Shared grid table styling */
.tt-class-grid,
.tt-dept-grid,
.tt-exam-grid,
.tt-duty-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    table-layout: fixed;
}

.tt-class-grid th,
.tt-class-grid td,
.tt-dept-grid th,
.tt-dept-grid td,
.tt-exam-grid th,
.tt-exam-grid td,
.tt-duty-table th,
.tt-duty-table td {
    border: 1px solid rgba(0,0,0,0.10);
    padding: 8px 6px;
    text-align: center;
    vertical-align: middle;
}

.tt-class-grid thead th,
.tt-dept-grid thead th,
.tt-exam-grid thead th,
.tt-duty-table thead th {
    background: rgba(74, 124, 66, 0.10);
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tt-day-head,
.tt-class-head,
.tt-exam-class-head {
    width: 90px;
    background: rgba(74, 124, 66, 0.14) !important;
}

.tt-time-head {
    min-width: 90px;
}

.tt-break-head {
    background: rgba(113, 128, 150, 0.12) !important;
    color: var(--text-secondary) !important;
    min-width: 55px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    padding: 12px 4px;
}

.tt-break-label {
    font-size: 0.68rem;
    font-weight: 800;
    margin-top: 6px;
}

.tt-day-cell,
.tt-class-cell,
.tt-exam-class-cell {
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(74, 124, 66, 0.06);
}

.tt-slot-cell,
.tt-exam-slot-cell {
    min-height: 48px;
}

.tt-break-cell {
    background: repeating-linear-gradient(
        45deg,
        rgba(113, 128, 150, 0.04),
        rgba(113, 128, 150, 0.04) 8px,
        rgba(113, 128, 150, 0.08) 8px,
        rgba(113, 128, 150, 0.08) 16px
    );
}

.tt-entry {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tt-subject,
.tt-exam-subject {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 0.82rem;
    text-transform: uppercase;
    line-height: 1.25;
}

.tt-teacher,
.tt-activity,
.tt-exam-meta {
    font-size: 0.74rem;
    color: var(--text-secondary);
    line-height: 1.25;
}

.tt-activity {
    font-weight: 600;
    text-transform: uppercase;
}

.tt-empty {
    color: var(--text-muted);
    opacity: 0.5;
}

.tt-entry-actions {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tt-entry:hover .tt-entry-actions {
    opacity: 1;
}

/* Department grid specific */
.tt-dept-grid .tt-day-cell {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* Exam grid specific */
.tt-exam-title {
    text-align: center;
    margin-bottom: 16px;
}

.tt-exam-title h2 {
    margin: 0 0 4px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tt-exam-title p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.tt-exam-date-head {
    min-width: 110px;
}

.tt-exam-date-head div:first-child {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.tt-exam-date {
    font-size: 0.88rem;
    font-weight: 700;
}

.tt-exam-entry {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Duty roster weekly table */
.tt-duty-table {
    font-size: 0.88rem;
}

.tt-duty-table thead th {
    background: rgba(74, 124, 66, 0.12);
    color: var(--primary);
    font-weight: 700;
    text-transform: uppercase;
}

.tt-duty-week {
    text-align: center;
    width: 150px;
}

.tt-duty-number {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
}

.tt-duty-date {
    font-weight: 600;
}

.tt-duty-teacher {
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
}

.tt-duty-seniors {
    text-align: center;
}

.tt-duty-senior {
    font-weight: 600;
    text-transform: uppercase;
}

.tt-duty-sep {
    font-weight: 800;
    color: var(--text-secondary);
    margin: 2px 0;
}

.tt-duty-actions {
    white-space: nowrap;
    text-align: center;
}

.tt-duty-actions form,
.tt-duty-actions button {
    display: inline-block;
    vertical-align: middle;
}

/* Duty week form */
.tt-duty-form h4 {
    margin-bottom: 12px;
    color: var(--text-dark);
}

/* Print styles for timetables */
@media print {
    .tt-class-grid-wrapper,
    .tt-dept-grid-wrapper,
    .tt-exam-grid-wrapper,
    .tt-duty-wrapper {
        overflow: visible;
    }
    .tt-entry-actions,
    .tt-duty-actions,
    .tt-duty-form,
    .no-print {
        display: none !important;
    }
    .tt-class-grid,
    .tt-dept-grid,
    .tt-exam-grid,
    .tt-duty-table {
        font-size: 8pt;
    }
    .tt-class-grid th,
    .tt-class-grid td,
    .tt-dept-grid th,
    .tt-dept-grid td,
    .tt-exam-grid th,
    .tt-exam-grid td,
    .tt-duty-table th,
    .tt-duty-table td {
        padding: 4px 3px;
    }
}

/* ==================== VIEW MODE TABS ==================== */
.view-mode-tabs {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.04);
    border-radius: 12px;
    padding: 4px;
    width: fit-content;
}
.view-mode-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.view-mode-tab:hover {
    background: rgba(255,255,255,0.5);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--text-dark);
}
.view-mode-tab.active {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ==================== SUBJECT TABS (Booklet view) ==================== */
.subject-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: thin;
}
.subject-tabs::-webkit-scrollbar {
    height: 6px;
}
.subject-tabs::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}
.subject-tab {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    background: rgba(0,0,0,0.04);
    border: 1px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.subject-tab:hover {
    background: rgba(255,255,255,0.6);
    color: var(--text-dark);
    border-color: var(--glass-border);
}
.subject-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(74, 124, 66, 0.25);
}

/* ==================== BOOKLET RECORDING SHEET ==================== */
.booklet-sheet {
    padding: 0;
}
.booklet-header {
    text-align: center;
    padding: 24px 20px 16px;
    border-bottom: 2px solid var(--primary);
}
.booklet-header h2 {
    margin: 0 0 8px;
    font-size: 1.3rem;
    letter-spacing: 0.06em;
    color: var(--primary-dark);
}
.booklet-meta {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.booklet-meta strong {
    color: var(--text-dark);
}

/* Booklet table */
.booklet-table {
    font-size: 0.85rem;
    border-collapse: collapse;
    width: 100%;
}
.booklet-table th,
.booklet-table td {
    border: 1px solid rgba(0,0,0,0.15);
    padding: 6px 8px;
    white-space: nowrap;
}
.booklet-table thead th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: center;
    vertical-align: middle;
    padding: 8px 6px;
}
.booklet-th-name {
    text-align: left !important;
    min-width: 180px;
    background: var(--primary-dark) !important;
}
.booklet-th-group {
    background: var(--primary-light) !important;
    color: #fff;
}
.booklet-th-sub {
    background: #3d6a36 !important;
}
.booklet-th-a50, .booklet-th-b50 {
    background: #8b1a1a !important;
}
.booklet-th-exam {
    background: #4a5568 !important;
}
.booklet-th-total {
    background: #8b1a1a !important;
    min-width: 80px;
}
.booklet-th-pos {
    min-width: 70px;
    background: #2d4a28 !important;
}
.booklet-th-comp {
    background: var(--primary) !important;
    min-width: 60px;
}

/* Body cells */
.booklet-td-name {
    text-align: left;
    font-weight: 600;
    min-width: 180px;
}
.booklet-sid {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-secondary);
}
.booklet-td-score {
    min-width: 52px;
}
.booklet-td-sub {
    background: rgba(74, 124, 66, 0.06);
    font-weight: 600;
    min-width: 52px;
}
.booklet-td-red {
    background: rgba(139, 26, 26, 0.06);
    color: #8b1a1a;
    font-weight: 700;
    min-width: 52px;
}
.booklet-td-total {
    background: rgba(139, 26, 26, 0.10);
    color: #8b1a1a;
    font-weight: 800;
    font-size: 0.95rem;
    min-width: 70px;
}
.booklet-td-pos {
    background: rgba(74, 124, 66, 0.08);
    font-weight: 700;
    min-width: 70px;
}

/* Zebra striping */
.booklet-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.02);
}
.booklet-table tbody tr:hover {
    background: rgba(74, 124, 66, 0.06);
}

/* Print styles */
@media print {
    .no-print,
    .sidebar,
    .main-header,
    .view-mode-tabs,
    .subject-tabs,
    .card-header button {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    .main-body {
        padding: 0 !important;
    }
    .booklet-sheet {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    .booklet-sheet .card-body {
        display: none;
    }
    .booklet-table th,
    .booklet-table td {
        border: 1px solid #333 !important;
        padding: 4px 6px !important;
    }
    .booklet-table thead th {
        background: #333 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body {
        background: #fff !important;
    }
    body::before, body::after {
        display: none !important;
    }
}

/* ==================== ATTENDANCE BOOKLET ==================== */
.attendance-booklet-sheet {
    padding: 0;
}
.attendance-booklet-scroll {
    overflow-x: auto;
}
.attendance-booklet-table {
    font-size: 0.82rem;
    border-collapse: collapse;
    width: auto;
    min-width: 100%;
}
.attendance-booklet-table th,
.attendance-booklet-table td {
    border: 1px solid rgba(0,0,0,0.15);
    padding: 5px 6px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
.attendance-booklet-table thead th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.att-bth-num,
.att-btd-num {
    min-width: 32px;
    max-width: 40px;
    background: rgba(0,0,0,0.03);
}
.att-bth-adm,
.att-btd-adm {
    min-width: 100px;
}
.att-bth-name,
.att-btd-name {
    text-align: left !important;
    min-width: 180px;
    max-width: 240px;
}
.att-bth-dob,
.att-btd-dob {
    min-width: 90px;
}
.att-bth-week {
    background: var(--primary-dark) !important;
    border-left: 2px solid rgba(255,255,255,0.25);
}
.att-bth-day {
    min-width: 34px;
    padding: 6px 4px;
}
.att-day-num {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 1px;
}
.att-bth-week-total,
.att-btd-week-total,
.att-bth-total,
.att-btd-grand-total {
    min-width: 48px;
    background: rgba(74, 124, 66, 0.10);
    font-weight: 700;
    border-left: 2px solid rgba(0,0,0,0.15);
}
.att-btd-mark {
    min-width: 34px;
    font-weight: 600;
}
.att-mark-blank {
    display: inline-block;
    width: 8px;
}
.att-btd-name {
    font-weight: 600;
    padding-left: 10px;
}
.att-btd-adm {
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.att-totals-divider td {
    border-top: 2px solid rgba(0,0,0,0.25);
}
.att-totals-label {
    text-align: left !important;
    font-weight: 700;
    background: rgba(74, 124, 66, 0.08);
    padding-left: 10px;
}
.att-total-cell {
    font-weight: 700;
    background: rgba(74, 124, 66, 0.06);
}
.att-totals-bold td {
    font-weight: 800;
}
.att-totals-bold .att-totals-label {
    background: rgba(74, 124, 66, 0.12);
}
.attendance-booklet-table tbody tr:nth-child(even):not(.att-totals-divider):not(.att-totals-bold) {
    background: rgba(0,0,0,0.02);
}

@media print {
    .attendance-booklet-sheet {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }
    .attendance-booklet-table th,
    .attendance-booklet-table td {
        border: 1px solid #333 !important;
        padding: 3px 4px !important;
        font-size: 0.75rem !important;
    }
    .attendance-booklet-table thead th {
        background: #333 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .att-bth-week {
        background: #444 !important;
    }
    .att-btd-week-total,
    .att-btd-grand-total,
    .att-total-cell,
    .att-totals-label {
        background: rgba(74, 124, 66, 0.12) !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .attendance-booklet-scroll {
        overflow-x: visible !important;
    }
}

/* ==================== ALERTS ==================== */
.alert {
    padding: 16px 20px;
    padding-right: 44px; /* room for the dismiss button */
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

/* Dismiss button injected by JS into every alert. */
.alert-dismiss {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    opacity: 0.7;
}
.alert-dismiss:hover {
    background: rgba(0, 0, 0, 0.12);
    opacity: 1;
    transform: scale(1.1);
}

.alert-success {
    background: rgba(198, 246, 213, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--success);
    border-left: 4px solid var(--success);
}

.alert-warning {
    background: rgba(254, 235, 200, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}

.alert-error {
    background: rgba(254, 215, 215, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--error);
    border-left: 4px solid var(--error);
}

.alert-info {
    background: rgba(26, 54, 93, 0.08);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 40px 40px 60px;
    text-align: center;
    position: relative;
    margin-bottom: -40px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 2rem;
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.login-header h1 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.login-body {
    padding: 40px;
}

.login-footer {
    padding: 20px 40px;
    background: rgba(240, 247, 239, 0.6);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ==================== GRADE DISPLAY ==================== */
.grade-a-plus, .grade-a { color: var(--success); }
.grade-b-plus, .grade-b { color: var(--primary); }
.grade-c-plus, .grade-c { color: var(--accent); }
.grade-d { color: var(--warning); }
.grade-f { color: var(--error); }

/* ==================== UTILITIES ==================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Compact 2-column button grid used by the dashboard Quick Actions card. */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.quick-actions-grid .btn {
    justify-content: flex-start;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
}

.hidden { display: none !important; }

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.animate-slide-in {
    animation: slideIn 0.4s ease-in-out;
}

/* ==================== RESPONSIVE ==================== */
/* Mobile sidebar toggle (hamburger) + dimming overlay. Hidden on desktop. */
.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px 10px;
    margin-right: 8px;
    border-radius: var(--radius);
    line-height: 1;
}

.menu-toggle:hover {
    background: rgba(74, 124, 66, 0.1);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 1199px) {
    .sidebar {
        width: 80px;
    }
    
    .sidebar-header,
    .sidebar-nav li a span,
    .sidebar-footer {
        display: none;
    }
    
    .sidebar-nav li a {
        justify-content: center;
        padding: 14px;
    }
    
    .sidebar-nav li a i {
        margin: 0;
        font-size: 1.25rem;
    }
    
    .main-content {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: inline-flex;
        align-items: center;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-header,
    .sidebar-nav li a span,
    .sidebar-footer {
        display: block;
    }
    
    .sidebar-nav li a {
        justify-content: flex-start;
        padding: 12px 24px;
    }
    
    .sidebar-nav li a i {
        margin-right: 12px;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .main-header {
        padding: 12px 16px;
    }

    .main-header h1 {
        margin-right: auto;
        font-size: 1.25rem;
    }
    
    .main-body {
        padding: 16px;
    }
    
    .table th, .table td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: var(--transition);
}

.pagination a {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination span {
    background: var(--primary);
    color: white;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--background);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 2rem;
    color: var(--text-muted);
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ==================== LOADING ==================== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

/* ==================== LOGIN BACKGROUND ==================== */
/* The background is a smooth crossfade carousel of school photos — three
   building exteriors and three campus-life photos. The .login-bg-slider
   div sits behind everything; the ::before pseudo-element adds the green
   tint overlay on top of the photos for brand contrast and text legibility. */

.login-page {
    position: relative;
    min-height: 100vh;
}

/* Carousel container: fixed full-viewport, sits behind the overlay and card. */
.login-bg-slider {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

/* Each slide: full-viewport background image with a slow, subtle Ken Burns
   zoom. All slides start invisible; the animation cycles them in sequence.
   The cycle duration is set via the --cycle CSS variable on .login-bg-slider
   (30 s for 6 images at 5 s each). The animation-delay is set inline per
   slide by login.php.

   Keyframe percentages are tuned for 6 slides. Each slide is visible for
   5 s, with a 1.5 s crossfade that overlaps the next slide's fade-in so
   there is no dark gap between images. The Ken Burns zoom goes from 1.0
   to 1.06 over the visible period — slow enough to be felt, not seen. */
.login-bg-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.0);
    animation: loginBgCrossfade var(--cycle, 30s) ease-in-out infinite;
}

@keyframes loginBgCrossfade {
    0%      { opacity: 0; transform: scale(1.0); }
    5%      { opacity: 1; }                          /* 1.5 s — smooth fade-in  */
    16.67%  { opacity: 1; transform: scale(1.03); }  /* 5 s — crossfade begins  */
    21.67%  { opacity: 0; transform: scale(1.06); }  /* 6.5 s — crossfade ends  */
    100%    { opacity: 0; transform: scale(1.06); }
}

/* Respect users who prefer reduced motion: show the first image only. */
@media (prefers-reduced-motion: reduce) {
    .login-bg-slide {
        animation: none;
        opacity: 0;
    }
    .login-bg-slide:first-child {
        opacity: 1;
        transform: scale(1);
    }
}

/* Green tint overlay on top of the carousel images for brand contrast. */
.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(rgba(31, 111, 67, 0.45), rgba(31, 111, 67, 0.45));
    z-index: 1;
}

.login-container {
    position: relative;
    z-index: 2;
}

/* ==================== LOGO STYLES (school crest image) ==================== */
/* Shared logo mark: the official Royal Stars crest (images/4.jpeg). The path is
   relative to this stylesheet (css/), so ../images/4.jpeg resolves to the
   project-root image for every portal page regardless of its folder depth. */
.login-logo,
.sidebar-logo-icon,
.hub-brand-logo {
    position: relative;
    background: #ffffff url("../images/4.jpeg") center center / contain no-repeat;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    flex: 0 0 auto;
}

/* No CSS star glyph now that the real crest image is used. */
.login-logo::before,
.sidebar-logo-icon::before,
.hub-brand-logo::before {
    content: none;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
}

.login-logo span {
    display: none;
}

.sidebar-logo-icon {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
}

/* ==================== REPORT TABLE STYLES ==================== */
.report-table th,
.report-table td {
    text-align: center;
    vertical-align: middle;
    padding: 12px 8px;
}

.report-table th:first-child,
.report-table td:first-child {
    text-align: left;
    padding-left: 15px;
}

/* Print Styles */
@media print {
    .sidebar,
    .main-header,
    .card-header h3 .text-secondary,
    .btn,
    .alert {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        page-break-inside: avoid;
    }
    
    .table {
        font-size: 10pt;
    }
    
    .table th,
    .table td {
        padding: 6px 4px !important;
        border: 1px solid #ddd !important;
    }
    
    .badge {
        border: 1px solid #999 !important;
        background: white !important;
        color: black !important;
    }
}

/* ==================== PARENT PORTAL: PRINTING DISABLED ==================== */
/* Parents are view-only: block browser printing (Ctrl+P) on every parent page. */
@media print {
    body.no-print-page * {
        display: none !important;
    }
    body.no-print-page::before {
        content: "Printing is not available on the parent portal.";
        display: block !important;
        padding: 48px 24px;
        text-align: center;
        font-size: 16pt;
        color: #000;
    }
}

/* ==================== PORTAL HUB (full-screen card landing) ==================== */
.hub-body {
    min-height: 100vh;
    background-color: #f4f7f3;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(74,124,66,0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(214,158,46,0.07) 0%, transparent 45%),
        radial-gradient(ellipse at 40% 90%, rgba(74,124,66,0.06) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
}

.hub-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: linear-gradient(90deg, var(--primary-dark) 0%, var(--primary) 60%, var(--secondary) 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);
    position: relative;
    z-index: 2;
}

.hub-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hub-brand-logo {
    width: 44px;
    height: 44px;
}

.hub-brand-logo::before {
    font-size: 1.5rem;
}

.hub-brand-text h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    margin: 0;
    line-height: 1.1;
    color: #fff;
}

.hub-brand-text span {
    font-size: 0.8rem;
    opacity: 0.85;
    letter-spacing: 0.5px;
}

.hub-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hub-user .user-avatar {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.hub-user-name {
    font-weight: 600;
    line-height: 1.1;
}

.hub-user-role {
    font-size: 0.78rem;
    opacity: 0.85;
}

.hub-logout {
    color: #fff;
    opacity: 0.85;
    font-size: 1.1rem;
    padding: 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.hub-logout:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.hub-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 32px;
    position: relative;
    z-index: 1;
}

.hub-back-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    margin-bottom: 24px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.hub-back-card:hover {
    background: rgba(255, 255, 255, 0.80);
    transform: translateX(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    border-color: var(--primary-light);
}
.hub-back-card i {
    font-size: 1rem;
    color: var(--primary);
}

.hub-welcome {
    text-align: center;
    margin-bottom: 40px;
    /* Entrance animation (tiles stagger below). */
    opacity: 0;
    animation: hubCardIn 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.hub-welcome h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: var(--primary-dark);
    margin: 0 0 6px;
}

.hub-welcome p {
    color: var(--text-secondary);
    margin: 0;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.hub-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    padding: 28px 24px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05), 0 8px 24px rgba(0,0,0,0.04);
    transition: var(--transition);
    min-height: 170px;
    /* Staggered entrance: tiles pop in one by one with spring easing. */
    opacity: 0;
    animation: hubCardIn 0.52s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Hub card entrance — scale + rise with spring overshoot. */
@keyframes hubCardIn {
    from { opacity: 0; transform: scale(0.94) translateY(22px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.hub-tile:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08), 0 20px 40px rgba(0,0,0,0.06);
    border-color: var(--primary-light);
    background: rgba(255, 255, 255, 0.92);
}

.hub-tile-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
}

.hub-tile-body h3 {
    font-size: 1.25rem;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.hub-tile-body p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.45;
}

@media (max-width: 640px) {
    .hub-topbar { padding: 14px 18px; }
    .hub-main { padding: 32px 18px; }
    .hub-welcome h2 { font-size: 1.6rem; }
    .hub-user-info { display: none; }
    .hub-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
    .hub-tile { min-height: 150px; padding: 20px 16px; }
    .hub-tile-icon { width: 52px; height: 52px; font-size: 1.4rem; }
    .hub-tile-body h3 { font-size: 1.05rem; }
}

@media (max-width: 400px) {
    .hub-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Hub tile enhancements: bento hero, role-themed colours, badges, cross-portal
   ========================================================================== */
.hub-tile { position: relative; }

/* Bento hero tile — spans 2 columns, larger icon and padding. */
.hub-tile.hero {
    grid-column: span 2;
    min-height: 200px;
    padding: 36px 32px;
    background: rgba(255, 255, 255, 0.88);
}
.hub-tile.hero .hub-tile-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    font-size: 2.2rem;
}
.hub-tile.hero .hub-tile-body h3 { font-size: 1.6rem; }
.hub-tile.hero .hub-tile-body p { font-size: 1rem; }

/* Role-themed icon gradients (admin/bursar stay green — the default). */
body[data-role="teacher"] .hub-tile-icon {
    background: linear-gradient(135deg, #3b7bb8 0%, #5ba0d8 100%);
}
body[data-role="parent"] .hub-tile-icon {
    background: linear-gradient(135deg, #c89028 0%, #e8b54a 100%);
}
body[data-role="hod"] .hub-tile-icon {
    background: linear-gradient(135deg, #2a8a8a 0%, #4db8b8 100%);
}
body[data-role="headteacher"] .hub-tile-icon {
    background: linear-gradient(135deg, #6b4a8a 0%, #9a6abf 100%);
}

/* Cross-portal tile — slate gray icon to signal “not native to your role”. */
.hub-tile.cross-portal .hub-tile-icon {
    background: linear-gradient(135deg, #64748b 0%, #94a3b8 100%);
}

/* Badge pill in the top-right corner of a tile. */
.hub-tile-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    line-height: 1.4;
    white-space: nowrap;
}
.hub-tile-badge.role {
    background: var(--primary-light);
    color: #fff;
}
.hub-tile-badge.cross-portal {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

/* Mini stat pills (for hero tiles). */
.hub-tile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.hub-tile-stat {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 20px;
    background: rgba(74, 124, 66, 0.10);
    color: var(--primary-dark);
}

@media (max-width: 640px) {
    .hub-tile.hero { grid-column: span 2; min-height: 160px; padding: 24px 20px; }
    .hub-tile.hero .hub-tile-icon { width: 60px; height: 60px; font-size: 1.6rem; }
    .hub-tile.hero .hub-tile-body h3 { font-size: 1.25rem; }
    .hub-tile-badge { font-size: 0.62rem; padding: 2px 8px; }
}

@media (max-width: 400px) {
    .hub-tile.hero { grid-column: span 1; }
}

/* ==========================================================================
   Toggle switches (used for feature-access permissions in the user modal)
   ========================================================================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 27px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    margin: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #d2d8d2;
    border-radius: 27px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, .2);
    transition: background .35s cubic-bezier(.4, 0, .2, 1), box-shadow .35s ease;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 21px;
    width: 21px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
    transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), box-shadow .35s ease;
}
.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 55%, var(--primary-dark) 100%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12), 0 2px 10px rgba(74, 124, 66, .5);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(23px);
    box-shadow: 0 2px 7px rgba(0, 0, 0, .35);
}
.toggle-switch input:focus-visible + .toggle-slider {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.toggle-switch input:disabled + .toggle-slider {
    opacity: .55;
    cursor: not-allowed;
}

/* A single feature row: icon + label on the left, toggle on the right. */
.perm-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: normal;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .1s ease;
}
.perm-toggle:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
.perm-toggle:active {
    transform: scale(.99);
}
/* Flashy highlight when the feature is enabled. */
.perm-toggle:has(input:checked) {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(107, 155, 99, .12) 0%, rgba(74, 124, 66, .06) 100%);
}
.perm-toggle:has(input:checked) .perm-toggle-label i {
    color: var(--primary);
}
.perm-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}
.perm-toggle-label i {
    width: 18px;
    text-align: center;
    color: var(--text-secondary);
    transition: color .2s ease;
}

/* ---- Compact permission grid (sectioned checkbox list) ----
   A dense multi-column layout for the Feature Access screens: each column
   holds sections whose bold uppercase title is itself the "select all"
   checkbox for the plain checkboxes beneath it. */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 28px;
    align-items: start;
}
@media (max-width: 992px) {
    .perm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .perm-grid { grid-template-columns: 1fr; }
}
.perm-sec {
    margin-bottom: 22px;
    break-inside: avoid;
}
.perm-sec-title {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0 0 8px;
    font-weight: 700;
    font-size: 0.86rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
    cursor: pointer;
}
.perm-sec-title input {
    margin: 2px 0 0;
    flex-shrink: 0;
}
.perm-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0 0 6px;
    padding-left: 0;
    font-weight: normal;
    font-size: 0.86rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.35;
}
.perm-item input {
    margin: 2px 0 0;
    flex-shrink: 0;
}
.perm-item:has(input:checked) {
    color: var(--primary);
    font-weight: 600;
}
.perm-item input:disabled,
.perm-sec-title input:disabled {
    cursor: not-allowed;
}
.perm-item-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.perm-hint {
    font-size: 0.74rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.35;
}
.perm-item:has(input:checked) .perm-hint {
    color: var(--text-secondary);
}

/* ==================== GALLERY ==================== */
.badge-muted {
    background: rgba(113, 128, 150, 0.12);
    color: var(--text-secondary);
}

.gallery-toolbar {
    margin-bottom: 16px;
}

.gallery-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 4px 0;
}

.gallery-desc {
    color: var(--text-secondary);
    margin-top: 6px;
}

.gallery-desc-sm {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
}

.gallery-caption {
    font-weight: 600;
    color: var(--text-primary);
}

.gallery-album-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.gallery-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.gallery-form .form-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.gallery-form .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* Flashy gallery forms */
.gallery-form-flashy {
    position: relative;
    padding: 20px;
    border-radius: var(--radius);
    background:
        linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
        linear-gradient(135deg, var(--primary), var(--accent)) border-box;
    border: 1px solid transparent;
    box-shadow: var(--shadow);
}

.gallery-form-flashy::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.gallery-form-flashy .form-group {
    margin-bottom: 14px;
}

.gallery-form-flashy label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.gallery-form-flashy input[type="text"],
.gallery-form-flashy input[type="date"],
.gallery-form-flashy textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--background);
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.gallery-form-flashy input[type="text"]:focus,
.gallery-form-flashy input[type="date"]:focus,
.gallery-form-flashy textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--card-bg);
    box-shadow: 0 0 0 3px rgba(74, 124, 66, 0.15);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 560px) {
    .form-grid-2 { grid-template-columns: 1fr; }
}

/* Upload dropzone */
.gallery-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
    padding: 26px 18px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--background);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.gallery-dropzone:hover,
.gallery-dropzone.is-dragover {
    border-color: var(--primary);
    background: rgba(74, 124, 66, 0.05);
    box-shadow: 0 0 0 3px rgba(74, 124, 66, 0.1);
}

.gallery-dropzone > i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.gallery-dropzone-title {
    font-weight: 600;
    color: var(--text-primary);
}

.gallery-dropzone-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.gallery-dropzone-file {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    margin-top: 4px;
    word-break: break-all;
}

.gallery-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.empty-state > i {
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: block;
}

/* Album grid */
.gallery-album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.gallery-album-card {
    display: block;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.gallery-album-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.gallery-album-card.is-hidden {
    opacity: 0.6;
}

.gallery-album-cover {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--background);
    overflow: hidden;
}

.gallery-album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-album-cover-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.5rem;
    color: var(--text-muted);
}

.gallery-album-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.gallery-album-body {
    display: block;
    padding: 14px 16px;
}

.gallery-album-body h3 {
    font-size: 1.05rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Image grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.gallery-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.gallery-item.is-hidden {
    opacity: 0.6;
}

.gallery-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--background);
    overflow: hidden;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-zoomable {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.gallery-zoomable:hover {
    transform: scale(1.03);
}

/* Video thumbnails */
.gallery-thumb.is-video {
    background: #000;
}

.gallery-thumb.is-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.gallery-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    pointer-events: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.gallery-thumb.is-video:hover .gallery-play {
    background: var(--primary);
    transform: translate(-50%, -50%) scale(1.08);
}

.gallery-cover-flag {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.gallery-hidden-flag {
    position: absolute;
    top: 8px;
    right: 8px;
}

.gallery-website-flag {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: #2d7a2d;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.gallery-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
}

.gallery-check-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.gallery-item-body {
    padding: 12px 14px;
}

/* Lightbox */
.gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 30px;
}

.gallery-lightbox.open {
    display: flex;
}

.gallery-lightbox img {
    max-width: 92vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.gallery-lightbox video {
    max-width: 92vw;
    max-height: 82vh;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    background: #000;
}

.gallery-lightbox-caption {
    color: #fff;
    margin-top: 14px;
    font-size: 0.95rem;
    text-align: center;
    max-width: 80vw;
}

.gallery-lightbox-close {
    position: absolute;
    top: 18px;
    right: 26px;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
    user-select: none;
}

/* ==================== HOVER TIP (QTIP) ==================== */
.qtip {
    position: fixed;
    z-index: 3000;
    background: #2d3748;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.3;
    padding: 6px 10px;
    border-radius: 6px;
    max-width: 240px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    white-space: normal;
}

.qtip.qtip-show {
    opacity: 1;
    transform: translateY(0);
}

.qtip::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
}

.qtip.qtip-top::after {
    top: 100%;
    border-top-color: #2d3748;
}

.qtip.qtip-bottom::after {
    bottom: 100%;
    border-bottom-color: #2d3748;
}

/* ============================================
   TERMINAL REPORT - ONE-PAGE PRINT FIT
   Compacts the GES terminal report (.terminal-report / .tr-*) so the whole
   card prints on a single A4 page in every portal. The pre-school report
   (.ps-report) keeps its own print styles and is NOT affected.
   ============================================ */
@media print {
    @page {
        size: A4 portrait;
        margin: 8mm;
    }

    .terminal-report {
        max-width: 100% !important;
        padding: 10px 14px !important;
        margin: 0 !important;
        border-width: 1px !important;
        border-radius: 0 !important;
        page-break-inside: avoid;
    }

    .terminal-report .tr-head {
        padding-bottom: 6px !important;
        margin-bottom: 8px !important;
    }

    .terminal-report .tr-head h1 {
        font-size: 1.15rem !important;
    }

    .terminal-report .tr-head p {
        margin: 2px 0 0 !important;
        font-size: 0.8rem !important;
    }

    .terminal-report .tr-meta {
        gap: 2px 18px !important;
        margin-bottom: 8px !important;
        font-size: 0.74rem !important;
    }

    .terminal-report .tr-meta div {
        padding: 1px 0 !important;
    }

    .terminal-report .tr-meta strong {
        min-width: 105px !important;
    }

    .terminal-report .tr-table {
        margin-bottom: 8px !important;
        font-size: 0.7rem !important;
    }

    .terminal-report .tr-table th,
    .terminal-report .tr-table td {
        padding: 2px 4px !important;
    }

    .terminal-report .tr-foot {
        gap: 2px 18px !important;
        font-size: 0.72rem !important;
        margin-bottom: 8px !important;
    }

    .terminal-report .tr-foot div {
        padding: 2px 0 !important;
    }

    .terminal-report .tr-key {
        font-size: 0.62rem !important;
    }

    .terminal-report .tr-key th,
    .terminal-report .tr-key td {
        padding: 1px 4px !important;
    }

    .terminal-report .tr-sign {
        margin-top: 14px !important;
        font-size: 0.72rem !important;
    }

    .terminal-report .tr-sign div {
        padding-top: 3px !important;
    }
}

/* ==================== Attendance Status Pills ==================== */
/* Checkbox group styled as tick pills; the tick stays visible and the pill
   takes the status colour when selected. */
.att-status-boxes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
}

.att-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    padding: 6px 12px;
    border: 1.5px solid var(--gray-300, #cbd5e0);
    border-radius: 999px;
    background: var(--white, #fff);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600, #4a5568);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.att-pill:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.att-pill input.att-status-box {
    accent-color: currentColor;
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
}

/* Selected state, coloured per status */
.att-pill:has(input:checked) {
    color: var(--white, #fff);
}

.att-pill-present:has(input:checked) {
    background: var(--success);
    border-color: var(--success);
}

.att-pill-absent:has(input:checked) {
    background: var(--error);
    border-color: var(--error);
}

.att-pill-late:has(input:checked) {
    background: var(--warning);
    border-color: var(--warning);
}

.att-pill-excused:has(input:checked) {
    background: #3182ce;
    border-color: #3182ce;
}

.att-pill:has(input:checked) input.att-status-box {
    accent-color: rgba(255, 255, 255, 0.9);
}

/* JavaScript fallback — the attendance-marking script toggles this class
   on the label whenever a checkbox is checked/unchecked. This mirrors the
   :has(input:checked) rules above so the pill colour change works even in
   browsers that don't fully support :has() in this context. */
.att-pill.att-pill-active {
    color: var(--white, #fff);
}
.att-pill-present.att-pill-active {
    background: var(--success);
    border-color: var(--success);
}
.att-pill-absent.att-pill-active {
    background: var(--error);
    border-color: var(--error);
}
.att-pill-late.att-pill-active {
    background: var(--warning);
    border-color: var(--warning);
}
.att-pill-excused.att-pill-active {
    background: #3182ce;
    border-color: #3182ce;
}
.att-pill.att-pill-active input.att-status-box {
    accent-color: rgba(255, 255, 255, 0.9);
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    body::before,
    body::after { animation: none; }
    .hub-tile,
    .hub-welcome { animation: none; opacity: 1; }
    .main-body { animation: none; }
    .main-body.page-exit,
    .hub-main.page-exit { animation: none; }
}

/* ==================== PORTAL TOUR / ONBOARDING ==================== */
/* The guided tour overlay, spotlight, and tooltip card. The tour engine
   lives in js/main.js and highlights elements one at a time. */

/* Dark overlay with a transparent hole punched around the target element.
   Uses a massive box-shadow so the spotlight covers the whole viewport. */
.portal-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.portal-tour-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* The spotlight rectangle — positioned by JS over the target element. */
.portal-tour-spotlight {
    position: fixed;
    z-index: 100001;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    border: 3px solid var(--secondary, #c9a227);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
.portal-tour-spotlight::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    animation: tourPulse 1.5s ease-in-out infinite;
}
@keyframes tourPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* The tooltip card shown next to the spotlighted element. */
.portal-tour-tooltip {
    position: fixed;
    z-index: 100002;
    max-width: 360px;
    min-width: 280px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.portal-tour-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}
/* Arrow pointing toward the spotlighted element. */
.portal-tour-tooltip::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--primary, #1f6f43);
    transform: rotate(45deg);
}
.portal-tour-tooltip[data-placement="bottom"]::before {
    top: -7px;
    left: 50%;
    margin-left: -7px;
}
.portal-tour-tooltip[data-placement="top"]::before {
    bottom: -7px;
    left: 50%;
    margin-left: -7px;
}
.portal-tour-tooltip[data-placement="left"]::before {
    right: -7px;
    top: 50%;
    margin-top: -7px;
}
.portal-tour-tooltip[data-placement="right"]::before {
    left: -7px;
    top: 50%;
    margin-top: -7px;
}

.portal-tour-header {
    background: var(--primary, #1f6f43);
    color: #fff;
    padding: 14px 18px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.portal-tour-header i {
    font-size: 1.3rem;
}
.portal-tour-step {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0.8;
    white-space: nowrap;
}
.portal-tour-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.portal-tour-body {
    padding: 16px 18px;
    color: #374151;
    font-size: 0.92rem;
    line-height: 1.55;
}

.portal-tour-footer {
    padding: 0 18px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}
.portal-tour-skip {
    margin-right: auto;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}
.portal-tour-skip:hover {
    color: #6b7280;
    background: #f3f4f6;
}
.portal-tour-btn {
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.portal-tour-btn-prev {
    background: #e5e7eb;
    color: #374151;
}
.portal-tour-btn-prev:hover {
    background: #d1d5db;
}
.portal-tour-btn-next {
    background: var(--primary, #1f6f43);
    color: #fff;
}
.portal-tour-btn-next:hover {
    background: var(--primary-dark, #155032);
}
.portal-tour-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Progress dots at the bottom of the tooltip. */
.portal-tour-progress {
    display: flex;
    gap: 5px;
    padding: 0 18px 14px;
    justify-content: center;
}
.portal-tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.2s ease;
}
.portal-tour-dot.active {
    background: var(--primary, #1f6f43);
    width: 22px;
    border-radius: 4px;
}
.portal-tour-dot.done {
    background: var(--secondary, #c9a227);
}

/* ============================================================
   DARK THEME
   Toggled per user via <html data-theme="dark"> (cookie-backed,
   echoed server-side to avoid a flash). Light stays the default.
   ============================================================ */
html[data-theme="dark"] {
    color-scheme: dark;
    --background: #10151f;
    --card-bg: #1b2432;
    --text-primary: #e8edf5;
    --text-secondary: #a3b0c6;
    --text-muted: #71809a;
    --border: #2c3a52;
    --glass-bg: rgba(27, 36, 50, 0.60);
    --glass-bg-strong: rgba(27, 36, 50, 0.88);
    --glass-border: rgba(148, 163, 184, 0.16);
    --glass-border-hover: rgba(148, 163, 184, 0.32);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --success-light: rgba(56, 161, 105, 0.16);
    --warning-light: rgba(221, 107, 32, 0.16);
    --error-light: rgba(229, 62, 62, 0.16);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.45);
}

/* Dim the colourful ambient glows so dark mode stays easy on the eyes. */
html[data-theme="dark"] body {
    background-image:
        radial-gradient(ellipse at 5% 2%, rgba(74,124,66,0.14) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 0%, rgba(214,158,46,0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 40%, rgba(13,148,136,0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 95% 50%, rgba(124,58,237,0.10) 0%, transparent 42%),
        radial-gradient(ellipse at 15% 75%, rgba(244,114,182,0.06) 0%, transparent 48%),
        radial-gradient(ellipse at 60% 95%, rgba(59,130,246,0.08) 0%, transparent 45%);
}
html[data-theme="dark"] body::before {
    background: radial-gradient(circle, rgba(13,148,136,0.12) 0%, transparent 70%);
}
html[data-theme="dark"] body::after {
    background: radial-gradient(circle, rgba(124,58,237,0.10) 0%, transparent 70%);
}

/* Typography & links: lift colours for contrast on dark surfaces. */
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 { color: #9dc79b; }
html[data-theme="dark"] a { color: var(--primary-light); }
html[data-theme="dark"] .text-secondary { color: var(--text-secondary); }

/* Surfaces that hard-code light backgrounds. */
html[data-theme="dark"] .main-header {
    background: rgba(16, 21, 31, 0.72);
    border-bottom: 1px solid var(--glass-border);
}
html[data-theme="dark"] .card {
    background: var(--glass-bg-strong);
    border-color: var(--glass-border);
}
html[data-theme="dark"] .table th {
    background: rgba(255, 255, 255, 0.05);
}
html[data-theme="dark"] .broadsheet-detail .subj-group {
    background: rgba(255, 255, 255, 0.06);
    border-bottom-color: rgba(255, 255, 255, 0.15);
}
html[data-theme="dark"] .broadsheet-detail .sub-col.tot {
    background: rgba(253, 246, 236, 0.1);
}
html[data-theme="dark"] .broadsheet-detail .sub-col.grd {
    background: rgba(232, 245, 233, 0.1);
    color: #86efac;
}
html[data-theme="dark"] .broadsheet-detail td.sub-col.grd {
    color: #86efac;
}
html[data-theme="dark"] .table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.03);
}
html[data-theme="dark"] .table tbody tr:hover,
html[data-theme="dark"] .table tbody tr:nth-child(even):hover {
    background: rgba(107, 155, 99, 0.10);
}
html[data-theme="dark"] .hub-tile {
    background: var(--glass-bg-strong);
    border-color: var(--glass-border);
}
html[data-theme="dark"] .hub-tile:hover {
    background: rgba(35, 46, 66, 0.95);
}
html[data-theme="dark"] .loading-overlay { background: rgba(16, 21, 31, 0.85); }
html[data-theme="dark"] .portal-tour-tooltip { background: #1b2432; }
html[data-theme="dark"] .portal-tour-body { color: var(--text-primary); }
html[data-theme="dark"] .portal-tour-skip { color: var(--text-muted); }
html[data-theme="dark"] .portal-tour-skip:hover { color: var(--text-secondary); background: rgba(255,255,255,0.06); }
html[data-theme="dark"] .portal-tour-btn-prev { background: #2c3a52; color: var(--text-primary); }
html[data-theme="dark"] .portal-tour-btn-prev:hover { background: #3a4a66; }
html[data-theme="dark"] .portal-tour-dot { background: #3a4a66; }
html[data-theme="dark"] .toggle-slider { background: #3a465c; }
html[data-theme="dark"] .perm-toggle { background: rgba(255, 255, 255, 0.04); }
html[data-theme="dark"] .att-pill {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border-color: var(--glass-border-hover);
}
html[data-theme="dark"] .user-dropdown-toggle:hover { background: rgba(107, 155, 99, 0.12); }
html[data-theme="dark"] .user-dropdown-menu a:hover { background: rgba(107, 155, 99, 0.14); }

/* Hub pages carry an inline light photo backdrop; keep the image but dim it
   with a dark multiply blend so it stays visible without washing out text. */
html[data-theme="dark"] .hub-body {
    background-color: rgba(16, 21, 31, 0.72) !important;
    background-blend-mode: multiply;
}
html[data-theme="dark"] .hub-welcome h2 { color: #9dc79b; }

/* Alerts: dark translucent tints with light text. */
html[data-theme="dark"] .alert-success { background: rgba(56, 161, 105, 0.18); color: #9ae6b4; }
html[data-theme="dark"] .alert-warning { background: rgba(221, 107, 32, 0.18); color: #fbd38d; }
html[data-theme="dark"] .alert-error   { background: rgba(229, 62, 62, 0.18); color: #feb2b2; }
html[data-theme="dark"] .alert-info    { background: rgba(59, 130, 246, 0.15); color: #bfdbfe; }
html[data-theme="dark"] .alert-dismiss:hover { background: rgba(255, 255, 255, 0.12); }

/* Badges: keep the hue, lift the text. */
html[data-theme="dark"] .badge-primary { background: rgba(107, 155, 99, 0.18); color: #9dc79b; }
html[data-theme="dark"] .badge-success { color: #6ee7a8; }
html[data-theme="dark"] .badge-warning { color: #fbd38d; }
html[data-theme="dark"] .badge-danger  { color: #feb2b2; }

/* Support-center chat bubbles (inline page styles). */
html[data-theme="dark"] .chat-thread {
    background: rgba(0, 0, 0, 0.25);
    border-color: var(--glass-border);
}
html[data-theme="dark"] .chat-msg-user {
    background: rgba(42, 53, 74, 0.95);
    border-color: var(--glass-border);
}
html[data-theme="dark"] .chat-presence {
    background: rgba(27, 36, 50, 0.9);
    border-color: var(--glass-border);
    color: var(--text-secondary);
}
html[data-theme="dark"] .chat-typing { color: var(--text-secondary); }

/* ---------------- Theme toggle button ---------------- */
.theme-toggle { display: inline-flex; align-items: center; }
.theme-toggle-btn {
    display: flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border: none; border-radius: 50%;
    background: var(--background); color: var(--text-secondary);
    font-size: 1.05rem; cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}
.theme-toggle-btn:hover {
    color: var(--accent); transform: rotate(15deg) scale(1.06);
}
/* On hub pages and the login page the header is dark/imagery: use a glass chip. */
.hub-topbar .theme-toggle-btn,
.theme-toggle-floating .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.15); color: #fff; box-shadow: none;
}
.hub-topbar .theme-toggle-btn:hover,
.theme-toggle-floating .theme-toggle-btn:hover { background: rgba(255, 255, 255, 0.25); }
.theme-toggle-floating {
    position: fixed; top: 18px; right: 18px; z-index: 60;
}
@media print {
    .theme-toggle { display: none !important; }
}

/* ── Toast notifications (styled replacement for native alert()) ───── */
.toast-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(400px, calc(100vw - 36px));
    pointer-events: none;
}
.toast {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 38px 18px 16px;
    background: #1f2937;
    color: #f3f4f6;
    border-radius: 12px;
    border-left: 4px solid #6b7280;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
    font-size: 0.95rem;
    line-height: 1.45;
    pointer-events: auto;
    animation: toast-in 0.32s cubic-bezier(0.21, 1.02, 0.55, 1);
}
.toast-icon { font-size: 1.15rem; margin-top: 2px; flex-shrink: 0; }
.toast-body { flex: 1; word-break: break-word; }
.toast-close {
    position: absolute;
    top: 5px; right: 7px;
    background: none;
    border: 0;
    color: rgba(255, 255, 255, 0.55);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
}
.toast-close:hover { color: #fff; }
.toast-progress {
    position: absolute;
    left: 0; bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left;
    animation-name: toast-progress;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(28px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateX(34px); }
}
@keyframes toast-progress {
    from { transform: scaleX(1); }
    to   { transform: scaleX(0); }
}
.toast.toast-out { animation: toast-out 0.3s ease forwards; }

.toast-error   { border-left-color: #ef4444; }
.toast-error   .toast-icon     { color: #f87171; }
.toast-error   .toast-progress { background: #ef4444; }
.toast-warning { border-left-color: #f59e0b; }
.toast-warning .toast-icon     { color: #fbbf24; }
.toast-warning .toast-progress { background: #f59e0b; }
.toast-success { border-left-color: #10b981; }
.toast-success .toast-icon     { color: #34d399; }
.toast-success .toast-progress { background: #10b981; }
.toast-info    { border-left-color: #3b82f6; }
.toast-info    .toast-icon     { color: #60a5fa; }
.toast-info    .toast-progress { background: #3b82f6; }

html[data-theme="dark"] .toast {
    background: #28323f;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   DARK MODE FORM & DROPDOWN FIXES
   ============================================================ */

/* Form controls: make sure inputs/selects use the dark glass tokens
   and do not revert to hard-coded light hover/focus backgrounds. */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background: var(--glass-bg);
    color: var(--text-primary);
    border-color: var(--glass-border);
}

html[data-theme="dark"] .form-control:hover,
html[data-theme="dark"] .form-select:hover {
    background: var(--glass-bg-strong);
    border-color: var(--glass-border-hover);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    outline: none;
    background: var(--glass-bg-strong);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(107, 155, 99, 0.18), 0 2px 8px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .form-control::placeholder {
    color: var(--text-muted);
}

/* Dropdown menus were rendering with a white background and light text in
   some browsers. Force the dark card surface and light text so every option
   is readable. */
html[data-theme="dark"] .form-select option,
html[data-theme="dark"] select option,
html[data-theme="dark"] select optgroup {
    background: var(--card-bg);
    color: var(--text-primary);
}

html[data-theme="dark"] .form-select option:checked,
html[data-theme="dark"] select option:checked {
    background: var(--primary-dark);
    color: #ffffff;
}

/* ============================================================
   DARK MODE INLINE-STYLE RESCUE
   A lot of PHP pages still use hard-coded light-mode colours.
   The rules below lift those colours in dark mode without editing
   every inline style.
   ============================================================ */

/* Dark text colours -> light primary text */
html[data-theme="dark"] [style*="color:#2d3748"],
html[data-theme="dark"] [style*="color:#1a202c"],
html[data-theme="dark"] [style*="color:#000000"],
html[data-theme="dark"] [style*="color:#000;"],
html[data-theme="dark"] [style*="color:#333"],
html[data-theme="dark"] [style*="color:#4a5568"] {
    color: var(--text-primary) !important;
}

/* Muted grey text -> muted dark text */
html[data-theme="dark"] [style*="color:#718096"] {
    color: var(--text-secondary) !important;
}

/* Light alert/note surfaces: keep them readable on dark backgrounds */
html[data-theme="dark"] [style*="background:#fffbeb"] {
    background: rgba(251, 191, 36, 0.12) !important;
    border-color: rgba(251, 191, 36, 0.35) !important;
}
html[data-theme="dark"] [style*="background:#ebf8ff"] {
    background: rgba(59, 130, 246, 0.12) !important;
    border-color: rgba(59, 130, 246, 0.35) !important;
}
html[data-theme="dark"] [style*="background:#fdf2f8"] {
    background: rgba(236, 72, 153, 0.12) !important;
    border-color: rgba(236, 72, 153, 0.35) !important;
}
html[data-theme="dark"] [style*="color:#744210"],
html[data-theme="dark"] [style*="color:#2a4365"],
html[data-theme="dark"] [style*="color:#97266d"] {
    color: #e2e8f0 !important;
}

/* ============================================================
   GRADE ENTRY PICKER — subject chips + assessment type cards
   (shared by admin and teacher grade-entry pages)
   ============================================================ */
.ge-picker .ge-step { margin-bottom: 16px; }
.ge-picker .ge-step:last-child { margin-bottom: 0; }
.ge-step-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 9px;
}
.ge-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.68rem;
    flex: none;
}
.ge-step-context {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.78rem;
}

/* Subject chips (step 2) */
.ge-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ge-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 20px;
    background: var(--glass-bg-strong);
    border: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition);
}
.ge-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}
.ge-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.ge-chip-count {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 10px;
    background: rgba(74, 124, 66, 0.14);
    color: var(--primary-dark);
}
.ge-chip.active .ge-chip-count { background: rgba(255, 255, 255, 0.25); color: #fff; }
.ge-chip-count.ge-zero { background: rgba(160, 174, 192, 0.18); color: var(--text-secondary); }

/* Assessment type cards (step 3) */
.ge-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px;
}
.ge-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-height: 150px;
    padding: 15px 15px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.85);
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}
a.ge-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    color: var(--text-primary);
}
.ge-card-head { display: flex; align-items: center; gap: 10px; }
.ge-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: rgba(74, 124, 66, 0.12);
    color: var(--primary);
}
.ge-card-title { font-weight: 700; font-size: 0.95rem; line-height: 1.25; }
.ge-card-sub { font-size: 0.72rem; color: var(--text-secondary); }
.ge-card-titleline {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.35;
    min-height: 2.2em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ge-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.ge-card-meta i { margin-right: 3px; font-size: 0.72rem; }
.ge-card-state {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    font-weight: 700;
}
.ge-card-note { font-size: 0.72rem; color: var(--text-muted); }
.ge-card-actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.ge-card-mini {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: underline;
}
.ge-card-mini:hover { color: var(--primary); }

/* Open card: green accent, whole card is the link */
.ge-card-open { border-color: rgba(56, 161, 105, 0.35); cursor: pointer; }
.ge-card-open .ge-card-state { color: var(--success); }
.ge-card-current { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Locked card: greyed, lock badge in the corner */
.ge-card-locked {
    background: rgba(160, 174, 192, 0.08);
    opacity: 0.88;
    cursor: default;
}
.ge-card-locked .ge-card-icon { background: rgba(221, 107, 32, 0.14); color: var(--warning); }
.ge-card-locked .ge-card-state { color: var(--warning); }
.ge-lock-badge {
    position: absolute;
    top: 11px;
    right: 11px;
    color: var(--warning);
    font-size: 0.95rem;
}

/* Missing card: dashed placeholder */
.ge-card-missing {
    background: transparent;
    border: 1.5px dashed var(--border);
    opacity: 0.75;
}
.ge-card-missing .ge-card-icon { background: rgba(160, 174, 192, 0.14); color: var(--text-muted); }
.ge-card-missing .ge-card-state { color: var(--text-muted); }

@media (max-width: 640px) {
    .ge-cards { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
    .ge-card { min-height: 138px; padding: 12px 12px 11px; }
    .ge-card-icon { width: 32px; height: 32px; font-size: 0.9rem; }
    .ge-chips { gap: 6px; }
    .ge-chip { padding: 6px 12px; font-size: 0.85rem; }
}

/* Manage-mode cards: static divs with inline action buttons */
.ge-card-manage {
    cursor: default;
}
.ge-card-actions-manage {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.ge-card-actions-manage .btn {
    padding: 3px 8px;
    font-size: 0.7rem;
    border-radius: 5px;
    line-height: 1.3;
}
.ge-card-actions-manage .btn i {
    font-size: 0.65rem;
    margin-right: 2px;
}

/* Dark theme: glass surfaces like the rest of the portal */
html[data-theme="dark"] .ge-chip {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}
html[data-theme="dark"] .ge-chip:hover {
    border-color: var(--primary-light);
    color: #9dc79b;
}
html[data-theme="dark"] .ge-chip.active { background: var(--primary); color: #fff; }
html[data-theme="dark"] .ge-chip-count { background: rgba(107, 155, 99, 0.18); color: #9dc79b; }
html[data-theme="dark"] .ge-card {
    background: var(--glass-bg-strong);
    border-color: var(--glass-border);
}
html[data-theme="dark"] .ge-card-locked { background: rgba(255, 255, 255, 0.03); }
html[data-theme="dark"] .ge-card-missing { background: rgba(0, 0, 0, 0.15); }
html[data-theme="dark"] .ge-card-mini { color: var(--text-secondary); }
