/* ═══════════════════════════════════════════
   LibraryOS — style.css
   8 Themes via [data-theme] on <html>
═══════════════════════════════════════════ */

/* ── THEME DEFINITIONS ── */

[data-theme="parchment"] {
    --bg: #f5f2eb;
    --surface: #ffffff;
    --surface2: #ede9df;
    --border: #d5cfb9;
    --text: #1c1a16;
    --muted: #7a7469;
    --accent: #2c5f2e;
    --accent-soft: #dff0df;
    --accent-text: #2c5f2e;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
    --font-display: "Playfair Display", serif;
    --font-body: "DM Sans", sans-serif;
}

[data-theme="midnight"] {
    --bg: #0d1117;
    --surface: #161b22;
    --surface2: #21262d;
    --border: #30363d;
    --text: #c9d1d9;
    --muted: #8b949e;
    --accent: #58a6ff;
    --accent-soft: #0d2040;
    --accent-text: #58a6ff;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    --font-display: "Space Mono", monospace;
    --font-body: "DM Sans", sans-serif;
}

[data-theme="rose"] {
    --bg: #fdf6f0;
    --surface: #ffffff;
    --surface2: #f8ede6;
    --border: #e8c9b8;
    --text: #3d2b1f;
    --muted: #9c7b6a;
    --accent: #c2715a;
    --accent-soft: #fdeae3;
    --accent-text: #a8503a;
    --shadow: 0 2px 14px rgba(194, 113, 90, 0.1);
    --font-display: "Crimson Pro", serif;
    --font-body: "DM Sans", sans-serif;
}

[data-theme="forest"] {
    --bg: #0e1a13;
    --surface: #152019;
    --surface2: #1c2b20;
    --border: #2d4a35;
    --text: #d8f3dc;
    --muted: #74a87e;
    --accent: #52b788;
    --accent-soft: #1a3d27;
    --accent-text: #52b788;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
    --font-display: "Playfair Display", serif;
    --font-body: "DM Sans", sans-serif;
}

[data-theme="slate"] {
    --bg: #1e2530;
    --surface: #252d3a;
    --surface2: #2d3748;
    --border: #3d4f63;
    --text: #f1f5f9;
    --muted: #94a3b8;
    --accent: #94a3b8;
    --accent-soft: #2d3748;
    --accent-text: #cbd5e1;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
    --font-display: "DM Sans", sans-serif;
    --font-body: "DM Sans", sans-serif;
}

[data-theme="amber"] {
    --bg: #1a1200;
    --surface: #221800;
    --surface2: #2e2100;
    --border: #4a3800;
    --text: #fef3c7;
    --muted: #b89a4a;
    --accent: #f59e0b;
    --accent-soft: #3a2a00;
    --accent-text: #f59e0b;
    --shadow: 0 2px 20px rgba(245, 158, 11, 0.15);
    --font-display: "Crimson Pro", serif;
    --font-body: "DM Sans", sans-serif;
}

[data-theme="lavender"] {
    --bg: #f5f3ff;
    --surface: #ffffff;
    --surface2: #ede9fe;
    --border: #c4b5fd;
    --text: #1e1b4b;
    --muted: #7c6ea4;
    --accent: #7c3aed;
    --accent-soft: #ede9fe;
    --accent-text: #6d28d9;
    --shadow: 0 2px 14px rgba(124, 58, 237, 0.1);
    --font-display: "Playfair Display", serif;
    --font-body: "DM Sans", sans-serif;
}

[data-theme="ocean"] {
    --bg: #0a1628;
    --surface: #0f2040;
    --surface2: #162952;
    --border: #1e3d6b;
    --text: #e0f2fe;
    --muted: #7ab8d4;
    --accent: #0ea5e9;
    --accent-soft: #0c2e4a;
    --accent-text: #38bdf8;
    --shadow: 0 2px 20px rgba(14, 165, 233, 0.15);
    --font-display: "Playfair Display", serif;
    --font-body: "DM Sans", sans-serif;
}

