:root {
    /* Unified BulSU palette: maroon, gold, and quiet neutrals */
    --primary: #8B1022;
    --primary-alpha: rgba(139, 16, 34, 0.1);
    --primary-700: #5F101F;
    --primary-900: #25060C;
    --secondary: #C99212;
    --secondary-alpha: rgba(201, 146, 18, 0.12);
    --accent: #F5F7FB;
    --highlight: #EEF1F6;
    --background: #F6F7F9;
    --surface: rgba(255, 255, 255, 0.96);
    --surface-solid: #FFFFFF;
    --text: #1F2026;
    --muted: #646772;
    --border: #E1E5EC;
    --border-strong: #C9D0DB;
    --danger: #B42335;
    --danger-bg: #FFF1F3;
    --warning: #94620D;
    --warning-bg: #FFF7E6;
    --success: #526A42;
    --success-bg: #F1F6EA;
    --info: #5F101F;
    --info-bg: #F4F6FA;
    --shadow: 0 24px 60px rgba(37, 6, 12, 0.13);
    --shadow-soft: 0 14px 34px rgba(37, 6, 12, 0.08);
    --sidebar-width: 280px;
    --topbar-height: 76px;
}

/* Sidebar locked full viewport height */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 241, 246, 0.94)), var(--surface-solid);
}

/* Sidebar nav scrolls internally, footer stays pinned */
.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 18px 14px 1.5rem;
}

.sidebar-footer {
    margin-top: auto;
}

/* Main right-hand content scrolls independently */
.app-main {
    position: relative;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding-top: var(--topbar-height);
    padding-bottom: 4rem;
    overflow-y: auto;
}

/* Header items aligned exactly along same horizontal line */
.site-header,
.site-header > * {
    display: flex;
    align-items: center;
}

.site-header {
    align-items: center;
    padding: 18px 32px;
}

/* Stronger active sidebar typography contrast */
.app-sidebar .sidebar-link.active,
.app-sidebar .sidebar-link.active .icon,
.app-sidebar .sidebar-link.active svg,
.app-sidebar .sidebar-link.active .sidebar-link-label {
    color: var(--primary-900) !important;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body.app-body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(244, 232, 238, 0.86), transparent 34%),
        linear-gradient(135deg, rgba(255, 253, 251, 0.98), rgba(248, 251, 250, 0.96) 46%, rgba(223, 234, 226, 0.54)),
        var(--background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-700);
}

.hidden {
    display: none !important;
}

.icon {
    flex: 0 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 76px;
    padding: 16px 32px;
    background: rgba(255, 255, 255, 0.78);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}

body.guest-body .site-header {
    display: none !important;
}

body.guest-body .flash-stack {
    margin-top: 0;
}

.guest-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-lockup,
.topbar-title {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand-lockup strong {
    display: block;
    color: var(--text);
    font-weight: 800;
    line-height: 1.1;
}

.brand-lockup small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.1;
}

.sidebar-brand {
    padding: 16px 18px;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    background: var(--surface-solid);
    border: 1px solid rgba(31, 32, 38, 0.12);
    border-radius: 14px;
    box-shadow: none;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
    background: var(--surface-solid);
    border-radius: 12px;
}

.brand-lockup strong {
    display: block;
    color: var(--text);
    font-weight: 800;
    font-size: 0.98rem;
    line-height: 1.08;
    letter-spacing: 0.02em;
}

.brand-lockup small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-mark-sm {
    width: 36px;
    height: 36px;
    font-size: 0.78rem;
}

.app-sidebar .brand-lockup strong,
.app-sidebar .brand-lockup small {
    color: var(--text);
}

.app-sidebar .brand-lockup small {
    color: var(--muted);
}

.sidebar-nav {
    display: grid;
    flex: 1 1 auto;
    gap: 6px;
    padding: 18px 14px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    color: var(--muted);
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    font: inherit;
    font-weight: 650;
    text-align: left;
    text-decoration: none;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--primary-900);
    background: rgba(216, 180, 199, 0.26);
    transform: translateX(2px);
}

.sidebar-link.active {
    box-shadow: inset 3px 0 0 var(--secondary);
}

.app-sidebar .sidebar-link.active,
.app-sidebar .sidebar-link.active .icon,
.app-sidebar .sidebar-link.active svg,
.app-sidebar .sidebar-link.active .sidebar-link-label {
    color: var(--primary-900) !important;
    fill: currentColor !important;
}

.sidebar-footer {
    display: grid;
    gap: 12px;
    margin-top: auto;
    padding: 16px 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: var(--text);
    background: rgba(245, 247, 251, 0.9);
    border-radius: var(--radius);
}

.sidebar-profile strong,
.sidebar-profile small {
    display: block;
}

.sidebar-profile small {
    color: var(--muted);
    font-size: 0.78rem;
}

.logout-link {
    cursor: pointer;
}

.app-main {
    position: relative;
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--topbar-height) + 20px);
    padding-bottom: 10rem;
    overflow-y: auto;
}

.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    min-height: var(--topbar-height);
    padding: 7px 24px;
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid rgba(234, 215, 223, 0.86);
    backdrop-filter: blur(18px);
}

.topbar > * {
    display: flex;
    align-items: center;
}

.topbar-title {
    font-weight: 800;
}

.university-masthead {
    justify-self: start;
    width: min(100%, 430px);
    height: 40px;
    gap: 10px;
}

.university-seal {
    flex: 0 0 auto;
    display: block;
    width: 34px !important;
    height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    object-fit: contain;
    background: #fff;
    border: 1px solid rgba(205, 185, 196, 0.7);
    border-radius: 50%;
}

.university-seal-fallback {
    display: inline-grid;
    place-items: center;
    color: #fff;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.5), transparent 26%),
        linear-gradient(135deg, var(--primary), var(--secondary));
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.88rem;
    font-weight: 900;
}

.university-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.university-copy strong,
.university-copy small {
    overflow: hidden;
    line-height: 1;
    letter-spacing: 0;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.university-copy strong {
    color: var(--text);
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 1.1rem;
    font-weight: 700;
}

.university-copy small {
    color: var(--primary);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 0.7rem;
    font-style: italic;
    font-weight: 850;
}

.topbar-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 14px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: 0;
    z-index: 90;
    display: none;
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.search-suggestions.show {
    display: grid;
    gap: 6px;
}

.suggestion-item {
    display: grid;
    gap: 3px;
    padding: 10px;
    color: var(--text);
    border-radius: var(--radius);
}

.suggestion-item:hover {
    background: var(--accent);
}

.suggestion-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-item span {
    color: var(--muted);
    font-size: 0.82rem;
}

.topbar-search input {
    min-height: 42px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.icon-button,
.profile-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
    cursor: pointer;
}

.icon-button {
    width: 44px;
    padding: 0;
}

.profile-button {
    padding: 6px 10px 6px 6px;
}

.icon-button:hover,
.profile-button:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.sidebar-toggle {
    display: none;
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--primary-900);
    background: var(--accent);
    border: 1px solid rgba(216, 180, 199, 0.32);
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 900;
}

.avatar-image {
    display: inline-block;
    object-fit: cover;
    overflow: hidden;
}

.avatar-sm {
    width: 34px;
    height: 34px;
    color: var(--primary-900);
    background: var(--accent);
}

.profile-copy {
    display: grid;
    line-height: 1.1;
    text-align: left;
}

.profile-copy strong {
    max-width: 150px;
    overflow: hidden;
    color: var(--text);
    font-size: 0.88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-copy small {
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 800;
}

.notification-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    color: #fff;
    background: var(--danger);
    border: 2px solid #fff;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 14px;
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 70;
    display: none !important;
    min-width: 280px;
    max-width: calc(100vw - 32px);
    padding: 8px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.dropdown-menu.show {
    display: block !important;
}

.dropdown-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 10px 8px;
}

.dropdown-heading span {
    color: var(--muted);
    font-size: 0.8rem;
}

.dropdown-heading .link-button {
    font-size: 0.78rem;
}

.notification-menu {
    width: min(380px, calc(100vw - 32px));
    display: flex;
    flex-direction: column;
    background: var(--surface-solid);
    border: 1px solid rgba(31, 32, 38, 0.08);
    box-shadow: 0 20px 45px rgba(31, 32, 38, 0.08);
    z-index: 10060; /* appear above chat widget */
}

