:root {
  --brand-green: #4eaf2e;
  --brand-green-dark: #3f8e25;
  --brand-green-soft: rgba(78, 175, 46, 0.12);
  --brand-gray: #868686;
  --brand-gray-dark: #5f5f5f;
  --brand-gray-soft: rgba(134, 134, 134, 0.12);
  --bg: #f7f7f4;
  --panel-bg: rgba(255, 255, 255, 0.96);
  --panel-border: rgba(134, 134, 134, 0.2);
  --surface: rgba(250, 250, 248, 0.98);
  --surface-strong: #ffffff;
  --text: #1d1d1b;
  --muted: #6f6f6f;
  --accent: var(--brand-green);
  --accent-strong: var(--brand-green-dark);
  --accent-soft: var(--brand-green-soft);
  --danger: #b6403a;
  --shadow: 0 24px 60px rgba(29, 29, 27, 0.12);
  --shadow-soft: 0 10px 24px rgba(29, 29, 27, 0.1);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  font-family: "Montserrat", sans-serif;
  background:
    linear-gradient(135deg, rgba(78, 175, 46, 0.08), transparent 26%),
    linear-gradient(315deg, rgba(134, 134, 134, 0.08), transparent 22%),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

a {
  color: var(--accent-strong);
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.map-canvas {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(140deg, rgba(78, 175, 46, 0.14), transparent 58%),
    linear-gradient(180deg, #f3f5f1 0%, #fafaf8 100%);
}

.map-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, transparent 20%),
    linear-gradient(90deg, rgba(29, 29, 27, 0.12) 0%, transparent 26%);
}

.map-status-card {
  position: absolute;
  top: 24px;
  left: 24px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  z-index: 12;
  padding: 10px 14px;
  border: 1px solid rgba(134, 134, 134, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  font-size: 0.84rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #93a4b8;
}

.status-dot--live {
  background: var(--brand-green);
  box-shadow: 0 0 0 6px rgba(78, 175, 46, 0.14);
}

.panel-toggle {
  position: absolute;
  right: 24px;
  top: 24px;
  z-index: 13;
  display: none;
  border: 1px solid rgba(134, 134, 134, 0.16);
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  font-size: 0.84rem;
}

.control-panel {
  position: absolute;
  top: 24px;
  right: 24px;
  bottom: 24px;
  z-index: 11;
  width: min(360px, calc(100vw - 48px));
  padding: 16px;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.panel-header {
  position: relative;
  margin-bottom: 14px;
  padding: 14px 14px 16px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(78, 175, 46, 0.12), rgba(78, 175, 46, 0.03)),
    linear-gradient(315deg, rgba(134, 134, 134, 0.08), transparent 48%),
    #ffffff;
  overflow: hidden;
}

.panel-header::after {
  content: "";
  position: absolute;
  right: -36px;
  top: -34px;
  width: 118px;
  height: 118px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(78, 175, 46, 0.18), rgba(78, 175, 46, 0.04));
  transform: rotate(24deg);
  pointer-events: none;
}

.panel-kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.panel-title-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row h1 {
  margin: 0;
  font-size: clamp(1.22rem, 1.55vw, 1.55rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.panel-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.82rem;
}

.load-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-strong);
  border: 1px solid rgba(78, 175, 46, 0.2);
  font-size: 0.74rem;
  font-weight: 700;
}

.banner {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(182, 64, 58, 0.1);
  border: 1px solid rgba(182, 64, 58, 0.18);
  color: var(--danger);
  line-height: 1.45;
  font-size: 0.82rem;
}

.is-hidden {
  display: none !important;
}

.panel-section {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(134, 134, 134, 0.16);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel-section--compact {
  padding: 11px 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-label {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.section-note {
  margin: 8px 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(134, 134, 134, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
  font-size: 0.86rem;
}

.search-input:focus {
  outline: none;
  border-color: rgba(78, 175, 46, 0.55);
  box-shadow: 0 0 0 4px rgba(78, 175, 46, 0.14);
}

.action-grid,
.stats-grid {
  display: grid;
  gap: 8px;
}

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

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

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(134, 134, 134, 0.14);
  background: rgba(255, 255, 255, 0.88);
}

.toggle-copy {
  display: grid;
  gap: 2px;
}

.toggle-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
}

.toggle-note {
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--muted);
}

.toggle-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.toggle-control input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(134, 134, 134, 0.28);
  transition: background-color 160ms ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(29, 29, 27, 0.2);
  transition: transform 160ms ease;
}

