* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; background: #101418; color: #e8eef2; }

header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: #171d23; border-bottom: 1px solid #2a333c;
  position: relative; z-index: 3000;
}
header h1 { font-size: 18px; font-weight: 600; }

.badge {
  padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
}
.badge.online { background: #14532d; color: #86efac; }
.badge.offline { background: #374151; color: #d1d5db; }
.badge.waiting { background: #374151; color: #fbbf24; }
.badge.nodata { background: #450a0a; color: #fca5a5; }
.badge.weak { background: #3b2a0b; color: #fbbf24; border: 1px solid #6b5a1e; }

#appMain { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
main { display: flex; flex: 1 1 auto; min-height: 0; }
.map-wrap { flex: 1; position: relative; }
#map { height: 100%; background: #1b2229; }

.layer-switch {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  display: flex;
  gap: 4px;
}
.layer-btn {
  background: rgba(16, 20, 24, 0.85);
  border: 1px solid #2a333c;
  color: #e8eef2;
  padding: 6px 12px;
}
.layer-btn.active { background: #2563eb; border-color: #2563eb; }
.layer-btn:disabled { background: #d1d5db; border-color: #d1d5db; color: #94a3b8; cursor: not-allowed; opacity: 1; }
.layer-btn:hover:not(.active) { background: #1e293b; }

.follow-switch {
  position: absolute;
  top: 50px;
  right: 10px;
  z-index: 1000;
}
.follow-switch .layer-btn { width: 100%; }

.ign { font-weight: 600; }
.ign.on { color: #16a34a; }
.ign.off { color: #6b7280; }
.ign::before { content: "●"; margin-right: 4px; }

aside {
  width: 340px; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 12px;
  background: #12181e; border-left: 1px solid #2a333c;
}

.card {
  background: #1a2129; border: 1px solid #2a333c; border-radius: 8px; padding: 12px;
}
.card h2 { font-size: 13px; text-transform: uppercase; color: #8ba0b3; margin-bottom: 8px; }

table.kv { width: 100%; font-size: 13px; border-collapse: collapse; }
table.kv td { padding: 3px 0; }
table.kv td:first-child { color: #8ba0b3; width: 45%; }
table.kv td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.muted { color: #7a8a99; font-size: 12px; margin-top: 6px; }

button {
  background: #2563eb; color: #fff; border: 0; border-radius: 6px;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
button:hover { background: #1d4ed8; }
.btnrow { display: flex; flex-direction: column; gap: 6px; }

.cal-wrap { position: relative; margin-bottom: 8px; }
.cal-btn {
  width: 100%; text-align: left; background: #101418;
  border: 1px solid #2a333c; color: #e8eef2;
}
.cal-btn:hover { background: #1e293b; }

.cal-popup {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: #1a2129; border: 1px solid #2a333c; border-radius: 8px;
  padding: 10px; margin-top: 4px;
}
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-title { font-weight: 600; font-size: 13px; }
.cal-arrow { background: none; border: 0; color: #8ba0b3; padding: 4px 8px; font-size: 12px; }
.cal-arrow:hover { color: #e8eef2; }

.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.cal-dow span { text-align: center; font-size: 11px; color: #7a8a99; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; font-size: 12px; background: none; border: 0;
  color: #e8eef2; cursor: pointer; position: relative;
}
.cal-cell.empty { visibility: hidden; }
.cal-cell.no { color: #4b5c6b; cursor: default; }
.cal-cell.has { background: #1e3a5f; }
.cal-cell.has:hover { background: #2563eb; }
.cal-cell.sel { background: #2563eb; font-weight: 700; }
.cal-cell.has::after {
  content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: #60a5fa;
}
.cal-cell.sel::after { background: #fff; }


.alarm { color: #fca5a5; font-weight: 600; }
.ok { color: #86efac; }

.tracker-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: #101418; border: 1px solid #2a333c; color: #e8eef2;
  margin-bottom: 6px; text-align: left;
  cursor: pointer; user-select: none;
}
.tracker-btn.active { border-color: #2563eb; background: #17233a; }
.tracker-btn:hover { background: #1e293b; }
.tracker-btn .muted { margin-left: auto; }
.tracker-btn .tname { font-weight: 600; }

.rename {
  color: #6b7280; font-size: 14px; padding: 0 4px;
}
.rename:hover { color: #e8eef2; }

.popup { line-height: 1.5; max-width: 280px; }
.popup .addr { color: #2563eb; }

.collapsible { cursor: pointer; user-select: none; }
.collapsible:hover { color: #93c5fd; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.online { background: #4ade80; }
.dot.offline { background: #4b5563; }
.dot.nodata { background: #ef4444; }
.dot.weak { background: #4b5563; }

.pin {
  width: 40px;
  height: 40px;
  position: relative;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.pin::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 50%;
}

.pin.pin-suspect {
  background: #dc2626;
  border-color: #fecaca;
  animation: suspectBlink 1s steps(2, start) infinite;
}
.pin.pin-weak {
  background: #f59e0b;
  border-color: #fde68a;
  box-shadow: 0 1px 4px rgba(0,0,0,.6), 0 0 0 3px rgba(245,158,11,.25);
}
.warn { color: #fbbf24; }
.suspect-wrap { position: relative; width: 40px; height: 40px; }
.suspect-wrap .pin { position: absolute; inset: 0; }
.gps-drop {
  position: absolute; width: 7px; height: 9px; background: #ef4444;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  animation: gpsDrop 1.4s ease-in-out infinite;
}
.gps-drop.drop-1 { left: 32px; top: 0; }
.gps-drop.drop-2 { left: -2px; top: 9px; animation-delay: .45s; }
.gps-dot {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: #fca5a5; animation: gpsDot 1.2s ease-in-out infinite;
}
.gps-dot.gdot-1 { right: 0; top: 20px; }
.gps-dot.gdot-2 { left: 0; bottom: 1px; animation-delay: .3s; }
.gps-dot.gdot-3 { right: 4px; bottom: -2px; animation-delay: .6s; }
.moving-wrap { position: relative; width: 40px; height: 40px; }
.moving-wrap .pin { position: absolute; inset: 0; }
.pin.pin-moving {
  background: #2563eb;
  border-color: #bfdbfe;
  animation: movingBlink 1.1s steps(2, start) infinite;
}
.move-drop {
  position: absolute; width: 8px; height: 10px; background: #3b82f6; border: 1px solid #dbeafe;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  animation: gpsDrop 1.4s ease-in-out infinite;
}
.move-drop.md-1 { left: 32px; top: 0; }
.move-drop.md-2 { left: -2px; top: 9px; animation-delay: .45s; }
.move-dot {
  position: absolute; width: 6px; height: 6px; border-radius: 50%;
  background: #60a5fa; border: 1px solid #dbeafe;
  animation: gpsDot 1.2s ease-in-out infinite;
}
.move-dot.mdot-1 { right: 0; top: 20px; }
.move-dot.mdot-2 { left: 0; bottom: 1px; animation-delay: .3s; }
.move-dot.mdot-3 { right: 4px; bottom: -2px; animation-delay: .6s; }
.moving-wrap.moving-unsel .pin {
  background: #eab308;
  border-color: #fde68a;
  animation: movingBlinkOrange 1.1s steps(2, start) infinite;
}
.moving-wrap.moving-unsel .move-drop {
  background: #f59e0b;
  border-color: #fde68a;
}
.moving-wrap.moving-unsel .move-dot {
  background: #fbbf24;
  border-color: #fde68a;
}
@keyframes movingBlinkOrange {
  0%, 100% { opacity: 1; box-shadow: 0 1px 4px rgba(0,0,0,.6), 0 0 0 0 rgba(234,179,8,.55); }
  50% { opacity: .45; box-shadow: 0 1px 4px rgba(0,0,0,.6), 0 0 0 9px rgba(234,179,8,0); }
}
.dot.suspect { background: #ef4444; animation: gpsDot 1s ease-in-out infinite; }
.badge.suspect {
  background: #450a0a; color: #fecaca; border: 1px solid #7f1d1d;
  animation: suspectBadge 1s steps(2, start) infinite;
}
.help-pin.pin-suspect { background: #ef4444; animation: suspectBlink 1s steps(2, start) infinite; }
@keyframes suspectBlink {
  0%, 100% { opacity: 1; box-shadow: 0 1px 4px rgba(0,0,0,.6), 0 0 0 0 rgba(239,68,68,.55); }
  50% { opacity: .45; box-shadow: 0 1px 4px rgba(0,0,0,.6), 0 0 0 9px rgba(239,68,68,0); }
}
@keyframes movingBlink {
  0%, 100% { opacity: 1; box-shadow: 0 1px 4px rgba(0,0,0,.6), 0 0 0 0 rgba(37,99,235,.55); }
  50% { opacity: .45; box-shadow: 0 1px 4px rgba(0,0,0,.6), 0 0 0 9px rgba(37,99,235,0); }
}
@keyframes gpsDrop {
  0%, 100% { transform: translateY(0) rotate(-45deg); opacity: .9; }
  50% { transform: translateY(3px) rotate(-45deg); opacity: .45; }
}
@keyframes gpsDot {
  0%, 100% { opacity: 1; }
  50% { opacity: .25; }
}
@keyframes suspectBadge {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.6); }
}


/* ─── Login ─────────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: #0c1014;
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: #1a2129; border: 1px solid #2a333c; border-radius: 12px;
  padding: 32px; width: 340px; text-align: center;
}
.login-logo { margin-bottom: 12px; }
.login-box h1 { font-size: 22px; margin-bottom: 4px; }
.login-box .muted { margin-bottom: 20px; }
.login-box form { display: flex; flex-direction: column; gap: 10px; }
.login-box input {
  background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 10px 12px; font-size: 14px;
}
.login-box input:focus { outline: none; border-color: #2563eb; }
.login-box button { padding: 10px; font-size: 14px; margin-top: 4px; }
.login-error { color: #fca5a5; font-size: 13px; min-height: 18px; }

/* ─── Header user menu ──────────────────────────────────────────────────── */
.header-right { margin-left: auto; }
.user-menu { position: relative; }
.user-btn {
  background: #1e293b; border: 1px solid #2a333c; color: #e8eef2;
  padding: 6px 12px; font-size: 13px; cursor: pointer; border-radius: 6px;
}
.user-btn:hover { background: #334155; }
.user-dropdown {
  position: absolute; top: 100%; right: 0; z-index: 5000;
  background: #1a2129; border: 1px solid #2a333c; border-radius: 8px;
  min-width: 160px; margin-top: 4px; overflow: hidden;
}
.user-dropdown-info { padding: 10px 12px; border-bottom: 1px solid #2a333c; font-size: 13px; }
.dropdown-item {
  display: block; width: 100%; text-align: left; background: none;
  border: 0; padding: 10px 12px; font-size: 13px; color: #e8eef2; cursor: pointer;
}
.dropdown-item:hover { background: #1e293b; }
.dropdown-item.danger { color: #fca5a5; }

/* ─── Admin nav ─────────────────────────────────────────────────────────── */

.npd-notice-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.npd-notice {
  background: linear-gradient(135deg, #6d28d9 0%, #a855f7 58%, #22c55e 130%);
  color: #fff;
  border: 2px solid #e9d5ff;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.35), 0 16px 36px rgba(0, 0, 0, 0.5);
  animation: npdPulse 1.8s ease-in-out infinite;
}
.npd-notice-main { font-size: 14px; line-height: 1.4; }
.npd-notice-main b { color: #fff; }
.npd-notice-hint { font-size: 11px; color: #f5d0fe; margin-top: 4px; }
.npd-receipt-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.npd-receipt-url {
  flex: 1 1 260px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-size: 12px;
}
.npd-receipt-url::placeholder { color: #e9d5ff; }
.npd-send {
  padding: 7px 11px;
  border: 1px solid #93c5fd;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.npd-send:hover { background: #1d4ed8; }
.npd-send:disabled { opacity: 0.6; cursor: wait; }
.npd-done {
  margin-top: 8px;
  padding: 4px 9px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff;
  font-size: 11px;
  border-radius: 6px;
}
.npd-done:hover { background: rgba(255, 255, 255, 0.3); }
@keyframes npdPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3), 0 16px 36px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(168, 85, 247, 0.18), 0 16px 42px rgba(34, 197, 94, 0.35); }
}

.admin-nav {
  display: flex; flex-wrap: wrap; gap: 0; background: #171d23; border-bottom: 1px solid #2a333c;
  padding: 0 16px;
}
.nav-btn {
  background: none; border: 0; border-bottom: 2px solid transparent;
  text-decoration: none; display: inline-block;
  color: #8ba0b3; padding: 10px 16px; font-size: 13px; cursor: pointer;
  border-radius: 0;
}
.nav-btn:hover { color: #e8eef2; background: none; }
.nav-btn.active { color: #e8eef2; border-bottom-color: #2563eb; }

/* ─── Users panel ───────────────────────────────────────────────────────── */
.users-panel {
  flex: 1; overflow-y: auto; padding: 20px; background: #101418; min-height: 0;
}
.users-inner { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-row input[type="text"], .form-row input[type="password"] {
  background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 8px 10px; font-size: 13px; flex: 1; min-width: 120px;
}
#addTrackerModel {
  flex: 1 1 100%; width: 100%; background: #101418; border: 1px solid #2a333c;
  border-radius: 6px; color: #e8eef2; padding: 8px 10px; font-size: 13px;
}
#addTrackerModel:focus { outline: none; border-color: #2563eb; }
.form-row input:focus { outline: none; border-color: #2563eb; }
.chk { font-size: 13px; color: #8ba0b3; white-space: nowrap; cursor: pointer; }
.chk.mini { font-size: 11px; }

.user-card {
  background: #101418; border: 1px solid #2a333c; border-radius: 8px;
  padding: 12px; margin-bottom: 8px;
}
.user-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-card-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.user-trackers { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tracker-chip {
  background: #1e3a5f; border: 1px solid #2563eb; border-radius: 12px;
  padding: 3px 10px; font-size: 12px; color: #93c5fd;
  display: inline-flex; align-items: center; gap: 4px;
}
.chip-x { color: #6b7280; cursor: pointer; font-weight: 700; }
.chip-x:hover { color: #fca5a5; }
.admin-badge { background: #4c1d95; color: #c4b5fd; padding: 2px 8px; border-radius: 8px; font-size: 11px; }
.me-badge { background: #14532d; color: #86efac; padding: 2px 8px; border-radius: 8px; font-size: 11px; }
.mini-btn {
  background: #1e293b; border: 1px solid #2a333c; color: #e8eef2;
  padding: 4px 8px; font-size: 11px; cursor: pointer; border-radius: 4px;
}
.mini-btn:hover { background: #334155; }
.mini-btn.danger { color: #fca5a5; border-color: #7f1d1d; }
.mini-btn.danger:hover { background: #450a0a; }
.mini-btn.accent { color: #93c5fd; border-color: #2563eb; }
.mini-btn.accent:hover { background: #17233a; }
.mini-btn.alt { color: #fbbf24; border-color: #6b5a1e; }
.mini-btn.alt:hover { background: #2a2413; }
.mini-btn.alt.active { background: #6b5a1e; color: #fff7e0; }

.badge-count {
  display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 4px;
  border-radius: 8px; background: #ef4444; color: #fff;
  font-size: 11px; line-height: 16px; text-align: center; vertical-align: middle;
}

.events-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.events-head h2 { margin-bottom: 0; }
.events-actions { display: flex; align-items: center; gap: 8px; }
.events-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.event-item { padding: 8px 10px; border-bottom: 1px solid #2a333c; }
.event-item.unread { background: #17233a; }
.event-item .et { color: #8ba0b3; font-size: 12px; margin-top: 3px; }

.fence-item { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid #2a333c; }
.fence-item .fname { flex: 1; font-size: 13px; }
.fence-item .fmeta { color: #8ba0b3; font-size: 11px; margin-top: 2px; }

#fenceForm input[type="text"], #fenceForm input[type="number"], #fenceForm select {
  width: 100%; margin-bottom: 6px; background: #101418; border: 1px solid #2a333c;
  border-radius: 6px; color: #e8eef2; padding: 7px 9px; font-size: 13px;
}
#fenceForm input[type="text"]:focus, #fenceForm input[type="number"]:focus, #fenceForm select:focus {
  outline: none; border-color: #2563eb;
}
#fenceForm .chk {
  display: flex; align-items: center; justify-content: flex-start; gap: 6px;
  text-align: left; width: 100%; margin: 4px 0 8px;
}
#fenceForm .chk input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; }
#fenceForm .btnrow { flex-direction: row; }
#fenceForm .btnrow button { flex: 1; }
#fenceRadiusHint { font-size: 11px; margin: -2px 0 6px; }
#map.drawing .leaflet-interactive,
#map.drawing .leaflet-marker-icon,
#map.drawing .leaflet-overlay-pane,
#map.drawing .leaflet-marker-pane,
#map.drawing .leaflet-popup-pane { pointer-events: none !important; }

.code {
  display: inline-block; padding: 3px 8px; background: #0f151a; border: 1px solid #2a333c;
  border-radius: 5px; font-family: monospace; font-size: 14px; color: #93c5fd;
}
.sep { border: none; border-top: 1px solid #2a333c; margin: 12px 0; }
.notify-quiet { margin: 10px 0; }
.notify-quiet input[type="time"] {
  background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 5px 7px;
}
.notify-email { margin: 8px 0; }
.notify-email input { width: 100%; }
#notifyEmail, #smtpHost, #smtpPort, #smtpUser, #smtpPass {
  width: 100%; background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 8px 10px; margin-bottom: 6px;
}
#notifyEmail:focus, #smtpHost:focus, #smtpPort:focus, #smtpUser:focus, #smtpPass:focus {
  outline: none; border-color: #2563eb;
}
#smtpCard .btnrow { flex-direction: row; }
.user-email { font-size: 12px; color: #8ba0b3; margin: 2px 0 4px; }
.user-consent { font-size: 11px; margin-top: 5px; color: #6b7280; }
.user-consent.ok { color: #86efac; }
.user-consent.none { color: #fca5a5; }

.speed-row { display: flex; gap: 6px; }
.speed-row input {
  flex: 1; width: auto; background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 7px 9px; font-size: 13px;
}
.speed-row input:focus { outline: none; border-color: #2563eb; }
.speed-row button { flex: 0 0 auto; }
.nowork-days { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 6px 0; }
.nowork-days .chk { margin: 0; }
#noworkCard .notify-quiet { display: flex; align-items: center; gap: 6px; }

.report-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.report-controls select, .report-controls input[type="date"] {
  background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 6px 8px; font-size: 12px;
}
.rep-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.rep-summary .item { background: #0f151a; border: 1px solid #2a333c; border-radius: 6px; padding: 8px 10px; }
.rep-summary .item b { display: block; font-size: 16px; }
.rep-summary .item span { color: #8ba0b3; font-size: 10px; text-transform: uppercase; }
.rep-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rep-tab {
  background: #1e293b; border: 1px solid #2a333c; color: #e8eef2;
  padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 12px;
}
.rep-tab.active { background: #2563eb; border-color: #2563eb; }
.rep-actions { margin-bottom: 8px; display: flex; gap: 6px; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rep-table th, .rep-table td { padding: 6px 8px; border-bottom: 1px solid #2a333c; text-align: left; }
.rep-table th { color: #8ba0b3; font-weight: 600; }

#pbBox { margin-top: 8px; }
.pb-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
#pbSlider { flex: 1; }
#pbSpeed {
  background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 4px 6px; font-size: 12px;
}

.poi-item { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid #2a333c; }
.poi-item .picon { font-size: 16px; }
.poi-item .pname { flex: 1; font-size: 13px; }
.poi-icon {
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: rgba(16, 20, 24, 0.85); border: 1px solid #2a333c; border-radius: 50%;
}
#poiForm input[type="text"], #poiForm select {
  width: 100%; margin-bottom: 6px; background: #101418; border: 1px solid #2a333c;
  border-radius: 6px; color: #e8eef2; padding: 7px 9px; font-size: 13px;
}
#poiForm .btnrow { flex-direction: row; }
#poiForm .btnrow button { flex: 1; }
#alertsCard .chk { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
#alertsCard .chk input { flex: 0 0 auto; }
#alertsSave { margin-top: 4px; }
#alertsMsg { font-size: 11px; margin-top: 6px; }

.server-log-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0;
}
.server-log-filters input,
.server-log-filters select {
  background: #101418; border: 1px solid #2a333c; border-radius: 5px;
  color: #e8eef2; padding: 6px 8px; font-size: 12px;
}
.server-log-filters input[type="text"] { min-width: 180px; }
.server-log-wrap { overflow: auto; max-height: 70vh; margin-top: 8px; }
.server-log-table { min-width: 1200px; font-size: 11px; }
.server-log-table td { vertical-align: top; }
.server-log-table th {
  position: sticky; top: 0; z-index: 2; background: #1a2129;
  box-shadow: inset 0 -1px 0 #2a333c;
}
.server-log-table th:first-child,
.server-log-table td:first-child {
  position: sticky; left: 0; background: #1a2129;
  box-shadow: 1px 0 0 #2a333c;
}
.server-log-table th:first-child { z-index: 3; }
.server-log-table td:first-child { z-index: 1; }
.server-log-packet, .server-log-event { width: 30ch; max-width: 30ch; white-space: normal; word-break: break-word; }
.server-log-table code {
  display: block; max-width: 380px; white-space: pre-wrap;
  word-break: break-all; font-size: 10px; color: #93c5fd;
}

.all-tracker-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid #1e293b; font-size: 13px; flex-wrap: wrap;
}
.all-tracker-row:last-child { border-bottom: 0; }
.assign-sel {
  background: #101418; border: 1px solid #2a333c; border-radius: 4px;
  color: #e8eef2; padding: 3px 6px; font-size: 12px; margin-left: auto;
}
.owner-tag {
  background: #1e3a5f; color: #93c5fd; padding: 1px 8px; border-radius: 8px;
  font-size: 11px;
}
.owner-tag.none { background: #2a2a2a; color: #6b7280; }

.source-ctrl { display: inline-flex; align-items: center; gap: 3px; margin-left: auto; }
.source-ctrl .source-btn { padding: 3px 6px; font-size: 10px; }
.source-btn.active { background: #2563eb; border-color: #60a5fa; color: #fff; }
.source-state {
  min-width: 38px; text-align: center; padding: 2px 6px; border-radius: 8px;
  font-size: 10px; background: #1e293b; color: #cbd5e1; border: 1px solid #334155;
}
.source-state.count { color: #fbbf24; border-color: #6b5a1e; }
.source-state.bin { color: #93c5fd; border-color: #1d4ed8; }
.source-state.txt { color: #86efac; border-color: #166534; }

/* ─── Tracker list extras ───────────────────────────────────────────────── */
.user-filter { margin-bottom: 8px; }
.user-filter select {
  width: 100%; background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 6px 8px; font-size: 12px;
}

.map-tools {
  position: absolute;
  top: 90px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.map-tools .layer-btn { min-width: 78px; text-align: center; }
.mobile-panel-bar { display: none; }

@media (max-width: 800px) {
  #appMain { height: 100vh; height: 100dvh; }
  main { position: relative; display: block; overflow: hidden; }
  .map-wrap { position: absolute; inset: 0; }
  #map { height: 100%; min-height: 0; }
  aside {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    width: 100%;
    max-height: 42vh;
    max-height: 42dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 12px 54px;
    border-left: 0;
    border-top: 1px solid #2a333c;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.45);
    transform: translateY(100%);
    transition: transform 0.25s ease;
  }
  body:not(.mobile-sheet-collapsed) aside { transform: translateY(0); }
  main::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    top: calc(100dvh - 42dvh);
    height: 16px;
    z-index: 1199;
    background: #12181e;
    pointer-events: none;
    display: none;
  }
  body:not(.mobile-sheet-collapsed) main::after { display: block; }
  aside > .card { flex: 0 0 auto; }
  .cal-popup { position: static; margin-top: 8px; }
  .mobile-panel-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    width: 100%;
    height: 42px;
    padding: 0 16px;
    background: #12181e;
    color: #e8eef2;
    border: 0;
    border-top: 1px solid #2a333c;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    touch-action: none;
  }
  .mobile-panel-bar:hover { background: #12181e; }
  .mobile-panel-bar .sheet-grip {
    position: absolute;
    top: 7px;
    left: 50%;
    width: 42px;
    height: 4px;
    border-radius: 2px;
    background: #4b5563;
    transform: translateX(-50%);
  }
  .mobile-panel-label { flex: 1; padding-top: 7px; }
  .mobile-panel-arrow { padding-top: 0; color: #93c5fd; font-size: 19px; line-height: 1; }
}

/* ─── Help ──────────────────────────────────────────────────────────────── */
.help-panel { scroll-behavior: smooth; }
.help-inner { max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.help-hero h1 { font-size: 24px; margin-bottom: 4px; }
.help-hero p { margin: 4px 0; }
.help-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 14px; }
.help-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #b6c2ce; }
.help-pin {
  width: 24px; height: 24px; flex-shrink: 0; position: relative;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.6);
  display: inline-block; margin: 0 2px 6px 0;
}
.help-pin::after {
  content: ""; position: absolute; width: 8px; height: 8px; top: 50%; left: 50%;
  transform: translate(-50%, -50%); background: #fff; border-radius: 50%;
}
.help-pin.pin-sel { background: #2563eb; }
.help-pin.pin-unsel { background: #eab308; }
.help-pin.pin-nodata { background: #ef4444; }
.help-pin.pin-lost { background: #4b5563; }
.help-suspect { position: relative; width: 34px; height: 30px; flex-shrink: 0; }
.help-suspect .help-pin { position: absolute; left: 3px; top: 4px; margin: 0; }
.help-drop {
  position: absolute; width: 6px; height: 8px; background: #ef4444;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  animation: gpsDrop 1.4s ease-in-out infinite;
}
.help-drop.hd1 { right: 0; top: 0; }
.help-drop.hd2 { left: 0; top: 10px; animation-delay: .45s; }
.help-suspect-dot {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: #fca5a5; animation: gpsDot 1.2s ease-in-out infinite;
}
.help-suspect-dot.hd3 { right: 1px; bottom: 0; animation-delay: .3s; }

.help-toc { background: #171d23; border: 1px solid #2a333c; border-radius: 10px; padding: 16px; }
.help-toc h2 { font-size: 16px; margin-bottom: 10px; }
.help-toc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 22px; }
.help-toc a { color: #93c5fd; text-decoration: none; font-size: 13px; padding: 3px 0; display: block; }
.help-toc a:hover { color: #e8eef2; text-decoration: underline; }

.help-sec { background: #171d23; border: 1px solid #2a333c; border-radius: 10px; padding: 18px; scroll-margin-top: 8px; }
.help-sec h2 { font-size: 17px; margin-bottom: 10px; }
.help-sec h3 { font-size: 14px; margin: 16px 0 6px; color: #cbd5e1; }
.help-sec p, .help-sec li { font-size: 13px; line-height: 1.6; color: #b6c2ce; }
.help-sec p { margin: 6px 0; }
.help-sec ul, .help-sec ol { margin: 6px 0 6px 22px; }
.help-sec li { margin: 4px 0; }
.help-sec b { color: #e8eef2; }
.help-sec a { color: #93c5fd; }

.help-note { border-left: 3px solid #2563eb; background: #122033; padding: 8px 12px; border-radius: 0 6px 6px 0; margin: 12px 0; font-size: 13px; line-height: 1.55; color: #b6c2ce; }
.help-note a { color: #ffffff; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.help-warn { border-left: 3px solid #f59e0b; background: #2a2112; padding: 8px 12px; border-radius: 0 6px 6px 0; margin: 12px 0; font-size: 13px; line-height: 1.55; color: #f3d9a4; }

.help-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.help-btn {
  background: #1e293b; border: 1px solid #2a333c; color: #e8eef2;
  padding: 4px 9px; font-size: 11px; border-radius: 4px; display: inline-block;
  text-decoration: none;
}
.help-btn:hover { background: #334155; }
.help-btn.primary { color: #93c5fd; border-color: #2563eb; }
.help-btn.danger { color: #fca5a5; border-color: #7f1d1d; }

.help-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.help-table th, .help-table td { border-bottom: 1px solid #2a333c; padding: 6px 8px; text-align: left; vertical-align: top; }
.help-table th { color: #8ba0b3; font-weight: 600; }
.help-table tr:last-child td { border-bottom: 0; }

.help-code {
  display: block; background: #0c1014; border: 1px solid #2a333c; border-radius: 6px;
  padding: 8px 10px; font-family: Consolas, "Courier New", monospace; font-size: 12px;
  color: #93c5fd; margin: 6px 0; overflow-x: auto; white-space: pre-wrap;
}
code { background: #0c1014; border: 1px solid #2a333c; border-radius: 4px; padding: 1px 5px; font-size: 12px; color: #93c5fd; }

.help-fig { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.help-fig .item { background: #101418; border: 1px solid #2a333c; border-radius: 8px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; min-width: 210px; }
.help-fig .item .txt { font-size: 12px; color: #b6c2ce; line-height: 1.4; }
.help-fig .item .txt b { display: block; color: #e8eef2; font-size: 13px; }

.help-mock { background: #101418; border: 1px solid #2a333c; border-radius: 8px; padding: 10px; margin: 10px 0; }
.help-mock .tracker-btn { margin: 0; }
.help-mock .kv td { font-size: 12px; }
.help-mock .kv td:first-child { color: #8ba0b3; }

.help-state { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; font-size: 13px; color: #b6c2ce; line-height: 1.5; }
.help-state .dot { margin-top: 6px; }
.help-top-btn {
  position: fixed; right: 22px; bottom: 22px; z-index: 4000;
  width: 40px; height: 40px; border-radius: 50%;
  background: #1e293b; border: 1px solid #2a333c; color: #93c5fd;
  font-size: 18px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.help-top-btn:hover { background: #334155; }

@media (max-width: 800px) {
  header h1 { font-size: 14px; line-height: 1.2; }
  
.admin-nav { flex-wrap: wrap; overflow-x: visible; padding: 0 8px; }
  .nav-btn { flex: 0 0 auto; padding: 8px 10px; font-size: 12px; }
  .help-toc-grid { grid-template-columns: 1fr; }
  .help-sec { padding: 14px; }
  .help-inner { gap: 12px; }
  .help-fig .item { min-width: 100%; }
}


/* ─── Modal ─────────────────────────────────────────────────────────────── */
#consentModal { z-index: 10002; }
#consentModal .modal-box a { color: #93c5fd; }
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10001;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 14px;
  background: #171d23;
  border: 1px solid #2a333c;
  border-radius: 10px;
  color: #b6c2ce;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.cookie-banner a { color: #93c5fd; }
.cookie-banner button {
  flex: 0 0 auto;
  padding: 7px 14px;
  border: 1px solid #2563eb;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.cookie-banner button:hover { background: #1d4ed8; }
@media (max-width: 600px) {
  .cookie-banner { flex-direction: column; align-items: stretch; left: 10px; right: 10px; bottom: 10px; }
  .cookie-banner button { width: 100%; }
}
.modal-back {
  position: fixed; inset: 0; z-index: 7000; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal-box {
  background: #1a2129; border: 1px solid #2a333c; border-radius: 10px;
  padding: 18px; width: 360px; max-width: 100%;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.modal-box h2 { font-size: 16px; }
.modal-box input {
  width: 100%; background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 9px 10px; font-size: 14px;
}
.modal-box input:focus { outline: none; border-color: #2563eb; }
.modal-box .btnrow { flex-direction: row; justify-content: flex-end; }
.modal-box #pwMsg { min-height: 18px; font-size: 12px; margin: 0; }
/* ─── Auth / registration ───────────────────────────────────────────────── */
.login-screen { overflow-y: auto; padding: 16px; }
.login-box { margin: auto; }
.auth-switch { margin-top: 10px; font-size: 13px; }
.auth-switch a { color: #93c5fd; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.auth-legal { font-size: 11px; color: #7a8a99; line-height: 1.4; margin: 0; text-align: left; }
.auth-legal a { color: #93c5fd; text-decoration: none; }
.auth-legal a:hover { text-decoration: underline; }
.consent-check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: #b6c2ce;
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
}
.consent-check input { width: 15px; height: 15px; margin-top: 1px; flex: 0 0 auto; }
.consent-check a { color: #93c5fd; text-decoration: none; }
.consent-check a:hover { text-decoration: underline; }
.auth-legal-info {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid #2a333c;
  color: #7a8a99;
  font-size: 10px;
  line-height: 1.5;
  text-align: left;
}
.auth-legal-info a { color: #93c5fd; text-decoration: none; }
.auth-legal-info a:hover { text-decoration: underline; }
.auth-legal-links { margin-top: 3px; }
#registerMsg { min-height: 18px; }

/* ─── Users search / activation ─────────────────────────────────────────── */
#userSearch {
  width: 100%; background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 8px 10px; font-size: 13px; margin-bottom: 8px;
}
#userSearch:focus { outline: none; border-color: #2563eb; }
.user-card-foot { display: flex; justify-content: flex-end; margin-top: 6px; }
.activation-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 8px; white-space: nowrap;
}
.activation-badge.active { background: #14532d; color: #86efac; }
.activation-badge.inactive { background: #450a0a; color: #fca5a5; }
.pw-hint { font-size: 11px; color: #7a8a99; margin: -4px 0 0; text-align: left; }
/* ─── Login journal ─────────────────────────────────────────────────────── */
.journal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.journal-head h2 { margin: 0; }
#journalMsg { font-size: 12px; margin: 0 0 6px; }
.journal-row {
  font-size: 14px; line-height: 1.45; color: #b6c2ce;
  padding: 5px 0; border-bottom: 1px solid #2a333c;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.journal-row:last-child { border-bottom: 0; }
.j-time, .j-sep { color: #8ba0b3; white-space: nowrap; }
.j-ip { color: #e8eef2; }
.j-user { color: #f5d76e; }
.j-action { color: #93c5fd; }
.j-row-reg { --j-accent: #4ade80; }
.j-row-activate { --j-accent: #34d399; }
.j-row-user { --j-accent: #60a5fa; }
.j-row-danger { --j-accent: #f87171; }
.j-row-tracker { --j-accent: #22d3ee; }
.j-row-gps-bad { --j-accent: #f97316; }
.j-row-gps-ok { --j-accent: #fdba74; }
.j-row-security { --j-accent: #fbbf24; }
.j-row-service { --j-accent: #facc15; }
.j-row-message { --j-accent: #f472b6; }
.journal-row.j-payment .j-action { color: #c084fc; font-weight: 700; }
.journal-row.j-row-reg .j-action,
.journal-row.j-row-activate .j-action,
.journal-row.j-row-user .j-action,
.journal-row.j-row-danger .j-action,
.journal-row.j-row-tracker .j-action,
.journal-row.j-row-gps-bad .j-action,
.journal-row.j-row-gps-ok .j-action,
.journal-row.j-row-security .j-action,
.journal-row.j-row-service .j-action,
.journal-row.j-row-message .j-action {
  color: var(--j-accent);
  font-weight: 600;
}

.j-details { color: #b6c2ce; }
.j-ok { color: #86efac; }
.j-no { color: #fca5a5; }
/* Payment / my trackers */
.pay-warning {
  background: #2a2413; border: 1px solid #6b5a1e; color: #fde68a;
  border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.45;
  margin: 4px 0 12px;
}
.pay-tracker {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 14px;
  padding: 12px 0; border-bottom: 1px solid #2a333c;
}
.pay-tracker:last-child { border-bottom: 0; }
.pay-tracker-main { min-width: 0; overflow-wrap: anywhere; }
.pay-status { font-size: 13px; margin: 4px 0; }
.pay-ok { color: #86efac; }
.pay-no { color: #fbbf24; }
.pay-tracker-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.pay-selected { font-weight: 600; color: #e8eef2; margin: 0 0 4px; }
.tariff-list {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px;
}
.tariff-btn {
  background: #101418; border: 1px solid #2a333c; border-radius: 8px;
  color: #e8eef2; padding: 12px 10px; cursor: pointer; text-align: center;
}
.tariff-btn b { display: block; font-size: 16px; margin-bottom: 4px; }
.tariff-btn span { color: #93c5fd; font-size: 13px; }
.tariff-btn:hover { border-color: #2563eb; background: #16202b; }
.tariff-btn:disabled, .mini-btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 700px) {
  .pay-tracker { flex-direction: column; }
  .pay-tracker-actions { align-self: stretch; }
  .tariff-list { grid-template-columns: 1fr; }
}

/* Journal filters / pagination */
.journal-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 6px 0 10px;
}
.journal-filters input,
.journal-filters select {
  background: #101418; border: 1px solid #2a333c; border-radius: 6px;
  color: #e8eef2; padding: 7px 9px; font-size: 13px; min-width: 0;
}
.journal-filters input[type="date"] { width: 145px; }
.journal-filters input[type="text"] { flex: 1 1 180px; }
.journal-filters select { flex: 1 1 190px; }
.journal-filters input:focus,
.journal-filters select:focus { outline: none; border-color: #2563eb; }
.journal-pager {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 8px; border-top: 1px solid #2a333c;
  color: #8ba0b3; font-size: 12px;
}
@media (max-width: 700px) {
  .journal-filters input[type="date"] { width: 100%; flex: 1 1 130px; }
}

/* Admin messages / service days */
#adminMessageText {
  width: 100%; min-height: 74px; resize: vertical;
  background: #101418; border: 1px solid #2a333c; border-radius: 7px;
  color: #e8eef2; padding: 9px 10px; font: inherit; font-size: 13px;
}
#adminMessageText:focus { outline: none; border-color: #2563eb; }
#adminMessageTo { min-width: 180px; }
#adminMessageHistory { max-height: 340px; overflow-y: auto; margin-top: 8px; }
.admin-message-row { padding: 8px 0; border-bottom: 1px solid #2a333c; }
.admin-message-row:last-child { border-bottom: 0; }
.admin-message-meta { font-size: 12px; color: #8ba0b3; margin-bottom: 3px; }
.admin-message-text { font-size: 13px; color: #e8eef2; white-space: pre-wrap; overflow-wrap: anywhere; }
.user-messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.user-message {
  background: #2a2112; border: 1px solid #b45309; border-left: 4px solid #f59e0b;
  border-radius: 9px; padding: 12px 14px; color: #fde68a;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.user-message-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: #fbbf24; margin-bottom: 6px; }
.user-message-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: #fef3c7; margin-bottom: 8px; }
.user-message .mini-btn { background: #92400e; color: #fff; }

/* Payment history */
.pay-history-row { padding: 8px 0; border-bottom: 1px solid #2a333c; font-size: 13px; }
.pay-history-row:last-child { border-bottom: 0; }
.pay-history-row > div { margin: 2px 0; }

/* Help shop link */
.help-shop {
  border-left: 3px solid #3b82f6; background: #0f2238;
  padding: 10px 13px; border-radius: 0 7px 7px 0;
  margin: 10px 0 14px; font-size: 13px; line-height: 1.55; color: #dbeafe;
}
.help-shop a { color: #93c5fd; font-weight: 600; }
.help-shop a:hover { text-decoration: underline; }