@media (max-width: 640px) {
    .dropdown-menu {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

[data-notification-list] {
    overflow-y: auto;
    max-height: 320px;
    padding: 8px 10px 12px;
}

.notification-tabs {
    display: flex;
    gap: 6px;
    padding: 8px 10px 4px;
    border-bottom: 1px solid rgba(31, 32, 38, 0.08);
    background: rgba(245, 247, 251, 0.96);
}

.tab-button {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
}

.tab-button.active {
    color: var(--text);
    background: var(--accent);
    border-color: rgba(31, 32, 38, 0.12);
}

.notification-item,
.profile-menu a,
.profile-menu button {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 11px 10px;
    color: var(--text);
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
    align-items: start;
    min-height: 72px;
}

.notification-item strong,
.notification-item span,
.notification-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-item strong {
    font-weight: 600;
    white-space: nowrap;
}

.notification-item span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.35rem;
    max-height: 2.7rem;
}

.notification-item small {
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.notification-item:hover,
.profile-menu a:hover,
.profile-menu button:hover {
    background: var(--background);
}

.notification-item.unread {
    border-left: 3px solid var(--accent);
}

.notification-item.empty {
    display: grid;
    place-items: center;
    gap: 10px;
    padding: 34px 20px;
    min-height: 240px;
    background: rgba(245, 247, 251, 0.96);
    color: var(--muted);
    text-align: center;
}

.notification-item.empty strong {
    color: var(--text);
    font-size: 1rem;
}

.notification-item.empty .notification-empty-icon {
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(238, 241, 246, 0.96);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(31, 32, 38, 0.08);
}

.notification-item.empty .notification-empty-icon svg {
    width: 32px;
    height: 32px;
}

.notification-item.empty small {
    color: var(--muted);
    font-size: 0.93rem;
}

.notification-empty-footer {
    display: flex;
    justify-content: center;
    padding: 10px 10px 12px;
    border-top: 1px solid rgba(31, 32, 38, 0.07);
}

.notification-empty-footer .link-button {
    color: var(--text);
    font-weight: 600;
}

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.profile-menu-header strong,
.profile-menu-header small {
    display: block;
}

.profile-menu-header small {
    color: var(--muted);
    font-size: 0.78rem;
}

.profile-avatar-large,
.profile-avatar-large-fallback {
    width: 74px;
    height: 74px;
    border-radius: 50%;
}

.profile-avatar-large {
    object-fit: cover;
    border: 3px solid var(--accent);
    font-size: 1.15rem;
}

.profile-avatar-large-fallback {
    font-size: 1.15rem;
}

.profile-menu a,
.profile-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-shell,
.page-shell {
    width: 100%;
    padding: 26px;
}

.guest-body .auth-shell,
.guest-body .page-shell {
    display: grid;
    min-height: calc(100vh - 76px);
    place-items: center;
}

.panel,
.glass-card,
.dashboard-card,
.metric-card,
.analytics-card,
.chart-panel,
.form-panel,
.directory-panel,
.auth-panel {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
}

.panel {
    width: min(100%, 1160px);
    margin: 0 auto;
    padding: 24px;
}

.chart-panel .chart-label,
.chart-panel .axis-label,
.chart-panel .y-axis-label,
.chart-panel .bar-label,
.chart-panel .metric-label {
    white-space: nowrap;
    min-width: 10rem;
    overflow: visible;
    text-overflow: clip;
}

.available-capstones-list {
    position: relative;
    padding-bottom: 5.5rem;
}

.available-capstones-list .floating-action-button,
.available-capstones-list .fab {
    position: absolute;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 2;
}

.ai-checker-card,
.ai-form-card,
.abstract-panel,
.form-panel.ai,
.ai-header,
.ai-panel {
    max-width: 920px;
    margin-left: auto;
    margin-right: auto;
}

textarea {
    padding: 18px 20px;
    line-height: 1.8;
}

.ai-header,
.title-with-badge,
.section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.ai-header .badge,
.title-with-badge .badge,
.section-header .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    background: rgba(166, 94, 58, 0.12);
    color: var(--primary-900);
    font-size: 0.92rem;
}

.auth-shell.auth-layout {
    display: grid;
    grid-template-columns: minmax(460px, 560px) minmax(380px, 560px);
    gap: 30px;
    max-width: 1160px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 30px 24px 34px;
}

.landing-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
    gap: 32px;
    min-height: 100vh;
    align-items: center;
    max-width: 1240px;
    margin: 0 auto;
    padding: 36px 28px;
}

.landing-hero {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.hero-branding {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 26px;
    align-items: start;
}

.hero-branding img {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 250, 245, 0.9);
}

.eyebrow-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(166, 94, 58, 0.12);
    color: var(--primary-900);
    font-size: 0.83rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.landing-hero h1 {
    font-size: clamp(2.8rem, 5vw, 4rem);
    line-height: 1.02;
    margin: 0;
    color: var(--text);
    max-width: 10ch;
}

.hero-copy {
    margin: 0;
    max-width: 620px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.8;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.btn-large {
    padding: 16px 26px;
    border-radius: 20px;
    font-size: 1rem;
}

.link-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-700);
    font-weight: 700;
    text-decoration: none;
}

.hero-highlights {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 18px;
}

.feature-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
    border-radius: 26px;
    border: 1px solid rgba(141, 101, 79, 0.12);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
}

.feature-card h3 {
    margin: 0;
    font-size: 1.08rem;
    color: var(--text);
}

.feature-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(166, 94, 58, 0.14);
    font-size: 1.35rem;
}

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

@media (max-width: 620px) {
    .hero-stat-grid {
        grid-template-columns: 1fr;
    }
}

.hero-stat {
    padding: 22px 22px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(141, 101, 79, 0.1);
    box-shadow: var(--shadow-soft);
}

.hero-stat strong {
    display: block;
    font-size: 1.8rem;
    color: var(--text);
    line-height: 1;
}

.hero-stat span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.95rem;
}

.landing-panel {
    display: grid;
    align-self: start;
}

.panel-surface {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 30px;
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 241, 246, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 24px 60px rgba(31, 32, 38, 0.12);
}

.panel-header {
    display: grid;
    gap: 16px;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--text);
    line-height: 1.1;
}

.panel-header p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}

.panel-preview {
    min-height: 260px;
    border-radius: 28px;
    background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 25%),
                linear-gradient(180deg, rgba(255, 250, 244, 0.95), rgba(229, 210, 187, 0.72));
    position: relative;
    overflow: hidden;
}

.panel-preview::before,
.panel-preview::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(166, 94, 58, 0.12);
}

.panel-preview::before {
    width: 180px;
    height: 180px;
    top: 12%;
    left: 14%;
}

.panel-preview::after {
    width: 120px;
    height: 120px;
    bottom: 14%;
    right: 18%;
}

.panel-footer {
    color: var(--muted);
    font-size: 0.95rem;
}

.auth-dialog {
    border: none;
    padding: 0;
    border-radius: 30px;
    width: min(520px, calc(100vw - 32px));
    max-width: 520px;
    background: var(--surface-solid);
    box-shadow: var(--shadow);
}

.dialog-shell {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
}

.auth-dialog .forgot-link,
.auth-dialog .modal-footnote a {
    font-size: 0.95rem;
}

.auth-dialog .remember-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0 22px;
    font-size: 0.95rem;
    flex-wrap: nowrap;
}

.auth-dialog .remember-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-dialog .remember-label input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--primary);
}

.auth-dialog .modal-footnote {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: center;
}

.dialog-form button[type="submit"] {
    display: block;
    margin: 0 auto;
    min-width: 192px;
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.dialog-close {
    width: 44px;
    height: 44px;
    border-radius: 18px;
    border: none;
    background: rgba(31, 32, 38, 0.08);
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

.dialog-copy {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.dialog-form label {
    display: block;
    margin: 0 0 8px;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.95rem;
}

.dialog-form .input-group {
    margin-bottom: 18px;
}

.dialog-form input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.dialog-form input:focus {
    outline: none;
    border-color: var(--primary-700);
    box-shadow: 0 0 0 4px rgba(166, 94, 58, 0.14);
}

.auth-modal-bio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px 0 0;
    flex-wrap: wrap;
}

.auth-dialog .remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    margin: 16px 0 22px;
    font-size: 0.95rem;
    flex-wrap: nowrap;
}

.auth-dialog .remember-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-dialog .remember-label input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.auth-dialog .forgot-link {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.dialog-form button[type="submit"] {
    display: block;
    margin: 0 auto;
    min-width: 180px;
}

.modal-footnote {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: center;
}

.btn-block {
    width: 100%;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(141, 101, 79, 0.18);
    color: var(--text);
}

.modal-footnote {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.modal-footnote a {
    color: var(--primary-700);
    text-decoration: none;
}

@media (max-width: 1024px) {
    .landing-shell {
        grid-template-columns: 1fr;
        padding: 30px 22px;
    }

    .hero-highlights {
        grid-template-columns: 1fr;
    }

    .hero-stat-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 720px) {
    .landing-shell {
        padding: 20px 16px;
        gap: 22px;
    }

    .hero-branding {
        grid-template-columns: 1fr;
        align-items: normal;
    }

    .panel-preview {
        min-height: 220px;
    }

    .dialog-shell {
        padding: 22px;
    }
}

.auth-dialog .auth-modal-bio {
    justify-content: center;
}

.auth-dialog .modal-footnote {
    text-align: center;
    margin-top: 0;
}

.auth-card {
    width: 100%;
    padding: 38px 34px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 32px 78px rgba(31, 32, 38, 0.14);
}

.auth-side {
    display: grid;
    align-items: center;
}

.auth-side-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
    min-height: 420px;
    padding: 26px;
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(166, 94, 58, 0.12), rgba(201, 154, 107, 0.14));
    box-shadow: 0 24px 56px rgba(31, 32, 38, 0.12);
    overflow: hidden;
}

.auth-side-card::before {
    content: '';
    position: absolute;
    inset: -40% 0 auto auto;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    filter: blur(12px);
}

.auth-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-branding img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    box-shadow: 0 18px 34px rgba(31, 32, 38, 0.12);
}

.brand-copy {
    text-align: center;
}

.brand-copy strong {
    display: block;
    font-size: 1rem;
    color: var(--primary-700);
}

.brand-copy small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.88rem;
}

.headline-copy {
    text-align: left;
    margin-bottom: 24px;
}

.headline-copy h1 {
    font-size: 2.2rem;
    line-height: 1.03;
    margin: 0 0 10px;
    color: var(--text);
}

.headline-copy .eyebrow {
    margin: 0;
    font-size: 1rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.auth-panel {
    width: 100%;
    padding: 0;
    text-align: left;
}

.auth-panel h1 {
    font-size: 1.82rem;
    margin: 0 0 6px;
    font-weight: 800;
    color: var(--text);
}

.auth-panel .eyebrow {
    margin-bottom: 18px;
    font-size: 0.95rem;
    text-transform: none;
    color: var(--muted);
}

.input-group {
    position: relative;
    margin-bottom: 16px;
}

.field-icon {
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--muted);
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.field-action {
    position: absolute;
    inset-inline-end: 12px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
}

.stacked-form input,
.stacked-form textarea,
.stacked-form select {
    width: 100%;
    min-width: 0;
    padding: 14px 14px 14px 48px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,0.94);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.stacked-form input:focus,
.stacked-form textarea:focus,
.stacked-form select:focus {
    outline: none;
    border-color: rgba(166, 94, 58, 0.75);
    box-shadow: 0 0 0 4px rgba(166, 94, 58, 0.14);
}

.form-grid-two,
.form-field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

@media (max-width: 780px) {
    .form-grid-two,
    .form-field-row {
        grid-template-columns: 1fr;
    }
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
textarea,
select {
    width: 100%;
    min-width: 0;
}

.stacked-form label {
    display: block;
    margin: 0 0 8px;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.92rem;
}

.auth-panel .btn {
    width: 100%;
    padding: 14px 14px;
    font-size: 1rem;
    border-radius: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-700));
    color: #fff;
    border: 0;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-900));
}

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 22px;
    font-size: 0.95rem;
}

