/* Theme colours: change these to re-brand the application. */
:root {
    --lms-primary: #1565c0;
    --lms-primary-dark: #0d47a1;
    --lms-tint: #e6f0fb;
    --lms-tint-soft: #eef4fc;
    --lms-bg: #f3f5f8;
    --lms-border: #e1e6ec;
    --lms-text-soft: #52606d;
    --lms-topbar: 60px;
    --lms-sidebar: 248px;
}

body { background: var(--lms-bg); }
a { color: var(--lms-primary); }
/* Bootstrap's own blue would otherwise show through a library's colour. */
.nav-pills { --bs-nav-pills-link-active-bg: var(--lms-primary); }
.nav-link { --bs-nav-link-color: var(--lms-primary); --bs-nav-link-hover-color: var(--lms-primary-dark); }
.pagination { --bs-pagination-color: var(--lms-primary); --bs-pagination-hover-color: var(--lms-primary-dark); --bs-pagination-focus-color: var(--lms-primary-dark); --bs-pagination-active-bg: var(--lms-primary); --bs-pagination-active-border-color: var(--lms-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--lms-primary); }
.list-group { --bs-list-group-active-bg: var(--lms-primary); --bs-list-group-active-border-color: var(--lms-primary); }
.form-check-input:checked, .form-check-input[type="checkbox"]:indeterminate { background-color: var(--lms-primary); border-color: var(--lms-primary); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--lms-primary); box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .25); }
.btn:focus-visible { box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .35); }
.badge.text-bg-primary { background-color: var(--lms-primary) !important; }
.btn-primary {
    --bs-btn-bg: var(--lms-primary); --bs-btn-border-color: var(--lms-primary);
    --bs-btn-hover-bg: var(--lms-primary-dark); --bs-btn-hover-border-color: var(--lms-primary-dark);
    --bs-btn-active-bg: var(--lms-primary-dark); --bs-btn-active-border-color: var(--lms-primary-dark);
}
.btn-outline-primary {
    --bs-btn-color: var(--lms-primary); --bs-btn-border-color: var(--lms-primary);
    --bs-btn-hover-bg: var(--lms-primary); --bs-btn-hover-border-color: var(--lms-primary);
    --bs-btn-active-bg: var(--lms-primary); --bs-btn-active-border-color: var(--lms-primary);
}

.skip-link { position: absolute; top: 8px; left: 8px; z-index: 2000; background: #fff; padding: 6px 12px; }

/* Top navigation */
.topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--lms-topbar);
    display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
    background: var(--lms-primary); color: #fff;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; min-width: 0; }
