:root {
  --bg: #0f1216; --panel: #161a20; --line: #262c35; --text: #d7dce3; --muted: #7d8794;
  --hi: #ffffff; --row: #1b2028; --accent: #4ea1ff;
  --cold: #6cb6ff; --frost: #a8d4ff; --warn: #f0a63a; --bad: #ff5d5d; --ok: #4cc38a;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7; --panel: #ffffff; --line: #dde1e6; --text: #1d232b; --muted: #6b7480;
    --hi: #000000; --row: #eef2f7; --accent: #1867c0;
    --cold: #1a6fd1; --frost: #4b8fd8; --warn: #b86e00; --bad: #d12c2c; --ok: #13804f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.35 system-ui, "Segoe UI", sans-serif; }
.muted { color: var(--muted); }

.bar { display: flex; align-items: center; gap: 18px; padding: 0 12px; height: 38px; white-space: nowrap; overflow: hidden; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.brand { letter-spacing: .08em; font-size: 12px; color: var(--hi); }
.bar nav { display: flex; gap: 2px; }
.bar nav a, .bar nav span { padding: 4px 9px; border-radius: 3px; color: var(--muted); text-decoration: none; }
.bar nav span { opacity: .45; cursor: default; }
.bar nav a.on { background: var(--row); color: var(--hi); }
.demo { background: var(--warn); color: #000; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 3px; }
.src { margin-left: auto; color: var(--muted); font-size: 12px; display: flex; gap: 12px; min-width: 0; overflow: hidden; }
.src i { font-style: normal; }
.src i::before { content: "●"; margin-right: 4px; color: var(--ok); }
.src i.err::before { color: var(--bad); }
.src i.old::before { color: var(--warn); }
.clock { flex: none; font-variant-numeric: tabular-nums; color: var(--hi); min-width: 60px; text-align: right; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tools input[type=search], .tools select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 5px 8px; font: inherit; }
.tools input[type=search] { width: 300px; max-width: 100%; }
.tools label { display: flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }

/* main namjerno bez overflow: inače zaglavlje tablice "lijepi" unutar main i prekrije prvi red */
table { border-collapse: collapse; width: 100%; white-space: nowrap; table-layout: fixed; }
col.w-road { width: 64px; } col.w-name { width: 260px; } col.w-num { width: 82px; } col.w-dir { width: 64px; }
col.w-pr { width: 120px; } col.w-cond { width: auto; } col.w-src { width: 56px; }
/* Cestovni promet (promet.html): ikona znaka, vrsta, mjesto, opis u jednom retku (cijeli u detaljima) */
col.w-ico { width: 38px; } col.w-kind { width: 250px; } col.w-where { width: 230px; } col.w-text { width: auto; } col.w-time { width: 96px; }
table.traffic td.ico { padding: 2px 4px 2px 10px; }
table.traffic td.ico img, table.traffic td.ico .ev-gen { width: 22px; height: 22px; display: block; object-fit: contain; }
table.traffic td.txt { color: var(--muted); }
table.traffic tr.det .ev-text { margin: 0 0 6px; color: var(--text); }
th, td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; overflow: hidden; text-overflow: ellipsis; }
th { position: sticky; top: 38px; background: var(--panel); color: var(--muted); font-weight: 600; font-size: 12px; cursor: pointer; user-select: none; z-index: 2; vertical-align: bottom; }
th small { display: block; font-weight: 400; font-size: 11px; opacity: .8; }
th:hover { color: var(--hi); }
th.sort::after { content: " ▲"; font-size: 9px; }
th.sort.desc::after { content: " ▼"; }
.n { text-align: center; font-variant-numeric: tabular-nums; }
.dist { color: var(--muted); font-size: 12px; margin-left: 6px; }
tr.old td { opacity: .45; }
tbody tr.st { cursor: pointer; }
tbody tr.st:hover { background: var(--row); }
tr.grp td { background: var(--bg); color: var(--hi); font-weight: 700; padding-top: 10px; }
tr.grp td span { color: var(--muted); font-weight: 400; margin-left: 6px; }
tr.det td { background: var(--row); white-space: normal; color: var(--muted); padding: 8px 12px; }
tr.det table { width: auto; margin-top: 6px; }
tr.det table td, tr.det table th { position: static; background: none; border: 0; padding: 2px 12px 2px 0; }
tr.det a { color: var(--accent); }
.road { font-weight: 700; color: var(--hi); }
/* Boje temperature preuzete s ATLAS-a (atlas.css .tc1-.tc6): tamna tema zadano, svijetla ispod */
.tc1 { color: #b0a4f7; } .tc2 { color: #7fb2f2; } .tc3 { color: #63cdd2; }
.tc4 { color: #7fd09d; } .tc5 { color: #f2ad62; } .tc6 { color: #f58c84; }
@media (prefers-color-scheme: light) {
  .tc1 { color: #5a47b5; } .tc2 { color: #2d69b8; } .tc3 { color: #127f86; }
  .tc4 { color: #2b7a4b; } .tc5 { color: #b4600b; } .tc6 { color: #bf3434; }
}
.c-cold { color: var(--cold); font-weight: 700; }

/* Karta */
body.map-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
#map { flex: 1; position: relative; z-index: 0; } /* zaseban sloj: ikone i oblačići karte ne idu preko zaglavlja ni popisa izvora */
/* Legenda iznad ikona kamera i događaja na karti (njihov z-index je do ~105), ispod oblačića (1000) */
.legend { position: fixed; left: 10px; bottom: 10px; z-index: 999; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 5px 9px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 3px 0 8px; vertical-align: -1px; }
.legend i:first-child { margin-left: 0; }
.legend .attr { padding: 4px 0 0; max-width: 560px; white-space: normal; }
.attr { color: var(--muted); font-size: 11.5px; padding: 10px 12px 14px; }
.attr a { color: var(--muted); text-decoration: underline; }
.tcb1 { background: #b0a4f7; } .tcb2 { background: #7fb2f2; } .tcb3 { background: #63cdd2; }
.tcb4 { background: #7fd09d; } .tcb5 { background: #f2ad62; } .tcb6 { background: #f58c84; }
@media (prefers-color-scheme: light) {
  .tcb1 { background: #5a47b5; } .tcb2 { background: #2d69b8; } .tcb3 { background: #127f86; }
  .tcb4 { background: #2b7a4b; } .tcb5 { background: #b4600b; } .tcb6 { background: #bf3434; }
}
/* Izbornik slojeva: gumb iz MapLibre skupine (isti izgled kao +/-), popis se otvara lijevo */
.layers { position: relative; }
.layers > button { display: grid; place-items: center; color: #333; }
.layers .menu { display: none; position: absolute; right: 36px; top: 0; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 7px 10px;
  flex-direction: column; gap: 5px; font: 12.5px/1.3 system-ui, "Segoe UI", sans-serif; box-shadow: 0 0 0 2px rgba(0, 0, 0, .1); }
.layers.open .menu { display: flex; }
.layers label { display: flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
/* Natpis mjesta: samo ikona vremena i temperatura u boji razreda */
.wx { display: flex; align-items: center; gap: 2px; padding: 1px 7px 1px 2px; border-radius: 14px; cursor: pointer;
  background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line); white-space: nowrap; line-height: 1; }
.wx img { width: 24px; height: 24px; display: block; }
.wx b { font-size: 13px; font-variant-numeric: tabular-nums; }
.wx:hover { border-color: var(--muted); z-index: 3; }
body.no-wx .wx { display: none; }
/* Ikona događaja (ATLAS-ov crtež) i oblačić događaja */
/* Sve ikone iste veličine (kvadrat 24 px); pravokutne dopunske ploče E stanu unutra */
.evm-ico { width: 24px; height: 24px; cursor: pointer; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .5)); }
.evm-ico img, .ev .evi img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* Opća oznaka za kategoriju bez dodijeljene ikone */
.ev-gen { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: #fff; border: 3px solid #d22630; color: #1e2833; font: 700 15px/1 system-ui, sans-serif; box-sizing: border-box; }
body.no-ev .evm-ico { display: none; }
body.no-g-ac .evm-ico.g-ac, body.no-g-dc .evm-ico.g-dc, body.no-g-radovi .evm-ico.g-radovi { display: none; }  /* slojevi događaja */
.layers .menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ev .evh { display: flex; align-items: center; gap: 8px; margin-right: 14px; }
.ev .evi { width: 34px; height: 34px; flex: none; }
/* Odabir kad je više događaja na istom mjestu */
.ev-pick { display: flex; flex-direction: column; gap: 4px; min-width: 230px; }
.ev-pick > b { color: var(--hi); margin: 0 18px 2px 0; }
.ev-pick button { display: flex; align-items: center; gap: 8px; text-align: left; background: var(--row); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 5px 8px; cursor: pointer; font: inherit; }
.ev-pick button:hover { border-color: var(--muted); }
.ev-pick .evi { width: 28px; height: 28px; flex: none; }
.ev-pick .evi img { width: 100%; height: 100%; object-fit: contain; display: block; }
.ev-pick small { display: block; color: var(--muted); }
.ev .evh b { color: var(--hi); font-size: 14px; }
.ev .evm { margin: 5px 0 0; color: var(--muted); }
.ev .evm b { color: var(--text); }
.ev p { margin: 6px 0; white-space: normal; line-height: 1.4; }
.maplibregl-popup-close-button { color: var(--muted); font-size: 16px; padding: 0 6px; }
/* Oblačić mjesta: ikone umjesto naziva redaka */
.pp { min-width: 150px; }
.pp .pw { display: flex; align-items: center; gap: 6px; margin: 2px 0 4px; }
.pp .pw img { width: 40px; height: 40px; }
.pp .pr { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.pp .pr > svg { color: var(--muted); flex: none; }
.pp .pr span { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.pp .pr span svg { color: var(--muted); }
.pop .pf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 6px; }
.pop .pf a { color: var(--accent); font-size: 12px; text-decoration: none; white-space: nowrap; }
.pop .pf a:hover { text-decoration: underline; }
/* Statistika mjesta: kartice s grafovima (boje serija provjerene alatom za palete na obje podloge) */
:root { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --gridc: #232831; --basec: #39404b; }
@media (prefers-color-scheme: light) { :root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --gridc: #e8ebef; --basec: #c3c9d1; } }
.stat-page .tools h1 { font-size: 16px; margin: 0 6px 0 0; color: var(--hi); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.seg button { background: var(--panel); color: var(--muted); border: 0; border-left: 1px solid var(--line); padding: 5px 10px; font: inherit; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--row); color: var(--hi); font-weight: 600; }
.stats { max-width: 1200px; padding: 12px; transition: opacity .15s; }
.stats.loading { opacity: .5; }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 14px; min-width: 150px; }
.tile span { display: block; color: var(--muted); font-size: 12px; }
.tile b { font-size: 20px; color: var(--hi); font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px 4px; margin-bottom: 10px; }
.card h2 { font-size: 13px; margin: 0 0 4px; color: var(--hi); display: flex; align-items: baseline; gap: 6px; }
.card h2 small { color: var(--muted); font-weight: 400; }
.legend-inline { margin-left: auto; font-weight: 400; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 14px; height: 2px; vertical-align: middle; border-radius: 1px; }
.key.k1 { background: var(--s1); } .key.k2 { background: var(--s2); } .key.k3 { background: var(--s3); }
.plot { width: 100%; }
.plot .empty { margin: 8px 0 10px; }
.chart { display: block; }
.chart .grid { stroke: var(--gridc); stroke-width: 1; }
.chart .base { stroke: var(--basec); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.s1 { stroke: var(--s1); } .chart .ln.s2 { stroke: var(--s2); } .chart .ln.s3 { stroke: var(--s3); }
.chart .bar.s1 { fill: var(--s1); }
.chart .area.s1 { fill: var(--s1); fill-opacity: .1; }
/* Statistika vjetra: crta 8 Bf, bez grafova temperature, oborina i snijega */
.chart .limit { stroke: var(--s2); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.chart .limit-label { fill: var(--s2); font-size: 11px; }
.wind-stat #c-temp, .wind-stat #c-rain, .wind-stat #c-snow { display: none; }
.chart .crossline { stroke: var(--muted); stroke-width: 1; }
/* Točka na krivulji: boja serije s prstenom u boji podloge */
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .dot.s1 { fill: var(--s1); } .chart .dot.s2 { fill: var(--s2); } .chart .dot.s3 { fill: var(--s3); }
.stat-page #status { margin-left: auto; }
.stat-page .clock { margin-left: auto; }
.btn { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 5px 10px; font: inherit; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .6; cursor: default; }
/* Skriveni list za PDF: fiksna širina i svijetle boje (iste uloge kao na stranici) */
.pdf-sheet { position: absolute; left: -20000px; top: 0; width: 1180px;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --gridc: #e1e0d9; --basec: #c3c2b7; --muted: #6b7480; --panel: #ffffff; --line: #dde1e6; }
.pdf-sheet .card { padding: 0; border: 0; margin: 0 0 10px; background: #fff; }
.pdf-sheet .chart .tick { font-size: 16px; }
/* Popis kategorija događaja */
table.cats { table-layout: auto; white-space: normal; margin-bottom: 12px; }
table.cats th { position: static; cursor: default; }
table.cats td { vertical-align: top; }
table.cats td.ex { color: var(--muted); font-size: 12px; max-width: 520px; }
.cat-ico { width: 28px; height: 28px; display: block; }
.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 6px 9px; font-size: 12px; color: var(--muted); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.tip .tt { color: var(--text); margin-bottom: 3px; }
.tip b { color: var(--hi); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 4px; }
.tip .key { margin-right: 5px; }
.table-view summary { cursor: pointer; color: var(--text); padding: 2px 0 6px; }
.table-view table { width: auto; min-width: 520px; margin-bottom: 6px; }
.table-view th { position: static; cursor: default; }
/* Kamere: mala tamna oznaka s ikonom kamere; oblačić sa slikama */
.cam-ico { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; cursor: pointer;
  background: #1e2833; color: #fff; border: 1.5px solid #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.cam-ico:hover { background: #2b78c5; }
body.no-cam-ac .cam-ico:not(.oc), body.no-cam-oc .cam-ico.oc { display: none; }
/* Jedna slika stalne veličine za svaku kameru (16:9, kao većina kamera) */
.cam img { width: 320px; max-width: 70vw; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-radius: 3px; background: var(--row); margin: 6px 0 4px; }
.cam .muted { font-size: 12px; }
/* Kamera s videom uživo: crvena oznaka; video uvijek isti okvir 16:9 (kamera 4:3 dobiva crne rubove sa strane) */
.cam-ico.live { background: #c62828; }
.cam-ico.live:hover { background: #e53935; }
/* Kolona na kameri (probno): ikona treperi između crvene i svoje obične boje */
.cam-ico.queue { animation: cam-queue 1s steps(2, jump-none) infinite; }
@keyframes cam-queue { from { background: #d12c2c; box-shadow: 0 0 0 3px rgba(209, 44, 44, .55); } to { background: #1e2833; box-shadow: 0 1px 2px rgba(0, 0, 0, .5); } }
.cam video { width: 400px; max-width: 80vw; aspect-ratio: 16 / 9; object-fit: contain; display: block; border-radius: 3px; background: #000; margin: 6px 0 4px; }
.cam .live-tag { color: #e53935; font-weight: 600; }
.cam small a { color: inherit; text-decoration: underline; }
/* Oblačić je uvijek iznad ikona događaja i natpisa mjesta (njihov z-index je do ~105) */
.maplibregl-popup { z-index: 1000; }
.maplibregl-popup-content { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; font: 13px/1.35 system-ui, "Segoe UI", sans-serif; }
.maplibregl-popup-tip { display: none; }
.pop > b { color: var(--hi); }
.pop table { width: auto; margin: 6px 0 4px; table-layout: auto; }
.pop td { border: 0; padding: 1px 12px 1px 0; }
.pop td:first-child { color: var(--muted); }
.pop small { color: var(--muted); }
.c-frost { color: var(--frost); }
.c-warn { color: var(--warn); font-weight: 700; }
.c-bad { color: var(--bad); font-weight: 700; }
.none { color: var(--muted); opacity: .5; }

/* Stranica Obavijesti */
.page { max-width: 980px; padding: 14px 16px 40px; }
.page h1 { font-size: 18px; color: var(--hi); margin: 4px 0 6px; }
.page h2 { font-size: 14px; color: var(--hi); margin: 0 0 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; margin: 12px 0; }
.card ol { margin: 6px 0; padding-left: 20px; line-height: 1.7; }
.card code { background: var(--row); padding: 1px 5px; border-radius: 3px; }
.card a { color: var(--accent); }
.card button { background: var(--row); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 5px 10px; font: inherit; cursor: pointer; }
.card button:hover { border-color: var(--muted); }
.code { font-size: 28px; font-weight: 700; letter-spacing: .15em; color: var(--hi); margin: 6px 0; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
table.matrix { width: auto; border-collapse: collapse; }
table.matrix th, table.matrix td { position: static; padding: 4px 10px; background: none; }
table.matrix thead th { color: var(--hi); cursor: pointer; }
table.matrix tbody th { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--text); cursor: pointer; white-space: nowrap; }
table.matrix th:hover { color: var(--accent); }
table.matrix .c { text-align: center; width: 46px; }
table.matrix img, table.matrix .noico { width: 20px; height: 20px; flex: none; }
table.matrix .noico { display: grid; place-items: center; background: var(--bad); color: #fff; border-radius: 3px; font-style: normal; font-weight: 700; font-size: 12px; }
table.matrix input { width: 16px; height: 16px; cursor: pointer; }
.opts { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.opts label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.ok-note { color: var(--ok); margin-left: 6px; }
table.log td { padding: 3px 10px 3px 0; border: 0; color: var(--text); }
.warn-note { color: var(--warn); margin-left: 6px; }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; margin: 14px -14px -12px; padding: 10px 14px; background: var(--panel); border-top: 1px solid var(--line); }
.card button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; padding: 6px 18px; }
.card button.primary:disabled { background: var(--row); border-color: var(--line); color: var(--muted); cursor: default; }

/* Stranica za prijavu */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 20px 22px 14px; }
.login h1 { font-size: 18px; color: var(--hi); margin: 10px 0 6px; }
.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.login label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.login input:not([type=checkbox]) { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 7px 9px; font: inherit; font-size: 14px; }
.login input:focus { outline: none; border-color: var(--accent); }
.login label.check { flex-direction: row; align-items: center; gap: 7px; cursor: pointer; }
.login button.primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; font: inherit; font-weight: 600; padding: 8px; border-radius: 3px; cursor: pointer; margin-top: 4px; }
.login button.primary:disabled { opacity: .6; cursor: default; }
.err-note { color: var(--bad); min-height: 1.35em; margin: 0; }
.logout { flex: none; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 3px; padding: 2px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.logout:hover { color: var(--hi); border-color: var(--muted); }

/* Oblačić vjetra na D8: dvije skupine redaka, nazivi modela se prelamaju */
.pop.d8 td:last-child { white-space: normal; }

/* Video zid (kamere.html): polja bez razmaka, kamera na autocesti 1 polje, ostale 2 × 2, povećana polje više */
.wall-page { background: #000; }
.wall-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 38px; z-index: 3; }
.wall-tools label { display: flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }
.wall-tools input[type=range] { width: 110px; }
.wall-tools button { background: var(--row); color: var(--text); border: 1px solid var(--line); border-radius: 3px; padding: 3px 10px; font: inherit; cursor: pointer; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { background: var(--row); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: 2px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.chip small { color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.on small { color: #fff; }
.wall { background: #000; min-height: calc(100vh - 80px); }
.wall:fullscreen { overflow: auto; }
.wall-sec h2 { margin: 0; padding: 8px 10px 5px; font-size: 13px; color: #fff; background: #000; }
.wall-sec h2 small { color: #888; font-weight: 400; }
.wall-grid { display: grid; grid-template-columns: repeat(var(--cols, 6), 1fr); grid-auto-rows: var(--rh, 150px); grid-auto-flow: row dense; gap: var(--gap, 0); }
.wt { position: relative; margin: 0; overflow: hidden; background: #0b0b0b; cursor: zoom-in; }
.wt.s2 { grid-column: span 2; grid-row: span 2; }
.wt.s3 { grid-column: span 3; grid-row: span 3; }
.wt img, .wt video { display: block; width: 100%; height: 100%; object-fit: cover; }
.wt figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 6px 2px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.wt figcaption b { color: #ffd84d; margin-right: 5px; }
.wt figcaption .stale { color: #f0a63a; }
.no-labels .wt figcaption { display: none; }
.no-labels .wt:hover figcaption { display: block; }
.wt-tools { position: absolute; top: 3px; right: 3px; display: none; gap: 3px; z-index: 2; }
.wt:hover .wt-tools { display: flex; }
.wt-tools button { width: 24px; height: 24px; border: 0; border-radius: 3px; background: rgba(0, 0, 0, .65); color: #fff; font-size: 13px; line-height: 24px; padding: 0; cursor: pointer; }
.wt.pinned .wt-tools [data-act=pin] { color: #ffd84d; }
.wt.pinned::after { content: '★'; position: absolute; top: 3px; left: 5px; color: #ffd84d; font-size: 12px; text-shadow: 0 0 3px #000; }
.wt.live::before { content: '● UŽIVO'; position: absolute; top: 4px; left: 5px; z-index: 1; padding: 1px 4px; border-radius: 2px; background: #d12c2c; color: #fff; font-size: 9px; font-weight: 700; letter-spacing: .03em; }
.wt.live.pinned::after { left: auto; right: 5px; }
.wt.live.pinned:hover::after { display: none; }
.wt.idle video { visibility: hidden; }
.wt.idle { background: #151515 center / 34px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='%23666'/%3E%3C/svg%3E"); }
.wt.err img { visibility: hidden; }
/* Kolona na kameri (probno): slika diskretno zacrvenjena i uokvirena, bez natpisa (želja korisnika); isto na videozidu,
   u povećanoj slici videozida i u oblačiću kamere na karti */
.wt-alarm { display: none; }
.wt.queue .wt-alarm, .shot.queue .wt-alarm, .lb-media.queue .wt-alarm { display: block; position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; color: transparent;
  background: rgba(210, 38, 48, .16); box-shadow: inset 0 0 0 2px rgba(226, 58, 58, .85);
  animation: wt-queue 1s linear infinite; animation-delay: var(--queue-delay, 0s); }
/* Okvir i crvenilo trepere; svaka slika s drugim pomakom (kamere.js), pa ne trepere sve istodobno */
.cam .shot .wt-alarm { top: 6px; bottom: 4px; border-radius: 3px; } /* točno preko slike (margine slike 6 px gore, 4 px dolje) */
.cam .shot:focus { outline: none; }
/* Zaustavljeno vozilo: crveni pravokutnik oko vozila (SVG preko slike, ista obrada kao slika) */
.wt-boxes { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.wt-boxes rect { fill: none; stroke: #ff2a2a; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.cam .shot .wt-boxes { top: 6px; bottom: 4px; height: auto; border-radius: 3px; } /* oblačić pri otvaranju fokusira poveznicu slike; bijeli okvir fokusa ne treba */
@keyframes wt-queue { 0%, 49.9% { opacity: 1; } 50%, 100% { opacity: 0; } } /* naglo: upaljeno pa ugašeno */
.wt.err { background: #151515; }
.wall-empty { color: #aaa; padding: 30px 16px; margin: 0; }
.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(0, 0, 0, .93); }
.lightbox[hidden] { display: none; }
.lb-media img, .lb-media video { display: block; max-width: 94vw; max-height: 86vh; }
.lb-media video { width: 94vw; height: 86vh; }
.lb-cap { margin-top: 8px; color: #ddd; font-size: 13px; }
.lb-cap b { color: #ffd84d; margin-right: 5px; }
.lb-cap a { color: #8cc4ff; }
.lightbox button { position: absolute; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 28px; width: 46px; height: 46px; border-radius: 4px; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, .22); }
.lb-prev { left: 12px; top: 50%; } .lb-next { right: 12px; top: 50%; } .lb-close { right: 12px; top: 12px; font-size: 20px !important; }
/* Vrijeme zadnje slike ručno dodanih kamera (WhatsUpCams): donji desni kut slike (natpis kamere mu ostavlja mjesta) */
.wt-time { position: absolute; bottom: 3px; right: 5px; z-index: 1; padding: 1px 5px; border-radius: 2px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; font-variant-numeric: tabular-nums; pointer-events: none; }
.wt-time:empty { display: none; }
.wt:has(.wt-time:not(:empty)) figcaption { padding-right: 56px; }
.lb-media { position: relative; }
.lb-media .wt-time { bottom: 8px; right: 8px; font-size: 14px; padding: 2px 8px; }
.cam .shot { position: relative; display: flow-root; width: fit-content; } /* flow-root: margine slike ostaju unutar poveznice */
.cam .shot .wt-time { bottom: 9px; right: 5px; } /* slika ima 4 px donje margine */
table.matrix th.dc { white-space: nowrap; width: auto; }
/* Legenda radara oborina (karta) */
.radar-legend { margin-bottom: 4px; line-height: 1.6; }
.flow-legend { margin-bottom: 4px; }
.flow-key, .legend .flow-key { display: inline-block; width: 16px; height: 4px; margin: 0 4px 0 2px; vertical-align: middle; border-radius: 2px; }
.radar-legend i { display: inline-block; width: 18px; height: 10px; margin-right: 1px; vertical-align: middle; border-radius: 1px; }
/* Izbornik slojeva i ostale kontrole iznad ikona događaja i kamera na karti */
.maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-right { z-index: 1000; }
.layers input[type=radio] { margin: 0; }
.guest-act { white-space: nowrap; } .guest-act button { margin: 2px 0; }

/* Prijava: pozadina s motivom prometa (ceste kao obojene crte, čvorovi, isprekidane trake u pokretu) */
.login-page { position: relative; overflow: hidden; background: radial-gradient(ellipse at 40% 45%, #141a24 0%, #0b0e13 70%); }
.login-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
.login-bg path { stroke-width: 5; opacity: .45; }
.login-bg .r1 { stroke: #2b78c5; stroke-width: 9; }
.login-bg .r2 { stroke: #d22630; stroke-width: 7; }
.login-bg .r3 { stroke: #fff200; opacity: .3; }
.login-bg .r4 { stroke: #7fd09d; }
.login-bg .r5 { stroke: #ef7d1a; stroke-width: 4; }
.login-bg .r6 { stroke: #4ea1ff; stroke-width: 4; opacity: .35; }
.login-bg .lane { stroke: #fff; stroke-width: 1.5; opacity: .5; stroke-dasharray: 14 22; animation: lane 6s linear infinite; }
.login-bg .l2 { animation-duration: 8s; animation-direction: reverse; }
.login-bg .nodes circle { fill: #0b0e13; stroke: #fff; stroke-width: 2.5; opacity: .7; }
@keyframes lane { to { stroke-dashoffset: -360; } }
@media (prefers-reduced-motion: reduce) { .login-bg .lane { animation: none; } }
.login { position: relative; z-index: 1; background: rgba(22, 26, 32, .92); backdrop-filter: blur(4px); box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }
.login .brand { color: #fff; }
.login .pass { display: flex; gap: 6px; }
.login .pass input { flex: 1; min-width: 0; }
.login .pass button { background: var(--row); color: var(--muted); border: 1px solid var(--line); border-radius: 3px; font: inherit; font-size: 12px; padding: 0 9px; cursor: pointer; }
.login .switch { margin: 2px 0 0; text-align: center; }
.login .switch a { color: var(--accent); font-size: 12px; }
.login .ok-note { color: var(--ok); margin: 12px 0 4px; line-height: 1.5; }
.guest-until { font-size: 12px; white-space: nowrap; }
.login [hidden] { display: none !important; }
/* Prijava: čekanje odobrenja (stanje se samo osvježava) */
.wait { margin-top: 12px; }
.wait h2 { font-size: 18px; color: var(--hi); margin: 12px 0 6px; }
.wait p { line-height: 1.5; margin: 0 0 10px; }
.wait-badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.wait.pending .wait-badge { background: #3d3216; color: #f2c200; }
.wait.approved .wait-badge { background: #143524; color: #4cc38a; }
.wait.rejected .wait-badge { background: #3a1719; color: #ff5d5d; }
.wait-road { position: relative; height: 6px; margin: 16px 0 10px; border-radius: 3px; background: #2b78c5; overflow: hidden; }
.wait-road span { position: absolute; inset: 2px 0 auto; height: 2px; background: repeating-linear-gradient(90deg, #fff 0 14px, transparent 14px 30px); opacity: .7; animation: road 1.6s linear infinite; width: 200%; }
.wait.approved .wait-road { background: #3f9f68; } .wait.rejected .wait-road { background: #d22630; } .wait:not(.pending) .wait-road span { animation: none; }
@keyframes road { to { transform: translateX(-30px); } }
@media (prefers-reduced-motion: reduce) { .wait-road span { animation: none; } }
/* Prijava je uvijek tamna (pozadina s cestama), neovisno o svijetloj ili tamnoj temi sustava */
.login-page { --bg: #0f1216; --panel: #161a20; --line: #262c35; --text: #d7dce3; --muted: #8b95a3; --hi: #ffffff; --row: #1b2028; --accent: #4ea1ff; --ok: #4cc38a; --bad: #ff5d5d; color: var(--text); color-scheme: dark; }

/* Prepoznavanje vozila uživo (vozila.html): mreža slika s okvirima svih vozila */
.det-title { color: var(--hi); margin-right: 4px; }
.det-legend { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.det-legend i { display: inline-block; width: 14px; height: 10px; border: 2px solid; border-radius: 2px; margin-left: 8px; }
.det-page #status { margin-left: auto; }
.det-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 8px; padding: 8px 12px; }
.det { margin: 0; background: #0b0b0b; border-radius: 3px; overflow: hidden; }
.det-img { position: relative; }
.det-img img { display: block; width: 100%; height: auto; }
.det-img svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.det-img rect { fill: none; vector-effect: non-scaling-stroke; }
.det-img rect.off { stroke: #9aa3ad; stroke-width: 1.5; stroke-dasharray: 5 4; }
.det figcaption { display: flex; flex-direction: column; gap: 2px; padding: 5px 8px; font-size: 12px; color: var(--muted); }
.det figcaption b { color: #fff; font-weight: 600; }
.det-page .attr { padding: 4px 12px 12px; }
.det-link { color: var(--accent); text-decoration: none; font-size: 12px; }
.det-link:hover { text-decoration: underline; }

/* Kako sustav uči (ucenje.html): koraci obrade za 3 kamere */
.learn-intro { margin: 8px 12px 0; max-width: 1100px; font-size: 12px; line-height: 1.5; }
.learn-page #status { margin-left: auto; }
.learn-page #picks select { max-width: 260px; }
.lc { margin: 10px 12px 18px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.lc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.lc-head b { color: var(--hi); }
.lc-head .btn { margin-left: auto; }
.lc-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; }
.lp { margin: 0; }
.lp figcaption { font-size: 12px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.lp-img { position: relative; background: #0b0b0b; border-radius: 3px; overflow: hidden; }
.lp-img img { display: block; width: 100%; height: auto; }
.lp-img img.dim { filter: brightness(.45); }
.lp-img svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lp-img rect { fill: none; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.lp-img rect.dash { stroke-dasharray: 6 4; stroke-width: 1.5; }
.lp-img rect.alarm { stroke-width: 4; }
.lp-img rect.hit { fill: #3fbf5f; stroke: none; }
.lp-img rect.mask { fill: none; stroke: #3fbf5f; stroke-width: 1; stroke-opacity: .5; }
.lp-img circle { fill: #ffd84d; stroke: #000; stroke-width: 2; vector-effect: non-scaling-stroke; }
.lp-img text { font: 600 22px system-ui, sans-serif; paint-order: stroke; stroke: #000; stroke-width: 4px; }
.lc-info { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; margin-top: 8px; font-size: 12px; }
.lc-info h3 { font-size: 12px; margin: 0 0 4px; color: var(--hi); }
.lc-list, .lc-log { margin: 0; padding: 0; list-style: none; line-height: 1.6; }
.lc-list i { display: inline-block; width: 12px; height: 9px; border: 2px solid; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
@media (max-width: 800px) { .lc-info { grid-template-columns: 1fr; } }
.c-ok { color: #3fbf5f; }
.det-page .det-link, .learn-page .det-link { margin-left: 4px; }
.lp { border-radius: 4px; padding: 3px; transition: background .2s; }
.lp.active { background: rgba(255, 216, 77, .18); box-shadow: 0 0 0 2px #ffd84d inset; } /* korak koji se upravo izvodi */
.lp-note { font-weight: 400; color: var(--text); }
.lc-wait { font-size: 12px; }
.lp-img circle.new { animation: lp-pop .8s ease-out 2; }
@keyframes lp-pop { from { r: 2; } }
@media (min-width: 1300px) { .lc-steps { grid-template-columns: repeat(4, 1fr); } }
/* Kolona u jednoj traci (ucenje.html): niz zbijenih vozila */
.lp-img polyline.lane { fill: none; stroke: #26c6da; stroke-width: 3; stroke-dasharray: 8 5; vector-effect: non-scaling-stroke; }
.lp-img polyline.lane.on { stroke-dasharray: none; stroke-width: 4; }
.lp-img circle.lane { fill: #26c6da; stroke: #000; }
.c-lane { color: #26c6da; }
.lane-log h3 { font-size: 13px; margin: 0 0 6px; color: var(--hi); }
.lane-log .lc-log { font-size: 12px; }
.lane-log li.now { color: var(--hi); }
.lane-log .btn { margin-left: 6px; padding: 0 6px; font-size: 11px; }
/* Vrsta alarma (kolona, zaustavljeno vozilo, osoba na cesti): treperave ikone prometnih znakova, jedna do druge;
   u oblačiću kamere i povećanoj slici uz gumb za zatvaranje, na videozidu u gornjem desnom kutu slike */
.al-icons { display: inline-flex; gap: 4px; vertical-align: middle; }
.al-icons img { width: 26px; height: 23px; object-fit: contain; animation: wt-queue 1s linear infinite; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .6)); }
.cam-head { display: flex; align-items: center; gap: 8px; padding-right: 22px; min-height: 24px; }
.cam-head b { flex: 1; }
/* Ispod natpisa i logotipa kamere (HAK, HAC: gornjih ~8 % slike); slika je zaseban sloj, pa ikone ne idu preko zaglavlja */
.wt { isolation: isolate; }
.wt .al-slot, .lb-media .al-slot { position: absolute; top: calc(9% + 4px); right: 6px; z-index: 3; pointer-events: none; }
.wt .al-slot img { width: 22px; height: 20px; }
.wt:hover .al-slot { display: none; } /* alati slike na istom mjestu */
.lb-media .al-slot .al-icons img { width: 40px; height: 35px; }
/* Ocjena alarma (vlasnik): točan ili lažan */
.al-line:empty { display: none; }
.al-line { margin-top: 4px; font-size: 12px; color: var(--muted); }
.lb-cap .al-line { display: inline; margin-left: 10px; }
.al-rate button { margin-left: 6px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 3px; background: none; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.al-rate button:hover { border-color: var(--muted); color: var(--hi); }
.lb-cap .al-rate button { color: #ddd; border-color: #555; }
/* Zvono u zaglavlju: obavijesti o alarmima na računalu */
.bell { flex: none; display: inline-flex; align-items: center; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 3px; padding: 3px 6px; cursor: pointer; }
.bell:hover { color: var(--hi); border-color: var(--muted); }
.bell.on { color: #ffd84d; border-color: #8a7420; }
.lightbox .al-rate button { position: static; width: auto; height: auto; padding: 1px 8px; font-size: 12px; background: none; }
/* Pregled sustava (ucenje.html) */
.learn-stats { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 8px 12px 0; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
.learn-stats:empty { display: none; }
.learn-stats b { color: var(--hi); }
/* Magla i snijeg na cesti (procjena sa slike kamere, lib/queue-watch.mjs): siva ili svijetloplava ikona kamere;
   alarm i dalje treperi crveno, između bljeskova ostaje boja vremena */
.cam-ico.wx-fog { background: #8a9099; --ico-bg: #8a9099; }
.cam-ico.wx-snow { background: #7cc8f2; --ico-bg: #7cc8f2; color: #0d2a3d; }
.cam-ico.wx-fog.queue, .cam-ico.wx-snow.queue { animation-name: cam-queue-wx; }
@keyframes cam-queue-wx { from { background: #d12c2c; box-shadow: 0 0 0 3px rgba(209, 44, 44, .55); } to { background: var(--ico-bg); box-shadow: 0 1px 2px rgba(0, 0, 0, .5); } }
.wx-tag { padding: 0 5px; border-radius: 3px; font-weight: 600; }
.wx-tag.magla { background: #8a9099; color: #fff; }
.wx-tag.snijeg { background: #7cc8f2; color: #0d2a3d; }
/* Stanje izvora: jedan gumb u zaglavlju, popis svih izvora ispod njega */
.src { overflow: visible; }
.src-btn { display: flex; gap: 12px; align-items: center; background: none; border: 1px solid var(--line); border-radius: 3px; padding: 2px 8px; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.src-btn:hover { border-color: var(--muted); color: var(--hi); }
.src-btn i, .src-pop i { font-style: normal; }
.src-btn i::before, .src-pop i::before { content: "●"; margin-right: 4px; color: var(--ok); }
.src-btn i.err::before, .src-pop i.err::before { color: var(--bad); }
.src-btn i.old::before, .src-pop i.old::before { color: var(--warn); }
.src-pop { position: fixed; top: 40px; right: 12px; z-index: 1100; margin: 0; padding: 8px 12px; list-style: none; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); font-size: 12px; line-height: 1.8; white-space: nowrap; }
.src-pop li { display: flex; gap: 10px; }
.src-pop li i { min-width: 170px; color: var(--text); }
/* Tablica meteo postaja: stupac Uvjeti (ikona vremena) */
col.w-wx { width: 58px; }
td.wxc { padding-top: 1px; padding-bottom: 1px; }
td.wxc img { width: 28px; height: 28px; display: block; }
/* Tablica meteo postaja: stupac Uvjeti (ikona vremena) */
col.w-wx { width: 58px; }
td.wxc { padding-top: 1px; padding-bottom: 1px; }
td.wxc img { width: 28px; height: 28px; display: block; }

/* Pregled (pregled.html): pločice bitnih vrsta događaja, graf po danima, tablice po cestama, alarmi, meteo */
.pg-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 10px; }
.pg-cat { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto auto; column-gap: 10px; align-items: center; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; color: var(--text); font: inherit; cursor: pointer; }
.pg-cat:hover { border-color: var(--muted); }
.pg-cat.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pg-cat img { grid-row: 1 / 4; width: 34px; height: 34px; object-fit: contain; }
.pg-cat .pg-n { font-size: 22px; font-weight: 600; color: var(--hi); font-variant-numeric: tabular-nums; line-height: 1.1; }
.pg-cat .pg-name { font-size: 12px; color: var(--text); }
.pg-cat .pg-live { font-size: 11px; color: var(--muted); }
.pg-cat .pg-live b { color: var(--warn); }
.pg-cat.zero { opacity: .55; }
.pg-chart { display: block; width: 100%; height: 180px; }
.pg-chart .grid { stroke: var(--line); stroke-width: 1; }
.pg-chart .ax { fill: var(--muted); font-size: 11px; }
.pg-chart .bar { fill: var(--accent); }
.pg-chart .hit { fill: transparent; }
.pg-chart .hit:hover { fill: var(--row); fill-opacity: .5; }
.pg-empty { margin: -100px 0 80px; text-align: center; }
.pg-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 10px; }
table.pg-tab { table-layout: auto; width: 100%; margin-bottom: 6px; }
table.pg-tab th, table.pg-tab td { position: static; padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; background: none; }
table.pg-tab th { color: var(--muted); font-weight: 400; cursor: default; }
table.pg-tab .n { text-align: right; font-variant-numeric: tabular-nums; }
table.pg-tab th img { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; }
table.pg-tab td b { color: var(--hi); font-weight: 600; }
.pg-note { font-size: 11px; margin: 2px 0 6px; }
.pg-wx b { display: block; }
.pg-wx small { color: var(--muted); font-size: 11px; }
@media (max-width: 600px) { .pg-row { grid-template-columns: 1fr; } table.pg-tab { white-space: normal; } }
/* Slika kamere u oblačiću karte: natpis dok se učitava ili ako ne stigne (klik i dalje otvara sliku izravno) */
.cam .shot.loading::after, .cam .shot.failed::after { position: absolute; inset: 6px 0 4px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; pointer-events: none; }
.cam .shot.loading::after { content: 'Učitavanje slike…'; }
.cam .shot.failed::after { content: 'Slika trenutno nije dostupna · klik otvara izravno'; }

/* Fokus s tipkovnice (korisnik, 29. 10. 2026.): jasno vidljiv okvir, samo kad se koristi tipkovnica */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
tr.st:focus-visible { outline-offset: -2px; }
.cam-ico:focus-visible, .evm-ico:focus-visible { outline: 3px solid #ffd84d; outline-offset: 2px; border-radius: 4px; }
.wt:focus-visible { outline: 3px solid #ffd84d; outline-offset: -3px; }

/* Mobitel (korisnik, 29. 10. 2026.): zaglavlje u dva reda s izbornikom koji se pomiče vodoravno, široke tablice se
   pomiču vodoravno, alati i mreže u jedan stupac */
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; height: auto; gap: 4px 10px; padding: 6px 10px 0; position: static; overflow: visible; }
  .bar nav { order: 9; flex: 0 0 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
  .bar nav::-webkit-scrollbar { display: none; }
  .bar nav a, .bar nav span { flex: none; padding: 6px 10px; }
  .src { margin-left: auto; }
  .clock { min-width: 0; }
  .tools { padding: 8px 10px; }
  .tools input[type=search] { width: 100%; }
  .tools select { flex: 1 1 140px; min-width: 0; }
  th { top: 0; position: static; }
  body:not(.map-page):not(.stat-page) > main:has(> table) { overflow-x: auto; }
  #t:not(.traffic) { min-width: 760px; }
  table.traffic { min-width: 0; table-layout: auto; }
  table.traffic col, table.traffic th:nth-child(5), table.traffic td.txt, table.traffic th:nth-child(7), table.traffic tr.st td:nth-child(7) { display: none; }
  table.traffic td { white-space: normal; }
  body.map-page { height: 100dvh; }
  .cam img { width: 280px; max-width: 78vw; }
  .maplibregl-popup { max-width: 92vw !important; }
  .wall-tools { position: static; }
  .wall-grid { grid-template-columns: repeat(2, 1fr) !important; grid-auto-rows: 30vw !important; }
  .wt .tile-tools { display: none; }
  .stats { padding: 8px; }
  .pg-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pg-cat { padding: 8px; column-gap: 8px; grid-template-columns: 28px 1fr; }
  .pg-cat img { width: 28px; height: 28px; }
  .tile { min-width: 0; flex: 1 1 140px; }
  .det-grid { grid-template-columns: 1fr; padding: 8px; }
  .lc-steps { grid-template-columns: 1fr; }
  .stat-page .clock, .stat-page #status { margin-left: 0; }
  .lightbox button { width: 40px; height: 40px; font-size: 22px; }
}

/* ---------- Ulaz (atlas-web.tech): dva velika prozora na pozadini prijave ---------- */
.portal-page { place-items: center; }
.portal { position: relative; z-index: 1; width: 100%; max-width: 860px; display: flex; flex-direction: column; gap: 26px; }
.portal-head { text-align: center; }
.portal-logo { display: block; color: #fff; font-size: 34px; font-weight: 800; letter-spacing: .32em; padding-left: .32em; }
.portal-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.portal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.portal-card { position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 260px; padding: 26px 24px 22px; text-decoration: none; color: var(--text);
  background: rgba(22, 26, 32, .9); backdrop-filter: blur(4px); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; overflow: hidden; }
.portal-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--c); }
.portal-card.web { --c: #4ea1ff; }
.portal-card.tech { --c: #4cc38a; }
.portal-card:hover, .portal-card:focus-visible { transform: translateY(-3px); border-color: var(--c); box-shadow: 0 14px 44px rgba(0, 0, 0, .55); outline: none; }
.portal-ico { width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); margin-bottom: 8px; }
.portal-ico svg { width: 34px; height: 34px; fill: none; stroke: var(--c); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.portal-ico .dash { stroke: #fff; stroke-width: 1.2; stroke-dasharray: 3 4; opacity: .7; }
.portal-ico circle { fill: var(--c); stroke: none; }
.portal-name { color: #fff; font-size: 24px; font-weight: 700; letter-spacing: .02em; }
.portal-sub { color: var(--c); font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.portal-text { color: var(--muted); font-size: 14px; line-height: 1.55; margin-top: 6px; flex: 1; }
.portal-go { align-self: flex-start; margin-top: 12px; padding: 8px 14px; border-radius: 4px; background: var(--c); color: #0b0e13; font-weight: 700; font-size: 14px; }
@media (max-width: 640px) {
  .portal-grid { grid-template-columns: 1fr; }
  .portal-card { min-height: 0; padding: 20px 18px 18px; }
  .portal-logo { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { .portal-card { transition: none; } .portal-card:hover { transform: none; } }
.login .brand-back { display: inline-block; margin-bottom: 10px; color: var(--muted); font-size: 12px; text-decoration: none; letter-spacing: .08em; }
.login .brand-back:hover, .login .brand-back:focus-visible { color: var(--accent); }
.login .brand-back + .brand { display: block; }
