/* Concrete-and-asphalt palette; safety yellow marks the selected car. */
:root {
  --ground: #E9EAE6;
  --panel: #FFFFFF;
  --ink: #17191C;
  --ink-2: #3D4146;
  --muted: #5B5F66;
  --line: #D3D5CF;
  --line-2: #ECEDE8;
  --bar: #17191C;
  --bar-ink: #F4F4F1;
  --bar-muted: #C9CBC5;
  --accent: #F5B700;
  --accent-soft: #FFF6D6;
  --stored: #3D7EEA;
  --hold: #9A6BF0;
  --good: #3CC47C;
  --warn: #E08A2E;
  --bad: #C9372C;
  --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: Barlow, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #121416; --panel: #1C1F22; --ink: #EDEEEA; --ink-2: #C9CBC5; --muted: #9A9EA4;
    --line: #2F3338; --line-2: #262A2E; --accent-soft: #3A3218; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--ground); color: var(--ink); font: 15px/1.4 var(--body); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.brand { display: flex; align-items: center; gap: 10px; font: 700 22px/1 var(--display); letter-spacing: .02em; }
.brand-pin { width: 14px; height: 14px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent); }

.btn { min-height: 44px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn-dark { background: var(--bar); color: var(--bar-ink); border-color: var(--bar); }
.btn-ghost { background: transparent; color: var(--bar-ink); border-color: #4A4E54; min-height: 36px; }
.btn-danger { color: var(--bad); }
.btn[disabled] { opacity: .5; cursor: default; }

/* Sign in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left)); }
.signin-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.signin-card .brand { font-size: 20px; margin-bottom: 8px; }
.signin-card input { font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--ground); color: var(--ink); }
.signin-card label { font-weight: 600; font-size: 14px; }
.error { color: var(--bad); margin: 0; font-size: 14px; }

/* App shell */
.app { height: 100%; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 12px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); background: var(--bar); color: var(--bar-ink); }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--bar-muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.dot.ok { background: var(--good); }
.dot.bad { background: var(--bad); }
.counts { margin-left: auto; display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--bar-muted); font-variant-numeric: tabular-nums; }
.counts strong { color: var(--bar-ink); font-size: 17px; }
.account { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.account .muted { color: var(--bar-muted); }

.body { flex: 1; min-height: 0; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 300px; max-width: 380px; min-width: 0; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { padding: 16px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line-2); }
.side-head input { font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--ground); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.list { flex: 1; overflow-y: auto; min-height: 120px; }
.row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line-2); background: var(--panel); text-align: left; cursor: pointer; }
.row:hover { background: var(--ground); }
.row.sel { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.row .dotkey { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #17191C; background: var(--stored); }
.row .dotkey.hold { background: var(--hold); }
.row .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .plate { font: 600 15px var(--mono); }
.row .veh { color: var(--ink-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .meta { color: var(--muted); font-size: 12px; }
.row .where { margin-left: auto; flex: none; text-align: right; font-size: 12px; }
.row .where b { display: block; }
.empty { padding: 24px 16px; color: var(--muted); font-size: 14px; }

.main { flex: 999 1 560px; min-width: 0; min-height: 0; padding: 14px max(14px, env(safe-area-inset-right)) 14px 14px; display: flex; flex-direction: column; gap: 12px; }
.lots { display: flex; flex-wrap: wrap; gap: 8px; }
.lot { min-height: 44px; padding: 6px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); text-align: left; cursor: pointer; display: flex; flex-direction: column; justify-content: center; }
.lot b { font-weight: 700; }
.lot span { font-size: 12px; color: var(--muted); }
.lot.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.lot.on span { color: var(--bar-muted); }
.map-wrap { position: relative; flex: 1; min-height: 420px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.map { position: absolute; inset: 0; background: #2B2E31; }
.legend { position: absolute; right: 10px; bottom: 22px; z-index: 500; display: flex; gap: 12px; padding: 7px 12px; border-radius: 6px; background: rgba(23,25,28,.85); color: #E9EAE6; font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.pin-key { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid #17191C; display: inline-block; background: var(--stored); }
.pin-key.hold { background: var(--hold); }
.pin-key.sel { border: 3px solid var(--accent); }

/* Map pins */
.car-pin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #17191C; background: var(--stored); box-shadow: 0 1px 4px rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; color: #fff; font: 700 10px var(--body); }
.car-pin.hold { background: var(--hold); }
.car-pin.sel { width: 30px; height: 30px; border: 3px solid var(--accent); box-shadow: 0 0 0 6px rgba(245,183,0,.35); }
.car-pin.flash { animation: flash 1.2s ease-out 2; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(245,183,0,.9); } 100% { box-shadow: 0 0 0 18px rgba(245,183,0,0); } }
@media (prefers-reduced-motion: reduce) { .car-pin.flash { animation: none; } }
.lot-label { background: var(--accent); color: #17191C; border: 0; border-radius: 4px; font: 700 13px var(--display); letter-spacing: .06em; padding: 3px 8px; box-shadow: none; }
.lot-label::before { display: none; }
.plate-tag { background: var(--accent); color: #17191C; border: 0; font: 600 12px var(--mono); padding: 2px 7px; }

/* Detail */
.detail { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: flex-start; }
.detail .who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.detail .plate { font: 600 24px var(--mono); }
.detail .badge { padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 700; color: #fff; background: var(--stored); border: 1.5px solid #17191C; margin-left: 8px; vertical-align: middle; }
.detail .badge.hold { background: var(--hold); }
.detail dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; font-size: 14px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; font-weight: 600; }
.detail .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail .history { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.detail .history ol { margin: 6px 0 0; padding-left: 18px; }
.confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--accent-soft); border-radius: 6px; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1000; background: var(--bar); color: var(--bar-ink); padding: 10px 16px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.35); font-size: 14px; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .side { max-width: none; flex-basis: 100%; border-right: 0; border-bottom: 1px solid var(--line); max-height: 45vh; }
  .counts { margin-left: 0; }
  .map-wrap { min-height: 360px; }
}

/* Outline editor */
.edit-bar { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; background: var(--accent-soft); font-size: 14px; }
.edit-bar span { flex: 1 1 260px; }
.handle { width: 18px; height: 18px; border-radius: 3px; background: #FFFFFF; border: 2px solid #17191C; box-shadow: 0 1px 4px rgba(0,0,0,.6); cursor: grab; }

/* Dark mode: the near-black button disappears on dark panels, so it switches to safety yellow. */
@media (prefers-color-scheme: dark) {
  .btn-dark { background: var(--accent); color: #17191C; border-color: var(--accent); }
}
