:root {
  --tlo: #0b1220; --karta: #111a2e; --karta2: #0d1628; --ramka: #22314f; --tekst: #F1F5F9; --tekst2: #CBD5E1; --tekst3: #A9B6C9;
  --akcent: #3B82F6; --ok: #4ADE80; --ostrz: #FBBF24; --zle: #F87171;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--tlo); color: var(--tekst); font: 13px/1.35 "Segoe UI", system-ui, sans-serif; }
#app { height: 100vh; display: grid; grid-template-rows: 54px 30px 104px 1fr; gap: 8px; padding: 8px 12px 10px; }
button, select, input { font: inherit; color: inherit; }

.nag { display: flex; align-items: center; justify-content: space-between; background: var(--karta); border: 1px solid var(--ramka); border-radius: 8px; padding: 0 14px; gap: 16px; }
.tyt { white-space: nowrap; }
.tyt h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: .3px; }
.tyt span { color: var(--tekst2); font-size: 12px; }
.ster { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.et { color: var(--tekst2); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.sep { width: 1px; height: 26px; background: var(--ramka); margin: 0 3px; }
.seg { display: inline-flex; border: 1px solid #33466c; border-radius: 6px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 6px 11px; cursor: pointer; color: var(--tekst2); }
.seg button:hover { color: #fff; background: #1a2744; }
.seg button + button { border-left: 1px solid #33466c; }
.seg button.on { background: var(--akcent); color: #fff; }
.seg.mini button { padding: 2px 9px; font-size: 12px; }
select { background: var(--karta2); border: 1px solid #33466c; border-radius: 6px; padding: 5px 8px; color: var(--tekst); }
select:disabled { opacity: .45; }
.btn { background: var(--akcent); border: 0; border-radius: 6px; padding: 7px 16px; color: #fff; font-weight: 600; cursor: pointer; }
.btn:hover { background: #2563eb; }
.btn:disabled { opacity: .5; cursor: wait; }
.btn2 { margin-left: 8px; padding: 4px 12px; font-size: 12.5px; background: #1d4ed8; }
.link { color: #93C5FD; font-size: 12px; text-decoration: underline dotted; text-underline-offset: 3px; }
.link:hover { color: #fff; }
.link.wyl { pointer-events: none; opacity: .45; }
.status { font-size: 13px; color: var(--tekst2); min-width: 210px; }
.status b { font-weight: 600; }
.status .sync { color: var(--tekst2); font-size: 12px; } .status.ok b { color: var(--ok); } .status.praca b { color: var(--ostrz); } .status.blad b { color: var(--zle); }

.meta { display: flex; align-items: center; gap: 18px; padding: 0 14px; background: var(--karta2); border: 1px solid var(--ramka); border-radius: 6px; color: var(--tekst2); font-size: 12px; white-space: nowrap; overflow: hidden; }
.meta b { color: var(--tekst); font-weight: 600; }
.meta .dah { color: var(--ostrz); }

.kpi { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.k { background: var(--karta); border: 1px solid var(--ramka); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.k h3 { margin: 0; font-size: 11.5px; font-weight: 600; color: var(--tekst2); text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.k .w { font-size: 25px; font-weight: 600; white-space: nowrap; }
.k .w small { font-size: 13px; color: var(--tekst2); font-weight: 400; margin-left: 4px; }
.k p { margin: 0; font-size: 12px; color: var(--tekst3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k.ujem .w { color: var(--ostrz); } .k.zer .w { color: var(--ok); }

.glowna { display: grid; grid-template-columns: 1fr 640px; gap: 8px; min-height: 0; }
.lewa { display: grid; grid-template-rows: 1fr auto; gap: 8px; min-height: 0; }
.prawa { display: grid; grid-template-rows: 1fr 1fr; gap: 8px; min-height: 0; }
.karta { background: var(--karta); border: 1px solid var(--ramka); border-radius: 8px; padding: 8px 12px; min-height: 0; display: flex; flex-direction: column; }
.kh { display: flex; align-items: center; gap: 10px; white-space: nowrap; margin-bottom: 4px; min-height: 26px; }
.kh b { font-size: 14px; font-weight: 600; }
.kh > span { color: var(--tekst2); font-size: 12px; }
.lg, .leg-st { margin-left: auto; display: flex; gap: 6px; align-items: center; color: var(--tekst2); font-size: 12px; }
.lg i, .leg-st i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-left: 6px; }
.lg i.pasmo { height: 9px; background: rgba(96,165,250,.28); }
.leg-st i.est { width: 10px; height: 10px; border: 2px solid #fff; border-radius: 2px; background: transparent; }
.leg-st i.brk { width: 10px; height: 10px; background: repeating-linear-gradient(45deg,#475569 0 2px,#0b1220 2px 4px); border-radius: 2px; }
.cw { flex: 1; position: relative; min-height: 0; }
.cw canvas, .mapa-w canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cw canvas { cursor: crosshair; }
.mapa-w { flex: 1; position: relative; min-height: 0; }
.tip { position: absolute; pointer-events: none; background: #020617f2; border: 1px solid #475569; border-radius: 6px; padding: 7px 10px; font-size: 12.5px; display: none; white-space: nowrap; z-index: 5; color: var(--tekst); box-shadow: 0 6px 18px #0008; }
.tip b { color: #fff; } .tip .t { font-weight: 600; margin-bottom: 3px; color: #fff; }
.tip .r { display: flex; justify-content: space-between; gap: 18px; } .tip .r span:first-child { color: var(--tekst2); }
.tip .r .s { color: #93C5FD; } .tip .r .z { color: var(--ok); } .tip .r .u { color: var(--ostrz); }

/* karta Profil doby: tryb, nawigacja po dobach, podsumowanie */
.profil .kh { margin-bottom: 3px; }
.prawa, .lewa, .karta, .glowna > * { min-width: 0; }
.profil .lg { gap: 4px; }
.pnaw { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; white-space: nowrap; min-width: 0; }
.pnaw .nb { background: #15213b; border: 1px solid #33466c; border-radius: 5px; padding: 3px 7px; font-size: 12px; color: var(--tekst); cursor: pointer; }
.pnaw .nb:hover:not(:disabled) { background: #1d2c4f; border-color: #4b6496; }
.pnaw .nb:disabled { opacity: .4; cursor: default; }
.pnaw input[type=date] { background: var(--karta2); border: 1px solid #33466c; border-radius: 5px; padding: 2px 6px; font-size: 12.5px; color: var(--tekst); color-scheme: dark; }
.pnaw.wyl { opacity: .45; }
.pnaw .pwsk { margin-left: auto; color: var(--tekst3); font-size: 11.5px; }
.psum { display: flex; gap: 14px; align-items: baseline; font-size: 12.5px; color: var(--tekst2); white-space: nowrap; overflow: hidden; margin-bottom: 2px; min-height: 18px; }
.psum b { color: var(--tekst); font-weight: 600; }
.psum .d { color: #fff; font-weight: 600; } .psum .u { color: var(--ostrz); } .psum .n { color: #7DD3FC; }
.lg i.ref { height: 0; border-top: 2px dashed #CBD5E1; background: none; width: 14px; }

/* legenda kolorów pod mapą */
.legenda { display: grid; grid-template-columns: 42px 1fr; grid-template-rows: 20px 16px 24px; column-gap: 0; margin-top: 4px; }
/* dwustronny suwak filtra cen na pasku gradientu */
.suwak { grid-column: 2; grid-row: 1; position: relative; cursor: pointer; touch-action: none; user-select: none; }
.suwak .g { position: absolute; left: 0; right: 0; top: 3px; bottom: 3px; border-radius: 3px; border: 1px solid #33466c; }
.suwak .zakres { position: absolute; top: 1px; bottom: 1px; border: 2px solid transparent; border-radius: 4px; pointer-events: none; }
.suwak.akt .zakres { border-color: #F8FAFC; box-shadow: 0 0 0 1px #0b1220; }
.suwak.akt .g { filter: saturate(.35) brightness(.55); }
.suwak.akt .zakres { background: transparent; backdrop-filter: saturate(2.8) brightness(1.8); }
.uchwyt { position: absolute; top: -2px; width: 12px; height: 24px; margin-left: -6px; background: #F8FAFC; border: 2px solid #0b1220; border-radius: 4px; box-shadow: 0 1px 4px #000c; cursor: ew-resize; z-index: 3; }
.uchwyt:hover, .uchwyt:focus-visible, .suwak.ciag .uchwyt { background: #93C5FD; outline: none; }
.uchwyt .ub { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); background: #020617f0; border: 1px solid #64748b; border-radius: 4px; padding: 0 5px; font-size: 11.5px; line-height: 17px; color: #fff; white-space: nowrap; display: none; pointer-events: none; }
.suwak.akt .ub, .suwak.ciag .ub, .uchwyt:hover .ub, .uchwyt:focus-visible .ub { display: block; }
#uLo .ub { transform: translateX(-85%); } #uHi .ub { transform: translateX(-15%); }
.legenda .kat .szyb { background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 1px 7px; font-size: 12px; color: var(--tekst2); cursor: pointer; }
.legenda .kat .szyb:hover { border-color: #33466c; background: #15213b; }
.legenda .kat .szyb.on { border-color: #F8FAFC; background: #1d2c4f; color: var(--tekst); }
.legenda .licznik { margin-left: auto; font-size: 12.5px; color: var(--tekst2); white-space: nowrap; }
.legenda .licznik b { color: var(--tekst); }
.legenda .reset { margin-left: 8px; background: #15213b; border: 1px solid #33466c; border-radius: 5px; padding: 2px 9px; font-size: 12px; color: var(--tekst); cursor: pointer; }
.legenda .reset:disabled { opacity: .4; cursor: default; }
.legenda .ticks { grid-column: 2; grid-row: 2; position: relative; font-size: 11.5px; color: var(--tekst); }
.legenda .ticks span { position: absolute; top: 1px; transform: translateX(-50%); white-space: nowrap; }
.legenda .ticks span::before { content: ""; position: absolute; left: 50%; top: -4px; width: 1px; height: 4px; background: #E2E8F0; }
.legenda .ticks span.l { transform: none; } .legenda .ticks span.l::before { left: 0; }
.legenda .ticks span.p { transform: translateX(-100%); } .legenda .ticks span.p::before { left: auto; right: 0; }
.legenda .kat { grid-column: 2; grid-row: 3; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--tekst2); }
.legenda .kat i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legenda .kat b { color: var(--tekst); font-weight: 600; }
.legenda .kat em { margin-left: auto; font-style: normal; color: var(--tekst3); }
.legenda .et2 { grid-column: 1; grid-row: 1 / 4; writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10.5px; color: var(--tekst3); text-align: center; }

.tab { padding: 6px 10px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
th, td { padding: 2px 4px; text-align: right; white-space: nowrap; border-bottom: 1px solid #1c2a45; color: var(--tekst); }
th { color: var(--tekst2); font-weight: 600; }
td:first-child, th:first-child { text-align: left; color: var(--tekst2); }
tr:last-child td { border-bottom: 0; }
td.neg { color: var(--ostrz); }

/* okno eksportu */
.modal { position: fixed; inset: 0; background: rgba(2,6,23,.72); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.okno { width: 760px; max-height: 880px; background: var(--karta); border: 1px solid #33466c; border-radius: 10px; box-shadow: 0 20px 60px #000a; display: flex; flex-direction: column; }
.okno header { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--ramka); }
.okno h2 { margin: 0; font-size: 17px; font-weight: 600; }
.zamknij { background: transparent; border: 1px solid #33466c; border-radius: 6px; width: 32px; height: 30px; cursor: pointer; color: var(--tekst); }
.zamknij:hover { background: #1a2744; }
.m-tresc { padding: 12px 18px; display: grid; gap: 10px; overflow: auto; }
.m-pole { border: 1px solid var(--ramka); border-radius: 8px; padding: 8px 12px; margin: 0; display: grid; gap: 5px; }
.m-pole > span, .m-pole legend { color: var(--tekst2); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 0 4px; }
label.m-pole select { width: 100%; padding: 7px 8px; }
.m-pole label { display: grid; grid-template-columns: 22px 260px 1fr; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.m-pole label:hover { background: #172340; }
.m-pole label b { font-weight: 600; } .m-pole label small { color: var(--tekst3); font-size: 12px; }
.m-pole label.poz { grid-template-columns: 22px auto; display: inline-grid; margin-right: 14px; }
.m-pole input[type=radio] { accent-color: var(--akcent); width: 15px; height: 15px; }
.m-dwa { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-dwa .m-pole { display: block; }
.m-info { margin: 0; color: var(--tekst2); font-size: 12px; }
.okno footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--ramka); }
.m-plik { font-family: Consolas, monospace; font-size: 12px; color: var(--tekst2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
