:root {
    --bg: #07111f;
    --bg-2: #0d1832;
    --surface: rgba(10, 17, 31, 0.72);
    --surface-strong: rgba(17, 27, 46, 0.9);
    --border: rgba(255, 255, 255, 0.14);
    --text: #f4f7ff;
    --muted: #92a4c2;
    --accent: #5ee7d0;
    --accent-2: #8b5cf6;
    --accent-3: #ff8a5b;
    --success: #5ed89f;
    --shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
    /* Native select popups are painted by the OS, so they need opaque colours. */
    --option-bg: #101b2f;
    --option-text: #f4f7ff;
    --option-active-bg: #1d6f66;
    --option-active-text: #ffffff;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(94, 231, 208, 0.18), transparent 24%),
        radial-gradient(circle at top right, rgba(139, 92, 246, 0.18), transparent 20%),
        linear-gradient(135deg, var(--bg), var(--bg-2));
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.15;
}

img {
    max-width: 100%;
    display: block;
}

.page-shell {
    min-height: 100vh;
    padding: 24px 20px 60px;
}

.topbar {
    max-width: 1240px;
    margin: 0 auto 30px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(5, 12, 24, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow);
    /*
     * The .reveal sections below use transform, which makes each one its own
     * stacking context painted after the header. Without an explicit z-index
     * here the open account/notification dropdowns render behind the page.
     */
    position: relative;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 20px rgba(94, 231, 208, 0.2);
}

.topnav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.topnav a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease, transform 0.3s ease;
}

.topnav a:hover {
    color: var(--text);
    transform: translateY(-2px);
}

.topnav a[aria-current="page"] {
    color: var(--accent);
}

/*
 * Grouped menu: "College" and "Mess" each open a small panel of their own
 * screens. <details> supplies the toggle; main.js adds the one-open-at-a-time,
 * outside-click and Escape behaviour shared with the account dropdowns.
 */
.nav-group {
    position: relative;
}

.nav-group > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    transition: color 0.3s ease;
}

.nav-group > summary::-webkit-details-marker {
    display: none;
}

.nav-group > summary:hover,
.nav-group[open] > summary {
    color: var(--text);
}

/* The group whose page is open reads the same as an active link. */
.nav-group > summary.is-current {
    color: var(--accent);
}

.nav-group-caret {
    font-size: 0.7em;
    transition: transform 0.25s ease;
}

.nav-group[open] .nav-group-caret {
    transform: rotate(180deg);
}

.nav-group-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 10px);
    z-index: 120;
    min-width: 190px;
    display: grid;
    gap: 2px;
    padding: 8px;
    border-radius: 14px;
    /* Opaque, not translucent: the panel overlaps page content. */
    background: #101b2f;
    border: 1px solid var(--border);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}

.nav-group-menu a {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 0.92rem;
    white-space: nowrap;
}

.nav-group-menu a:hover {
    background: rgba(255, 255, 255, 0.07);
    /* The parent rule lifts links on hover; inside a panel that just jitters. */
    transform: none;
}

.nav-group-menu a[aria-current="page"] {
    background: rgba(94, 231, 208, 0.14);
}

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
}

.user-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 0 3px rgba(94, 231, 208, 0.2);
}

.container {
    max-width: 1240px;
    margin: 0 auto;
}

.hero {
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr;
    align-items: start;
    margin-bottom: 20px;
}

.hero-card,
.card,
.metric-card,
.role-card,
.list-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-card {
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: '';
    position: absolute;
    inset: auto -40px -40px auto;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(94, 231, 208, 0.4), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.hero h1 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    line-height: 1.2;
    margin: 0 0 8px;
}

.hero p {
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.6;
    margin-bottom: 14px;
}

.button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #04111f;
    box-shadow: 0 12px 24px rgba(94, 231, 208, 0.18);
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border-color: var(--border);
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(94, 231, 208, 0.16);
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 700;
}

.demo-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.story-card {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
}

.story-card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.story-card p {
    margin: 0 0 10px;
    color: var(--muted);
    line-height: 1.6;
}

.support-list {
    display: grid;
    gap: 6px;
    font-size: 0.92rem;
    color: var(--muted);
}

.form-card {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
}

.form-card h3 {
    margin-top: 0;
}

.hero-side {
    padding: 24px;
}

.hero-stack {
    display: grid;
    gap: 16px;
}

.feature-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.06);
    color: var(--muted);
}

