:root {
  --paper: #e8efe9;      /* szałwia dowodu rejestracyjnego */
  --paper-2: #f4f8f5;
  --ink: #18241d;
  --ink-soft: #4b5b51;
  --line: #c5d2c8;
  --eu: #1d47b0;         /* pasek UE z tablicy */
  --good: #2e7a47;
  --bad: #b23a2e;
  --plate: #ffffff;
  --radius: 6px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Barlow", system-ui, sans-serif;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a { color: var(--eu); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--eu); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* --- nagłówek i nawigacja --- */
.top {
  background: var(--ink);
  color: var(--paper);
}
.top .wrap { display: flex; align-items: center; gap: 24px; min-height: 56px; }
.brand {
  font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: .01em;
  color: var(--paper);
  text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.brand .eu {
  display: inline-block; width: 10px; height: 22px; border-radius: 2px; background: var(--eu);
}
nav.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
nav.tabs::-webkit-scrollbar { display: none; }
nav.tabs a {
  color: #c9d6cd; text-decoration: none; padding: 16px 12px 14px; white-space: nowrap;
  border-bottom: 3px solid transparent; font-weight: 500;
}
nav.tabs a:hover { color: #fff; }
nav.tabs a.on { color: #fff; border-bottom-color: var(--eu); }
.logout { color: #9fb1a5; font-size: .9rem; text-decoration: none; white-space: nowrap; }

main { padding: 28px 0 64px; }
h1 {
  font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
  font-weight: 700; font-size: 2rem; line-height: 1.1; margin: 0 0 6px;
}
h2 {
  font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
  font-weight: 600; font-size: 1.35rem; margin: 36px 0 10px;
}
.lead { color: var(--ink-soft); margin: 0 0 22px; max-width: 70ch; }
.muted { color: var(--ink-soft); }
.small { font-size: .875rem; }

/* --- formularze filtrów --- */
form.filters {
  display: grid; gap: 12px 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  align-items: end;
  padding: 16px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
}
label { display: block; font-size: .85rem; color: var(--ink-soft); font-weight: 500; }
input, select {
  width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid #aebdb2; border-radius: 4px;
}
input:focus, select:focus { border-color: var(--eu); outline: none; box-shadow: 0 0 0 2px rgba(29,71,176,.25); }
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 18px; border-radius: 4px; border: 1px solid var(--eu);
  background: var(--eu); color: #fff; text-decoration: none; display: inline-block;
}
button:hover { background: #163a91; }
button.ghost { background: transparent; color: var(--ink); border-color: #9fb1a5; }
button.ghost:hover { background: #dfe8e1; }
button.no { background: transparent; color: var(--bad); border-color: var(--bad); }

/* --- tablica rejestracyjna (wynik wyceny) --- */
.plate-row { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; margin: 28px 0 8px; }
.plate {
  display: flex; align-items: stretch; background: var(--plate);
  border: 3px solid var(--ink); border-radius: 8px; overflow: hidden;
  box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px #d9e2db;
}
.plate .band {
  background: var(--eu); color: #fff; width: 44px;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding: 8px 0; font-weight: 700; font-size: .95rem;
}
.plate .band .stars {
  width: 22px; height: 22px; border-radius: 50%; margin-bottom: auto; margin-top: 2px;
  border: 2px dotted #ffd84a;
}
.plate .num {
  font-family: "Barlow Semi Condensed", "Barlow", sans-serif;
  font-weight: 700; font-size: clamp(2.6rem, 9vw, 4.2rem); line-height: 1;
  padding: 14px 22px 10px; letter-spacing: .02em;
}
.plate .num small { font-size: .45em; font-weight: 600; margin-left: 6px; color: var(--ink-soft); }
.plate-meta { max-width: 44ch; }
.plate-meta strong { font-size: 1.15rem; display: block; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0; margin: 22px 0 0;
  border-top: 1px solid var(--line); }
.facts div { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); }
.facts dt { font-size: .85rem; color: var(--ink-soft); }
.facts dd { margin: 2px 0 0; font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-size: 1.5rem; font-weight: 600; }

/* --- tabele --- */
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); }
table { border-collapse: collapse; width: 100%; font-size: .94rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 600; color: var(--ink-soft); background: #dfe8e1; position: sticky; top: 0; font-size: .85rem; }
td.n, th.n { text-align: right; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fff; }
.good { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: .8rem; font-weight: 600;
  background: #dfe8e1; color: var(--ink-soft); }
.tag.below { background: #d6ead9; color: var(--good); }
.tag.above { background: #f3dcd8; color: var(--bad); }

.empty { padding: 22px; background: var(--paper-2); border: 1px dashed #9fb1a5; border-radius: var(--radius); max-width: 70ch; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-2); margin-bottom: 14px; overflow: hidden; }
.pair > div { padding: 12px 14px; }
.pair > div + div:not(.car + div) { border-left: 1px solid var(--line); }
.pair .car { grid-column: 1 / -1; padding: 10px 14px 0; font-weight: 600; }
.pair .acts { padding: 12px 14px; grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0 !important; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.hist { display: flex; align-items: flex-end; gap: 2px; height: 160px; padding: 10px 10px 22px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); }
.hist .bar { flex: 1; background: #9fb1a5; position: relative; min-height: 1px; border-radius: 2px 2px 0 0; }
.hist .bar.win { background: var(--eu); }
.hist .bar span { position: absolute; bottom: -19px; left: 50%; transform: translateX(-50%); font-size: .75rem; color: var(--ink-soft); }

.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login .plate { margin-bottom: 26px; }
.login .plate .num { font-size: 2.4rem; }
.err { color: var(--bad); font-weight: 600; }

@media (max-width: 640px) {
  h1 { font-size: 1.6rem; }
  .top .wrap { gap: 12px; }
  .brand .txt { display: none; }
  .facts { grid-template-columns: 1fr 1fr; }
  .facts dd { font-size: 1.25rem; }
  .plate-row { gap: 14px; margin-top: 22px; }
  .logout { display: none; }
  .pair { grid-template-columns: 1fr; }
  .pair > div { border-left: 0 !important; }
  .pair > div + div { border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
