:root {
  --ink: #172033;
  --muted: #687083;
  --line: #e7eaf0;
  --surface: #fff;
  --canvas: #f5f7fa;
  --blue: #2563eb;
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--canvas); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; }
a { color: var(--blue); }
.page-header { padding: 24px clamp(20px, 4vw, 56px) 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.home-link { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; }
.page-header h1 { max-width: 900px; margin: 0; font-size: clamp(28px, 4vw, 46px); line-height: 1.08; letter-spacing: -.035em; }
.page-header > p:not(.updated) { max-width: 780px; margin: 12px 0 0; color: var(--muted); line-height: 1.55; }
.updated { margin: 10px 0 0; color: #8c93a2; font-size: 12px; }
.intent-links { margin-top: 12px; }
.intent-links a { font-size: 13px; font-weight: 700; text-underline-offset: 3px; }
main { display: grid; grid-template-columns: minmax(360px, 46vw) 1fr; height: 100vh; min-height: 560px; }
.map-column { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
#map { flex: 1 1 auto; width: 100%; min-height: 0; background: #e8ebef; }
.results-column { overflow-y: auto; min-width: 0; }
.results-toolbar { position: sticky; top: 0; z-index: 4; padding: 18px 22px 14px; background: rgba(245,247,250,.96); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.summary { margin: 0 0 12px; font-size: 14px; font-weight: 700; line-height: 1.45; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button { border: 1px solid #d8dce5; border-radius: 999px; padding: 8px 13px; background: white; color: #4e5668; cursor: pointer; font: inherit; font-size: 13px; font-weight: 700; }
.filters button:hover { border-color: #aeb5c2; }
.filters button.active { color: white; border-color: var(--blue); background: var(--blue); }
.notice { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fff7df; color: #725515; font-size: 13px; line-height: 1.4; }
#results { padding: 4px 22px 36px; }
.results-toggle { display: none; }
.result-group h2 { margin: 24px 0 12px; font-size: 17px; }
.result-group h2 span { color: var(--muted); font-size: 13px; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.place-card { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 12px rgba(31,42,68,.04); cursor: pointer; outline: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.place-card:hover, .place-card:focus-visible { border-color: #aebbd4; box-shadow: 0 8px 24px rgba(31,42,68,.10); transform: translateY(-1px); }
.place-card.selected { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), 0 8px 24px rgba(37,99,235,.12); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.card-top-end { display: inline-flex; align-items: center; gap: 6px; }
.distance { color: var(--ink); font-size: 12px; font-weight: 750; white-space: nowrap; }
.type-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--type-color); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.type-badge::before { width: 7px; height: 7px; border-radius: 50%; background: var(--type-color); content: ""; }
.status-pill { border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 800; }
.status-pill.active { color: #057047; background: #dcfce7; }
.status-pill.inactive { color: #596174; background: #edf0f5; }
.status-pill.unknown { color: #7a5a10; background: #fff3cd; }
.place-card h3 { margin: 9px 0 5px; font-size: 17px; line-height: 1.25; }
.place-card > p { margin: 0; min-height: 36px; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.card-schedule { margin-top: 13px; border-top: 1px solid var(--line); padding-top: 10px; }
.schedule-row { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 12.5px; }
.schedule-row span { color: var(--muted); }
.schedule-row strong { text-align: right; }
.period { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 12px; }
.period a { flex: none; }
.detail-link { display: inline-block; margin-top: 12px; font-size: 12px; font-weight: 750; text-underline-offset: 3px; }
.empty-state { margin-top: 24px; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--muted); line-height: 1.55; }
/* Ficha del centro seleccionado: va debajo del mapa, en su misma columna, y el mapa se
   encoge para dejarle sitio. Sin position:fixed ni transparencias: no tapa nada. */
.place-panel { position: relative; flex: none; max-height: 55%; overflow-y: auto; padding: 18px 22px 20px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(23,32,51,.06); }
.place-panel[hidden] { display: none; }
.place-panel.open { animation: panel-in .2s ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.place-panel > button { position: absolute; top: 12px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #eef1f5; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; }
.place-panel > button:hover { background: #e2e6ed; color: var(--ink); }
.panel-type { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.panel-type::before { width: 7px; height: 7px; border-radius: 50%; background: var(--type-color); content: ""; }
.place-panel h2 { margin: 6px 44px 4px 0; font-size: 20px; line-height: 1.2; }
.panel-address { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.place-panel .card-schedule { margin-top: 12px; padding-top: 8px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.panel-actions a { border-radius: 10px; padding: 9px 13px; background: var(--blue); color: white; text-decoration: none; font-size: 13px; font-weight: 750; }
.panel-actions a.secondary { color: var(--blue); background: #eaf0ff; }
.panel-actions a:hover { filter: brightness(.95); }
.leaflet-marker-icon.is-selected { z-index: 1000 !important; }
.leaflet-marker-icon.is-selected svg { transform: scale(1.3); transform-origin: 50% 100%; filter: drop-shadow(0 3px 5px rgba(23,32,51,.35)); }
.locate-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 2px solid rgba(0,0,0,.2); border-radius: 4px; background: white; background-clip: padding-box; color: var(--ink); cursor: pointer; }
.locate-button:hover { background-color: #f4f4f4; }
.locate-button.is-active { color: var(--blue); }
.locate-button.is-locating svg { animation: locate-pulse .8s ease-in-out infinite alternate; }
@keyframes locate-pulse { from { opacity: .4; transform: scale(.9); } to { opacity: 1; transform: scale(1.05); } }
.locate-button:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }
.user-marker span { display: block; width: 18px; height: 18px; border: 3px solid white; border-radius: 50%; background: #1a73e8; box-shadow: 0 0 0 6px rgba(26,115,232,.2), 0 1px 4px rgba(0,0,0,.3); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: var(--blue) !important; color: white !important; font-weight: 800; }
.noscript { margin: 0; padding: 12px 20px; background: #fff3cd; }

@media (max-width: 800px) {
  .page-header { padding: 18px 18px 16px; }
  .page-header h1 { font-size: 29px; }
  .page-header > p:not(.updated) { font-size: 14px; }
  main { display: block; height: auto; min-height: 0; }
  .map-column { border-right: 0; border-bottom: 1px solid var(--line); scroll-margin-top: 0; }
  #map { flex: none; height: 42vh; min-height: 300px; }
  .place-panel { max-height: none; padding: 16px 16px 18px; box-shadow: none; }
  .results-column { overflow: visible; }
  .results-toolbar { position: static; padding: 16px 16px 12px; }
  #results { padding: 2px 16px 28px; }
  .results-toggle { width: 100%; align-items: center; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 3px 12px rgba(31,42,68,.06); font: inherit; font-size: 15px; font-weight: 750; text-align: left; cursor: pointer; }
  .results-toggle span:first-child { color: var(--muted); font-size: 13px; }
  .results-toggle .toggle-chevron { margin-left: auto; color: var(--blue); font-size: 22px; line-height: 1; transition: transform .18s; }
  .is-collapsible .results-toggle { display: flex; }
  .is-collapsible:not(.expanded) #results-groups { display: none; }
  .is-collapsible.expanded .toggle-chevron { transform: rotate(180deg); }
  .results-toggle:focus-visible { outline: 3px solid rgba(37,99,235,.35); outline-offset: 2px; }
  .cards { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .leaflet-control-attribution {
    width: 28px;
    height: 28px;
    max-width: none;
    margin: 0 8px 8px 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 50%;
    background: transparent !important;
    box-shadow: none;
    color: transparent;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
  }
  .leaflet-control-attribution::before {
    content: "©";
    display: flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    box-shadow: 0 2px 8px rgba(20,30,60,.16);
    color: #475569;
    font-size: 12px;
    font-weight: 750;
  }
  .leaflet-control-attribution a { display: none; }
  .leaflet-control-attribution:focus-visible::before {
    outline: 3px solid rgba(37,99,235,.35);
    outline-offset: 2px;
  }
  .leaflet-control-attribution.is-expanded {
    width: min(320px, calc(100vw - 16px));
    height: auto;
    max-width: calc(100vw - 16px);
    padding: 5px 7px !important;
    overflow: visible;
    border-radius: 8px;
    background: rgba(255,255,255,.94) !important;
    box-shadow: 0 3px 14px rgba(20,30,60,.16);
    color: #475569;
    font-size: 8px;
    line-height: 1.2;
  }
  .leaflet-control-attribution.is-expanded::before { display: none; }
  .leaflet-control-attribution.is-expanded a { display: inline; }
}
