:root{--library-cover-w:86px;--library-cover-h:124px}.app-shell{max-width:1400px}.icon-btn{min-width:2.5rem}.book-cover-thumb{width:var(--library-cover-w);height:var(--library-cover-h);object-fit:contain;background:var(--bs-tertiary-bg)}.cover-placeholder{width:var(--library-cover-w);height:var(--library-cover-h)}.books-search-toolbar{display:grid;grid-template-columns:minmax(360px,1fr) minmax(190px,250px) minmax(190px,250px);gap:.5rem;align-items:center}.books-search-box{min-width:0}.books-list-wrap{overflow:visible}.books-table{table-layout:fixed;margin-bottom:1rem}.books-table th,.books-table td{padding:.42rem .5rem}.books-table .cover-col{width:104px}.books-table .actions-col{width:52px;text-align:right;padding-right:.25rem}.books-table tbody tr{height:auto}.book-info-cell{vertical-align:middle}.book-title-line{display:flex;align-items:center;min-width:0}.book-status-line{display:flex;align-items:center;gap:.12rem;margin-top:.28rem;min-height:1.25rem}.book-title-link{font-size:1rem;line-height:1.25;min-width:0}.book-row-tools{display:inline-flex;align-items:center;gap:.18rem;flex:0 0 auto}.status-button{appearance:none;border:0;background:transparent;padding:.16rem .2rem;line-height:1;font-size:1.04rem;border-radius:.3rem;color:var(--bs-secondary-color);display:inline-flex;align-items:center;justify-content:center}.status-button:hover,.status-button:focus-visible{background:var(--bs-tertiary-bg);outline:0}.status-button.is-off{opacity:.28}.status-button.is-on{opacity:1}.status-button.is-disabled{pointer-events:none;cursor:default}.compact-action{padding:.15rem .32rem;line-height:1.1}.actions-col .book-actions{display:flex;justify-content:flex-end}.book-actions .dropdown-toggle::after{display:none}.book-subtitle{max-width:64rem;margin-top:.12rem}.author-line,.loan-line{margin-top:.1rem}.loan-line{display:none}.users-table .user-role-select{width:auto;min-width:86px}.min-w-0{min-width:0}

