:root {
  --bg: #0d1117; --panel: #151b23; --panel2: #1c2430; --line: #2a3442;
  --text: #dce3ea; --muted: #8592a3; --accent: #4fb3ff;
  --ok: #3fb950; --watch: #e3b341; --suspicious: #f85149; --trusted: #8b949e;
  --mono: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
header { display: flex; align-items: center; gap: 14px; padding: 8px 16px; height: 52px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; }
.brand { font-weight: 700; letter-spacing: .3px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--ok); animation: pulse 1.4s infinite; }
.dot.alarm { background: var(--suspicious); animation: pulse .7s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; opacity: 1 } 70% { opacity: .5 } 100% { opacity: 1 } }
.stat { color: var(--muted); white-space: nowrap; font-size: 13px; }
.stat b { color: var(--text); font-weight: 600; }
.spacer { flex: 1; }
.counts { display: flex; gap: 6px; }
.pill { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid currentColor; }
.pill.ok { color: var(--ok); } .pill.watch { color: var(--watch); }
.pill.suspicious { color: var(--suspicious); } .pill.trusted { color: var(--trusted); }
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.active { background: var(--accent); color: #001; border-color: var(--accent); }
.btn.danger { border-color: var(--suspicious); color: var(--suspicious); }

main { display: grid; grid-template-columns: minmax(0, 1fr) 540px; height: calc(100% - 52px); }
#mapwrap { position: relative; }
#map { position: absolute; inset: 0; background: #0b0f14; }
.maptools { position: absolute; top: 10px; right: 10px; z-index: 500; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 60px); }
.legend { position: absolute; bottom: 10px; left: 10px; z-index: 500; background: rgba(21,27,35,.92);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px;
  display: flex; gap: 10px; flex-wrap: wrap; max-width: calc(100% - 20px); }
