/* ============================================================
   ADMIN PANEL — Warm Editorial
   Mobile: Bottom tab bar (app feel)
   Desktop: Sidebar (software feel)
   ============================================================ */

/* ============ DESKTOP LAYOUT ============ */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--paper);
}

/* ============ SIDEBAR (Desktop only) ============ */
.sidebar {
    width: 264px;
    background: var(--white);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 24px 22px 22px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    gap: 14px;
}

.sidebar-brand-icon {
    width: 48px;
    height: 48px;
    background: var(--teal);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-teal);
    position: relative;
}
.sidebar-brand-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--r-sm);
    border: 1px solid rgba(255,255,255,0.15);
}

.sidebar-brand-icon svg {
    width: 26px;
    height: 26px;
    color: var(--white);
}

.sidebar-brand-text {
    flex: 1;
    min-width: 0;
}

.sidebar-brand-text h3 {
    font-family: var(--font-mr);
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 4px;
    letter-spacing: 0;
}

.sidebar-brand-text span {
    font-size: 10px;
    color: var(--text-mute);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-sans);
}

.sidebar-menu {
    padding: 20px 14px;
    list-style: none;
    flex: 1;
}

.sidebar-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-mute);
    padding: 16px 14px 8px;
    font-weight: 700;
    font-family: var(--font-sans);
}

.sidebar-menu li {
    margin-bottom: 2px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-soft);
    border-radius: var(--r-sm);
    transition: all 0.15s;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.sidebar-menu a:hover {
    background: var(--paper-warm);
    color: var(--text);
}

.sidebar-menu a.active {
    background: var(--teal-bg);
    color: var(--teal-dark);
    font-weight: 600;
}

.sidebar-menu a.active::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--teal);
    border-radius: 0 2px 2px 0;
}

.sidebar-menu a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2;
}

.sidebar-menu a .badge {
    margin-left: auto;
    font-size: 9px;
    padding: 2px 8px;
}

.sidebar-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--border-soft);
    font-size: 11px;
    color: var(--text-mute);
    text-align: center;
}
.sidebar-footer strong { color: var(--teal); display: block; font-weight: 600; margin-bottom: 2px; }

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-left: 264px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--white);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.92);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-title-group h1 {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0;
}

.topbar-title-group .eyebrow {
    margin-bottom: 2px;
    display: block;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    background: var(--paper-warm);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    color: var(--text);
    align-items: center;
    justify-content: center;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 14px 6px 6px;
    background: var(--paper-warm);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    cursor: pointer;
    transition: all 0.15s;
}

.admin-profile:hover {
    background: var(--paper-deep);
    border-color: var(--border-strong);
}

.admin-avatar {
    width: 36px;
    height: 36px;
    background: var(--teal);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-serif);
}

.admin-info { line-height: 1.2; }
.admin-info strong {
    display: block;
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
}
.admin-info small {
    font-size: 11px;
    color: var(--text-mute);
    text-transform: capitalize;
}

.content-area {
    padding: 32px;
    flex: 1;
}

/* ============ PAGE HEADER ============ */
.page-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.page-header-text { flex: 1; }
.page-header h2 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin-bottom: 6px;
}
.page-header p {
    font-size: 14px;
    color: var(--text-soft);
    margin: 0;
}

.date-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--paper-warm);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 500;
}
.date-pill svg { color: var(--terra); }

/* ============ STATS GRID — Editorial style ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 36px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 26px 28px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--teal);
    opacity: 0.7;
}
.stat-card.terra::before { background: var(--terra); }
.stat-card.gold::before { background: var(--gold); }
.stat-card.success::before { background: var(--success); }

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-mute);
    margin-bottom: 12px;
    display: block;
    font-family: var(--font-sans);
}

.stat-card .stat-value {
    font-family: var(--font-serif);
    font-size: 44px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    font-variation-settings: "opsz" 144;
}

.stat-card .stat-meta {
    font-size: 12px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
}
.stat-card .stat-meta svg { width: 14px; height: 14px; }

/* ============ INFO BLOCKS ============ */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.info-block {
    padding: 22px 24px;
    background: var(--paper-warm);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    border-left: 3px solid var(--teal);
}
.info-block.terra { border-left-color: var(--terra); }
.info-block.gold { border-left-color: var(--gold); }