.feature-chip strong {
    color: var(--text);
    display: block;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 36px 0 18px;
}

.section-title h2 {
    margin: 0;
    font-size: 1.3rem;
}

.section-title a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.grid-3,
.role-grid,
.dashboard-grid,
.stat-grid {
    display: grid;
    gap: 18px;
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-grid {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
}

.dashboard-shell {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
    align-items: start;
}

.dashboard-main,
.dashboard-sidebar {
    display: grid;
    gap: 16px;
}

.sidebar-card {
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

.sidebar-card h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.status-list {
    display: grid;
    gap: 10px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: var(--muted);
    font-size: 0.95rem;
}

.status-row:last-child {
    border-bottom: 0;
}

.status-success,
.status-warn,
.status-info {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.status-success {
    background: rgba(94, 231, 208, 0.18);
    color: var(--accent);
}

.status-warn {
    background: rgba(255, 138, 91, 0.18);
    color: var(--accent-3);
}

.status-info {
    background: rgba(139, 92, 246, 0.18);
    color: #cab5ff;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.activity-list li {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: var(--muted);
    font-size: 0.94rem;
}

.activity-list li:last-child {
    border-bottom: 0;
}

.activity-list strong {
    color: var(--text);
}

.quick-links {
    display: grid;
    gap: 8px;
}

.quick-links a {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.role-card,
.metric-card,
.list-card,
.panel {
    padding: 22px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.role-card:hover,
.metric-card:hover,
.list-card:hover,
.panel:hover {
    transform: translateY(-4px);
    border-color: rgba(94, 231, 208, 0.4);
}

.role-card h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.role-card p,
.metric-card p,
.list-card p,
.panel p {
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

.role-card ul {
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.7;
}

.metric-card .value {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 4px 0 6px;
}

.metric-card .delta {
    color: var(--accent);
    font-weight: 600;
}

.list-card .list-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.list-card .list-item:last-child {
    border-bottom: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(255,255,255,0.08);
    color: var(--text);
}

.progress-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.timeline {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.timeline-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
}

.timeline-item .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex: 0 0 auto;
    background: linear-gradient(135deg, var(--accent), var(--accent-3));
    box-shadow: 0 0 0 3px rgba(94, 231, 208, 0.2);
}

.timeline-item strong {
    display: block;
    margin-bottom: 4px;
}

.list-card h3,
.panel h3 {
    margin: 0 0 10px;
    font-size: 1.1rem;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-group label {
    font-size: 0.95rem;
    color: var(--muted);
    font-weight: 600;
}

.required-mark {
    color: var(--accent-3);
    margin-left: 2px;
}

.field-optional {
    font-weight: 500;
    opacity: 0.75;
}

/*
 * A validation message, printed by Html::fieldError() directly beneath the
 * input it belongs to rather than collected into one banner at the top — the
 * user should not have to work out which field a complaint refers to.
 */
.field-error {
    color: #ffb37a;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
}

.field-error::before {
    content: '⚠ ';
}

/* The matching state on the control itself, so the pair reads as one unit. */
.field-group input[aria-invalid="true"],
.field-group select[aria-invalid="true"],
.field-group textarea[aria-invalid="true"] {
    border-color: rgba(255, 138, 91, 0.65);
    background: rgba(255, 138, 91, 0.10);
}

.field-group input[aria-invalid="true"]:focus,
.field-group select[aria-invalid="true"]:focus,
.field-group textarea[aria-invalid="true"]:focus {
    outline: 2px solid rgba(255, 138, 91, 0.35);
    border-color: rgba(255, 138, 91, 0.75);
}

/* Spacing for a banner that sits directly under the page hero. */
.alert-top {
    margin-top: 16px;
}

.field-group input,
.field-group select,
.field-group textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.08);
    color: var(--text);
    font: inherit;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.field-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: rgba(255,255,255,0.08);
    background-image: linear-gradient(45deg, transparent 50%, rgba(255,255,255,0.8) 50%),
                      linear-gradient(135deg, rgba(255,255,255,0.8) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 14px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 40px;
    color: var(--text);
    border-color: rgba(255,255,255,0.18);
}

.field-group select:hover {
    background-color: rgba(255,255,255,0.14);
}

.field-group select::-ms-expand {
    display: none;
}

/*
 * The open dropdown list is drawn by the browser/OS, which ignores translucent
 * colours and inherited text colour. Options therefore need fully opaque
 * background/foreground pairs, and the highlighted row needs the inset
 * box-shadow fallback because Chrome ignores background-color on :checked.
 */
select option,
.field-group select option {
    background-color: var(--option-bg);
    color: var(--option-text);
}

select option:hover,
select option:focus,
select option:checked,
select option[selected],
.field-group select option:hover,
.field-group select option:focus,
.field-group select option:checked,
.field-group select option[selected] {
    background-color: var(--option-active-bg);
    color: var(--option-active-text);
    box-shadow: 0 0 0 100px var(--option-active-bg) inset;
}

select option:disabled {
    color: var(--muted);
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: 2px solid rgba(94, 231, 208, 0.25);
    border-color: rgba(94, 231, 208, 0.45);
    background-color: rgba(255,255,255,0.12);
}

.table-wrap {
    overflow-x: auto;
}

.table-wrap table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.table-wrap th,
.table-wrap td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.table-empty {
    text-align: center;
    padding: 18px 10px;
    color: var(--muted);
}

.row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-action:hover {
    transform: translateY(-1px);
}

.btn-edit:hover {
    background: rgba(94, 231, 208, 0.16);
    border-color: rgba(94, 231, 208, 0.45);
    color: var(--accent);
}

.btn-delete:hover {
    background: rgba(255, 138, 91, 0.16);
    border-color: rgba(255, 138, 91, 0.45);
    color: var(--accent-3);
}

.btn-action:focus-visible {
    outline: 2px solid rgba(94, 231, 208, 0.5);
    outline-offset: 2px;
}

.row-actions-note {
    color: var(--muted);
    font-size: 0.84rem;
}

/* Dining hall chooser ------------------------------------------------------ */

.hall-choices {
    display: grid;
    gap: 16px;
    margin-top: 18px;
}

.hall-group {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px 16px;
    margin: 0;
}

.hall-group legend {
    padding: 0 8px;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.95rem;
}

.hall-option {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid transparent;
    background: rgba(255,255,255,0.04);
    margin-top: 8px;
    cursor: pointer;
}

.hall-option:hover {
    background: rgba(255,255,255,0.08);
}

.hall-option.is-selected,
.hall-option:has(input:checked) {
    border-color: rgba(94, 231, 208, 0.45);
    background: rgba(94, 231, 208, 0.1);
}

.hall-option input {
    margin-top: 4px;
    width: auto;
    accent-color: var(--accent);
    flex: 0 0 auto;
}

.hall-option-body {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.hall-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.hall-notes {
    color: var(--muted);
    font-size: 0.88rem;
}

.alert-warning {
    background: rgba(255, 138, 91, 0.12);
    border-color: rgba(255, 138, 91, 0.3);
    color: #ffc79a;
}

.badge-paid {
    background: rgba(94, 231, 208, 0.18);
    color: var(--accent);
}

.badge-unpaid {
    background: rgba(255, 138, 91, 0.18);
    color: var(--accent-3);
}

.cell-mono {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.86rem;
}

.settings-note {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    color: var(--muted);
    font-size: 0.9rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

.checkbox-label input {
    width: auto;
    accent-color: var(--accent);
}

/* Filter tabs -------------------------------------------------------------- */

.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.filter-tab {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.filter-tab.is-active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent;
    color: #04111f;
}

/* Account and notification menus ------------------------------------------- */

.topbar-account {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-menu,
.account-menu {
    position: relative;
}

.notification-menu summary,
.account-menu summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.notification-menu summary::-webkit-details-marker,
.account-menu summary::-webkit-details-marker {
    display: none;
}

.notification-menu summary {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent-3);
    color: #1b0d05;
    font-size: 0.7rem;
    font-weight: 800;
    display: grid;
    place-items: center;
}

.account-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-dropdown,
.account-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 120;
    min-width: 260px;
    max-width: min(320px, calc(100vw - 32px));
    padding: 12px;
    border-radius: 16px;
    /* Opaque, not translucent: the dropdown overlaps page content. */
    background: #101b2f;
    border: 1px solid var(--border);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}

.topbar-account details[open] > summary {
    background: rgba(94, 231, 208, 0.16);
    border-color: rgba(94, 231, 208, 0.4);
}

.notification-dropdown-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.notification-dropdown-head a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.86rem;
}

.notification-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 4px;
    max-height: 320px;
    overflow-y: auto;
}

.notification-dropdown li a {
    display: grid;
    gap: 2px;
    padding: 8px;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.86rem;
}

.notification-dropdown li a strong {
    color: var(--text);
}

.notification-dropdown li.is-unread a {
    background: rgba(94, 231, 208, 0.1);
}

.notification-dropdown li a:hover {
    background: rgba(255,255,255,0.07);
}

.notification-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.account-dropdown {
    display: grid;
    gap: 6px;
}

.account-role {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.account-email {
    color: var(--muted);
    font-size: 0.85rem;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    word-break: break-all;
}

.account-dropdown a {
    padding: 8px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.account-dropdown a:hover {
    background: rgba(255,255,255,0.07);
}

.account-signout {
    color: var(--accent-3) !important;
}

/* Notification list -------------------------------------------------------- */

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.notification-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    flex-wrap: wrap;
}

.notification-item.is-unread {
    border-color: rgba(94, 231, 208, 0.35);
    background: rgba(94, 231, 208, 0.08);
}

.notification-icon {
    font-size: 1.2rem;
    line-height: 1.4;
}

.notification-body {
    flex: 1 1 240px;
    min-width: 0;
}

.notification-body p {
    margin: 4px 0 6px;
    color: var(--muted);
    line-height: 1.5;
}

.notification-meta {
    color: var(--muted);
    font-size: 0.82rem;
}

.notification-meta a {
    color: var(--accent);
}

/* Visible to screen readers only — used for table captions and search labels. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.alert {
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    line-height: 1.5;
}

.alert-error {
    background: rgba(255, 138, 91, 0.14);
    border-color: rgba(255, 138, 91, 0.35);
    color: #ffb37a;
}

.alert-success {
    background: rgba(94, 231, 208, 0.14);
    border-color: rgba(94, 231, 208, 0.35);
    color: var(--accent);
}

.table-search {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.table-search input {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background-color: rgba(255,255,255,0.08);
    color: var(--text);
    font: inherit;
    min-width: 0;
    flex: 1 1 200px;
}

.table-search input:focus {
    outline: 2px solid rgba(94, 231, 208, 0.25);
    border-color: rgba(94, 231, 208, 0.45);
}

.user-signout {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    margin-left: 4px;
}

.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.pagination span[aria-disabled="true"] {
    opacity: 0.4;
}

.pagination-summary {
    border: 0;
    color: var(--muted);
    font-size: 0.88rem;
    min-width: 0;
    padding-left: 6px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text);
    text-decoration: none;
    font-size: 0.92rem;
}

.pagination .active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #04111f;
    border-color: transparent;
    font-weight: 700;
}

.table-wrap th {
    color: var(--accent);
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.site-footer {
    max-width: 1240px;
    margin: 0 auto;
    padding: 20px 0 10px;
    text-align: center;
    color: var(--muted);
    font-size: 0.95rem;
}

.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/*
 * A list panel that is fetching its next page. Dimming it marks the wait and
 * blocking pointer events stops a second request queueing behind the first.
 * Declared after .reveal.is-visible so it wins on a panel that is both.
 */
[data-ajax-table].is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

@media (max-width: 980px) {
    .hero,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .grid-3,
    .role-grid,
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .page-shell {
        padding: 18px 14px 45px;
    }

    .topbar {
        border-radius: 24px;
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .user-pill {
        width: 100%;
        justify-content: flex-start;
    }

    /* Stacked header: anchor the dropdowns to the bar itself so they cannot
       hang off the edge of a narrow screen. */
    .topbar-account {
        width: 100%;
        justify-content: space-between;
    }

    /*
     * The nav wraps to full width here, so a floating panel would sit over the
     * links beneath it. Let the group expand in place instead — the menu simply
     * pushes the rest of the nav down, which is what there is room for.
     */
    .topnav {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .nav-group,
    .nav-group > summary {
        width: 100%;
    }

    .nav-group > summary {
        justify-content: space-between;
    }

    .nav-group-menu {
        position: static;
        margin-top: 8px;
        box-shadow: none;
    }

    .notification-menu,
    .account-menu {
        position: static;
    }

    .notification-dropdown,
    .account-dropdown {
        left: 14px;
        right: 14px;
        max-width: none;
        min-width: 0;
    }

    .account-name {
        max-width: 45vw;
    }

    .topnav {
        gap: 10px;
    }

    .hero-card,
    .hero-side,
    .role-card,
    .metric-card,
    .list-card,
    .panel,
    .sidebar-card {
        padding: 18px;
    }

    .grid-3,
    .role-grid,
    .stat-grid,
    .dashboard-shell {
        grid-template-columns: 1fr;
    }

    .section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
