:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #6b7382;
  --line: #e2e5ea;
  --accent: #1f6feb;
  --accent-soft: #dbe7fd;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
  --plate-bg: #ffd83d;
  --plate-text: #111;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1318;
    --card: #171c23;
    --text: #e6e9ee;
    --muted: #8d96a5;
    --line: #2a313b;
    --accent: #5b9dff;
    --accent-soft: #1d2d47;
    --ok: #3fb950;
    --warn: #d29922;
    --bad: #f85149;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1rem; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .85rem; }

.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--card); border-bottom: 1px solid var(--line); padding: .6rem 1rem;
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: .5rem; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.topbar nav a { padding: .35rem .7rem; border-radius: 6px; text-decoration: none; color: var(--text); }
.topbar nav a.active, .topbar nav a:hover { background: var(--accent-soft); color: var(--accent); }
.logout { margin: 0; }
.zonebar { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; max-width: 1200px; margin: .75rem auto 0; padding: 0 1rem; }
.zonebar a { padding: .25rem .7rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .9rem; }
.zonebar a.active { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; overflow-x: auto; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; }
.cols > .card { margin-bottom: 0; }
.cols { margin-bottom: 1rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; display: flex; flex-direction: column; }
.tile .num { font-size: 2rem; font-weight: 700; }
.tile span:last-child { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr.dup td { opacity: .6; }

.plate {
  display: inline-block; font-family: "Charles Wright", "Arial Narrow", sans-serif; font-weight: 700;
  background: var(--plate-bg); color: var(--plate-text); padding: .05rem .4rem; border-radius: 3px;
  text-decoration: none; letter-spacing: .04em; border: 1px solid #0003;
}
.plate.big { font-size: 1.4rem; padding: .1rem .6rem; }

.thumbs { white-space: nowrap; }
.thumb { height: 54px; width: auto; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; }
.thumb-plate { height: 28px; width: auto; border-radius: 2px; vertical-align: middle; margin-left: .3rem; }

.badge { font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge-closed { background: transparent; color: var(--ok); border: 1px solid var(--ok); }
.badge-open { background: var(--accent-soft); color: var(--accent); }
.badge-no_exit, .badge-no_entry { background: transparent; color: var(--warn); border: 1px solid var(--warn); }

.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .2rem; }
.filters label.check { flex-direction: row; align-items: center; gap: .4rem; padding-bottom: .45rem; }
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: .4rem .55rem;
}
button { background: var(--accent); color: #fff; border-color: var(--accent); cursor: pointer; }
button:hover { filter: brightness(1.08); }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack label { display: flex; flex-direction: column; gap: .25rem; }
.stack label.check { flex-direction: row; align-items: flex-start; gap: .5rem; }
.stack button { align-self: flex-start; }

.strip { display: flex; gap: .75rem; overflow-x: auto; padding-bottom: .25rem; }
.strip-item { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-decoration: none; color: var(--muted); font-size: .8rem; min-width: 110px; }
.strip-item img { height: 110px; width: auto; max-width: 160px; border-radius: 6px; border: 1px solid var(--line); object-fit: cover; }

.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin: 1rem 0; }

.status { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 0; }
.status dt { color: var(--muted); }
.status dd { margin: 0; }

.chart { margin: 0; }
.chart figcaption { font-weight: 600; margin-bottom: .5rem; }
.chart svg { width: 100%; height: 190px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .val { fill: var(--muted); font-size: 8px; text-anchor: middle; }
.chart .lbl { fill: var(--muted); font-size: 8px; text-anchor: middle; }

.login-box { max-width: 360px; margin: 10vh auto 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; }
.login-box form { display: flex; flex-direction: column; gap: .8rem; }
.login-box label { display: flex; flex-direction: column; gap: .25rem; }
.error { color: var(--bad); }
.notice { background: var(--accent-soft); padding: .75rem; border-radius: 8px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }

tr.incomplete td { color: var(--warn); }
.statement tfoot th { border-top: 2px solid var(--text); text-transform: none; font-size: 1rem; color: var(--text); }
@media print {
  .topbar, .zonebar, footer, .noprint { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; }
  .tile { border: 1px solid #999; }
}

@media (max-width: 600px) {
  .reads th:nth-child(4), .reads td:nth-child(4), .reads th:nth-child(5), .reads td:nth-child(5) { display: none; }
}
