:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-soft: #f1f5f3;
  --text: #18231e;
  --muted: #718078;
  --border: #e1e8e4;
  --brand: #0b9855;
  --brand-dark: #087844;
  --brand-soft: #e6f7ee;
  --orange: #ff9800;
  --red: #ef352d;
  --black: #1d2421;
  --shadow: 0 16px 44px rgba(21, 54, 38, .08);
  --radius-lg: 26px;
  --radius-md: 18px;
}

html[data-theme="dark"] {
  --bg: #0d1310;
  --surface: #141c18;
  --surface-soft: #1a241f;
  --text: #eff6f2;
  --muted: #9cad9f;
  --border: #29352f;
  --brand: #35ca79;
  --brand-dark: #2caf6a;
  --brand-soft: #193a28;
  --black: #050706;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
}

.site-container {
  max-width: 1560px;
  padding-inline: clamp(18px, 3vw, 56px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 15px;
  background: var(--brand);
  color: white;
  font-size: 1.5rem;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.18rem;
  font-weight: 900;
}

.brand small {
  color: var(--muted);
  font-size: .72rem;
}

.nav-link {
  color: var(--muted);
  font-weight: 700;
  border-radius: 12px;
  padding-inline: 14px !important;
}

.nav-link:hover,
.nav-link.active {
  color: var(--brand);
  background: var(--brand-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-search {
  width: min(310px, 28vw);
  height: 45px;
  display: flex;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.header-search input {
  min-width: 0;
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 18px;
  color: var(--text);
  background: transparent;
}

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

.header-search button {
  width: 46px;
  height: 100%;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 1.4rem;
}

.icon-button {
  width: 45px;
  height: 45px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.3rem;
}

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 800;
}

.btn-brand:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn-outline-brand {
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 800;
}

.btn-outline-brand:hover {
  background: var(--brand);
  color: white;
}

.filter-section {
  padding: 28px 0 10px;
}

.filter-panel {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.filter-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.15fr 1.15fr .85fr;
  gap: 14px;
  align-items: end;
}

.filter-control {
  display: grid;
  gap: 7px;
}

.filter-control span {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

.filter-control select {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 15px;
  outline: none;
}

.filter-submit {
  min-height: 52px;
  border-radius: 15px;
}

.category-pills {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}

.category-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  min-width: 110px;
  justify-content: center;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  font-weight: 800;
}

.category-pill:hover,
.category-pill.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.dashboard-section {
  padding: 16px 0 30px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 24px;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.map-card,
.sidebar-card,
.stat-card,
.place-row,
.empty-state {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 25px;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--brand);
  font-size: .82rem;
  font-weight: 900;
}

.eyebrow.light {
  color: rgba(255,255,255,.75);
}

.map-toolbar h1,
.section-title h2,
.section-heading h2 {
  margin: 0;
  font-weight: 900;
}

.map-toolbar h1 {
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.map-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-indicator {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
}

.live-indicator i {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 6px;
  border-radius: 50%;
  background: #20c76a;
  box-shadow: 0 0 0 5px rgba(32,199,106,.12);
}

.places-map {
  width: 100%;
  height: 510px;
  background: var(--surface-soft);
}

.cluster-legend {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 15px 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .77rem;
}

.cluster-legend span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-dot.green { background: var(--brand); }
.legend-dot.orange { background: var(--orange); }
.legend-dot.red { background: var(--red); }
.legend-dot.black { background: var(--black); }

.marker-cluster-custom {
  display: grid !important;
  place-items: center;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(0,0,0,.22);
}

.marker-cluster-custom span {
  line-height: 1;
}

.marker-cluster-green {
  background: var(--brand);
}

.marker-cluster-orange {
  background: var(--orange);
}

.marker-cluster-red {
  background: var(--red);
}

.marker-cluster-black {
  background: var(--black);
}

.place-map-marker {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 5px 14px rgba(0,0,0,.28);
}

.place-map-marker.hot {
  background: var(--red);
}

.map-popup {
  min-width: 220px;
  direction: rtl;
}

.map-popup strong {
  display: block;
  font-size: 1rem;
}

.map-popup small {
  color: #68776f;
}

.map-popup .popup-metrics {
  display: flex;
  gap: 8px;
  margin: 10px 0;
}

.map-popup a {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  color: white;
  background: #0b9855;
  text-decoration: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 110px;
  padding: 18px;
  border-radius: var(--radius-md);
}

.stat-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 1.25rem;
  font-weight: 900;
}

.stat-card strong,
.stat-card span {
  display: block;
}

.stat-card strong {
  color: var(--brand);
  font-size: 1.45rem;
  font-weight: 900;
}

.stat-card div span {
  color: var(--muted);
  font-size: .8rem;
}

.dashboard-sidebar {
  display: grid;
  gap: 20px;
}

.discovery-card {
  position: relative;
  min-height: 245px;
  padding: 28px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  color: white;
  background:
    radial-gradient(circle at 18% 80%, rgba(52, 219, 130, .34), transparent 32%),
    linear-gradient(135deg, #0b7e49, #11a960);
  box-shadow: var(--shadow);
}

.discovery-card > div:first-child {
  position: relative;
  z-index: 2;
  max-width: 245px;
}

.discovery-card h2 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  font-weight: 900;
}

.discovery-card p {
  color: rgba(255,255,255,.82);
}

.discovery-pin {
  position: absolute;
  left: 20px;
  bottom: -35px;
  color: rgba(255,255,255,.17);
  font-size: 12rem;
  line-height: 1;
  transform: rotate(-8deg);
}

.sidebar-card {
  padding: 22px;
  border-radius: var(--radius-lg);
}

.section-title,
.section-heading,
.place-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.section-title h2 {
  font-size: 1.35rem;
}

.trend-arrow {
  color: var(--brand);
  font-size: 1.8rem;
  font-weight: 900;
}

.quick-list {
  display: grid;
  margin-top: 15px;
}

.quick-place {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.quick-rank {
  color: var(--brand);
  font-weight: 900;
}

.quick-info {
  min-width: 0;
}

.quick-info strong,
.quick-info small {
  display: block;
}

.quick-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-info small {
  color: var(--muted);
}

.quick-trend {
  color: var(--brand);
  font-size: .85rem;
  font-weight: 900;
}

.places-section {
  padding: 10px 0 65px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: clamp(1.5rem, 2vw, 2.15rem);
}

.results-count {
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 900;
}

.places-list {
  display: grid;
  gap: 13px;
}

.place-row {
  display: grid;
  grid-template-columns: 56px 118px minmax(0, 1fr) auto;
  gap: 19px;
  align-items: center;
  padding: 16px;
  border-radius: var(--radius-md);
  transition: transform .2s ease, border-color .2s ease;
}

.place-row:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 50%, var(--border));
}

.place-number {
  color: var(--brand);
  font-size: 1.65rem;
  font-weight: 900;
  text-align: center;
}

.place-image {
  width: 118px;
  height: 92px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface-soft);
}

.place-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  font-size: 2rem;
}

