/* Centrum wież - panel operatora. Ciemny motyw "centrum dowodzenia": jeden akcent (cyjan),
   czerwień tylko dla alarmów, bursztyn dla ostrzeżeń. Animacje wyłącza prefers-reduced-motion. */
:root {
  --bg: #060a11;
  --panel: #0d141f;
  --panel-2: #121b29;
  --panel-3: #18233a;
  --line: #1b2638;
  --line-2: #26354d;
  --text: #e7eef7;
  --text-2: #b4c1d3;
  --muted: #7a8aa0;
  --accent: #22d3ee;
  --accent-2: #0ea5e9;
  --accent-ink: #032029;
  --accent-soft: rgba(34, 211, 238, .12);
  --accent-glow: rgba(34, 211, 238, .38);
  --red: #ff4d5e;
  --red-soft: rgba(255, 77, 94, .13);
  --red-glow: rgba(255, 77, 94, .5);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, .14);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, .13);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 12px 32px -12px rgba(0, 0, 0, .55);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --topbar-h: 58px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* hidden wygrywa z display: flex/grid z klas poniżej */
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1100px 520px at 8% -12%, rgba(34, 211, 238, .075), transparent 62%),
    radial-gradient(900px 480px at 100% -8%, rgba(14, 165, 233, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
/* delikatna siatka w tle, wygasa ku dołowi */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image: linear-gradient(rgba(148, 197, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 197, 255, .035) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 80%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0 0 .6em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 15px; } h3 { font-size: 14px; }
.muted { color: var(--muted); }
.error { color: var(--red); }
b, strong { font-weight: 650; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: rgba(34, 211, 238, .3); }
* { scrollbar-width: thin; scrollbar-color: #26354d transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #223047; border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- pasek górny ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 22px; height: var(--topbar-h); padding: 0 18px;
  background: rgba(7, 11, 18, .78);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .55) 30%, rgba(14, 165, 233, .35) 70%, transparent);
  opacity: .55;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { font-size: 10px; letter-spacing: .18em; color: var(--muted); text-transform: uppercase; margin-top: 2px; }
.logo { width: 32px; height: 32px; flex: none; color: var(--accent); filter: drop-shadow(0 0 10px rgba(34, 211, 238, .45)); }
.logo .sig { animation: signal 2.4s ease-in-out infinite; }
.logo .sig-2 { animation-delay: .35s; }
@keyframes signal { 0%, 100% { opacity: .25; } 40% { opacity: 1; } }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  position: relative; color: var(--text-2); padding: 7px 12px; border-radius: 9px; font-weight: 500;
  transition: color .15s, background .15s;
}
.topbar nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); text-decoration: none; }
.topbar nav a.active { color: var(--text); background: var(--accent-soft); }
.topbar nav a.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -11px; height: 2px; border-radius: 2px;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
}
.clock { font: 500 13px var(--mono); color: var(--text-2); padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255, 255, 255, .02); font-variant-numeric: tabular-nums; }
.user { display: flex; gap: 10px; align-items: center; }
.user form { margin: 0; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 12.5px; color: var(--accent-ink); text-transform: uppercase;
  background: linear-gradient(135deg, #67e8f9, #0ea5e9);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, .2);
}
.user-name { color: var(--text-2); font-weight: 500; }

/* ---------- układ ---------- */
main { position: relative; z-index: 1; }
main.page { padding: 20px; max-width: 1440px; margin: 0 auto; }
main.dash {
  display: grid; grid-template-columns: 300px minmax(340px, 1fr) minmax(380px, 1.25fr);
  grid-template-rows: auto minmax(0, 1fr); gap: 14px; padding: 14px;
  height: calc(100vh - var(--topbar-h));
}
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, 0) 120px), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 0; overflow: auto;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.panel-head h2, .panel > h2, .section-title {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-size: 12px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2);
}
.panel > h2 { margin-bottom: 12px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.section { margin-bottom: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.back:hover { color: var(--accent); text-decoration: none; }

/* wejście elementów strony (stagger przez --d) */
.rise { animation: rise .6s var(--ease) both; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
/* nowe elementy list (morph w common.js): pierwsze wczytanie i późniejsze dopisanie */
.fx-in { animation: rise .5s var(--ease) both; animation-delay: calc(var(--fx-i, 0) * 45ms); }
.fx-new { animation: popIn .55s var(--ease) both; }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px); background-color: var(--accent-soft); } }
tr.fx-new td { animation: rowFlash 1.6s ease-out; }
@keyframes rowFlash { from { background: var(--accent-soft); } }
.fx-leave {
  transition: height .32s var(--ease), opacity .22s, transform .32s var(--ease), margin .32s var(--ease), padding .32s var(--ease) !important;
  height: 0 !important; opacity: 0; transform: translateX(28px);
  margin-top: 0 !important; margin-bottom: 0 !important; padding-top: 0 !important; padding-bottom: 0 !important;
}
.fx-swap { animation: swap .35s var(--ease) both; }
@keyframes swap { from { opacity: 0; transform: translateY(6px); } }
.fx-bump { animation: bump .5s var(--ease); }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ---------- przyciski i formularze ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel-3); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 8px 13px; font: 500 13.5px/1.2 var(--font); cursor: pointer; white-space: nowrap;
  transition: transform .14s var(--ease), background .15s, border-color .15s, box-shadow .2s, color .15s;
}
a.btn:hover { text-decoration: none; }
.btn:hover { background: #1e2b44; border-color: #3a4d6b; transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary {
  background: linear-gradient(180deg, #34e1f7, #0cb3d6); border-color: rgba(103, 232, 249, .5); color: var(--accent-ink); font-weight: 650;
  box-shadow: 0 8px 22px -10px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.primary:hover { background: linear-gradient(180deg, #52e8fa, #12bfe2); box-shadow: 0 10px 28px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn.danger { background: var(--red-soft); border-color: rgba(255, 77, 94, .45); color: #ffb3bc; }
.btn.danger:hover { background: rgba(255, 77, 94, .22); border-color: rgba(255, 77, 94, .7); }
.btn.ok { background: var(--green-soft); border-color: rgba(52, 211, 153, .45); color: #a7f3d0; }
.btn.ok:hover { background: rgba(52, 211, 153, .22); border-color: rgba(52, 211, 153, .7); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.btn.small { padding: 5px 9px; font-size: 12.5px; border-radius: 8px; }
.btn.active { border-color: var(--accent); color: #fff; background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.btn.armed { border-color: var(--red); color: #ffd0d6; background: var(--red-soft); animation: armed 1s ease-in-out infinite; }
@keyframes armed { 50% { box-shadow: 0 0 0 4px rgba(255, 77, 94, .18); } }
.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent; animation: spin .8s linear infinite;
}
.btn.primary.busy::after { border-color: var(--accent-ink) transparent var(--accent-ink) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
input, select, textarea {
  background: #070c14; color: var(--text); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 8px 10px; font: inherit; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #33465f; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 211, 238, .16); }
input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 77, 94, .14); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; }
label { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 4px; color: var(--text); }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 13px; cursor: pointer; }
.hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.field-error { display: block; color: #ff8a96; font-size: 12px; margin-top: 4px; }
.form-error { color: #ff8a96; margin: 0 0 4px; }
.toggle { display: flex; align-items: center; gap: 8px; margin: 0; }
/* przełącznik zamiast gołego checkboxa */
.switch { display: inline-flex; align-items: center; gap: 8px; margin: 0; color: var(--text-2); font-size: 12.5px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 32px; height: 18px; border-radius: 18px; background: var(--panel-3); border: 1px solid var(--line-2); transition: background .2s, border-color .2s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: transform .22s var(--ease), background .2s; }
.switch input:checked + .track { background: var(--accent-soft); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- znaczki i stany ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px;
  background: var(--panel-3); color: var(--text-2); font: 600 11.5px/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.badge.red { background: var(--red); color: #fff; box-shadow: 0 0 14px -2px var(--red-glow); }
.badge.cyan { background: var(--accent-soft); color: var(--accent); }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; border-radius: 20px; font-size: 12.5px; font-weight: 550; background: var(--panel-3); border: 1px solid var(--line-2); vertical-align: middle; }
.pill.on { color: #a7f3d0; border-color: rgba(52, 211, 153, .35); background: var(--green-soft); }
.pill.off { color: #ffb3bc; border-color: rgba(255, 77, 94, .35); background: var(--red-soft); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 7px; font: 500 12px var(--mono); color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); }
.dot { position: relative; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; vertical-align: middle; }
.on .dot, .dot.on { background: var(--green); box-shadow: 0 0 8px rgba(52, 211, 153, .8); }
.on .dot::after, .dot.on::after {
  content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid var(--green);
  animation: ping 2.2s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: .8; } 80%, 100% { transform: scale(2.8); opacity: 0; } }
.warn .dot, .dot.warn { background: var(--amber); box-shadow: 0 0 8px rgba(245, 165, 36, .8); animation: breathe 1.6s ease-in-out infinite; }
.off .dot, .dot.off { background: var(--red); box-shadow: 0 0 8px var(--red-glow); animation: breathe 1.1s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

/* szkielety zamiast "Wczytuję…" */
.skeleton {
  display: block; border-radius: 10px; min-height: 14px;
  background: linear-gradient(90deg, var(--panel-2) 0%, #1b2740 40%, var(--panel-2) 80%);
  background-size: 220% 100%; animation: shimmer 1.4s linear infinite;
}
.sk-row { height: 52px; margin-bottom: 8px; list-style: none; }
.sk-line { height: 14px; margin: 10px 0; }
td .skeleton { height: 14px; margin: 4px 0; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* puste stany */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 36px 16px; color: var(--muted); text-align: center; }
.empty svg { width: 44px; height: 44px; color: var(--line-2); }
.empty b { color: var(--text-2); font-size: 14px; }
.empty.ok svg { color: rgba(52, 211, 153, .55); filter: drop-shadow(0 0 14px rgba(52, 211, 153, .35)); }

/* ---------- pulpit: wskaźniki ---------- */
.kpis { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 13px 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .03), transparent 60%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, var(--kpi-c, var(--accent-soft)), transparent 70%); opacity: .7; pointer-events: none; }
.kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(34, 211, 238, .25); }
.kpi-icon svg { width: 19px; height: 19px; }
.kpi .label { color: var(--muted); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; }
.kpi .value { font-size: 22px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi.alarm { --kpi-c: rgba(255, 77, 94, .22); }
.kpi.alarm .kpi-icon { color: var(--red); background: var(--red-soft); border-color: rgba(255, 77, 94, .3); }
.kpi.alarm.active { border-color: rgba(255, 77, 94, .45); }
.kpi.alarm.active .kpi-icon { animation: alarmIcon 1.6s ease-in-out infinite; }
@keyframes alarmIcon { 50% { box-shadow: 0 0 0 6px rgba(255, 77, 94, .12), 0 0 18px var(--red-glow); } }
.kpi.warn .value { color: var(--amber); }
.kpi.bad .value { color: var(--red); }

/* ---------- lista wież ---------- */
.tower-list, .alarm-list { list-style: none; margin: 0; padding: 0; }
.tower { margin-bottom: 6px; }
.tower a {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 11px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
  transition: transform .15s var(--ease), border-color .15s, background .15s;
}
.tower a:hover { text-decoration: none; transform: translateX(2px); border-color: var(--line-2); background: #16213a; }
.tower .dot { grid-row: 1 / 3; }
.tower .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tower .meta { grid-column: 2; color: var(--muted); font-size: 12.5px; }
.tower .badge { grid-row: 1 / 3; grid-column: 3; }
.tower.off a { border-color: rgba(255, 77, 94, .3); background: linear-gradient(90deg, var(--red-soft), transparent 70%), var(--panel-2); }
.tower.off .meta { color: #ff9aa5; }
.tower.warn a { border-color: rgba(245, 165, 36, .3); }

/* ---------- kolejka alarmów ---------- */
.alarm {
  position: relative; display: grid; grid-template-columns: 72px 1fr; gap: 2px 12px; padding: 10px 12px 10px 16px; margin-bottom: 8px;
  background: linear-gradient(90deg, var(--red-soft), transparent 60%), var(--panel-2);
  border: 1px solid var(--line); border-radius: 11px; cursor: pointer;
  transition: transform .15s var(--ease), border-color .15s, box-shadow .2s;
}
.alarm::before { content: ""; position: absolute; left: 6px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--red); box-shadow: 0 0 10px var(--red-glow); }
.alarm:hover { transform: translateX(2px); border-color: var(--line-2); }
.alarm.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), 0 0 26px -8px var(--accent-glow); }
.alarm.tower_offline, .alarm.camera_offline, .alarm.overheat { background: linear-gradient(90deg, var(--amber-soft), transparent 60%), var(--panel-2); }
.alarm.tower_offline::before, .alarm.camera_offline::before, .alarm.overheat::before { background: var(--amber); box-shadow: 0 0 10px rgba(245, 165, 36, .5); }
.alarm .time { grid-row: 1 / 3; align-self: center; font: 500 12.5px var(--mono); color: var(--text-2); font-variant-numeric: tabular-nums; }
.alarm .what { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.alarm .where { color: var(--muted); font-size: 12.5px; }
/* nowa grupa wjeżdża z góry, rosnąca grupa świeci na czerwono */
.alarm.new-flash { animation: alarmGlow 1.6s ease-out; }
.alarm.fx-new { animation: alarmIn .6s var(--ease) both, alarmGlow 1.8s ease-out .1s; }
@keyframes alarmIn { from { opacity: 0; transform: translateY(-16px) scale(.98); } }
@keyframes alarmGlow { 0% { box-shadow: 0 0 0 1px var(--red), 0 0 34px var(--red-glow); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- szczegóły alarmu ---------- */
.media-box {
  position: relative; background: radial-gradient(circle at 50% 40%, #0c1422, #03060b); border-radius: 12px; border: 1px solid var(--line);
  aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 14px;
}
.media-box img, .media-box video { width: 100%; height: 100%; object-fit: contain; animation: mediaIn .5s var(--ease) both; }
@keyframes mediaIn { from { opacity: 0; transform: scale(1.02); filter: blur(4px); } }
.media-box .muted { padding: 16px; text-align: center; }
.media-tag {
  position: absolute; top: 10px; left: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 7px; font: 600 10.5px var(--font); letter-spacing: .1em; text-transform: uppercase;
  background: rgba(3, 6, 11, .72); border: 1px solid rgba(255, 255, 255, .1); color: var(--text-2);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.media-tag.alarm-tag { color: #ffc2c9; border-color: rgba(255, 77, 94, .45); }
.media-tag.live { color: #a7f3d0; border-color: rgba(52, 211, 153, .45); }
.media-tag .dot { width: 7px; height: 7px; }
.media-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
/* ramka wykrytego obiektu na zdjęciu alarmu */
.bbox {
  position: absolute; z-index: 1; border: 2px solid var(--red); border-radius: 4px; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), 0 0 22px -2px var(--red-glow), inset 0 0 18px -6px var(--red-glow);
  animation: bboxIn .55s var(--ease) both, bboxPulse 2.4s ease-in-out .7s infinite;
}
.bbox::before, .bbox::after { content: ""; position: absolute; width: 10px; height: 10px; border: 0 solid #fff; }
.bbox::before { left: -4px; top: -4px; border-left-width: 2px; border-top-width: 2px; }
.bbox::after { right: -4px; bottom: -4px; border-right-width: 2px; border-bottom-width: 2px; }
.bbox-label {
  position: absolute; left: -2px; bottom: 100%; margin-bottom: 5px; white-space: nowrap;
  padding: 2px 8px; border-radius: 6px; background: var(--red); color: #fff; font: 650 12px/1.4 var(--font);
  box-shadow: 0 4px 14px -4px var(--red-glow);
}
.bbox.below .bbox-label { bottom: auto; top: 100%; margin: 5px 0 0; }
@keyframes bboxIn { from { opacity: 0; transform: scale(1.35); } 60% { opacity: 1; } }
@keyframes bboxPulse { 50% { box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), 0 0 34px 2px var(--red-glow), inset 0 0 22px -4px var(--red-glow); } }
dl.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 14px; }
dl.facts > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; min-width: 0; }
dl.facts dt { color: var(--muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
dl.facts dd { margin: 1px 0 0; font-weight: 550; overflow-wrap: anywhere; }
.detail textarea { min-height: 58px; resize: vertical; margin-bottom: 12px; }
.status-hero { display: flex; align-items: center; gap: 16px; padding: 20px; margin-bottom: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); }
.status-hero svg { width: 46px; height: 46px; flex: none; color: var(--accent); }
.status-hero b { display: block; font-size: 26px; line-height: 1.15; letter-spacing: -.01em; }
.status-hero span { display: block; color: var(--muted); margin-top: 4px; }
.status-hero.warn { border-color: rgba(245, 165, 36, .35); background: linear-gradient(90deg, var(--amber-soft), transparent 70%), var(--panel-2); }
.status-hero.warn svg { color: var(--amber); filter: drop-shadow(0 0 12px rgba(245, 165, 36, .45)); animation: breathe 1.8s ease-in-out infinite; }
.status-hero.warn b { color: var(--amber); }
.learn-note { display: flex; align-items: flex-start; gap: 7px; margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.learn-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--accent); }
/* menu "⋯" */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 250px; padding: 6px;
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 20px 44px -12px rgba(0, 0, 0, .7);
  animation: modalIn .2s var(--ease) both;
}
.menu-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; color: var(--text); font: 500 13px var(--font); cursor: pointer; }
.menu-item:hover { background: rgba(255, 255, 255, .05); }
.menu-item.danger { color: #ffb3bc; }
.menu-item.danger:hover { background: var(--red-soft); }
.menu-item.armed { background: var(--red-soft); color: #ffd0d6; animation: armed 1s ease-in-out infinite; }
.menu-note { margin: 2px 10px 6px; color: var(--muted); font-size: 11.5px; line-height: 1.4; }
/* nagrania 24/7 */
.rec-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); gap: 16px; align-items: start; }
.rec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rec-list > li:not(.skeleton) { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.rec-list .dot { grid-row: 1 / 3; }
.rec-list .rec-meta { grid-column: 2 / 4; color: var(--muted); font-size: 12.5px; }
.rec-list .rec-state { font-size: 12.5px; font-weight: 600; }
.rec-list .on-txt { color: #a7f3d0; }
.rec-list .off-txt { color: #ffb3bc; }
.rec-list .warn-txt { color: var(--amber); }
.rec-list li.rec-note { display: block; color: var(--muted); }
.clip-form { margin: 0; padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.clip-form h3 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.clip-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.clip-fields label:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
#clip-result:not(:empty) { margin-top: 12px; }
#clip-result video { width: 100%; border-radius: 10px; background: #000; border: 1px solid var(--line); animation: mediaIn .5s var(--ease) both; }
.clip-progress { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.clip-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
@media (max-width: 1100px) { .rec-layout { grid-template-columns: 1fr; } }
/* skuteczność reguł */
.ratio { display: flex; width: 120px; height: 8px; border-radius: 6px; overflow: hidden; background: var(--panel-3); }
.ratio i { display: block; height: 100%; transition: width .8s var(--ease); }
.ratio .r-ack { background: var(--green); }
.ratio .r-false { background: var(--red); }
.ratio .r-new { background: #3a4a63; }
.ratio-legend { display: flex; gap: 10px; margin-top: 4px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ratio-legend b { font-weight: 600; }
.rate-bad { color: var(--red); font-weight: 650; }
.rate-hot { color: var(--amber); font-weight: 650; }
.suggestion { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.suggestion span { color: var(--text-2); font-size: 12.5px; }
.detail .panel-head h2 { text-transform: none; letter-spacing: -.01em; font-size: 16px; color: var(--text); }

/* ---------- strona wieży ---------- */
.tower-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; padding: 18px 20px;
  background: radial-gradient(700px 160px at 0% 0%, rgba(34, 211, 238, .09), transparent 70%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.tower-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0 6px; font-size: 24px; }
.tower-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile {
  position: relative; overflow: hidden; padding: 12px 14px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent), var(--panel);
  border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s;
}
.tile:hover { border-color: var(--line-2); }
.tile .label { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.tile .value { margin-top: 3px; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value.hot { color: var(--amber); }
.tile .value.bad { color: var(--red); }
.tile .bar { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--pct, 0%); background: linear-gradient(90deg, var(--accent-2), var(--accent)); box-shadow: 0 0 10px var(--accent-glow); transition: width .9s var(--ease); }
.tile .bar.hot { background: var(--amber); box-shadow: 0 0 10px rgba(245, 165, 36, .5); }
.tile .bar.bad { background: var(--red); box-shadow: 0 0 10px var(--red-glow); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; vertical-align: middle; margin-right: 6px; box-shadow: 0 0 8px -1px currentColor; }

/* karta podłączania nowego Jetsona */
.enroll {
  position: relative; overflow: hidden; margin-bottom: 16px; padding: 20px 22px;
  background: radial-gradient(700px 240px at 0% 0%, rgba(34, 211, 238, .13), transparent 70%), var(--panel);
  border: 1px solid rgba(34, 211, 238, .4); border-radius: var(--radius);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, .08), 0 20px 50px -24px var(--accent-glow);
  animation: rise .6s var(--ease) both;
}
.enroll-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.enroll-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; text-transform: none; color: var(--text); }
.enroll-head p { margin: 2px 0 0; }
.enroll-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(34, 211, 238, .3); }
.enroll-icon svg { width: 22px; height: 22px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps > li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.step-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--accent); border: 1.5px solid rgba(34, 211, 238, .5); background: rgba(34, 211, 238, .06); }
.steps p { margin: 2px 0 8px; }
.cmd {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; margin-top: 6px;
  background: #03070d; border: 1px solid var(--line-2); border-radius: 10px;
}
.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; color: #a5f3fc; font-size: 13.5px; padding: 2px 0; }
.cmd code::before { content: "$ "; color: var(--muted); }
.code-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.code-big { font: 700 24px/1 var(--mono); letter-spacing: .14em; color: var(--accent); text-shadow: 0 0 20px var(--accent-glow); }
.waiting { display: flex; align-items: center; gap: 16px; }
.waves { position: relative; width: 54px; height: 54px; flex: none; }
.waves span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: wave 2.4s var(--ease) infinite; }
.waves span:nth-child(2) { animation-delay: .8s; }
.waves span:nth-child(3) { animation-delay: 1.6s; }
.waves i { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
@keyframes wave { 0% { transform: scale(.25); opacity: .9; } 100% { transform: scale(1.15); opacity: 0; } }
.enroll.success { border-color: rgba(52, 211, 153, .5); background: radial-gradient(700px 240px at 0% 0%, rgba(52, 211, 153, .14), transparent 70%), var(--panel); box-shadow: 0 20px 50px -24px rgba(52, 211, 153, .5); }
.success-row { display: flex; align-items: center; gap: 16px; }
.success-row h2 { margin: 0; font-size: 18px; text-transform: none; letter-spacing: -.01em; color: var(--text); }
.check-anim { width: 54px; height: 54px; flex: none; color: var(--green); filter: drop-shadow(0 0 12px rgba(52, 211, 153, .55)); }
.check-anim circle { stroke-dasharray: 152; stroke-dashoffset: 152; animation: draw .7s var(--ease) forwards; }
.check-anim path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s var(--ease) .55s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* legenda stref i linii */
.legend { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); }
.legend > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; cursor: pointer; list-style: none;
  font-size: 12px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); user-select: none;
}
.legend > summary::-webkit-details-marker { display: none; }
.legend > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s var(--ease); margin-right: 4px; }
.legend[open] > summary::after { transform: rotate(-135deg); }
.legend ul { list-style: none; margin: 0; padding: 0 12px 10px; display: grid; gap: 9px; animation: swap .3s var(--ease); }
.legend li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.legend li svg { width: 34px; height: 22px; margin-top: 1px; }
.legend li b { display: block; font-size: 13px; color: var(--text); }
.legend li span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.legend .legend-note { padding: 0 12px 11px; margin: 0; font-size: 12px; color: var(--muted); }
.legend.compact ul { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 14px; }
.legend.compact li span { font-size: 12px; }

/* ---------- tabele ---------- */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; background: rgba(255, 255, 255, .015); }
thead th:first-child { border-top-left-radius: 8px; }
thead th:last-child { border-top-right-radius: 8px; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: rgba(255, 255, 255, .025); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; color: var(--accent); }
td .actions { justify-content: flex-end; }
td.time { font: 500 12.5px var(--mono); color: var(--text-2); white-space: nowrap; }
td.heat { background: rgb(34 211 238 / calc(var(--h, 0) * .26)); }
.table-wrap { overflow-x: auto; }

/* ---------- edytor stref ---------- */
main.editor { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; padding: 14px; height: calc(100vh - var(--topbar-h)); }
.editor-main { min-width: 0; display: flex; flex-direction: column; }
.draw-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s, box-shadow .2s, background .2s;
}
.draw-bar.drawing { border-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), transparent 70%), var(--panel); box-shadow: 0 0 0 1px rgba(34, 211, 238, .25), 0 10px 30px -14px var(--accent-glow); }
.draw-info { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 550; color: var(--text); min-width: 0; }
.draw-info .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--accent); background: var(--accent-soft); }
.draw-info .ico svg { width: 16px; height: 16px; }
.draw-bar.drawing .draw-info .ico { animation: armedCyan 1.4s ease-in-out infinite; }
@keyframes armedCyan { 50% { box-shadow: 0 0 0 5px rgba(34, 211, 238, .14); } }
.draw-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.draw-actions .pts { color: var(--text-2); font-size: 13px; margin-right: 4px; }
.draw-actions .pts b { color: var(--accent); font-variant-numeric: tabular-nums; }
.keys { color: var(--muted); font-size: 12px; margin: -4px 0 10px 2px; }
kbd { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--panel-2); color: var(--text-2); }
.canvas-wrap { position: relative; background: #000; border-radius: 12px; overflow: hidden; align-self: start; width: fit-content; max-width: 100%; border: 1px solid var(--line); box-shadow: var(--shadow); }
/* cała klatka zawsze na ekranie - skala liczona w editor.js z faktycznego rozmiaru */
.canvas-wrap canvas { display: block; max-width: 100%; max-height: calc(100vh - 230px); cursor: crosshair; }
.canvas-wrap canvas.select { cursor: default; }
.canvas-wrap canvas.closing { cursor: pointer; }
.toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.toolbar .btn { justify-content: flex-start; }
.rule-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.rule-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; transition: background .15s, border-color .15s; }
.rule-list li:hover { background: var(--panel-2); }
.rule-list li.selected { background: var(--accent-soft); border-color: rgba(34, 211, 238, .35); }
.rule-list li .muted { margin-left: auto; font-size: 12px; }
.rule-list li.fx-flash { animation: ruleFlash 1.6s var(--ease); }
@keyframes ruleFlash { 0% { transform: translateX(-6px); box-shadow: 0 0 0 2px var(--accent), 0 0 24px var(--accent-glow); } 100% { transform: none; box-shadow: 0 0 0 0 transparent; } }
.classes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin-bottom: 10px; }
input[type=range] { padding: 0; border: 0; background: none; box-shadow: none; accent-color: var(--accent); height: 22px; }
.range-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; }
.range-row b { min-width: 42px; text-align: right; color: var(--accent); font-variant-numeric: tabular-nums; }
select.fps { width: auto; padding: 4px 8px; font-size: 12.5px; }
.save-bar { position: sticky; bottom: -14px; margin: 0 -14px -14px; padding: 12px 14px 14px; background: linear-gradient(180deg, rgba(13, 20, 31, .7), var(--panel) 30%); border-top: 1px solid var(--line); }
#props h2 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); margin-top: 6px; }

/* ---------- okna (modal) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(2, 5, 9, .62); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  animation: fade .2s ease both;
}
.modal-backdrop.closing { animation: fade .18s ease reverse forwards; }
.modal-backdrop.closing .modal { animation: modalOut .18s ease forwards; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 140px), var(--panel);
  border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 40px 90px -20px rgba(0, 0, 0, .75), 0 0 0 1px rgba(34, 211, 238, .06);
  animation: modalIn .32s var(--ease) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes modalOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 6px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 8px 18px 6px; }
.modal-body > p { margin-top: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.modal-foot .left { margin-right: auto; }

/* ---------- powiadomienia ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 80; pointer-events: none; }
.toast {
  pointer-events: auto; position: relative; overflow: hidden; display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 400px; padding: 11px 12px 13px 13px;
  background: rgba(18, 27, 41, .94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7);
  animation: toastIn .4s var(--ease) both;
}
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--t-c, var(--accent)); transform-origin: left; animation: toastTimer var(--ms, 4500ms) linear forwards; opacity: .8; }
.toast.error { --t-c: var(--red); border-color: rgba(255, 77, 94, .4); }
.toast.ok { --t-c: var(--green); border-color: rgba(52, 211, 153, .35); }
.toast-icon { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--t-c, var(--accent)); background: color-mix(in srgb, var(--t-c, var(--accent)) 16%, transparent); }
.toast-icon svg { width: 13px; height: 13px; }
.toast-text { flex: 1; padding-top: 1px; }
.toast-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; padding: 0 2px; }
.toast-x:hover { color: var(--text); }
.toast.leave { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px) scale(.96); } }
@keyframes toastTimer { to { transform: scaleX(0); } }

/* ---------- logowanie ---------- */
body.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; }
body.login::before { -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 10%, transparent 70%); mask-image: radial-gradient(circle at 50% 50%, #000 10%, transparent 70%); }
.radar { position: fixed; left: 50%; top: 50%; width: min(150vmax, 1500px); aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; z-index: 0; border-radius: 50%; }
.radar::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-radial-gradient(circle, transparent 0 79px, rgba(34, 211, 238, .09) 79px 80px);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%); mask-image: radial-gradient(circle, #000 20%, transparent 68%);
}
.radar .sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(34, 211, 238, .22), rgba(34, 211, 238, .06) 40deg, transparent 70deg, transparent 360deg);
  -webkit-mask-image: radial-gradient(circle, #000 15%, transparent 66%); mask-image: radial-gradient(circle, #000 15%, transparent 66%);
  animation: sweep 7s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.radar .blip { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); opacity: 0; animation: blip 7s linear infinite; }