.cover-options{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:.75rem}.cover-option{position:relative;border:2px solid transparent;border-radius:.65rem;background:var(--bs-body-bg);color:var(--bs-body-color);padding:.35rem;min-height:280px;text-align:left}.cover-option.selected{border-color:var(--bs-primary);box-shadow:0 0 0 .15rem rgba(13,110,253,.12)}.cover-option img{width:100%;height:165px;object-fit:contain;background:var(--bs-tertiary-bg);border-radius:.35rem}.cover-option-body{padding-top:.35rem}.cover-option .cover-label{font-size:.75rem;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cover-quality{font-size:.82rem;line-height:1.2;margin-top:.25rem}.cover-meta,.cover-advice{font-size:.72rem;line-height:1.25;color:var(--bs-secondary-color);margin-top:.18rem}.cover-advice{min-height:2.2em}.cover-badge{position:absolute;top:.6rem;left:.6rem;background:var(--bs-success);color:#fff;font-size:.68rem;padding:.15rem .45rem;border-radius:999px;box-shadow:0 1px 3px rgba(0,0,0,.18)}

.scanner-modal .modal-content{background:#050505;color:#fff}.scanner-stage{position:relative;height:calc(100dvh - 150px);min-height:360px;overflow:hidden;background:#000}.scanner-stage video{width:100%;height:100%;object-fit:cover}.scanner-guide{position:absolute;left:7%;right:7%;top:50%;height:min(26vw,170px);min-height:105px;transform:translateY(-50%);border:3px solid rgba(255,255,255,.92);border-radius:14px;box-shadow:0 0 0 200vmax rgba(0,0,0,.4);pointer-events:none}.scanner-guide::after{content:"Align the ISBN barcode inside this box";position:absolute;top:100%;left:0;right:0;text-align:center;margin-top:.75rem;color:#fff;font-size:.9rem}.scanner-toolbar{display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}.scanner-toolbar .form-select{max-width:280px}.metadata-sources{font-size:.8rem}.loan-history .form-control{min-width:120px}.book-description{white-space:pre-line}.form-section{border-top:1px solid var(--bs-border-color);padding-top:1rem;margin-top:.5rem}

.cover-search-preview{max-height:360px}.cover-match-list{display:grid;gap:.65rem}.cover-match-card{display:grid;grid-template-columns:64px minmax(0,1fr);align-items:center;gap:.8rem;padding:.6rem;border:1px solid var(--bs-border-color);border-radius:.6rem;background:var(--bs-body-bg)}.cover-match-card:hover{background:var(--bs-tertiary-bg)}.cover-match-card img,.cover-match-placeholder{width:64px;height:92px;object-fit:contain;background:var(--bs-tertiary-bg)}.cover-match-placeholder{display:flex;align-items:center;justify-content:center;background:var(--bs-tertiary-bg)}.cover-search-empty{min-height:260px;border:1px dashed var(--bs-border-color);border-radius:.75rem;display:flex;flex-direction:column;gap:.6rem;align-items:center;justify-content:center;color:var(--bs-secondary-color)}.cover-search-empty i{font-size:2rem}

@media(max-width:991.98px){.books-search-toolbar{grid-template-columns:minmax(0,1fr) 1fr}.books-search-box{grid-column:1/-1}.books-sort,.books-direction{min-width:0}}
@media(max-width:767.98px){:root{--library-cover-w:64px;--library-cover-h:94px}.app-shell{padding-left:.65rem;padding-right:.65rem}.books-heading{margin-bottom:.65rem!important}.books-heading .btn{padding:.35rem .55rem}.books-search-toolbar{grid-template-columns:1fr 1fr;gap:.4rem}.books-table .cover-col{width:76px}.books-table .actions-col{width:44px;padding-left:.15rem;padding-right:.15rem}.books-table th,.books-table td{padding:.35rem .3rem}.books-table thead th.cover-col{font-size:0;color:transparent}.book-title-line{gap:.35rem}.book-status-line{margin-top:.22rem}.book-title-link{font-size:.95rem}.book-row-tools{gap:.08rem}.status-button{font-size:1rem;padding:.12rem}.compact-action{padding:.12rem .25rem}.books-table .author-line,.books-table .book-subtitle{font-size:.76rem}.loan-line{display:block;font-size:.75rem}.scanner-stage{height:calc(100dvh - 185px)}.cover-options{grid-template-columns:repeat(3,minmax(0,1fr))}.cover-option{min-height:220px}.cover-option img{height:115px}.cover-meta,.cover-advice,.cover-quality{font-size:.68rem}.users-table td,.users-table th{padding:.45rem .35rem}}
@media(max-width:480px){.books-search-toolbar{grid-template-columns:1fr}.books-search-box,.books-sort,.books-direction{grid-column:1}.books-heading h1{font-size:1.35rem}.cover-options{grid-template-columns:repeat(2,minmax(0,1fr))}.book-title-line{align-items:flex-start}.book-status-line{margin-top:.18rem}.book-row-tools{width:100%;margin-top:.15rem}}

.book-detail-cover-wrap{width:100%;max-width:360px}.book-detail-cover{display:block;width:100%;height:auto}.book-detail-cover-placeholder{width:100%;aspect-ratio:2/3;min-height:220px;display:flex;align-items:center;justify-content:center;overflow:hidden;position:relative}.book-detail-cover-placeholder i{font-size:4.5rem;line-height:1;position:static;width:auto;height:auto}.book-detail-status{position:relative;z-index:1;clear:both}
@media(max-width:767.98px){.book-detail-cover-wrap{max-width:240px}.book-detail-cover-placeholder{min-height:180px}}

.cover-option.cover-unavailable{opacity:.62;border-style:dashed}.cover-option.cover-unavailable.selected{border-color:var(--bs-danger);box-shadow:0 0 0 .15rem rgba(220,53,69,.12)}

/* Theme */
html{background:var(--bs-body-bg)}
body{min-height:100vh;background:var(--bs-body-bg);color:var(--bs-body-color);transition:background-color .15s ease,color .15s ease}
.nav-theme-toggle{line-height:1;min-width:2.25rem}
.theme-toggle-icon{display:inline-block;width:1em;text-align:center}
.book-cover-thumb,.cover-option img,.cover-match-card img,.cover-match-placeholder{transition:background-color .15s ease}
.cover-badge{color:#fff}
[data-bs-theme="dark"] .book-cover-thumb,[data-bs-theme="dark"] .cover-option img,[data-bs-theme="dark"] .cover-match-card img,[data-bs-theme="dark"] .cover-match-placeholder{background:#181b1f}
[data-bs-theme="dark"] .card,[data-bs-theme="dark"] .dropdown-menu,[data-bs-theme="dark"] .modal-content{box-shadow:0 .125rem .35rem rgba(0,0,0,.24)}
[data-bs-theme="dark"] .table{--bs-table-bg:transparent}
.books-filter{min-width:0}
.books-search-toolbar{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center}
.books-search-toolbar .books-search-box{flex:1 1 320px;min-width:240px}
.books-search-toolbar .form-select{flex:0 1 190px;min-width:150px}
@media(max-width:575.98px){.books-search-toolbar .form-select{flex:1 1 calc(50% - .25rem)}}

/* Keep the ISBN readable on narrow phones: input on its own row, actions below. */
@media(max-width:575.98px){.isbn-lookup-group{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:.4rem}.isbn-lookup-group>.form-control{grid-column:1/-1;width:100%;min-width:0;border-radius:var(--bs-border-radius-lg)!important}.isbn-lookup-group>.btn{position:static!important;border-radius:var(--bs-border-radius)!important}.isbn-lookup-group>#btn-scan-barcode,.isbn-lookup-group>#btn-fetch-metadata{width:100%}}

/* Duplicate ISBN guard: shown before any external metadata request. */
.duplicate-book-card{display:grid;grid-template-columns:92px minmax(0,1fr);gap:1rem;align-items:center;padding:1rem;border:1px solid var(--bs-border-color);border-radius:.8rem;background:var(--bs-tertiary-bg)}
.duplicate-book-cover-wrap{width:92px;height:132px;border-radius:.55rem;overflow:hidden;background:var(--bs-body-bg);display:flex;align-items:center;justify-content:center}
.duplicate-book-cover{width:100%;height:100%;object-fit:contain}.duplicate-book-cover-placeholder{width:100%;height:100%;display:flex;align-items:center;justify-content:center;color:var(--bs-secondary-color);font-size:2rem}
@media(max-width:480px){.duplicate-book-card{grid-template-columns:70px minmax(0,1fr);gap:.75rem;padding:.75rem}.duplicate-book-cover-wrap{width:70px;height:104px}}

/* Explicit per-source imports on Edit book stay collapsed until requested. */
.book-section-toolbar{min-height:2rem}.source-import-panel{border:1px solid var(--bs-border-color);border-radius:.6rem;background:var(--bs-tertiary-bg);padding:.75rem}.manual-import-check-col{width:4.5rem;text-align:center}.manual-metadata-diff th{white-space:nowrap}.manual-import-value{min-width:12rem;max-width:32rem;white-space:pre-wrap;overflow-wrap:anywhere;vertical-align:top}.manual-metadata-diff td,.manual-metadata-diff th{padding-top:.55rem;padding-bottom:.55rem}
@media(max-width:767.98px){.manual-metadata-diff{font-size:.78rem}.manual-import-value{min-width:10rem;max-width:20rem}.source-import-panel{padding:.65rem}}
