:root {
  --background: rgb(246, 248, 249);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #fff;
  --text: #101112;
  --muted: #697177;
  --subtle: #eef1f2;
  --border: #dfe4e6;
  --border-strong: #c9d0d3;
  --shadow: 0 18px 60px rgba(18, 24, 27, 0.12);
  --header-height: 72px;
  --sidebar-width: 390px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--background);
}

button, input, select, textarea { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

.site-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(246, 248, 249, 0.92);
  backdrop-filter: blur(20px);
  position: relative;
  z-index: 30;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: #111;
  font-size: 11px;
  letter-spacing: 0;
}

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

.portfolio-link {
  margin-left: 8px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid var(--border-strong);
  padding: 7px 0;
}

.portfolio-link:hover { border-color: var(--text); }

.button, .icon-button, .map-tool, .map-panel-button, .menu-button, .place-pin-button, .map-style-control summary {
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-solid);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover, .icon-button:hover, .map-tool:hover, .map-panel-button:hover { border-color: #9da6aa; }
.button:active, .icon-button:active, .map-tool:active { transform: scale(0.97); }
.button:focus-visible, .icon-button:focus-visible, .map-tool:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
}

.button-primary { color: #fff; background: #111; border-color: #111; }
.button-primary:hover { background: #292b2c; border-color: #292b2c; }
.button-secondary { background: rgba(255,255,255,.72); }
.button[aria-pressed="true"] { color: #fff; background: #111; border-color: #111; }
.button svg { width: 16px; height: 16px; }

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}
.icon-button svg { width: 17px; height: 17px; }

.menu-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  margin-left: 5px;
}
.menu-button svg { width: 18px; height: 18px; }

.site-menu {
  position: fixed;
  z-index: 100;
  top: 12px;
  right: 12px;
  width: min(360px, calc(100% - 24px));
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255,255,255,.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}
.site-menu-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 2px 2px 10px; }
.site-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 12px;
  border-top: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  text-decoration: none;
}
.site-menu a:hover { background: var(--subtle); }
.site-menu a[aria-current="page"] { font-weight: 600; }
.site-menu a svg { width: 18px; height: 18px; color: var(--muted); }
.menu-scrim { position: fixed; z-index: 90; inset: 0; border: 0; background: rgba(20,25,28,.22); backdrop-filter: blur(2px); }
body.menu-open { overflow: hidden; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: calc(100% - var(--header-height));
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 28px 24px 16px;
  overflow-y: auto;
  background: var(--background);
  border-right: 1px solid var(--border);
  z-index: 20;
}

.sidebar-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 38px; line-height: 1; font-weight: 500; letter-spacing: -.045em; }
h2 { font-size: 25px; line-height: 1.1; font-weight: 500; letter-spacing: -.035em; }
h3 { font-size: 16px; font-weight: 500; }

.search-wrap {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-solid);
}

.search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 14px; }
.search-wrap input::placeholder { color: #929a9e; }

.filter-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.filter-row select, .field select, .field input, .field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-solid);
  color: var(--text);
}
.filter-row select { height: 38px; padding: 0 8px; font-size: 11px; }