/* ═══════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    transition:
        background 0.4s,
        color 0.4s;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    transition:
        background 0.4s,
        color 0.4s;
    line-height: 1.6;
}

/* ═══════════════════════════════════════════
   HEADER
═══════════════════════════════════════════ */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 200;
    transition:
        background 0.4s,
        border-color 0.4s;
}

.logo {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    flex-shrink: 0;
}
.logo span {
    color: var(--accent);
}

/* Search */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    flex: 1;
    max-width: 340px;
    transition:
        border-color 0.2s,
        background 0.4s;
}
.search-bar:focus-within {
    border-color: var(--accent);
}
.search-bar svg {
    color: var(--muted);
    flex-shrink: 0;
}
.search-bar input {
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    padding: 9px 0;
    width: 100%;
}
.search-bar input::placeholder {
    color: var(--muted);
}

/* ═══════════════════════════════════════════
   THEME PICKER
═══════════════════════════════════════════ */
.theme-picker {
    position: relative;
    flex-shrink: 0;
}

.theme-pick-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition:
        border-color 0.2s,
        background 0.4s;
    white-space: nowrap;
}
.theme-pick-btn:hover {
    border-color: var(--accent);
}
.theme-pick-btn svg {
    color: var(--accent);
}

.theme-palette {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    width: 280px;
    box-shadow:
        var(--shadow),
        0 8px 32px rgba(0, 0, 0, 0.15);
    transition: background 0.4s;
    z-index: 300;
}
.theme-palette.open {
    display: block;
    animation: fadeDown 0.18s ease;
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.palette-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 0.875rem;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.swatch {
    display: flex;
    flex-direction: column;
    gap: 7px;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition:
        border-color 0.2s,
        background 0.2s;
    text-align: left;
}
.swatch:hover {
    border-color: var(--accent);
}
.swatch.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.swatch-colors {
    display: flex;
    gap: 4px;
}
.swatch-colors i {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}
.swatch-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
}

/* ═══════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════ */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition:
        background 0.4s,
        border-color 0.4s;
}
.stat-num {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--accent);
    line-height: 1.1;
}
.stat-label {
    font-size: 13px;
    color: var(--muted);
    margin-top: 3px;
}

/* Page header */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
}
.page-sub {
    font-size: 14px;
    color: var(--muted);
    margin-top: 4px;
}

/* Filters */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}
.filter-btn {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 6px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s;
}
.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

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

.book-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition:
        background 0.4s,
        border-color 0.4s,
        transform 0.22s,
        box-shadow 0.22s;
    cursor: pointer;
    animation: cardIn 0.3s ease both;
}
@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.book-card:hover {
    transform: translateY(-4px);
    box-shadow:
        var(--shadow),
        0 10px 28px rgba(0, 0, 0, 0.12);
    border-color: var(--accent);
}

.book-cover {
    width: 100%;
    height: 130px;
    border-radius: 9px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    position: relative;
    overflow: hidden;
}
.book-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.18) 0%,
        transparent 60%
    );
    border-radius: 9px;
}

.book-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-text);
    margin-bottom: 0.5rem;
    transition:
        background 0.4s,
        color 0.4s;
}

.book-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
    line-height: 1.35;
    color: var(--text);
}
.book-author {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 0.85rem;
}

.book-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    transition: border-color 0.4s;
}

.availability {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
}
.dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.dot.available {
    background: var(--accent);
}
.dot.checked {
    background: #e28c3d;
}

.borrow-btn {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid var(--accent);
    color: var(--accent);
    background: none;
    cursor: pointer;
    transition: all 0.2s;
}
.borrow-btn:hover {
    background: var(--accent);
    color: #fff;
}
.borrow-btn:disabled {
    border-color: var(--border);
    color: var(--muted);
    cursor: not-allowed;
}

/* Empty state */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 0;
    color: var(--muted);
    font-size: 15px;
}

/* ═══════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════ */
footer {
    text-align: center;
    padding: 2rem;
    font-size: 13px;
    color: var(--muted);
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    transition: border-color 0.4s;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 640px) {
    header {
        padding: 0 1rem;
        gap: 0.75rem;
    }
    .search-bar {
        max-width: none;
    }
    .container {
        padding: 1.25rem;
    }
    .logo {
        font-size: 18px;
    }
}