.radar .blip::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1.5px solid var(--accent); animation: ping 2s var(--ease) infinite; }
.radar .blip.r { background: var(--red); box-shadow: 0 0 12px var(--red); }
.radar .blip.r::after { border-color: var(--red); }
@keyframes blip { 0%, 4% { opacity: 0; } 6% { opacity: 1; } 40% { opacity: .5; } 60%, 100% { opacity: 0; } }
.login-box {
  position: relative; z-index: 1; width: min(380px, 100%); padding: 30px 28px 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .01)), rgba(10, 16, 26, .78);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid rgba(148, 197, 255, .14); border-radius: 18px;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(34, 211, 238, .05), 0 0 80px -40px var(--accent-glow);
  animation: rise .7s var(--ease) both;
}
.login-brand { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 22px; }
.login-brand .logo { width: 56px; height: 56px; margin-bottom: 12px; animation: floaty 5s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-4px); } }
.login-brand h1 { margin: 0; font-size: 22px; }
.login-brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; }
.login-box .btn { width: 100%; margin-top: 8px; padding: 11px 14px; font-size: 14.5px; }
.login-box input { padding: 10px 12px; }
.login-error { display: flex; gap: 8px; align-items: center; padding: 9px 12px; margin-bottom: 14px; border-radius: 10px; background: var(--red-soft); border: 1px solid rgba(255, 77, 94, .35); color: #ffb3bc; animation: shake .45s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.login-foot { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 12px; }
pre.snippet { background: #03070d; border: 1px solid var(--line-2); border-radius: 10px; padding: 14px; overflow: auto; color: #a5f3fc; }
.note { padding: 11px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid rgba(34, 211, 238, .3); color: var(--text-2); margin-bottom: 14px; }

/* ---------- wąskie ekrany ---------- */
@media (max-width: 1100px) {
  main.dash { grid-template-columns: 1fr; grid-template-rows: none; height: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main.dash .panel { max-height: none; }
  .grid-2 { grid-template-columns: 1fr; }
  main.editor { grid-template-columns: 1fr; height: auto; }
  .canvas-wrap canvas { max-height: none; }
}
@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .brand-text small, .clock, .user-name { display: none; }
  .topbar nav a { padding: 6px 8px; }
  .topbar nav a.active::after { display: none; }
  main.page, main.dash, main.editor { padding: 10px; }
  .kpis { gap: 10px; }
  .kpi { padding: 10px 12px; gap: 10px; }
  .kpi-icon { width: 32px; height: 32px; }
  .kpi .value { font-size: 18px; }
  .tower-head { padding: 14px; }
  .tower-head h1 { font-size: 20px; }
  dl.facts { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  th, td { padding: 8px 6px; }
  .table-wrap table { min-width: 520px; }
  #toasts { left: 10px; right: 10px; bottom: 10px; }
  .toast { max-width: none; min-width: 0; }
}
@media (max-width: 420px) {
  .brand-text, .avatar { display: none; }
  .topbar nav a:nth-child(n+3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .radar .sweep, .radar .blip { display: none; }
}
