:root {
    --primary-color: #6a0dad;
    --primary-dark: #4b0082;
    --primary-light: #f3e8ff;
    --text-dark: #1f2937;
    --bg-light: #f9fafb;
    --bg: #f4f6fb;
    --surface: #ffffff;
    --text: var(--text-dark);
    --muted: #6b7280;
    --primary: var(--primary-color);
    --border: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg-light);
    color: var(--text);
}

body.app-layout {
    background: linear-gradient(140deg, #f4f2ff 0%, #f8f9ff 55%, #f3f4f8 100%);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.app-sidebar {
    min-height: 100vh;
    border-right: 1px solid rgba(255, 255, 255, 0.25);
}

.app-main {
    display: grid;
    grid-template-rows: 72px 1fr auto;
    min-height: 100vh;
}

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.25rem;
    margin: 1rem 1rem 0;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.student-count-card {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    margin-left: 1rem;
    padding: 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.58);
    border-radius: 999px;
    border: 1px solid rgba(124, 58, 237, 0.16);
}

.student-count-card__icon-svg {
    width: 18px;
    height: 18px;
}

.brand-logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
}

.brand-text {
    display: grid;
    line-height: 1.1;
}

.brand-text small {
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    background: rgba(106, 13, 173, 0.1);
}

.user-chip strong {
    display: block;
    font-size: 0.82rem;
}

.user-chip small {
    color: var(--muted);
    font-size: 0.72rem;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: var(--primary-color);
    color: #fff;
}

.btn-logout {
    text-decoration: none;
    border-radius: 8px;
    padding: 0.45rem 0.85rem;
    color: #fff;
    background: rgba(106, 13, 173, 0.85);
}

