/* mon — vzhled podle MikroTik The Dude. Okolí: šedé lišty, bílé seznamy, modrý výběr.
   Mapa má vlastní téma (data-theme na .map-pane): tmavé jako Dude 3.5, nebo světlé klasické. */
:root {
  --bg: #d9dde3;          /* plocha okna */
  --chrome: #e8ebef;      /* lišty, hlavičky */
  --chrome-2: #f3f5f7;
  --panel: #ffffff;       /* seznamy, formuláře */
  --panel-2: #f4f6f9;
  --ink: #111820;
  --ink-2: #39424d;
  --muted: #69737e; --warn-ink: #b45309;
  --line: #c3c9d1;
  --line-2: #a5adb8;
  --sel: #2f6fb8;         /* výběr jako ve Windows/Dude */
  --sel-ink: #ffffff;
  --sel-soft: #dbe7f6;
  --accent: #2f6fb8;
  --accent-ink: #ffffff;
  --up: #1f8a3c;
  --partial: #c77800;
  --down: #c8261d;
  --acked: #7a4bc0;
  --unknown: #8a939c;
  --win-head: linear-gradient(#4b82c3, #2f63a3);
  --win-head-ink: #ffffff;
  --win-head-off: linear-gradient(#a7b3c2, #8d9aab);
  --shadow: 0 2px 4px rgba(10, 20, 30, .18), 0 10px 28px rgba(10, 20, 30, .22);
  --ui: Tahoma, Verdana, "Segoe UI", "DejaVu Sans", system-ui, sans-serif;
  --mono: "Lucida Console", Consolas, "DejaVu Sans Mono", ui-monospace, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181c; --chrome: #23272d; --chrome-2: #2b3037; --panel: #1b1f24; --panel-2: #22272d;
    --ink: #e4e8ec; --ink-2: #bcc4cc; --muted: #8b949e; --line: #353c44; --line-2: #4a525c; --warn-ink: #f0a540;
    --sel: #3b7dd0; --sel-ink: #ffffff; --sel-soft: #1f3550; --accent: #5b9be6; --accent-ink: #0b1420;
    --up: #45c06a; --partial: #f0a030; --down: #ff5a4f; --acked: #b28cf0; --unknown: #8b949e;
    --win-head: linear-gradient(#35619a, #234a7c); --win-head-ink: #ffffff; --win-head-off: linear-gradient(#3a414a, #2e343b);
    --shadow: 0 2px 4px rgba(0, 0, 0, .5), 0 12px 30px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15181c; --chrome: #23272d; --chrome-2: #2b3037; --panel: #1b1f24; --panel-2: #22272d;
  --ink: #e4e8ec; --ink-2: #bcc4cc; --muted: #8b949e; --line: #353c44; --line-2: #4a525c; --warn-ink: #f0a540;
  --sel: #3b7dd0; --sel-ink: #ffffff; --sel-soft: #1f3550; --accent: #5b9be6; --accent-ink: #0b1420;
  --up: #45c06a; --partial: #f0a030; --down: #ff5a4f; --acked: #b28cf0; --unknown: #8b949e;
  --win-head: linear-gradient(#35619a, #234a7c); --win-head-ink: #ffffff; --win-head-off: linear-gradient(#3a414a, #2e343b);
  --shadow: 0 2px 4px rgba(0, 0, 0, .5), 0 12px 30px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 12px/1.35 var(--ui); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
code, kbd, pre { font-family: var(--mono); font-size: 11.5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.muted { color: var(--muted); }
.warn-text { color: var(--warn-ink); font-weight: 600; }
.lv tr.sel .warn-text { color: inherit; }
.warn { color: var(--partial); font-weight: bold; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ic { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
#app { height: 100%; }

/* ---------- stavové barvy ---------- */
.st-up { color: var(--up); } .st-partial { color: var(--partial); } .st-down { color: var(--down); }
.st-acked { color: var(--acked); } .st-unknown, .st-disabled { color: var(--unknown); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--unknown); border: 1px solid rgba(0, 0, 0, .25); }
.dot.st-up { background: var(--up); } .dot.st-partial { background: var(--partial); } .dot.st-down { background: var(--down); } .dot.st-acked { background: var(--acked); }
.pill { display: inline-block; padding: 0 6px; border-radius: 2px; font-size: 11px; line-height: 16px; white-space: nowrap; color: #fff; background: var(--unknown); }
.pill.st-up { background: var(--up); } .pill.st-partial { background: var(--partial); } .pill.st-down { background: var(--down); } .pill.st-acked { background: var(--acked); }

/* ---------- tlačítka, pole ---------- */
.btn { border: 1px solid var(--line-2); background: linear-gradient(var(--chrome-2), var(--chrome)); color: var(--ink); border-radius: 2px; padding: 0 12px; min-height: 24px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.btn:hover { border-color: var(--sel); }
.btn:active { background: var(--chrome); }
.btn.primary { font-weight: bold; border-color: var(--sel); box-shadow: inset 0 0 0 1px var(--sel-soft); }
.btn.danger { color: var(--down); }
.btn.small { min-height: 20px; padding: 0 7px; font-size: 11px; }
.btn.busy { opacity: .6; cursor: progress; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=time], input:not([type]), select, textarea {
  height: 22px; border: 1px solid var(--line-2); border-radius: 0; background: var(--panel); padding: 0 4px; width: 100%; min-width: 0; }
textarea { height: auto; padding: 3px 4px; resize: vertical; font-family: var(--mono); font-size: 11.5px; }
select { padding: 0 2px; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--sel); outline-offset: 0; border-color: var(--sel); }
input[type=checkbox] { margin: 0; width: 13px; height: 13px; accent-color: var(--sel); }

/* ---------- přihlášení ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(1200px 600px at 15% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--bg); }
.login-box { width: 100%; max-width: 360px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 18px; padding: 28px 26px 24px; display: grid; gap: 14px;
  box-shadow: 0 1px 2px rgba(10, 20, 30, .06), 0 18px 48px -12px rgba(10, 20, 30, .28); font: 14px/1.4 system-ui, "Segoe UI", Roboto, "DejaVu Sans", sans-serif;
  animation: login-in .35s ease-out both; }
@keyframes login-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .login-box { animation: none; } }
.login-logo { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.login-logo img { width: 44px; height: 44px; padding: 6px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.login-logo b { display: block; font-size: 22px; letter-spacing: -.01em; line-height: 1.1; }
.login-logo small { color: var(--muted); font-size: 13px; }
.login-box .f { gap: 6px; }
.login-box .f > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.login-box input[type=text], .login-box input[type=password] { height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--panel-2); font-size: 15px; transition: border-color .15s, box-shadow .15s, background .15s; }
.login-box input:focus { outline: none; background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.login-err { margin: 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--down) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--down) 55%, transparent); color: var(--ink); font-size: 13px; }
.login-box .btn { min-height: 44px; border-radius: 10px; font-size: 15px; }
.login-box .btn.primary { margin-top: 4px; background: var(--accent); color: var(--accent-ink); border: 0; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); transition: filter .15s, transform .05s; }
.login-box .btn.primary:hover { filter: brightness(1.08); }
.login-box .btn.primary:active { transform: translateY(1px); }
.login-box .btn.primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- hlavní okno ---------- */
.shell { height: 100%; display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); }
.topbar { display: flex; align-items: center; gap: 2px; padding: 2px 4px; background: linear-gradient(var(--chrome-2), var(--chrome)); border-bottom: 1px solid var(--line-2); min-width: 0; }
.tb-btn { border: 1px solid transparent; background: none; height: 26px; padding: 0 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; color: var(--ink); border-radius: 2px; }
.tb-btn:hover { border-color: var(--line-2); background: var(--panel); }
.srv { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; height: 26px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); white-space: nowrap; min-width: 0; }
.srv-name { overflow: hidden; text-overflow: ellipsis; }
.srv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--down); flex: none; }
.srv-dot.ok { background: var(--up); }
.tb-fill { flex: 1; }
.body { display: flex; min-height: 0; }
.side { width: 210px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line-2); min-height: 0; }
body.side-closed .side { display: none; }
.side-h { padding: 3px 6px; background: var(--chrome); border-bottom: 1px solid var(--line); font-weight: bold; display: flex; align-items: center; justify-content: space-between; }
.side-x, .side-scrim { display: none; }
.tree { overflow: auto; flex: 1; padding: 2px 0; }
.tn { display: flex; align-items: center; gap: 4px; padding: 1px 6px 1px 4px; cursor: pointer; white-space: nowrap; min-height: 19px; user-select: none; }
.tn:hover { background: var(--sel-soft); }
.tn.on { background: var(--sel); color: var(--sel-ink); }
.tn-l { overflow: hidden; text-overflow: ellipsis; }
.tw { width: 13px; height: 13px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); padding: 0; cursor: pointer; flex: none; font-size: 10px; line-height: 11px; display: grid; place-items: center; }
.tw::before { content: "+"; }
.tw.open::before { content: "−"; }
.tw.none { border: 0; background: none; cursor: default; }
.tw.none::before { content: ""; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.tabstrip { display: flex; gap: 1px; padding: 3px 3px 0; background: var(--chrome); border-bottom: 1px solid var(--line-2); overflow-x: auto; scrollbar-width: thin; flex: none; }
.topbar .tabstrip { flex: 1 1 auto; min-width: 0; background: none; border-bottom: 0; align-self: center; align-items: center; gap: 4px; padding: 0; margin-left: 18px; }   /* karty v horní liště vedle Nápovědy, odsazené */
.topbar .stab { height: 26px; border-bottom: 1px solid var(--line-2); border-radius: 3px; margin-bottom: 0; }   /* stejná výška jako tlačítka v liště */
.topbar .stab.on { border-color: var(--sel); }
.stab { display: flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border: 1px solid var(--line-2); border-bottom: 0; background: var(--chrome-2); cursor: pointer; white-space: nowrap; max-width: 220px; margin-bottom: -1px; border-radius: 3px 3px 0 0; }
.stab.on { background: var(--panel); font-weight: bold; position: relative; }
.stab-t { overflow: hidden; text-overflow: ellipsis; }
.tab-x { border: 0; background: none; cursor: pointer; width: 18px; height: 18px; padding: 0; color: var(--muted); font-size: 14px; line-height: 1; border-radius: 2px; }
.tab-x:hover { background: var(--down); color: #fff; }
.stage { flex: 1; min-height: 0; position: relative; background: var(--panel); display: flex; }
.stage > * { flex: 1; min-width: 0; }
.statusbar { display: flex; align-items: center; gap: 0; background: var(--chrome); border-top: 1px solid var(--line-2); min-width: 0; overflow: hidden; white-space: nowrap; }
.statusbar > span { padding: 2px 8px; border-right: 1px solid var(--line); }
.statusbar > .tb-fill { border: 0; }
.sb-conn { color: var(--down); font-weight: bold; }
.sb-conn.ok { color: var(--up); }
.sb-conn.bad { color: var(--down); }
.sb-devs { display: flex; gap: 10px; border-right: 0 !important; }
.pane-empty { display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center; padding: 30px 16px; color: var(--ink-2); }
.pane-empty p { margin: 0 0 4px; max-width: 460px; }
.loading { padding: 20px; color: var(--muted); }

/* ---------- panely se seznamy ---------- */
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; height: 100%; }
.toolbar { display: flex; align-items: center; gap: 1px; padding: 2px 3px; background: var(--chrome); border-bottom: 1px solid var(--line); flex-wrap: wrap; min-width: 0; flex: none; }
.toolbar .tb { border: 1px solid transparent; background: none; height: 24px; min-width: 24px; padding: 0 5px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; border-radius: 2px; color: var(--ink); }
.toolbar .tb:hover { border-color: var(--line-2); background: var(--panel); }
.toolbar .tb.on { border-color: var(--sel); background: var(--sel-soft); }
.toolbar .tb .ic { width: 15px; height: 15px; }
.tb-sep { width: 1px; align-self: stretch; background: var(--line-2); margin: 2px 3px; }
.tb-lbl { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px; white-space: nowrap; }
.tb-lbl select { width: auto; }
.tb-note { color: var(--muted); padding: 0 6px; }
.lv-search { width: 160px !important; }
.lv-wrap { flex: 1; overflow: auto; min-height: 0; background: var(--panel); outline: none; }
.lv { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lv th { position: sticky; top: 0; z-index: 1; text-align: left; font-weight: normal; padding: 2px 6px; background: linear-gradient(var(--chrome-2), var(--chrome)); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-2); white-space: nowrap; cursor: pointer; user-select: none; }
.lv th.asc::after { content: " ▲"; font-size: 8px; } .lv th.desc::after { content: " ▼"; font-size: 8px; }
.lv td { padding: 1px 6px; border-bottom: 1px solid color-mix(in srgb, var(--line) 50%, transparent); white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; height: 19px; }
/* dlouhé zprávy (logy, výsledek restartu PoE) se zalamují celé — jinak by konec nešel přečíst */
.lv td.td-wrap { white-space: normal; max-width: none; height: auto; overflow-wrap: anywhere; }
.lv tbody tr { cursor: default; }
.lv tbody tr:hover td { background: color-mix(in srgb, var(--sel-soft) 55%, transparent); }
.lv tr.sel td { background: var(--sel) !important; color: var(--sel-ink); }
.lv tr.sel .muted { color: inherit; }
.lv tr.lv-empty td { white-space: normal; padding: 18px 10px; color: var(--muted); text-align: center; background: none !important; }
.lv tr.row-down td, .lv tr.st-row-down td { color: var(--down); }
.lv tr.st-row-partial td, .lv tr.row-warn td { color: var(--partial); }
.lv tr.st-row-acked td { color: var(--acked); }
.lv tr.st-row-disabled td, .lv tr.row-gone td, .lv tr.row-builtin td { color: var(--muted); }
.lv tr.row-up td { color: var(--up); }
.lv tr.sel.row-down td, .lv tr.sel[class*="st-row"] td { color: var(--sel-ink); }
.pane-foot { display: flex; align-items: center; gap: 8px; padding: 1px 6px; background: var(--chrome); border-top: 1px solid var(--line); color: var(--ink-2); flex: none; min-height: 20px; }
.lv-count { flex: 1; }
.pane-msg, .pane-note { padding: 5px 8px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pane-msg { background: color-mix(in srgb, var(--down) 12%, var(--panel)); }
.pane-note { background: var(--panel-2); color: var(--ink-2); }
.tabpane { display: flex; flex-direction: column; min-height: 0; height: 100%; }

/* ---------- okna ---------- */
#windows { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.win { position: fixed; pointer-events: auto; display: flex; flex-direction: column; background: var(--chrome); border: 1px solid var(--line-2); box-shadow: var(--shadow); max-height: calc(100vh - 16px); min-width: 260px; max-width: calc(100vw - 8px); }
.win-head { display: flex; align-items: center; gap: 6px; padding: 0 2px 0 8px; height: 24px; background: var(--win-head-off); color: var(--win-head-ink); cursor: move; user-select: none; flex: none; touch-action: none; }
.win.active .win-head { background: var(--win-head); }
.win-title { flex: 1; font-weight: bold; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-x { width: 20px; height: 18px; border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .15); color: inherit; cursor: pointer; padding: 0; line-height: 14px; font-size: 14px; border-radius: 2px; }
.win-x:hover { background: #d23a33; border-color: #d23a33; }
.win-max { font-size: 12px; }
.win-max:hover { background: rgba(255, 255, 255, .35); border-color: rgba(255, 255, 255, .7); }
.win-grip { position: absolute; z-index: 2; touch-action: none; }
.win-grip-e { top: 24px; right: -4px; bottom: 10px; width: 8px; cursor: ew-resize; }
.win-grip-s { left: 0; right: 10px; bottom: -4px; height: 8px; cursor: ns-resize; }
.win-grip-se { right: -4px; bottom: -4px; width: 16px; height: 16px; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 55%, var(--line-2) 55% 62%, transparent 62% 72%, var(--line-2) 72% 79%, transparent 79%) right 4px bottom 4px / 12px 12px no-repeat; }
.win.max .win-grip { display: none; }
.win-main { display: flex; flex: 1; min-height: 0; }
.win-content { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.win-body { flex: 1; overflow: auto; min-height: 0; padding: 8px; display: flex; flex-direction: column; }
.win-body > .pane, .win-body > .dev, .win-body > .tool, .win-body > .tabbox { flex: 1; min-height: 0; }
.win-side { display: flex; flex-direction: column; gap: 4px; padding: 8px 8px 8px 0; width: 118px; flex: none; }
.win-side .btn { width: 100%; }
.win-side .sep { height: 6px; }
.win-foot { display: flex; gap: 6px; padding: 6px 8px 8px; justify-content: flex-end; flex-wrap: wrap; flex: none; }
.win-foot .btn { min-width: 76px; }
.win-msg { margin: 0 8px; padding: 5px 7px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; border: 1px solid var(--down); background: color-mix(in srgb, var(--down) 12%, var(--panel)); }
.win-msg > span { flex: 1; min-width: 160px; }
.win-msg.info, .win-msg.ok { border-color: var(--sel); background: var(--sel-soft); }
.msgbox-text { margin: 4px 2px; white-space: pre-line; }
.msgbox.notify.st-down .win-head { background: linear-gradient(#d84a40, #a8231b); }
.msgbox.notify.st-up .win-head { background: linear-gradient(#45a85c, #2a7a3d); }
.dev-win .win-body, .tool-win .win-body { padding: 4px; }

/* záložky v oknech (Dude: General / Polling / Services / …) */
.tabbox { display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 1px; border-bottom: 1px solid var(--line-2); flex: none; padding: 0 2px; }   /* víc řad záložek jako v Dude — nic se neschová */
.tab { border: 1px solid var(--line-2); border-bottom: 0; background: var(--chrome-2); padding: 2px 9px; cursor: pointer; white-space: nowrap; margin-bottom: -1px; border-radius: 3px 3px 0 0; }
.tab.on { background: var(--panel); font-weight: bold; }
.tab-pages { flex: 1; min-height: 0; background: var(--panel); border: 1px solid var(--line-2); border-top: 0; overflow: auto; display: flex; flex-direction: column; }
.tab-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tab-page > .form, .tab-page > .gen, .tab-page > .help, .tab-page > .kv { padding: 8px; }

/* ---------- formuláře ---------- */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; align-content: start; }
.msgbox .form, .form:has(> p) { grid-template-columns: 1fr; }
.form > p { margin: 0; }
.f { display: grid; gap: 2px; min-width: 0; align-content: start; }
.f > span { color: var(--ink-2); }
.f > small { color: var(--muted); font-size: 11px; }
.f.wide, .f:has(textarea), .f:has(.checks), .f-section, .form > .f-info { grid-column: 1 / -1; }
.f.check { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 6px; cursor: pointer; grid-column: 1 / -1; }
.f.check > span { color: var(--ink); }
.f.check > small { grid-column: 2; }
.f-info { padding: 3px 0; color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere; }
.f-section { font-weight: bold; padding: 6px 0 2px; border-bottom: 1px solid var(--line); margin-top: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 3px 12px; padding: 4px 6px; border: 1px solid var(--line); background: var(--panel); max-height: 150px; overflow: auto; }
.checks label { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line-2); flex-wrap: wrap; align-self: flex-start; }
.seg-b { border: 0; background: var(--chrome-2); padding: 1px 8px; cursor: pointer; font-size: 11px; }
.seg-b + .seg-b { border-left: 1px solid var(--line-2); }
.seg-b.on { background: var(--sel); color: var(--sel-ink); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; align-content: start; }
.kv > div { display: contents; }
.kv > div > span:first-child { color: var(--muted); }
.kv > div > span:last-child { overflow-wrap: anywhere; }
.kv.big { padding: 10px; font-size: 13px; gap: 4px 20px; height: auto; }
.gen { display: grid; gap: 10px; align-content: start; }
.test-out { color: var(--ink-2); }
.copyrow { display: flex; gap: 6px; align-items: center; }
.copyrow code { padding: 2px 6px; background: var(--panel); border: 1px solid var(--line); user-select: all; }
.chart-items { display: grid; gap: 2px; border: 1px solid var(--line); background: var(--panel); padding: 4px; max-height: 180px; overflow: auto; grid-column: 1 / -1; }
.ci { display: flex; align-items: center; gap: 6px; }
.ci > span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- zařízení ---------- */
.dev { display: flex; flex-direction: column; min-height: 0; height: 100%; gap: 4px; }
.dev-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 2px 4px; }
.dev-head b { font-size: 13px; }
.dev-holder { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dev-holder > .tabbox { flex: 1; }
.sub-h { display: flex; align-items: center; gap: 6px; padding: 3px 6px; background: var(--chrome); border-bottom: 1px solid var(--line); font-weight: bold; flex: none; }
.sub-h + .lv-wrap, .tabpane > .lv-wrap { min-height: 80px; }
.snmp-out { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.tool-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; padding: 8px; align-content: start; height: auto !important; }

/* ---------- nástroje ---------- */
.tool { display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.tool-bar { display: flex; gap: 8px; align-items: center; }
.tool-status { color: var(--ink-2); }
.tool-out { flex: 1; min-height: 160px; margin: 0; padding: 6px; background: #0d1014; color: #d6e2d6; border: 1px solid var(--line-2); overflow: auto; white-space: pre; }
.tool-out.short { min-height: 70px; max-height: 140px; flex: none; }
.tool-out.term { color: #c8f0c8; }
.term-in { font-family: var(--mono) !important; background: #0d1014 !important; color: #c8f0c8 !important; height: 26px !important; }
.disc-prog { padding: 4px 0; font-weight: bold; }
.disc-run { display: flex; flex-direction: column; gap: 6px; min-height: 0; flex: 1; }
.disc-run .lv-wrap { min-height: 120px; border: 1px solid var(--line); }

/* ---------- grafy ---------- */
.graph { display: flex; flex-direction: column; gap: 4px; padding: 6px; min-height: 0; }
.chart-box { position: relative; min-height: 170px; }
.chart-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 10px; pointer-events: none; }
.chart-msg button { pointer-events: auto; }
.chart-pane { overflow: auto; padding: 8px; gap: 12px; }
.chart-item { border: 1px solid var(--line); background: var(--panel); flex: none; }
.chart-title { padding: 3px 6px; background: var(--chrome); border-bottom: 1px solid var(--line); font-weight: bold; }
.uplot { font-family: var(--ui); }
.uplot .u-legend { font-size: 11px; color: var(--ink-2); }

/* ---------- nabídky, hlášky ---------- */
.menu { position: fixed; z-index: 400; min-width: 180px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); padding: 2px; }
.menu-item { padding: 3px 22px 3px 20px; cursor: pointer; white-space: nowrap; position: relative; }
.menu-item:hover, .menu-item:focus { background: var(--sel); color: var(--sel-ink); outline: none; }
.menu-item.checked::before { content: "✓"; position: absolute; left: 6px; }
.menu-item.has-sub::after { content: "▸"; position: absolute; right: 7px; }
.menu-sep { height: 1px; background: var(--line); margin: 2px 4px; }
.menu.sub { display: none; position: absolute; left: 100%; top: -3px; color: var(--ink); }
.menu-item.has-sub:hover > .menu.sub { display: block; }
#toasts { position: fixed; right: 12px; bottom: 30px; z-index: 500; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; max-width: calc(100vw - 24px); }
.toast { background: var(--chrome); color: var(--ink); border: 1px solid var(--line-2); border-left: 4px solid var(--up); padding: 6px 10px; box-shadow: var(--shadow); transition: opacity .5s; }
.toast.info { border-left-color: var(--sel); }
.toast.err, .toast.error { border-left-color: var(--down); }
.toast.out { opacity: 0; }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 600; background: var(--down); opacity: 0; animation: flash 1.2s ease-out; }
.flash.st-up { background: var(--up); } .flash.st-partial { background: var(--partial); }
@keyframes flash { 0%, 40% { opacity: .45; } 20%, 100% { opacity: 0; } }

/* ---------- nápověda ---------- */
.help { line-height: 1.5; }
.help h3 { margin: 10px 0 4px; font-size: 13px; }
.help p { margin: 0 0 6px; max-width: 70ch; }
.kv-table { border-collapse: collapse; }
.kv-table td { padding: 2px 10px 2px 0; vertical-align: top; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--panel-2); border-radius: 2px; white-space: nowrap; }

/* ---------- mapa ---------- */
.map-pane { position: relative; }
.map-pane[data-theme="dark"] { --m-bg: #000000; --m-ink: #000000; --m-label: #e6e6e6; --m-link: #e8a33c; --m-sel: #ffffff; --m-band: rgba(120, 170, 230, .18); }
.map-pane[data-theme="light"] { --m-bg: #ffffff; --m-ink: #000000; --m-label: #202020; --m-link: #505050; --m-sel: #1060d0; --m-band: rgba(40, 110, 210, .12); }
.map-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; background: var(--m-bg, #000); }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; outline: none; }
.nd { cursor: pointer; }
.nd .nb { stroke: rgba(0, 0, 0, .55); stroke-width: 1; }
.nd .nt { font: 11px Tahoma, Verdana, "Segoe UI", sans-serif; fill: var(--m-ink); pointer-events: none; }
.nd.k-label .nb { stroke: none; }
.nd.k-label .nt { fill: var(--m-label); }
.nd.k-network .nb { stroke-dasharray: 3 2; }
.nd.k-submap .nb { stroke-width: 2; }
.nd.sel .nb { stroke: var(--m-sel); stroke-width: 2; stroke-dasharray: 4 2; }
.nd.sel .ni { filter: drop-shadow(0 0 2px var(--m-sel)) drop-shadow(0 0 1px var(--m-sel)); }
.nd.k-label.sel .nb { stroke-width: 1; }
/* Hlídané porty: port jede pomaleji, než má → kostička pomalu pulzuje oranžovým okrajem (2,4 s; bez filtrů — XP PC u TV) */
.nd.pulse .nb { animation: port-pulse 2.4s ease-in-out infinite; }
@keyframes port-pulse { 0%, 100% { stroke: rgba(0, 0, 0, .55); stroke-width: 1; } 50% { stroke: #ff8c00; stroke-width: 7; } }
@media (prefers-reduced-motion: reduce) { .nd.pulse .nb { animation: none; stroke: #ff8c00; stroke-width: 5; } }
.down-text { color: var(--down); font-weight: 600; }
.lv tr.sel .down-text { color: inherit; }
.watch-cell { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ll { stroke: var(--m-link); fill: none; }
.ll.s-wireless, .ll.s-dotted { stroke-dasharray: 2 3; }
.ll.s-dashed { stroke-dasharray: 8 4; }
.ll.down { stroke: #e0261c; }
.ll.sel { stroke: var(--m-sel); }
.lhit { stroke: transparent; stroke-width: 12; fill: none; cursor: pointer; }
.lab { cursor: pointer; }
.lb { stroke: rgba(0, 0, 0, .55); stroke-width: 1; }
.lt { font: 11px Tahoma, Verdana, "Segoe UI", sans-serif; fill: #000; pointer-events: none; }
.band { fill: var(--m-band); stroke: var(--m-sel); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.ghost { stroke: var(--m-sel); stroke-width: 1.5; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.map-pane[data-layer="nolabels"] .g-llabels { display: none; }
.map-pane[data-layer="devices"] .g-llabels, .map-pane[data-layer="devices"] .g-links { display: none; }
.map-pane.tiny .lhit { stroke-width: 30; }
/* přechody ve výplni (Dude 3.5: modré „up“, červené „down“ …) */
/* změřeno ze snímku Dude 3.5: nahoře skoro bílá, dole plná barva stavu; neznámý = čistě bílý */
.gs1.g-up { stop-color: #eaf1f4; } .gs2.g-up { stop-color: #156388; }
.gs1.g-down { stop-color: #fff3f3; } .gs2.g-down { stop-color: #ff1313; }
.gs1.g-partial { stop-color: #fff6ea; } .gs2.g-partial { stop-color: #e38900; }
.gs1.g-acked { stop-color: #f3eefa; } .gs2.g-acked { stop-color: #7a4bc0; }
.gs1.g-unknown { stop-color: #ffffff; } .gs2.g-unknown { stop-color: #ffffff; }
.gs1.g-disabled { stop-color: #a8a8a8; } .gs2.g-disabled { stop-color: #666666; }
.gs1.g-net { stop-color: #eef2f6; } .gs2.g-net { stop-color: #a9b4bf; }
.gs1.g-sub { stop-color: #dfeaf5; } .gs2.g-sub { stop-color: #8eaecd; }
.gs1.g-lok { stop-color: #93c68e; } .gs2.g-lok { stop-color: #75b66f; }
.gs1.g-lwarn { stop-color: #d0ac96; } .gs2.g-lwarn { stop-color: #bd8b6d; }
.gs1.g-lbad { stop-color: #e2988c; } .gs2.g-lbad { stop-color: #dc8274; }
.map-pane[data-theme="light"] .gs1.g-up { stop-color: #d6fbcc; } .map-pane[data-theme="light"] .gs2.g-up { stop-color: #43c232; }
/* plovoucí prvky nad mapou */
.map-tip { position: absolute; z-index: 20; pointer-events: none; background: #ffffe1; color: #000; border: 1px solid #555; padding: 4px 6px; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); max-width: 320px; font-size: 11px; }
.map-tip table { border-collapse: collapse; margin-top: 2px; }
.map-tip td { padding: 0 8px 0 0; white-space: nowrap; }
.map-tip td:first-child { color: #555; }
.map-tip .muted { color: #666; margin-top: 3px; }
.tip-svcs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }
.map-hint { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 15; display: flex; gap: 8px; align-items: center; background: #ffffe1; color: #000; border: 1px solid #555; padding: 4px 8px; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); max-width: calc(100% - 16px); }
.map-empty, .map-err { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; padding: 16px; pointer-events: none; color: var(--m-label); }
.map-empty > *, .map-err > * { pointer-events: auto; }
.map-empty p, .map-err p { margin: 0; max-width: 420px; }
.map-err { background: color-mix(in srgb, var(--m-bg) 80%, transparent); z-index: 16; }

/* ---------- mobil / tablet ---------- */
@media (max-width: 759px) {
  body { font-size: 13px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 90; width: min(280px, 85vw); box-shadow: var(--shadow); transform: translateX(-100%); transition: transform .18s; display: flex !important; }
  body.side-open .side { transform: none; }
  .side-x { display: block; min-width: 36px; min-height: 36px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--ink); cursor: pointer; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 89; background: rgb(0 0 0 / .35); }
  .tn { min-height: 36px; }
  .tw { width: 22px; height: 22px; font-size: 13px; line-height: 20px; }
  .tb-btn, .toolbar .tb { height: 36px; min-width: 36px; }
  .toolbar .tb > span, .topbar .tb-btn > span { display: none; }
  /* lišta mapy v jednom řádku s posunem do strany (dřív se zalomila do 4 řádků a zabrala půl displeje) */
  .toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .toolbar::-webkit-scrollbar { display: none; }
  .toolbar .tb-lbl { font-size: 0; flex: none; }
  .toolbar .tb-lbl select { font-size: 16px; width: auto; max-width: 140px; }
  .toolbar > * { flex: none; }
  .statusbar { font-size: 12px; }
  .statusbar > span { padding: 2px 6px; }
  .statusbar > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .srv { border: 0; font-size: 0; gap: 0; }   /* telefon: jen tečka stavu, místo pro karty */
  .stab { padding: 6px 4px 6px 10px; }
  .tab-x { width: 28px; height: 28px; }
  .lv-search { width: 120px !important; }
  .btn { min-height: 34px; }
  .btn.small { min-height: 30px; }
  input[type=text], input[type=password], input[type=number], input[type=search], input[type=time], input:not([type]), select { height: 34px; font-size: 16px; }
  .form { grid-template-columns: 1fr; }
  .win { left: 4px !important; right: 4px; width: auto !important; top: 4px !important; max-height: calc(100vh - 8px); }
  .win-head { height: 34px; }
  .win-x { width: 34px; height: 28px; }
  .win-grip, .win-max { display: none; }
  .win-main { flex-direction: column; }
  .win-side { flex-direction: row; flex-wrap: wrap; width: auto; padding: 0 8px 8px; }
  .win-side .btn { width: auto; flex: 1 1 auto; }
  .statusbar > span:nth-child(2) { display: none; }
  .tab { padding: 6px 10px; }
}
/* dotykové ovládání (telefon i iPad, na výšku i na šířku): cíle aspoň 44 × 44 px podle Apple HIG */
@media (pointer: coarse) {
  .tb-btn, .toolbar .tb { min-height: 44px; min-width: 44px; }
  .tn { min-height: 44px; }
  .tw { width: 44px; height: 44px; font-size: 18px; line-height: 42px; border-color: transparent; background: none; }   /* celá plocha 44 px, znak + / − uprostřed */
  .tw:not(.none)::before { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--line-2); background: var(--panel); line-height: 1; }
  .tab { min-height: 44px; display: inline-flex; align-items: center; }
  .tab-x { width: 44px; height: 44px; font-size: 18px; }
  .btn, .btn.small { min-height: 44px; }
  .win-head { min-height: 44px; }
  .win-x { width: 44px; height: 36px; font-size: 18px; }
  .side-x { min-width: 44px; min-height: 44px; }
  .stab, .topbar .stab { min-height: 44px; height: 44px; }
  input[type=text], input[type=password], input[type=number], input[type=search], input[type=time], input:not([type]), select, textarea { min-height: 44px; font-size: 16px; }   /* 16 px: iOS jinak při psaní přiblíží stránku */
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
}
/* výřez displeje a spodní lišta iPhonu (viewport-fit=cover) */
.topbar { padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); padding-top: max(2px, env(safe-area-inset-top)); }
.statusbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); padding-bottom: env(safe-area-inset-bottom); }
.side { padding-left: env(safe-area-inset-left); }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } .flash { animation: none; } .toast { transition: none; } }
