@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #166534;
    --secondary: #16a34a;
    --accent: #eab308;
    --success: #15803d;
    --danger: #ef4444;
    --warning: #eab308;
    --light: #f0fdf4;
    --dark: #14532d;
    --gray: #64748b;
    --border: #bbf7d0;
    --sidebar-w: 260px;
    --radius: 10px;
    --font: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(22,163,74,.25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(22,163,74,.45); }
* { scrollbar-width: thin; scrollbar-color: rgba(22,163,74,.25) transparent; }

body {
    font-family: var(--font);
    background: #f0fdf4;
    color: #1e293b;
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    overflow-x: hidden;
}

img,
svg,
canvas {
    max-width: 100%;
}

/* AUTH PAGES */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #166534 0%, #16a34a 100%);
    padding: 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-brand-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: .6rem;
}
.auth-brand-logos img {
    height: 64px;
    width: auto;
    object-fit: contain;
}
.auth-center-logo {
    height: 80px !important;
}
.auth-brand-name {
    font-size: .8rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.4;
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.auth-brand-name span {
    font-weight: 500;
    color: var(--gray);
    text-transform: none;
    font-size: .75rem;
}

.auth-logo h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.04em;
    font-family: var(--font);
}

.auth-logo span { color: var(--secondary); }
.auth-logo p { color: var(--gray); font-size: 0.8rem; margin-top: 4px; }

/* PASSWORD TOGGLE */
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 4.75rem; }
.pw-eye {
    position: absolute;
    right: .75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: .76rem;
    font-weight: 700;
    color: var(--gray);
    padding: .2rem;
    line-height: 1;
    min-width: 2.75rem;
    transition: color .2s;
}
.pw-eye:hover { color: var(--primary); }

/* GOOGLE BUTTON */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    width: 100%;
    padding: .7rem 1rem;
    border-radius: 8px;
    border: 1.5px solid #dadce0;
    background: #fff;
    color: #3c4043;
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .2s, box-shadow .2s;
    margin-bottom: .75rem;
}
.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: .75rem 0;
    color: #94a3b8;
    font-size: .78rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.captcha-widget {
    margin-bottom: 1rem;
}

.captcha-visual {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    flex-wrap: wrap;
}

.captcha-image {
    width: 210px;
    max-width: 100%;
    height: 74px;
    display: block;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #f0fdf4;
}

.captcha-refresh {
    min-width: 88px;
    justify-content: center;
}

.captcha-input {
    text-transform: uppercase;
    letter-spacing: .24em;
    font-weight: 700;
    text-align: center;
    font-size: 1rem;
}

.captcha-input.is-valid {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}

.captcha-input.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.captcha-hint {
    margin-top: .45rem;
    font-size: .75rem;
    color: var(--gray);
    line-height: 1.5;
}

.captcha-status {
    min-height: 1.15rem;
    margin-top: .45rem;
    font-size: .78rem;
    font-weight: 600;
}

.captcha-status.is-valid {
    color: #15803d;
}

.captcha-status.is-invalid {
    color: #b91c1c;
}

.captcha-status.is-neutral {
    color: var(--gray);
}

/* SETTINGS */
.settings-brand-block {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: .75rem 0;
}
.settings-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    flex-shrink: 0;
}
.settings-brand-text { flex: 1; }
.settings-brand-title { font-size: .95rem; font-weight: 700; color: var(--primary); line-height: 1.3; }
.settings-brand-sub { font-size: .78rem; color: var(--secondary); font-weight: 600; margin: .2rem 0 .4rem; }
.settings-brand-desc { font-size: .8rem; color: #64748b; line-height: 1.5; }
.settings-divider { border: none; border-top: 1px solid var(--border); margin: .75rem 0; }

/* LAYOUT */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
}

.sidebar-logo {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo h2 {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-family: var(--font);
}

.sidebar-logo h2 span { color: var(--accent); }
.sidebar-logo p { font-size: 0.65rem; opacity: 0.6; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section {
    padding: 0.6rem 1.25rem 0.2rem;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.45;
    font-family: var(--font);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: rgba(255,255,255,0.72);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    transition: all 0.18s;
    border-left: 3px solid transparent;
    letter-spacing: -0.01em;
    min-width: 0;
}

.nav-link span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--accent);
}

.nav-link .icon { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: .85; }
.nav-link:hover .nav-icon, .nav-link.active .nav-icon { opacity: 1; }

.page-tabs {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.page-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: #475569;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: border-color 0.18s, color 0.18s, background 0.18s, transform 0.18s;
}

.page-tab:hover {
    color: var(--primary);
    border-color: #86efac;
    transform: translateY(-1px);
}

.page-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

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

