:root {
    --bg-dark: #080B11;
    --surface-dark: #111622;
    --border-subtle: #1E2638;
    --gold-primary: #E5B869;
    --gold-gradient: linear-gradient(135deg, #F5D089 0%, #C8963E 100%);
    --text-white: #FFFFFF;
    --text-muted: #8A94A6;
    --success: #10B981;
    --danger: #EF4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

/* Lock page scroll on auth view only */
body:has(#view-auth.active) {
    overflow: hidden;
}

body:has(#view-auth.active) .bottom-nav {
    display: none !important;
}

body:has(#view-auth.active) .view {
    padding-bottom: 0;
}

/* SPA View Controller */
.view {
    display: none;
    width: 100%;
    max-width: 480px;
    padding: 20px;
    padding-bottom: 90px;
}

.view.active {
    display: block;
}

/* Typography */
.serif-title {
    font-family: 'Georgia', serif;
    color: var(--gold-primary);
    text-align: center;
    font-size: 2rem;
    margin-bottom: 8px;
}

.gold-icon {
    color: var(--gold-primary);
}

.sub-text, .sub-caption {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

/* Buttons */
.btn {
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-gold {
    background: var(--gold-gradient);
    color: #000000;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-white);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Card Containers */
.auth-card, .onboarding-container, .profile-card, .admin-card, .stats-card {
    background-color: var(--surface-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px;
    margin-top: 20px;
}

/* Form Inputs */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-input, .search-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    color: var(--text-white);
    outline: none;
}

.form-input:focus, .search-input:focus {
    border-color: var(--gold-primary);
}

.input-icon-wrap {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.input-icon-wrap .form-input {
    padding-right: 44px;
    flex: 1;
}

.input-icon-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    line-height: 1;
}

.input-icon-btn:hover {
    color: var(--gold-primary);
}

/* Auth Extras */
.auth-error {
    display: none;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.35);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 14px;
}

.auth-error.show {
    display: block;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 18px 0 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

#google-btn i {
    margin-right: 8px;
}

.auth-toggle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 18px;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Genre Cards Grid */
.genre-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.genre-card {
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}

.genre-card.selected {
    border-color: var(--gold-primary);
    background: rgba(229, 184, 105, 0.1);
    color: var(--gold-primary);
}

/* Stats Layout */
.stats-grid {
    display: flex;
    justify-content: space-around;
    margin-top: 16px;
    text-align: center;
}

.stat-box {
    text-align: center;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
}

button.stat-box {
    appearance: none;
    -webkit-appearance: none;
}

.stat-box--clickable {
    cursor: pointer;
    border-radius: 12px;
    padding: 8px 14px;
    margin: -8px -14px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.stat-box--clickable:hover {
    background: rgba(229, 184, 105, 0.08);
    transform: translateY(-1px);
}

.stat-box--clickable:focus-visible {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

.stat-box--clickable:active {
    transform: translateY(0);
}

.stat-box strong {
    display: block;
    font-size: 1.2rem;
    color: var(--gold-primary);
}

.stat-box span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Catalog Grid */
.catalog-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.book-card {
    background: var(--surface-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 12px;
}

.book-cover {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--surface-dark);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-around;
    padding: 12px 0;
    z-index: 100;
}

.bottom-nav[hidden] {
    display: none !important;
}

.back-nav-btn {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--surface-dark);
    border-top: 1px solid var(--border-subtle);
    border-left: none;
    border-right: none;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-white);
    cursor: pointer;
    z-index: 100;
}

.back-nav-btn i {
    color: var(--gold-primary);
}

.back-nav-btn[hidden] {
    display: none !important;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    position: relative;
}

.nav-item.active {
    color: var(--gold-primary);
}

.nav-item.active i {
    color: var(--gold-primary);
}

.nav-item.active::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 3px;
    border-radius: 999px;
    background: var(--gold-gradient);
}

/* Profile Photo Preview */
.avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold-primary);
}

.file-input {
    display: none;
}

/* Profile preferences */
.profile-preferences {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.pref-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.pref-header h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-white);
}

.genre-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.genre-chips .category-chip {
    font-size: 0.78rem;
    padding: 6px 10px;
}

.genre-edit-panel {
    margin-top: 12px;
    padding: 12px;
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}