.place-content {
  min-width: 0;
}

.place-title-line h3 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 900;
}

.place-title-line p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .84rem;
}

.trend-badge {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 900;
}

.trend-low {
  color: var(--brand);
  background: var(--brand-soft);
}

.trend-medium {
  color: #d97900;
  background: #fff1da;
}

.trend-hot {
  color: #d52f28;
  background: #ffe2df;
}

html[data-theme="dark"] .trend-medium {
  color: #ffc167;
  background: #49300f;
}

html[data-theme="dark"] .trend-hot {
  color: #ff8f88;
  background: #4d211f;
}

.place-description {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: .87rem;
}

.place-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 11px;
  color: var(--muted);
  font-size: .78rem;
}

.place-metrics span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.place-metrics b {
  color: var(--text);
}

.place-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 105px;
}

.empty-state {
  padding: 65px 20px;
  border-radius: var(--radius-lg);
  text-align: center;
}

.empty-state > span {
  color: var(--brand);
  font-size: 4rem;
}

.empty-state h2 {
  font-weight: 900;
}

.empty-state p {
  color: var(--muted);
}

.site-footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.site-footer .site-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
}

.site-footer strong,
.site-footer span {
  display: block;
}

.site-footer span {
  color: var(--muted);
  font-size: .82rem;
}

.site-footer a {
  margin-inline-start: 20px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.site-footer a:hover {
  color: var(--brand);
}

.leaflet-control-zoom a {
  color: #1b2821 !important;
}

@media (max-width: 1199px) {
  .header-actions {
    margin-top: 18px;
    flex-wrap: wrap;
  }

  .header-search {
    width: min(100%, 420px);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 991px) {
  .filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .place-row {
    grid-template-columns: 46px 96px minmax(0, 1fr);
  }

  .place-image {
    width: 96px;
    height: 82px;
  }

  .place-actions {
    grid-column: 2 / -1;
    flex-direction: row;
  }
}

@media (max-width: 767px) {
  .site-container {
    padding-inline: 14px;
  }

  .brand small {
    display: none;
  }

  .filter-section {
    padding-top: 16px;
  }

  .filter-panel {
    padding: 14px;
    border-radius: 20px;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .map-toolbar {
    align-items: flex-start;
    padding: 18px;
  }

  .map-toolbar-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .places-map {
    height: 430px;
  }

  .cluster-legend {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .cluster-legend span {
    justify-content: flex-start;
  }

  .dashboard-sidebar {
    grid-template-columns: 1fr;
  }

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

  .stat-card {
    min-height: 95px;
    padding: 14px;
  }

  .place-row {
    grid-template-columns: 42px 80px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .place-image {
    width: 80px;
    height: 75px;
  }

  .place-number {
    font-size: 1.25rem;
  }

  .place-title-line {
    align-items: flex-start;
  }

  .place-title-line h3 {
    font-size: 1rem;
  }

  .place-title-line p {
    font-size: .73rem;
  }

  .trend-badge {
    padding: 5px 8px;
    font-size: .7rem;
  }

  .place-description {
    display: none;
  }

  .place-metrics {
    gap: 8px;
    font-size: .68rem;
  }

  .place-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .site-footer .site-container {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 470px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .map-toolbar {
    display: block;
  }

  .map-toolbar-actions {
    margin-top: 12px;
    flex-direction: row;
    justify-content: space-between;
  }

  .place-row {
    grid-template-columns: 36px 67px minmax(0, 1fr);
  }

  .place-image {
    width: 67px;
    height: 67px;
  }

  .place-metrics span:nth-child(n+3) {
    display: none;
  }
}
