* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #06090f;
  --surface: rgba(11, 17, 28, 0.74);
  --surface-strong: rgba(14, 22, 36, 0.9);
  --border: rgba(123, 150, 184, 0.24);
  --text: #f2f7ff;
  --muted: #95a2b8;
  --good: #2ed07f;
  --warn: #f5ae2a;
  --bad: #ff5f5f;
  --accent: #45d4d0;
  --accent-2: #79b8ff;
}

body {
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  background:
    radial-gradient(1100px 550px at 10% -10%, #173a4a 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 0%, #1c324b 0%, transparent 65%),
    linear-gradient(145deg, #080d16 0%, #04060b 70%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bg-orb {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.35;
  z-index: 0;
}

.bg-orb-a {
  width: 360px;
  height: 360px;
  background: #2eb2a6;
  top: -120px;
  left: -80px;
}

.bg-orb-b {
  width: 300px;
  height: 300px;
  background: #3679bb;
  right: -80px;
  bottom: 120px;
}

header {
  margin: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  background: linear-gradient(110deg, rgba(13, 20, 33, 0.84), rgba(9, 14, 24, 0.66));
  backdrop-filter: blur(14px);
  border-radius: 16px;
  z-index: 1000;
  animation: slide-in 420ms ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.logo-subtitle {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #38dccb, #2f7ecb);
  box-shadow: 0 10px 24px rgba(53, 181, 223, 0.28);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.transport-chip {
  border: 1px solid rgba(121, 184, 255, 0.55);
  background: rgba(50, 90, 130, 0.35);
  color: #a8d1ff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
}

#last-update {
  color: var(--muted);
  font-size: 12px;
  padding: 6px 0;
}

.btn {
  border: 1px solid rgba(94, 119, 147, 0.55);
  background: linear-gradient(135deg, rgba(25, 38, 58, 0.78), rgba(16, 24, 37, 0.68));
  color: #d8e6f7;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(128, 173, 215, 0.85);
  background: linear-gradient(135deg, rgba(33, 50, 76, 0.8), rgba(20, 31, 47, 0.76));
}

.btn.disabled,
.btn[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
}

.btn.active {
  color: #041f12;
  border-color: rgba(96, 255, 162, 0.85);
  background: linear-gradient(135deg, #50df91, #40c7ae);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  background: rgba(53, 62, 78, 0.45);
}

.status-pill.online { border-color: rgba(55, 215, 129, 0.45); color: var(--good); background: rgba(20, 49, 35, 0.7); }
.status-pill.stale { border-color: rgba(245, 174, 42, 0.5); color: var(--warn); background: rgba(57, 42, 14, 0.72); }
.status-pill.offline { border-color: rgba(255, 95, 95, 0.45); color: var(--bad); background: rgba(58, 24, 28, 0.72); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.dot.pulse { animation: pulse 1.5s infinite; }

#map-wrap {
  position: relative;
  flex: 1;
  margin: 0 14px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  z-index: 1;
}

.sms-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100% - 32px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(110deg, rgba(10, 18, 31, 0.94), rgba(8, 13, 22, 0.9));
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  z-index: 920;
}

.sms-panel.hidden {
  display: none;
}

.sms-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sms-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sms-panel-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.sms-auth {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.sms-auth input,
.sms-field input,
.sms-field select {
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(94, 119, 147, 0.55);
  background: rgba(12, 21, 34, 0.9);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
}

.sms-response {
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(94, 119, 147, 0.35);
  background: rgba(14, 21, 33, 0.76);
  padding: 10px 12px;
  color: #d6e8fb;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.sms-response.error {
  border-color: rgba(255, 95, 95, 0.45);
  color: #ffc4c4;
}

.sms-response.success {
  border-color: rgba(46, 208, 127, 0.45);
  color: #c8ffe0;
}

.sms-groups {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}

.sms-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sms-group-title {
  font-size: 12px;
  color: #9ec8ff;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sms-command-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(94, 119, 147, 0.3);
  background: rgba(13, 21, 33, 0.7);
}

.sms-command-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.sms-command-label {
  font-size: 14px;
  font-weight: 700;
}

.sms-command-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.sms-danger {
  color: #ff9e9e;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sms-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sms-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.sms-actions {
  display: flex;
  justify-content: flex-end;
}

#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

.info-panel {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  min-width: 450px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  background: linear-gradient(110deg, var(--surface), var(--surface-strong));
  backdrop-filter: blur(12px);
  border-radius: 14px;
  box-shadow: 0 10px 35px rgba(5, 8, 13, 0.6);
  z-index: 900;
  animation: rise 450ms ease;
}

.interaction-hint {
  position: absolute;
  left: 16px;
  bottom: 108px;
  z-index: 910;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(100, 175, 230, 0.45);
  background: rgba(10, 25, 42, 0.86);
  color: #d5e9ff;
  font-size: 12px;
  box-shadow: 0 12px 28px rgba(4, 13, 23, 0.42);
  animation: slide-in-left 280ms ease;
}

.interaction-hint.hidden {
  display: none;
}

.hint-close {
  border: 1px solid rgba(121, 184, 255, 0.6);
  border-radius: 8px;
  background: rgba(33, 66, 100, 0.65);
  color: #d5e9ff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  cursor: pointer;
}

.hint-close:hover {
  background: rgba(46, 84, 124, 0.9);
}

.info-item {
  min-width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.info-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.35rem;
  font-weight: 700;
}

.info-value.speed {
  color: #44dca0;
}

.info-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.divider {
  width: 1px;
  height: 32px;
  background: rgba(132, 154, 181, 0.3);
}

.coord-box {
  font-size: 11px;
  line-height: 1.9;
  color: #a4b2c6;
}

.coord-box span {
  color: #ebf5ff;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.alert-toast {
  position: fixed;
  right: 16px;
  top: 86px;
  transform: translateX(130%);
  transition: transform 250ms ease;
  background: rgba(17, 31, 27, 0.92);
  border: 1px solid rgba(46, 208, 127, 0.55);
  border-radius: 12px;
  box-shadow: 0 16px 30px rgba(6, 22, 16, 0.45);
  color: #67f0ae;
  padding: 10px 14px;
  z-index: 2000;
}

.alert-toast.show { transform: translateX(0); }

.car-pin {
  font-size: 28px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
  transform: translate(-50%, -50%);
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.25); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 1080px) {
  header {
    margin: 10px;
    border-radius: 14px;
  }

  #map-wrap {
    margin: 0 10px 10px;
  }

  .header-right {
    justify-content: flex-start;
  }

  .info-panel {
    width: calc(100% - 20px);
    min-width: 0;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
  }

  .interaction-hint {
    left: 10px;
    right: 10px;
    bottom: 122px;
    max-width: none;
    justify-content: space-between;
  }

  .info-item {
    min-width: auto;
  }

  .divider {
    display: none;
  }

  .sms-panel {
    width: calc(100% - 20px);
    left: 10px;
    right: 10px;
    top: 10px;
    max-height: calc(100% - 20px);
  }
}

@media (max-width: 720px) {
  .logo-subtitle {
    display: none;
  }

  #last-update {
    width: 100%;
    order: 4;
  }

  .btn,
  .transport-chip,
  .status-pill {
    font-size: 12px;
  }

  .btn {
    min-height: 42px;
    padding: 10px 13px;
  }

  .leaflet-control-zoom a {
    width: 42px !important;
    height: 42px !important;
    line-height: 40px !important;
  }

  .coord-box {
    font-size: 10px;
  }

  .sms-fields {
    grid-template-columns: 1fr;
  }
}
