:root {
  --bg: #f6f6f3; --panel: #fff; --ink: #1d2025; --muted: #666d76; --line: #dcdcd5;
  --accent: #1f5fbf; --accent-ink: #fff; --ok: #1d7a46; --warn: #a56200; --bad: #b3261e;
  --chip: #eceff4; color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15171a; --panel: #1e2126; --ink: #e6e8eb; --muted: #9aa1ab; --line: #343941;
          --accent: #6ea3ff; --accent-ink: #0b1220; --chip: #2a2f36; --ok: #5fcf8b; --warn: #e0a64a; --bad: #ff8a80; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
main { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.top { display: flex; gap: 1rem; align-items: center; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.topsearch { flex: 1; min-width: 200px; } .topsearch input { width: 100%; }
nav { display: flex; gap: 1rem; margin-left: auto; align-items: center; }
input, select, textarea, button { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: .4rem .6rem; }
textarea { width: 100%; } input[type=text], input[type=search], input[type=password], input[type=number], input[type=email], select { max-width: 100%; }
button, .btn { background: var(--accent); color: var(--accent-ink); border: 0; cursor: pointer; padding: .45rem .9rem; border-radius: 6px; display: inline-block; }
button.secondary, .btn.secondary { background: var(--chip); color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--bad); color: #fff; }
.messages { list-style: none; padding: 0; } .messages li { padding: .6rem .9rem; border-radius: 6px; margin-bottom: .5rem; background: var(--chip); }
.messages .success { border-left: 4px solid var(--ok); } .messages .error { border-left: 4px solid var(--bad); } .messages .warning { border-left: 4px solid var(--warn); }
.layout { display: grid; grid-template-columns: 250px 1fr; gap: 1.2rem; align-items: start; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .9rem 1rem; margin-bottom: 1rem; }
.facets h3 { margin: .8rem 0 .3rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.facets ul { list-style: none; margin: 0; padding: 0; } .facets li { display: flex; justify-content: space-between; gap: .5rem; }
.facets .on { font-weight: 700; } .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.searchbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; } .searchbar input[name=q] { flex: 1; min-width: 220px; }
.book { display: grid; grid-template-columns: 56px 1fr; gap: .9rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.book:last-child { border: 0; }
.cover { width: 56px; height: 76px; object-fit: cover; border-radius: 3px; background: var(--chip); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--muted); }
.book h3 { margin: 0; font-size: 1.02rem; } .sub { color: var(--muted); } .meta { color: var(--muted); font-size: .88rem; }
.chip { display: inline-block; background: var(--chip); border-radius: 99px; padding: 0 .6rem; font-size: .8rem; margin-right: .25rem; color: var(--ink); }
.chip.pdf { color: var(--accent); } .chip.phys { color: var(--ok); }
.detail { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; } @media (max-width: 800px) { .detail { grid-template-columns: 1fr; } }
.detail .cover { width: 200px; height: auto; min-height: 260px; }
dl.kv { display: grid; grid-template-columns: 9rem 1fr; gap: .25rem .8rem; margin: 0; } dl.kv dt { color: var(--muted); }
table { width: 100%; border-collapse: collapse; } th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.form-row { margin-bottom: .8rem; } .form-row label { display: block; font-weight: 600; margin-bottom: .2rem; } .help, .helptext { color: var(--muted); font-size: .85rem; }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: .2rem 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; } @media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }
.pager { display: flex; justify-content: space-between; margin-top: 1rem; }
.st-review { color: var(--warn); } .st-committed { color: var(--ok); } .st-failed { color: var(--bad); } .st-duplicate { color: var(--muted); }
.bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--accent); }
.conf { font-variant-numeric: tabular-nums; } .conf.low { color: var(--bad); } .conf.mid { color: var(--warn); } .conf.high { color: var(--ok); }
.htmx-request { opacity: .6; transition: opacity .2s; }
details > summary { cursor: pointer; color: var(--muted); }
.pdfframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 6px; }
/* allauth pages (main.auth is set in templates/allauth/layouts/base.html) */
main.auth { max-width: 560px; }
main.auth form p { margin: .6rem 0; } main.auth form label { display: block; font-weight: 600; }
main.auth input[type=text], main.auth input[type=password], main.auth input[type=email], main.auth input[type=number] { width: 100%; }
main.auth table { margin: 1rem 0; }
.form-row input[type=text], .form-row input[type=number], .form-row input[type=url], .form-row select:not([multiple]) { width: 100%; }
.form-row select[multiple] { width: 100%; min-height: 9rem; }
.grid2 .form-row input[name=series_index], .grid2 .form-row input[name=year] { width: 8rem; }
