:root {
  --bg: #23271e;
  --bg2: #2c3125;
  --panel: #3b4130;
  --tile: #4b5237;
  --tile-edge: #5d6545;
  --text: #f1e9b8;
  --muted: #b9b48f;
  --line: #8d946c;
  --normal: #87916a;
  --armed: #2e5b1e;
  --armed-hi: #3c7428;
  --violation: #2fe02f;
  --alarm: #e11d1d;
  --nocomm: #f2e600;
  --ppoz-off: #87916a;
  --orange: #f08a00;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Segoe UI", Tahoma, Arial, sans-serif; overflow: hidden; user-select: none; }
button { font-family: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- pasek boczny ---------- */
body { display: flex; }
.side { width: 270px; flex: none; overflow-y: auto; background: var(--bg2); border-right: 1px solid #1a1d16;
  display: flex; flex-direction: column; padding: 22px 18px 16px; gap: 18px; }
.brand .sys { font-size: 28px; line-height: 1.1; }
.brand .site { color: var(--muted); font-size: 15px; margin-top: 4px; letter-spacing: .5px; }
.menu { display: flex; flex-direction: column; gap: 8px; }
.menu button { background: var(--normal); border: 1px solid #6f7856; border-radius: 4px;
  font-size: 21px; padding: 7px 10px; color: var(--text); }
.menu button.active { background: var(--armed); border-color: #4b8a34; }
.menu button:hover { filter: brightness(1.1); }
.userbox { background: var(--panel); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.userbox .who { color: var(--muted); margin-bottom: 8px; }
.userbox .who b { color: var(--text); font-weight: 600; }
.userbox button { width: 100%; background: #5a6241; border: 1px solid #737c58; border-radius: 4px; padding: 7px; font-size: 15px; }
.spacer { flex: 1; }
.legend-title { font-size: 18px; margin-bottom: 6px; }
.legend-box { background: #3a3a2c; border-radius: 6px; padding: 8px 12px; font-size: 15px; line-height: 1.75; }
.legend-sub { color: var(--muted); }
.sw { display: inline-block; width: 14px; height: 14px; margin-right: 8px; vertical-align: -2px; }
.sw.nocomm { background: var(--nocomm); } .sw.normal { background: var(--normal); }
.sw.alarm { background: var(--alarm); } .sw.armed { background: var(--armed); } .sw.violation { background: var(--violation); }
.clock { background: #11130e; border: 1px solid #3c4230; border-radius: 8px; padding: 10px 12px 8px; text-align: center; }
.clock .time { font-family: "Consolas", "Lucida Console", monospace; font-size: 38px; color: #7dff5a;
  letter-spacing: 2px; font-variant-numeric: tabular-nums; text-shadow: 0 0 10px rgba(125,255,90,.45); }
.clock .date { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* ---------- obszar główny ---------- */
main { flex: 1; position: relative; padding: 26px 30px; overflow: auto; }
.banner { position: absolute; top: 0; left: 0; right: 0; background: var(--nocomm); color: #222;
  text-align: center; padding: 6px; font-weight: 600; z-index: 5; }
#view-area { position: relative; min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding-bottom: 40px; }
.line-frame { position: relative; height: 58px; max-width: 100%; border: 3px solid var(--line);
  border-bottom: none; border-radius: 14px 14px 0 0; flex: none; }
.line-chip { position: absolute; left: 50%; top: -22px; transform: translateX(-50%);
  background: #2c6b25; border: 1px solid #5aa046; border-radius: 6px; padding: 6px 24px; font-size: 20px; }
.area-inner { display: flex; flex-direction: column; align-items: center; }
.tiles { --s: 1; display: grid; justify-content: center; margin-top: -26px; flex: none; }
.col { display: flex; flex-direction: column; gap: 14px; }

.tile { position: relative; background: var(--tile); border: 1px solid var(--tile-edge);
  border-radius: var(--radius); padding: calc(var(--s) * 14px) calc(var(--s) * 28px + 4px) calc(var(--s) * 18px);
  height: var(--th, 470px); display: flex; flex-direction: column; box-shadow: 0 6px 18px rgba(0,0,0,.35); min-width: 0; }
.tile::before, .tile::after { content: ""; position: absolute; top: 12px; bottom: 12px; width: calc(var(--s) * 8px + 2px); border-radius: 2px; background: #3a4029; }
.tile::before { left: calc(var(--s) * 8px + 1px); } .tile::after { right: calc(var(--s) * 8px + 1px); }
.tile.nocomm::before, .tile.nocomm::after { background: var(--nocomm); }
.tile.alarm::before, .tile.alarm::after { background: var(--alarm); animation: blink 1s steps(1) infinite; }
.tile-head { display: flex; align-items: center; justify-content: center; gap: 8px; background: none; border: none;
  font-size: calc(var(--s) * 30px); padding: 4px 0 calc(var(--s) * 10px); width: 100%; white-space: nowrap; overflow: hidden; }
.tile-head:hover { text-decoration: underline; text-underline-offset: 6px; }
.tile-head .go { font-size: calc(var(--s) * 22px); color: var(--muted); }
.tile-sub { text-align: center; color: var(--muted); font-size: calc(var(--s) * 13px + 1px); margin: -6px 0 10px; min-height: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.parts { flex: 1; display: grid; gap: calc(var(--s) * 12px); grid-auto-rows: 1fr; min-height: 0; }

.pbtn { border-radius: 6px; border: 2px solid rgba(0,0,0,.35); display: flex; flex-direction: column; min-width: 0; min-height: 0;
  align-items: center; justify-content: center; gap: 4px; padding: 6px; text-align: center; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 3px 6px rgba(0,0,0,.35); transition: filter .15s; }
.pbtn:hover { filter: brightness(1.12); }
.pbtn:active { transform: translateY(1px); }
.pbtn .pn { font-size: calc(var(--s) * 22px); font-weight: 600; line-height: 1.1; }
.parts.single .pbtn .pn { font-size: calc(var(--s) * 36px); font-weight: 400; }
.pbtn .ps { font-size: calc(var(--s) * 12px + 1px); letter-spacing: .6px; opacity: .9; }
.dparts .pbtn .pn { font-size: 22px; } .dparts .pbtn .ps { font-size: 13px; }

.st-normal { background: var(--normal); color: var(--text); }
.st-armed { background: var(--armed); color: var(--text); }
.st-violation { background: var(--violation); color: #10300a; }
.st-alarm { background: var(--alarm); color: #fff; animation: blinkbg 1s steps(1) infinite; }
.st-memory { background: #a01818; color: #fff; }
.st-transit { background: var(--armed); color: var(--text); animation: transit 1.2s ease-in-out infinite; }
.st-nocomm { background: var(--nocomm); color: #2a2a00; }

.ppoz { height: 64px; border-radius: 6px; border: 2px solid rgba(0,0,0,.35); font-size: calc(var(--s) * 26px + 4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
  box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.ppoz .ps { font-size: 12px; letter-spacing: .6px; opacity: .9; }
.ppoz.off { background: var(--ppoz-off); color: var(--text); }
.ppoz.on { background: var(--alarm); color: #fff; animation: blinkbg 0.8s steps(1) infinite; }
.ppoz.nocomm { background: var(--nocomm); color: #2a2a00; }
.ppoz.none { visibility: hidden; }

@keyframes blink { 50% { opacity: .25; } }
@keyframes blinkbg { 50% { background: #5a0b0b; } }
@keyframes transit { 50% { background: var(--normal); } }

/* ---------- szczegóły ---------- */
.dhead { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.back { background: var(--normal); border: 1px solid #6f7856; border-radius: 4px; font-size: 18px; padding: 8px 16px; }
.dhead h1 { margin: 0; font-weight: 400; font-size: 34px; }
.dhead .meta { color: var(--muted); font-size: 14px; }
.dgrid { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto 1fr; gap: 20px; }
.card { background: var(--tile); border: 1px solid var(--tile-edge); border-radius: var(--radius); padding: 14px 18px; }
.card h3 { margin: 0 0 12px; font-weight: 400; font-size: 20px; color: var(--muted); }
.dparts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.dparts .pbtn { min-height: 110px; }
.ppoz3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ppoz3 .ppoz { height: 110px; font-size: 22px; text-align: center; padding: 6px; }
.ppoz3 .ppoz.warn { background: var(--orange); color: #241400; animation: blinkbg2 1s steps(1) infinite; }
.ppoz3 .ppoz.fault { background: var(--nocomm); color: #2a2a00; animation: blinkbg3 1s steps(1) infinite; }
@keyframes blinkbg2 { 50% { background: #6b3d00; color: #fff; } }
@keyframes blinkbg3 { 50% { background: #6b6600; color: #fff; } }
.plan { grid-column: 1 / -1; min-height: 220px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); border-style: dashed; }
table.zones { width: 100%; border-collapse: collapse; font-size: 15px; }
table.zones td { padding: 6px 6px; border-bottom: 1px solid #5a6142; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; margin-right: 4px; }
.chip.ok { background: var(--normal); } .chip.v { background: var(--violation); color: #10300a; }
.chip.a { background: var(--alarm); color: #fff; } .chip.m { background: #a01818; color: #fff; }
.chip.t { background: var(--orange); color: #241400; } .chip.b { background: #555; }

/* ---------- dziennik ---------- */
#view-log h2 { font-weight: 400; margin: 0 0 14px; font-size: 30px; }
.log-wrap { height: calc(100% - 60px); overflow: auto; background: var(--tile); border-radius: var(--radius); border: 1px solid var(--tile-edge); }
table.log { width: 100%; border-collapse: collapse; font-size: 15px; }
table.log th { position: sticky; top: 0; background: #3a4029; text-align: left; padding: 8px; font-weight: 600; }
table.log td { padding: 6px 8px; border-bottom: 1px solid #575e40; user-select: text; }
tr.c-alarm td, tr.c-ppoz td { color: #ff8b8b; } tr.c-awaria td { color: #ffe75a; } tr.c-sabotaz td { color: #ffb24d; }
tr.c-uzytkownik td { color: #a9e2ff; }

/* ---------- okna ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 20; }
.dialog { background: var(--panel); border: 1px solid var(--tile-edge); border-radius: 12px; min-width: 420px; max-width: 560px;
  padding: 22px 26px; box-shadow: 0 20px 50px rgba(0,0,0,.6); }
.dialog h2 { margin: 0 0 4px; font-weight: 400; font-size: 26px; }
.dialog .sub { color: var(--muted); margin-bottom: 16px; }
.dialog .row { display: flex; gap: 10px; margin-top: 14px; }
.dialog .row button { flex: 1; }
.btn { border-radius: 5px; border: 1px solid rgba(0,0,0,.4); padding: 12px; font-size: 18px; background: var(--normal); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.arm { background: var(--armed-hi); } .btn.disarm { background: #8a7a2c; } .btn.clear { background: #9b2222; }
.btn.ghost { background: #50573c; }
.dialog label { display: block; color: var(--muted); font-size: 14px; margin-top: 10px; }
.dialog input { width: 100%; font-size: 18px; padding: 9px; background: #23271e; color: var(--text);
  border: 1px solid #6f7856; border-radius: 4px; margin-top: 4px; }
.dialog .err { color: #ff8b8b; min-height: 20px; margin-top: 8px; }
.confirm { background: #2a2f22; border-radius: 6px; padding: 12px; margin-top: 14px; font-size: 18px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #11130e; border: 1px solid #5d6545;
  padding: 12px 22px; border-radius: 8px; font-size: 17px; z-index: 30; }
.toast.bad { border-color: var(--alarm); color: #ff9b9b; }

/* ---------- DEMO ---------- */
.demo-btn { position: fixed; right: 14px; bottom: 14px; background: #6b3d00; border: 1px solid var(--orange); border-radius: 6px;
  padding: 6px 12px; font-weight: 700; z-index: 15; }
.demo-panel { position: fixed; right: 14px; bottom: 54px; width: 380px; max-height: 70vh; overflow: auto; background: #1b1e16;
  border: 1px solid var(--orange); border-radius: 8px; padding: 10px 12px; font-size: 13px; z-index: 15; }
.demo-panel h4 { margin: 10px 0 4px; color: var(--orange); }
.demo-panel button { background: #3b4130; border: 1px solid #5d6545; border-radius: 3px; padding: 3px 6px; margin: 2px; font-size: 12px; }
.demo-panel button.on { background: var(--alarm); }

/* ---------- menu / użytkownik ---------- */
.menu button { position: relative; }
.menu button.hot-alarms:not(.active) { background: #7a2020; border-color: #b33; }
.menu button.hot-troubles:not(.active) { background: #6b6420; border-color: #b3a633; }
.badge.troubles { background: var(--nocomm); color: #222; }
.badge { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: var(--alarm); color: #fff;
  border-radius: 12px; font-size: 14px; padding: 1px 9px; animation: blink 1s steps(1) infinite; }
.ub-row { display: flex; gap: 6px; } .ub-row button { flex: 1; }
.muted { color: var(--muted); }

/* ---------- widoki z nagłówkiem ---------- */
.vhead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.vhead h2 { font-weight: 400; margin: 0; font-size: 30px; }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.filters label { display: flex; align-items: center; gap: 6px; }
input, select, textarea { font-family: inherit; background: #23271e; color: var(--text); border: 1px solid #6f7856; border-radius: 4px; padding: 6px 8px; font-size: 14px; }
input[type=date] { color-scheme: dark; }
.btn.sm { padding: 7px 14px; font-size: 15px; } .btn.xs { padding: 4px 9px; font-size: 13px; }
.btn.rev { background: #2b5a7a; }
#view-log { height: 100%; display: flex; flex-direction: column; }
#view-log .log-wrap { flex: 1; height: auto; }
table.log tr[data-ev] { cursor: pointer; } table.log tr[data-ev]:hover td { background: rgba(255,255,255,.05); }
tr.unacked td { background: rgba(225,29,29,.12); }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 3px; background: #555c40; color: var(--text); margin: 1px 0; }
.tag.ok { background: #2e5b1e; } .tag.hot { background: var(--alarm); color: #fff; } .tag.rev { background: #2b5a7a; }
.chk { display: flex !important; align-items: center; gap: 6px; }
.chk input { width: auto !important; }

/* ---------- okno zdarzenia ---------- */
.evtext { font-size: 20px; margin: 6px 0 10px; }
.notes { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow: auto; }
.note { background: #2a2f22; border-left: 3px solid #6f7856; padding: 6px 10px; font-size: 14px; border-radius: 3px; }
.note.ack { border-color: #4b8a34; } .note.rev { border-color: #3d82b3; }
.note div { margin-top: 3px; color: var(--text); white-space: pre-wrap; }
.dialog textarea { width: 100%; margin-top: 4px; font-size: 15px; resize: vertical; }
.dialog select { width: 100%; font-size: 16px; padding: 8px; margin-top: 4px; }

/* ---------- raporty ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--tile); border: 1px solid var(--tile-edge); border-radius: var(--radius); padding: 14px 18px; }
.kpi .v { font-size: 38px; } .kpi .l { color: var(--muted); font-size: 14px; }
.kpi.bad .v { color: #ff6b6b; } .kpi.warn .v { color: #ffd24d; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid #6f7856; }
table.grid td { padding: 6px 8px; border-bottom: 1px solid #575e40; }
.card + .card, .kpis + .card { margin-top: 16px; }
.row-btns { display: flex; gap: 10px; margin-top: 16px; }
#view-report, #view-settings, #view-users { padding-bottom: 40px; }

/* ---------- ustawienia ---------- */
.form4, .form6, .form3 { display: grid; gap: 12px; }
.form4 { grid-template-columns: repeat(4, 1fr); } .form6 { grid-template-columns: 1.4fr 1fr 1.2fr .7fr 1.2fr; } .form3 { grid-template-columns: repeat(3, 1fr); }
.form4 label, .form6 label, .form3 label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.cc-head { display: flex; justify-content: space-between; align-items: center; }
.cc-head h3 { margin: 0 0 10px; color: var(--text); font-size: 22px; }
.cc-cols { display: grid; grid-template-columns: 1fr 1.6fr; gap: 24px; margin-top: 12px; }
.cc-cols h4 { margin: 10px 0 6px; font-weight: 600; color: var(--muted); }
table.edit { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 6px; }
table.edit th { text-align: left; color: var(--muted); font-weight: 400; padding: 2px 4px; }
table.edit td { padding: 2px 4px; }
table.edit input, table.edit select { width: 100%; }
table.edit input.nr { width: 64px; }
.pin { display: flex; gap: 6px; } .pin input { flex: 1; min-width: 0; }
.dirty { color: #ffd24d; font-weight: 600; }
#sErr { margin-bottom: 10px; font-size: 16px; color: #ff8b8b; }
.roles td:not(:first-child) { text-align: center; } .roles th:not(:first-child) { text-align: center; }

/* niższe ekrany – kompaktowy pasek boczny */
@media (max-height: 900px) {
  .side { padding: 14px 14px 10px; gap: 10px; }
  .brand .sys { font-size: 23px; }
  .menu { gap: 5px; } .menu button { font-size: 16px; padding: 4px 8px; }
  .legend-title { font-size: 15px; margin-bottom: 3px; } .legend-box { font-size: 13px; line-height: 1.5; padding: 6px 10px; }
  .clock .time { font-size: 30px; } .clock { padding: 6px 8px 4px; }
  .userbox { padding: 8px 10px; font-size: 13px; } .userbox button { padding: 5px; font-size: 13px; }
}

/* ---------- odczyt z centrali ---------- */
.scan-row { display: flex; align-items: center; gap: 14px; margin-top: 12px; font-size: 13px; }
.dialog.wide { max-width: 1100px; width: 90vw; max-height: 90vh; overflow: auto; }
.scan-cols { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; margin-top: 8px; }
.scan-cols h4, .dialog h4 { margin: 10px 0 6px; color: var(--muted); font-weight: 600; }
.dialog .form3 label { margin-top: 0; }
.dialog .form3 input, .dialog .form3 select { width: 100%; margin-top: 4px; }
.dialog table.edit input[type=checkbox] { width: 18px; height: 18px; }
.scanning { display: flex; align-items: center; gap: 14px; padding: 20px 0; font-size: 17px; }
.spinner { width: 28px; height: 28px; border: 4px solid #6f7856; border-top-color: var(--violation); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
input[type=checkbox] { accent-color: #3c7428; }

/* ---------- plan obiektu ---------- */
.dgrid2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.dgrid2 .card + .card { margin-top: 0; }
#dPpozBox .card { height: 100%; }
.plan-wrap { display: flex; gap: 18px; align-items: flex-start; }
.plan-stage { position: relative; display: inline-block; line-height: 0; border-radius: 6px; overflow: visible; flex: none; touch-action: none; }
.plan-stage img { max-height: calc(100vh - 330px); min-height: 300px; max-width: 100%; border-radius: 6px; display: block; user-select: none; }
.plan-stage.editing img { max-height: calc(100vh - 290px); }
.plan-stage.placing { cursor: crosshair; outline: 2px dashed var(--violation); outline-offset: 4px; }
.plan-empty { padding: 60px 20px; color: var(--muted); border: 1px dashed #6f7856; border-radius: 6px; flex: 1; text-align: center; }
.pi { position: absolute; transform: translate(-50%, -50%); width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; border: 2px solid rgba(0,0,0,.55); box-shadow: 0 2px 6px rgba(0,0,0,.45); line-height: 1; z-index: 2; }
.pi.static { position: static; transform: none; width: 26px; height: 26px; flex: none; box-shadow: none; }
.pi .pl { position: absolute; left: 40px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: 11px; line-height: 1.2;
  background: rgba(17,19,14,.82); color: var(--text); padding: 1px 5px; border-radius: 3px; pointer-events: none; }
.pi.drag { cursor: grab; } .pi.drag:active { cursor: grabbing; }
.pi.sel { outline: 3px solid #7dd3fc; outline-offset: 2px; }
.pi.st-normal { background: var(--normal); color: #1d2116; }
.pi.st-violation { background: var(--violation); color: #10300a; box-shadow: 0 0 14px 3px rgba(47,224,47,.75); }
.pi.st-alarm { background: var(--alarm); color: #fff; animation: blinkbg 0.8s steps(1) infinite; }
.pi.st-memory { background: #a01818; color: #fff; }
.pi.st-tamper { background: var(--orange); color: #241400; animation: blinkbg2 1s steps(1) infinite; }
.pi.st-bypass { background: #666; color: #ddd; border-style: dashed; }
.pi.st-nocomm { background: var(--nocomm); color: #2a2a00; }
.pi.st-pp-pozar { background: var(--alarm); color: #fff; animation: blinkbg 0.6s steps(1) infinite; box-shadow: 0 0 16px 4px rgba(225,29,29,.8); }
.pi.st-pp-usterka { background: var(--nocomm); color: #2a2a00; animation: blinkbg3 1s steps(1) infinite; }
.pi.st-pp-blokada { background: var(--orange); color: #241400; animation: blinkbg2 1s steps(1) infinite; }
.plegend { min-width: 210px; font-size: 14px; }
.plegend .legend-title { font-size: 17px; }
.lg-sec { color: var(--muted); margin: 10px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.lg-row { display: flex; align-items: center; gap: 9px; margin: 4px 0; }
.sw.tamper { background: var(--orange); } .sw.bypass { background: #666; } .sw.swppoz { background: var(--alarm); }
.zi { display: inline-flex; vertical-align: -3px; margin-right: 6px; color: var(--muted); }
.zones-card table.zones td { padding: 5px 4px; }
.form2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form2 label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.pe-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; padding: 10px 16px; font-size: 14px; }
.pe-tools label { display: flex; align-items: center; gap: 8px; }
.pe-grid { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 16px; align-items: start; }
.pe-grid .card + .card { margin-top: 0; }
.pe-list { max-height: calc(100vh - 230px); overflow: auto; }
.pe-list tr.sel td { background: rgba(125,211,252,.1); } .pe-list tr.placing td { background: rgba(47,224,47,.15); }
.small { font-size: 11px; } .nowrap { white-space: nowrap; }

.pi.lbl-left .pl { left: auto; right: 40px; }
.plan-stage.nolabels .pi .pl { display: none; }
.plan-stage .pi:hover .pl { display: block; z-index: 5; }
.pi:hover { z-index: 4; }
.lg-toggle { margin-top: 12px; font-size: 13px; color: var(--muted); }

.lg-note { margin-top: 12px; font-size: 12px; color: var(--muted); max-width: 220px; }

.ver { text-align: center; font-size: 11px; color: #6f7856; margin-top: -10px; }

/* ---------- ekrany ---------- */
.screens { display: flex; flex-direction: column; gap: 4px; margin: -2px 0 2px 14px; }
.screens button { font-size: 15px !important; padding: 4px 8px !important; text-align: left; position: relative; background: #5a6241 !important; }
.screens button.active { background: var(--armed) !important; }
.screens button small { color: var(--muted); font-size: 11px; }
.sdot { position: absolute; right: 8px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; }
.sdot.alarm { background: var(--alarm); animation: blink 0.8s steps(1) infinite; } .sdot.warn { background: var(--nocomm); }
.alarm-bar { position: sticky; top: -26px; margin: -26px -30px 14px; padding: 8px 30px; z-index: 6; font-size: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.alarm-bar.alarm { background: #7a0f0f; color: #fff; border-bottom: 3px solid var(--alarm); animation: barpulse 1.2s ease-in-out infinite; }
.alarm-bar.warn { background: #5c5600; color: #fff; border-bottom: 3px solid var(--nocomm); }
@keyframes barpulse { 50% { background: #b01515; } }
.ab-item { border: 1px solid rgba(255,255,255,.5); background: rgba(0,0,0,.25); border-radius: 4px; padding: 4px 10px; font-size: 15px; color: #fff; }
.ab-item.alarm { border-color: #ff8b8b; } .ab-item:hover { background: rgba(255,255,255,.15); }
.empty-screen { grid-column: 1 / -1; color: var(--muted); font-size: 22px; padding: 80px; text-align: center; }
.cap-info { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.cap-info span.over { color: #ff8b8b; font-weight: 700; }
.form4 { grid-template-columns: repeat(4, 1fr); }
.form6 { grid-template-columns: 1.4fr 1fr 1.2fr .7fr .9fr 1.2fr; }
/* ---------- dźwięk ---------- */
.soundbox { border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.soundbox.alarm { background: #7a1414; border: 1px solid var(--alarm); animation: barpulse 1.2s ease-in-out infinite; }
.soundbox.warn { background: #5c5600; border: 1px solid var(--nocomm); }
.soundbox.muted { background: var(--panel); border: 1px dashed #6f7856; }
.soundbox .sb-t { font-weight: 600; margin-bottom: 4px; } .soundbox .sb-h { font-size: 12px; opacity: .85; margin: 3px 0; }
.soundbox button { width: 100%; margin-top: 4px; padding: 6px; border-radius: 4px; border: 1px solid rgba(255,255,255,.4); background: rgba(0,0,0,.3); font-size: 14px; }

.form6 label, .form4 label { min-width: 0; } .pin input { min-width: 0; width: 100%; }

/* ---------- raport zmiany ---------- */
.menu button.shift-new:not(.active) { animation: shiftblink 1.4s infinite; border-color: #d9b44a; }
@keyframes shiftblink { 50% { background: #6b5a12; color: #fff; } }
.badge.shiftb { background: #d9b44a; color: #222; font-size: 11px; }
.kpis.kpis6 { grid-template-columns: repeat(6, 1fr); }
.shift-verdict { padding: 10px 16px; border-radius: var(--radius); margin-bottom: 14px; font-size: 17px; border: 1px solid; }
.shift-verdict.ok { background: #1f3a22; border-color: #3c7a43; color: #cfeccf; }
.shift-verdict.bad { background: #4a1c1c; border-color: #a33; color: #ffd9d9; }
#view-shift td.bad, #view-shift b.bad { color: #ff6b6b; font-weight: 600; } #view-shift td.warnc { color: #ffd24d; font-weight: 600; }
#view-shift .dgrid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); margin-bottom: 16px; }
#view-shift .dgrid2 .card { overflow-x: auto; }
#view-shift .dgrid2 table.grid { font-size: 13px; }
#view-shift .dgrid2 table.grid th { white-space: normal; padding: 6px 5px; } #view-shift .dgrid2 table.grid td { padding: 6px 5px; }
#view-shift td:first-child { white-space: nowrap; }
#view-shift .small { font-size: 12px; margin-top: 8px; }
#view-shift tr.cat-alarm td:nth-child(3), #view-shift tr.cat-ppoz td:nth-child(3), #view-shift tr.cat-sabotaz td:nth-child(3) { color: #ff6b6b; }
#view-shift tr.cat-awaria td:nth-child(3) { color: #ffd24d; }
.print-only { display: none; }
.filebtn { cursor: pointer; display: inline-block; }
#bkBox .row-btns { margin: 12px 0; } #bkBox code { color: #fff; }
@media print {
  body { background: #fff !important; color: #000 !important; }
  .side, .alarm-bar, .banner, .no-print, .demo-btn, .demo-panel, .toast, .modal, .soundbox { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; overflow: visible !important; height: auto !important; }
  .view { overflow: visible !important; height: auto !important; }
  .print-only { display: block; margin-bottom: 8px; font-size: 12px; }
  .card, .kpi, .shift-verdict { background: #fff !important; color: #000 !important; border-color: #999 !important; break-inside: avoid; }
  .kpi .v { font-size: 24px; } .card h3, .kpi .l, .muted, h2 { color: #333 !important; }
  table.grid th, table.grid td { color: #000 !important; border-color: #bbb !important; font-size: 11px; }
  #view-shift td.bad, #view-shift b.bad, #view-shift tr td { color: #000 !important; }
}
.log-stats { grid-column: 1 / -1; font-size: 13px; }