.auth-dialog .remember-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 16px 0 22px;
    flex-wrap: nowrap;
}

.remember-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.remember-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.forgot-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.forgot-link:hover {
    color: var(--primary-700);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0 16px;
    color: var(--muted);
    font-size: 0.92rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(161, 127, 107, 0.24);
}

.side-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--primary-700);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    z-index: 1;
}

.auth-side-card h2 {
    margin: 0;
    font-size: 1.85rem;
    line-height: 1.05;
    color: var(--text);
    z-index: 1;
}

.auth-side-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
    z-index: 1;
}

.library-illustration {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 260px;
    border-radius: 30px;
    overflow: hidden;
    background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.96), transparent 20%),
                radial-gradient(circle at 85% 10%, rgba(255,255,255,0.75), transparent 18%),
                linear-gradient(180deg, rgba(255, 248, 242, 0.95), rgba(238, 223, 208, 0.72));
}

.library-illustration::before {
    content: '';
    position: absolute;
    inset: -10% 10% auto auto;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    filter: blur(16px);
}

.library-illustration::after {
    content: '';
    position: absolute;
    inset: auto auto 12% 6%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.42);
}

.page-grid {
    position: absolute;
    top: 18%;
    left: 12%;
    width: 70%;
    height: 65%;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.8));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35);
    z-index: 1;
}

.page-grid::before,
.page-grid::after {
    content: '';
    position: absolute;
    border-radius: 999px;
    background: rgba(166, 94, 58, 0.14);
}

.page-grid::before {
    inset: 14% 12% auto auto;
    width: 52px;
    height: 12px;
}

.page-grid::after {
    inset: auto 14% 14% auto;
    width: 48px;
    height: 10px;
}

.book-stack {
    position: relative;
    width: 130px;
    height: 130px;
    border-radius: 28px;
    background: linear-gradient(180deg, #fff, rgba(255, 250, 244, 0.94));
    box-shadow: 0 28px 48px rgba(31, 32, 38, 0.14);
    z-index: 2;
}

.book-stack::before,
.book-stack::after {
    content: '';
    position: absolute;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(201, 154, 107, 0.18), rgba(201, 154, 107, 0.05));
}

.book-stack::before {
    inset: 16px 12px auto auto;
    width: 94px;
    height: 72px;
}

.book-stack::after {
    inset: auto auto 18px 22px;
    width: 78px;
    height: 56px;
}

.lock-emblem {
    position: absolute;
    right: 20px;
    bottom: 24px;
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: #fff;
    display: grid;
    place-items: center;
    color: var(--primary-900);
    font-size: 1.9rem;
    box-shadow: 0 18px 30px rgba(31, 32, 38, 0.14);
    z-index: 2;
}

.sparkles {
    position: absolute;
    top: 16px;
    right: 18px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.6);
    z-index: 2;
}

.sparkles::after {
    content: '';
    position: absolute;
    inset: 6px auto auto 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,211,172,0.9);
}

@media (max-width: 960px) {
    .auth-shell.auth-layout {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 20px;
    }

    .auth-side {
        order: -1;
    }

    .auth-side-card {
        min-height: 300px;
    }
}

@media (max-width: 640px) {
    /* Make data tables flow naturally on small screens */
    .table-wrap {
        border-radius: 6px;
        margin-inline: 8px;
    }

    .data-table {
        table-layout: auto;
        font-size: 0.95rem;
        width: 100%;
    }

    .data-table th,
    .data-table td {
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        padding: 10px 12px;
        line-height: 1.2;
    }

    /* Relax min-widths that force horizontal squeezing */
    .borrower-cell {
        min-width: 0 !important;
        gap: 10px;
    }

    .borrower-stack .borrower-email {
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .directory-panel .data-table td:last-child {
        min-width: 0;
    }

    /* Stacked card table layout for very small screens (improves readability) */
    .table-wrap.stacked-tables .data-table {
        display: block;
        width: 100%;
    }

    .table-wrap.stacked-tables .data-table thead,
    .table-wrap.stacked-tables .data-table tbody,
    .table-wrap.stacked-tables .data-table tr {
        display: block;
    }

    .table-wrap.stacked-tables .data-table tr {
        background: #fff;
        border-radius: 8px;
        margin: 0 6px 12px;
        padding: 10px;
        box-shadow: 0 6px 18px rgba(0,0,0,0.04);
    }

    .table-wrap.stacked-tables .data-table td,
    .table-wrap.stacked-tables .data-table th {
        display: block;
        padding: 6px 0;
        border: 0;
        white-space: normal;
        overflow: visible;
    }

    .table-wrap.stacked-tables .data-table td::before {
        content: attr(data-label);
        display: block;
        font-weight: 700;
        color: var(--muted);
        margin-bottom: 6px;
        text-transform: none;
    }

    /* Improve readability for borrow module specifically */
    .directory-panel .table-wrap.stacked-tables .data-table tr {
        padding: 16px;
    }

    .directory-panel .table-wrap.stacked-tables .data-table td {
        padding: 6px 0;
        font-size: 0.95rem;
        color: var(--text);
    }

    .directory-panel .table-wrap.stacked-tables .data-table td::before {
        color: #7a4f45;
        font-size: 0.82rem;
        margin-bottom: 8px;
    }

    .directory-panel .table-wrap.stacked-tables .status-pill {
        display: inline-block;
        margin-top: 6px;
    }

    /* Reduce header density and allow longer header labels to wrap */
    .data-table th {
        font-size: 0.72rem;
        padding: 8px 10px;
        white-space: normal;
    }

    /* Ensure actions remain visible and tappable */
    .table-actions,
    .borrower-info-btn {
        z-index: 5;
    }
    .auth-shell.auth-layout {
        gap: 18px;
        padding: 16px;
    }

    .auth-side-card {
        padding: 22px;
    }

    .headline-copy h1 {
        font-size: 1.7rem;
    }

    .auth-side-card h2 {
        font-size: 1.5rem;
    }
}

.auth-panel .btn {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.98rem;
}

.remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 10px 0 20px;
    font-size: 0.95rem;
}

.remember-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.remember-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.forgot-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.forgot-link:hover {
    color: var(--primary-700);
}

    .auth-dialog {
        width: min(520px, calc(100vw - 32px));
        max-width: 520px;
    }

    .auth-dialog .remember-row {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: 16px 0 22px;
        flex-wrap: nowrap;
    }

    .auth-dialog .remember-label input {
        width: 16px;
        height: 16px;
    }

    .auth-dialog .forgot-link,
    .auth-dialog .modal-footnote a {
        font-size: 0.95rem;
    }

    .auth-dialog .modal-footnote {
        text-align: center;
    }

    .dialog-form button[type="submit"] {
        display: block;
        margin: 0 auto;
        min-width: 190px;
    }

    .auth-dialog .auth-modal-bio {
        justify-content: center;
    }

.dashboard-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.dashboard-hero {
    min-height: 180px;
    padding: 28px;
    overflow: hidden;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 241, 246, 0.9)),
        var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.dashboard-hero h1,
.page-heading h1,
h1 {
    margin: 0;
    color: inherit;
    font-size: 2rem;
    line-height: 1.15;
    font-weight: 850;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding-bottom: 18px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(31, 32, 38, 0.08);
}

.directory-panel .page-heading {
    padding-bottom: 18px;
    margin-bottom: 24px;
}

.page-heading h1,
h1 {
    color: var(--text);
}

h2 {
    margin: 0 0 14px;
    color: var(--text);
    font-size: 1.22rem;
    font-weight: 800;
}

h3 {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 800;
}

p {
    margin: 0 0 14px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0;
    text-transform: uppercase;
}

.dashboard-hero .eyebrow {
    color: var(--primary);
}

.dashboard-hero p {
    color: var(--text);
}

.hero-actions,
.button-row,
.dashboard-actions,
.filter-actions,
.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
}

.dashboard-hero .button-row {
    position: relative;
    z-index: 1;
}

.notification-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

button.link-button {
    min-width: 96px;
}

.btn,
button.btn,
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    margin: 0;
    padding: 9px 15px;
    color: #fff;
    background: #58151f;
    border: 1px solid rgba(88, 21, 31, 0.54);
    border-radius: var(--radius);
    box-shadow: 0 12px 24px rgba(88, 21, 31, 0.16);
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
    color: #fff;
    background: #3c0f14;
    border-color: rgba(60, 15, 20, 0.4);
    box-shadow: 0 16px 28px rgba(60, 15, 20, 0.22);
    transform: translateY(-1px);
}

.btn-sm {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 0.84rem;
}

.btn-secondary {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--border);
    box-shadow: none;
}

.btn-secondary:hover {
    color: var(--primary-700);
    background: var(--accent);
}

.btn-tertiary {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(128, 99, 89, 0.15);
    box-shadow: none;
}

.btn-tertiary:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(128, 99, 89, 0.25);
}

.btn-danger {
    color: #fff;
    background: var(--danger);
    border-color: rgba(160, 82, 45, 0.25);
}

.btn-success {
    color: #fff;
    background: var(--success);
}

/* Maroon outline variant used for secondary actions in the borrow module */
.btn-outline-maroon {
    color: #58151f;
    background: transparent;
    border: 1px solid rgba(88,21,31,0.18);
    box-shadow: none;
}
.btn-outline-maroon:hover {
    background: rgba(88,21,31,0.06);
    color: #58151f;
}

/* Small action button used inside table cells */
.btn-action-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    font-size: 0.85rem;
    min-height: 34px;
    border-radius: 8px;
}

/* small square icon-only action button used inside table rows */
.btn-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 6px;
    border-radius: 8px;
    background: transparent;
    color: #58151f;
    border: 1px solid rgba(88,21,31,0.12);
}
.btn-action-icon svg { width: 18px; height: 18px; }
.btn-action-icon:hover { background: rgba(88,21,31,0.06); transform: translateY(-1px); }

