:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --ink: #17211b;
  --muted: #647067;
  --panel: rgba(250, 252, 248, 0.94);
  --line: rgba(23, 33, 27, 0.16);
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(18, 30, 24, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
.app-shell,
.map {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: #e8efe8;
  overflow: hidden;
}

button,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
}

.map {
  width: 100%;
}

.panel-toggle {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 9;
  box-shadow: var(--shadow);
}

.panel-toggle[aria-pressed="true"] {
  border-color: rgba(15, 118, 110, 0.65);
  color: #ffffff;
  background: var(--accent);
}

.panel-toggle[aria-pressed="true"]:hover {
  background: var(--accent-strong);
}

.app-shell:not(.controls-open) .topbar,
.app-shell:not(.controls-open) .search-panel,
.app-shell:not(.controls-open) .nav-panel,
.app-shell:not(.controls-open) .sheet {
  display: none !important;
}

.topbar {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: calc(max(14px, env(safe-area-inset-left)) + 52px);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.05;
}

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

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease,
    border-color 120ms ease;
}

.icon-button span {
  font-size: 24px;
  line-height: 1;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.icon-button:hover {
  border-color: rgba(15, 118, 110, 0.5);
  background: #effaf7;
}

.icon-button:active {
  transform: scale(0.97);
}

.search-panel {
  position: absolute;
  top: calc(max(16px, env(safe-area-inset-top)) + 64px);
  left: max(14px, env(safe-area-inset-left));
  z-index: 6;
  width: min(360px, calc(100vw - 28px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.search-form {
  margin: 0;
}

.search-form input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
}

.search-results {
  display: grid;
  gap: 6px;
  max-height: 280px;
  margin-top: 8px;
  overflow: auto;
}

.search-result {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(23, 33, 27, 0.12);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  text-align: left;
  cursor: pointer;
}

.search-result strong,
.search-result span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result strong {
  font-size: 13px;
  line-height: 1.25;
}

.search-result span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.search-empty {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.nav-panel {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  z-index: 7;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  width: min(430px, calc(100vw - 28px));
  padding: 9px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(15, 118, 110, 0.32);
  border-radius: 8px;
  background: rgba(250, 252, 248, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.nav-arrow {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.28);
  transition: transform 180ms ease;
}

.nav-arrow svg {
  width: 34px;
  height: 34px;
  fill: currentColor;
}

.nav-copy {
  min-width: 0;
}

.nav-copy strong,
.nav-copy span,
.nav-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-copy strong {
  font-size: 15px;
}

.nav-copy span {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 800;
}

.nav-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-stop {
  width: 38px;
  height: 38px;
}

.sheet {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
  width: min(390px, calc(100vw - 28px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  max-height: min(620px, calc(100vh - 120px));
  overflow: auto;
}

.sheet-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  margin: 0 0 8px auto;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.sheet-toggle:hover {
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.45);
  background: #effaf7;
}

.sheet-toggle-collapsed {
  display: none;
}

.sheet.is-collapsed {
  width: auto;
  min-width: 74px;
  max-height: none;
  padding: 6px;
  overflow: visible;
}

.sheet.is-collapsed .sheet-toggle {
  min-height: 40px;
  margin: 0;
  padding: 0 14px;
  color: #ffffff;
  border-color: rgba(15, 118, 110, 0.65);
  background: var(--accent);
}

.sheet.is-collapsed .sheet-toggle:hover {
  background: var(--accent-strong);
}

.sheet.is-collapsed .sheet-toggle-expanded,
.sheet.is-collapsed .sheet-grip,
.sheet.is-collapsed .select-label,
.sheet.is-collapsed select,
.sheet.is-collapsed .details,
.sheet.is-collapsed .status {
  display: none;
}

.sheet.is-collapsed .sheet-toggle-collapsed {
  display: inline;
}

.sheet-grip {
  display: none;
}

.select-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.details {
  min-height: 88px;
  margin-top: 12px;
}

.details h2 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

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

.metric {
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

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

.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background 120ms ease;
}

.primary-button {
  border: 1px solid rgba(15, 118, 110, 0.55);
  color: #ffffff;
  background: var(--accent);
}

.secondary-button {
  border: 1px solid rgba(15, 118, 110, 0.35);
  color: var(--accent-strong);
  background: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button:hover {
  background: #effaf7;
}

.primary-button:active,
.secondary-button:active {
  transform: scale(0.98);
}

.location-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0 0;
  padding: 8px;
  border: 1px solid rgba(23, 33, 27, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.map-target-button {
  min-height: 38px;
  border: 1px solid rgba(15, 118, 110, 0.26);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.map-target-button:hover {
  border-color: rgba(15, 118, 110, 0.48);
  background: #effaf7;
}

.map-target-button.is-wide {
  grid-column: 1 / -1;
  color: #ffffff;
  background: var(--accent);
}

.map-target-button.is-wide:hover {
  background: var(--accent-strong);
}

.location-actions p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.meta-list {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
}

.meta-list div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  padding-top: 7px;
  border-top: 1px solid rgba(23, 33, 27, 0.1);
}

.meta-list dt,
.meta-list dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.meta-list dt {
  color: var(--muted);
  font-weight: 700;
}

.meta-list dd {
  overflow-wrap: anywhere;
}

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

.status {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.35;
}

.status.error {
  color: var(--danger);
}

.setup-panel {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 10;
  width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.setup-panel h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.setup-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.gm-style .gm-style-iw-c {
  border-radius: 8px;
}

.info-window {
  min-width: 190px;
  max-width: 280px;
  color: var(--ink);
}

.info-window h3 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.info-window p {
  margin: 4px 0;
  color: var(--muted);
}

@media (max-width: 640px) {
  .panel-toggle {
    top: max(10px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
  }

  .topbar {
    top: max(10px, env(safe-area-inset-top));
    left: calc(max(10px, env(safe-area-inset-left)) + 48px);
    padding: 6px;
  }

  .search-panel {
    top: calc(max(10px, env(safe-area-inset-top)) + 58px);
    left: max(10px, env(safe-area-inset-left));
    width: min(340px, calc(100vw - 20px));
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }

  .nav-panel {
    top: calc(max(10px, env(safe-area-inset-top)) + 58px);
    grid-template-columns: 50px minmax(0, 1fr) 38px;
    width: calc(100vw - 20px);
    padding: 8px;
  }

  .nav-arrow {
    width: 46px;
    height: 46px;
  }

  .sheet {
    right: 0;
    bottom: 0;
    width: 100%;
    padding: 10px 12px max(12px, env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
    max-height: 48vh;
  }

  .sheet.is-collapsed {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: auto;
    width: auto;
    max-height: none;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
  }

  .sheet-grip {
    display: block;
    width: 42px;
    height: 4px;
    margin: 0 auto 10px;
    border-radius: 999px;
    background: rgba(23, 33, 27, 0.22);
  }

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

  .meta-list div {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .details {
    min-height: 74px;
  }
}
