/* Sentinel web panel — dark, military-inspired, minimal translucent panels */
:root {
  --bg: #0d1108;
  --panel: rgba(20, 26, 14, 0.82);
  --line: #3a4630;
  --fg: #c8d4b0;
  --dim: #7d8a68;
  --accent: #9ab86a;
  --warn: #d9a441;
  --bad: #c0563f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 13px/1.4 "SF Mono", Menlo, Consolas, monospace; }
#map { position: fixed; inset: 0; }
.hidden { display: none !important; }

/* dark-mode tiles (day toggle removes the filter) */
.leaflet-tile-pane { filter: grayscale(0.6) brightness(0.55) invert(0.9) hue-rotate(180deg) saturate(0.4); }
body.day .leaflet-tile-pane { filter: none; }
.leaflet-container { background: var(--bg); font: inherit; }
.leaflet-control-attribution { background: rgba(0,0,0,.55) !important; color: var(--dim); font-size: 10px; }
.leaflet-control-attribution a { color: var(--dim); }

.panel { background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; backdrop-filter: blur(4px); }

.overlay { position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; background: rgba(5, 8, 3, 0.6); z-index: 1000; }
.login-panel { padding: 18px; width: min(300px, 92vw); display: flex; flex-direction: column; gap: 10px; }
.login-panel h1 { margin: 0 0 4px; font-size: 15px; font-weight: 600; letter-spacing: 1px; color: var(--accent); }
.login-panel label { display: flex; flex-direction: column; gap: 4px; color: var(--dim); font-size: 12px; }
.login-panel input { background: #11170a; border: 1px solid var(--line);
  border-radius: 3px; color: var(--fg); padding: 7px 8px; font: inherit; }
button { background: #2a3419; color: var(--fg); border: 1px solid var(--line);
  border-radius: 3px; padding: 7px 10px; font: inherit; cursor: pointer; }
button:hover { background: #36421f; }
button.mini { padding: 3px 8px; font-size: 12px; color: var(--dim); }
button.mini:hover { color: var(--fg); }
.err { color: var(--bad); min-height: 1em; font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }

#topbar { position: fixed; top: 8px; left: 8px; right: 8px; z-index: 900; }
.bar { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.brand { color: var(--accent); font-weight: 600; letter-spacing: 1px; }
.spacer { flex: 1; }
.dim { color: var(--dim); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  color: var(--dim); }
.chip.sel { color: var(--fg); border-color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.dot.on { background: var(--accent); }

.side { position: fixed; top: 52px; right: 8px; z-index: 900; width: min(290px, 92vw);
  max-height: calc(100vh - 70px); overflow-y: auto; padding: 10px 12px; }
.side.side-l { left: 8px; right: auto; border-left: 3px solid #3f7cac; }
.side.side-r { border-left: 3px solid var(--accent); }
.side-head { display: flex; justify-content: space-between; align-items: center;
  gap: 8px; color: var(--accent); margin-bottom: 6px; }
.side-head span:nth-child(2) { flex: 1; }
/* panel type tags */
.ptag { display: inline-flex; gap: 4px; align-items: center; font-size: 10px;
  padding: 1px 7px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.ptag .picon { font-size: 9px; }
.ptag-dron { background: var(--accent); color: var(--bg); }
.ptag-stacja { background: #3f7cac; color: #fff; }
.ptag-cfg { background: #c08a2e; color: #fff; }
/* narrow-screen edge chips */
.edge-tab { position: fixed; top: 45%; z-index: 890; padding: 8px 5px;
  font-size: 11px; color: var(--dim); }
.edge-tab.edge-l { left: 0; border-radius: 0 6px 6px 0;
  border-left: 3px solid #3f7cac; }
.edge-tab.edge-r { right: 0; border-radius: 6px 0 0 6px;
  border-right: 3px solid var(--accent); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 6px 0; }
.kv .k { color: var(--dim); }
.kv .v { text-align: right; word-break: break-all; }
.sect { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 6px; }

#history-list .ev { padding: 4px 0; border-bottom: 1px solid #222a16; font-size: 12px; }
#history-list .ev .t { color: var(--dim); }
.pager { display: flex; justify-content: space-between; margin-top: 8px; }

/* markers */
.stn { background: none; border: none; }
.stn-box { width: 15px; height: 15px; border: 2px solid #3f7cac;
  background: rgba(63, 124, 172, .3); transform: rotate(45deg); }
.drone { background: none; border: none; }
.drone svg { display: block; filter: drop-shadow(0 0 4px rgba(0,0,0,.75)); }
.drone svg polygon { fill: var(--drone-live, #9ab86a);
  stroke: rgba(0,0,0,.65); }
.drone.lost svg polygon { fill: #777; }
.drone.sel .halo { fill: none; stroke: var(--accent); stroke-width: 2.5;
  stroke-dasharray: 5 4; opacity: .95; }
.opmk { background: none; border: none; }
.opmk .ring { fill: rgba(42, 111, 176, .25); stroke: #2a6fb0;
  stroke-width: 2.5; }
.opmk .dot { fill: #2a6fb0; }
.pred-lbl { background: none; border: none; text-align: center; }
.pred-lbl span { font-size: 12px; font-weight: 600; color: #d9a441;
  text-shadow: 0 0 3px #000, 0 0 5px #000; }
body.day .pred-lbl span { color: #7a5200;
  text-shadow: 0 0 3px #fff, 0 0 5px #fff; }

/* day theme adjustments */
body.day {
  --drone-live: #2e6b1f;
  --panel: rgba(244, 246, 238, 0.88);
  --line: #9aa88a;
  --fg: #1c2612;
  --dim: #5b6b4a;
  --accent: #3f6a1f;
  --bg: #e8ece2;
}
body.day .leaflet-control-attribution {
  background: rgba(255,255,255,.6) !important; color: #444; }
body.day .login-panel input { background: #f4f6ee; }
body.day button { background: #dde4d0; }
body.day button:hover { background: #cfdac0; }
body.day button.mini { color: var(--dim); }
body.day .stn-box { background: rgba(63, 124, 172, .35); }
body.day #history-list .ev { border-bottom-color: #c4cdb4; }

@media (max-width: 600px) {
  .bar { gap: 6px; padding: 5px 8px; font-size: 12px; }
  .side { top: auto; bottom: 8px; right: 8px; left: 8px; width: auto;
    max-height: 45vh; }
}

a { color: var(--accent); }

/* ---------- konfiguracja: floating centred sheet ---------- */
#cfg-wrap { background: rgba(5, 8, 3, 0.5); backdrop-filter: blur(3px);
  z-index: 1100; align-items: center; justify-content: center; }
body.day #cfg-wrap { background: rgba(30, 40, 20, 0.35); }
.cfg-sheet { width: min(760px, 94vw); max-height: 80vh; padding: 0;
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(24, 26, 24, 0.92); border: 1px solid var(--line);
  border-top: 3px solid #c08a2e; border-radius: 6px; }
body.day .cfg-sheet { background: rgba(245, 246, 240, 0.96); }
.cfg-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.cfg-head .cfg-title { flex: 1; font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cfg-sel { background: #11170a; border: 1px solid var(--line); color: var(--fg);
  border-radius: 3px; font: inherit; padding: 3px 6px; max-width: 160px; }
body.day .cfg-sel { background: #f4f6ee; }
.cfg-note { margin: 8px 14px 0; font-size: 11px; color: var(--dim); }
.cfg-sheet > .badge.warn { margin: 8px 14px 0; align-self: flex-start; }
.cfg-body { display: flex; flex: 1; min-height: 0; }
.cfg-rail { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px;
  border-right: 1px solid var(--line); flex: 0 0 auto; min-width: 140px; }
.cfg-tab { background: none; border: 1px solid transparent; text-align: left;
  color: var(--dim); padding: 7px 10px; border-radius: 4px; }
.cfg-tab:hover { color: var(--fg); }
.cfg-tab.sel { background: rgba(192, 138, 46, .15); color: var(--fg);
  border-color: #c08a2e; }
.cfg-main { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cfg-id { font-size: 11px; color: var(--dim); word-break: break-all; flex: 1; }
.cfg-sect.danger h3 { color: var(--bad); }
.cfg-sect.danger { border-top: 1px solid var(--bad); margin-top: 18px;
  padding-top: 8px; }

/* Połączenia catalog */
.conn { padding: 6px 0; border-bottom: 1px solid var(--line); }
.conn:last-child { border-bottom: none; }
.conn-head { display: flex; align-items: center; gap: 8px; }
.conn-name { font-weight: 600; flex: 1; }
.conn-chip { font-size: 10px; padding: 1px 7px; border-radius: 8px;
  white-space: nowrap; border: 1px solid transparent; }
.conn-ok { background: #3f6a1f; color: #fff; }
.conn-now { background: var(--accent); color: var(--bg); font-weight: 700; }
.conn-untested { background: #8a6d1f; color: #fff; }
.conn-plan { background: transparent; color: var(--dim);
  border-color: var(--dim); }
.conn-shelved { background: transparent; color: var(--dim);
  border-color: var(--dim); border-style: dashed; }
.conn-desc { color: var(--dim); font-size: 12px; margin-top: 2px; }
.conn-jak { color: var(--dim); font-size: 11px; font-family: inherit;
  opacity: .85; margin-top: 2px; }

.cfg-sect { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.cfg-sect h3 { font-size: 12px; text-transform: lowercase; color: var(--dim); margin: 0; }
.cfg-sect input[type="text"], .cfg-sect input[type="password"] { width: 100%; }
.cfg-add { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: var(--accent); color: var(--bg); }
.badge.warn { background: #8a6d1f; color: #fff; }
.banner.warn { color: #d9a441; }
.sel-net { display: flex; gap: 6px; align-items: center; }
.sel-net .pri { color: var(--dim); min-width: 10px; }
.err { color: #e06c60; }

/* ---------- phone: bottom sheet + menu ---------- */
.sheet-bar { display: none; gap: 10px; align-items: center;
  padding: 6px 8px; font-size: 12px; cursor: pointer; }
.sheet-bar .b-id { font-weight: 600; }
.sheet-bar .b-it { white-space: nowrap; }
.sheet-bar .b-caret { margin-left: auto; color: var(--dim); }
.only-phone { display: none; }
#phone-menu { position: fixed; top: 44px; right: 8px; z-index: 1200;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; display: flex; flex-direction: column;
  gap: 4px; min-width: 140px; }
#phone-menu.hidden { display: none; }
#phone-menu button { text-align: left; }

@media (max-width: 600px) {
  .only-phone { display: inline-block; }
  #topbar .bar > button:not(#btn-menu),
  #topbar .brand { display: none; }
  #drone-info.side { left: 0; right: 0; bottom: 0; top: auto;
    width: auto; max-height: 45vh; border-radius: 12px 12px 0 0;
    display: flex; flex-direction: column; }
  #drone-info .sheet-bar { display: flex; flex: 0 0 auto; }
  #drone-info:not(.expanded) .sheet-body { display: none; }
  #drone-info.expanded .sheet-scroll { overflow-y: auto; }
  #drone-info.expanded .b-caret { transform: rotate(180deg); }
  #station-info.side { left: 0; right: 0; bottom: 0; top: auto;
    width: auto; max-height: 70vh; overflow-y: auto;
    border-radius: 12px 12px 0 0; border-left: none;
    border-top: 3px solid #3f7cac; }
  #drone-info.side { border-left: none; border-top: 3px solid var(--accent); }
  /* config: full-screen page with top tabs */
  .cfg-sheet { width: 100vw; height: 100vh; max-height: none;
    border: none; border-radius: 0; border-top: 3px solid #c08a2e; }
  .cfg-body { flex-direction: column; }
  .cfg-rail { flex-direction: row; min-width: 0; border-right: none;
    border-bottom: 1px solid var(--line); overflow-x: auto; padding: 6px; }
  .cfg-tab { white-space: nowrap; }
}