.sidebar {
    grid-area: sidebar;
    background: rgba(106, 13, 173, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1rem;
    border-right: 1px solid var(--border);
    color: #ffffff;
}

.sidebar nav {
    display: grid;
    gap: 0.5rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 1rem;
    color: #ffffff;
}

.sidebar-brand small {
    display: block;
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.75rem;
}

.sidebar-logo {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    object-fit: cover;
}

.sidebar a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.sidebar a.active {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    border-radius: 8px;
}

.app-content {
    padding: 1rem;
}

.content {
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: 1.25rem;
}

h1, h2 {
    color: var(--text-dark);
}

h1 {
    border-left: 4px solid var(--primary-light);
    padding-left: 0.6rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(124, 58, 237, 0.16);
    border-radius: 18px;
    padding: 1.2rem;
    box-shadow: 0 24px 60px rgba(74, 10, 124, 0.08);
    backdrop-filter: blur(18px);
}

.glass-card {
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    box-shadow: 0 16px 40px rgba(74, 10, 124, 0.08);
}

.content,
.card,
.table-wrap {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.content {
    border-radius: 12px;
}

.footer {
    text-align: center;
    padding: 0.85rem;
    color: var(--muted);
}

.link-button,
button {
    border: 0;
    border-radius: 0.45rem;
    padding: 0.5rem 0.85rem;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

button:hover,
.link-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-glass {
    background: rgba(106, 13, 173, 0.85);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 4px 12px rgba(106, 13, 173, 0.3);
    transition: all 0.2s ease;
}

.btn-glass:hover {
    background: rgba(75, 0, 130, 0.95);
    transform: translateY(-1px);
}

button,
.link-button {
    background: rgba(106, 13, 173, 0.85);
    box-shadow: 0 4px 12px rgba(106, 13, 173, 0.3);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

/* MentorNova-style glass login (login.php only) */
body.auth-page--glass {
    position: relative;
    overflow-x: hidden;
    background: linear-gradient(145deg, #0f0518 0%, #1a0a2e 35%, #12081f 70%, #0a0612 100%);
    color: rgba(255, 255, 255, 0.92);
}

body.auth-page--glass::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(106, 13, 173, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(106, 13, 173, 0.07) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
    z-index: 0;
}

body.auth-page--glass::after {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(106, 13, 173, 0.35), transparent 55%);
    pointer-events: none;
    z-index: 0;
}

body.auth-page--glass main.auth-card.login-card {
    position: relative;
    z-index: 1;
}

.auth-card {
    width: min(420px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
}

.login-card.glass-card {
    width: min(420px, 100%);
    max-width: 420px;
    padding: 2rem 1.75rem 2.25rem;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.login-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo {
    display: block;
    margin: 0 auto 1rem;
    width: min(130px, 28vw);
    max-width: 140px;
    min-width: 110px;
    height: auto;
    object-fit: contain;
}

.no-save-logo {
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
}

.login-school {
    margin: 0 0 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(243, 232, 255, 0.85);
}

.login-title {
    margin: 0 0 0.5rem;
    padding: 0;
    border: none;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.login-subtitle {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: rgba(226, 232, 240, 0.78);
    max-width: 26rem;
    margin-left: auto;
    margin-right: auto;
}

.login-alert.alert {
    margin-top: 0;
    margin-bottom: 1rem;
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
}

.login-form {
    display: grid;
    gap: 1rem;
    margin-top: 0.25rem;
}

.login-field-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.65);
}

.mode-segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
    padding: 0.35rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mode-segment {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.mode-segment input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.mode-segment-text {
    display: block;
    width: 100%;
    text-align: center;
    padding: 0.55rem 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.75);
    border-radius: 8px;
    transition: inherit;
}

.mode-segment:hover .mode-segment-text {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.06);
}

.mode-segment.is-active .mode-segment-text,
.mode-segment:has(input:checked) .mode-segment-text {
    color: #ffffff;
    background: rgba(106, 13, 173, 0.65);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.login-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.88);
    margin-bottom: -0.5rem;
}

.login-input {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-input::placeholder {
    color: rgba(148, 163, 184, 0.7);
}

.login-input:focus {
    outline: none;
    border-color: rgba(167, 139, 250, 0.85);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(106, 13, 173, 0.35);
}

.login-submit.btn-glass {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.9rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
}

.auth-card.login-card .login-form {
    margin-top: 0.25rem;
}

.auth-card form {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.mode-group {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.auth-card input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem;
}

.alert {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    border-radius: 8px;
    padding: 0.6rem;
    margin: 0.75rem 0;
}

.success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    border-radius: 8px;
    padding: 0.6rem;
    margin: 0.75rem 0;
}

.input-full {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.95rem 1rem;
    margin-bottom: 0.9rem;
    min-height: 44px;
}

input,
select,
textarea {
    min-height: 44px;
}

textarea.input-full {
    resize: vertical;
    font-family: Arial, sans-serif;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
    align-items: end;
    margin: 1rem 0;
}

.search-form label {
    grid-column: 1 / -1;
}

.search-form input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem;
}

input,
select,
textarea {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 8px 10px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(106, 13, 173, 0.15);
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(17, 24, 39, 0.04);
}

.table-container {
    padding: 16px;
}

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

table {
    background: transparent;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.95rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
    min-width: 70px;
}

.data-table input[type="checkbox"] {
    width: 22px;
    height: 22px;
}

.data-table thead th {
    background: rgba(106, 13, 173, 0.1);
    font-size: 0.9rem;
}

.data-table tbody tr:hover {
    background: rgba(106, 13, 173, 0.05);
}

.th-link {
    color: inherit;
    text-decoration: none;
}

.th-link:hover {
    text-decoration: underline;
}

.header,
.app-topbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

@media (max-width: 860px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "topbar"
            "sidebar"
            "content"
            "footer";
    }

    .sidebar {
        padding-top: 0.5rem;
    }

    .search-form {
        grid-template-columns: 1fr;
    }
}

/* ===== APP BACKGROUND ===== */
body.app-layout {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #1a1235, #2b1a5a);
    color: #111;
}

/* ===== SHELL ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.app-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a1235, #2b1a5a);
    color: #fff;
    padding: 20px;
    box-shadow: 0 0 30px rgba(0,0,0,0.4);
}

/* ===== MAIN ===== */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ===== TOPBAR ===== */
.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* ===== USER CHIP ===== */
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #d32f2f;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* ===== CONTENT ===== */
.app-content {
    padding: 30px;
}

/* ===== CARD ===== */
.card {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    border-radius: 18px;
    padding: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 20px;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: #d32f2f;
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-right: 8px;
}

.btn-primary:hover {
    background: #b71c1c;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
}

.sidebar-menu li {
    margin: 10px 0;
}

.sidebar-menu a {
    display: block;
    padding: 12px 15px;
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.1);
}

.sidebar-menu a.active {
    background: rgba(255,255,255,0.22);
}

.page-hero {
    margin-bottom: 20px;
}

.page-subtitle {
    margin-top: 6px;
    color: #374151;
}

.actions-right {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.editor-page {
    display: grid;
    gap: 16px;
}

.editor-card {
    width: 100%;
}

.editor-toolbar-actions,
.editor-preview-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0;
}

.wide-editor {
    width: 100%;
    min-height: 650px;
}

.pagination-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(248, 244, 255, 0.92);
    border: 1px solid rgba(124, 58, 237, 0.16);
}