.link-button {
    padding: 0;
    color: var(--primary);
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.webauthn-panel,
.webauthn-settings-card {
    display: grid;
    gap: 14px;
}

.webauthn-panel {
    padding: 18px 16px;
    background: rgba(248, 242, 238, 0.95);
    border: 1px solid rgba(194, 151, 109, 0.24);
    border-radius: 18px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.85);
}

.webauthn-copy small {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    letter-spacing: 0.012em;
    text-transform: uppercase;
}

.webauthn-panel .btn {
    width: 100%;
    padding: 12px 0;
}

.webauthn-copy {
    display: grid;
    gap: 3px;
}

.webauthn-copy strong {
    color: var(--text);
    font-weight: 850;
}

/* hide the longer biometric helper text to reduce clutter */
.webauthn-copy span { display: none; }
.webauthn-status {
    color: var(--muted);
    font-size: 0.86rem;
}

.webauthn-status {
    min-height: 20px;
    margin: 0;
}

.webauthn-status[data-status="success"] {
    color: var(--success);
}

.webauthn-status[data-status="error"] {
    color: var(--danger);
}

.credential-list {
    display: grid;
    gap: 10px;
}

.credential-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: rgba(245, 247, 251, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.credential-item > span {
    min-width: 0;
}

.credential-item strong,
.credential-item small {
    display: block;
}

.compact-empty {
    padding: 14px;
}

button:disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.64;
    transform: none;
}

.stacked-form,
.record-form,
.checker-form,
.create-capstone-form,
.upload-form,
.abstract-form {
    display: grid;
    gap: 14px;
}

label,
.stacked-form label,
.record-form label,
.form-group label {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-weight: 760;
}

.form-group {
    display: grid;
    gap: 7px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
}

textarea {
    min-height: 132px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(216, 180, 199, 0.32);
    border-color: var(--secondary);
}

small,
.table-note,
.form-group small,
.result-summary,
.results-info,
.muted {
    color: var(--muted);
    font-size: 0.88rem;
}

.form-grid,
.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.metric-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.metric-card,
.stat-card {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    min-height: 118px;
    padding: 22px 20px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.metric-card:hover,
.stat-card:hover,
.dashboard-card:hover,
.capstone-card:hover,
.analytics-card:hover {
    box-shadow: 0 22px 48px rgba(28, 22, 18, 0.11);
    transform: translateY(-2px);
    border-color: rgba(166, 94, 58, 0.18);
}

.metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 8px 8px 0;
    background: linear-gradient(180deg, rgba(166, 94, 58, 0.24), transparent 100%);
}

.metric-icon,
.stat-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    color: var(--primary-900);
    background: rgba(166, 94, 58, 0.12);
    border: 1px solid rgba(166, 94, 58, 0.16);
    border-radius: 16px;
}

.metric-icon svg,
.stat-icon svg {
    display: block;
    width: 24px;
    height: 24px;
    color: inherit;
}

.stat-icon-primary {
    color: var(--primary);
    background: var(--accent);
}

.stat-icon-success {
    color: var(--success);
    background: var(--success-bg);
}

.stat-icon-warning {
    color: var(--warning);
    background: var(--warning-bg);
}

.stat-icon-danger,
.metric-icon-danger {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: rgba(178, 77, 87, 0.22);
}

.metric-card--danger {
    border-color: rgba(178, 77, 87, 0.18);
    background: #fff3f3;
}

.metric-card--danger .metric-value {
    color: var(--danger);
}

.metric-card--danger .metric-label {
    color: var(--danger);
}

.stat-content,
.metric-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.stat-value,
.metric-value {
    color: var(--text);
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.04;
}

.stat-label,
.metric-label {
    color: rgba(60, 45, 35, 0.72);
    font-size: 0.82rem;
    font-weight: 750;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.role-badge,
.status-badge,
.status-pill,
.status-tag,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 850;
    line-height: 1;
    white-space: nowrap;
}

.role-badge {
    color: var(--primary);
    background: var(--accent);
    border: 1px solid rgba(216, 180, 199, 0.32);
}

.dashboard-hero .role-badge {
    color: var(--primary-900);
    background: rgba(245, 247, 251, 0.92);
    border-color: var(--border);
}

.status-available,
.status-approved,
.status-active,
.status-low,
.borrow-status-returned,
.rfid-result-matched {
    color: var(--success);
    background: var(--success-bg);
}

.status-borrowed,
.status-pending,
.status-flagged,
.status-on_hold,
.status-needs-revision,
.status-moderate,
.borrow-status-pending,
.borrow-status-borrowed,
.rfid-result-unassigned {
    color: var(--warning);
    background: var(--warning-bg);
}

.status-missing,
.status-rejected,
.status-high,
.borrow-status-overdue,
.borrow-status-declined,
.rfid-result-inactive,
.rfid-result-unknown {
    color: var(--danger);
    background: var(--danger-bg);
}

.borrow-status-cancelled {
    color: var(--muted);
    background: #eef2f7;
}

.borrow-status-borrowed {
    /* Active/borrowed: soft light-orange background with dark-amber text */
    color: #b45309; /* amber-700 */
    background: var(--warning-bg);
    border: 1px solid rgba(180,83,9,0.08);
}

.status-inactive {
    color: var(--muted);
    background: #eef2f7;
}

.dashboard-grid,
.content-grid,
.analytics-sections,
.ai-checker-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.content-grid.three-col,
.analytics-grid {
    grid-template-columns: 1.2fr 1fr 1fr;
}

.dashboard-card,
.analytics-card,
.chart-panel,
.checker-panel,
.results-panel,
.create-capstone-section,
.capstone-card,
.rfid-result,
.empty-state,
.delete-summary,
.notice,
.alert {
    padding: 18px;
    border-radius: 8px;
}

.dashboard-card,
.analytics-card,
.chart-panel,
.checker-panel,
.results-panel,
.create-capstone-section,
.capstone-card,
.rfid-result {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.card-header-row,
.capstone-header,
.section-title-row,
.result-header,
.file-review-info {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.card-header-row {
    margin-bottom: 14px;
}

.card-header-row p,
.section-title-row p {
    margin: 4px 0 0;
    color: var(--muted);
}

.list-stack,
.analytics-list,
.uploaded-files ul,
.activity-list,
.notification-list,
.notification-page-list,
.capstone-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 300ms ease, opacity 300ms ease;
    opacity: 1;
}

.list-stack[data-collapsed="true"],
.analytics-list[data-collapsed="true"],
.activity-list[data-collapsed="true"] {
    max-height: 0;
    opacity: 0;
}

.collapsible-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(166, 94, 58, 0.08);
    border: 1px solid rgba(166, 94, 58, 0.12);
    cursor: pointer;
    transition: background 150ms ease, transform 150ms ease;
}

.collapsible-toggle:hover {
    background: rgba(166, 94, 58, 0.14);
}

.collapse-icon {
    display: inline-block;
    transition: transform 300ms ease;
    font-size: 0.85rem;
}

.collapsible-toggle[aria-expanded="false"] .collapse-icon {
    transform: rotate(-90deg);
}

.directory-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.directory-card {
    display: grid;
    gap: 16px;
}

.department-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    grid-auto-rows: minmax(230px, auto);
    gap: 16px;
    margin: 22px 0;
}

.department-card {
    display: grid;
    gap: 14px;
    min-height: 230px;
    padding: 18px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(238, 241, 246, 0.88)),
        var(--surface-solid);
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
    overflow: hidden;
}