.info-block-title {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-block-title svg { color: var(--teal); }
.info-block.terra .info-block-title svg { color: var(--terra); }

.info-block ul {
    list-style: none;
    padding: 0;
}
.info-block li {
    font-size: 13px;
    color: var(--text-body);
    padding: 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.info-block li::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold);
    flex-shrink: 0;
}

/* ============ MINI STAT TILES ============ */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.tile {
    padding: 20px 22px;
    background: var(--paper-warm);
    border: 1px solid var(--border);
    border-radius: var(--r);
    text-align: left;
}
.tile-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-mute);
    margin-bottom: 8px;
}
.tile-value {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 700;
    color: var(--teal);
    letter-spacing: -0.02em;
    line-height: 1;
}
.tile-value.small { font-size: 18px; }

/* ============ LOGIN PAGE ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    background: var(--paper);
}

.login-side {
    flex: 1;
    background: var(--teal-darker);
    color: var(--white);
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-side::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 30% 20%, rgba(212, 160, 23, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(20, 184, 166, 0.2) 0%, transparent 50%);
}

.login-side > * { position: relative; z-index: 1; }

.login-side-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}
.login-side-brand-icon {
    width: 52px;
    height: 52px;
    background: var(--gold);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-side-brand-icon svg { color: var(--teal-darker); width: 28px; height: 28px; }
.login-side-brand h4 {
    font-family: var(--font-serif);
    color: var(--white);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}
.login-side-brand small {
    font-size: 11px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-side-quote {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--white);
    max-width: 460px;
}
.login-side-quote .gold-rule-short { background: var(--gold); margin-bottom: 24px; }

.login-side-attribution {
    font-size: 13px;
    opacity: 0.75;
    font-family: var(--font-sans);
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-box .eyebrow { margin-bottom: 8px; display: block; }

.login-box h2 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.025em;
    margin-bottom: 8px;
}

.login-box > p.subtitle {
    color: var(--text-soft);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-mobile-brand { display: none; }

/* ============ MOBILE BOTTOM NAV (hidden on desktop) ============ */
.bottom-nav { display: none; }