.pagination-summary {
    font-size: 0.95rem;
    color: #4b0082;
    min-width: 160px;
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.active-page {
    background: #6d28d9 !important;
    color: #fff !important;
    border-color: transparent !important;
}

@media (min-width: 1400px) {
    .wide-editor {
        min-height: 750px;
    }
}

.preview-frame-wrap {
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    background: rgba(255,255,255,0.92);
    padding: 16px;
}

.preview-frame {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    min-height: 220px;
}

.preview-banner {
    background: rgba(106, 13, 173, 0.15);
    border: 1px solid rgba(106, 13, 173, 0.3);
    border-radius: 10px;
    padding: 10px 12px;
    color: #3b0764;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ===== Premium Polish Layer ===== */
.app-content {
    animation: fadeInUp 0.28s ease;
}

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

.card {
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.84));
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 14px 34px rgba(8, 12, 26, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(8, 12, 26, 0.22);
}

.card-soft {
    background: rgba(255,255,255,0.78);
    box-shadow: 0 8px 22px rgba(8, 12, 26, 0.12);
}

.card-elevated {
    box-shadow: 0 22px 50px rgba(5, 10, 26, 0.3);
    border-color: rgba(255,255,255,0.78);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.1);
}

.page-hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(124, 58, 237, 0.16);
    border-radius: 18px;
    box-shadow: 0 24px 48px rgba(74, 10, 124, 0.08);
    backdrop-filter: blur(18px);
}

.page-hero__main {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.page-hero-icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: rgba(124, 58, 237, 0.12);
    color: var(--primary-dark);
    flex-shrink: 0;
}

.page-hero h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.05;
}

.page-hero .page-subtitle {
    margin: 8px 0 0;
    color: rgba(31, 41, 55, 0.68);
    max-width: 38rem;
}

.page-hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
}

.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger,
.btn-glass,
.link-button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    min-height: 44px;
    border-radius: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-icon,
.student-count-card__icon-svg {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.page-hero-icon svg {
    width: 22px;
    height: 22px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: #fff;
    border: 0;
}

.btn-secondary {
    background: rgba(255,255,255,0.45);
    color: #312e81;
    border: 1px solid rgba(124, 58, 237, 0.25);
}

.btn-outline {
    background: transparent;
    color: #4c1d95;
    border: 1px solid rgba(76, 29, 149, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #fff;
    border: 0;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-outline:hover,
.btn-danger:hover,
.btn-glass:hover,
.link-button:hover,
button:hover {
    transform: translateY(-1px) scale(1.01);
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.dashboard-stat-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    padding: 1rem 1.1rem;
    min-width: 240px;
}

.dashboard-stat-card .stat-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(124, 58, 237, 0.12);
    color: var(--primary-dark);
}

.sticky-selection-summary,
.editor-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(124, 58, 237, 0.16);
    box-shadow: 0 18px 40px rgba(74, 10, 124, 0.08);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 96px;
    z-index: 12;
    margin-bottom: 1rem;
}

.editor-preview-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pill-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
    font-weight: 700;
    font-size: 0.82rem;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.queue-summary-cards {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    margin-bottom: 12px;
}

.queue-summary-value {
    margin: 6px 0 0;
    font-size: 1.6rem;
    font-weight: 800;
    color: #4c1d95;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th,
.data-table td {
    padding: 0.82rem 0.9rem;
}

.data-table tbody tr:nth-child(even) {
    background: rgba(124, 58, 237, 0.04);
}

.data-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.09);
}

