:root {
  --primary: #0b5cad;
  --primary-dark: #08457f;
  --bg: #f4f6fa;
  --surface: #fff;
  --text: #1b2430;
  --muted: #5f6b7a;
  --border: #dde3ec;
  --current: #1b873f;
  --current-bg: #d7f5e0;
  --hist-bg: #e6e9ee;
  --warn-bg: #fff3d6;
  --error: #b3261e;
  --error-bg: #f9dedc;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); }
.loading { padding: 2rem; color: var(--muted); }

header.top { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.2rem; background: var(--primary); color: #fff; flex-wrap: wrap; }
header.top .brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: 1.1rem; }
header.top .brand img { width: 30px; height: 30px; }
header.top nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
header.top nav a { color: #fff; text-decoration: none; padding: .4rem .8rem; border-radius: 6px; opacity: .85; }
header.top nav a.active, header.top nav a:hover { background: rgba(255,255,255,.18); opacity: 1; }
header.top .session { font-size: .85rem; opacity: .9; }
header.top button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); }

main { max-width: 1200px; margin: 0 auto; padding: 1.2rem; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; }

.toolbar { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; min-width: 200px; }
input[type=search], input[type=date] { padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 6px; font: inherit; background: #fff; width: 100%; }
button, .button { padding: .45rem .9rem; border: 1px solid var(--primary); background: var(--primary); color: #fff; border-radius: 6px; font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .button.secondary { background: #fff; color: var(--primary); }
button:hover, .button:hover { filter: brightness(1.08); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.2rem; }
.count { color: var(--muted); font-size: .9rem; margin-bottom: .5rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
td.wrap { white-space: normal; }
th { background: #f8fafc; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); position: sticky; top: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f1f6fd; }
tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-weight: 600; }
.muted { color: var(--muted); }
.mobile-only { display: none; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.chip.current { background: var(--current-bg); color: var(--current); }
.chip.hist { background: var(--hist-bg); color: var(--muted); }
.chip.warn { background: var(--warn-bg); color: #8a5300; }

.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.detail-head .number { font-family: var(--mono); font-size: 1.8rem; font-weight: 700; }
.detail-head .name { font-size: 1.1rem; }
.current-batch { margin-top: 1rem; background: var(--current-bg); border-color: #b7e6c5; }
.current-batch .label { color: var(--current); font-weight: 700; font-size: .8rem; letter-spacing: .05em; }
.current-batch .value { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; margin: .2rem 0; }
.current-batch.none { background: var(--hist-bg); border-color: var(--border); }
.facts { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: .6rem; color: var(--muted); font-size: .9rem; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login .card { max-width: 760px; width: 100%; display: grid; grid-template-columns: 1fr 300px; gap: 2rem; align-items: center; padding: 2rem; }
.login h1 { display: flex; align-items: center; gap: .6rem; }
.login h1 img { width: 36px; height: 36px; }
.login ol { padding-left: 1.2rem; }
.login ol li { margin: .35rem 0; }
.qr { text-align: center; }
.qr img { width: 260px; height: 260px; border: 1px solid var(--border); border-radius: 8px; }
.qr .timer { color: var(--muted); font-size: .85rem; margin-top: .4rem; }
.notice { padding: .7rem .9rem; border-radius: 8px; margin: .8rem 0; }
.notice.error { background: var(--error-bg); color: var(--error); }
.notice.info { background: var(--warn-bg); }
@media (max-width: 720px) {
  .login .card { grid-template-columns: 1fr; }
  header.top .session { display: none; }
  main { padding: .8rem; }
  .opt { display: none; }
  .mobile-only { display: block; font-size: .85rem; }
  .toolbar label { flex: 1; }
  th, td { padding: .5rem .6rem; }
  td.wrap { white-space: normal; }
  .detail-head .number { font-size: 1.4rem; }
}