.status-card {
    padding: 1.2rem;
}

.status-kicker {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray);
    margin-bottom: 0.7rem;
}

.status-value {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.status-note {
    margin-top: 0.75rem;
    color: #475569;
    font-size: 0.84rem;
    line-height: 1.6;
}

.status-dot {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.status-dot.ok {
    background: #22c55e;
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
}

.status-dot.warn {
    background: #f59e0b;
    box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.14);
}

.status-dot.error {
    background: #ef4444;
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.14);
}

.status-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.8rem;
    opacity: 0.7;
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    min-width: 0;
    max-width: min(260px, 45vw);
}

.user-badge-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--secondary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.page-content { padding: 1.5rem; flex: 1; min-width: 0; }

/* CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    border: 1px solid var(--border);
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.yellow { background: #fef3c7; }
.stat-icon.red { background: #fee2e2; }

.stat-info h3 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.04em; }
.stat-info p { font-size: 0.78rem; color: var(--gray); font-weight: 500; }

/* CARD */
.card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.07);
    overflow: hidden;
    min-width: 0;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.card-header h3 { font-size: 0.9rem; font-weight: 700; letter-spacing: -0.02em; }
.card-body { padding: 1.25rem; min-width: 0; }

/* TABLE */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.875rem; }
thead th {
    background: #f0fdf4;
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 700;
    color: var(--gray);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid var(--border);
}
tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: break-word;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f0fdf4; }

/* BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-admin { background: #dcfce7; color: #166534; }
.badge-librarian { background: #dbeafe; color: #1d4ed8; }
.badge-user { background: #f1f5f9; color: #475569; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.18s;
    white-space: nowrap;
    letter-spacing: -0.01em;
    max-width: 100%;
}
.btn-primary { background: var(--secondary); color: #fff; }
.btn-primary:hover { background: #15803d; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: #475569;
}
.btn-outline:hover { background: #f8fafc; }
.btn:disabled,
.btn[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.4rem; letter-spacing: -0.01em; }
.form-control {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: var(--font);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    color: #1e293b;
}
.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
}
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* SEARCH BAR */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.search-bar .form-control { flex: 1; min-width: 200px; }

/* RESEARCH GRID */
.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.research-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: box-shadow 0.2s;
    min-width: 0;
}
.research-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.1); }

.research-card h4 {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--primary);
    letter-spacing: -0.02em;
}
.research-card .meta { font-size: 0.78rem; color: var(--gray); }
.research-card .abstract {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.research-card .actions { display: flex; gap: 0.5rem; margin-top: auto; flex-wrap: wrap; }

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    /* sit to the right of the sidebar, not over it */
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }

/* PDF preview modal — portrait A4-ish proportions */
#pdfModal {
    /* on mobile the sidebar is hidden, so cover full screen */
}
#pdfModal .modal {
    /* portrait: width drives height via aspect-ratio */
    width: min(520px, 90%);
    aspect-ratio: 3 / 4;
    max-height: calc(100vh - 2rem);
}
#pdfModal .modal-body iframe {
    min-height: unset;
    height: 100%;
}

.modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 0.92rem; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--gray);
    line-height: 1;
}
.modal-body { flex: 1; overflow: hidden; }
.modal-body iframe { width: 100%; height: 100%; min-height: 70vh; border: none; }

/* On mobile the sidebar collapses — modal covers full viewport */
@media (max-width: 768px) {
    .modal-overlay {
        left: 0;
    }
}

/* ALERTS */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-wrap: anywhere;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }

/* PAGINATION */
.pagination { display: flex; gap: 0.4rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.page-btn {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
    color: #475569;
    transition: all 0.2s;
}
.page-btn:hover, .page-btn.active {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
    border-color: var(--secondary);
}

/* HAMBURGER */
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #475569;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1rem; margin-bottom: 0.5rem; }

/* CHART CONTAINER */
.chart-container { position: relative; height: 250px; }

/* BOOK COVER GRID */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
}

.book-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}
.book-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transform: translateY(-3px);
}

.book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: linear-gradient(135deg, #166534, #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 3rem;
    flex-shrink: 0;
}
.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.book-info {
    padding: .875rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
    flex: 1;
}
.book-info h4 {
    font-size: .83rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.3;
    letter-spacing: -0.02em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.book-info .book-meta { font-size: .72rem; color: var(--gray); }
.book-info .book-actions { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }

/* DETAIL PANEL (Wattpad-style) */
.detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}
.detail-overlay.open { display: flex; }

.detail-panel {
    background: #fff;
    width: 100%;
    max-width: 680px;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.32,1,.23,1);
    padding-bottom: 2rem;
    min-width: 0;
}
.detail-overlay.open .detail-panel { transform: translateY(0); }