form label {
    margin-top: 4px;
    margin-bottom: 3px;
    font-weight: 600;
}

form small,
.field-help {
    display: block;
    margin-top: 4px;
    color: rgba(55, 65, 81, 0.75);
    font-size: 0.82rem;
}

.alert,
.success {
    border-width: 1px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

.editor-toolbar-actions.sticky-actions {
    position: sticky;
    top: 8px;
    z-index: 4;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.preview-frame-wrap {
    max-width: 960px;
    margin: 0 auto;
    background: linear-gradient(180deg, rgba(243,244,246,0.85), rgba(229,231,235,0.68));
}

.preview-frame {
    max-width: 860px;
    margin: 0 auto;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 10px 30px rgba(17,24,39,0.1);
}

.preview-mode-label {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.15);
    color: #4c1d95;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

@media (max-width: 980px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
    }

    .page-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .editor-toolbar-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-wrap {
        overflow-x: auto;
    }
}

/* Students page spacing + selection UX */
.app-shell {
    gap: 0;
}

.app-main {
    background: linear-gradient(135deg, #f8f5ff, #ffffff);
}

.app-content {
    padding: 24px;
}

.checkbox-col {
    width: 44px;
    text-align: center;
}

.checkbox-col input[type="checkbox"] {
    vertical-align: middle;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    padding: 6px;
}

.sidebar-title strong {
    display: block;
    font-size: 15px;
    color: #fff;
}

.sidebar-title small {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

.sidebar-logo:hover {
    transform: scale(1.05);
    transition: 0.2s ease;
}

/* MentorNova-like sidebar revision */
.app-sidebar {
    width: 260px;
    padding: 18px;
    background: linear-gradient(180deg, #111013 0%, #1b1028 52%, #241139 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 10px 30px rgba(0,0,0,0.45);
}

.sidebar {
    padding: 0;
    background: transparent;
    border-right: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.sidebar-brand {
    margin-bottom: 16px;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: contain;
    background: rgba(255,255,255,0.1);
    padding: 6px;
}

.sidebar-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 14px rgba(167, 139, 250, 0.35);
}

.sidebar-title strong {
    display: block;
    font-size: 15px;
    color: #fff;
    line-height: 1.2;
}

.sidebar-title small {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

.sidebar-section-label {
    margin: 10px 6px 8px;
    font-size: 11px;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: rgba(229, 231, 235, 0.55);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 8px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
    color: rgba(229, 231, 235, 0.88);
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.menu-initial {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(238, 242, 255, 0.92);
    background: rgba(255,255,255,0.09);
}

.sidebar-menu a:hover {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(167, 139, 250, 0.12));
    color: #fff;
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.62), rgba(99, 102, 241, 0.4));
    color: #fff;
    box-shadow: 0 8px 20px rgba(76, 29, 149, 0.36);
}

/* ===== Phillaw Nova visual system override ===== */
body.app-layout {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(124, 58, 237, 0.16), transparent 32%),
        radial-gradient(circle at top right, rgba(236, 72, 153, 0.1), transparent 30%),
        linear-gradient(135deg, #f8f5ff 0%, #ffffff 48%, #f3efff 100%);
    color: #1f2937;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
}

.app-sidebar {
    position: sticky;
    top: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 4%, rgba(255, 255, 255, 0.14), transparent 36%),
        linear-gradient(180deg, #150b28 0%, #1d1034 55%, #24123f 100%);
    border-right: 1px solid rgba(167, 139, 250, 0.2);
}

.sidebar-brand {
    border-radius: 16px;
    padding: 0.4rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-logo {
    border-radius: 12px;
}

.sidebar-menu a {
    min-height: 44px;
    border-radius: 14px;
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.76), rgba(99, 102, 241, 0.5));
    box-shadow: 0 12px 24px rgba(76, 29, 149, 0.36);
}

.menu-icon {
    width: 18px;
    height: 18px;
}

.app-main {
    background: transparent;
}

.app-topbar {
    margin: 1.1rem 1.2rem 0;
    border-radius: 20px;
    border: 1px solid rgba(124, 58, 237, 0.16);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 16px 36px rgba(76, 29, 149, 0.14);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.topbar-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 750;
    letter-spacing: -0.01em;
}

.student-count-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(124, 58, 237, 0.24);
}

.user-chip {
    border: 1px solid rgba(124, 58, 237, 0.18);
}

.btn-logout,
.btn-primary,
.btn-glass {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    box-shadow: 0 11px 24px rgba(76, 29, 149, 0.24);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.68);
    border: 1px solid rgba(124, 58, 237, 0.25);
    color: #4c1d95;
    box-shadow: 0 8px 20px rgba(76, 29, 149, 0.12);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.4);
    color: #4c1d95;
}