.toggle-control input:checked + .toggle-slider {
  background: var(--brand-green);
}

.toggle-control input:checked + .toggle-slider::after {
  transform: translateX(18px);
}

.action-button,
.mini-button {
  border: 0;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease;
}

.action-button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(78, 175, 46, 0.22);
  font-size: 0.8rem;
}

.action-button:hover,
.mini-button:hover {
  transform: translateY(-1px);
}

.action-button--ghost,
.mini-button--ghost {
  background: rgba(134, 134, 134, 0.1);
  color: var(--text);
  box-shadow: none;
}

.stat-card {
  min-height: 72px;
  padding: 11px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 247, 242, 0.95));
  border: 1px solid rgba(134, 134, 134, 0.14);
}

.stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-size: 1.42rem;
  line-height: 1;
  color: var(--accent-strong);
  margin-bottom: 8px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(78, 175, 46, 0.11);
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 600;
}

.chip--neutral {
  background: rgba(134, 134, 134, 0.1);
  color: var(--muted);
}

.option-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  padding-right: 4px;
  overflow-y: auto;
}

.option-item {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(134, 134, 134, 0.16);
  background: rgba(255, 255, 255, 0.9);
}

.option-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.option-label {
  font-size: 0.82rem;
  line-height: 1.35;
}

.option-count {
  min-width: 30px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(134, 134, 134, 0.1);
  color: var(--muted);
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.mini-actions {
  display: inline-flex;
  gap: 6px;
}

.mini-button {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(78, 175, 46, 0.12);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
}

.legend-list {
  display: grid;
  gap: 8px;
}

.legend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(134, 134, 134, 0.12);
  font-size: 0.8rem;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.95);
}

.empty-state {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 48px));
  padding: 18px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(134, 134, 134, 0.18);
  box-shadow: var(--shadow-soft);
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.8rem;
}

.noscript-banner {
  padding: 14px 18px;
  background: #fff1dd;
  color: #764d00;
  text-align: center;
}

.company-pin {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, var(--brand-green-dark), var(--brand-green) 62%, #72c256);
  border: 2px solid rgba(255, 255, 255, 0.96);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 16px 28px rgba(78, 175, 46, 0.26);
}

.info-window {
  max-width: 280px;
  color: var(--text);
  font-family: "Montserrat", sans-serif;
}

.info-window h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  line-height: 1.3;
}

.info-window div {
  font-size: 0.8rem;
  line-height: 1.45;
}

.info-window-media {
  margin: 0 0 10px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(134, 134, 134, 0.08);
}

.info-window-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.info-window-image {
  display: block;
  width: 100%;
  max-height: 170px;
  object-fit: cover;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 29, 27, 0.78);
  backdrop-filter: blur(4px);
}

.image-modal-dialog {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 1080px);
  max-height: 88vh;
  padding: 18px 18px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 60px rgba(29, 29, 27, 0.28);
}

.image-modal-image {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 72px);
  margin: 0 auto;
  border-radius: 12px;
}

.image-modal-caption {
  margin: 10px 4px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.image-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1001;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
}

.panel-meta {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.panel-meta a {
  color: var(--brand-gray-dark);
}

@media (max-width: 960px) {
  .panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .control-panel {
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
    max-height: min(78vh, 760px);
    transform: translateY(calc(100% + 24px));
    transition: transform 220ms ease;
  }

  .control-panel.is-open {
    transform: translateY(0);
  }

  .map-scrim {
    background:
      linear-gradient(180deg, rgba(29, 29, 27, 0.08) 0%, transparent 16%),
      linear-gradient(0deg, rgba(29, 29, 27, 0.1) 0%, transparent 24%);
  }
}

@media (max-width: 680px) {
  .map-status-card {
    top: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
  }

  .panel-toggle {
    top: 78px;
    right: 16px;
  }

  .control-panel {
    padding: 14px;
  }

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

  .panel-title-row {
    flex-direction: column;
  }

  .empty-state {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }

  .image-modal-dialog {
    width: calc(100vw - 24px);
    padding: 14px 14px 12px;
  }

  .image-modal-close {
    top: 12px;
    right: 12px;
  }
}
