:root {
  --ink: #17332c;
  --muted: #64756f;
  --line: #dfe8e4;
  --surface: #ffffff;
  --wash: #f3f7f5;
  --accent: #1f765d;
  --shadow: 0 14px 35px rgba(23, 51, 44, 0.1);
}

* { box-sizing: border-box; }

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

body {
  background: var(--wash);
  color: var(--ink);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }

.map-app { width: min(1500px, 100%); margin: 0 auto; padding: 28px; }

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; line-height: 1.05; }
.intro { margin-bottom: 0; color: var(--muted); }

.header-badge { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #d99a24; }

.map-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; align-items: start; }
.sidebar, .results-panel { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.sidebar { overflow: hidden; }
.sidebar-section { padding: 18px; border-bottom: 1px solid var(--line); }
.sidebar-section:last-child { border-bottom: 0; }
.sidebar-section label { display: block; margin-bottom: 8px; color: var(--ink); font-size: 13px; font-weight: 750; }
.search-row { display: flex; gap: 8px; }
.search-row input { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); outline: none; }
.search-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 118, 93, .12); }
.search-row button { width: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--wash); color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; }
.search-row button:hover { color: var(--ink); }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-heading h2, .results-heading h2 { margin-bottom: 0; font-size: 16px; }
.text-button { border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 700; }
.sidebar-section:has(#layer-filters) { padding: 0; background: #07536a; color: #ffffff; }
.sidebar-section:has(#layer-filters) .section-heading { padding: 17px 18px 12px; margin-bottom: 0; }
.sidebar-section:has(#layer-filters) .section-heading h2 { color: #ffffff; }
.sidebar-section:has(#layer-filters) .text-button { color: #b7eadb; }
.layer-search-row { display: flex; align-items: center; gap: 8px; margin: 0 14px 12px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 7px; background: rgba(0, 32, 46, .25); }
.layer-search-icon { color: #c5e6df; font-size: 21px; line-height: 1; }
.layer-search-row input { width: 100%; min-width: 0; padding: 9px 0; border: 0; outline: 0; background: transparent; color: #ffffff; font-size: 12px; }
.layer-search-row input::placeholder { color: #b8d3d2; }
.filter-list { display: block; max-height: 490px; overflow: auto; }
.ds-mapas-shortcode .filter-list { display: block !important; height: auto !important; min-height: 0 !important; }
.layer-group { border-top: 1px solid rgba(255, 255, 255, .16); }
.ds-mapas-shortcode .layer-group { display: block !important; height: auto !important; min-height: 0 !important; }
.layer-group:last-child { border-bottom: 1px solid rgba(255, 255, 255, .16); }
.layer-group summary { display: grid; grid-template-columns: 22px minmax(0, 1fr) 18px; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; list-style: none; }
.layer-group summary::-webkit-details-marker { display: none; }
.layer-group summary:hover { background: rgba(255, 255, 255, .08); }
.group-symbol { color: var(--group-color); font-size: 18px; text-shadow: 0 0 0 #ffffff; }
.group-summary-text { min-width: 0; }
.group-summary-text strong, .group-summary-text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-summary-text strong { color: #ffffff; font-size: 12px; }
.group-summary-text small { margin-top: 2px; color: #b8d3d2; font-size: 10px; }
.group-chevron { color: #b8d3d2; font-size: 17px; text-align: center; transition: transform .18s ease; }
.layer-group[open] .group-chevron { transform: rotate(180deg); }
.layer-group-content { padding: 2px 14px 10px 38px; }
.ds-mapas-shortcode .layer-group-content { display: block !important; position: static !important; flex: 0 0 auto !important; flex-direction: initial !important; justify-content: flex-start !important; align-items: stretch !important; gap: 0 !important; height: auto !important; min-height: 0 !important; max-height: none !important; overflow: visible !important; }
.ds-mapas-shortcode .layer-group-content > * { flex: 0 0 auto !important; }
.layer-group-actions { display: flex; justify-content: flex-end; padding: 0 4px 3px; }
.group-select-button { border: 0; background: transparent; color: #b7eadb; cursor: pointer; font-size: 10px; font-weight: 750; }
.group-select-button:hover { color: #ffffff; text-decoration: underline; }
.filter-option { display: grid; grid-template-columns: 18px 10px minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 0 !important; padding: 8px 4px; border-radius: 8px; cursor: pointer; font-weight: 500 !important; }
.ds-mapas-shortcode .filter-option { display: grid !important; position: static !important; width: 100% !important; height: auto !important; min-height: 0 !important; margin: 0 !important; margin-block: 0 !important; padding: 7px 4px !important; line-height: 1.2 !important; vertical-align: middle !important; }
.filter-option:hover { background: var(--wash); }
.sidebar-section:has(#layer-filters) .filter-option:hover { background: rgba(255, 255, 255, .08); }
.filter-option input { margin: 0; accent-color: #54b8a0; }
.ds-mapas-shortcode .filter-option input { width: 13px !important; height: 13px !important; min-height: 0 !important; margin: 0 !important; }
.color-chip, .result-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--chip-color); }
.filter-text { overflow: hidden; color: #ffffff; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.filter-count { color: #b8d3d2; font-size: 10px; }
.empty-layer { margin: 0; padding: 18px; color: #c9dfdc; font-size: 12px; }
.results-summary p { margin-bottom: 4px; font-weight: 750; }
.results-summary .hint, .source-note p { margin-bottom: 0; color: var(--muted); font-size: 12px; font-weight: 400; }

.map-column { min-width: 0; }
.address-search-panel { margin-bottom: 12px; padding: 16px 18px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.address-search-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.address-search-heading .eyebrow { margin-bottom: 3px; font-size: 10px; }
.address-search-heading h2 { margin: 0 0 3px; font-size: 16px; }
.address-search-heading p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.address-search-form { display: grid; grid-template-columns: minmax(130px, 1.2fr) minmax(90px, .7fr) minmax(130px, 1fr) minmax(130px, 1fr) minmax(130px, 1fr) auto; gap: 8px; align-items: end; }
.address-search-form label { display: grid; gap: 5px; color: var(--ink); font-size: 11px; font-weight: 750; }
.address-search-form input { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); outline: none; font-size: 12px; }
.address-search-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 118, 93, .12); }
.address-submit { min-height: 37px; padding: 0 14px; border: 0; border-radius: 9px; background: var(--accent); color: #ffffff; cursor: pointer; font-size: 12px; font-weight: 750; white-space: nowrap; }
.address-submit:hover { background: #175f4a; }
.address-submit:disabled { cursor: wait; opacity: .7; }
.address-search-status { min-height: 18px; margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.address-search-status.is-error { color: #a33b2e; }
.address-search-status.is-success { color: var(--accent); }
#map { min-height: 620px; height: min(68vh, 780px); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.leaflet-container { background: #e9f0ed; }
.map-pin-wrapper { width: 24px !important; height: 30px !important; border: 0; background: transparent; }
.map-pin { position: relative; display: block; width: 22px; height: 22px; border: 2px solid #ffffff; border-radius: 50% 50% 50% 0; background: var(--pin-color); box-shadow: 0 2px 7px rgba(23, 51, 44, .32); transform: rotate(-45deg); }
.map-pin span { position: absolute; top: 5px; left: 5px; width: 8px; height: 8px; border-radius: 50%; background: #ffffff; }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.popup-card { min-width: 210px; max-width: 300px; }
.popup-card h3 { margin: 0 0 7px; font-size: 16px; line-height: 1.2; }
.popup-card p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.popup-card .popup-category { color: var(--accent); font-size: 11px; font-weight: 750; }
.popup-detail { margin-top: 5px; color: var(--muted); font-size: 12px; }

.results-panel { margin-top: 16px; padding: 18px; }
.results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.results-heading span { color: var(--muted); font-size: 12px; }
.results-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.result-card { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 9px; align-items: start; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.result-card:hover { border-color: var(--accent); background: var(--wash); }
.result-dot { margin-top: 5px; }
.result-card strong, .result-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-card strong { font-size: 13px; }
.result-card small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.result-card small .result-distance { color: var(--accent); }
.empty-state, .result-limit { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 13px; }
.result-limit { padding-top: 4px; }

@media (max-width: 980px) {
  .map-app { padding: 18px; }
  .map-layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; }
  .sidebar-section { border-right: 1px solid var(--line); }
  .sidebar-section:nth-child(2) { border-right: 0; }
  .sidebar-section:nth-child(3), .sidebar-section:nth-child(4) { grid-column: span 1; }
  .filter-list { max-height: 230px; }
  .address-search-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .address-submit { width: 100%; }
}

@media (max-width: 640px) {
  .map-app { padding: 12px; }
  .app-header { display: block; }
  .header-badge { margin-top: 14px; }
  .sidebar { display: block; }
  .sidebar-section { border-right: 0; }
  .address-search-panel { padding: 14px; }
  .address-search-form { grid-template-columns: 1fr 1fr; }
  .address-search-form label:first-child, .address-search-form label:nth-child(3), .address-search-form label:nth-child(4), .address-submit { grid-column: 1 / -1; }
  #map { min-height: 480px; height: 62vh; border-radius: 12px; }
  .results-list { grid-template-columns: 1fr; }
}