.app-content {
    padding: 1.2rem;
}

.content {
    width: min(1400px, 100%);
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.card,
.glass-card,
.table-wrap {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(124, 58, 237, 0.14);
    box-shadow: 0 18px 44px rgba(76, 29, 149, 0.11), 0 3px 12px rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.page-hero {
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, #7c3aed, #a855f7, #ec4899);
}

h1 {
    font-size: clamp(1.55rem, 2.6vw, 2rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    font-weight: 800;
}

.page-subtitle {
    color: #4b5563;
}

.data-table thead th {
    background: rgba(124, 58, 237, 0.12);
}

.data-table tbody tr:nth-child(even) {
    background: rgba(124, 58, 237, 0.04);
}

.data-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.09);
}

.sticky-selection-summary,
.editor-toolbar-actions,
.students-sticky-toolbar {
    top: 20px;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        min-height: auto;
        width: 100%;
    }

    .app-topbar {
        margin: 0.8rem;
    }

    .app-content {
        padding: 0.85rem;
    }

    .page-hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .sticky-selection-summary,
    .editor-toolbar-actions,
    .students-sticky-toolbar {
        position: static;
    }
}

/* ---- Public enrolment: Terms header (enrolment/terms.php) ---- */

.enrolment-terms-layout {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(140deg, #f4f2ff 0%, #f8f9ff 55%, #f3f4f8 100%);
    color: var(--text-dark);
}

.enrolment-terms-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.25rem clamp(1rem, 4vw, 1.75rem) 2.75rem;
}

.enrolment-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 10px 10px;
    margin-bottom: 1.35rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(124, 58, 237, 0.1);
    border-bottom: 1px solid #eee;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.95) inset,
        0 10px 32px rgba(88, 28, 135, 0.08);
}

.enrolment-logo {
    flex-shrink: 0;
    width: 70px;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
}

.enrolment-header-text {
    text-align: left;
    min-width: 0;
}

.enrolment-title {
    font-size: 20px;
    font-weight: 700;
    color: #000;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.enrolment-subtitle {
    font-size: 13px;
    color: #555;
    margin-top: 4px;
    line-height: 1.45;
}

.enrolment-document-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-top: 8px;
    line-height: 1.45;
}

.enrolment-terms-content {
    background: #fff;
    border-radius: 8px;
    border: 1px solid rgba(124, 58, 237, 0.1);
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.06);
    padding: 1.25rem clamp(1rem, 3vw, 1.65rem) 1.5rem;
}

.enrolment-terms-content__heading {
    margin: 0 0 0.75rem;
    font-size: 1.35rem;
}

.enrolment-terms-meta {
    margin: 1.25rem 0 0;
    color: var(--muted);
}

.terms-content hr.editor-line-separator,
.enrolment-terms-content__body hr.editor-line-separator {
    border: 0;
    border-top: 1px solid #999;
    margin: 24px 0;
}

@media (max-width: 768px) {
    .enrolment-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding-bottom: 20px;
    }

    .enrolment-header-text {
        text-align: center;
    }
}
