#adm { max-width: 1280px; margin: 0 auto; padding: 16px; }
body { padding: calc(env(safe-area-inset-top) + 60px) 0 24px; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.bar .grow { flex: 1 1 260px; color: var(--muted); font-size: 14px; }
.btn.sm { padding: 7px 11px; font-size: 14px; }
.hint2 { color: var(--muted); font-size: 13px; }

/* kafelki */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.tile { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 12px;
  box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.tile.off { opacity: .6; }
.tile.alarm { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--card)); box-shadow: 0 0 0 1px var(--bad), var(--shadow); }
.tile .head { display: flex; align-items: center; gap: 8px; padding-right: 28px; }
.tile .sdot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.tile .sdot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.tile .sdot.bad { background: var(--bad); }
.tile h3 { margin: 0; font-size: 17px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .id { color: var(--muted); font-size: 13px; font-weight: 500; flex: none; }
.tile .chk { position: absolute; top: 12px; right: 12px; }
.tile .chk input { width: 20px; height: 20px; cursor: pointer; }
.tile .badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 650; background: var(--chip); color: var(--ink); }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge.bad { background: var(--bad); color: #fff; }
.tile .kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0 0; }
.tile .kv div { background: var(--chip); border-radius: 10px; padding: 6px 8px; }
.tile .kv small { display: block; color: var(--muted); font-size: 11px; }
.tile .kv b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tile .foot { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; display: flex; justify-content: space-between; gap: 8px; }
.tile .note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* szczegoly urzadzenia */
.dhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.dhead h2 { margin: 0; font-size: 20px; }
.dhead .grow { flex: 1; }
.dhead .badges { display: flex; flex-wrap: wrap; gap: 6px; }
.edit { display: grid; gap: 10px; grid-template-columns: 1fr 1fr auto; align-items: end; }
@media (max-width: 700px) { .edit { grid-template-columns: 1fr; } }
iframe.dev { width: 100%; height: calc(100vh - 200px); height: calc(100dvh - 200px); min-height: 480px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); display: block; }
@media (max-width: 700px) { iframe.dev { height: calc(100dvh - 270px); min-height: 420px; } #adm { padding: 12px; } .dhead .hint2 { display: none; } .dhead h2 { font-size: 18px; flex: 1 1 60%; } }

/* zdalna diagnostyka */
.diag .drow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.diag .drow input { flex: 1 1 220px; min-width: 0; }
.diag .dfiles { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow: auto; }
.diag .dfiles a { color: var(--accent); word-break: break-all; }

/* 2026-11-15: rodzaj alarmu na kafelku */
.tile .altxt { margin: 8px 0 0; color: var(--bad); font-size: 13px; font-weight: 600; }

/* historia temperatur (2026-11-20); kolory czujnikow stale, osobno dla jasnego i ciemnego tla */
:root { --h-t2: #2a78d6; --h-t1: #eb6834; --h-t3: #1baf7a; --h-t6: #eda100; --h-t8: #e87ba4; --h-t9: #008300; --h-t10: #6250d6; --h-t11: #8a8a85; }
@media (prefers-color-scheme: dark) { :root { --h-t2: #3987e5; --h-t1: #d95926; --h-t3: #199e70; --h-t6: #c98500; --h-t8: #d55181; --h-t9: #0ca30c; --h-t10: #9085e9; --h-t11: #9a9a94; } }
.hist .hbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 10px; }
.hist .hbar .grow { flex: 1; }
.hist .hseg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.hist .hseg button { font: inherit; font-size: 14px; font-weight: 650; border: 0; background: var(--chip); color: var(--muted); padding: 7px 12px; cursor: pointer; }
.hist .hseg button + button { border-left: 1px solid var(--line); }
.hist .hseg button.on { background: var(--accent); color: #fff; }
.hist .hleg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.hchip { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--chip); color: var(--ink); cursor: pointer; }
.hchip.off { opacity: .45; text-decoration: line-through; }
.hist .sw { display: inline-block; width: 16px; height: 0; border-top: 3px solid; border-radius: 2px; flex: none; }
.hist .sw.dash { border-top-style: dashed; }
.hplot { position: relative; user-select: none; -webkit-user-select: none; min-height: 120px; }
.hplot svg { display: block; width: 100%; height: auto; }
.hplot .ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.hplot .gr { stroke: var(--line); stroke-width: 1; } .hplot .gr.minor { stroke-dasharray: 2 4; }
.hplot .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; } .hplot .ln.dash { stroke-dasharray: 6 4; }
.hplot .alb { fill: var(--bad); opacity: .14; } .hplot .als { fill: var(--bad); }
.hplot .alm line { stroke: var(--bad); stroke-width: 1.5; stroke-dasharray: 4 3; } .hplot .alm path { fill: var(--bad); }
.hplot .xh { stroke: var(--muted); stroke-width: 1; } .hplot .dot { stroke: var(--card); stroke-width: 2; }
.hplot .sel { fill: var(--accent); opacity: .15; }
.hplot .hempty { color: var(--muted); margin: 40px 0; text-align: center; }
.htip { position: absolute; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow); min-width: 200px; z-index: 2; }
.htip .tt { font-weight: 650; margin: 0 0 4px; }
.htip .r { display: flex; justify-content: space-between; gap: 12px; padding: 1px 0; } .htip .r > span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.htip b { font-variant-numeric: tabular-nums; color: var(--ink); } .htip .r.m { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.htip .r.al span { color: var(--bad); font-weight: 650; }

/* historia: zakres od-do i starty sprezarki (2026-11-21) */
.hist .hrange { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hist .hrange label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.hist .hin { width: 12em; font: inherit; font-variant-numeric: tabular-nums; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--chip); color: var(--ink); color-scheme: light dark; }
.hist .hmsg { display: block; color: var(--bad); font-size: 13px; font-weight: 600; margin: -4px 0 8px; min-height: 0; }
.hist .hmsg:empty { display: none; }
.hist .hstarts { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.hist .shead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 0 0 6px; }
.hist .shead h3 { margin: 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hist .hsum { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
.hchip.static { cursor: default; }
.hist .swb { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.hplot .sbg { fill: var(--chip); stroke: var(--line); stroke-width: 1; }
.htip .tl { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }

/* konta instalatorow i panel serwisowy (2026-11-21) */
.badge.inst { background: var(--chip); color: var(--muted); font-weight: 600; }
.konta .kform { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; align-items: end; }
.konta .kmsg { font-weight: 650; color: var(--ink); background: var(--chip); border-radius: 10px; padding: 10px 12px; margin: 12px 0; word-break: break-word; }
.konta .kmsg:empty { display: none; }
.konta .klist { display: grid; gap: 8px; margin: 8px 0; }
.konta .krow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) auto; gap: 8px 14px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.konta .krow.off { opacity: .6; }
.konta .kbtn { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .konta .krow { grid-template-columns: 1fr; } }
.kinst { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.kinst .f { flex: 1 1 260px; margin: 0; }
.ksel { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kerr { color: var(--bad); font-weight: 650; min-height: 1.2em; margin: 4px 0 10px; }
.krowb { display: flex; gap: 10px; flex-wrap: wrap; }
.konta .kdel { color: var(--bad); }
