:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --line: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-d: #0284c7;
  --ok: #22c55e;
  --bad: #ef4444;
  --warn: #f59e0b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }

header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
header.topbar .brand { font-weight: 700; font-size: 1.05rem; }
header.topbar .who { color: var(--muted); font-size: .85rem; }
.badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent-d); color: #fff; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px; margin: 14px 0;
}
.card h2 { margin: 0 0 4px; font-size: 1.1rem; }
.card .hint { color: var(--muted); font-size: .85rem; margin: 0 0 14px; }

label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input, select {
  width: 100%; padding: 12px; font-size: 1rem;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px;
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

button {
  font-size: 1rem; font-weight: 600; cursor: pointer;
  padding: 12px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent-d); color: #fff;
}
button.secondary { background: var(--panel-2); border-color: var(--line); color: var(--text); }
button.danger { background: transparent; color: var(--bad); border-color: var(--bad); padding: 7px 12px; font-size: .85rem; }
button.ghost { background: transparent; color: var(--accent); border: none; padding: 4px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.full { width: 100%; margin-top: 8px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: var(--panel-2); border-radius: 10px; padding: 12px; text-align: center; }
.stat .n { font-size: 1.6rem; font-weight: 700; }
.stat .l { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; }
.plate { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; letter-spacing: .06em; }

.pill { font-size: .72rem; padding: 2px 8px; border-radius: 999px; display: inline-block; }
.pill.guest { background: #1e3a5f; color: #7dd3fc; }
.pill.resident { background: #14532d; color: #86efac; }
.pill.expired { background: #4c1d1d; color: #fca5a5; }

.msg { padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: .9rem; }
.msg.err { background: #4c1d1d; color: #fecaca; border: 1px solid #7f1d1d; }
.msg.ok  { background: #14532d; color: #bbf7d0; border: 1px solid #166534; }
.muted { color: var(--muted); }
.tabs { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.tabs button { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.tabs button.active { background: var(--accent-d); color: #fff; border-color: var(--accent-d); }

/* enforcement scanner */
.result {
  text-align: center; border-radius: 16px; padding: 28px 16px; margin: 14px 0;
  font-weight: 800; font-size: 2rem;
}
.result.allowed { background: var(--ok); color: #052e16; }
.result.denied  { background: var(--bad); color: #450a0a; }
.result.unknown { background: var(--panel-2); color: var(--muted); font-size: 1.1rem; font-weight: 600; }
.result .sub { font-size: .95rem; font-weight: 600; margin-top: 6px; opacity: .9; }
.cache-status { font-size: .85rem; }
.cache-status .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.videoWrap { position: relative; line-height: 0; margin: 4px 0; }
#video { width: 100%; border-radius: 12px; background: #000; display: block; }
/* aiming box: line the plate up inside this strip */
/* tight strip: frame ONLY the big plate number — keep state name/slogan out */
#guide { position: absolute; left: 17%; right: 17%; top: 40%; height: 20%;
  border: 2px dashed var(--accent); border-radius: 8px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.34); }
#scanResult { width: 100%; border-radius: 12px; display: block; margin: 4px 0; }
.bigplate { font-size: 1.4rem; text-align: center; text-transform: uppercase; letter-spacing: .12em; }
.center { text-align: center; }
.hidden { display: none !important; }
.spacer { height: 8px; }
.small { font-size: .8rem; }
