:root {
  --concrete: #e7e9ec;
  --surface: #ffffff;
  --ink: #1a2028;
  --muted: #5b6573;
  --rule: #d3d8de;
  --asphalt: #2a2f35;
  --paint: #f2c230;
  --sign: #1c4f9c;
  --charging: #1a7fd1;
  --idle: #d98a00;
  --free: #22995f;
  --offline: #8e959e;
  --heat: 28, 79, 156;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --concrete: #15191e; --surface: #1d2228; --ink: #e6e9ed; --muted: #9aa4b0; --rule: #313840;
    --asphalt: #0f1215; --sign: #3b74cf; --heat: 77, 140, 230; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--concrete); color: var(--ink);
  font: 400 16px/1.5 "Barlow", system-ui, sans-serif; font-variant-numeric: tabular-nums;
}
h1, h2 { font-family: "Barlow Semi Condensed", "Barlow", sans-serif; font-weight: 700; line-height: 1.15; margin: 0; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
a { color: var(--sign); }
:focus-visible { outline: 3px solid var(--paint); outline-offset: 2px; }
.sub, small { color: var(--muted); font-size: .875rem; }

/* nagłówek jak znak parkingowy */
.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
  padding: .6rem clamp(1rem, 3vw, 2rem); background: var(--sign); color: #fff;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none;
  font: 600 1.15rem "Barlow Semi Condensed", sans-serif; }
.sign { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border: 2px solid #fff;
  border-radius: 4px; font-weight: 700; font-size: 1.25rem; }