.profile-contact {
    margin-top: 12px;
    padding: 14px 18px;
    background: var(--surface-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
}

.profile-contact-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.profile-contact-item:hover {
    color: var(--gold-primary);
}

.profile-contact-item i {
    color: var(--gold-primary);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}

.genre-edit-panel[hidden] {
    display: none !important;
}

.user-details {
    text-align: center;
    margin-bottom: 6px;
}

.user-details h3 {
    font-size: 1.15rem;
    margin-bottom: 6px;
}

.user-details .sub-text {
    font-size: 0.85rem;
    word-break: break-all;
}

/* ============ Dashboard: Catalog & Loans ============ */
.empty-state {
    padding: 24px 0;
}

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

/* Section title with search — used in dashboard */
.section-title {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 14px;
    position: relative;
}

.section-title h4 {
    font-size: 0.98rem;
    font-weight: 600;
    white-space: nowrap;
}

.catalog-search-wrap {
    position: relative;
    width: 100%;
    max-width: none;
    display: flex;
    align-items: center;
}

.catalog-search-wrap .search-input {
    width: 100%;
    padding-right: 42px;
}

.catalog-filter-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--surface-dark);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.catalog-filter-btn:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    background: rgba(229, 184, 105, 0.08);
}

.catalog-filter-btn.active {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
    background: rgba(229, 184, 105, 0.14);
}

.catalog-filter-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    z-index: 30;
    background: var(--surface-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.18s ease;
    max-height: min(60vh, 420px);
    overflow-y: auto;
}

.catalog-filter-panel[hidden] {
    display: none !important;
}

.filter-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.filter-group .form-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #0D121D;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23E5B869' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.filter-group .form-input:hover {
    border-color: rgba(229, 184, 105, 0.4);
    background-color: #11182A;
}

.filter-group .form-input:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(229, 184, 105, 0.14);
    outline: none;
}

