/* VigilNMS – NOC stílusú felület, sötét alapértelmezett, világos téma választható */
:root, [data-theme="dark"] {
  --bg: #0b1220; --bg2: #0f1829; --panel: #131e33; --panel2: #18253f; --line: #22314f; --line2: #2d3f63;
  --text: #dbe4f3; --muted: #8496b5; --faint: #5b6c8b;
  --accent: #38bdf8; --accent2: #0ea5e9; --accent-bg: rgba(56,189,248,.12);
  --up: #22c55e; --warn: #f59e0b; --down: #ef4444; --unr: #a78bfa; --unk: #64748b; --info: #60a5fa;
  --up-bg: rgba(34,197,94,.13); --warn-bg: rgba(245,158,11,.14); --down-bg: rgba(239,68,68,.15); --unr-bg: rgba(167,139,250,.14);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eef2f7; --bg2: #e6ebf3; --panel: #ffffff; --panel2: #f5f7fb; --line: #dde3ed; --line2: #c9d2e1;
  --text: #15233b; --muted: #5a6a85; --faint: #8b98ae;
  --accent: #0284c7; --accent2: #0369a1; --accent-bg: rgba(2,132,199,.09);
  --up: #16a34a; --warn: #d97706; --down: #dc2626; --unr: #7c3aed; --unk: #64748b; --info: #2563eb;
  --up-bg: rgba(22,163,74,.1); --warn-bg: rgba(217,119,6,.12); --down-bg: rgba(220,38,38,.1); --unr-bg: rgba(124,58,237,.1);
  --shadow: 0 10px 30px rgba(15,23,42,.12);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.hidden { display: none !important; }

/* ---------- elrendezés ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.brand .dot { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--bg) 0 28%, var(--up) 30% 100%);
  box-shadow: 0 0 14px rgba(34,197,94,.45); }
.brand small { display: block; font-weight: 500; font-size: 10.5px; color: var(--faint); letter-spacing: .08em; text-transform: uppercase; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-bg); color: var(--accent); }
.nav a svg { width: 17px; height: 17px; flex: none; }
.nav .badge { margin-left: auto; }
.nav-sep { margin: 12px 12px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); }
.side-foot { margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.side-foot button { margin-top: 6px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 500; }
.topbar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 20px 22px 40px; display: flex; flex-direction: column; gap: 16px; }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 1000; left: -240px; width: 230px; transition: left .2s; box-shadow: var(--shadow); }
  .side.open { left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 14px 12px 30px; }
  .topbar { padding: 10px 12px; }
}

/* ---------- panelek ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-h h2, .card-h h3 { flex: 1; }
.card-b { padding: 14px 16px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }

/* ---------- KPI csempék ---------- */
.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.kpi .val { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .sub { font-size: 12.5px; color: var(--muted); }
.kpi .bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 6px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; background: var(--up); }
.kpi.bad .val { color: var(--down); } .kpi.warn .val { color: var(--warn); } .kpi.good .val { color: var(--up); }
.kpi.bad { border-color: color-mix(in srgb, var(--down) 45%, var(--line)); }

/* ---------- állapot jelzők ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--unk); flex: none; }
.st.up::before { background: var(--up); box-shadow: 0 0 6px var(--up); }
.st.warning::before { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.st.down::before { background: var(--down); box-shadow: 0 0 8px var(--down); animation: pulse 1.4s infinite; }
.st.unreachable::before { background: var(--unr); }
@keyframes pulse { 50% { opacity: .35; } }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 7px;
  border-radius: 10px; font-size: 11.5px; font-weight: 600; background: var(--line); color: var(--text); }
.badge.critical, .badge.down, .badge.deny { background: var(--down-bg); color: var(--down); }
.badge.warning, .badge.watch { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--accent-bg); color: var(--info); }
.badge.ok, .badge.up, .badge.allow { background: var(--up-bg); color: var(--up); }
.badge.unreachable { background: var(--unr-bg); color: var(--unr); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sev-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--unk); flex: none; }
.sev-bar.critical { background: var(--down); } .sev-bar.warning { background: var(--warn); } .sev-bar.info { background: var(--info); }

/* ---------- táblázat ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel2); position: sticky; top: 0; white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tbl tr.click { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.5px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- űrlapok, gombok ---------- */
button, .btn { font: inherit; font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--accent); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent2); border-color: var(--accent2); color: #fff; }
button.primary:hover { background: var(--accent); }
button.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, var(--line2)); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--panel2); }
button.sm { padding: 4px 9px; font-size: 12px; }
button svg { width: 15px; height: 15px; }
input, select, textarea { font: inherit; font-size: 13px; color: var(--text); background: var(--bg2); border: 1px solid var(--line2);
  border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 0; border-color: var(--accent); }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent2); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.form label.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.form .hint { font-size: 11.5px; color: var(--faint); font-weight: 400; }