.top nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.top nav a { color: #fff; text-decoration: none; padding: .3rem .7rem; border-radius: 3px; }
.top nav a:hover { background: rgba(255,255,255,.12); }
.top nav a[aria-current] { background: #fff; color: var(--sign); font-weight: 600; }
.feed { margin-left: auto; font-size: .85rem; opacity: .9; }
.feed.bad { background: var(--idle); color: #000; padding: .1rem .5rem; border-radius: 3px; opacity: 1; }

main { max-width: 1280px; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 4rem; }

/* parking na żywo — jedyny "głośny" element */
.lot { background: var(--asphalt); color: #eef1f4; border-radius: 6px; padding: 1.25rem clamp(1rem, 2.5vw, 1.75rem) 1.5rem; }
.lot-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1rem; margin-bottom: 1rem; }
.lot h1 { color: #fff; }
.tally { margin: 0; color: #c3cad3; }
.bays { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0; }
.bays { row-gap: 1.25rem; }
.bay { border-inline: 3px solid var(--paint); padding: 0 .6rem; display: flex; flex-direction: column; }
.slots { display: grid; gap: .5rem; flex: 1; }
.slot {
  position: relative; display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; align-content: start;
  padding: .6rem .7rem .7rem; border-radius: 4px; background: rgba(255,255,255,.06);
  border-top: 5px solid var(--offline); min-height: 7.5rem;
}
.slot.charging { border-top-color: var(--charging); background: rgba(26,127,209,.16); }
.slot.idle { border-top-color: var(--idle); background: rgba(217,138,0,.18); }
.slot.free { border-top-color: var(--free); }
.slot .cn { grid-row: span 2; display: grid; place-items: center; width: 1.8rem; height: 1.8rem;
  border: 2px solid currentColor; border-radius: 50%; font-weight: 600; opacity: .8; }
.slot .st { font: 600 1.05rem "Barlow Semi Condensed", sans-serif; }
.slot .for { font-size: .85rem; color: #b9c1cb; }
.slot img { grid-column: 1 / -1; width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 3px; margin-top: .4rem; }
.slot .plate { grid-column: 1 / -1; justify-self: start; margin-top: .35rem; }
.slot .who { grid-column: 1 / -1; margin-top: .35rem; line-height: 1.25; }
.slot .car { grid-column: 1 / -1; color: #b9c1cb; font-size: .9rem; line-height: 1.25; }
.paint { margin-top: .6rem; text-align: center; font: 700 1.4rem "Barlow Semi Condensed", sans-serif;
  color: #f4f5f6; opacity: .85; }
.plate { display: inline-block; background: #fff; color: #111; border: 1px solid #111; border-left: 6px solid #1c4f9c;
  padding: 0 .35rem; font: 600 .8rem "Barlow Semi Condensed", sans-serif; border-radius: 2px; }

/* sekcje */
.block { margin-top: 2.25rem; }
.block.narrow { max-width: 760px; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }
.empty { background: var(--surface); padding: 1rem 1.25rem; border-radius: 4px; color: var(--muted); }
.period { display: inline-flex; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; background: var(--surface); }
.period a { padding: .3rem .8rem; text-decoration: none; color: var(--ink); font-size: .9rem; }
.period a + a { border-left: 1px solid var(--rule); }
.period a[aria-current] { background: var(--sign); color: #fff; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: .875rem; color: var(--muted); margin: .25rem 0 .75rem; }
.k { width: .9rem; height: .9rem; border-radius: 2px; display: inline-block; margin-left: .5rem; }
.k:first-child { margin-left: 0; }
.charging { background: var(--charging); } .idle { background: var(--idle); }
.free { background: var(--free); } .offline { background: var(--offline); }

.ports { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 4px; }
.ports li { display: grid; grid-template-columns: 9rem minmax(8rem, 1fr) 6.5rem 8.5rem 5rem 8.5rem; align-items: center;
  gap: .5rem 1.1rem; padding: .55rem 1rem; border-bottom: 1px solid var(--rule); }
.ports li:last-child { border-bottom: 0; }
.pname { font-weight: 600; }
.bar { display: flex; height: .9rem; border-radius: 2px; overflow: hidden; background: var(--rule); }
.bar i { display: block; height: 100%; }
.num { font-size: .9rem; color: var(--muted); white-space: nowrap; }
.num b { color: var(--ink); font-size: 1rem; }
@media (max-width: 760px) {
  .ports li { grid-template-columns: 1fr 1fr; }
  .ports .bar { grid-column: 1 / -1; order: 2; }
  .ports .pname { grid-column: 1 / -1; }
}

.scroll { overflow-x: auto; background: var(--surface); border-radius: 4px; }
.heat { border-collapse: collapse; font-size: .78rem; width: 100%; }
.heat th { font-weight: 500; color: var(--muted); padding: .3rem; }
.heat td { text-align: center; padding: .45rem .1rem; min-width: 1.9rem;
  background: rgba(var(--heat), calc(.08 + var(--v) * .92)); color: var(--ink); }
.heat td.hot { color: #fff; }
.heat td.na { background: transparent; }

table.data { border-collapse: collapse; width: 100%; font-size: .92rem; }
.data th { text-align: left; font-weight: 600; padding: .55rem .7rem; border-bottom: 2px solid var(--rule); white-space: nowrap; }
.data td { padding: .5rem .7rem; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.data .r { text-align: right; white-space: nowrap; }
.data tr.open td { background: rgba(26,127,209,.07); }
.data td.ph { width: 64px; padding-right: 0; }
.data td.ph img { width: 64px; height: 40px; object-fit: cover; border-radius: 3px; display: block; }
.chip { display: inline-block; padding: 0 .45rem; border-radius: 3px; background: var(--idle); color: #000; font-size: .8rem; }
.chip.charging { background: var(--charging); color: #fff; }

.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem 1rem; margin: .5rem 0 1rem; }
label { display: grid; gap: .2rem; font-size: .875rem; color: var(--muted); }
label.inline { display: flex; align-items: center; gap: .4rem; }
input, select, textarea, button, .btn-sec { font: inherit; color: var(--ink); }
input:not([type=checkbox]):not([type=file]), select, textarea {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 3px; padding: .4rem .55rem; }
button { background: var(--sign); color: #fff; border: 0; border-radius: 3px; padding: .45rem 1rem; font-weight: 600; cursor: pointer; }
.btn-sec { display: inline-block; padding: .4rem .9rem; border: 1px solid var(--rule); border-radius: 3px; background: var(--surface); text-decoration: none; }

.edit { display: grid; gap: .9rem; margin-top: 1rem; }
.edit label { color: var(--ink); }
.photo-edit { display: grid; gap: .6rem; }
.photo-edit img { max-width: 360px; width: 100%; border-radius: 4px; }
.actions { display: flex; gap: .6rem; align-items: center; }

.vlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.vlist a { display: grid; gap: .15rem; padding: .6rem; background: var(--surface); border-radius: 4px; text-decoration: none; color: var(--ink); height: 100%; }
.vlist a:hover { outline: 2px solid var(--sign); }
.vlist img, .nophoto { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 3px; margin-bottom: .3rem; }
.nophoto { display: grid; place-items: center; background: var(--concrete); color: var(--muted); font-size: .85rem;
  border: 1px dashed var(--rule); }
.vlist em { color: var(--idle); font-style: normal; font-weight: 600; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* konto, logowanie, admin */
.me { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.me a { color: #fff; }
.me form { margin: 0; }
button.link { background: none; padding: 0; color: #fff; text-decoration: underline; font-weight: 400; }
.subnav { display: flex; gap: .25rem; margin-bottom: 1rem; border-bottom: 2px solid var(--rule); }
.subnav a { padding: .45rem .9rem; text-decoration: none; color: var(--muted); margin-bottom: -2px; border-bottom: 2px solid transparent; }
.subnav a[aria-current] { color: var(--ink); border-bottom-color: var(--sign); font-weight: 600; }
.alert { background: #fbe9e7; color: #8a1c0f; border-left: 4px solid #c43c26; padding: .6rem .8rem; border-radius: 3px; margin: .5rem 0; }
.notice { background: #e7f4ec; color: #145c38; border-left: 4px solid var(--free); padding: .6rem .8rem; border-radius: 3px; margin: .5rem 0; }
@media (prefers-color-scheme: dark) {
  .alert { background: #3a1c18; color: #ffb4a6; } .notice { background: #16301f; color: #a6e3bd; }
}
.temp-pw { background: var(--surface); border: 2px dashed var(--paint); padding: .8rem 1rem; border-radius: 4px; margin: .75rem 0; }
.temp-pw p { margin: 0 0 .5rem; }
.temp-pw code { font: 600 1.3rem "Barlow Semi Condensed", sans-serif; letter-spacing: .04em; user-select: all; }
.btn-danger { background: #b3261e; }
.btn-sec { cursor: pointer; }
.data.users td { white-space: nowrap; }
.data .inactive td { opacity: .55; }
.row-actions form { display: flex; gap: .4rem; margin: 0; }
.inline-form { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
.edit h2 { margin-top: .5rem; }
.edit + .edit { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--asphalt);
  background-image: repeating-linear-gradient(90deg, transparent 0 calc(25% - 3px), var(--paint) calc(25% - 3px) 25%);
  background-size: 100% 38%; background-repeat: no-repeat; background-position: bottom; }
.login-wrap { width: min(400px, 92vw); padding: 2rem 0; }
.login-sign { width: 3.4rem; height: 3.4rem; margin: 0 auto -1.7rem; position: relative; z-index: 1;
  display: grid; place-items: center; background: var(--sign); color: #fff; border: 3px solid #fff;
  border-radius: 6px; font: 700 2.1rem "Barlow Semi Condensed", sans-serif; }
.login-card { display: grid; gap: .9rem; background: var(--surface); padding: 2.4rem 1.6rem 1.6rem; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.login-card h1 { text-align: center; }
.login-card > .sub { text-align: center; margin: -.4rem 0 .2rem; }
.login-card label { color: var(--ink); }
.login-card input:not([type=checkbox]) { padding: .6rem .7rem; font-size: 1rem; }
.login-card button { padding: .7rem; font-size: 1rem; }
.inline-form input, .inline-form select { width: 100%; }
.inline-form { column-gap: 1rem; }

/* powiadomienia */
fieldset { border: 1px solid var(--rule); border-radius: 4px; padding: .8rem 1rem 1rem; margin: 0; display: grid; gap: .6rem; background: var(--surface); }
legend { font-weight: 600; padding: 0 .3rem; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem 1rem; }
.grid2 input, .grid2 select { width: 100%; }
.test-row { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; }
.steps { margin: 0; padding-left: 1.2rem; }
.btn-tg { display: inline-block; background: #2aabee; color: #fff; padding: .55rem 1rem; border-radius: 3px; text-decoration: none; font-weight: 600; }
.devices { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.devices li { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
button.link-dark { background: none; color: var(--sign); padding: 0; text-decoration: underline; font-weight: 400; }
#push-info.alert { margin: 0; }