.detail-drag { width: 40px; height: 4px; background: #cbd5e1; border-radius: 4px; margin: .75rem auto .5rem; }

.detail-hero {
    display: flex;
    gap: 1.25rem;
    padding: 1rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.detail-cover {
    width: 100px;
    min-width: 100px;
    aspect-ratio: 2/3;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, #166534, #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.detail-cover img { width:100%; height:100%; object-fit:cover; display:block; }
.detail-meta { display: flex; flex-direction: column; justify-content: center; gap: .4rem; }
.detail-meta h2 { font-size: 1.05rem; font-weight: 800; color: var(--primary); line-height: 1.3; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.detail-meta .detail-author { font-size: .85rem; color: var(--gray); }
.detail-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .25rem; }
.detail-tag {
    background: #dcfce7;
    color: #166534;
    font-size: .72rem;
    font-weight: 600;
    padding: .2rem .6rem;
    border-radius: 20px;
}

.detail-body { padding: 1.25rem 1.5rem; }
.detail-section-title { font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--gray); margin-bottom: .5rem; }
.detail-description { font-size: .9rem; color: #334155; line-height: 1.7; }
.detail-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .75rem;
}
.detail-meta-item {
    padding: .75rem .85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}
.detail-meta-label {
    font-size: .63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gray);
    margin-bottom: .3rem;
}
.detail-meta-value {
    font-size: .82rem;
    color: #1e293b;
    line-height: 1.5;
    word-break: break-word;
}
.detail-actions { display: flex; gap: .75rem; padding: 0 1.5rem 1rem; flex-wrap: wrap; }

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

/* RECOMMENDATIONS */
.detail-recs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: .75rem;
}
.rec-card {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    background: #fff;
}
.rec-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
}
.rec-cover {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    background: linear-gradient(135deg, #166534, #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
}
.rec-cover img { width:100%; height:100%; object-fit:cover; display:block; }
.rec-info { padding: .4rem .5rem; }
.rec-info h5 {
    font-size: .72rem;
    font-weight: 600;
    color: var(--primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rec-info p { font-size: .65rem; color: var(--gray); margin-top: 2px; }

/* FAVORITES */
.fav-btn { background: transparent; border: 1px solid var(--border); color: #94a3b8; font-size: .85rem; }
.fav-btn:hover { border-color: #f43f5e; }
.fav-btn.fav-active { border-color: #f43f5e; background: #fff1f2; }

/* NOTIFICATION BELL */
.notif-bell {
    position: relative;
    font-size: 1.2rem;
    text-decoration: none;
    line-height: 1;
    padding: .25rem;
    display: flex;
    align-items: center;
}
.notif-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

/* COLLEGE BADGE */
.badge-college {
    background: #ede9fe;
    color: #5b21b6;
}

/* READING PROGRESS */
.progress-bar-wrap {
    height: 6px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: .35rem;
}
.progress-bar-fill {
    height: 100%;
    background: var(--secondary);
    border-radius: 4px;
    transition: width .4s;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar {
        width: min(88vw, 320px);
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .hamburger { display: block; }
    .topbar {
        padding: .9rem 1rem;
        gap: .75rem;
        flex-wrap: wrap;
    }
    .topbar > div:first-child {
        min-width: 0;
    }
    .topbar-title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .topbar-right {
        width: 100%;
        justify-content: space-between;
        gap: .75rem;
    }
    .page-content { padding: 1rem; }
    .card-header,
    .card-body { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .research-grid { grid-template-columns: 1fr; }
    .detail-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 1rem 1.1rem;
    }
    .detail-cover {
        width: 88px;
        min-width: 88px;
    }
    .detail-body { padding: 1rem; }
    .detail-actions { padding: 0 1rem 1rem; }
    .detail-actions .btn {
        flex: 1 1 calc(50% - .5rem);
        justify-content: center;
    }
    .upload-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .topbar-right {
        justify-content: flex-start;
    }
    .user-badge-name {
        display: none;
    }
    .status-grid,
    .book-grid {
        grid-template-columns: 1fr;
    }
    .table-wrap {
        margin: 0 -.15rem;
    }
    .detail-actions .btn {
        flex-basis: 100%;
    }
    .modal-overlay {
        padding: .75rem;
    }
    .modal {
        max-height: calc(100vh - 1.5rem);
        border-radius: 14px;
    }
    .modal-header { padding: .9rem 1rem; }
    .modal-body iframe { min-height: 60vh; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 1.25rem; }
    .auth-brand-logos { gap: .75rem; }
    .auth-brand-logos img { height: 52px; }
    .auth-center-logo { height: 70px !important; }
}
