/* Palette taken from the street: parking-sign blue, kerb-paint yellow, asphalt, signal red. */
:root {
  --sign: #1d4e9e;
  --sign-ink: #ffffff;
  --sign-soft: #e3ebf7;
  --kerb: #f2c230;
  --asphalt: #2b2f36;
  --ink: #1f2329;
  --muted: #5d6573;
  --line: #d9dde4;
  --paper: #f5f6f8;
  --card: #ffffff;
  --red: #c8372d;
  --red-soft: #fbe9e7;
  --green: #2f8f5b;
  --green-soft: #e4f3ea;
  --amber-soft: #fdf3d3;
  --radius-sm: 6px;
  --radius: 10px;
  --sign-font: "DIN Alternate", "DIN 2014", "Bahnschrift", "D-DIN", "Roboto Condensed", "Arial Narrow", sans-serif;
  --body-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sign: #5b8fe0;
    --sign-ink: #0e1116;
    --sign-soft: #1c2a40;
    --asphalt: #12151a;
    --ink: #e8ebf0;
    --muted: #a0a8b5;
    --line: #313744;
    --paper: #171a20;
    --card: #1f232b;
    --red: #f07167;
    --red-soft: #3a2224;
    --green: #5cc58a;
    --green-soft: #1d3327;
    --amber-soft: #3a3220;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 var(--body-font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--sign-font); font-weight: 700; line-height: 1.15; margin: 0 0 .5rem; letter-spacing: .01em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
a { color: var(--sign); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--kerb); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: .55rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); cursor: pointer; text-decoration: none; font-weight: 600;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--sign); border-color: var(--sign); color: var(--sign-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--sign); }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 1.1rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
label { display: block; font-weight: 600; margin: 0 0 .35rem; font-size: .95rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: .25rem; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=time], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card);
}
input:focus, select:focus, textarea:focus { border-color: var(--sign); outline: none; box-shadow: 0 0 0 3px var(--sign-soft); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 160px; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.check input { width: 20px; height: 20px; }
.error { background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); padding: .65rem .85rem; margin-bottom: 1rem; }

/* ---------- the number plate: the one bold element ---------- */
.plate {
  display: flex; align-items: stretch; border: 3px solid var(--asphalt); border-radius: 8px;
  background: #fff; overflow: hidden; box-shadow: 0 2px 0 var(--asphalt);
}
.plate .flag {
  width: 46px; flex: none; background: var(--sign); color: #fff; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; padding-bottom: 6px; font: 700 .8rem var(--sign-font);
}
.plate .flag::before { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--kerb); margin-bottom: auto; margin-top: 8px; }
.plate input {
  border: 0; border-radius: 0; min-height: 72px; font: 700 2.4rem/1 var(--sign-font); letter-spacing: .12em;
  text-transform: uppercase; text-align: center; color: #15181d; background: #fff; padding: 0 .5rem;
}
.plate input:focus { box-shadow: none; }
.plate input::placeholder { color: #b9bfc8; }
.plate:focus-within { box-shadow: 0 2px 0 var(--asphalt), 0 0 0 4px var(--kerb); }
.plate.small input { min-height: 52px; font-size: 1.6rem; }
.plate-tag {
  display: inline-block; font: 700 1rem/1 var(--sign-font); letter-spacing: .08em; padding: .3rem .5rem;
  background: #fff; color: #15181d; border: 2px solid var(--asphalt); border-radius: 4px; white-space: nowrap;
}

/* ---------- public pages ---------- */
.public { max-width: 520px; margin: 0 auto; padding: 0 16px 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font: 700 1.15rem var(--sign-font); }
.brand .p {
  width: 34px; height: 34px; border-radius: 6px; background: var(--sign); color: #fff; display: grid; place-items: center;
  font: 700 1.35rem var(--sign-font); border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--sign);
}
.lang { display: flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.lang button { border: 0; background: transparent; padding: .3rem .6rem; cursor: pointer; font-weight: 600; color: var(--muted); }
.lang button[aria-pressed=true] { background: var(--asphalt); color: #fff; }
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 2.3rem; margin-bottom: .35rem; }
.hero p { color: var(--muted); }
.actions { display: grid; gap: .75rem; margin-top: 1.25rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-top: 1rem; }
.back { display: inline-block; margin: 6px 0 4px; text-decoration: none; font-weight: 600; }
.zone-list { display: grid; gap: .5rem; }
.zone-opt {
  display: flex; gap: .75rem; align-items: center; padding: .75rem .9rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; background: var(--card);
}
.zone-opt input { width: 20px; height: 20px; accent-color: var(--sign); }
.zone-opt:has(input:checked) { border-color: var(--sign); box-shadow: inset 4px 0 0 var(--sign); }
.zone-opt .code { font: 700 .95rem var(--sign-font); background: var(--sign); color: #fff; border-radius: 4px; padding: .15rem .45rem; }
.zone-opt .meta { color: var(--muted); font-size: .875rem; }
.stepper { display: flex; align-items: center; gap: .5rem; }
.stepper button { width: 48px; height: 48px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card); font-size: 1.4rem; cursor: pointer; }
.stepper output { min-width: 4.5rem; text-align: center; font: 700 1.6rem var(--sign-font); }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: .9rem 0; border-top: 1px dashed var(--line); margin-top: .5rem; }
.total strong { font: 700 1.8rem var(--sign-font); }
.choice { display: flex; gap: .5rem; flex-wrap: wrap; }
.choice label {
  flex: 1 1 120px; display: flex; gap: .5rem; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .7rem .8rem; cursor: pointer; font-weight: 600; margin: 0; background: var(--card);
}
.choice label:has(input:checked) { border-color: var(--sign); background: var(--sign-soft); }
.choice input { accent-color: var(--sign); }