/* ═══════════════════════════════
     SIDEBAR
  ═══════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transition: transform 0.3s;
}

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

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.brand-text {
    line-height: 1.2;
}

.brand-name {
    font-family: "Playfair Display", serif;
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--gold);
}

.brand-sub {
    font-size: 10.5px;
    color: var(--muted);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--muted);
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition:
        background 0.15s,
        color 0.15s;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.nav-item.active {
    background: rgba(232, 200, 122, 0.1);
    color: var(--gold);
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--gold);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent-rose);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    line-height: 1.4;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.api-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--muted);
}

.api-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
}

.api-dot.ok {
    background: var(--accent-sage);
    box-shadow: 0 0 6px var(--accent-sage);
}

.api-dot.err {
    background: var(--accent-rose);
}

.sidebar-back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    margin-top: 10px;
    transition: color 0.2s;
}

.sidebar-back:hover {
    color: var(--gold);
}

/* ═══════════════════════════════
     MAIN AREA
  ═══════════════════════════════ */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 14px;
    padding-left: 200px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-title {
    font-family: "Playfair Display", serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cream);
}

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

.topbar-search {
    display: flex;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 0 16px;
    transition: border-color 0.2s;
}

.topbar-search:focus-within {
    border-color: var(--gold-dim);
}

.topbar-search input {
    background: none;
    border: none;
    outline: none;
    padding: 8px 8px 8px 0;
    color: var(--text);
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    width: 200px;
}

.topbar-search input::placeholder {
    color: var(--muted);
}

.topbar-search span {
    color: var(--muted);
    font-size: 14px;
    margin-right: 6px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Playfair Display", serif;
    font-size: 14px;
    color: #0f0e0c;
    font-weight: 900;
    flex-shrink: 0;
    cursor: pointer;
}

/* Content area */
.content {
    padding: 28px;
    padding-left: 200px;
    flex: 1;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Page heading */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-head-left {
}

.page-title {
    font-family: "Playfair Display", serif;
    font-size: 1.7rem;
    font-weight: 900;
    color: var(--cream);
    line-height: 1.15;
}

.page-title span {
    color: var(--gold);
}

.page-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

/* ═══════════════════════════════
     STAT CARDS
  ═══════════════════════════════ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
    transition:
        border-color 0.2s,
        transform 0.15s;
}

.stat-card:hover {
    border-color: var(--gold-dim);
    transform: translateY(-2px);
}

.stat-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gold);
}

.stat-card.teal::after {
    background: var(--accent-teal);
}

.stat-card.rose::after {
    background: var(--accent-rose);
}

.stat-card.blue::after {
    background: var(--accent-blue);
}

.stat-card.sage::after {
    background: var(--accent-sage);
}

.stat-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-value {
    font-family: "Playfair Display", serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--cream);
    line-height: 1;
}

.stat-icon {
    position: absolute;
    right: 18px;
    top: 18px;
    font-size: 22px;
    opacity: 0.12;
}

.stat-sub {
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
}

/* ═══════════════════════════════
     SEARCH BAR (pages)
  ═══════════════════════════════ */
.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-field {
    flex: 1;
    min-width: 220px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 10px 20px;
    color: var(--text);
    font-family: "DM Sans", sans-serif;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
}

.search-field:focus {
    border-color: var(--gold-dim);
}

.search-field::placeholder {
    color: var(--muted);
}

.btn {
    padding: 10px 20px;
    border-radius: 50px;
    border: none;
    font-family: "DM Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.btn-gold {
    background: var(--gold);
    color: #0f0e0c;
}

.btn-outline {
    background: transparent;
    color: var(--gold);
    border: 1px solid var(--gold-dim);
}

.btn-teal {
    background: var(--accent-teal);
    color: #0f0e0c;
}

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

.btn-sage {
    background: var(--accent-sage);
    color: #0f0e0c;
}

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

/* ═══════════════════════════════
     TABLE
  ═══════════════════════════════ */
.table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background: rgba(255, 255, 255, 0.03);
    text-align: left;
    padding: 12px 16px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid rgba(46, 43, 39, 0.7);
    transition: background 0.12s;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

tbody td {
    padding: 11px 16px;
    font-size: 13px;
    color: var(--text);
    vertical-align: middle;
}

.td-muted {
    color: var(--muted);
    font-size: 12px;
}

code {
    background: rgba(232, 200, 122, 0.1);
    color: var(--gold);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 11.5px;
    font-family: monospace;
}

/* ═══════════════════════════════
     BADGES
  ═══════════════════════════════ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.badge-gold {
    background: rgba(232, 200, 122, 0.15);
    color: var(--gold);
    border: 1px solid rgba(232, 200, 122, 0.25);
}

.badge-teal {
    background: rgba(95, 196, 184, 0.15);
    color: var(--accent-teal);
    border: 1px solid rgba(95, 196, 184, 0.25);
}

.badge-rose {
    background: rgba(224, 122, 120, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(224, 122, 120, 0.25);
}

.badge-sage {
    background: rgba(139, 196, 160, 0.15);
    color: var(--accent-sage);
    border: 1px solid rgba(139, 196, 160, 0.25);
}

.badge-blue {
    background: rgba(111, 168, 220, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(111, 168, 220, 0.25);
}

.badge-muted {
    background: rgba(122, 117, 112, 0.12);
    color: var(--muted);
    border: 1px solid rgba(122, 117, 112, 0.2);
}

/* ═══════════════════════════════
     MODAL
  ═══════════════════════════════ */
.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px 36px;
    max-width: 540px;
    width: 92%;
    max-height: 88vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.7);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        transform: scale(0.94);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-x {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    font-size: 16px;
    color: var(--muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
}

.modal-x:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text);
}

