@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

:root {
  --color-bg: #151817;
  --color-surface: #202422;
  --color-surface-raised: #282d2a;
  --color-surface-hover: #303632;
  --color-border: #3a403c;
  --color-border-light: #515953;
  --color-text: #f2f4f1;
  --color-text-secondary: #b6bdb8;
  --color-text-muted: #7f8982;
  --color-primary: #73a886;
  --color-primary-hover: #82b693;
  --color-primary-light: rgba(115, 168, 134, 0.16);
  --color-danger: #db6b68;
  --radius-sm: 3px;
  --radius-md: 5px;
  --radius-lg: 6px;
  --shadow-panel: 0 10px 28px rgba(11, 14, 12, 0.24);
  --transition: 140ms ease;
}

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

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  overflow: hidden;
}

#map {
  position: fixed;
  inset: 0;
  z-index: 1;
}

#loading {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10000;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}

#loading.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 14px;
  color: var(--color-text-secondary);
  font-weight: 500;
}

#filter-panel {
  position: fixed;
  top: 24px;
  left: 24px;
  width: 328px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  z-index: 1000;
  overflow: hidden;
  transition: width var(--transition);
}

#filter-panel.minimized {
  width: auto;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 9px 10px 9px 16px;
  background: var(--color-surface-raised);
  border-bottom: 1px solid var(--color-border);
  cursor: grab;
  user-select: none;
}

.panel-header:active {
  cursor: grabbing;
}

.panel-title {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.panel-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.panel-toggle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.panel-body {
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 19px;
  overflow: visible;
}

[x-collapse] {
  overflow: visible;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0;
}

.filter-range {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-secondary);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 8px 10px 8px 36px;
  background: #191c1b;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 13px;
  color: var(--color-text);
  transition: var(--transition);
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.slider-container {
  height: 5px;
  margin: 7px 4px 4px;
  background: #111412;
  border: 1px solid var(--color-border);
  border-radius: 2px;
  box-shadow: none;
}

.noUi-connect {
  background: var(--color-primary);
  border-radius: 0;
}

.noUi-handle {
  width: 14px !important;
  height: 18px !important;
  right: -7px !important;
  top: -8px !important;
  background: var(--color-surface-raised) !important;
  border: 1px solid #9aa29c !important;
  border-radius: 3px !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35) !important;
  cursor: grab !important;
  transition: border-color 0.15s ease !important;
}

.noUi-handle:hover {
  border-color: var(--color-text) !important;
}

.noUi-handle:active {
  cursor: grabbing !important;
  background: var(--color-primary) !important;
}

.noUi-handle::before,
.noUi-handle::after {
  display: none !important;
}

.noUi-tooltip {
  display: none;
}

.noUi-active .noUi-tooltip {
  display: block;
  background: var(--color-surface) !important;
  border: 1px solid var(--color-border) !important;
  color: var(--color-text) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  padding: 4px 6px !important;
  border-radius: var(--radius-sm) !important;
}

.noUi-pips {
  display: none;
}

.stats-box {
  background: transparent;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stats-label {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.stats-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

.actions-row {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #101512;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-secondary {
  background: transparent;
  border-color: var(--color-border-light);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-surface-hover);
}

.download-wrapper {
  position: relative;
}

.download-wrapper .btn .chevron {
  transition: transform 0.2s ease;
}

.download-wrapper .btn .chevron.rotated {
  transform: rotate(180deg);
}

.download-menu {
  position: fixed;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  z-index: 10000;
  min-width: 200px;
}

.download-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--color-text);
  text-decoration: none;
  transition: var(--transition);
}

.download-option:hover {
  background: var(--color-surface-hover);
}

.download-option:not(:last-child) {
  border-bottom: 1px solid var(--color-border);
}

.download-option svg {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.download-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.download-title {
  font-size: 13px;
  font-weight: 600;
}

.download-desc {
  font-size: 11px;
  color: var(--color-text-muted);
}

.leaflet-container {
  background: var(--color-bg);
  font-family: inherit;
}

.leaflet-bar {
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 4px 12px rgba(11, 14, 12, 0.2) !important;
  overflow: hidden;
}

.leaflet-bar a,
.leaflet-bar a:hover {
  width: 30px;
  height: 30px;
  line-height: 29px;
  background: var(--color-surface);
  border-bottom-color: var(--color-border);
  color: var(--color-text);
}

.leaflet-bar a:hover {
  background: var(--color-surface-hover);
}

.leaflet-control-attribution {
  background: rgba(242, 244, 241, 0.88) !important;
  color: #353b37;
}

.leaflet-control-attribution a {
  color: #315d43;
}

.leaflet-popup-content-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
}

.leaflet-popup-tip {
  background: var(--color-surface);
}

.leaflet-popup-content {
  color: var(--color-text);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.popup-content {
  max-height: 320px;
  overflow-y: auto;
  padding: 13px 14px;
}

.popup-header {
  padding-bottom: 9px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
}

.popup-address {
  font-weight: 600;
  font-size: 13px;
  color: var(--color-text);
  margin-bottom: 4px;
}

.popup-location {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.popup-person {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border);
}

.popup-person:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.popup-person-name {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 3px;
}

.popup-person-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}

.popup-shipments {
  max-height: 160px;
  overflow-y: auto;
}

.popup-shipment {
  padding: 7px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 12px;
}

.popup-shipment:last-child {
  border-bottom: none;
}

.popup-shipment-order {
  font-weight: 600;
  margin-bottom: 2px;
}

.popup-shipment-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
}

.marker-cluster-small {
  background-color: rgba(136, 181, 151, 0.5);
}

.marker-cluster-small div {
  background-color: #8ab59a;
  color: #152019;
}

.marker-cluster-medium {
  background-color: rgba(217, 184, 107, 0.5);
}

.marker-cluster-medium div {
  background-color: #d8b66e;
  color: #241e12;
}

.marker-cluster-large {
  background-color: rgba(199, 122, 109, 0.5);
}

.marker-cluster-large div {
  background-color: #c77a6d;
  color: #261412;
}

.marker-cluster {
  background-clip: padding-box;
  border-radius: 20px;
}

.marker-cluster div {
  width: 30px;
  height: 30px;
  margin-left: 5px;
  margin-top: 5px;
  text-align: center;
  border-radius: 15px;
  font: 600 12px "Inter", sans-serif;
  font-variant-numeric: tabular-nums;
}

.marker-cluster span {
  line-height: 30px;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

@media (max-width: 768px) {
  #filter-panel {
    top: 12px;
    left: 12px;
    width: calc(100vw - 24px);
    max-width: 328px;
  }
}

@media (max-width: 380px) {
  #filter-panel {
    width: calc(100vw - 16px);
    top: 8px;
    left: 8px;
  }

  .panel-body {
    padding: 16px 14px 14px;
  }

  .search-input {
    font-size: 12px;
  }
}