/* payment status: the ticket */
.ticket { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 1rem; overflow: hidden; }
.ticket .stub { padding: 22px 20px; text-align: center; }
.ticket .stub.ok { background: var(--green-soft); }
.ticket .stub.fail { background: var(--red-soft); }
.ticket .stub.wait { background: var(--amber-soft); }
.ticket .stub h2 { margin: .5rem 0 .25rem; }
.ticket dl { margin: 0; padding: 16px 20px; display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; border-top: 2px dashed var(--line); }
.ticket dt { color: var(--muted); }
.ticket dd { margin: 0; text-align: right; font-weight: 600; }
.ticket .until { font: 700 2.6rem/1 var(--sign-font); }
.phone-pulse { width: 54px; height: 54px; border-radius: 50%; background: var(--kerb); margin: 0 auto; display: grid; place-items: center; animation: pulse 1.6s ease-out infinite; }
.phone-pulse svg { width: 26px; height: 26px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(242,194,48,.7); } 100% { box-shadow: 0 0 0 22px rgba(242,194,48,0); } }
.fine-row { display: flex; gap: .75rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.fine-row:last-child { border-bottom: 0; }
.fine-row .amt { margin-left: auto; font: 700 1.1rem var(--sign-font); white-space: nowrap; }
.footer-link { text-align: center; margin-top: 2rem; }

/* ---------- staff shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--asphalt); color: #d7dbe2; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; padding: 4px 8px 16px; }
.side a { color: #d7dbe2; text-decoration: none; padding: .55rem .75rem; border-radius: var(--radius-sm); font-weight: 500; display: flex; justify-content: space-between; }
.side a:hover { background: rgba(255,255,255,.07); }
.side a[aria-current=page] { background: var(--sign); color: #fff; }
.side .group { font-size: .8rem; color: #8a93a2; margin: 14px 12px 4px; }
.side .who { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: .875rem; }
.side .who p button { background: none; border: 0; color: #d7dbe2; text-decoration: underline; cursor: pointer; padding: 0; margin-right: .75rem; }
.side .lang { border-color: rgba(255,255,255,.25); display: inline-flex; }
.side .lang button { color: #b8bfca; }
.side .lang button[aria-pressed=true] { background: #fff; color: var(--asphalt); }
.main { padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.7rem; margin: 0; }
.menu-btn { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px; }
}

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font: 700 1.9rem/1.1 var(--sign-font); }
.kpi .l { color: var(--muted); font-size: .9rem; }
.kpi.alert .v { color: var(--red); }
.grid2 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.box h2 { font-size: 1.15rem; }
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 170px; margin-top: 10px; }
.bars .b { background: var(--sign); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars .b.today { background: var(--kerb); }
.bars-x { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; font-size: .72rem; color: var(--muted); text-align: center; margin-top: 4px; }
.meter { height: 10px; border-radius: 5px; background: var(--paper); border: 1px solid var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--sign); }
.meter.warn > i { background: var(--red); }

.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar > * { flex: 0 1 auto; width: auto; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); background: var(--paper); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--sign-soft); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 10px; }

.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--paper); border: 1px solid var(--line); }
.badge.open, .badge.failed, .badge.offline { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge.clamped, .badge.pending, .badge.processing, .badge.disputed { background: var(--amber-soft); color: #8a6200; border-color: transparent; }
.badge.paid, .badge.succeeded, .badge.active, .badge.released, .badge.online, .badge.ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
@media (prefers-color-scheme: dark) { .badge.clamped, .badge.pending, .badge.processing, .badge.disputed { color: #f2c230; } }

/* modal */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--card); color: var(--ink); }
dialog::backdrop { background: rgba(15,18,24,.55); }
dialog form { padding: 20px; }
dialog .foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .5rem; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--paper); padding: .6rem; border-radius: var(--radius-sm); word-break: break-all; border: 1px dashed var(--line); }

/* toast */
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--asphalt); color: #fff; padding: .7rem 1.1rem; border-radius: var(--radius-sm); z-index: 50; max-width: calc(100vw - 32px); }
#toast.err { background: var(--red); }

/* enforcer */
.enf { max-width: 640px; margin: 0 auto; padding: 0 16px 48px; }
.verdict { border-radius: var(--radius); padding: 16px; margin-top: 12px; display: flex; gap: 1rem; align-items: center; }
.verdict.paid { background: var(--green-soft); }
.verdict.unpaid { background: var(--red-soft); }
.verdict .big { font: 700 1.5rem var(--sign-font); }
.case { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 10px; display: grid; gap: .5rem; }
.case .top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.case .btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.photos { display: flex; gap: .5rem; flex-wrap: wrap; }
.photos img { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 16px 0 4px; }
.tabs button { border: 0; background: none; padding: .6rem .9rem; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--sign); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); }
.mt { margin-top: 12px; }
.hdr-right { display: flex; align-items: center; gap: .5rem; }
@media (max-width: 520px) { .kpi .v { font-size: 1.45rem; } .page-head h1 { font-size: 1.4rem; } }