/* ============================================================
   RESPONSIVE — Mobile becomes an app
   ============================================================ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
}

@media (max-width: 768px) {
    /* Hide desktop sidebar entirely on mobile */
    .sidebar { display: none; }
    .menu-toggle { display: none; }

    .main-content {
        margin-left: 0;
        padding-bottom: var(--bottom-nav-h);
    }

    .topbar {
        padding: 14px 18px;
        background: var(--white);
        border-bottom: 1px solid var(--border);
    }

    .topbar-title-group h1 { font-size: 18px; }
    .topbar-title-group .eyebrow { font-size: 9px; }

    .admin-info { display: none; }
    .admin-profile { padding: 4px; }

    .content-area { padding: 20px 18px; }

    .page-header {
        margin-bottom: 24px;
        padding-bottom: 18px;
    }
    .page-header h2 { font-size: 24px; }
    .page-header p { font-size: 13px; }
    .date-pill { display: none; }

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

    .stat-card { padding: 20px 18px; }
    .stat-card .stat-value { font-size: 32px; }
    .stat-card .stat-label { font-size: 10px; }
    .stat-card .stat-meta { font-size: 11px; }

    .tile-grid { grid-template-columns: 1fr 1fr; }
    .tile { padding: 16px; }
    .tile-value { font-size: 22px; }

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

    /* ============ BOTTOM NAV — App feel ============ */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 1px solid var(--border);
        height: var(--bottom-nav-h);
        z-index: 100;
        padding: 0 8px;
        box-shadow: 0 -4px 16px rgba(26, 22, 18, 0.06);
    }

    .bottom-nav a {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 4px;
        color: var(--text-mute);
        font-size: 10px;
        font-weight: 600;
        transition: color 0.15s;
        text-decoration: none;
        position: relative;
    }

    .bottom-nav a svg {
        width: 22px;
        height: 22px;
        stroke-width: 2;
    }

    .bottom-nav a.active {
        color: var(--teal);
    }
    .bottom-nav a.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 32px;
        height: 3px;
        background: var(--teal);
        border-radius: 0 0 3px 3px;
    }

    /* Login page mobile - stack */
    .login-page { flex-direction: column; }
    .login-side {
        display: none;
    }
    .login-mobile-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 40px 20px 20px;
        text-align: center;
    }
    .login-mobile-brand .login-side-brand-icon {
        width: 64px;
        height: 64px;
        background: var(--teal);
        margin-bottom: 16px;
    }
    .login-mobile-brand .login-side-brand-icon svg { color: var(--white); width: 32px; height: 32px; }
    .login-mobile-brand h4 {
        font-family: var(--font-serif);
        font-size: 18px;
        color: var(--text);
        margin-bottom: 4px;
    }
    .login-mobile-brand small {
        font-size: 11px;
        color: var(--text-mute);
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }
    .login-form-side { padding: 20px 24px 40px; align-items: flex-start; }
    .login-box h2 { font-size: 24px; }

    .card-header { padding: 18px 20px 14px; }
    .card-body { padding: 18px 20px 22px; }
    .card-title { font-size: 17px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PHASE 2 — Books, Categories, Tables
   ============================================================ */

/* Toolbar above lists */
.toolbar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar .search-input {
    flex: 1;
    min-width: 220px;
    position: relative;
}
.toolbar .search-input svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-mute);
    pointer-events: none;
}
.toolbar .search-input input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--paper-warm);
    outline: none;
    transition: all 0.15s;
}
.toolbar .search-input input:focus {
    background: var(--white);
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.toolbar select {
    padding: 11px 38px 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 14px;
    font-family: var(--font-sans);
    background: var(--paper-warm);
    color: var(--text);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230F766E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

/* Categories grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.category-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 22px 20px;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.category-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.category-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    flex-shrink: 0;
}
.category-icon svg { width: 26px; height: 26px; }

.category-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.category-card:hover .category-actions { opacity: 1; }

.category-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--r-xs);
    background: var(--paper-warm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.15s;
}
.category-action-btn:hover {
    background: var(--teal-bg);
    color: var(--teal);
    border-color: var(--teal-pale);
}
.category-action-btn.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #FECACA;
}

.category-card h3 {
    font-family: var(--font-mr);
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.25;
}
.category-card .cat-en {
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.category-card .cat-count {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 6px;
}
.category-card .cat-count strong {
    font-family: var(--font-serif);
    color: var(--teal);
    font-size: 17px;
    font-weight: 700;
}

/* Books grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 22px;
}

.book-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}
.book-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.book-cover {
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, var(--paper-warm) 0%, var(--paper-deep) 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.book-cover-placeholder {
    width: 60%;
    height: 75%;
    background: var(--white);
    border: 1px solid var(--border);
    border-left: 4px solid var(--teal);
    border-radius: 4px 8px 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}
.book-cover-placeholder svg {
    color: var(--teal);
    opacity: 0.4;
    margin-bottom: 8px;
}
.book-cover-placeholder .pl-title {
    font-family: var(--font-serif);
    font-size: 12px;
    color: var(--text-soft);
    line-height: 1.3;
    font-weight: 600;
}

.book-type-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 4px;
}
.book-type-badge.online { color: var(--terra); }
.book-type-badge.both { color: var(--teal); }

.book-info {
    padding: 16px 18px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-info .cat-tag {
    font-size: 10px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin-bottom: 6px;
    font-family: var(--font-sans);
}

.book-info h4 {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.book-info h4.mr {
    font-family: var(--font-mr);
}

.book-info .author {
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 12px;
    font-style: italic;
}

.book-info .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    font-size: 11px;
    color: var(--text-mute);
}
.book-info .meta .copies {
    color: var(--teal);
    font-weight: 600;
}

.book-info .actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}
.book-info .actions a {
    flex: 1;
    padding: 8px;
    background: var(--paper-warm);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: var(--text-soft);
    transition: all 0.15s;
}
.book-info .actions a:hover {
    background: var(--teal-bg);
    color: var(--teal);
    border-color: var(--teal-pale);
}
.book-info .actions a.danger:hover {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #FECACA;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: var(--white);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
}
.empty-state-icon {
    width: 80px;
    height: 80px;
    background: var(--paper-warm);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--text-mute);
}
.empty-state h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    color: var(--text);
    margin-bottom: 8px;
}
.empty-state p {
    color: var(--text-soft);
    font-size: 14px;
    margin-bottom: 24px;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* Form columns helper */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}
@media (max-width: 768px) {
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; gap: 0; }
}

