/* Book catalogue (catalogue.php) */
.cat-sec { padding-top: 36px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.cat-main { min-width: 0; }

.cat-flash { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: 16px; border: 1px solid; margin-bottom: 20px; font-weight: 600; }
.cat-flash .ico { flex: none; width: 22px; height: 22px; margin-top: 1px; }
.cat-flash.is-ok { background: #F0FBF4; border-color: #BFE6CD; color: #14532D; }
.cat-flash.is-bad { background: #FEF3F2; border-color: #F8C9C4; color: #7F1D1D; }

.cat-search { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1fr) auto auto; gap: 10px; align-items: center; width: 100%; max-width: none; padding: 14px; background: #fff; border: 1px solid #E3EAE5; border-radius: 20px; box-shadow: 0 6px 20px rgba(11, 74, 34, .05); }
.cat-search > * { min-width: 0; margin: 0; }
.cat-q { position: relative; }
.cat-q .ico { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: #64748B; pointer-events: none; }
.cat-q input { width: 100%; height: 48px; padding: 0 14px 0 44px; border: 1px solid #D5DDD8; border-radius: 14px; font: inherit; background: #FAFAF9; }
.cat-search select { width: 100%; height: 48px; padding: 0 12px; border: 1px solid #D5DDD8; border-radius: 14px; font: inherit; background: #FAFAF9; }
.cat-q input:focus, .cat-search select:focus { outline: 2px solid #16A34A; outline-offset: 1px; background: #fff; }
.cat-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cat-check input { width: 18px; height: 18px; accent-color: #15803D; }
.cat-search .btn { height: 48px; justify-content: center; }
@media (max-width: 1240px) { .cat-search { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .cat-q { grid-column: 1 / -1; } }

.cat-count { margin: 18px 2px 14px; color: #57534E; min-height: 1.5em; }
.cat-count strong { color: #14532D; }

.cat-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.cat-book { display: flex; gap: 14px; padding: 16px; background: #fff; border: 1px solid #E3EAE5; border-radius: 20px; min-width: 0; transition: box-shadow .2s ease, border-color .2s ease; }
.cat-book:hover { border-color: #BFE6CD; box-shadow: 0 10px 26px rgba(11, 74, 34, .08); }
.cat-cover { position: relative; flex: none; width: 64px; height: 88px; border-radius: 6px 12px 12px 6px; display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--h) 45% 34%), hsl(var(--h) 50% 24%)); color: #fff; box-shadow: inset 5px 0 0 rgba(255, 255, 255, .18), 0 6px 14px rgba(0, 0, 0, .12); }
.cat-cover .ico { position: absolute; right: 6px; bottom: 6px; width: 16px; height: 16px; opacity: .55; }
.cat-cover span { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.cat-info { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.cat-info h3 { margin: 0; font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.cat-by { margin: 2px 0 0; color: #57534E; font-size: .95rem; overflow-wrap: anywhere; }
.cat-meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .85rem; color: #64748B; }
.cat-meta a { color: #15803D; font-weight: 600; text-decoration: none; }
.cat-meta a:hover { text-decoration: underline; }
.cat-status { margin: 10px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .85rem; color: #57534E; }
.cat-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .8rem; }
.cat-pill.ok { background: #DCFCE7; color: #14532D; }
.cat-pill.out { background: #FEF3C7; color: #7C4A03; }
.cat-pill.held { background: #E0E7FF; color: #312E81; }
.cat-act { margin-top: auto; padding-top: 12px; }
.cat-btn { width: 100%; justify-content: center; min-height: 42px; padding-top: 8px; padding-bottom: 8px; font-size: .95rem; }
.cat-note { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #14532D; font-size: .92rem; }
.cat-note .ico { width: 18px; height: 18px; flex: none; }

.cat-empty { text-align: center; padding: 48px 20px; background: #fff; border: 1px dashed #CBD5D0; border-radius: 22px; }
.cat-empty > .ico { width: 44px; height: 44px; color: #15803D; }
.cat-empty h2 { margin: 12px 0 6px; font-size: 1.3rem; }
.cat-empty p { margin: 0 auto 16px; max-width: 460px; color: #57534E; }

.cat-pages { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 26px; }
.cat-pages a { min-width: 44px; height: 44px; padding: 0 14px; display: grid; place-items: center; border: 1px solid #D5DDD8; border-radius: 12px; background: #fff; font-weight: 700; color: #14532D; text-decoration: none; }
.cat-pages a.on { background: #15803D; border-color: #15803D; color: #fff; }

.cat-side { position: sticky; top: 100px; display: grid; gap: 16px; scroll-margin-top: 110px; min-width: 0; }
.cat-card { background: #fff; border: 1px solid #E3EAE5; border-radius: 22px; padding: 22px; min-width: 0; }
.cat-kicker { margin: 0 0 4px; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #B45309; }
.cat-card h2 { margin: 0; font-size: 1.3rem; overflow-wrap: anywhere; }
.cat-card h3 { margin: 18px 0 8px; font-size: 1rem; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.cat-card h3 span { font-size: .82rem; font-weight: 600; color: #64748B; }
.cat-how h3 { margin-top: 0; }
.cat-code { margin: 2px 0 0; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-weight: 700; color: #15803D; }
.cat-muted { margin: 6px 0 0; color: #57534E; font-size: .93rem; }
.cat-signin { display: grid; gap: 12px; margin-top: 14px; }
.cat-signin .field { margin: 0; }
.cat-signin input { width: 100%; }
.cat-signin .btn { justify-content: center; }
.cat-join { margin: 14px 0 0; font-size: .93rem; }
.cat-join a { font-weight: 700; color: #15803D; }
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cat-list li { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 10px 12px; background: #FAFAF9; border: 1px solid #EEF1EF; border-radius: 14px; }
.cat-list li > div { min-width: 0; }
.cat-list strong { display: block; font-size: .95rem; overflow-wrap: anywhere; }
.cat-list small { color: #64748B; }
.cat-list b.ok { color: #15803D; } .cat-list b.bad { color: #B91C1C; }
.cat-link { background: none; border: 0; padding: 4px 0; font: inherit; font-size: .88rem; font-weight: 700; color: #B91C1C; cursor: pointer; text-decoration: underline; }
.cat-out { margin-top: 18px; }
.cat-out .btn { width: 100%; justify-content: center; }
.cat-how ol { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

@media (max-width: 1024px) {
  .cat-layout { grid-template-columns: minmax(0, 1fr); }
  .cat-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 560px) {
  .cat-search { padding: 12px; grid-template-columns: minmax(0, 1fr); }
  .cat-grid { grid-template-columns: minmax(0, 1fr); }
  .cat-book { padding: 14px; }
}

/* Real book covers (uploads/covers/<code>.jpg); books without one keep the coloured tile */
.cat-cover.has-img { width: 88px; height: 128px; padding: 0; overflow: hidden; background: #F1F5F2; border-radius: 4px 8px 8px 4px; box-shadow: 0 4px 12px rgba(15, 23, 42, .18); }
.cat-cover.has-img img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Reserve with a collection date */
.cat-reserve { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.cat-reserve label { display: grid; gap: 3px; min-width: 0; font-size: .78rem; font-weight: 700; color: #57534E; }
.cat-reserve input[type="date"] { width: 100%; min-width: 0; height: 42px; padding: 0 10px; border: 1px solid #D5DDD8; border-radius: 12px; font: inherit; font-weight: 600; color: #1C1917; background: #FAFAF9; }
.cat-reserve input[type="date"]:focus { outline: 2px solid #16A34A; outline-offset: 1px; background: #fff; }
.cat-reserve .cat-btn { width: auto; padding-left: 18px; padding-right: 18px; }
@media (max-width: 420px) { .cat-reserve { grid-template-columns: minmax(0, 1fr); } .cat-reserve .cat-btn { width: 100%; } }
