:root {
  color-scheme: dark;
  --bg: #05070b;
  --panel: rgba(12, 16, 23, 0.9);
  --panel-strong: rgba(18, 24, 33, 0.96);
  --line: rgba(147, 168, 190, 0.14);
  --ink: #eef3f8;
  --muted: #9aa8b8;
  --accent: #ff8b38;
  --accent-2: #f6b94f;
  --verified: #42c97c;
  --source: #e6b24d;
  --manual: #ff6f61;
  --approx: #7e8c9c;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 139, 56, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(57, 101, 141, 0.16), transparent 26%),
    linear-gradient(180deg, rgba(12, 18, 26, 0.35), rgba(2, 4, 8, 0.85)),
    var(--bg);
  color: var(--ink);
}

body {
  min-height: 100vh;
  overflow: hidden;
}

a {
  color: var(--accent-2);
  text-decoration-color: rgba(246, 185, 79, 0.4);
}

button,
input,
select,
textarea {
  font: inherit;
  font-size: 16px;
}

.shell {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100vh;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}

.sidebar,
.workspace {
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.workspace {
  display: grid;
  grid-template-rows: minmax(420px, 1fr) minmax(300px, 380px);
  gap: 14px;
}

.mobile-switcher {
  display: none;
}

.panel,
.map-panel,
.sidebar-head {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.sidebar-head,
.panel,
.detail-panel {
  padding: 18px;
}

.sidebar-head {
  background:
    linear-gradient(160deg, rgba(20, 26, 36, 0.98), rgba(12, 16, 23, 0.9));
}

.mode-banner {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.mode-description {
  font-size: 0.88rem;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 10px;
}

.subhead,
.muted {
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(130, 155, 182, 0.18);
  background: rgba(7, 11, 16, 0.92);
  padding: 10px 12px;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
  min-height: 132px;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(154, 168, 184, 0.72);
}

body[data-app-mode="snapshot"] .field input[readonly],
body[data-app-mode="snapshot"] .field textarea[readonly],
body[data-app-mode="snapshot"] .field select:disabled {
  background: rgba(10, 15, 21, 0.84);
  color: rgba(238, 243, 248, 0.88);
  border-color: rgba(130, 155, 182, 0.12);
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip,
.badge,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 7px 11px;
  border: 1px solid rgba(130, 155, 182, 0.15);
  background: rgba(10, 15, 21, 0.84);
  color: var(--ink);
  font-size: 0.82rem;
}

.filter-chip button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.filter-chip.is-off {
  opacity: 0.45;
}

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

.stat-card {
  border-radius: 18px;
  padding: 12px;
  background: rgba(8, 12, 17, 0.84);
  border: 1px solid rgba(130, 155, 182, 0.12);
}

.stat-card strong {
  display: block;
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.list-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

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

.places-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
}

.place-card {
  border-radius: 18px;
  border: 1px solid rgba(130, 155, 182, 0.12);
  background: rgba(9, 13, 18, 0.84);
  padding: 12px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.place-card:hover,
.place-card.is-selected {
  transform: translateY(-1px);
  border-color: rgba(255, 139, 56, 0.32);
  background: rgba(18, 24, 33, 0.96);
}

.place-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.place-card h3 {
  font-size: 0.96rem;
  line-height: 1.15;
}

.place-card p {
  font-size: 0.86rem;
  color: var(--muted);
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.category-pill {
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(255, 139, 56, 0.14);
  color: #ffc98d;
  font-size: 0.76rem;
}

.map-panel {
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 420px;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}

.review-form {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.summary-card {
  border-radius: 18px;
  padding: 14px;
  background: rgba(8, 12, 17, 0.88);
  border: 1px solid rgba(130, 155, 182, 0.12);
}

.link-row {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.grid.two-up {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.meta-card {
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(8, 12, 17, 0.84);
  border: 1px solid rgba(130, 155, 182, 0.12);
}

.meta-card span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #160b02;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

button.secondary {
  background: rgba(79, 96, 112, 0.22);
  color: var(--ink);
}

.hidden {
  display: none;
}

.empty-state {
  display: grid;
  place-items: center;
  flex: 1;
  border-radius: 18px;
  border: 1px dashed rgba(130, 155, 182, 0.24);
  color: var(--muted);
  background: rgba(7, 11, 16, 0.54);
}

.badge[data-status="exact_verified"],
.dot[data-status="exact_verified"] {
  background: rgba(45, 125, 70, 0.14);
  color: var(--verified);
}

.badge[data-status="exact_source_only"],
.dot[data-status="exact_source_only"] {
  background: rgba(179, 103, 17, 0.16);
  color: var(--source);
}

.badge[data-status="manual_needed"],
.dot[data-status="manual_needed"] {
  background: rgba(176, 56, 44, 0.14);
  color: var(--manual);
}

.badge[data-status="approximate"],
.dot[data-status="approximate"] {
  background: rgba(96, 112, 126, 0.14);
  color: var(--approx);
}

.places-list,
.detail-panel {
  scrollbar-color: rgba(126, 140, 156, 0.45) rgba(8, 12, 17, 0.4);
}

.places-list::-webkit-scrollbar,
.detail-panel::-webkit-scrollbar {
  width: 10px;
}

.places-list::-webkit-scrollbar-track,
.detail-panel::-webkit-scrollbar-track {
  background: rgba(8, 12, 17, 0.45);
  border-radius: 999px;
}

.places-list::-webkit-scrollbar-thumb,
.detail-panel::-webkit-scrollbar-thumb {
  background: rgba(126, 140, 156, 0.5);
  border-radius: 999px;
}

.leaflet-container {
  background:
    radial-gradient(circle at top, rgba(27, 39, 54, 0.55), transparent 40%),
    #081018;
}

.leaflet-tile-pane {
  filter: brightness(0.55) invert(1) contrast(2.1) hue-rotate(188deg) saturate(0.34);
}

.leaflet-control-zoom a,
.leaflet-bar a {
  background: rgba(10, 14, 20, 0.88);
  color: var(--ink);
  border-bottom-color: rgba(130, 155, 182, 0.14);
}

.leaflet-control-zoom a:hover,
.leaflet-bar a:hover {
  background: rgba(18, 24, 33, 0.98);
  color: var(--accent-2);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(10, 14, 20, 0.94);
  color: var(--ink);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.leaflet-popup-content {
  color: var(--ink);
}

.leaflet-control-attribution {
  background: rgba(10, 14, 20, 0.74);
  color: var(--muted);
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .workspace {
    grid-template-rows: minmax(420px, 56vh) auto;
  }

  .sidebar,
  .workspace {
    overflow: visible;
  }
}

@media (max-width: 820px) {
  body {
    min-height: 100svh;
    padding-bottom: calc(100px + var(--safe-bottom));
    overflow-x: hidden;
  }

  .shell {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
    padding:
      calc(10px + var(--safe-top))
      10px
      calc(18px + var(--safe-bottom));
    gap: 12px;
  }

  .workspace {
    order: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: visible;
  }

  .sidebar {
    order: 2;
    gap: 12px;
    overflow: visible;
  }

  .panel,
  .map-panel,
  .sidebar-head {
    border-radius: 20px;
  }

  .sidebar-head,
  .panel,
  .detail-panel {
    padding: 16px;
  }

  .map-panel {
    position: sticky;
    top: calc(10px + var(--safe-top));
    z-index: 20;
  }

  #map {
    height: clamp(310px, 46svh, 430px);
    min-height: clamp(310px, 46svh, 430px);
  }

  .mobile-switcher {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + var(--safe-bottom));
    z-index: 40;
    padding: 10px;
    border-radius: 999px;
    border: 1px solid rgba(130, 155, 182, 0.16);
    background: rgba(7, 11, 16, 0.92);
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
  }

  .mobile-switcher-button {
    min-height: 52px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
  }

  .mobile-switcher-button.is-active {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #160b02;
  }

  .mobile-switcher-button:disabled {
    opacity: 0.42;
    cursor: default;
  }

  body[data-mobile-panel="browse"] .detail-panel {
    display: none;
  }

  body[data-mobile-panel="review"] .sidebar {
    display: none;
  }

  .controls,
  .review-form {
    gap: 12px;
  }

  .status-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-chip {
    justify-content: space-between;
    min-height: 52px;
    padding: 10px 12px;
  }

  .stats,
  .grid.two-up,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .places-list {
    gap: 10px;
    overflow: visible;
    padding-right: 0;
  }

  .place-card {
    padding: 14px;
    border-radius: 20px;
  }

  .place-card h3 {
    font-size: 1.02rem;
    line-height: 1.2;
  }

  .panel-title-row {
    align-items: flex-start;
    gap: 10px;
  }

  .link-row {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .detail-panel {
    overflow: visible;
    padding-bottom: calc(116px + var(--safe-bottom));
  }

  .action-row {
    position: static;
    flex-wrap: wrap;
    justify-content: stretch;
    padding-top: 12px;
    background: transparent;
  }

  .action-row button {
    flex: 1 1 calc(50% - 5px);
  }

  .action-row button[type="submit"] {
    flex-basis: 100%;
  }

  .empty-state {
    min-height: 180px;
    text-align: center;
    padding: 18px;
  }
}

@media (max-width: 520px) {
  .shell {
    padding-left: 8px;
    padding-right: 8px;
  }

  .status-filters,
  .stats {
    grid-template-columns: 1fr;
  }

  .place-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-row {
    gap: 8px;
  }

  .mobile-switcher {
    left: 8px;
    right: 8px;
    bottom: calc(8px + var(--safe-bottom));
    padding: 8px;
  }
}