.department-card:hover,
.department-card.active {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.department-icon {
    display: inline-grid;
    place-items: center;
    width: 64px;
    height: 64px;
    color: var(--primary-900);
    background: rgba(245, 247, 251, 0.94);
    border: 1px solid var(--border);
    border-radius: 18px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.department-card h2 {
    margin-bottom: 6px;
}

.department-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
}

.department-card-meta span {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 78px;
    min-height: 78px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 16px;
    color: var(--muted);
    font-size: 0.92rem;
    text-align: center;
}

.department-card-meta strong {
    color: var(--text);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.department-card-meta strong {
    color: var(--text);
    font-size: 0.7rem;
    text-transform: uppercase;
}

.department-sections {
    display: grid;
    gap: 16px;
}

.department-section {
    display: none;
    padding: 18px;
    background: rgba(245, 247, 251, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.department-section.open {
    display: grid;
    gap: 18px;
}

.department-section.maximized {
    position: fixed;
    inset: calc(var(--topbar-height) + 12px) 24px 24px calc(var(--sidebar-width) + 24px);
    z-index: 35;
    overflow-y: auto;
}

.department-section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.department-filter-bar {
    display: grid;
    grid-template-columns: 1.4fr 0.7fr 1fr 1fr 0.9fr;
    gap: 12px;
    align-items: end;
    padding: 14px;
    background: rgba(245, 247, 251, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.department-capstone-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.archive-card {
    display: grid;
    gap: 14px;
}

.capstone-entry-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.capstone-entry-meta span {
    display: grid;
    gap: 3px;
    padding: 10px;
    background: rgba(245, 247, 251, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 0.84rem;
}

.capstone-entry-meta strong {
    color: var(--text);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.rfid-visual {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: linear-gradient(135deg, rgba(238, 241, 246, 0.8), rgba(255, 255, 255, 0.94));
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.rfid-visual strong,
.rfid-visual small {
    display: block;
}

.rfid-visual small {
    color: var(--muted);
    font-size: 0.82rem;
}

.shelf-map-dot {
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    background: var(--danger);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(160, 68, 95, 0.14);
}

.shelf-map-dot.available {
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(109, 127, 88, 0.14);
}

.borrow-modal-card {
    display: grid;
    gap: 14px;
}

.compact-hero {
    min-height: 142px;
}

.librarian-dashboard {
    max-width: 1440px;
    margin: 0 auto;
}

.librarian-hero {
    min-height: 132px;
    align-items: center;
}

.librarian-hero p {
    max-width: 680px;
}

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

.librarian-stat-grid .metric-card {
    min-height: 100px;
    padding: 14px;
}

.librarian-stat-grid .metric-value {
    font-size: 1.45rem;
}

.librarian-work-grid,
.librarian-archive-grid,
.librarian-analytics-grid {
    display: grid;
    gap: 18px;
}

.librarian-work-grid {
    grid-template-columns: repeat(3, minmax(280px, 1fr));
    align-items: start;
    margin-bottom: 20px;
}

.librarian-archive-grid,
.librarian-analytics-grid {
    grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.priority-panel {
    min-height: 100%;
    padding-bottom: 2.8rem;
}

.librarian-dashboard .card-header-row {
    align-items: center;
}

.librarian-dashboard .card-header-row h2 {
    margin-bottom: 0;
}

.librarian-dashboard .card-header-row .btn {
    flex: 0 0 auto;
}

.librarian-dashboard .list-item {
    align-items: flex-start;
    min-height: 64px;
    padding: 18px 20px;
    border-radius: 12px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: background 180ms ease, transform 180ms ease;
}

.librarian-dashboard .list-item:hover {
    background: rgba(232, 213, 200, 0.18);
    transform: translateX(1px);
}

.librarian-dashboard .list-item > span {
    min-width: 0;
}

.librarian-dashboard .list-item strong {
    overflow-wrap: anywhere;
}

.librarian-dashboard .list-item .status-pill {
    flex: 0 0 auto;
    min-height: auto;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    background-color: #ffedd5;
    color: #c2410c;
    box-shadow: inset 0 0 0 1px rgba(195, 65, 12, 0.08);
}

.compact-stat-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.compact-stat-grid .metric-card {
    min-height: 104px;
    padding: 15px;
}

.compact-stat-grid .metric-value {
    font-size: 1.55rem;
}

.dashboard-command-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
    gap: 18px;
    align-items: start;
}

.page-shell.librarian-dashboard {
    padding-bottom: 10rem;
}

.dashboard-analytics-stack {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    grid-auto-rows: minmax(280px, auto);
    gap: 18px;
    align-items: stretch;
}

.dashboard-analytics-stack > .analytics-card,
.dashboard-analytics-stack > .chart-card {
    display: flex;
    flex-direction: column;
    min-height: 350px;
    min-width: 0;
}

.quick-panel-stack {
    display: grid;
    gap: 18px;
    align-items: start;
    position: static;
}

.quick-panel-stack > .dashboard-card {
    display: flex;
    flex-direction: column;
    min-height: 260px;
}

.chart-card {
    display: flex;
    flex-direction: column;
    padding: 22px;
    min-height: 350px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 28px 64px rgba(49, 45, 50, 0.1);
}

.chart-card .card-header-row {
    align-items: flex-start;
    gap: 12px;
}

.chart-card .card-header-row p,
.librarian-dashboard .list-item small {
    color: rgba(60, 45, 35, 0.78);
}

.chart-card-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.chart-card-body canvas {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 260px;
    max-height: 420px;
}

.chart-card .chart-kpi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(124, 92, 102, 0.08);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.4;
    white-space: nowrap;
}

.chart-card canvas {
    width: 100%;
    min-height: 250px;
    max-height: 420px;
}

.quick-panel-stack {
    display: grid;
    gap: 18px;
    position: static;
}

.quick-panel-stack .dashboard-card {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    padding: 18px;
}

.quick-panel-stack h2 {
    margin-bottom: 12px;
    font-size: 1rem;
}

.directory-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.directory-meta span {
    display: grid;
    gap: 4px;
    padding: 11px;
    color: var(--muted);
    background: rgba(245, 247, 251, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.88rem;
}

.directory-meta strong {
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.capstone-modal {
    width: min(820px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
}

.capstone-modal::backdrop {
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(4px);
}

.modal-card {
    padding: 22px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-height: calc(100vh - 72px);
    overflow-y: auto;
}

.app-body .ai-checker-shell .checker-panel,
.app-body .ai-checker-shell .results-panel,
.app-body .ai-checker-shell .result-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.app-body .ai-checker-shell .btn {
    color: #fff;
    background: var(--primary);
    border: 1px solid rgba(139, 115, 85, 0.54);
    border-radius: var(--radius);
    box-shadow: 0 10px 20px rgba(139, 115, 85, 0.16);
    font-weight: 800;
}

.app-body .ai-checker-shell .btn-secondary {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--border);
    box-shadow: none;
}

.list-item,
.analytics-item,
.activity-item,
.notification-row,
.notification-page-item,
.file-row,
.borrow-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: rgba(245, 247, 251, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.notification-page-item.unread {
    border-left: 4px solid var(--danger);
    background: var(--danger-bg);
}

.notification-page-item small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.list-item strong,
.analytics-item-title,
.activity-item strong,
.notification-row strong,
.notification-page-item strong {
    display: block;
    color: var(--text);
}

.analytics-item-title,
.list-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    background: #e8e6e0;
    border-radius: 999px;
}

.progress-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 999px;
}

.score-ring {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    color: var(--primary);
    background: conic-gradient(var(--secondary) var(--score, 0%), #e8e6e0 0);
    border-radius: 50%;
}

.score-ring span {
    display: grid;
    place-items: center;
    width: 82px;
    height: 82px;
    color: var(--text);
    background: #fff;
    border-radius: 50%;
    font-size: 1.35rem;
    font-weight: 900;
}

.chart-bars {
    display: grid;
    gap: 12px;
}

.bar-row {
    display: grid;
    grid-template-columns: 130px 1fr 44px;
    align-items: center;
    gap: 10px;
}

.bar-track {
    height: 12px;
    overflow: hidden;
    background: #e8e6e0;
    border-radius: 999px;
}

.bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: inherit;
}

.donut-chart {
    display: grid;
    place-items: center;
    width: 170px;
    height: 170px;
    margin: 0 auto;
    background: conic-gradient(var(--primary) var(--approved, 0%), var(--warning-bg) 0 var(--pending, 0%), var(--danger-bg) 0);
    border-radius: 50%;
}

.donut-chart span {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    color: var(--text);
    background: #fff;
    border-radius: 50%;
    font-weight: 900;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(170px, 1fr) minmax(160px, 1fr) minmax(110px, 0.7fr) minmax(140px, 0.9fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.filter-bar > label {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-bar input,
.filter-bar select {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 14px;
    border: 1px solid rgba(148, 117, 86, 0.16);
    border-radius: 12px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    box-sizing: border-box;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: rgba(88, 21, 31, 0.24);
    box-shadow: 0 0 0 4px rgba(88, 21, 31, 0.08);
}

.filter-bar select {
    appearance: none;
}

.filter-bar label span {
    color: var(--muted);
    font-weight: 700;
    display: block;
}

/* Improve placeholder visibility and label styling inside the filter bar */
.filter-bar label span {
    color: var(--muted);
    font-weight: 700;
    display: block;
}

.filter-bar input::placeholder,
.filter-bar textarea::placeholder {
    color: rgba(100, 103, 114, 0.72);
    opacity: 1;
}

.filter-bar .filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
    align-self: end;
}

.filter-bar .filter-actions .btn-secondary {
    background: transparent;
    color: #58151f;
    border: 2px solid #58151f;
    box-shadow: none;
}

.filter-bar .filter-actions .btn-secondary:hover {
    background: rgba(88, 21, 31, 0.08);
    color: #58151f;
}

.filter-bar .filter-actions .btn {
    height: 42px;
    min-height: 42px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.history-filter {
    grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) auto;
}

.table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.data-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 16px 18px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.data-table th {
    color: var(--primary-700);
    background: var(--highlight);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.borrower-cell {
    min-width: 220px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    white-space: normal;
}

.borrower-stack {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 4px;
}

.borrower-stack .borrower-name {
    font-weight: 700;
    color: var(--text);
}

.borrower-stack .borrower-email {
    color: rgba(60, 45, 35, 0.72);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.6;
}

.borrower-info-btn {
    flex-shrink: 0;
    margin-left: auto;
}

/* ensure the QR/info button aligns with the borrower's name (top of stack) */
.borrower-info-btn {
    align-self: flex-start;
}

/* Maroon primary variant for header actions */
.btn-primary-maroon {
    color: #fff;
    background: #58151f;
    border: 1px solid rgba(88,21,31,0.54);
    box-shadow: 0 12px 24px rgba(88,21,31,0.12);
}
.btn-primary-maroon:hover { background: #3c0f14; }

.directory-panel .data-table td:last-child {
    min-width: 140px;
}

/* allow interactive form popups (date pickers) inside approval cells to show fully */
.directory-panel .data-table td.approval-cell,
.data-table td.approval-cell {
    overflow: visible;
    white-space: normal;
}

.data-table td.approval-cell .button-row {
    flex-wrap: wrap;
    gap: 10px;
}

.data-table td.approval-cell .inline-form {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

/* Utility: muted secondary text */
.text-muted { color: #6b7280; }

/* Table title with a single leading icon */
.table-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}
.table-title svg.icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.table-title svg.icon:not(:first-of-type),
.data-table td strong svg.icon:not(:first-of-type) {
    display: none !important;
}

/* Form input styles for compact inline forms */
.approval-form {
    display: grid;
    gap: 0.75rem;
}
.form-input,
.form-textarea,
.approval-form input[type="date"],
.approval-form input[type="text"] {
    width: 100%;
    border: 1px solid #d1d5db;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}
.form-textarea { min-height: 82px; resize: vertical; }
.approval-form label { display: block; margin-bottom: 0; }
.approval-form label span { display: block; font-size: 13px; color: #374151; margin-bottom: 6px; }

/* Button variants for Approve / Decline hierarchy */
.btn-approve {
    background: #660000;
    color: #fff;
    border: 1px solid rgba(102,0,0,0.8);
    padding: 10px 14px;
    border-radius: 8px;
}
.btn-approve:hover { background: #4d0000; }
.btn-decline {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    padding: 10px 14px;
    border-radius: 8px;
}
.btn-decline:hover { background: #f9fafb; color: #374151; }

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr {
    transition: background 140ms ease;
}

.data-table tbody tr:hover {
    background: var(--surface-solid);
}

.table-note {
    display: block;
    margin-top: 4px;
}

.table-actions {
    white-space: nowrap;
}

.table-actions a {
    display: inline-flex;
    margin-right: 10px;
    font-weight: 800;
}

.danger-link {
    color: var(--danger);
}

.empty-state,
.delete-summary {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.72);
    border: 1px dashed var(--border-strong);
}

.empty-state h2,
.delete-summary h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
}

.alert,
.notice,
.flash {
    border: 1px solid var(--border);
}

.alert p:last-child,
.notice p:last-child,
.empty-state p:last-child {
    margin-bottom: 0;
}

.alert-error,
.flash-error {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: #fecdca;
}

.alert-success,
.flash-success {
    color: var(--success);
    background: var(--success-bg);
    border-color: #bbf7d0;
}

.alert-info,
.flash-info,
.notice {
    color: var(--info);
    background: var(--info-bg);
    border-color: #bfdbfe;
}

.flash-stack {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 100;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100vw - 44px));
}

.section-block {
    margin-top: 24px;
}

.section-block:first-of-type {
    margin-top: 0;
}

.approval-table {
    min-width: 980px;
}

.approval-form {
    display: grid;
    gap: 10px;
    min-width: 280px;
}

.rfid-scan-form {
    display: grid;
    gap: 12px;
    margin-bottom: 22px;
}

.scan-input-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 10px;
}

.scan-input-row input {
    height: 44px;
    box-sizing: border-box;
    font-size: 1rem;
    font-weight: 700;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.scan-input-row input:focus {
    outline: none;
    border-color: rgba(174, 20, 87, 0.35);
    box-shadow: 0 0 0 4px rgba(174, 20, 87, 0.12);
}

.scan-input-row button,
.scan-input-row .btn {
    height: 44px;
    min-height: 44px;
    line-height: 44px;
    box-sizing: border-box;
    padding: 0 20px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
}

.rfid-lookup-link {
    color: #7c1d1d;
    font-weight: 700;
    text-decoration: none;
}

.rfid-lookup-link:hover {
    text-decoration: underline;
}

.muted-empty {
    color: #9ca3af;
}

.result-topline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.record-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.record-detail-grid > div {
    padding: 12px;
    background: rgba(245, 247, 251, 0.94);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.detail-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.rfid-borrow-notice {
    margin: 16px 0 0;
}

.rfid-actions {
    margin-top: 16px;
}

.audit-shell .dashboard-card,
.audit-shell .directory-panel {
    background: rgba(255, 252, 248, 0.96);
    border-color: rgba(166, 94, 58, 0.16);
}

.audit-workspace {
    grid-template-columns: minmax(320px, 1.05fr) minmax(300px, 0.95fr);
}

.audit-close-box {
    display: grid;
    gap: 12px;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid rgba(166, 94, 58, 0.18);
    border-radius: 8px;
    background: rgba(245, 247, 251, 0.82);
}

.audit-close-box p {
    margin: 0;
    color: var(--muted);
}

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

.audit-shelf-card {
    display: grid;
    gap: 14px;
    min-height: 190px;
    padding: 16px;
    border: 1px solid rgba(166, 94, 58, 0.18);
    border-radius: 8px;
    background: rgba(245, 247, 251, 0.92);
}

.audit-shelf-card.is-selected {
    border-color: rgba(88, 21, 31, 0.45);
    box-shadow: 0 0 0 3px rgba(88, 21, 31, 0.08);
}

.audit-shelf-card h3,
.audit-title-cell strong,
.audit-shelf-card p,
.audit-alert-list small,
.audit-recent-list small {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.audit-shelf-card h3 {
    margin-bottom: 4px;
    font-size: 1rem;
    line-height: 1.3;
}

.audit-shelf-card p {
    margin: 0;
    color: var(--muted);
}

.audit-shelf-card form,
.audit-shelf-card .btn {
    width: 100%;
}

.audit-shelf-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.audit-shelf-meta span {
    display: grid;
    gap: 2px;
    min-height: 58px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--muted);
    font-size: 0.85rem;
}

.audit-shelf-meta strong {
    color: var(--text);
    font-size: 1.1rem;
}

.audit-table-wrap {
    background: rgba(255, 255, 255, 0.74);
}

.audit-checklist-table,
.audit-scan-log-table {
    min-width: 860px;
}

.audit-checklist-table th,
.audit-checklist-table td,
.audit-scan-log-table th,
.audit-scan-log-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.audit-title-cell strong,
.audit-title-cell small,
.audit-checklist-table td small {
    display: block;
}

.audit-title-cell small,
.audit-checklist-table td small {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.abstract-text,
.flagged-issues,
.issues-section {
    padding: 13px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.abstract-text {
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.flagged-issues pre {
    margin: 8px 0 0;
    color: var(--danger);
    white-space: pre-wrap;
}

.file-review-list,
.uploaded-files {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.file-review-item,
.uploaded-files li {
    padding: 12px;
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.file-review-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.file-review-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.file-review-name {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    flex: 1 1 320px;
}

.file-name {
    overflow: hidden;
    color: var(--text);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: normal;
    overflow-wrap: anywhere;
}

.file-review-item .button-row {
    flex: 0 0 auto;
    gap: 10px;
}

.file-meta,
.file-size,
.file-date {
    color: var(--muted);
    font-size: 0.84rem;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.page-info {
    color: var(--muted);
    font-weight: 750;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 26px 24px;
    color: var(--muted);
    font-size: 0.84rem;
}

code {
    color: var(--primary-700);
    background: var(--accent);
    border-radius: 6px;
    padding: 2px 6px;
}

.app-body :target {
    scroll-margin-top: calc(var(--topbar-height) + 18px);
}

.capstone-card:target,
.data-table tr:target {
    outline: 3px solid rgba(127, 156, 141, 0.34);
    outline-offset: 2px;
}

.data-table tr:target td {
    background: var(--success-bg);
}

/* Photo-led guest landing */
.landing-stage {
    min-height: 100vh;
    padding: 24px;
    color: #ffffff;
    background:
        linear-gradient(135deg, #25060c 0%, #5f101f 42%, #e6a51a 100%);
}

.landing-showcase {
    position: relative;
    min-height: calc(100vh - 48px);
    overflow: hidden;
    isolation: isolate;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 8px;
    background: #16070b;
    box-shadow: 0 28px 80px rgba(34, 9, 16, 0.36);
}

.landing-photo-wrap,
.landing-photo-wrap::after {
    position: absolute;
    inset: 0;
}

.landing-photo-wrap::after {
    content: "";
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(25, 6, 11, 0.82) 0%, rgba(54, 11, 19, 0.58) 28%, rgba(54, 11, 19, 0.04) 62%),
        linear-gradient(0deg, rgba(12, 8, 10, 0.42) 0%, rgba(12, 8, 10, 0.02) 42%);
    pointer-events: none;
}

.landing-photo {
    display: block;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 48px);
    object-fit: cover;
    object-position: center;
}

.landing-overlay {
    position: relative;
    z-index: 2;
    display: grid;
    min-height: calc(100vh - 48px);
    grid-template-rows: auto 1fr;
    gap: 24px;
    padding: 28px;
}

.landing-navline {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 12px;
    min-width: 0;
    padding: 10px 14px 10px 10px;
    color: #ffffff;
    background: rgba(30, 8, 14, 0.54);
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(25, 6, 11, 0.22);
    backdrop-filter: blur(18px);
}

.landing-brand-mark {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    overflow: hidden;
    flex: 0 0 auto;
    background: #ffffff;
    border-radius: 8px;
}

.landing-brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.landing-navline strong,
.landing-navline small {
    display: block;
    overflow: hidden;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.landing-navline strong {
    font-size: 0.98rem;
    font-weight: 850;
}

.landing-navline small {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.78rem;
    font-weight: 700;
}

.landing-copy-block {
    align-self: end;
    max-width: 570px;
    padding-bottom: 18px;
    text-shadow: 0 16px 38px rgba(18, 6, 9, 0.42);
}

.landing-kicker {
    display: block;
    margin-bottom: 10px;
    color: #f2b11f;
    font-size: 0.95rem;
    font-weight: 850;
    letter-spacing: 0;
}

.landing-copy-block h1 {
    margin: 0;
    color: #ffffff;
    max-width: 15ch;
    font-size: 3.25rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0;
}

.landing-copy-block p {
    max-width: 500px;
    margin: 16px 0 0;
    color: rgba(255, 255, 255, 0.86);
    font-size: 1rem;
    line-height: 1.65;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
}

.landing-stage .btn,
.landing-auth-dialog .btn {
    border-radius: 8px;
}

.landing-login-trigger {
    min-width: 156px;
    justify-content: center;
    background: linear-gradient(135deg, #8b1022, #c99212);
    box-shadow: 0 18px 34px rgba(61, 10, 20, 0.26);
}

.landing-login-trigger .icon {
    transition: transform 160ms ease;
}

.landing-login-trigger:hover .icon {
    transform: translateX(3px);
}

.landing-register-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 16px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.13);
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    backdrop-filter: blur(14px);
}

.landing-register-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.22);
}

.landing-auth-dialog {
    width: min(430px, calc(100vw - 32px));
    max-width: 430px;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.62);
    border-radius: 8px;
    background: rgba(255, 252, 248, 0.98);
    box-shadow: 0 30px 90px rgba(24, 7, 12, 0.34);
}

.landing-auth-dialog::backdrop {
    background: rgba(20, 6, 10, 0.62);
    backdrop-filter: blur(8px);
}

.landing-dialog-shell {
    gap: 18px;
    padding: 24px;
}

.landing-dialog-header {
    align-items: center;
}

.dialog-title-lockup {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.dialog-title-lockup small {
    display: block;
    color: #8b1022;
    font-size: 0.78rem;
    font-weight: 850;
    line-height: 1.1;
}

.dialog-title-lockup h2 {
    margin: 2px 0 0;
    color: var(--text);
    font-size: 1.6rem;
    line-height: 1.05;
}

.dialog-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #ffffff;
    background: linear-gradient(135deg, #8b1022, #c99212);
    border-radius: 8px;
}

.landing-close {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    color: #4a1f28;
    background: var(--highlight);
    border: 1px solid rgba(74, 31, 40, 0.08);
    border-radius: 8px;
}

.landing-login-form {
    display: grid;
    gap: 0;
}

.landing-auth-dialog .dialog-form label {
    margin-bottom: 8px;
    color: var(--muted);
}

.landing-auth-dialog .input-group {
    margin-bottom: 16px;
}

.landing-auth-dialog .field-icon {
    color: #8b1022;
}

.landing-auth-dialog .field-action {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--muted);
    border-radius: 8px;
}

.landing-auth-dialog .field-action:hover {
    background: var(--highlight);
}

.landing-auth-dialog .dialog-form input:not([type="checkbox"]) {
    min-height: 52px;
    padding: 14px 50px 14px 48px;
    color: var(--text);
    border-color: rgba(74, 31, 40, 0.14);
    border-radius: 8px;
    background: #ffffff;
}

.landing-auth-dialog .dialog-form input:not([type="checkbox"]):focus {
    border-color: rgba(139, 16, 34, 0.68);
    box-shadow: 0 0 0 4px rgba(139, 16, 34, 0.12);
}

.landing-auth-dialog .dialog-form input::placeholder {
    color: rgba(96, 69, 80, 0.55);
}

.landing-auth-dialog .remember-row {
    margin: 0 0 18px;
}

.landing-auth-dialog .remember-label {
    color: #3c2229;
}

.landing-auth-dialog .remember-label input {
    border-radius: 4px;
    accent-color: #8b1022;
}

.landing-auth-dialog .forgot-link,
.landing-auth-dialog .modal-footnote a {
    color: #8b1022;
}

.landing-auth-dialog .btn-primary {
    min-height: 52px;
    background: linear-gradient(135deg, #8b1022, #5f101f);
}

.landing-auth-dialog .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-900));
}

.landing-auth-dialog .auth-divider {
    margin: 2px 0 0;
}

.landing-auth-dialog .auth-divider span {
    color: var(--muted);
    background: rgba(255, 252, 248, 0.98);
}

.landing-biometric-row {
    display: grid;
    gap: 10px;
    padding: 0;
}

.landing-biometric-row .btn {
    min-height: 50px;
    color: #3c2229;
    background: var(--accent);
    border: 1px solid rgba(139, 16, 34, 0.16);
    box-shadow: none;
}

.landing-biometric-row .btn:hover {
    color: var(--text);
    background: var(--highlight);
}

.landing-biometric-row .webauthn-status {
    margin: 0;
    text-align: center;
}

.landing-auth-dialog .modal-footnote {
    color: var(--muted);
}

@media (max-width: 900px) {
    .landing-stage {
        padding: 14px;
    }

    .landing-showcase,
    .landing-photo,
    .landing-overlay {
        min-height: calc(100vh - 28px);
    }

    .landing-photo {
        object-position: 62% center;
    }

    .landing-photo-wrap::after {
        background:
            linear-gradient(90deg, rgba(25, 6, 11, 0.86) 0%, rgba(54, 11, 19, 0.55) 48%, rgba(54, 11, 19, 0.08) 100%),
            linear-gradient(0deg, rgba(12, 8, 10, 0.5) 0%, rgba(12, 8, 10, 0.02) 48%);
    }

    .landing-overlay {
        padding: 18px;
    }

    .landing-copy-block {
        max-width: 440px;
    }

    .landing-copy-block h1 {
        font-size: 2.65rem;
    }
}

@media (max-width: 620px) {
    .landing-stage {
        padding: 0;
        background: #24070d;
    }

    .landing-showcase {
        min-height: 100vh;
        border: 0;
        border-radius: 0;
    }

    .landing-photo,
    .landing-overlay {
        min-height: 100vh;
    }

    .landing-photo {
        object-position: 68% center;
    }

    .landing-overlay {
        padding: 16px;
    }

    .landing-navline {
        max-width: 100%;
    }

    .landing-copy-block {
        padding-bottom: 12px;
    }

    .landing-copy-block h1 {
        max-width: 12ch;
        font-size: 2.05rem;
    }

    .landing-copy-block p {
        max-width: 20rem;
        font-size: 0.98rem;
    }

    .landing-actions {
        align-items: stretch;
        flex-direction: column;
        width: min(100%, 310px);
    }

    .landing-login-trigger,
    .landing-register-link {
        width: 100%;
        justify-content: center;
    }

    .landing-dialog-shell {
        padding: 20px;
    }

    .landing-auth-dialog .remember-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }
}

.loader {
    position: relative;
    overflow: hidden;
}

.loader::after {
    position: absolute;
    inset: 0;
    content: "";
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    animation: shimmer 1.6s infinite;
    transform: translateX(-100%);
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

@media (max-width: 1180px) {
    .topbar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .topbar-search {
        display: none;
    }

    .metric-grid,
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .compact-stat-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .librarian-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .librarian-work-grid,
    .librarian-archive-grid,
    .librarian-analytics-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-command-grid {
        grid-template-columns: 1fr;
    }

    .quick-panel-stack {
        position: static;
    }

    .department-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content-grid.three-col,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .department-filter-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .department-capstone-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 920px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 180ms ease;
    }

    .sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 45;
        display: none;
        background: rgba(15, 23, 42, 0.42);
    }

    .sidebar-open .sidebar-backdrop {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .topbar {
        left: 0;
        grid-template-columns: auto minmax(0, 1fr) auto;
        padding-inline: 16px;
    }

    .university-masthead {
        width: min(100%, 360px);
        height: 38px;
        gap: 9px;
    }

    .university-seal {
        width: 30px !important;
        height: 30px !important;
        max-width: 30px !important;
        max-height: 30px !important;
    }

    .university-copy strong {
        font-size: 0.95rem;
    }

    .university-copy small {
        font-size: 0.64rem;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .profile-copy {
        display: none;
    }

    .dashboard-grid,
    .content-grid,
    .analytics-sections,
    .ai-checker-grid,
    .directory-grid,
    .dashboard-analytics-stack {
        grid-template-columns: 1fr;
    }

    .filter-bar,
    .history-filter {
        grid-template-columns: 1fr 1fr;
    }

    .record-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .department-section.maximized {
        inset: calc(var(--topbar-height) + 12px) 16px 16px;
    }
}

/* Additional mobile-specific fixes to improve sidebar scrolling, text wrapping,
   horizontal overflow prevention, and touch targets on small viewports. */
@media (max-width: 920px) {
    body {
        overflow-x: hidden;
    }

    .app-sidebar {
        width: min(320px, 86vw);
        max-width: min(320px, 86vw);
        height: 100vh;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        box-shadow: 0 12px 40px rgba(0,0,0,0.18);
        transition: transform 180ms ease;
    }

    .app-sidebar .sidebar-nav {
        max-height: calc(100vh - 160px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 24px;
    }

    /* When the sidebar is open, raise it above other elements and prevent
       the background from receiving touch events. */
    .sidebar-open .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(0) !important;
        z-index: 1000;
    }

    /* Ensure backdrop blocks interaction only when visible */
    .sidebar-backdrop {
        pointer-events: none;
    }

    .sidebar-open .sidebar-backdrop {
        pointer-events: auto;
    }

    /* Ensure stacking order so interactive elements remain reachable */
    .topbar {
        z-index: 60;
    }

    .app-sidebar {
        z-index: 70;
    }

    .dropdown-menu {
        z-index: 80;
    }

    /* Prevent headings and list items from overflowing their containers */
    .librarian-dashboard .list-item strong,
    .dashboard-hero h1,
    .chart-card .card-header-row h2 {
        overflow-wrap: break-word;
        word-break: break-word;
        white-space: normal;
    }

    .librarian-dashboard .list-item strong {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chart-card-body canvas {
        max-width: 100%;
    }

    /* Protect against horizontal overflow on narrow viewports */
    .metric-grid,
    .dashboard-command-grid {
        overflow-x: hidden;
    }

    /* Improve touch behavior for interactive controls */
    .icon-button,
    .btn,
    .sidebar-link {
        touch-action: manipulation;
    }
}

@media (max-width: 640px) {
    /* Respect iOS and other safe areas so bottom toolbar doesn't cover content */
    .app-main {
        padding-bottom: calc(6rem + env(safe-area-inset-bottom));
    }

    html, body {
        padding-bottom: env(safe-area-inset-bottom);
    }
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 16px;
    }

    .guest-nav {
        width: 100%;
        justify-content: space-between;
    }

    .auth-shell,
    .page-shell {
        padding: 16px;
    }

    .panel,
    .auth-panel {
        padding: 18px;
    }

    .university-masthead {
        width: min(100%, 260px);
        height: 34px;
        gap: 8px;
    }

    .university-seal {
        width: 28px !important;
        height: 28px !important;
        max-width: 28px !important;
        max-height: 28px !important;
    }

    .university-copy strong {
        font-size: 0.8rem;
    }

    .university-copy small {
        font-size: 0.54rem;
    }

    .page-heading,
    .dashboard-hero,
    .card-header-row,
    .capstone-header,
    .file-review-info,
    .app-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-hero h1,
    .page-heading h1,
    h1 {
        font-size: 1.55rem;
    }

    .metric-grid,
    .stats-grid,
    .compact-stat-grid,
    .librarian-stat-grid,
    .department-card-grid,
    .department-filter-bar,
    .department-capstone-grid,
    .capstone-entry-meta,
    .department-card-meta,
    .filter-bar,
    .history-filter,
    .form-grid,
    .form-row,
    .record-detail-grid,
    .scan-input-row,
    .bar-row {
        grid-template-columns: 1fr;
    }

    .librarian-dashboard .list-item {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions {
        gap: 6px;
    }

    .notification-menu,
    .profile-menu {
        right: -8px;
        width: min(320px, calc(100vw - 24px));
    }

    .topbar .dropdown-menu.show {
        position: fixed !important;
        top: calc(var(--topbar-height) + 10px) !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: min(320px, calc(100vw - 24px)) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100vh - 96px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .topbar-actions,
    .topbar .dropdown {
        overflow: visible;
    }
}

/* Compact guest auth screens and unified internal palette */
body.app-body:not(.guest-body) {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 247, 249, 0.96)),
        var(--background);
}

.app-sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 241, 246, 0.94)),
        var(--surface-solid);
    border-right: 1px solid var(--border);
}

.topbar,
.site-header {
    background: rgba(255, 252, 248, 0.9);
    border-color: var(--border);
}

.sidebar-link:hover,
.sidebar-link.active {
    color: var(--primary-900);
    background: var(--primary-alpha);
}

.sidebar-link.active {
    box-shadow: inset 3px 0 0 var(--secondary);
}

.panel,
.glass-card,
.dashboard-card,
.metric-card,
.analytics-card,
.chart-panel,
.form-panel,
.directory-panel,
.auth-panel,
.capstone-card,
.checker-panel,
.results-panel,
.create-capstone-section,
.rfid-result {
    background: var(--surface);
    border-color: var(--border);
    box-shadow: var(--shadow-soft);
}

.metric-card,
.stat-card,
.dashboard-card,
.analytics-card,
.chart-panel,
.checker-panel,
.results-panel,
.create-capstone-section,
.capstone-card,
.rfid-result {
    background: var(--surface-solid);
    border-color: var(--border);
}

.dashboard-hero {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 241, 246, 0.92)),
        var(--surface-solid);
    border-color: var(--border);
}

.metric-icon,
.stat-icon,
.role-badge,
.status-badge,
.status-pill,
.status-tag,
.badge {
    border-color: rgba(139, 16, 34, 0.12);
}

.metric-icon,
.stat-icon,
.role-badge {
    color: var(--primary);
    background: var(--primary-alpha);
}

.btn,
button.btn,
a.btn,
.btn-primary,
.btn-primary-maroon,
.btn-approve {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary), var(--primary-700));
    border-color: rgba(139, 16, 34, 0.46);
    box-shadow: 0 12px 24px rgba(139, 16, 34, 0.14);
}

.btn:hover,
button.btn:hover,
a.btn:hover,
.btn-primary:hover,
.btn-primary-maroon:hover,
.btn-approve:hover {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-700), var(--primary-900));
    border-color: rgba(37, 6, 12, 0.42);
}

.btn-secondary,
.btn-tertiary,
.btn-outline-maroon,
.btn-decline {
    color: var(--primary);
    background: rgba(255, 252, 248, 0.92);
    border-color: var(--border);
    box-shadow: none;
}

.btn-secondary:hover,
.btn-tertiary:hover,
.btn-outline-maroon:hover,
.btn-decline:hover {
    color: var(--primary-900);
    background: var(--accent);
}

.data-table th,
.filter-bar,
.table-wrap,
.notification-menu,
.dropdown-menu {
    background: var(--surface-solid);
    border-color: var(--border);
}

.filter-bar input,
.filter-bar select,
.form-input,
.form-textarea,
.approval-form input[type="date"],
.approval-form input[type="text"],
.scan-input-row input {
    border-color: var(--border);
}

.compact-auth-shell {
    display: grid;
    min-height: 100vh;
    padding: clamp(14px, 3vh, 30px);
    place-items: center;
}

body.guest-body .compact-auth-shell {
    min-height: 100vh;
}

.compact-auth-panel {
    width: min(100%, 760px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    margin: 0 auto;
    padding: clamp(18px, 3vw, 24px);
    border-radius: 8px;
}

.compact-auth-panel-narrow {
    width: min(100%, 440px);
}

.compact-auth-header {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.compact-auth-header .eyebrow {
    margin: 0;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.compact-auth-header h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.35rem, 2.4vw, 1.65rem);
    line-height: 1.08;
}

.compact-auth-header p {
    max-width: 42rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.compact-auth-form {
    display: grid;
    gap: 12px;
}

.compact-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.compact-field {
    display: grid;
    min-width: 0;
    gap: 6px;
}

.compact-field--full {
    grid-column: 1 / -1;
}

.compact-auth-panel .stacked-form label,
.compact-auth-panel label {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.compact-auth-panel .stacked-form input,
.compact-auth-panel .stacked-form textarea,
.compact-auth-panel .stacked-form select {
    min-height: 42px;
    padding: 9px 12px;
    color: var(--text);
    border-color: var(--border);
    border-radius: 8px;
    background: #ffffff;
    font-size: 0.94rem;
}

.compact-auth-panel .stacked-form input:focus,
.compact-auth-panel .stacked-form textarea:focus,
.compact-auth-panel .stacked-form select:focus {
    border-color: rgba(139, 16, 34, 0.62);
    box-shadow: 0 0 0 4px rgba(139, 16, 34, 0.1);
}

.compact-auth-panel .btn {
    min-height: 44px;
    border-radius: 8px;
}

.compact-auth-panel .alert {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.92rem;
}

.small-link {
    margin: 16px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
}

.small-link a {
    color: var(--primary);
    font-weight: 800;
}

.compact-auth-panel .resend-container {
    margin-top: 16px !important;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.compact-auth-panel .form-hint,
.compact-auth-panel .resend-timer {
    color: var(--muted);
    font-size: 0.88rem;
}

@media (max-width: 680px) {
    .compact-auth-shell {
        align-items: start;
        min-height: 100vh;
        padding: 12px;
    }

    .compact-auth-panel {
        width: 100%;
        max-height: none;
        padding: 18px;
    }

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

    .compact-field--full {
        grid-column: auto;
    }
}

/* Final system color cleanup: neutral surfaces with maroon/gold accents only */
body.app-body:not(.guest-body) {
    background: var(--background);
}

.app-sidebar,
.topbar,
.site-header,
.panel,
.glass-card,
.dashboard-card,
.metric-card,
.stat-card,
.analytics-card,
.chart-panel,
.form-panel,
.directory-panel,
.auth-panel,
.capstone-card,
.checker-panel,
.results-panel,
.create-capstone-section,
.rfid-result,
.table-wrap,
.dropdown-menu,
.notification-menu,
.filter-bar,
.data-table th,
.data-table tbody tr:hover,
.abstract-text,
.flagged-issues,
.issues-section,
.file-review-item,
.uploaded-files li,
.empty-state,
.delete-summary {
    background: var(--surface-solid);
    border-color: var(--border);
}

.dashboard-hero,
.department-card,
.department-section,
.notification-tabs,
.notification-item.empty,
.topbar-search,
.search-suggestions,
.sidebar-profile,
.record-detail-grid > div {
    background: var(--accent);
    border-color: var(--border);
}

.brand-mark,
.brand-mark img,
.icon-button,
.profile-button,
.avatar,
.avatar-sm,
.role-badge,
.dashboard-hero .role-badge,
.metric-icon,
.stat-icon,
.department-card-icon,
.notification-item.empty .notification-empty-icon {
    background: var(--highlight);
    border-color: var(--border);
    color: var(--primary);
}

.sidebar-link:hover,
.sidebar-link.active,
.tab-button.active,
.suggestion-item:hover,
.profile-menu a:hover,
.profile-menu button:hover,
.notification-item:hover {
    background: var(--primary-alpha);
    color: var(--primary-900);
}

.metric-card::after,
.bar-fill {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
}

.donut-chart,
.score-donut {
    background: conic-gradient(var(--primary) var(--approved, var(--score, 0%)), var(--highlight) 0);
}

.borrow-status-cancelled,
.status-inactive {
    color: var(--muted);
    background: var(--highlight);
}

.borrow-status-borrowed,
.status-borrowed,
.status-pending,
.status-flagged,
.status-on_hold,
.status-needs-revision,
.status-moderate,
.borrow-status-pending,
.rfid-result-unassigned {
    color: var(--warning);
    background: var(--warning-bg);
}

.status-available,
.status-approved,
.status-active,
.status-low,
.borrow-status-returned,
.rfid-result-matched {
    color: var(--success);
    background: var(--success-bg);
}

.text-muted,
.stat-label,
.metric-label,
.borrower-stack .borrower-email,
.file-meta,
.file-size,
.file-date,
.table-note {
    color: var(--muted) !important;
}

code {
    color: var(--primary);
    background: var(--highlight);
}

.notification-menu {
    width: min(520px, calc(100vw - 32px));
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 8px;
}

.profile-menu {
    width: min(340px, calc(100vw - 32px));
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    overflow-x: hidden;
}

.topbar .dropdown {
    overflow: visible !important;
}

.topbar-actions {
    overflow: visible !important;
}

@media (min-width: 641px) {
    .topbar .dropdown-menu.show {
        position: fixed !important;
        top: calc(var(--topbar-height) + 10px) !important;
        right: 16px !important;
        left: auto !important;
        bottom: auto !important;
        max-width: calc(100vw - 32px) !important;
        max-height: calc(100vh - 96px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
}

.topbar .notification-menu.show {
    width: min(520px, calc(100vw - 32px));
}

.topbar .profile-menu.show {
    width: min(340px, calc(100vw - 32px));
}

.profile-menu-header {
    min-width: 0;
}

.profile-menu-header span,
.profile-menu-header strong,
.profile-menu-header small {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
}

[data-notification-list] {
    max-height: min(560px, calc(100dvh - 230px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 10px 12px;
}

.notification-item {
    min-height: auto;
    padding: 12px;
    gap: 6px;
}

.notification-item strong,
.notification-item span,
.notification-item small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.notification-item strong {
    line-height: 1.35;
}

.notification-item span {
    display: block;
    max-height: none;
    line-height: 1.45;
    overflow-wrap: anywhere;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
}

.notification-item small {
    line-height: 1.35;
}

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

.notification-actions .link-button {
    min-width: max-content;
    white-space: nowrap;
}

@media (max-width: 920px) {
    .app-sidebar {
        display: flex;
        flex-direction: column;
        width: min(300px, 84vw);
        max-width: min(300px, 84vw);
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden !important;
    }

    .app-sidebar .sidebar-nav {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        padding-bottom: 12px;
    }

    .app-sidebar .sidebar-footer {
        flex: 0 0 auto;
        margin-top: 0;
        padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
        background: var(--surface-solid);
        border-top: 1px solid var(--border);
    }

    .app-sidebar .sidebar-link {
        min-height: 42px;
        padding: 10px 11px;
        font-size: 0.94rem;
    }
}

@media (max-width: 640px) {
    .notification-menu {
        left: 50% !important;
        right: auto !important;
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 76px);
        transform: translateX(-50%) !important;
    }

    [data-notification-list] {
        max-height: calc(100dvh - 230px);
    }

    .dropdown-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .notification-actions {
        width: 100%;
        justify-content: space-between;
    }
}
