/* Compact Calibre-Web overlay; native readers and book grid retain their layout. */
:root { --bw-line:#dce2e6; --bw-muted:#596773; --bw-active:#225a78; }
.bw-layout {display:flex; align-items:flex-start; gap:24px;}
body > .container-fluid > .bw-layout > .bw-sidebar {flex:0 0 212px; width:212px; padding:0 8px 16px 0; scrollbar-width:thin;}
body > .container-fluid > .bw-layout > .bw-main {flex:1; min-width:0; width:auto; padding:0 24px 24px 0;}
.bw-main > h1 {font-size:26px; line-height:1.25; margin:8px 0 20px;}
#scnd-nav .bw-nav-heading {font-size:11px; font-weight:700; letter-spacing:.04em; color:var(--bw-muted); margin:16px 0 4px; padding:0 10px;}
#scnd-nav .bw-nav-heading:first-child {margin-top:8px;}
#scnd-nav li:not(.nav-head) > a {display:block; padding:6px 10px; line-height:1.35; font-size:13px; overflow-wrap:anywhere; border-radius:3px;}
#scnd-nav li.active > a {background:#e9f1f5; color:#174d6b; font-weight:600;}
#scnd-nav .glyphicon {margin-right:5px; color:var(--bw-muted);}
#scnd-nav .create-shelf {border-top:1px solid var(--bw-line); margin-top:12px; padding-top:8px;}
a:focus-visible,button:focus-visible,summary:focus-visible,input:focus-visible,select:focus-visible {outline:2px solid #286d99!important; outline-offset:3px;}
.bw-toolbar {display:flex; flex-wrap:wrap; align-items:flex-start; gap:12px 20px; margin-bottom:20px; padding-bottom:16px; border-bottom:1px solid var(--bw-line);}
.bw-sort,.bw-filter-general,.bw-letter-group {display:flex; flex-wrap:wrap; align-items:center; gap:4px;}
.bw-alphabet {display:flex; flex:1 1 350px; flex-wrap:wrap; gap:8px 12px; min-width:0;}
.bw-alphabet .character {display:flex; flex-wrap:wrap; gap:8px 12px; min-width:0;}
.bw-letter-group + .bw-letter-group {border-left:1px solid var(--bw-line); padding-left:12px;}
.bw-toolbar .btn {background:#fff; color:#374955; border:1px solid #c7d1d8; border-radius:3px; min-width:32px; min-height:32px; padding:5px 8px; font-size:13px; box-shadow:none;}
.bw-toolbar .btn:hover {background:#edf3f6;}
.bw-toolbar .btn.active {background:var(--bw-active); color:#fff; border-color:var(--bw-active); box-shadow:none;}
.bw-toolbar [hidden],.bw-list-item[hidden],.bw-series-card[hidden],.bw-years[hidden],.bw-nav-heading[hidden] {display:none!important;}
.bw-list-grid {display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px 24px;}
.bw-list-item.row {display:flex; align-items:baseline; gap:12px; margin:0; padding:8px 0; min-width:0; border-bottom:1px solid #eef1f3;}
.bw-label {flex:1; min-width:0; order:0; overflow-wrap:anywhere;}
.bw-label > a {display:block; color:#285773; line-height:1.45;}
.bw-count {order:1; flex:0 0 auto;}
.bw-count .badge {background:transparent; padding:0; border-radius:0; color:var(--bw-muted); font-size:12px; font-weight:400; font-variant-numeric:tabular-nums;}
.bw-years {margin-bottom:20px; padding:10px 12px; border:1px solid var(--bw-line); border-radius:3px;}
.bw-years summary {cursor:pointer; font-weight:600; min-height:28px; line-height:28px; color:#334b5a;}
.bw-year-grid {display:grid; grid-template-columns:repeat(auto-fill,minmax(115px,1fr)); gap:0 20px; margin-top:8px;}
.bw-series-grid {display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:20px 16px;}
.container-fluid .bw-series-card.book {display:flex; width:auto; max-width:none; min-width:0; margin:0; padding:10px; border:1px solid var(--bw-line); border-radius:3px;}
.container-fluid .bw-series-card .cover {height:190px; margin:0; background:#f5f7f8;}
.bw-series-card .cover a,.bw-series-card .cover .img {display:block; height:100%; width:100%; position:relative;}
.container-fluid .bw-series-card .cover img {height:100%; width:100%; max-height:100%; object-fit:contain; border:0; box-shadow:none;}
.container-fluid .bw-series-card .meta {margin-top:12px;}
.container-fluid .bw-series-card .meta .title {font-size:14px; line-height:20px; height:40px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; color:#285773;}
.container-fluid .bw-series-card .meta .bw-series-count {color:var(--bw-muted); font-size:12px; line-height:18px; margin-top:4px;}
.bw-cover-missing:after {content:'—';position:absolute; inset:0; display:grid;place-items:center;color:#657581;pointer-events:none;}
@media(min-width:1600px){.bw-series-grid{grid-template-columns:repeat(8,minmax(0,1fr));}.bw-list-grid{grid-template-columns:repeat(4,minmax(0,1fr));}}
@media(min-width:992px) and (max-width:1199px){.bw-series-grid{grid-template-columns:repeat(5,minmax(0,1fr));}.bw-list-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.container-fluid .bw-series-card .cover{height:165px;}}
@media(min-width:768px) and (max-width:991px){.bw-series-grid{grid-template-columns:repeat(3,minmax(0,1fr));}.bw-list-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.bw-layout{gap:16px;}}
@media(max-width:767px){.bw-layout{display:block;}body>.container-fluid>.bw-layout>.bw-sidebar{width:auto;padding:0;}body>.container-fluid>.bw-layout>.bw-main{width:100%;max-height:none;overflow:visible;padding:0 16px 20px 0;}.bw-main>h1{font-size:24px;margin-top:16px;}.bw-list-grid{grid-template-columns:1fr;}.bw-series-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}.container-fluid .bw-series-card .cover{height:190px;}.bw-toolbar .btn{min-height:36px;min-width:36px;}.bw-letter-group+.bw-letter-group{border-left:0;padding-left:0;}.bw-letter-group{flex-basis:100%;}#scnd-nav .bw-nav-heading{display:block;}.bw-alphabet{flex-basis:100%;}.bw-toolbar{gap:12px;}.navbar-form .input-group{max-width:100%;}}
@media(max-width:359px){.container-fluid .bw-series-card .cover{height:150px;}.container-fluid .bw-series-card.book{padding:8px;}}

.bw-years summary {list-style:none;display:flex;align-items:center;gap:8px;}
.bw-years summary::before {content:'▸';font-size:14px;}
.bw-years[open] summary::before {content:'▾';}
.bw-years summary::-webkit-details-marker {display:none;}
.bw-alphabet .character {flex-direction:column;}
.bw-letter-group + .bw-letter-group {border-left:0;padding-left:0;}
.container-fluid .book.bw-series-card .cover span img {box-shadow:none;border:0;}

.bw-alphabet .character {display:grid;grid-template-columns:minmax(0,1fr);width:100%;}
.bw-letter-group {min-width:0;max-width:100%;}
@media(min-width:768px){body>.container-fluid>.bw-layout>.bw-main{max-height:calc(100vh - 111px);overflow-y:auto;}}
