.sightings-page [hidden] { display: none !important; }

.sightings-page {
  --s-current: #198754;
  --s-gps: #2563eb;
  --s-qr: #f97316;
  --s-scooter-end: #8b5cf6;
  --s-client-end: #dc2626;
  max-width: 1900px;
}
.source-current { --source-color: var(--s-current); }
.source-scooter-gps { --source-color: var(--s-gps); }
.source-client-qr { --source-color: var(--s-qr); }
.source-scooter-end { --source-color: var(--s-scooter-end); }
.source-client-end { --source-color: var(--s-client-end); }
.source-unknown { --source-color: #64748b; }

.sightings-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.sightings-hero .subhead { margin-bottom: 0; }
.mobile-filter-toggle { display: none; }

.preset-strip {
  display: grid;
  grid-template-columns: auto minmax(180px, 320px) auto auto minmax(180px, 1fr);
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-sm);
}

.preset-strip label {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.preset-strip select {
  min-height: 38px;
  padding: 7px 34px 7px 10px;
  font-size: 12px;
}

.button.compact {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 12px;
}

.auto-status {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.auto-status::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #64b879;
  box-shadow: 0 0 0 4px rgba(100, 184, 121, .12);
  content: "";
}

.sightings-page .sightings-layout {
  display: grid;
  grid-template-columns: minmax(340px, 380px) minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.sightings-page .controls {
  position: sticky;
  top: 18px;
  max-height: calc(100dvh - 36px);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.controls-head {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
}

.controls-head h2,
.controls-head p { margin: 0; }
.controls-head .step {
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.filter-close { display: none; }
.sightings-page .controls form { padding: 0 20px 22px; }

.filter-section {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.filter-section h3,
.save-filter h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
}

.filter-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.filter-title-row output,
.filter-title-row > span {
  color: var(--green);
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.battery-range {
  display: grid;
  gap: 10px;
  margin-top: 7px;
}

.battery-slider-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 9px;
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 750;
}

.battery-slider-row input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.battery-slider-row input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 999px;
  background: #d6e4dc;
  box-shadow: inset 0 1px 2px rgba(15, 80, 61, .12);
}

.battery-slider-row input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -7px;
  appearance: none;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 2px 8px rgba(15, 80, 61, .32), 0 0 0 1px rgba(15, 80, 61, .18);
}

.battery-slider-row input[type="range"]::-moz-range-track {
  height: 7px;
  border-radius: 999px;
  background: #d6e4dc;
  box-shadow: inset 0 1px 2px rgba(15, 80, 61, .12);
}

.battery-slider-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 2px 8px rgba(15, 80, 61, .32), 0 0 0 1px rgba(15, 80, 61, .18);
}

.battery-slider-row input[type="range"]:focus-visible {
  outline: 2px solid #76bca2;
  outline-offset: 2px;
  border-radius: 999px;
}

.battery-slider-row input[type="range"]:disabled { cursor: wait; opacity: .55; }
.battery-slider-row output {
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.source-all,
.source-option,
.filter-switch {
  cursor: pointer;
  user-select: none;
}

.source-all {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 700;
}

.source-options { display: grid; gap: 6px; }
.source-option {
  display: grid;
  min-height: 40px;
  grid-template-columns: 18px 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--source-color, #64748b);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}
.source-option:hover { background: var(--surface-soft); }
.source-option i {
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background-color: var(--source-color, #64748b);
  box-shadow: 0 0 0 1px var(--source-color, #64748b), 0 2px 5px rgba(13, 37, 29, .16);
}
.source-options.is-disabled .source-option { cursor: not-allowed; background: #f7f9f7; }
.source-options.is-disabled .source-option input,
.source-options.is-disabled .source-option span { opacity: .42; }
.source-options.is-disabled .source-option i { opacity: 1; }
.special-filters { display: grid; gap: 7px; }
.special-filters h3 { margin-bottom: 4px; }
.filter-switch {
  display: grid;
  min-height: 54px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
}
.filter-switch:hover { background: var(--surface-soft); }
.filter-switch:has(input:checked) {
  border-color: #b9d7c8;
  background: #edf7f1;
}
.filter-switch input { margin-top: 2px; }
.filter-switch strong,
.filter-switch small { display: block; }
.filter-switch strong { font-size: 12px; }
.filter-switch small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.route-filter { border-bottom: 0; }
.route-filter fieldset {
  display: grid;
  gap: 7px;
  margin: 10px 0 0 30px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}
.route-filter fieldset label { font-size: 11px; font-weight: 700; }
.route-filter input,
.route-filter select { width: 100%; }

.apply-button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}
.apply-button i { font-size: 18px; font-style: normal; }

.save-filter {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.save-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
.save-row input { min-width: 0; }
.save-row .button { min-height: 44px; padding: 8px 12px; }
#preset-status { min-height: 18px; margin: 7px 0 0; color: var(--muted); font-size: 10px; }

.map-column { min-width: 0; }
.map-panel { overflow: hidden; }
.map-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.map-heading h2,
.map-heading p { margin: 0; }
.map-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.map-shell { position: relative; isolation: isolate; }
.sightings-page #sightings-map {
  height: min(70dvh, 760px);
  min-height: 570px;
  background: #e5ebe3;
}

.map-vehicle-search {
  position: absolute;
  z-index: 610;
  top: 12px;
  right: 12px;
  width: min(286px, calc(100% - 78px));
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 28px rgba(20, 42, 34, .18);
  backdrop-filter: blur(12px);
}
.map-vehicle-search form { display: flex; gap: 6px; }
.map-vehicle-search input {
  min-width: 0;
  min-height: 38px;
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #bfd0c6;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
}
.map-vehicle-search button {
  min-height: 38px;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
.map-vehicle-search p {
  margin: 6px 3px 1px;
  color: var(--green);
  font-size: 10px;
  line-height: 1.35;
}
.map-vehicle-search p.error { color: #a13f2a; }
.map-source-legend {
  position: absolute;
  z-index: 500;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: flex;
  width: fit-content;
  max-width: calc(100% - 28px);
  align-items: center;
  gap: 7px 13px;
  padding: 8px 11px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 11px;
  background: rgba(255, 255, 255, .84);
  box-shadow: 0 7px 24px rgba(20, 42, 34, .12);
  font-size: 10px;
  white-space: nowrap;
  backdrop-filter: blur(13px);
}
.map-source-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-source-legend i { width: 8px; height: 8px; border-radius: 50%; background-color: var(--source-color, #64748b); }

.vehicle-focus {
  position: absolute;
  z-index: 620;
  top: 66px;
  left: 50%;
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 14px;
  border: 1px solid rgba(23, 107, 82, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 10px 32px rgba(12, 49, 37, .18);
  font-size: 12px;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}
.vehicle-focus button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #e6f1eb;
  color: var(--green);
  font-size: 20px;
  cursor: pointer;
}

.map-loading {
  position: absolute;
  z-index: 700;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  background: rgba(239, 246, 241, .72);
  color: var(--ink-strong);
  text-align: center;
  backdrop-filter: blur(4px) saturate(.7);
}
.map-loading[hidden] { display: none; }
.map-loading strong { margin-top: 12px; font-size: 16px; }
.map-loading small { margin-top: 4px; color: var(--muted); }
.spinner {
  width: 38px;
  height: 38px;
  border: 4px solid rgba(23, 107, 82, .16);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: sightings-spin .75s linear infinite;
}
@keyframes sightings-spin { to { transform: rotate(360deg); } }

.sighting-rank-icon { background: transparent !important; border: 0 !important; }
.sighting-rank-marker {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background-color: var(--source-color, #64748b);
  box-shadow: 0 2px 8px rgba(13, 37, 29, .32);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

.sighting-popup { min-width: 190px; }
.sighting-popup .popup-source { margin: 0; font-weight: 750; }
.sighting-popup .popup-time { margin: 5px 0 10px; color: #617269; font-size: 11px; }
.sighting-popup .popup-vehicle {
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: #e7f3ed;
  color: #125d47;
  font-weight: 750;
  cursor: pointer;
}

.message { white-space: pre-line; }
.message.error { padding: 12px 14px; border-radius: 10px; background: #fff0e7; color: #93451e; }
.route-result,
.export-panel,
.points-panel { margin-top: 16px; padding: 18px 20px; }
summary { cursor: pointer; font-weight: 700; }
.export-actions { display: flex; flex-wrap: wrap; gap: 9px; }
#geojson {
  width: 100%;
  height: 200px;
  margin-top: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}
#point-list { max-height: 420px; overflow: auto; }
.point-row {
  display: grid;
  width: 100%;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.point-row .point-rank {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background-color: var(--source-color, #64748b);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.point-row strong,
.point-row small { display: block; }
.point-row small { color: var(--muted); font-size: 10px; }
.point-row > em { color: var(--muted); font-size: 11px; font-style: normal; }
#route-stops { max-height: 300px; overflow: auto; padding-left: 24px; }
.route-stop { padding: 5px; border: 0; background: none; color: var(--green); text-align: left; cursor: pointer; }
.filter-scrim { display: none; }

@media (max-width: 1180px) {
  .sightings-page .sightings-layout { grid-template-columns: 320px minmax(0, 1fr); gap: 16px; }
  .sightings-page .controls form { padding-right: 16px; padding-left: 16px; }
  .controls-head { padding-right: 16px; padding-left: 16px; }
  .preset-strip { grid-template-columns: auto minmax(150px, 1fr) auto auto; }
  .auto-status { grid-column: 2 / -1; justify-self: start; }
}

@media (max-width: 900px) {
  .sightings-page [hidden] { display: none !important; }

.sightings-page { padding-right: 12px !important; padding-left: 12px !important; }
  .sightings-hero { align-items: center; margin-bottom: 14px; }
  .sightings-hero h1 { font-size: clamp(26px, 7vw, 34px); }
  .sightings-hero .subhead { display: none; }
  .mobile-filter-toggle {
    display: inline-flex;
    min-height: 44px;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    padding: 9px 13px;
    border: 1px solid #bcd0c4;
    border-radius: 12px;
    background: #fff;
    color: var(--green);
    font-weight: 750;
    cursor: pointer;
  }
  .preset-strip {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    margin-bottom: 10px;
    padding: 8px;
  }
  .preset-strip label { display: none; }
  .preset-strip select { width: 100%; }
  #delete-preset { display: none; }
  #copy-link { grid-column: 2; grid-row: 1; }
  .auto-status { grid-column: 1 / -1; font-size: 10px; }
  .sightings-page .sightings-layout { display: block; }
  .sightings-page .controls {
    position: fixed;
    z-index: 1600;
    inset: auto 0 0;
    max-height: min(88dvh, 780px);
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 60px rgba(8, 31, 23, .28);
    transform: translateY(105%);
    transition: transform .25s ease;
  }
  .sightings-filters-open .sightings-page .controls { transform: translateY(0) !important; transition: none; }
  .sightings-filters-open { overflow: hidden; }
  .controls-head { min-height: 64px; }
  .filter-close {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border: 0;
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--ink);
    font-size: 24px;
    cursor: pointer;
  }
  .filter-scrim {
    position: fixed;
    z-index: 1550;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(7, 25, 19, .48);
    backdrop-filter: blur(2px);
  }
  .filter-scrim[hidden] { display: none; }
  .sightings-page #sightings-map { height: calc(100dvh - 245px); min-height: 500px; }
  .map-source-legend { right: 8px; bottom: 8px; left: 8px; max-width: calc(100% - 16px); }
  .map-heading { min-height: 60px; padding: 12px 14px; }
  .map-heading .button { min-height: 36px; }
  .map-vehicle-search { top: 8px; right: 8px; width: min(280px, calc(100% - 66px)); }
  .vehicle-focus { top: 64px; max-width: calc(100% - 24px); }
}

@media (max-width: 560px) {
  .sightings-hero .eyebrow { margin-bottom: 4px; font-size: 8px; }
  .sightings-hero h1 { font-size: 25px; }
  .mobile-filter-toggle {
    width: 44px;
    padding: 0;
    justify-content: center;
    font-size: 0;
  }
  .mobile-filter-toggle span { font-size: 20px; }
  #fit { padding-right: 10px; padding-left: 10px; font-size: 0; }
  #fit::before { content: "Все"; font-size: 11px; }
  .preset-strip .button { padding: 7px 9px; font-size: 0; }
  .preset-strip .button::before { content: "Ссылка"; font-size: 11px; }
  .sightings-page #sightings-map { height: calc(100dvh - 225px); min-height: 430px; }
  .map-source-legend { scrollbar-width: none; }
  .map-source-legend::-webkit-scrollbar { display: none; }
  .route-result,
  .export-panel,
  .points-panel { padding: 15px; }
  .export-actions .button { width: 100%; }
  .save-row { grid-template-columns: 1fr; }
  .save-row .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.5s; }
}