.brand-mark { display: inline-grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 8px; background: #fff; color: var(--lms-primary); font-size: 1.2rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong, .brand-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { opacity: .85; font-size: .72rem; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .25rem; }
.topbar-btn { color: #fff; border: 0; }
.topbar-btn:hover, .topbar-btn:focus-visible, .topbar-btn.show { background: rgba(255,255,255,.16); color: #fff; }
.plan-badge { background: rgba(255,255,255,.18); font-weight: 500; margin-right: .5rem; }
.notif-count { position: absolute; top: 2px; right: 0; font-size: .6rem; }
.notif-menu { width: 280px; }
.user-btn { display: flex; align-items: center; gap: .5rem; }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--lms-primary); font-weight: 700; }

@media (max-width: 575px) {
    .topbar { gap: .35rem; padding: 0 .5rem; }
    .topbar .brand-mark { display: none; }
    .brand-text small { display: none; }
    .topbar-btn { padding-left: .5rem; padding-right: .5rem; }
}

/* Layout and sidebar */
.app-body { display: flex; align-items: flex-start; }
.app-content { flex: 1; min-width: 0; padding: 1.25rem; }
.sidebar { --bs-offcanvas-width: 280px; background: #fff; }
@media (min-width: 992px) {
    .sidebar {
        position: sticky; top: var(--lms-topbar); flex: 0 0 var(--lms-sidebar);
        height: calc(100vh - var(--lms-topbar)); overflow-y: auto; border-right: 1px solid var(--lms-border);
    }
    .sidebar .offcanvas-body { display: block !important; background: #fff !important; }
}
.side-menu, .side-sub { list-style: none; margin: 0; padding: 0; width: 100%; }
.side-menu { padding: .5rem 0; }
.side-link {
    display: flex; align-items: center; gap: .75rem; width: 100%; padding: .65rem 1rem;
    border: 0; border-left: 3px solid transparent; background: none; color: #243240;
    text-decoration: none; text-align: left; font-size: .93rem;
}
a.side-link:hover, button.side-link:hover { background: var(--lms-tint-soft); }
.side-link.active { background: var(--lms-tint); border-left-color: var(--lms-primary); color: var(--lms-primary-dark); font-weight: 600; }
.side-link.is-disabled { color: #6b7785; cursor: default; }
.side-sub .side-link { padding-left: 2.85rem; font-size: .88rem; }
.phase { margin-left: auto; font-size: .66rem; border: 1px solid var(--lms-border); border-radius: 10px; padding: 1px 7px; white-space: nowrap; }
.chevron { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.side-link:not(.collapsed) .chevron { transform: rotate(180deg); }

/* Page content */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.page-title { font-size: 1.5rem; margin: 0 0 .25rem; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; }
.filter-bar label { font-size: .75rem; color: var(--lms-text-soft); }
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; margin-bottom: .5rem; }
@media (max-width: 1399px) { .stat-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
@media (max-width: 480px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { display: flex; gap: .75rem; padding: .9rem; background: #fff; border: 1px solid var(--lms-border); border-radius: 10px; }
.stat > i { font-size: 1.35rem; color: var(--lms-primary); }
.stat > div { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: .8rem; color: var(--lms-text-soft); }
.stat-value { font-size: 1.6rem; line-height: 1.2; }
.stat small { color: #6b7785; font-size: .72rem; }
.stat-alert { border-color: #f1aeb5; }
.stat-alert > i { color: #b02a37; }
@media (max-width: 480px) { .stat > i { display: none; } }

.panel { border-color: var(--lms-border); border-radius: 10px; overflow: hidden; }
.panel-title { font-size: 1rem; font-weight: 600; margin: 0; padding: .8rem 1rem; border-bottom: 1px solid var(--lms-border); }
.panel-title small { font-weight: 400; color: var(--lms-text-soft); }
.panel .table { font-size: .875rem; }
.panel .table th { color: var(--lms-text-soft); font-weight: 600; white-space: nowrap; }
.panel .table td:first-child, .panel .table th:first-child { padding-left: 1rem; }
.panel .table td:last-child, .panel .table th:last-child { padding-right: 1rem; }
.chart-box { position: relative; height: 270px; }
.empty { margin: 0; padding: 2rem 1rem; text-align: center; color: var(--lms-text-soft); }
.form-narrow { max-width: 480px; }

/* Sign-in and installer */
body.guest { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.guest-card { width: 100%; max-width: 420px; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 30px rgba(15,40,80,.12); }
.guest-card.wide { max-width: 760px; }
.guest-head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.5rem; background: var(--lms-primary); color: #fff; }
.guest-body { padding: 1.5rem; }
.checklist { list-style: none; padding: .75rem 1rem; background: var(--lms-bg); border-radius: 8px; font-size: .875rem; }
.section-title { margin-top: 1.5rem; padding-bottom: .4rem; border-bottom: 1px solid var(--lms-border); }

/* Catalogue */
.min-w-0 { min-width: 0; }
.app-content > .page-title { margin-bottom: .75rem; }
.table-responsive { position: relative; } /* keeps screen-reader-only headings inside the scroll area */
.panel-visible { overflow: visible; }
.panel + .panel, fieldset.panel { margin-bottom: 1rem; }
.row .panel { margin-bottom: 0; }
fieldset.panel > legend { float: left; width: 100%; font-size: 1rem; }
fieldset.panel > legend + * { clear: left; }
.filter-bar label { display: flex; flex-direction: column; gap: .15rem; margin: 0; }
.filter-bar .grow { flex: 1 1 220px; }
.filter-bar .year { width: 6.5rem; }
.filter-bar .short { width: 6rem; }
.search-box { margin-bottom: 1rem; }
.search-field { flex: 0 0 10.5rem !important; }
@media (max-width: 575px) { .search-field { flex-basis: 8.75rem !important; } .search-box .btn-primary:has(> i) { font-size: 0; } .search-box .btn-primary i { font-size: 1rem; } }
.result-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.resource-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.resource-card { display: flex; gap: .85rem; padding: .85rem; background: #fff; border: 1px solid var(--lms-border); border-radius: 10px; min-width: 0; }
.resource-info { display: flex; flex-direction: column; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.resource-info h2 { font-size: 1rem; margin: 0 0 .15rem; }
.resource-info h2 a { text-decoration: none; }
.resource-info p { margin: 0 0 .2rem; font-size: .85rem; }
.resource-info .meta { color: var(--lms-text-soft); }
.resource-info .counts { display: flex; flex-wrap: wrap; gap: .15rem .8rem; }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: .35rem; }
.cover { width: 84px; height: 120px; flex: 0 0 auto; object-fit: cover; border-radius: 5px; border: 1px solid var(--lms-border); }
.cover-xs { width: 36px; height: 52px; }
.cover-lg { width: 120px; height: 172px; }
.resource-card > a { align-self: flex-start; text-decoration: none; }
.detail code, .result-table code { color: inherit; font-size: .85rem; }
.detail-head .cover { align-self: flex-start; }
.cover-blank { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; background: var(--lms-tint); color: var(--lms-primary); }
.cover-blank span { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.cover-xs.cover-blank span { font-size: 1rem; }
.cover-xs.cover-blank i { display: none; }
.result-table .title-cell { min-width: 220px; }
.result-table .table-responsive, .result-table { font-size: .875rem; }

/* Detail view and side panel */
.detail-panel { --bs-offcanvas-width: min(680px, 100vw); background: var(--lms-bg) !important; }
.detail-panel .offcanvas-header { background: var(--lms-primary); color: #fff; }
.detail-panel .btn-close { filter: invert(1) grayscale(1) brightness(2); }
.detail { display: flex; flex-direction: column; gap: 1rem; }
.detail > .panel { margin: 0; }
.detail-head { display: flex; gap: 1rem; background: #fff; border: 1px solid var(--lms-border); border-radius: 10px; padding: 1rem; overflow-wrap: anywhere; }
.count-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; }
.count-grid div { background: #fff; border: 1px solid var(--lms-border); border-radius: 10px; padding: .6rem .8rem; }
.count-grid span { display: block; font-size: .78rem; color: var(--lms-text-soft); }
.count-grid strong { font-size: 1.4rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem 1rem; margin: 0; background: #fff; border: 1px solid var(--lms-border); border-radius: 10px; padding: 1rem; overflow-wrap: anywhere; }
.facts dt { font-size: .75rem; color: var(--lms-text-soft); font-weight: 600; }
.facts dd { margin: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich h3 { font-size: 1.1rem; }
.rich h4 { font-size: 1rem; }
.rich { overflow-wrap: anywhere; }
.note { border-top: 1px solid var(--lms-border); padding: .6rem 0; overflow-wrap: anywhere; }
.form-medium { max-width: 720px; }
.check-list { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; max-height: 190px; overflow: auto; border: 1px solid var(--lms-border); border-radius: 6px; padding: .6rem .75rem; }
.check-list .depth-1 { font-size: .92rem; } .check-list .depth-1 .form-check-label::before, .check-list .depth-2 .form-check-label::before, .check-list .depth-3 .form-check-label::before, .check-list .depth-4 .form-check-label::before { content: "↳ "; color: var(--lms-text-soft); }
.editor-bar { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .35rem; }
.editor-area { min-height: 180px; max-height: 420px; overflow: auto; }

/* Barcode labels */
body.print-page { background: #fff; padding: 1rem; }
.label-tools { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.label-sheet { display: grid; gap: 3mm; max-width: 194mm; }
.label-sheet.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.label-sheet.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.label-sheet.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.label { border: 1px dashed #aab4bf; padding: 2mm; text-align: center; break-inside: avoid; min-width: 0; color: #000; }
.label .barcode { display: block; width: 100%; height: var(--label-bar, 14mm); }
.label-lib { font-size: 7.5pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-title { font-size: 8.5pt; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-code { font-family: monospace; font-size: 9pt; letter-spacing: .08em; }
@media (max-width: 575px) { .label-sheet { grid-template-columns: 1fr !important; } }
@media print {
    body.print-page { padding: 0; }
    .label-sheet { max-width: none; }
    .label-sheet.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .label-sheet.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    .label-sheet.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
    .offcanvas, .offcanvas-backdrop { display: none !important; }
    .count-grid { grid-template-columns: repeat(4, 1fr); }
}
@page { margin: 8mm; }

@media print {
    .topbar, .sidebar, .no-print, .alert, details, .modal { display: none !important; }
    body { background: #fff; }
    .app-body { display: block; }
    .app-content { padding: 0; }
    .stat-grid { grid-template-columns: repeat(5, 1fr); }
    .stat > i { display: none; }
    .row { display: block; margin: 0; }
    .row > [class*="col-"] { width: 100%; padding: 0; margin: 0 0 .75rem; }
    .panel.h-100 { height: auto !important; }
    .panel { overflow: visible; }
    .stat, .panel tr { break-inside: avoid; }
    .panel-title { break-after: avoid; }
    .table-responsive { overflow: visible; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Members */
.person { display: flex; align-items: center; gap: .75rem; }
.photo { width: 64px; height: 80px; flex: 0 0 auto; object-fit: cover; border-radius: 6px; border: 1px solid var(--lms-border); }
.photo-xs { width: 34px; height: 42px; }
.photo-lg { width: 88px; height: 110px; }
.photo-blank { display: inline-grid; place-items: center; background: var(--lms-tint); color: var(--lms-primary); font-size: 1.6rem; font-weight: 700; }
.photo-xs.photo-blank { font-size: .95rem; }
.member-table .person { min-width: 180px; }
.form-wide { max-width: 960px; }
.timeline { list-style: none; margin: 0; padding: .25rem 1rem; font-size: .85rem; }
.timeline li { padding: .5rem 0; border-bottom: 1px solid var(--lms-border); overflow-wrap: anywhere; }
.timeline li:last-child { border-bottom: 0; }
.timeline small { display: block; color: var(--lms-text-soft); }
.temp-password { display: block; font-size: 1.25rem; color: #000; letter-spacing: .04em; user-select: all; margin: .35rem 0; }
.record-label { width: 32%; }

/* Reader portal */
.portal-nav { display: flex; justify-content: center; gap: .25rem; overflow-x: auto; padding: 0 .5rem; background: #fff; border-bottom: 1px solid var(--lms-border); }
.portal-nav a { display: flex; align-items: center; gap: .4rem; padding: .7rem .85rem; white-space: nowrap; text-decoration: none; color: #243240; border-bottom: 3px solid transparent; font-size: .93rem; }
.portal-nav a.active { border-bottom-color: var(--lms-primary); color: var(--lms-primary-dark); font-weight: 600; }
.portal-content { max-width: 1080px; margin: 0 auto; }
.count-grid strong small { font-size: .85rem; font-weight: 400; color: var(--lms-text-soft); }
@media (max-width: 575px) { .portal-nav { justify-content: space-between; gap: 0; } .portal-nav a { flex-direction: column; gap: .1rem; padding: .45rem .35rem; font-size: .68rem; } .portal-nav i { font-size: 1.1rem; } }

.stack-title { min-width: 200px; }
/* On a phone each row of a borrowing table becomes a short block, so due dates are never off screen. */
@media screen and (max-width: 575px) {
    .stack-table, .stack-table tbody, .stack-table tfoot { display: block; }
    .stack-table thead { display: none; }
    .stack-table tr { display: block; padding: .5rem 1rem; border-bottom: 1px solid var(--lms-border); }
    .stack-table tr:last-child { border-bottom: 0; }
    .panel .stack-table td { display: flex; justify-content: space-between; gap: 1rem; padding: .1rem 0; border: 0; text-align: right; }
    .stack-table td::before { content: attr(data-label); color: var(--lms-text-soft); text-align: left; }
    .panel .stack-table td.stack-title { display: block; min-width: 0; text-align: left; font-weight: 600; }
    .stack-table td.stack-title::before { content: none; }
    /* The title leads each stacked row, wherever its column sits. */
    .stack-table tbody tr { display: flex; flex-direction: column; }
    .stack-table .stack-title { order: -1; }
    .stack-table tfoot tr { display: flex; justify-content: space-between; }
    .panel .stack-table tfoot th { padding: 0; border: 0; }
    .panel .table.stack-table :is(td, th):is(:first-child, :last-child) { padding-left: 0; padding-right: 0; }
}

/* ID cards: credit-card size */
.card-sheet { display: flex; flex-wrap: wrap; gap: 4mm; }
.card-single { overflow-x: auto; }
.id-card { width: 85.6mm; height: 54mm; flex: 0 0 auto; display: flex; flex-direction: column; overflow: hidden; background: #fff; color: #000; border: 1px solid #8c99a6; border-radius: 3mm; break-inside: avoid; line-height: 1.25; }
.id-head { background: var(--lms-primary); color: #fff; padding: 1.6mm 3mm; font-size: 9.5pt; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-body { display: flex; gap: 3mm; padding: 2mm 3mm 0; flex: 1; min-height: 0; }
.id-card .photo { width: 19mm; height: 24mm; border-radius: 1.5mm; }
.id-text { min-width: 0; font-size: 7.8pt; }
.id-name { font-size: 10.5pt; font-weight: 700; max-height: 2.5em; overflow: hidden; overflow-wrap: anywhere; }
.id-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-foot { padding: 0 3mm 1.2mm; text-align: center; font-family: monospace; font-size: 7.5pt; letter-spacing: .08em; }
.id-foot .barcode { display: block; width: 60mm; height: 9mm; margin: 0 auto; }
@media (max-width: 380px) { .card-single .id-card { zoom: .9; } }
@media print {
    .portal-nav { display: none !important; }
    .portal-content { max-width: none; }
    .card-sheet { gap: 4mm; }
    .record { font-size: 10pt; }
    .record .table-responsive { overflow: visible; }
    body.print-page * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Circulation */
.tab-strip { gap: .25rem; flex-wrap: nowrap; overflow-x: auto; }
.tab-strip .nav-link { white-space: nowrap; padding: .35rem .75rem; font-size: .9rem; }
.tab-strip.tab-wrap { flex-wrap: wrap; overflow-x: visible; }
.loan-actions { min-width: 8.5rem; }
.request-actions { min-width: 17rem; white-space: nowrap; }
.renew-block { display: inline-block; max-width: 11rem; white-space: normal; margin-right: .35rem; }
.request-actions .reject-form { display: inline-flex; flex-wrap: nowrap; width: 15rem; max-width: 100%; vertical-align: middle; margin-left: .35rem; }
.fine-actions > summary { list-style: none; }
.fine-actions > summary::-webkit-details-marker { display: none; }
.fine-actions[open] { flex-basis: 15rem; }
.scan-view { position: relative; background: #000; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; }
.scan-view span { position: absolute; inset: 28% 10%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 8px; pointer-events: none; }
@media (min-width: 576px) and (max-width: 1399px) {
    .request-actions { min-width: 15rem; }
    .request-actions .reject-form { display: flex; margin: .35rem 0 0 auto; }
}
@media (max-width: 575px) {
    .stack-table td.loan-actions, .stack-table td.request-actions { min-width: 0; flex-wrap: wrap; justify-content: flex-end; align-items: center; margin-top: .35rem; }
    .panel .stack-table td.loan-actions, .panel .stack-table td.request-actions { justify-content: flex-end; }
    .request-actions .reject-form { width: auto; flex: 1; margin: 0; }
    .panel .stack-table td.request-actions { flex-wrap: nowrap; }
}

/* Issue and return receipts: fit an 80 mm roll as well as a sheet */
.receipt { max-width: 80mm; margin: 0 auto; color: #000; font-size: 10pt; overflow-wrap: anywhere; }
.receipt h1 { font-size: 13pt; text-align: center; margin: 0 0 .2rem; }
.receipt h2 { font-size: 11pt; text-align: center; border-top: 1px dashed #000; border-bottom: 1px dashed #000; padding: .3rem 0; margin: .5rem 0; }
.receipt p { margin: 0 0 .5rem; text-align: center; }
.receipt table { width: 100%; border-collapse: collapse; margin-bottom: .6rem; }
.receipt th, .receipt td { text-align: left; vertical-align: top; padding: .25rem .2rem; border-bottom: 1px solid #ccc; }
.receipt-small { font-size: 8.5pt; }
.label-tools .alert { margin: 0; }

/* Notices */
.cron-command { background: var(--bs-tertiary-bg); border: 1px solid var(--bs-border-color); border-radius: 6px; padding: .6rem .75rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.mail-body { max-width: 32rem; padding: .35rem 0; overflow-wrap: anywhere; }

/* Reports */
.report-group { font-size: 1rem; font-weight: 700; margin-bottom: .6rem; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.report-card { display: block; padding: .85rem 1rem; text-decoration: none; color: inherit; }
.report-card strong { display: block; color: var(--bs-primary); }
.report-card span { font-size: .875rem; color: var(--bs-secondary-color); }
.report-card:hover, .report-card:focus-visible { border-color: var(--bs-primary); }
.report-table { font-size: .875rem; }
.report-table td { min-width: 5.5rem; overflow-wrap: break-word; }
.report-scroll { max-width: 100%; }
/* Reports print on A4 landscape; other pages keep the paper chosen in the print window. */
@page report { size: A4 landscape; margin: 8mm; }
.report-print { page: report; color: #000; font-size: 8.5pt; padding: 0 2mm; }
.report-print h1 { font-size: 14pt; margin: 0; }
.report-print h2 { font-size: 11.5pt; margin: .1rem 0 .3rem; }
.report-print p { margin: 0 0 .25rem; }
.report-print table { width: 100%; border-collapse: collapse; margin-top: .4rem; font-size: 8pt; }
.report-print th, .report-print td { border: 1px solid #999; padding: .8mm 1mm; vertical-align: top; min-width: 0; overflow-wrap: break-word; }
.report-print td.break-any { overflow-wrap: anywhere; }
.report-print thead { display: table-header-group; }
.report-print tr { break-inside: avoid; }
@media screen { .report-print { max-width: 297mm; margin: 0 auto; overflow-x: auto; } }

/* Roles */
.permission-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1rem; }
.permission-grid legend { font-size: .95rem; font-weight: 700; }

/* Logo, settings pages */
.topbar .brand-mark.has-logo { display: inline-grid; }
.brand-mark img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.logo-preview { display: inline-grid; place-items: center; width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--lms-border); border-radius: 10px; background: #fff; }
.logo-blank { font-size: 2rem; color: var(--lms-primary); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .6rem; margin-bottom: .5rem; }
.swatch { display: flex; align-items: center; gap: .5rem; }
.swatch-colour { width: 2rem; height: 2rem; border-radius: 6px; border: 1px solid rgba(0,0,0,.2); }
.swatch .form-control-color { width: 2.5rem; }
.prefix { width: 9rem; font-family: monospace; }
.link-list { margin: 0; padding-left: 1.1rem; columns: 2 16rem; }
.wording-table td { width: 50%; overflow-wrap: anywhere; }
.language-switch { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem; }
.branch-switch { max-width: 12rem; }

/* ID card designs */
.id-head { display: flex; align-items: center; gap: 1.5mm; }
.id-head img { height: 6mm; width: 6mm; object-fit: contain; background: #fff; border-radius: 1mm; flex: 0 0 auto; }
.id-head span { overflow: hidden; text-overflow: ellipsis; }
.id-card.portrait { width: 54mm; height: 85.6mm; }
.id-card.portrait .id-body { flex-direction: column; align-items: center; text-align: center; gap: 1.2mm; overflow: hidden; }
.id-card.portrait .id-text { max-width: 100%; }
.id-card.portrait .photo { width: 22mm; height: 27.5mm; }
.id-card.portrait .id-foot .barcode { width: 46mm; }
.id-back-body { flex: 1; min-height: 0; overflow: hidden; padding: 2.5mm 3mm; font-size: 7.8pt; overflow-wrap: anywhere; }
.id-address { margin-top: 2mm; font-weight: 700; }
.id-sign { margin: 0 3mm 2.5mm auto; padding-top: .5mm; border-top: .3mm solid #000; font-size: 7.5pt; min-width: 24mm; text-align: center; }

/* Receipt designs */
.receipt.paper-58 { max-width: 58mm; font-size: 8.5pt; }
.receipt.paper-58 .receipt-small { font-size: 7.5pt; }
.receipt.paper-a5 { max-width: 128mm; font-size: 11pt; }
.receipt-logo { display: block; max-width: 22mm; max-height: 18mm; margin: 0 auto .25rem; }
.receipt p.receipt-sign { width: 60%; margin: 1.6rem 0 .3rem auto; border-top: 1px solid #000; font-size: 8.5pt; }
.receipt-preview { background: #fff; border: 1px solid var(--lms-border); border-radius: 8px; padding: .75rem; }
@page receipt-roll { margin: 2mm; }
@page receipt-sheet { size: A5; margin: 8mm; }
@media print {
    body.print-page .receipt.paper-58, body.print-page .receipt.paper-80 { page: receipt-roll; }
    body.print-page .receipt.paper-a5 { page: receipt-sheet; }
}

/* Phase 7: system pages */
.check-row { display: flex; gap: .75rem; align-items: flex-start; }
.check-row > .badge { flex: 0 0 7.5rem; text-align: left; margin-top: .15rem; }
.backup-get input { flex: 1 1 9rem; min-width: 0; max-width: 14rem; }