/* Dropdown options — dark theme */
.filter-group .form-input option {
    background: #0D121D;
    color: var(--text-white);
    padding: 10px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.catalog-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.catalog-pagination[hidden] {
    display: none !important;
}

.pagination-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: var(--surface-dark);
    color: var(--text-white);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.page-btn.active {
    background: var(--gold-gradient);
    border-color: transparent;
    color: #000000;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-ellipsis {
    color: var(--text-muted);
    padding: 0 4px;
    user-select: none;
}

.page-info {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    width: 100%;
}

@media (max-width: 360px) {
    .filter-row {
        grid-template-columns: 1fr;
    }
}

.book-card {
    background-color: var(--surface-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.book-tile {
    height: 110px;
    border-radius: 10px;
    background: var(--gold-gradient);
    color: #000000;
    font-family: 'Georgia', serif;
    font-size: 2.2rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.book-title {
    font-size: 0.95rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.book-author {
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-chip {
    align-self: flex-start;
    font-size: 0.68rem;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(229, 184, 105, 0.12);
    color: var(--gold-primary);
    border: 1px solid rgba(229, 184, 105, 0.35);
}

.book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 6px;
}

.rating {
    font-size: 0.75rem;
    color: var(--gold-primary);
}

.availability-badge {
    font-size: 0.66rem;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

.availability-badge.available {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.availability-badge.out {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.loans-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.loan-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--surface-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
}

.loan-icon {
    width: 40px;
    height: 48px;
    border-radius: 8px;
    background: var(--gold-gradient);
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.loan-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.loan-info strong {
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loan-info span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.loan-status {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.due-text {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.overdue-badge {
    background: var(--danger);
    color: #FFFFFF;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 999px;
}

/* ============ Admin: Inventory Table ============ */
.table-wrap {
    overflow-x: auto;
}

.inventory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.inventory-table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 6px;
    border-bottom: 1px solid var(--border-subtle);
}

.inventory-table td {
    padding: 10px 6px;
    border-bottom: 1px solid rgba(30, 38, 56, 0.6);
    vertical-align: middle;
}

.inv-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.inv-thumb {
    width: 32px;
    height: 44px;
    border-radius: 6px;
    background: var(--gold-gradient);
    color: #000000;
    font-family: 'Georgia', serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.inv-title-link {
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    color: inherit;
    font: inherit;
    text-align: left;
    border-radius: 6px;
    transition: opacity 0.15s ease;
}

.inv-title-link:focus-visible {
    outline: 2px solid var(--gold-primary);
    outline-offset: 2px;
}

.inv-title-link:hover strong {
    color: var(--gold-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.inventory-table tr.editing td {
    background: rgba(229, 184, 105, 0.08);
}

.inventory-table tr.editing .inv-title-link strong {
    color: var(--gold-primary);
}

.stock-controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.stock-btn {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: #0D121D;
    color: var(--text-white);
    cursor: pointer;
    font-weight: 700;
    transition: border-color 0.2s ease;
}

.stock-btn:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.delete-btn {
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: transparent;
    color: var(--danger);
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.2s ease;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.12);
}

/* ============ Admin Portal ============ */
.admin-login-card {
    margin-top: 12vh;
    text-align: center;
}

.admin-shield {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: var(--gold-gradient);
    color: #000000;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

/* Layout utilities (previously unstyled) */
.mt-4 {
    margin-top: 16px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 720px) {
    body:has(#admin-panel-view.active) .view {
        max-width: 960px;
    }

    .admin-grid {
        grid-template-columns: 1fr 1fr;
    }

    .full-width {
        grid-column: 1 / -1;
    }
}

.admin-card h3 {
    font-size: 1rem;
    margin-bottom: 14px;
}

/* Admin moderation tabs (reports / reviews) */
.mod-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.mod-tab-btn {
    flex: 1;
    padding: 10px 8px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: #0D121D;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mod-tab-btn.active {
    background: var(--gold-gradient);
    color: #000;
    border-color: transparent;
}

.mod-pane[hidden] {
    display: none !important;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
}

.admin-borrow-item {
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
}

.admin-btn-row {
    display: flex;
    gap: 10px;
}

.admin-btn-row .btn {
    flex: 1;
}

.inline-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 720px) {
    .inline-form {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
        align-items: center;
    }
}

/* ============ Student Lookup ============ */
#issue-student-result[hidden] {
    display: none !important;
}

.lookup-row {
    display: flex;
    gap: 10px;
}

.lookup-row .form-input {
    flex: 1;
}

.lookup-row .btn {
    flex-shrink: 0;
}

.lookup-search-wrap {
    position: relative;
    flex: 1;
}

.lookup-search-wrap .form-input {
    padding-right: 38px;
}

.lookup-search-clear {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lookup-search-clear:hover {
    background: rgba(239, 68, 68, 0.25);
    color: var(--text-white);
}

/* ============ Book Search Combobox (Issue Physical Book) ============ */
.combo-wrap {
    position: relative;
}

.combo-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
    max-height: 260px;
    overflow-y: auto;
}

.combo-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-white);
    font-size: 0.85rem;
    cursor: pointer;
}

.combo-item:last-child {
    border-bottom: none;
}

.combo-item small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.combo-item.active,
.combo-item:hover {
    background: rgba(212, 175, 55, 0.12);
}

.combo-empty {
    color: var(--text-muted);
    cursor: default;
    padding: 12px 14px;
    font-size: 0.85rem;
    text-align: left;
}

.combo-empty:hover {
    background: transparent;
}

.student-hits {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.student-hit {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text-white);
    text-align: left;
    transition: border-color 0.2s ease;
}

.student-hit:hover {
    border-color: var(--gold-primary);
}

.hit-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hit-text small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.student-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.student-avatar {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: var(--gold-gradient);
    color: #000000;
    font-family: 'Georgia', serif;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

img.student-avatar {
    object-fit: cover;
    display: block;
}

.thumb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.student-name {
    margin-bottom: 4px;
}

.id-badge {
    display: inline-block;
    background: rgba(229, 184, 105, 0.12);
    border: 1px solid rgba(229, 184, 105, 0.35);
    color: var(--gold-primary);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 3px 9px;
    border-radius: 999px;
}

.student-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.field-box {
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px 12px;
}

.field-box .lbl {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.field-box .val {
    font-size: 0.88rem;
    word-break: break-word;
}

.section-subhead {
    font-size: 0.95rem;
    color: var(--gold-primary);
    margin: 6px 0 8px;
}

.status-chip {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 3px 8px;
    border-radius: 999px;
}

.status-active {
    color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}

.status-overdue {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.15);
}

.status-returned {
    color: var(--text-muted);
    background: rgba(138, 148, 166, 0.15);
}

.status-pending-chip {
    color: var(--gold-primary);
    background: rgba(212, 175, 55, 0.15);
}

.val.status-active { color: var(--success); }
.val.status-out { color: var(--danger); }

/* ============ Logout Confirmation Modal ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
    animation: modalFadeIn 0.2s ease;
}

.modal-card {
    background: var(--surface-dark);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 28px 24px 24px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.25s ease;
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
}

.modal-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 22px;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions .btn {
    flex: 1;
}

#logout-confirm-btn {
    background: var(--danger);
    color: #FFFFFF;
}

#logout-confirm-btn:hover {
    background: #DC2626;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ Reading History Modal ============ */
.modal-card--scroll {
    max-width: 460px;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: #0D121D;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.modal-close-btn:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.modal-icon--gold {
    background: rgba(229, 184, 105, 0.14);
    border-color: rgba(229, 184, 105, 0.3);
    color: var(--gold-primary);
}

.read-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0 8px;
    max-height: 42vh;
    overflow-y: auto;
    padding-right: 4px;
    text-align: left;
}

.read-history-list::-webkit-scrollbar {
    width: 6px;
}

.read-history-list::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 999px;
}

.read-book-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    transition: border-color 0.2s ease;
}

.read-book-item:hover {
    border-color: rgba(229, 184, 105, 0.35);
}

.read-book-thumb {
    width: 40px;
    height: 48px;
    border-radius: 8px;
    background: var(--gold-gradient);
    color: #000000;
    font-family: 'Georgia', serif;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.read-book-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.read-book-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-book-author {
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.read-book-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    text-align: right;
}

.read-book-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.read-book-chip {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.read-history-empty {
    padding: 28px 12px;
    text-align: center;
}

.read-history-empty .empty-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(229, 184, 105, 0.1);
    border: 1px solid rgba(229, 184, 105, 0.2);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.3rem;
}

.read-history-actions {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(30, 38, 56, 0.6);
}

/* ============ Subscription Details Modal ============ */
.sub-details-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0 8px;
    text-align: left;
}

.sub-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 14px;
}

.sub-detail-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.sub-detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-white);
    text-align: right;
    word-break: break-word;
}

.sub-detail-value.gold {
    color: var(--gold-primary);
}

.sub-detail-value.success {
    color: var(--success);
}

.sub-detail-value.muted {
    color: var(--text-muted);
}

/* ============ Membership (Spec B) ============ */
.membership-card-box {
    text-align: left;
}

.membership-card-box .serif-title {
    text-align: center;
}

.membership-card-box .sub-text {
    text-align: center;
}

.membership-plan-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

@media (min-width: 420px) {
    .membership-plan-btns {
        flex-direction: row;
    }

    .membership-plan-btns .btn {
        flex: 1;
    }
}

.membership-plan-btns .btn.active {
    background: var(--gold-gradient);
    color: #000000;
    border-color: transparent;
    box-shadow: 0 0 0 2px rgba(229, 184, 105, 0.25);
}

.membership-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #0D121D;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 14px;
}

.membership-steps .sub-text {
    text-align: left;
}

.bkash-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #0D121D;
    border: 1px dashed rgba(229, 184, 105, 0.5);
    border-radius: 12px;
    padding: 10px 12px;
    margin-top: 12px;
}

.bkash-number {
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--gold-primary);
}

.membership-status-card {
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.88rem;
    border: 1px solid var(--border-subtle);
    background: #0D121D;
}

.membership-status-card strong {
    font-size: 0.92rem;
}

.membership-status-card code {
    background: rgba(229, 184, 105, 0.12);
    padding: 1px 6px;
    border-radius: 6px;
    font-family: inherit;
}

.membership-status-card.status-active {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
}

.membership-status-card.status-pending {
    border-color: rgba(229, 184, 105, 0.5);
    background: rgba(229, 184, 105, 0.08);
}

.membership-status-card.status-expired,
.membership-status-card.status-rejected {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.07);
}

/* ============ Admin Pending Queue (Spec B) ============ */
.pending-item {
    border-left: 3px solid var(--gold-primary);
}

.pending-item.pending-overdue {
    border-left-color: var(--danger);
    border-color: rgba(239, 68, 68, 0.45);
}

.sla-bar {
    height: 6px;
    border-radius: 999px;
    background: rgba(138, 148, 166, 0.2);
    overflow: hidden;
    margin-top: 6px;
}

.sla-fill {
    height: 100%;
    background: var(--gold-gradient);
    transition: width 0.3s ease;
}

.sla-fill.overdue {
    background: var(--danger);
}

/* ============ Expired Membership Alert ============ */
.membership-alert[hidden] { display: none; }
.membership-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 14px;
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.12);
    color: var(--text-white);
    font-size: 0.82rem;
}
.membership-alert i { flex: 0 0 auto; color: var(--danger); font-size: 0.95rem; }
.membership-alert span { flex: 1 1 auto; line-height: 1.3; }
.membership-alert .btn { flex: 0 0 auto; white-space: nowrap; padding: 5px 10px; font-size: 0.78rem; }