.modal-title {
    font-family: "Playfair Display", serif;
    font-size: 1.3rem;
    color: var(--cream);
    margin-bottom: 20px;
}

/* Forms inside modal */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

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

.fg {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fg label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--muted);
}

.fg input,
.fg select,
.fg textarea {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 9px 12px;
    color: var(--text);
    font-family: "DM Sans", sans-serif;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
}

.fg input:focus,
.fg select:focus {
    border-color: var(--gold-dim);
}

.fg select option {
    background: var(--card);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Book detail modal */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    margin-bottom: 16px;
}

.detail-row .lbl {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
}

.detail-row .val {
    font-size: 13.5px;
    color: var(--text);
    margin-top: 2px;
    font-weight: 500;
}

/* Student avatar */
.stu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Playfair Display", serif;
    font-size: 18px;
    color: #0f0e0c;
    flex-shrink: 0;
}

/* ═══════════════════════════════
     EMPTY / LOADER
  ═══════════════════════════════ */
.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.loader {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-style: italic;
    font-size: 13px;
}

/* ═══════════════════════════════
     TOAST
  ═══════════════════════════════ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    background: var(--gold);
    color: #0f0e0c;
    padding: 13px 22px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13.5px;
    transform: translateY(70px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    max-width: 320px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.err {
    background: var(--accent-rose);
    color: #fff;
}

/* ═══════════════════════════════
     OVERDUE ROW
  ═══════════════════════════════ */
.row-overdue td:not(:last-child) {
    color: var(--accent-rose) !important;
}

/* ═══════════════════════════════
     ACTIVITY / QUICK ACTIONS
  ═══════════════════════════════ */
.two-col {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: var(--cream);
}

.panel-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.quick-actions {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text);
}

.quick-btn:last-child {
    border-bottom: none;
}

.quick-btn:hover {
    background: rgba(255, 255, 255, 0.03);
}

.quick-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.quick-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--cream);
}

.quick-sub {
    font-size: 11.5px;
    color: var(--muted);
    margin-top: 2px;
}

.quick-arrow {
    margin-left: auto;
    color: var(--muted);
    font-size: 18px;
}

/* ═══════════════════════════════
     MOBILE
  ═══════════════════════════════ */
.mob-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 60;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--gold);
    color: #0f0e0c;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(232, 200, 122, 0.4);
}

@media (max-width: 860px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main {
        margin-left: 0;
    }

    .mob-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

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

    .two-col {
        grid-template-columns: 1fr;
    }

    .topbar-search {
        display: none;
    }

    .content {
        padding: 20px 16px;
    }
}

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

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