/* File upload box */
.file-upload {
    border: 2px dashed var(--border-strong);
    border-radius: var(--r-md);
    padding: 32px 20px;
    text-align: center;
    background: var(--paper-warm);
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}
.file-upload:hover {
    border-color: var(--teal);
    background: var(--teal-bg);
}
.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.file-upload-icon {
    width: 56px;
    height: 56px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: var(--teal);
    border: 1px solid var(--border);
}
.file-upload h4 {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
    font-weight: 600;
}
.file-upload p {
    font-size: 12px;
    color: var(--text-mute);
}
.file-upload-preview {
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}
.file-upload-preview img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--r-xs);
}

/* Data table (for book copies, etc.) */
.data-table {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th {
    background: var(--paper-warm);
    padding: 14px 18px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-sans);
}
.data-table td {
    padding: 14px 18px;
    font-size: 13px;
    color: var(--text-body);
    border-bottom: 1px solid var(--border-soft);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--paper-warm); }
.data-table td strong { color: var(--text); font-weight: 600; }
.data-table .accession {
    font-family: var(--font-serif);
    color: var(--teal);
    font-weight: 600;
    font-size: 14px;
}

@media (max-width: 768px) {
    .toolbar { padding: 12px 14px; }
    .toolbar .search-input { min-width: 100%; }
    .category-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .category-card { padding: 16px 14px; }
    .category-icon { width: 44px; height: 44px; }
    .books-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .book-info { padding: 12px; }
    .book-info h4 { font-size: 13px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 10px 12px; }
}
@media (max-width: 480px) {
    .category-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PHASE 3 — Members
   ============================================================ */

/* Members list grid */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.member-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 22px;
    transition: all 0.2s;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.member-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.member-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--teal-bg);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid var(--teal-pale);
    overflow: hidden;
}
.member-avatar img {
    width: 100%; height: 100%; object-fit: cover;
}
.member-avatar.terra { background: var(--terra-bg); color: var(--terra); border-color: var(--terra-pale); }
.member-avatar.gold { background: var(--gold-pale); color: #92760A; border-color: #FBE491; }
.member-avatar.info { background: var(--info-bg); color: var(--info); border-color: #BFDBFE; }

.member-info { flex: 1; min-width: 0; }

.member-info .member-code {
    font-family: var(--font-serif);
    font-size: 11px;
    color: var(--teal);
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.member-info h3 {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.member-info .contact {
    font-size: 12px;
    color: var(--text-soft);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}
.member-info .contact svg { flex-shrink: 0; color: var(--text-mute); }

.member-info .member-meta {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.member-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}
.member-actions a {
    padding: 7px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--r-xs);
    background: var(--paper-warm);
    border: 1px solid var(--border);
    color: var(--text-soft);
    transition: all 0.15s;
    text-decoration: none;
}
.member-actions a:hover {
    background: var(--teal-bg);
    color: var(--teal);
    border-color: var(--teal-pale);
}

/* Member ID Card (printable) */
.id-card-wrap {
    max-width: 540px;
    margin: 0 auto;
}
.id-card {
    width: 540px;
    height: 340px;
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
}
.id-card-header {
    background: var(--teal-darker);
    color: var(--white);
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 4px solid var(--gold);
    position: relative;
    overflow: hidden;
}
.id-card-header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(212,160,23,0.25) 0%, transparent 70%);
}
.id-card-logo {
    width: 48px;
    height: 48px;
    background: var(--gold);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--teal-darker);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.id-card-title {
    position: relative;
    z-index: 1;
    flex: 1;
}
.id-card-title h4 {
    font-family: var(--font-serif);
    color: var(--white);
    font-size: 16px;
    line-height: 1.2;
    font-weight: 600;
    margin-bottom: 2px;
}
.id-card-title small {
    font-size: 10px;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.id-card-body {
    display: flex;
    padding: 22px;
    gap: 20px;
    flex: 1;
}
.id-card-photo {
    width: 100px;
    height: 120px;
    background: var(--paper-warm);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mute);
    overflow: hidden;
    border: 2px solid var(--border);
    flex-shrink: 0;
}
.id-card-photo img { width:100%; height:100%; object-fit:cover; }
.id-card-details { flex: 1; }
.id-card-details h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    color: var(--text);
    margin-bottom: 4px;
    font-weight: 700;
    line-height: 1.15;
}
.id-card-code {
    font-family: var(--font-serif);
    font-size: 13px;
    color: var(--teal);
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}
.id-card-row {
    font-size: 11px;
    color: var(--text-soft);
    margin-bottom: 4px;
    display: flex;
    gap: 6px;
}
.id-card-row strong {
    color: var(--text);
    font-weight: 600;
    min-width: 60px;
    display: inline-block;
}
.id-card-footer {
    padding: 10px 22px;
    background: var(--paper-warm);
    font-size: 10px;
    color: var(--text-mute);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}
