:root {
  --bg: #0f1216;
  --panel: #181d24;
  --line: #2a313b;
  --text: #e8edf3;
  --muted: #9aa6b4;
  --lime: #a3e635;
  --blue: #4da3ff;
  --red: #ff6b6b;
  --green: #4ade80;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body.center { display: flex; align-items: center; justify-content: center; padding: 16px; }

h1 { margin: 0 0 4px; font-size: 24px; }

.sub { margin: 0 0 16px; color: var(--muted); }

.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}

label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }

input {
  width: 100%;
  padding: 14px;
  margin-bottom: 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
}

input:focus, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.btn {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 10px;
  background: var(--lime);
  color: #111;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: var(--red);
  font-size: 14px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.link { background: none; border: 0; color: var(--blue); font-size: 14px; cursor: pointer; padding: 6px; }

main { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; }

.pill {
  display: inline-block;
  margin-bottom: 18px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.pill.online { color: var(--green); border-color: rgba(74, 222, 128, 0.5); }
.pill.offline { color: var(--red); border-color: rgba(255, 107, 107, 0.5); }

.gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 120px;
  margin-bottom: 16px;
  border: 0;
  border-radius: 16px;
  color: #101418;
  font-weight: 800;
  cursor: pointer;
}

.gate .label { font-size: 32px; letter-spacing: 0.04em; }
.gate .hint { font-size: 14px; font-weight: 600; opacity: 0.8; font-variant-numeric: tabular-nums; }
.gate.enter { background: var(--lime); }
.gate.exit { background: var(--blue); }
.gate:disabled { opacity: 0.55; cursor: default; }

#msg { min-height: 24px; margin: 8px 0 0; text-align: center; color: var(--muted); }
#msg.ok { color: var(--green); }
#msg.error { color: var(--red); }

.tags { margin-top: 20px; }
.tags h2 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); font-size: 14px; }
.tags ul { list-style: none; margin: 0; padding: 0; }
.tagrow {
  padding: 6px 10px;
  margin-bottom: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 8px;
  font-size: 13px;
}
.tagrow.plate { border-left-color: var(--green); }
.tagrow.unknown { border-left-color: #ffb454; }
.line1, .line2 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.line2 { margin-top: 2px; justify-content: space-between; }
.chip { font-weight: 700; font-size: 14px; }
.chip.plate { color: var(--green); }
.chip.unknown { color: #ffb454; }
.where { padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.nick { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.when { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { color: var(--muted); font: 11px ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.assign { display: flex; gap: 4px; flex-shrink: 0; }
.unit-input { width: 84px; margin: 0; padding: 4px 8px; font-size: 13px; border-radius: 6px; }
.unit-save, .linkbtn {
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.unit-save { background: var(--lime); color: #111; }
.unit-save:disabled { opacity: 0.55; cursor: default; }
.linkbtn { background: none; color: var(--blue); font-weight: 600; }

/* management page */
main.wide { max-width: 720px; }
.section { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 14px; padding: 12px 14px; background: var(--panel); }
.section legend { padding: 0 6px; font-weight: 700; }
.field { margin-bottom: 10px; }
.field label { margin-bottom: 4px; }
.field input { margin-bottom: 2px; padding: 10px; }
.hint { color: var(--muted); font-size: 12px; }
.antenna { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.antenna:first-child { border-top: 0; }
.antenna input[type=checkbox] { width: 20px; height: 20px; margin: 0; }
.antenna .ant-name { margin: 0; color: var(--text); font-weight: 700; }
.antenna select, .antenna input[type=number] { grid-column: 1 / 3; width: 100%; padding: 10px; margin: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.antenna .muted { grid-column: 1 / 3; }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.actions .btn { width: auto; padding: 12px 22px; }
a.link { text-decoration: none; }
header > span { display: flex; align-items: center; gap: 10px; }
.field select { width: 100%; padding: 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.unit-input { text-transform: uppercase; }
.note-input { flex: 1 1 120px; min-width: 0; margin: 0; padding: 4px 8px; font-size: 13px; border-radius: 6px; }
.assign { flex-wrap: wrap; justify-content: flex-end; }
.line2 { flex-wrap: wrap; }

/* Reader test page: the live list of reads (administrators only) */
.live { margin-top: 24px; }
.livelist { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.liverow { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--lime); border-radius: 10px; font-size: 14px; }
.liverow.weak { opacity: 0.55; border-left-color: var(--line); }
.liverow .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.liverow .where { font-weight: 700; }
.liverow .num { font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all; }
.liverow .dbm { color: var(--muted); }
.field.check { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.field.check input[type=checkbox] { width: 20px; height: 20px; margin: 0; flex: none; }
.field.check label { margin: 0; color: var(--text); font-weight: 700; }
.field.check .hint { flex-basis: 100%; }
.live .actions label { display: inline-flex; align-items: center; gap: 8px; }
.live .actions input[type=checkbox] { width: 18px; height: 18px; margin: 0; }
.antenna input.specs { grid-column: 1 / 3; width: 100%; padding: 10px; margin: 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }
.liverow.group { flex-direction: column; align-items: flex-start; gap: 6px; }
.liverow .line1, .liverow .line2 { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.liverow .line2 { color: var(--muted); font-size: 13px; }
.liverow .line2 .where { color: var(--text); }
.liverow .chip.count { color: var(--lime); }
.testbanner { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: center; padding: 10px 16px; background: #ffb454; color: #1a1205; font-weight: 700; font-size: 14px; text-align: center; }
.testbanner .btn.small { padding: 6px 12px; font-size: 13px; margin: 0; background: #1a1205; color: #ffb454; }
.keyblock { margin: 10px 0; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.keyblock code { word-break: break-all; font-size: 12px; color: var(--lime); }
.keyblock input[type=text] { width: 100%; padding: 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font-family: ui-monospace, monospace; font-size: 13px; }