@media (max-width: 600px) { .form { grid-template-columns: 1fr; } }
.search { min-width: 220px; }

/* ---------- fülek ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: transparent; border-radius: 0; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs button:hover { color: var(--text); }

/* ---------- modal, toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(2,6,16,.6); z-index: 2000; display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 16px 16px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; width: min(720px, 100%); box-shadow: var(--shadow); }
.modal.wide { width: min(1100px, 100%); }
.modal-h { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-h h2 { flex: 1; }
.modal-b { padding: 16px 18px; max-height: calc(100vh - 200px); overflow-y: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel); border: 1px solid var(--line2); border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px;
  box-shadow: var(--shadow); max-width: 380px; animation: tin .2s; }
.toast.err { border-left-color: var(--down); } .toast.ok { border-left-color: var(--up); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---------- riasztás lista ---------- */
.alist { display: flex; flex-direction: column; }
.aitem { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.aitem:last-child { border-bottom: 0; }
.aitem .msg { flex: 1; min-width: 0; }
.aitem .msg b { font-weight: 600; }
.aitem .meta { font-size: 12px; color: var(--muted); }
.aitem.acked { opacity: .55; }

/* ---------- topológia, térkép ---------- */
.topo-wrap { position: relative; height: calc(100vh - 190px); min-height: 480px; }
#cy { position: absolute; inset: 0; }
.topo-legend { position: absolute; left: 12px; bottom: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; z-index: 5; }
.topo-legend span { display: inline-flex; align-items: center; gap: 6px; }
.topo-legend i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.topo-side { position: absolute; right: 12px; top: 12px; width: 300px; max-height: calc(100% - 24px); overflow-y: auto; z-index: 5; }
.map-wrap { height: calc(100vh - 190px); min-height: 480px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.leaflet-container { background: var(--bg2); font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); border: 1px solid var(--line2); }
.leaflet-popup-content { margin: 10px 12px; min-width: 220px; }
.cam-marker { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.5); }
.dev-marker { width: 16px; height: 16px; border-radius: 4px; border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.5); }
.snap { width: 100%; border-radius: 8px; display: block; background: #000; min-height: 60px; }

/* ---------- részletek ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.chart-box { position: relative; height: 220px; }
.diff { font-family: var(--mono); font-size: 12px; white-space: pre; overflow: auto; max-height: 60vh; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 0; }
.diff div { padding: 0 12px; }
.diff .add { background: rgba(34,197,94,.14); color: var(--up); } .diff .del { background: rgba(239,68,68,.14); color: var(--down); }
.diff .hunk { color: var(--accent); background: var(--accent-bg); }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--up); }
.meter.warn i { background: var(--warn); } .meter.bad i { background: var(--down); }
.plate { display: inline-block; font-family: var(--mono); font-weight: 700; font-size: 13px; letter-spacing: .06em; padding: 2px 8px;
  border: 2px solid #1e293b; border-radius: 4px; background: #f8fafc; color: #0f172a; white-space: nowrap; }
.plate::before { content: "H"; display: inline-block; background: #1d4ed8; color: #fde047; font-size: 9px; padding: 0 3px; margin-right: 6px; border-radius: 2px; vertical-align: 1px; }
.lpr-thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 6px; background: var(--bg2); display: block; }

/* ---------- belépés ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1000px 500px at 20% 10%, rgba(56,189,248,.12), transparent 60%), radial-gradient(800px 400px at 90% 90%, rgba(34,197,94,.08), transparent 60%), var(--bg); }
.login .card { width: min(380px, 100%); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.login .brand { padding: 0 0 6px; font-size: 20px; }
.login label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.spin { width: 16px; height: 16px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { padding: 40px; display: flex; justify-content: center; }

/* ---------- terminál ---------- */
.term-card { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; overflow: hidden; }
.term { flex: 1; overflow: auto; background: #05080f; color: #cfe3d4; font-family: var(--mono); font-size: 13px; line-height: 1.45;
  padding: 12px 14px; white-space: pre-wrap; word-break: break-word; }
.term .cmdline { color: #7dd3fc; font-weight: 600; } .term .err { color: #fca5a5; } .term .muted { color: #64748b; }
.term-in { display: flex; align-items: center; gap: 8px; background: #05080f; border-top: 1px solid #1e293b; padding: 8px 14px; }
.term-in .prompt { color: #4ade80; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.term-in input { flex: 1; background: transparent; border: 0; color: #e2e8f0; font-family: var(--mono); font-size: 13px; padding: 4px 0; }
.term-in input:focus { outline: none; }

/* ---------- helyi menü ---------- */
.ctx-menu { position: fixed; z-index: 4000; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px;
  box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; min-width: 220px; }
.ctx-menu button { border: 0; background: transparent; justify-content: flex-start; padding: 8px 10px; border-radius: 6px; font-weight: 400; }
.ctx-menu button:hover { background: var(--accent-bg); color: var(--accent); }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sorted { color: var(--accent); }

/* videó beállítások */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; }
.vgrid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted, #888); }
.vgrid label select, .vgrid label input { width: 100%; }
.vcard .card-h { padding: 10px 14px; }
.modal-b > p { white-space: pre-line; }

/* ---------- topológia térkép (Dude-stílus) ---------- */
.dmap { position: relative; height: calc(100vh - 150px); min-height: 480px; display: flex; flex-direction: column; overflow: hidden; }
.dmap-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.dmap-bar button { padding: 5px 10px; font-size: 13px; }
.dmap-bar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.dmap-opt { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.dmap-opt label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.dmap-canvas { position: relative !important; inset: auto !important; flex: 1; min-height: 0;
  background-color: #fbfbfb;
  background-image: linear-gradient(#ececec 1px, transparent 1px), linear-gradient(90deg, #ececec 1px, transparent 1px);
  background-size: 24px 24px; }
.dmap.dark .dmap-canvas { background-color: #141a23; background-image: linear-gradient(#1d2531 1px, transparent 1px), linear-gradient(90deg, #1d2531 1px, transparent 1px); }
.dmap-legend { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: #333;
  background: rgba(255,255,255,.92); border: 1px solid #c9c9c9; border-radius: 6px; padding: 5px 9px; pointer-events: none; }
.dmap.dark .dmap-legend { background: rgba(20,26,35,.9); color: #cdd6e3; border-color: #2a3442; }
.dmap-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dmap-legend i { width: 14px; height: 10px; border: 1px solid #555; border-radius: 2px; display: inline-block; }
.dmap-tip { position: absolute; z-index: 20; max-width: 290px; pointer-events: none; font-size: 12px; line-height: 1.45;
  background: #fffbe6; color: #1d2329; border: 1px solid #b9a95c; border-radius: 4px; padding: 7px 9px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.dmap-tip .faint { color: #6b7280; } .dmap-tip .st { color: #1d2329; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.ctx-menu button.danger { color: var(--down); }
.dtabs { margin: -4px 0 12px; }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.icon-pick button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; font-size: 11px; font-weight: 400; min-height: 86px; justify-content: center; }
.icon-pick img { width: 44px; height: 44px; }
.icon-pick button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); color: var(--accent); }
.icon-pick b { font-size: 15px; }
@media (max-width: 700px) { .dmap-opt { display: none; } .dmap { height: calc(100vh - 120px); } }

/* ---------- térkép: kamera panel, élőkép, PTZ ---------- */
.map-layout { display: flex; gap: 12px; align-items: stretch; }
.map-layout .map-wrap { flex: 1; min-width: 0; }
.map-side { width: 380px; flex: none; max-height: calc(100vh - 190px); overflow: auto; }
.cam-view { position: relative; background: #000; border-radius: 8px; aspect-ratio: 16 / 9; overflow: hidden; cursor: pointer; }
.cam-live { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: #cfd8e3; font-size: 14px; text-align: center; padding: 10px; }
.ptz { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.ptz-pad { display: grid; grid-template-columns: repeat(3, 42px); gap: 4px; }
.ptz-pad button { width: 42px; height: 38px; padding: 0; justify-content: center; font-size: 16px; touch-action: none; user-select: none; }
.ptz-pad button:active, .ptz-side [data-z]:active { background: var(--accent); color: #fff; }
.ptz-side { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 150px; }
.ptz-side [data-z] { touch-action: none; user-select: none; }
.ptz-side input[type=range] { width: 100%; }
.ptz-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.ptz-presets button { justify-content: center; padding: 4px 0; }
.aim { display: grid; gap: 6px; }
.aim label { display: grid; grid-template-columns: 90px 52px 1fr; align-items: center; font-size: 12.5px; gap: 6px; }
.aim-handle { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #1f5fbf; box-shadow: 0 1px 5px rgba(0,0,0,.45); cursor: grab; }
.cam-marker.sel { outline: 3px solid #1f5fbf; outline-offset: 2px; }
@media (max-width: 900px) { .map-layout { flex-direction: column; } .map-side { width: auto; max-height: none; } }

/* térkép csoportosítás */
.clu { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; position: relative; cursor: pointer; }
.clu b { text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.clu i { position: absolute; top: -6px; right: -6px; background: #dc2626; color: #fff; border: 2px solid #fff; border-radius: 9px;
  font-style: normal; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; line-height: 14px; text-align: center; padding: 0 3px; }

/* eszköz lista */
tr.last-open td { background: var(--accent-bg) !important; transition: background 2s; }
.map-pin { text-decoration: none; font-size: 13px; }

/* dokumentáció */
.note-form { display: grid; gap: 6px; margin-bottom: 12px; }
.note-form textarea { width: 100%; }
.timeline { display: grid; gap: 8px; }
.tl-item { border-left: 3px solid var(--line2); padding: 6px 10px; background: var(--panel2, rgba(127,127,127,.06)); border-radius: 0 8px 8px 0; }
.tl-item.k-install { border-color: #0ea5e9; } .tl-item.k-fault { border-color: var(--down); } .tl-item.k-fix { border-color: var(--up); }
.tl-h { display: flex; gap: 8px; align-items: center; } .tl-h .ghost { margin-left: auto; }
.tl-b { margin-top: 4px; font-size: 13.5px; white-space: normal; }
.upl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.photo-grid figure { margin: 0; position: relative; cursor: pointer; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); }
.photo-grid img { width: 100%; height: 120px; object-fit: cover; display: block; }
.photo-grid figcaption { font-size: 12px; padding: 5px 7px; line-height: 1.3; }
.photo-grid .del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.55); color: #fff; padding: 2px 7px; }
.file-ico { height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 34px; gap: 4px; }
.file-ico span { font-size: 11px; padding: 0 6px; text-align: center; word-break: break-all; }
.viewer img { width: 100%; max-height: 70vh; object-fit: contain; background: #000; border-radius: 8px; }

/* munkalap */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 6px 12px; }
.seg button.on { background: var(--accent); color: #fff; }
.wo-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.wo-row:hover { background: var(--accent-bg); }
.wo-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wo-meta { text-align: right; }
.wo-st { display: inline-block; padding: 3px 10px; border-radius: 999px; color: #fff; font-size: 12px; font-weight: 600; text-align: center; }
.st-open { background: #f59e0b; } .st-in_progress { background: #3b82f6; } .st-done { background: #16a34a; } .st-closed { background: #64748b; }
.prio { border-radius: 6px; padding: 1px 6px; color: #fff; font-size: 11px; margin-right: 4px; }
.p-high { background: #f97316; } .p-urgent { background: #dc2626; } .p-low { background: #64748b; }
.wo { max-width: 980px; margin: 0 auto; padding-bottom: 80px; }
.wo-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 16px; }
.wo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; }
.wo-grid label, .wo label.blk { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.wo-grid label.full { grid-column: 1 / -1; }
.wo label.blk { margin-top: 10px; }
.wo textarea, .wo input, .wo select { width: 100%; font-size: 15px; }
.wo .row.tight input { flex: 1; }
.wo .card-h h3 { font-size: 15px; padding-left: 9px; border-left: 4px solid var(--accent); }
.h-red { border-color: #dc2626 !important; } .h-blue { border-color: #2563eb !important; } .h-violet { border-color: #7c3aed !important; }
.h-orange { border-color: #ea580c !important; } .h-teal { border-color: #0e7490 !important; }
.rows { display: grid; gap: 8px; }
.mrow { display: grid; grid-template-columns: 1fr 90px 100px 1fr 36px; gap: 6px; }
.nrow { display: grid; grid-template-columns: 1fr 1fr 120px 150px 36px; gap: 6px; }
.sig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sig-box { border: 1px dashed var(--line2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sig-box img { max-height: 80px; max-width: 100%; background: #fff; border-radius: 6px; padding: 4px; }
.sig-empty { height: 60px; display: flex; align-items: center; color: var(--faint); font-size: 13px; }
.sig-pad { position: relative; background: #fff; border-radius: 10px; border: 2px dashed #94a3b8; margin-top: 10px; }
.sig-pad canvas { width: 100%; height: 260px; display: block; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #94a3b8; pointer-events: none; font-size: 18px; }
.wo-bar { position: sticky; bottom: 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -4px 16px rgba(0,0,0,.18); z-index: 10; }
@media (max-width: 700px) {
  .wo-row { grid-template-columns: 1fr; gap: 4px; } .wo-meta { text-align: left; }
  .mrow { grid-template-columns: 1fr 70px 80px 36px; } .mrow [data-k="note"] { grid-column: 1 / -1; grid-row: 2; }
  .nrow { grid-template-columns: 1fr 1fr 36px; } .nrow [data-k="method"], .nrow [data-k="at"] { grid-row: 2; }
  .sig-row { grid-template-columns: 1fr; }
  .wo-bar button, .wo-bar .btn { flex: 1; }
}
.tbl tr.grp td { background: var(--bg2, rgba(127,127,127,.08)); padding-top: 10px; }
.small.err, .login .err { color: var(--down); }
.login a { color: var(--accent, #38bdf8); }
.perm-grid { display: grid; grid-template-columns: 1fr repeat(3, auto); gap: 4px 14px; align-items: center; font-size: 13px; }
.perm-grid .h { font-weight: 600; color: var(--muted, #8a94a6); font-size: 12px; }
.perm-grid label { display: flex; justify-content: center; margin: 0; }
.perm-grid.disabled { opacity: .45; pointer-events: none; }
/* hibajegyek */
.tk-new { background: #8b5cf6; } .tk-open { background: #f59e0b; } .tk-in_progress { background: #3b82f6; }
.tk-waiting { background: #a16207; } .tk-resolved { background: #16a34a; } .tk-closed { background: #64748b; }
.tk-overdue { color: var(--down); font-weight: 600; }
.tk-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .tk-grid { grid-template-columns: 1fr; } }
.tk-hist { display: flex; flex-direction: column; gap: 8px; }
.tk-ev { font-size: 12.5px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--line2); }
.tk-c { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; max-width: 92%; }
.tk-c.mine { align-self: flex-end; background: var(--accent-bg); }
.tk-c.internal { border-style: dashed; border-color: #d97706; background: rgba(217, 119, 6, .08); }
.tk-cust { margin-top: 14px; padding: 12px; border-radius: 10px; background: rgba(22, 163, 74, .1); border: 1px solid rgba(22, 163, 74, .4); }
.form.one { grid-template-columns: 1fr; }
.tk-grid > div > .card { margin-bottom: 16px; }