.id-card-footer strong { color: var(--teal-dark); }

/* Detail card sidebar */
.detail-sidebar {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}
@media (max-width: 900px) {
    .detail-sidebar { grid-template-columns: 1fr; }
}

.member-profile-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 28px 24px;
    text-align: center;
}
.member-profile-card .avatar-lg {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--teal-bg);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-size: 44px;
    font-weight: 700;
    margin: 0 auto 18px;
    border: 3px solid var(--teal-pale);
    overflow: hidden;
}
.member-profile-card .avatar-lg img { width:100%; height:100%; object-fit:cover; }

.member-profile-card h3 {
    font-family: var(--font-serif);
    font-size: 22px;
    color: var(--text);
    margin-bottom: 4px;
    font-weight: 700;
}
.member-profile-card .code-pill {
    display: inline-block;
    padding: 4px 12px;
    background: var(--teal-bg);
    color: var(--teal-dark);
    border-radius: var(--r-full);
    font-family: var(--font-serif);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}
.info-row:last-child { border-bottom: none; }
.info-row svg { color: var(--teal); flex-shrink: 0; margin-top: 2px; }
.info-row .info-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-mute);
    font-weight: 700;
    margin-bottom: 2px;
}
.info-row .info-value {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
    word-break: break-word;
}

/* Public auth pages (register, member login) */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    background: var(--paper);
}
.auth-side {
    flex: 1;
    background: var(--teal-darker);
    color: var(--white);
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-side::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 30% 20%, rgba(212, 160, 23, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(20, 184, 166, 0.2) 0%, transparent 50%);
}
.auth-side > * { position: relative; z-index: 1; }
.auth-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    overflow-y: auto;
}
.auth-box {
    width: 100%;
    max-width: 460px;
}
.auth-box h2 {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.025em;
}
.auth-box > p.subtitle {
    color: var(--text-soft);
    font-size: 14px;
    margin-bottom: 28px;
}
.auth-box .eyebrow { margin-bottom: 8px; display: block; }

.auth-mobile-brand { display: none; }

@media (max-width: 900px) {
    .auth-wrap { flex-direction: column; }
    .auth-side { display: none; }
    .auth-mobile-brand {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 40px 20px 20px;
        text-align: center;
    }
    .auth-mobile-brand .login-side-brand-icon {
        width: 64px; height: 64px;
        background: var(--teal);
        margin-bottom: 16px;
    }
    .auth-mobile-brand .login-side-brand-icon svg { color: var(--white); width: 32px; height: 32px; }
    .auth-mobile-brand h4 {
        font-family: var(--font-serif);
        font-size: 18px;
        color: var(--text);
        margin-bottom: 4px;
    }
    .auth-mobile-brand small {
        font-size: 11px;
        color: var(--text-mute);
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }
    .auth-form-side { padding: 20px 24px 40px; align-items: flex-start; }
    .auth-box h2 { font-size: 24px; }
}

/* Print styles for ID card */
@media print {
    body * { visibility: hidden; }
    .id-card-wrap, .id-card-wrap * { visibility: visible; }
    .id-card-wrap {
        position: absolute;
        left: 0; top: 0;
    }
    .id-card { box-shadow: none; }
}