.legend .hint { color: var(--muted); }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.lg.tmobile { background: #E20074 } .lg.o2 { background: #0050C8 } .lg.vodafone { background: #E60000 } .lg.other { background: #2ea043 }
.lg.ring { background: transparent; box-shadow: inset 0 0 0 2.5px currentColor; }
.lg.ok { background: var(--ok) } .lg.watch { background: var(--watch) }
.lg.suspicious { background: var(--suspicious) } .lg.trusted { background: var(--trusted) }

aside { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 10px; cursor: pointer; font: inherit;
  border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs b { font-weight: 600; margin-left: 4px; }
.badge.hot { background: var(--suspicious); color: #fff; padding: 0 6px; border-radius: 9px; }
.tab { overflow: auto; flex: 1; min-height: 0; }
.hidden { display: none !important; }
.toolbar { display: flex; gap: 6px; padding: 8px; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.toolbar input, .toolbar select { flex: 1; background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; font: inherit; }
.toolbar select { flex: 0 0 auto; }

table.cells { width: 100%; border-collapse: collapse; font-size: 13px; }
table.cells th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--line);
  position: sticky; top: 48px; background: var(--panel); }
#tab-scans table.cells th { top: 0; }
table.cells td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.cells td.num { font-family: var(--mono); text-align: right; }
table.cells tbody tr { cursor: pointer; }
table.cells tbody tr:hover { background: var(--panel2); }
tr.sel { background: #1f2d3d !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.pad { padding: 8px 12px; }

ul.alerts { list-style: none; margin: 0; padding: 0; }
ul.alerts li { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; border-left: 3px solid transparent; }
ul.alerts li.high { border-left-color: var(--suspicious); }
ul.alerts li.medium { border-left-color: var(--watch); }
ul.alerts li.low, ul.alerts li.info { border-left-color: var(--muted); }
ul.alerts li.acked { opacity: .5; }
ul.alerts .meta { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }

.drawer { position: fixed; right: 550px; top: 62px; width: 440px; max-height: calc(100% - 72px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; z-index: 1000;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.drawer .close { position: absolute; top: 6px; right: 10px; background: none; border: 0; color: var(--muted);
  font-size: 22px; cursor: pointer; }
.drawer h2 { margin: 0 0 4px; font-size: 18px; }
.drawer h3 { margin: 16px 0 6px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); }
.finding { padding: 6px 8px; border-radius: 6px; background: var(--panel2); margin-bottom: 5px; font-size: 13px;
  border-left: 3px solid var(--muted); }
.finding.high { border-left-color: var(--suspicious); } .finding.medium { border-left-color: var(--watch); }
.finding code { color: var(--muted); font-size: 11px; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
canvas.chart { width: 100%; height: 110px; background: var(--panel2); border-radius: 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tags span { font-family: var(--mono); font-size: 12px; background: var(--panel2); padding: 1px 6px; border-radius: 4px; }

.maplibregl-map { font: inherit; }
.maplibregl-popup.tip .maplibregl-popup-content { background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.maplibregl-popup.tip .maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-group { background: var(--panel) !important; border: 1px solid var(--line); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(.85); }
.maplibregl-ctrl-attrib { background: rgba(21,27,35,.85) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-scale { background: rgba(21,27,35,.8); color: var(--text); border-color: var(--muted); }
.mapnotice { position: absolute; top: 52px; right: 10px; z-index: 500; background: rgba(21,27,35,.92); color: var(--watch);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
select.btn { appearance: auto; }
.me-marker { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(79,179,255,.25); }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; height: auto; min-height: calc(100% - 52px); }
  aside { border-left: 0; border-top: 1px solid var(--line); }
  .drawer { right: 8px; left: 8px; width: auto; top: 60px; }
  .legend .hint { display: none; }
}

/* filtr s křížkem */
.search { position: relative; flex: 1; display: flex; }
.search input { flex: 1; padding-right: 30px !important; }
.search .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px;
  border: 0; border-radius: 50%; background: var(--line); color: var(--text); font-size: 16px; line-height: 24px;
  cursor: pointer; padding: 0; }
.search .clear:hover { background: var(--accent); color: #001; }

/* nápověda */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 2000; display: flex; align-items: flex-start;
  justify-content: center; padding: 60px 16px 16px; overflow: auto; }
.modal-box { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  max-width: 820px; width: 100%; padding: 20px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal-box .close { position: absolute; top: 8px; right: 12px; background: none; border: 0; color: var(--muted);
  font-size: 24px; cursor: pointer; }
.modal-box h2 { margin: 0 0 6px; font-size: 20px; }
.modal-box h3 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.modal-box p { margin: 6px 0; color: var(--text); }
.scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.scale div { background: var(--panel2); border-radius: 8px; padding: 8px 10px; font-size: 13px; border-top: 3px solid; }
.scale b { display: block; margin-bottom: 2px; }
table.rules { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rules td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.rules td:first-child { white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.sev { display: inline-block; min-width: 56px; text-align: center; border-radius: 999px; padding: 1px 8px; font-size: 12px;
  font-weight: 600; border: 1px solid currentColor; white-space: nowrap; }
.sev.high { color: var(--suspicious); } .sev.medium { color: var(--watch); } .sev.low, .sev.info { color: var(--muted); }
@media (max-width: 700px) { .scale { grid-template-columns: 1fr 1fr; } }

/* odhad polohy */
.estimate-box { position: absolute; bottom: 78px; left: 50%; transform: translateX(-50%); z-index: 600;
  background: rgba(21,27,35,.96); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px;
  font-size: 13px; max-width: min(460px, calc(100% - 32px)); box-shadow: 0 8px 30px rgba(0,0,0,.45); }
.estimate-box .row { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; flex-wrap: wrap; }
.estimate-box .btn.primary { background: var(--accent); color: #001; border-color: var(--accent); }

/* právě běžící sken */
tr.live td { background: rgba(79,179,255,.07); }
tr.live.idle td { background: transparent; }
.livedot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  margin-right: 6px; animation: pulse 1.2s infinite; vertical-align: 0; }
.bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
