:root {
  --red: #c8102e;
  --navy: #00205b;
  --navy-deep: #001433;
  --blue: #0057b8;
  --gold: #c6a15b;
  --ink: #1b1b1b;
  --muted: #3d4a5c;
  --line: #d5dbe3;
  --paper: #f4f7fb;
  --hero: #e7eef6;
  --white: #ffffff;
  --focus: #ffdd00;
  --max: 1120px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--white);
  font-size: 1.0625rem;
  line-height: 1.5;
}

img { display: block; max-width: 100%; height: auto; }

button,
input { font: inherit; }

a { color: var(--blue); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 1200;
  background: var(--focus);
  color: var(--ink);
  font-weight: 700;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
}

.skip-link:focus { top: 0.5rem; }

.wrap {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}

.fiction-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--red);
  color: var(--white);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.35;
  text-align: center;
  padding: 0.9rem 1.25rem;
}

.fiction-banner p { margin: 0 auto; max-width: 62rem; }

.masthead { background: var(--white); border-bottom: 1px solid var(--line); }

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 0.85rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--navy);
  text-decoration: none;
  min-width: 0;
}

.brand-text { min-width: 0; }

.brand img { width: min(220px, 46vw); height: auto; flex: none; }

.brand-name {
  display: block;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-url {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.masthead-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.masthead-tools form { margin: 0; flex: none; }

.who {
  font-weight: 700;
  color: var(--navy);
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-toggle {
  display: none;
  align-items: center;
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 4px;
  font-weight: 700;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.main-nav { background: var(--navy); }

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav a {
  display: block;
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  padding: 0.85rem 1rem;
}

.main-nav a:hover,
.main-nav a:focus-visible { background: #12356f; }

.main-nav a[aria-current="page"] { box-shadow: inset 0 -4px 0 var(--gold); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  color: var(--white);
  border: 2px solid var(--navy);
  border-radius: 4px;
  font-weight: 700;
  text-decoration: none;
  padding: 0.65rem 1rem;
  cursor: pointer;
}

.btn:hover { background: #00337a; }

.btn-secondary {
  background: var(--white);
  color: var(--navy);
}

.btn-secondary:hover { background: var(--paper); }

.hero {
  background: linear-gradient(180deg, var(--hero) 0%, #f7f9fc 100%);
  border-bottom: 1px solid var(--line);
  padding: 2.4rem 0 2rem;
}

.hero h1,
.page h1 {
  margin: 0 0 0.45rem;
  color: var(--navy);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.lede { margin: 0 0 1rem; max-width: 42rem; font-size: 1.15rem; }

.page { padding: 1.75rem 0 3rem; }

.page h2 { color: var(--navy); margin: 0 0 0.5rem; }

.role-list { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.hint { color: var(--muted); }

.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.flash {
  margin: 1rem 0 0;
  background: var(--hero);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}

.panel {
  max-width: 38rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.3rem 1.4rem;
}

.form-error {
  margin: 0 0 0.6rem;
  color: var(--red);
  font-weight: 700;
}

.identity {
  display: grid;
  gap: 0.8rem;
  margin: 1.2rem 0 0;
}

.identity div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}

.identity dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.identity dd {
  margin: 0.2rem 0 0;
  font-weight: 700;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.site-footer {
  background: var(--navy-deep);
  color: #e7edf5;
  padding-top: 2rem;
}

.site-footer a { color: #ffffff; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
}

.footer-logo {
  display: inline-flex;
  background: var(--white);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  margin-bottom: 0.75rem;
}

.footer-logo img { width: min(220px, 100%); }

.site-footer h2 {
  color: var(--white);
  font-size: 1rem;
  margin: 0 0 0.55rem;
}

.site-footer p { margin: 0 0 0.55rem; }

.site-footer ul { list-style: none; margin: 0; padding: 0; }

.site-footer li + li { margin-top: 0.35rem; }

.footer-base {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding: 0.85rem 0 1.4rem;
}

.footer-base p { margin: 0; }

@media (max-width: 800px) {
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .fiction-banner { font-size: 1rem; padding: 0.75rem 1rem; }
  .menu-toggle { display: inline-flex; }
  .main-nav { display: none; }
  .main-nav.is-open { display: block; }
  .main-nav ul { flex-direction: column; }
  .masthead-inner {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.75rem;
  }
  .brand { flex: 1 1 100%; }
  .brand img { width: 120px; }
  .brand-name,
  .brand-url {
    overflow: visible;
    text-overflow: unset;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .masthead-tools {
    flex: 1 1 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .who {
    max-width: none;
    flex: 1 1 auto;
    margin-right: auto;
  }
  .masthead-tools .btn,
  .menu-toggle { white-space: nowrap; padding: 0.45rem 0.65rem; }
}

/* ANPR workspace: search, vehicle record, map, audit. */
:root {
  --max: 1240px;
  --plate: #f7d117;
  --ok: #0e6b3a;
  --ok-bg: #dff3e7;
  --warn: #7a4b00;
  --warn-bg: #fff0cc;
  --bad: #99121c;
  --bad-bg: #fbe1e3;
  --amber: #ffb81c;
}

select,
textarea { font: inherit; }

main { background: var(--paper); }

.flash-error {
  border-color: var(--red);
  color: var(--red);
  font-weight: 700;
}

.flash-success { border-color: var(--ok); }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--navy);
  border-radius: 8px;
  padding: 1.25rem 1.3rem 1.4rem;
  margin-bottom: 1.25rem;
}

.card--flush { padding: 0; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.split--even { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

.side .card { margin-bottom: 1.25rem; }

.form { max-width: 40rem; }

.field { margin-bottom: 1.35rem; }

label { display: block; font-weight: 700; margin-bottom: 0.25rem; }

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select {
  font: inherit;
  color: var(--ink);
  width: 100%;
  padding: 0.55rem 0.65rem;
  background: var(--white);
  border: 2px solid #4b5563;
  border-radius: 4px;
  min-height: 44px;
}

.field__hint { margin: 0 0 0.35rem; color: var(--muted); }

.field__error { margin: 0 0 0.35rem; color: var(--bad); font-weight: 700; }

.field--error { border-left: 5px solid var(--bad); padding-left: 0.9rem; }

.field--error input,
.field--error select { border-color: var(--bad); }

input.plate-input {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  max-width: 280px;
  background: var(--plate);
  border-color: #000;
  border-radius: 6px;
}

input.plate-input--small {
  font-size: 1.0625rem;
  max-width: 180px;
  min-height: 38px;
  padding: 0.25rem 0.65rem;
}

.btn-small { min-height: 36px; padding: 0.35rem 0.8rem; }

.inline-form {
  display: flex;
  gap: 0.65rem;
  align-items: end;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.inline-form label { margin: 0; align-self: center; }

.facts { margin: 0; }

.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.facts > div:last-child { border-bottom: 0; }

.facts dt { color: var(--muted); }

.facts dd { margin: 0; font-weight: 600; text-align: right; }

.facts--grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 2rem;
}

.facts--grid > div:nth-last-child(2) { border-bottom: 0; }

.recent { list-style: none; margin: 0; padding: 0; }

.recent li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.recent li:last-child { border-bottom: 0; }

.source {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.source p { margin: 0; font-size: 0.9375rem; max-width: 56ch; }

.source form { margin: 0; }

.chip {
  display: inline-block;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 1px 10px;
  border-radius: 3px;
  border: 1px solid currentColor;
}

.chip--ok { color: var(--ok); background: var(--ok-bg); }
.chip--warn { color: var(--warn); background: var(--warn-bg); }
.chip--bad { color: var(--bad); background: var(--bad-bg); }

.tablewrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--navy);
  border-radius: 8px;
}

.table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }

.table th,
.table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th { background: var(--paper); font-weight: 700; white-space: nowrap; }

.crumbs { font-size: 0.9375rem; margin-bottom: 0.9rem; color: var(--muted); }

.vhead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.5rem 1.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.vhead__title h1 { margin: 0; }

.vhead__title p { margin: 0.15rem 0 0; }

.vhead__ref { margin: 0; font-size: 0.9375rem; max-width: 36ch; text-align: right; }

.plate {
  display: inline-flex;
  align-items: stretch;
  border: 2px solid #111;
  border-radius: 8px;
  overflow: hidden;
  background: var(--plate);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.plate__band {
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 9px 6px;
  min-width: 38px;
}

.plate__reg {
  font-family: "Arial Black", "Arial Bold", Arial, sans-serif;
  font-weight: 900;
  font-size: 2.25rem;
  letter-spacing: 0.06em;
  padding: 6px 16px 4px;
  color: #111;
  line-height: 1.1;
  white-space: nowrap;
}

.mapbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 1rem 1.3rem 0.5rem;
}

.mapbar h2 { margin: 0; }

.range { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.chipbtn {
  font: inherit;
  font-weight: 600;
  background: var(--white);
  color: var(--ink);
  border: 2px solid #4b5563;
  padding: 0.25rem 0.9rem;
  min-height: 36px;
  cursor: pointer;
  border-radius: 4px;
}

.chipbtn[aria-pressed="true"] {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.custom {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.custom label { margin: 0; font-weight: 600; }

.custom input { width: auto; min-height: 36px; padding: 0.2rem 0.4rem; }

.mapnote {
  margin: 0;
  padding: 0 1.3rem 0.65rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

.mapnote--foot { padding: 0.65rem 1.3rem 0.9rem; }

.mapgrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  border-top: 1px solid var(--line);
}

#map { height: 600px; background: #dfe6ee; z-index: 0; }

.leaflet-container img {
  max-width: none;
  max-height: none;
}

.sightings {
  border-left: 1px solid var(--line);
  height: 600px;
  overflow-y: auto;
  padding: 0.9rem 0 0;
}

.sightings h3 { padding: 0 1rem; }

.sightings__list { list-style: none; margin: 0; padding: 0; }

.sightings__list li { border-top: 1px solid var(--line); }

.sighting {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  font: inherit;
  background: none;
  border: 0;
  padding: 0.65rem 1rem;
  cursor: pointer;
  color: var(--ink);
}

.sighting:hover,
.sighting[aria-current="true"] { background: var(--hero); }

.sighting__n {
  font-weight: 700;
  background: var(--navy);
  color: var(--white);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
}

.sighting__main { display: block; font-weight: 600; }

.sighting__sub { display: block; font-size: 0.875rem; color: var(--muted); }

.sightings__empty { padding: 0.9rem 1rem; color: var(--muted); }

.pin {
  background: var(--navy);
  color: var(--white);
  border: 2px solid var(--white);
  border-radius: 50%;
  font: 700 12px/22px var(--font);
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.pin--first { background: var(--white); color: var(--navy); border-color: var(--navy); }

.pin--latest { background: var(--amber); color: #111; border-color: #111; }

.pin--active { outline: 3px solid var(--blue); outline-offset: 2px; }

.leaflet-popup-content { font-family: var(--font); margin: 12px 14px; }

.popup__t { font-weight: 700; display: block; margin-bottom: 2px; }

.popup__r { display: block; color: #333; }

.popup__r a { color: var(--blue); }

@media (max-width: 960px) {
  .mapgrid { grid-template-columns: 1fr; }
  #map { height: 420px; }
  .sightings {
    height: auto;
    max-height: 360px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .custom { margin-left: 0; }
}

@media (max-width: 880px) {
  .split,
  .split--even { grid-template-columns: 1fr; }
  .vhead { grid-template-columns: 1fr; }
  .vhead__ref { text-align: left; }
}

@media (max-width: 640px) {
  .facts--grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