@media (max-width: 768px) {
    .members-grid { grid-template-columns: 1fr; }
    .member-card { flex-direction: row; padding: 16px; gap: 14px; }
    .member-avatar { width: 56px; height: 56px; font-size: 20px; }
    .member-info h3 { font-size: 16px; }
}

/* ============================================================
   PHASE 6 — Public Catalog
   ============================================================ */

/* Catalog hero */
.catalog-hero {
    background: linear-gradient(135deg, var(--teal-darker) 0%, var(--teal-dark) 100%);
    border-radius: 24px;
    padding: 50px 40px;
    color: var(--white);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}
.catalog-hero::before {
    content: '';
    position: absolute;
    top: -50px; right: -50px;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(212,160,23,0.2) 0%, transparent 70%);
}
.catalog-hero::after {
    content: '';
    position: absolute;
    bottom: -80px; left: -80px;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(20,184,166,0.18) 0%, transparent 70%);
}
.catalog-hero-inner {
    position: relative;
    z-index: 1;
    max-width: 700px;
}
.catalog-hero .eyebrow {
    color: var(--gold);
    margin-bottom: 12px;
}
.catalog-hero h2 {
    font-family: var(--font-serif);
    font-size: 38px;
    color: var(--white);
    line-height: 1.1;
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}
.catalog-hero p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 24px;
    max-width: 540px;
}

.catalog-search {
    display: flex;
    background: var(--white);
    border-radius: var(--r-full);
    padding: 6px;
    max-width: 540px;
    box-shadow: 0 8px 24px -8px rgba(0,0,0,0.2);
}
.catalog-search input {
    flex: 1;
    border: none;
    padding: 14px 22px;
    font-family: var(--font-sans);
    font-size: 14px;
    background: transparent;
    outline: none;
    color: var(--text);
}
.catalog-search button {
    background: var(--terra);
    color: var(--white);
    border: none;
    padding: 12px 26px;
    border-radius: var(--r-full);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
}
.catalog-search button:hover {
    background: var(--terra-dark);
    transform: translateY(-1px);
}

/* Filter bar */
.filter-bar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.filter-bar select {
    padding: 9px 36px 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-family: var(--font-sans);
    font-size: 13px;
    background: var(--paper-warm);
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230F766E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}
.filter-bar .filter-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-mute);
    font-weight: 700;
}
.filter-bar .results-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-soft);
}

/* Catalog grid */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 28px;
}

.catalog-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: all 0.25s ease;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
}
.catalog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 40px -12px rgba(15, 118, 110, 0.2);
    border-color: var(--teal-pale);
}
.catalog-card-cover {
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, var(--paper-warm) 0%, var(--cream) 100%);
    position: relative;
    overflow: hidden;
}
.catalog-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.catalog-card:hover .catalog-card-cover img { transform: scale(1.04); }

.catalog-card-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--teal);
    padding: 20px;
    text-align: center;
}
.catalog-card-cover-placeholder svg { opacity: 0.3; margin-bottom: 12px; }
.catalog-card-cover-placeholder .pl-title {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.3;
    font-weight: 600;
}
.catalog-card-cover-placeholder .pl-title.mr { font-family: var(--font-mr); }

.catalog-card-badges {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.catalog-card-badges .badge {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    color: var(--text);
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--r-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.catalog-card-badges .badge.online {
    background: var(--teal);
    color: var(--white);
}
.catalog-card-badges .badge.physical {
    background: var(--terra);
    color: var(--white);
}

.catalog-card-body {
    padding: 16px 18px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.catalog-card-cat {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--terra);
    margin-bottom: 6px;
}
.catalog-card h3 {
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.catalog-card h3.mr { font-family: var(--font-mr); font-weight: 600; }
.catalog-card .author {
    font-size: 12px;
    color: var(--text-soft);
    font-style: italic;
    margin-bottom: 12px;
    flex: 1;
}
.catalog-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    font-size: 11px;
}
.catalog-card-availability {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}
.catalog-card-availability.available { color: var(--success); }
.catalog-card-availability.limited { color: var(--warning); }
.catalog-card-availability.unavailable { color: var(--danger); }

/* Book detail page */
.book-detail-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 40px;
    margin-bottom: 40px;
}
.book-detail-cover {
    position: sticky;
    top: 100px;
}
.book-detail-cover-img {
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, var(--paper-warm) 0%, var(--cream) 100%);
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: 0 16px 48px -16px rgba(15, 118, 110, 0.25);
    border: 1px solid var(--border);
}
.book-detail-cover-img img { width: 100%; height: 100%; object-fit: cover; }

