/* Library 360 theme: navy and green, in the same family as School 360. */
:root {
    --navy: #14284b;
    --navy-2: #1d3b6e;
    --green: #1f9d62;
    --green-2: #17784a;
    --bg: #f3f5f9;
    --card: #ffffff;
    --text: #1d2433;
    --muted: #6b7385;
    --line: #e3e7ef;
    --danger: #b42626;
    --radius: 14px;
    --sidebar-w: 250px;
    --topbar-h: 60px;
    color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.app-body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
}
a { color: var(--green-2); }
h1 { font-size: 24px; margin: 0 0 4px; color: var(--navy); }
h2 { font-size: 18px; margin: 0 0 10px; color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
code { background: #f0f3f8; padding: 2px 6px; border-radius: 6px; font-size: 12px; }
:focus-visible { outline: 2px solid #7fd3a8; outline-offset: 2px; }

/* Top bar */
.topbar {
    position: sticky; top: 0; z-index: 50;
    height: var(--topbar-h); background: var(--navy); color: #fff;
    display: flex; align-items: center; gap: 14px; padding: 0 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}
.topbar .brand { color: #fff; text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.topbar .brand img { height: 30px; width: auto; border-radius: 6px; }
.top-title { opacity: .85; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
    background: transparent; border: 0; color: #fff; width: 40px; height: 40px; border-radius: 10px;
    cursor: pointer; font-size: 20px; display: grid; place-items: center;
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.grid-dots { display: grid; grid-template-columns: repeat(3, 5px); gap: 3px; }
.grid-dots i { display: block; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--green); color: #fff; font-weight: 700; cursor: pointer; }

/* Dropdowns (app switcher and account menu) */
.dropdown { position: relative; }
.dropdown-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 8px);
    background: #fff; color: var(--text); border-radius: var(--radius);
    box-shadow: 0 12px 40px rgba(16, 24, 40, .22); min-width: 240px; padding: 10px; z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }
.apps-menu { min-width: 300px; }
.apps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; text-decoration: none; color: var(--text); font-size: 13px; text-align: center; }
.app-tile:hover { background: #f1f5fb; }
.app-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--green); color: #fff; display: grid; place-items: center; font-weight: 700; }
.menu-head { padding: 10px 12px; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.menu-item:hover { background: #f1f5fb; }

/* Sidebar: fixed on desktop, off-canvas on phones */
.sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w);
    background: #fff; border-right: 1px solid var(--line); overflow-y: auto;
    padding: 8px 0 24px; transition: transform .2s ease; z-index: 40;
}
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin: 2px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-size: 14px; }
.nav-item:hover { background: #f1f5fb; }
.nav-item.active { background: #e6f5ee; color: var(--green-2); font-weight: 600; }
.nav-item.disabled { opacity: .55; cursor: not-allowed; }
.nav-ico { width: 30px; height: 30px; border-radius: 9px; background: #eef1f7; color: var(--navy); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.nav-item.active .nav-ico { background: var(--green); color: #fff; }
.soon { margin-left: auto; font-size: 10px; background: #fff4dd; color: #8a5a00; padding: 2px 7px; border-radius: 999px; }
.sidebar-overlay { display: none; }
body.has-sidebar .content { margin-left: var(--sidebar-w); transition: margin-left .2s ease; }
body.has-sidebar.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.has-sidebar.sidebar-collapsed .content { margin-left: 0; }
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
    body.sidebar-open .sidebar { transform: none; }
    body.has-sidebar .content { margin-left: 0; }
    body.sidebar-open .sidebar-overlay { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(10, 20, 40, .35); z-index: 35; }
    .top-title { display: none; }
}

/* Content and cards */
.content { padding: 22px 22px 10px; min-height: calc(100vh - var(--topbar-h) - 50px); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px rgba(16, 24, 40, .05); padding: 18px; margin-bottom: 16px; }
.card.narrow { max-width: 520px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { margin: 0; display: flex; flex-direction: column; gap: 6px; border-left: 4px solid var(--green); }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--navy); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14px; margin-bottom: 8px; }
.app-footer { padding: 14px; text-align: center; color: var(--muted); font-size: 13px; }

/* Forms and buttons */
label { font-size: 13px; color: var(--muted); }
input, select, textarea {
    font: inherit; padding: 9px 11px; min-height: 40px; border: 1px solid #d3dae6;
    border-radius: 10px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid #a9e3c6; border-color: var(--green); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.field.grow { flex: 1; min-width: 260px; }
.field.actions { flex-direction: row; align-items: flex-end; gap: 8px; min-width: 0; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 14px; }
.search-group { display: flex; }
.search-group select { border-radius: 10px 0 0 10px; border-right: 0; background: #f7f9fc; max-width: 170px; }
.search-group input { border-radius: 0 10px 10px 0; flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; min-height: 40px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-2); }
.btn-ghost { background: #fff; border-color: #d3dae6; color: var(--text); }
.btn-block { width: 100%; }
.alert { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; transition: opacity .5s; }
.alert.fade { opacity: 0; }
.alert-success { background: #e7f6ee; color: #14603d; }
.alert-danger { background: #fdecec; color: #8c2222; }
.alert-info { background: #e8f0fd; color: #1d4f9c; }

/* Tables, sorting, pagination */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid #eef1f6; text-align: left; white-space: nowrap; }
table.data th { background: #f7f9fc; font-weight: 600; color: var(--navy); }
table.data tbody tr:hover { background: #fafbfe; }
th.serial, td.serial { width: 52px; color: var(--muted); }
a.sort { color: inherit; text-decoration: none; }
.table-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px; color: var(--muted); font-size: 14px; }
.per-page label { display: flex; align-items: center; gap: 8px; }
.per-page select { padding: 6px 8px; min-height: auto; }
.pager { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.page-link { padding: 6px 11px; border-radius: 9px; border: 1px solid #d3dae6; text-decoration: none; color: var(--text); font-size: 14px; background: #fff; }
.page-link.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.page-link.disabled { opacity: .4; }
.page-gap { color: var(--muted); padding: 0 4px; align-self: center; }

/* Module chooser */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.choice-card {
    background: #fff; border-radius: 18px; padding: 24px; text-decoration: none; color: var(--text);
    display: flex; flex-direction: column; gap: 8px; box-shadow: 0 6px 18px rgba(16, 24, 40, .06);
    border-top: 5px solid var(--green); transition: transform .15s ease;
}
.choice-card:hover { transform: translateY(-2px); }
.choice-lms { border-top-color: var(--navy-2); }
.choice-tile { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--green); color: #fff; font-weight: 700; font-size: 20px; margin-bottom: 6px; }
.choice-lms .choice-tile { background: var(--navy-2); }

/* Sign-in */
body.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background:
        radial-gradient(circle at 20% 10%, #2b5b8c 0, transparent 45%),
        radial-gradient(circle at 85% 90%, #1f9d62 0, transparent 40%),
        linear-gradient(135deg, #14284b, #1d3b6e);
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card { background: #fff; border-radius: 20px; padding: 30px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand h1 { font-size: 22px; }
.auth-logo { height: 64px; width: auto; margin-bottom: 10px; }
.auth-logo-text { font-size: 26px; font-weight: 800; color: var(--navy); letter-spacing: .04em; margin-bottom: 6px; }
.auth-footer { color: #d6e2f2; text-align: center; font-size: 13px; margin-top: 18px; }

/* ---- Part 2: forms, badges, reveals, matrix, errors ---- */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.mt { margin-top: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-2 .card { margin-bottom: 0; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form label { display: flex; flex-direction: column; gap: 4px; }
.inline { display: inline; margin: 0; }
.row-actions { white-space: nowrap; }
.row-actions a, .row-actions .link-btn { margin-right: 10px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--green-2); font: inherit; cursor: pointer; text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; }
.help { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px 16px; margin: 0; }
.fieldset.has-error { border-color: var(--danger); }
.fieldset legend { font-weight: 600; color: var(--navy); padding: 0 6px; }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { margin-top: 3px; min-height: auto; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 16px; margin: 6px 0; }
.perm-group { margin-top: 10px; }
.perm-group h3 { font-size: 14px; margin: 0 0 4px; color: var(--navy); }
.setting-row { padding: 10px 0; border-bottom: 1px solid #f0f2f7; }
.setting-row:last-child { border-bottom: 0; }
.settings-form .card h2 { margin-bottom: 4px; }
.logo-preview { max-height: 72px; border-radius: 10px; border: 1px solid var(--line); padding: 6px; background: #fff; }
.danger-zone { border-top: 4px solid var(--danger); }
.reveal { border-left: 5px solid var(--green); background: #f5fbf7; }
.reveal .kv { grid-template-columns: max-content 1fr; }
.reveal .kv strong { font-size: 16px; word-break: break-all; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge-green { background: #e6f5ee; color: #14603d; }
.badge-blue { background: #e8f0fd; color: #1d4f9c; }
.badge-amber { background: #fff4dd; color: #8a5a00; }
.badge-red { background: #fdecec; color: #8c2222; }
.badge-grey { background: #eef1f6; color: #4a5366; }
.error-panel { max-width: 640px; margin: 40px auto; background: #fff; border-radius: 18px; padding: 32px; box-shadow: 0 6px 24px rgba(16, 24, 40, .08); text-align: left; }
.error-panel h1 { font-size: 22px; }
.error-code { font-size: 44px; font-weight: 800; color: var(--navy); margin: 0; }
.error-detail { background: #f6f7fb; border-radius: 10px; padding: 12px; overflow-x: auto; font-size: 12px; white-space: pre-wrap; }
.field input[type=file] { padding: 8px; background: #fff; }
@media (max-width: 600px) {
    .content { padding: 16px 12px; }
    .stat-value { font-size: 24px; }
    .filter-bar .field { min-width: 100%; }
    .search-group select { max-width: 120px; }
}

/* ---- Part 3: circulation desk, library dashboard ---- */
.desk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 16px; }
.desk-card { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.desk-card h2 { margin: 0; }
.danger { color: var(--danger); }
.btn.danger { color: var(--danger); border-color: #f0c4c4; }
.stat-inline { display: inline-flex; flex-direction: column; gap: 6px; min-width: 240px; margin: 0; }

/* ---- Part 4: ebook reading room and reader ---- */
.alert-warning { background: #fff4dd; color: #7a4f00; }
.btn-lg { padding: 12px 22px; font-size: 16px; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-top: 12px; }
.book-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 14px; background: #fff; text-decoration: none; color: var(--text);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .06); border-left: 6px solid var(--navy-2); transition: transform .15s ease; }
.book-card:hover { transform: translateY(-2px); }
.book-spine { width: 44px; height: 56px; border-radius: 6px; background: linear-gradient(135deg, var(--green), var(--navy-2)); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.book-title { font-weight: 600; color: var(--navy); line-height: 1.3; }
.book-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }
.reader-shell { position: relative; margin: -22px -22px 0; min-height: calc(100vh - var(--topbar-h) - 40px); background: #f7f6f2; }
.reader-bar { position: sticky; top: var(--topbar-h); z-index: 20; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.reader-title { font-weight: 600; color: var(--navy); flex: 1; min-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.reader-select { min-height: 34px; padding: 6px 10px; max-width: 320px; }
.reader-select-sm { max-width: 110px; }
.reader-page { max-width: 760px; margin: 0 auto; padding: 22px 18px 40px; }
.reader-text { background: #fffdf8; color: #1f1f1f; padding: 28px clamp(18px, 4vw, 48px); border-radius: 14px; line-height: 1.75; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow-wrap: anywhere; }
.reader-text img { max-width: 100%; height: auto; }
.reader-text table { display: block; overflow-x: auto; max-width: 100%; }
.reader-chapter { font-size: 1.35em; color: var(--navy); margin: 0 0 .8em; }
.reader-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.reader-pdf { height: calc(100vh - var(--topbar-h) - 110px); padding: 12px; }
.pdf-frame { width: 100%; height: 100%; border: 0; border-radius: 12px; background: #fff; }
.watermark { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 70px 90px; padding: 40px; opacity: .07; }
.watermark span { transform: rotate(-24deg); font-size: 15px; font-weight: 700; color: var(--navy); white-space: nowrap; }
@media (max-width: 900px) { .reader-shell { margin: -16px -12px 0; } }

/* ===================================================================
   Part 5: reader theme (ebook) and library tile theme, login, desk,
   labels and print. Scoped by body class so other areas keep the base look.
   =================================================================== */
.icon { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.18em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-bad { color: var(--danger); }
.mt { margin-top: 18px; }

/* ---- Reader theme: cream paper, terracotta banners, a monospace voice ---- */
.theme-reader {
    --bg: #f5f1ea; --card: #fbf9f5; --text: #3c2f27; --muted: #7b6a5e; --line: #e6dccf;
    --navy: #7a4f3a; --navy-2: #9a6b52; --green: #9a6b52; --green-2: #7d5340; --danger: #b03a2e;
    background: var(--bg);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 15px;
}
.theme-reader .topbar { background: #7a4f3a; }
.theme-reader h1, .theme-reader h2 { font-family: Georgia, "Times New Roman", serif; color: #4a3024; }
.theme-reader .card { background: var(--card); box-shadow: none; border: 1px solid var(--line); }
.theme-reader .btn-primary { background: #9a6b52; }
.theme-reader .btn-primary:hover { background: #7d5340; }
.theme-reader .btn-ghost { background: #fbf9f5; border-color: #d9cbbb; color: #4a3024; }
.theme-reader .nav-item.active { background: #efe3d6; color: #7a4f3a; }
.theme-reader .sidebar { background: #fbf9f5; border-right-color: var(--line); }
.theme-reader .app-footer { font-family: ui-monospace, monospace; }

.banner { background: #9a6b52; color: #fbf3e8; text-align: center; padding: 14px 16px; margin: 0 0 14px; }
.banner-text { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 26px; letter-spacing: .02em; }

.reader-home { max-width: 1280px; margin: 0 auto; }
.reader-hero { margin: 4px 0 18px; }
.reader-h1 { font-size: 40px; font-weight: 700; color: #3c2a20; margin: 0 0 14px; }
.reader-quote { margin: 0; padding: 12px 18px; background: #f3e9e1; border-left: 5px solid #5a3d2e; font-style: italic; color: #5a3d2e; font-size: 16px; }
.reader-columns { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.reader-side { display: flex; flex-direction: column; gap: 18px; }
.reader-main { min-width: 0; }
.panel { background: #fbf9f5; border: 1px solid var(--line); padding: 16px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; gap: 8px; font-size: 19px; margin: 0 0 12px; font-family: Georgia, serif; font-style: italic; }
.panel-head .icon { color: #9a6b52; }
.nav-btn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid #d9cbbb; background: #fff; color: #4a3024; text-decoration: none; border-radius: 4px; font-size: 14px; }
.nav-btn:hover { background: #f3e9e1; }
.nav-btn .icon { color: #9a6b52; }
.nav-btn.is-soon { opacity: .5; }
.goal-line { margin: 0 0 6px; font-size: 14px; }
.goal-count { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.goal-big { font-size: 34px; font-weight: 700; color: #4a3024; }
.progress { display: block; height: 6px; background: #e8dfd3; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.progress > span { display: block; height: 100%; background: #9a6b52; }
.clock { text-align: center; padding: 12px; background: #7a4f3a; color: #fbf3e8; border-radius: 4px; }
.clock-time { display: block; font-size: 26px; font-weight: 700; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.clock-date { display: block; font-size: 13px; opacity: .9; margin-top: 4px; }

.reading-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.reading-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; background: #fff; border: 1px solid #e3d8c9; color: #3c2f27; text-decoration: none; }
.reading-card:hover { border-color: #9a6b52; }
.reading-title { font-weight: 600; color: #4a3024; line-height: 1.3; }
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.shelf-book { display: flex; flex-direction: column; gap: 6px; color: #3c2f27; text-decoration: none; }
.shelf-book:hover .cover { transform: translateY(-3px); }
.cover { display: grid; place-items: center; aspect-ratio: 2 / 3; width: 100%; max-width: 160px; color: #fbf3e8; border-radius: 3px 6px 6px 3px; box-shadow: inset 6px 0 0 rgba(0,0,0,.18), 0 4px 10px rgba(60,40,30,.18); transition: transform .15s ease; }
.cover span { font-family: Georgia, serif; font-size: 42px; font-style: italic; text-shadow: 0 2px 6px rgba(0,0,0,.25); }
.cover-sm { width: 70px; max-width: 70px; }
.cover-sm span { font-size: 26px; }
.reading-card .cover { max-width: 120px; }
.book-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- Reader page ---- */
.theme-reader .reader-shell { background: #f5f1ea; }
.theme-reader .reader-bar { background: #fbf9f5; }
.theme-reader .reader-text { background: #fffdf8; font-family: Georgia, "Times New Roman", serif; }

/* ---- Library theme: the tile menu, white and grey like the Koha menu ---- */
.theme-library {
    --bg: #ffffff; --card: #ffffff; --text: #333333; --muted: #6f6f6f; --line: #dcdcdc;
    --navy: #3a3a3a; --navy-2: #555555; --green: #3a3a3a; --green-2: #222222;
    background: #fff;
}
.theme-library .topbar { background: #3a3a3a; }
.theme-library .card { box-shadow: none; border: 1px solid #e2e2e2; }
.theme-library .btn-primary { background: #3a3a3a; }
.theme-library .btn-primary:hover { background: #222; }
.theme-library .sidebar { background: #fafafa; }
.theme-library .nav-item.active { background: #e9e9e9; color: #222; }
.menu-page { max-width: 1040px; margin: 0 auto; }
.menu-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; border-bottom: 1px solid #dcdcdc; margin-bottom: 12px; }
.menu-title { font-size: 18px; display: inline-flex; gap: 8px; align-items: center; color: #333; }
.menu-sep { color: #aaa; }
.menu-actions { display: inline-flex; gap: 10px; align-items: center; }
.menu-close { font-size: 26px; line-height: 1; color: #555; text-decoration: none; padding: 0 6px; }
.menu-stats { display: flex; flex-wrap: wrap; gap: 14px; font-size: 14px; color: #555; padding: 8px 4px 14px; }
.menu-stats strong { color: #222; }
.menu-heading { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; color: #333; margin: 18px 0 10px; font-family: inherit; }
.menu-heading .icon { color: #555; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 112px; padding: 14px 10px; background: #fff; border: 1px solid #d6d6d6; border-radius: 3px; color: #333; text-decoration: none; text-align: center; font-size: 14px; }
.tile:hover { background: #f4f8fc; border-color: #9aa9b8; }
.tile-ico .icon { width: 38px; height: 38px; color: #444; }
.tile.is-soon, .tile.is-soon * { opacity: .45; pointer-events: none; }
.tile.is-soon { position: relative; }
.menu-foot { margin-top: 22px; }

/* ---- Login: a split page with a book-shelf panel ---- */
body.auth-body { background: radial-gradient(circle at 15% 10%, #b8876c 0, transparent 42%), linear-gradient(140deg, #5a3d2e, #2f3b33); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100%; max-width: 960px; min-height: 560px; background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.login-hero { position: relative; display: flex; flex-direction: column; padding: 40px 36px; color: #fbf3e8; background: linear-gradient(170deg, #9a6b52, #5a3d2e); overflow: hidden; }
.hero-kicker { font-family: ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; opacity: .85; margin: 0 0 14px; }
.hero-title { font-family: Georgia, "Times New Roman", serif; font-size: 34px; line-height: 1.15; margin: 0 0 12px; font-weight: 700; }
.hero-text { margin: 0; opacity: .9; font-size: 15px; }
.hero-shelf { margin-top: auto; display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 24px; }
.spine { display: block; width: 100%; border-radius: 3px 3px 0 0; box-shadow: inset 0 3px 0 rgba(255,255,255,.18), inset 0 -3px 0 rgba(0,0,0,.18); }
.login-card { padding: 40px 38px; display: flex; flex-direction: column; justify-content: center; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.login-logo { height: 40px; width: auto; }
.login-mark { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: #9a6b52; color: #fbf3e8; }
.login-mark svg { width: 24px; height: 24px; }
.login-name { font-weight: 700; color: #4a3024; font-family: Georgia, serif; font-size: 18px; }
.login-card h1 { font-family: Georgia, "Times New Roman", serif; font-size: 30px; margin: 0 0 6px; color: #3c2a20; }
.login-lede { margin: 0 0 18px; }
.login-form .field label { color: #5a4538; }
.login-form input { min-height: 44px; font-size: 15px; }
.login-form input:focus { border-color: #9a6b52; outline-color: #e2c7b5; }
.pw-wrap { display: flex; gap: 8px; }
.pw-wrap input { flex: 1; min-width: 0; }
.pw-toggle { border: 1px solid #d9cbbb; background: #fbf9f5; color: #5a4538; border-radius: 10px; padding: 0 14px; cursor: pointer; font: inherit; font-size: 13px; }
.student-box { border: 1px dashed #cbb9a6; border-radius: 10px; padding: 10px 14px; background: #fbf7f2; }
.student-box summary { cursor: pointer; color: #7a4f3a; font-weight: 600; font-size: 14px; }
.student-box[open] summary { margin-bottom: 10px; }
.student-box .field { margin-top: 4px; }
.btn-lg { min-height: 46px; }
.login-help { margin: 16px 0 0; }
body.auth-body .auth-footer { color: #f3e6d8; }
@media (max-width: 760px) {
    .login-shell { grid-template-columns: 1fr; min-height: 0; }
    .login-hero { padding: 26px; }
    .hero-shelf { height: 90px; }
    .hero-title { font-size: 26px; }
    .login-card { padding: 28px 22px; }
}

/* ---- Scanner desk ---- */
.desk-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.desk-main .scan-form { display: flex; flex-direction: column; gap: 10px; }
.mode-fieldset { border: 0; margin: 0; padding: 0; }
.mode-fieldset legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.mode-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.mode-tab { position: relative; cursor: pointer; }
.mode-tab input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-tab span { display: inline-block; padding: 9px 16px; border: 1px solid #cfd6df; border-radius: 999px; font-size: 14px; background: #fff; }
.mode-tab input:checked + span { background: #3a3a3a; color: #fff; border-color: #3a3a3a; }
.mode-tab input:focus-visible + span { outline: 2px solid #7fa6c9; outline-offset: 2px; }
.scan-label { font-size: 13px; color: var(--muted); }
.scan-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.scan-input { flex: 1; min-width: 240px; font-size: 22px; padding: 14px 16px; letter-spacing: .04em; font-family: ui-monospace, Menlo, Consolas, monospace; }
.camera-view { width: 100%; max-width: 480px; border-radius: 12px; background: #000; }
.scan-log { margin-top: 16px; }
.scan-log h2 { font-size: 16px; margin-bottom: 6px; }
.scan-log ul { list-style: none; margin: 0; padding: 0; }
.scan-log li { display: flex; gap: 12px; padding: 9px 12px; border-left: 4px solid #ccc; background: #f8f8f8; margin-bottom: 6px; font-size: 14px; }
.scan-log li.ok { border-left-color: #2f8f5b; background: #eef8f2; }
.scan-log li.bad { border-left-color: #b03a2e; background: #fbeeed; }
.scan-time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; font-size: 12px; padding-top: 2px; }
.reader-card .reader-name { font-size: 20px; font-weight: 600; margin: 0 0 4px; }

/* ---- Print: barcode labels and library cards ---- */
.print-body { background: #e9e9e9; margin: 0; padding: 16px; font-family: system-ui, sans-serif; color: #000; }
.print-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 auto 14px; max-width: 900px; }
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-width: 900px; margin: 0 auto; }
.label { background: #fff; border: 1px dashed #aaa; padding: 8px; text-align: center; break-inside: avoid; }
.label-title { font-size: 11px; line-height: 1.2; min-height: 26px; }
.label .barcode { width: 100%; height: auto; display: block; }
.label-meta { font-size: 11px; color: #444; }
.member-card { width: 86mm; min-height: 54mm; margin: 0 auto; background: #fff; border: 1px solid #999; border-radius: 6mm; padding: 5mm 6mm; box-sizing: border-box; display: flex; flex-direction: column; gap: 2mm; }
.member-card-head { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #5a3d2e; }
.member-card-name { font-size: 18px; font-weight: 700; }
.member-card-meta { font-size: 11px; color: #444; }
.member-card-barcode .barcode { width: 100%; height: auto; display: block; }
.member-card-foot { font-size: 10px; color: #555; margin-top: auto; }
.opac-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.opac-item { display: flex; gap: 14px; padding: 12px; border: 1px solid #e2e2e2; background: #fff; }
.opac-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.opac-title { margin: 0; font-size: 16px; }

@media print {
    .no-print { display: none !important; }
    body.print-body { background: #fff; padding: 0; }
    .label-sheet { max-width: none; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
    .label { border-color: #ccc; }
    .member-card { border-color: #000; }
    @page { margin: 8mm; }
}
@media (max-width: 900px) {
    .desk-grid, .reader-columns { grid-template-columns: 1fr; }
    .reader-h1 { font-size: 30px; }
    .banner-text { font-size: 22px; }
}


/* ===================================================================
   Koha palette for the library area and the sign-in page.
   Sampled from the Koha reference screenshots: white pages, #f0f0f0 panels,
   #666666 text and icons, #6d757d slate headers and accents.
   =================================================================== */
.icon { width: 20px; height: 20px; flex: none; }
.theme-library, body.auth-body.theme-library {
    --bg: #ffffff; --card: #ffffff; --text: #333333; --muted: #666666; --line: #dcdcdc;
    --navy: #6d757d; --navy-2: #4f565c; --green: #6d757d; --green-2: #4f565c; --danger: #b03a2e;
}
.theme-library { background: #ffffff; color: #333333; }
.theme-library .topbar { background: #6d757d; color: #ffffff; box-shadow: none; }
.theme-library .topbar .brand, .theme-library .topbar .top-title { color: #ffffff; }
.theme-library .icon-btn { color: #ffffff; }
.theme-library .avatar { background: #4f565c; }
.theme-library .sidebar { background: #f0f0f0; border-right: 1px solid #dcdcdc; }
.theme-library .nav-item { color: #333333; font-size: 14px; }
.theme-library .nav-item:hover { background: #e2e2e2; }
.theme-library .nav-item.active { background: #ffffff; color: #333333; font-weight: 600; box-shadow: inset 4px 0 0 #6d757d; }
.theme-library .nav-ico { width: 18px; height: 18px; background: transparent; color: #666666; border-radius: 0; }
.theme-library .nav-item.active .nav-ico { background: transparent; color: #333333; }
.theme-library .nav-item.disabled { color: #999999; }
.theme-library .nav-section { color: #666666; }
.theme-library .card { background: #ffffff; border: 1px solid #dcdcdc; box-shadow: none; }
.theme-library h1, .theme-library h2 { color: #333333; font-family: inherit; }
.theme-library .btn-primary { background: #6d757d; border-color: #6d757d; color: #ffffff; }
.theme-library .btn-primary:hover { background: #4f565c; border-color: #4f565c; }
.theme-library .btn-ghost { background: #f0f0f0; border-color: #c9c9c9; color: #333333; }
.theme-library .btn-ghost:hover { background: #e4e4e4; }
.theme-library table.data th { background: #f0f0f0; color: #333333; }
.theme-library table.data th, .theme-library table.data td { border-bottom-color: #e4e4e4; }
.theme-library .alert-info { background: #f0f0f0; color: #333333; }
.theme-library .mode-tab input:checked + span { background: #6d757d; border-color: #6d757d; }
.theme-library .scan-log li { background: #f7f7f7; }
.theme-library .scan-log li.ok { background: #eef6f0; }
.theme-library .scan-log li.bad { background: #f8eeee; }

/* Library menu tiles */
.menu-bar { border-bottom-color: #dcdcdc; }
.menu-title { color: #333333; }
.menu-stats { color: #666666; }
.menu-stats strong { color: #333333; }
.menu-heading { color: #333333; }
.menu-heading .icon { color: #666666; width: 22px; height: 22px; }
.tile { background: #ffffff; border: 1px solid #cfcfcf; color: #333333; }
.tile:hover { background: #f0f0f0; border-color: #6d757d; }
.tile-ico .icon { color: #666666; width: 34px; height: 34px; }
.tile-label { color: #333333; }

/* Sign-in page in the Koha style */
body.auth-body.theme-library { background: #f0f0f0; }
body.auth-body.theme-library .login-shell { background: #ffffff; border: 1px solid #d0d0d0; box-shadow: 0 1px 4px rgba(0,0,0,.08); border-radius: 4px; }
body.auth-body.theme-library .login-hero { background: linear-gradient(170deg, #6d757d, #4f565c); }
body.auth-body.theme-library .login-card h1 { color: #333333; }
body.auth-body.theme-library .login-name { color: #333333; font-family: inherit; }
body.auth-body.theme-library .login-mark { background: #6d757d; }
body.auth-body.theme-library .login-lede, body.auth-body.theme-library .login-help { color: #666666; }
body.auth-body.theme-library .login-form .field label { color: #333333; }
body.auth-body.theme-library .login-form input:focus { border-color: #6d757d; outline-color: #c9ced3; }
body.auth-body.theme-library .pw-toggle { background: #f0f0f0; border-color: #c9c9c9; color: #333333; }
body.auth-body.theme-library .student-box { background: #f7f7f7; border-color: #c9c9c9; }
body.auth-body.theme-library .student-box summary { color: #333333; }
body.auth-body.theme-library .btn-primary.btn-block { background: #6d757d; }
body.auth-body.theme-library .auth-footer { color: #666666; }
body.auth-body.theme-library .hero-kicker, body.auth-body.theme-library .hero-title,
body.auth-body.theme-library .hero-text { color: #ffffff; }
body.auth-body.theme-library .hero-title { font-family: inherit; }


/* ===================================================================
   Part 6: the module chooser. Each module keeps its own colours.
   =================================================================== */
.chooser { max-width: 920px; margin: 0 auto; padding-top: 4px; }
.chooser-head { margin: 8px 0 24px; }
.chooser-kicker { margin: 0 0 4px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: #6f7785; }
.chooser-head h1 { font-size: 30px; }
.chooser-licence { display: inline-flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 14px; color: #5b6472; }
.chooser-licence .icon { width: 18px; height: 18px; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.module-card {
    display: flex; flex-direction: column; gap: 8px; min-height: 230px; padding: 24px;
    background: #ffffff; border: 1px solid #e6eaf1; border-radius: 18px; text-decoration: none; color: #1d2433;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .07);
    transition: transform .15s ease, box-shadow .15s ease;
}
.module-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(16, 24, 40, .08), 0 14px 32px rgba(16, 24, 40, .12); }
.module-card:focus-visible { outline: 3px solid #b9d3c6; outline-offset: 3px; }
.module-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.module-icon { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; color: #ffffff; }
.module-icon .icon { width: 28px; height: 28px; }
.module-title { font-size: 20px; font-weight: 700; margin-top: 8px; }
.module-text { color: #5b6472; font-size: 15px; line-height: 1.5; }
.module-go { margin-top: auto; padding-top: 10px; font-weight: 600; font-size: 15px; }
.module-ebook { border-top: 5px solid #9a6b52; }
.module-ebook .module-icon { background: #9a6b52; }
.module-ebook .module-go { color: #7a4f3a; }
.module-library { border-top: 5px solid #6d757d; }
.module-library .module-icon { background: #6d757d; }
.module-library .module-go { color: #4f565c; }
@media (max-width: 600px) { .module-card { min-height: 0; } .chooser-head h1 { font-size: 26px; } }


/* ---- Notifications: bell, count, notice list ---- */
.top-actions .icon-btn .icon { width: 20px; height: 20px; }
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
    background: #b03a2e; color: #ffffff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-bottom: 1px solid #eceff3; }
.notice:last-child { border-bottom: 0; }
.notice.is-unread { background: #f4f8fb; }
.notice-icon .icon { width: 22px; height: 22px; color: #6d757d; }
.notice-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }

/* ---- Part 7: reports ---- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.report-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid #dcdcdc; border-radius: 10px; background: #ffffff; color: #333333; text-decoration: none; }
.report-card:hover { border-color: #6d757d; background: #f7f7f7; }
.report-icon .icon { width: 24px; height: 24px; color: #6d757d; }
.report-title { font-weight: 700; }
.report-totals { margin-bottom: 14px; }
.report-table .table-wrap { max-height: none; }
@media print {
    .sidebar, .topbar, .app-footer, .no-print, .alert, .bell { display: none !important; }
    body.has-sidebar .content { margin-left: 0 !important; padding: 0; }
    .card { box-shadow: none; border: 0; }
    table.data th, table.data td { font-size: 11px; padding: 5px 7px; }
    .report-totals .stat-value { font-size: 18px; }
}


/* ---- Part 8: the library look, applied to library and administration pages ---- */
.theme-library { font-family: Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif; font-size: 15px; }
.theme-library h1 { font-size: 24px; font-weight: 600; color: #333333; }
.theme-library h2, .theme-library h3 { font-family: inherit; font-weight: 600; color: #333333; }
.theme-library a { color: #3b6b8c; }
.theme-library .stat { border-left: 4px solid #6d757d; }
.theme-library .stat-label { color: #666666; }
.theme-library .stat-value { color: #333333; font-weight: 600; }
.theme-library input, .theme-library select, .theme-library textarea { border-color: #c4c4c4; }
.theme-library input:focus, .theme-library select:focus, .theme-library textarea:focus { outline: 2px solid #c9ced3; border-color: #6d757d; }
.theme-library .pager .page-link.active { background: #6d757d; border-color: #6d757d; }
.theme-library .sidebar .nav-item { border-radius: 0; margin: 0; padding: 12px 16px; }
.theme-library .sidebar .nav-item.active { box-shadow: inset 4px 0 0 #6d757d; }
.theme-library .topbar .icon-btn .icon { color: #ffffff; }
.theme-library .menu-stats span { font-size: 14px; }
.theme-reader { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace; }


/* ---- Part 11: reports take the look of their area ---- */
.theme-reader .report-card { border: 1px solid #e3d8c9; background: #fffdf8; color: #3c2f27; border-radius: 4px; }
.theme-reader .report-card:hover { border-color: #9a6b52; background: #f6efe6; }
.theme-reader .report-icon .icon { color: #9a6b52; }
.theme-reader .report-title { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 17px; color: #4a3024; }
.theme-reader .report-totals .stat { border-left-color: #9a6b52; }
.theme-reader .report-table { background: #fffdf8; }
.theme-reader .report-table table.data th { background: #f3e9e1; color: #4a3024; }
.theme-library .report-card { border-color: #cfcfcf; color: #333333; }
.theme-library .report-card:hover { border-color: #6d757d; background: #f0f0f0; }
.theme-library .report-icon .icon { color: #666666; }
.theme-library .report-totals .stat { border-left-color: #6d757d; }
.theme-library .report-table table.data th { background: #f0f0f0; color: #333333; }