.list-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 1px 10px; color: var(--muted); font-size: 12px; }
.switch-label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.switch-label input { accent-color: #111; }

.location-list { display: grid; gap: 8px; }
.location-card {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 13px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(255,255,255,.65);
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.location-card:hover { background: #fff; border-color: var(--border-strong); transform: translateY(-1px); }
.location-card.is-selected { border-color: #111; background: #fff; }
.location-card-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-size: 14px; font-weight: 600; }
.location-card-icon svg { width: 17px; height: 17px; }
.location-card-copy { min-width: 0; }
.location-card-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.location-card-copy span { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; text-transform: capitalize; }
.location-card-arrow { width: 15px; height: 15px; color: var(--muted); }

.empty-state { padding: 54px 22px; text-align: center; }
.empty-state h2 { margin-bottom: 9px; }
.empty-state p { margin-bottom: 22px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.empty-icon { width: 50px; height: 50px; display: grid; place-items: center; margin: 0 auto 18px; border: 1px solid var(--border); border-radius: 50%; background: #fff; font-size: 21px; }

.sidebar-footer { margin-top: auto; padding-top: 18px; }
.data-menu { border-top: 1px solid var(--border); padding-top: 14px; }
.data-menu summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.data-actions { padding: 12px 0 4px; }
.data-actions p { color: var(--muted); font-size: 11px; line-height: 1.5; }
.text-button { padding: 0; margin-right: 14px; border: 0; border-bottom: 1px solid var(--border-strong); background: none; font-size: 12px; cursor: pointer; }
.file-button { display: inline-block; }

.map-wrap { position: relative; min-width: 0; overflow: hidden; }
#map { position: absolute; inset: 0; }
.maplibregl-ctrl-bottom-left { left: 10px; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-popup-content { padding: 0; border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.maplibregl-popup-close-button { width: 28px; height: 28px; font-size: 18px; z-index: 2; }
.map-popup { min-width: 210px; padding: 16px; }
.map-popup .eyebrow { margin-bottom: 5px; }
.map-popup strong { display: block; margin-right: 18px; font-size: 15px; font-weight: 500; }
.map-popup span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }

.map-tools { position: absolute; top: 16px; right: 16px; display: grid; gap: 8px; }
.map-tool { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; box-shadow: 0 8px 24px rgba(20,26,29,.1); font-size: 18px; }
.map-tool svg { width: 18px; height: 18px; }
.place-pin-button {
  position: absolute;
  top: 16px;
  left: 16px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  box-shadow: 0 8px 24px rgba(20,26,29,.1);
  font-size: 12px;
  font-weight: 500;
}
.place-pin-button svg { width: 17px; height: 17px; }
.place-pin-button[aria-pressed="true"] { color: #fff; background: #111; border-color: #111; }
.maplibregl-canvas.placing-pin { cursor: crosshair !important; }

.map-style-control { position: absolute; top: 116px; right: 16px; }
.map-style-control summary { width: 42px; height: 42px; display: grid; place-items: center; list-style: none; box-shadow: 0 8px 24px rgba(20,26,29,.1); cursor: pointer; }
.map-style-control summary::-webkit-details-marker { display: none; }
.map-style-control summary svg { width: 18px; height: 18px; }
.map-style-menu {
  position: absolute;
  top: 0;
  right: 50px;
  width: 118px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.map-style-menu button { width: 100%; min-height: 34px; padding: 0 9px; border: 0; border-radius: 9px; background: transparent; text-align: left; font-size: 11px; cursor: pointer; }
.map-style-menu button:hover { background: var(--subtle); }
.map-style-menu button[aria-pressed="true"] { color: #fff; background: #111; }

.map-pin-marker {
  width: 36px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0 0 6px;
  border: 3px solid #fff;
  border-radius: 18px 18px 18px 4px;
  color: #fff;
  background: var(--pin-color);
  box-shadow: 0 5px 14px rgba(16,20,22,.28);
  transform: rotate(-45deg);
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.map-pin-marker svg { width: 16px; height: 16px; transform: rotate(45deg); }
.map-pin-marker:hover, .map-pin-marker.is-selected { transform: rotate(-45deg) scale(1.14); box-shadow: 0 7px 20px rgba(16,20,22,.34); }
.map-pin-marker.is-parking { border-radius: 50% 50% 50% 4px; }
.map-message { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 140px); padding: 10px 14px; border-radius: 999px; color: #fff; background: rgba(17,17,17,.9); box-shadow: var(--shadow); font-size: 12px; text-align: center; }

.sun-panel {
  position: absolute;
  right: 16px;
  bottom: 32px;
  width: min(390px, calc(100% - 32px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}
.sun-nudge-row { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 6px; margin-top: 10px; }
.sun-nudge-row .button { min-height: 34px; padding: 0 8px; font-size: 10px; }
.sun-nudge-row .button svg { width: 13px; height: 13px; }
.sun-anchor-marker {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #ef3d32;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  cursor: grab;
}
.sun-anchor-marker:active { cursor: grabbing; }
.sun-anchor-marker span { width: 8px; height: 8px; border: 2px solid #fff; border-radius: 50%; }
.sun-panel-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 15px; }
.sun-panel-head strong { font-size: 15px; font-weight: 500; }
.compact-field { margin-bottom: 13px; }
.compact-field input { height: 38px !important; }
.range-field > span { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.range-field strong { color: var(--text); font-weight: 500; }
.range-field input { width: 100%; accent-color: #e49a26; }
.sun-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 14px; }
.sun-stats span { color: var(--muted); font-size: 9px; }
.sun-stats strong { display: block; margin: 3px 0 0 13px; color: var(--text); font-size: 11px; font-weight: 500; }
.sun-stats i { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; }
.sunrise-key { background: #e7aa42; }.current-key { background: #f1cc36; }.sunset-key { background: #d96e4c; }
.microcopy { margin: 13px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }

.detail-back { display: inline-flex; align-items: center; gap: 6px; padding: 0; margin: 0 0 20px; border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.detail-hero { padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-title-row h2 { margin-bottom: 9px; }
.detail-pin { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; }
.detail-pin svg { width: 18px; height: 18px; }
.detail-image { width: 100%; max-height: 240px; display: block; margin-bottom: 18px; border-radius: 16px; object-fit: cover; }
.detail-description { margin: 15px 0 0; color: #3f4447; font-size: 13px; line-height: 1.6; white-space: pre-wrap; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: var(--subtle); color: #50575b; font-size: 10px; text-transform: capitalize; }
.detail-section { padding: 20px 0; border-bottom: 1px solid var(--border); }
.detail-section h3 { margin-bottom: 13px; }
.fact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.fact span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.fact strong { display: block; font-size: 13px; font-weight: 500; line-height: 1.35; }
.weather-box { min-height: 72px; }
.weather-sun { margin-top: 16px; }
.weather-current { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.weather-temp { font-size: 34px; letter-spacing: -.05em; }
.weather-copy strong { display: block; font-size: 13px; font-weight: 500; }
.weather-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.loading { color: var(--muted); font-size: 12px; }
.nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.nav-link { display: flex; align-items: center; justify-content: center; min-height: 38px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); background: #fff; font-size: 11px; text-decoration: none; }
.detail-actions { display: flex; gap: 8px; padding: 20px 0 6px; }
.detail-actions .button { flex: 1; }
.danger-button { color: #9f2929; }
.demo-readonly { margin: 18px 0 0; padding: 12px; border-radius: 12px; background: var(--subtle); color: var(--muted); font-size: 11px; text-align: center; }

.dialog {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100% - 40px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--background);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(20, 25, 28, .34); backdrop-filter: blur(4px); }
.dialog form { padding: 26px; overflow-y: auto; }
.dialog-small { width: min(500px, calc(100% - 32px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.dialog-head h2 { margin-bottom: 0; }
.dialog-intro { margin-bottom: 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 13px; background: #e9edef; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: grid; place-items: center; height: 36px; border-radius: 9px; color: var(--muted); font-size: 12px; }
.segmented input:checked + span { color: var(--text); background: #fff; box-shadow: 0 2px 8px rgba(25,31,34,.08); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 12px; }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.field-wide { grid-column: 1 / -1; }
.field input, .field select { height: 42px; padding: 0 11px; }
.field textarea { resize: vertical; padding: 11px; line-height: 1.45; }
.field small { font-size: 10px; }
.color-field { align-content: start; }
.color-field input { width: 64px; height: 42px; padding: 4px; }
.form-inline-action { justify-self: start; grid-column: 1 / -1; margin-top: -6px; }
.image-upload {
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: rgba(255,255,255,.55);
  cursor: pointer;
}
.image-upload:hover { background: #fff; }
.image-upload > svg { flex: 0 0 auto; width: 22px; height: 22px; color: var(--text); }
.image-upload strong, .image-upload small { display: block; }
.image-upload strong { margin-bottom: 4px; color: var(--text); font-size: 12px; font-weight: 500; }
.image-upload small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.image-preview { position: relative; margin-top: 4px; }
.image-preview img { width: 100%; max-height: 260px; display: block; border-radius: 15px; object-fit: cover; }
.image-preview .icon-button { position: absolute; top: 10px; right: 10px; box-shadow: 0 7px 18px rgba(0,0,0,.18); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.route-preview { margin-top: 18px; }
.route-preview ol { margin: 0; padding-left: 24px; }
.route-preview li { padding: 5px 0; font-size: 13px; }
.route-summary { padding: 12px; border-radius: 12px; background: #fff; color: var(--muted); font-size: 12px; line-height: 1.5; }
.route-actions { display: flex; gap: 8px; margin-top: 14px; }
.coming-soon-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 8px 0 20px; border: 1px solid var(--border); border-radius: 50%; background: #fff; }
.coming-soon-icon svg { width: 25px; height: 25px; }
.demo-intro { position: relative; padding: 34px; }
.demo-intro h2 { max-width: 360px; font-size: 34px; }
.demo-intro > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.65; }
.demo-close { position: absolute; top: 18px; right: 18px; }
.demo-mode #add-button, .demo-mode #place-pin-button, .demo-mode #empty-add-button, .demo-mode #import-input, .demo-mode .file-button { display: none !important; }

.mobile-only { display: none; }

@media (max-width: 820px) {
  :root { --header-height: 64px; }
  .site-header { padding: 0 14px; }
  .portfolio-link { display: none; }
  .button-label { display: none; }
  .header-actions .button { width: 40px; padding: 0; }
  .menu-button { margin-left: 0; }
  .app-shell { display: block; position: relative; }
  .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: min(390px, calc(100% - 36px));
    padding: 24px 18px 14px;
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }
  .sidebar.is-open { transform: translateX(0); }
  .map-wrap { width: 100%; height: 100%; }
  .mobile-only { display: grid; }
  .map-panel-button { position: absolute; top: 15px; left: 14px; min-height: 40px; padding: 0 15px; box-shadow: 0 8px 24px rgba(20,26,29,.1); font-size: 12px; }
  .place-pin-button { top: 64px; left: 14px; }
  .map-tools { top: 15px; }
  .map-style-control { top: 116px; right: 14px; }
  .sun-panel { bottom: 20px; }
}

@media (max-width: 520px) {
  .brand > span:last-child { display: none; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .filter-row label:last-child { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide, .form-inline-action { grid-column: auto; }
  .dialog form { padding: 20px; }
  .sun-stats { grid-template-columns: 1fr; gap: 7px; }
  .sun-stats strong { display: inline; margin-left: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