.book-detail-actions {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.book-detail-actions .btn { width: 100%; justify-content: center; }

.book-detail-meta {
    margin-top: 18px;
    background: var(--paper-warm);
    border-radius: var(--r-md);
    padding: 18px 22px;
    border: 1px solid var(--border);
}
.book-detail-meta-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 12px;
}
.book-detail-meta-row:last-child { border-bottom: none; }
.book-detail-meta-row .label {
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    font-size: 10px;
}
.book-detail-meta-row .value {
    color: var(--text);
    font-weight: 600;
    text-align: right;
    max-width: 60%;
}

.book-detail-info .eyebrow {
    margin-bottom: 12px;
}
.book-detail-info h1 {
    font-family: var(--font-serif);
    font-size: 42px;
    line-height: 1.05;
    color: var(--text);
    letter-spacing: -0.025em;
    font-weight: 700;
    margin-bottom: 8px;
}
.book-detail-info h1.mr { font-family: var(--font-mr); font-weight: 600; }
.book-detail-info .author-line {
    font-size: 16px;
    color: var(--text-soft);
    font-style: italic;
    margin-bottom: 22px;
}
.book-detail-info .author-line strong {
    font-style: normal;
    color: var(--text);
}

.book-detail-description {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-body);
    margin-top: 22px;
}

.book-availability-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 22px 26px;
    margin: 24px 0;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.book-availability-card .av-stat {
    text-align: center;
}
.book-availability-card .av-stat .num {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}
.book-availability-card .av-stat .num.success { color: var(--success); }
.book-availability-card .av-stat .num.muted { color: var(--text-mute); }
.book-availability-card .av-stat .num.terra { color: var(--terra); }
.book-availability-card .av-stat .lbl {
    font-size: 10px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin-top: 4px;
}
.book-availability-card .av-divider {
    width: 1px;
    height: 40px;
    background: var(--border);
}
.book-availability-card .av-status {
    flex: 1;
    min-width: 160px;
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.5;
}

@media (max-width: 768px) {
    .catalog-hero { padding: 32px 22px; }
    .catalog-hero h2 { font-size: 26px; }
    .catalog-search { max-width: 100%; }
    .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
    .catalog-card h3 { font-size: 14px; }
    .catalog-card .author { font-size: 11px; }
    .book-detail-grid { grid-template-columns: 1fr; gap: 24px; }
    .book-detail-cover { position: static; max-width: 240px; margin: 0 auto; }
    .book-detail-info h1 { font-size: 28px; }
    .filter-bar { padding: 12px 16px; gap: 10px; }
    .filter-bar select { font-size: 12px; padding: 8px 32px 8px 12px; }
    .filter-bar .filter-label { display: none; }
}

/* Pagination */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 10px 16px;
    border-radius: var(--r-sm);
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--text-soft);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s;
}
.pagination a:hover {
    background: var(--paper-warm);
    color: var(--teal);
    border-color: var(--teal-pale);
}
.pagination .current {
    background: var(--teal);
    color: var(--white);
    border-color: var(--teal);
}
.pagination .disabled { opacity: 0.4; cursor: not-allowed; }

/* PDF Reader */
.reader-shell {
    background: #1a1611;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.reader-toolbar {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    color: var(--white);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.reader-toolbar a, .reader-toolbar button {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 14px;
    border-radius: var(--r-sm);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.reader-toolbar a:hover, .reader-toolbar button:hover {
    background: rgba(255, 255, 255, 0.2);
}
.reader-title {
    flex: 1;
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--white);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reader-frame-wrap {
    flex: 1;
    display: flex;
    background: #2a2520;
}
.reader-frame-wrap iframe {
    flex: 1;
    border: none;
    width: 100%;
    height: 100%;
    background: var(--white);
}
