* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #f5f7f8; color: #172126; }
button, input { font: inherit; }
.app { display: grid; grid-template-columns: 380px 1fr; height: 100vh; }
.panel { padding: 22px; overflow: auto; border-right: 1px solid #dfe5e8; background: #fff; z-index: 500; }
.panel h1 { margin: 0 0 8px; font-size: 1.55rem; }
.intro { margin: 0 0 22px; color: #5c6a70; line-height: 1.45; }
label { display: block; margin-bottom: 8px; font-size: .92rem; }
#radius { width: 100%; margin-bottom: 18px; }
.coords-readout { margin-bottom: 10px; padding: 10px 12px; border: 1px solid #d8e0e3; border-radius: 10px; background: #f7f9fa; display: grid; gap: 3px; }
.coords-readout span { color: #6a7880; font-size: .8rem; }
.coords-readout strong { font-size: .92rem; }
.coords { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.coords input { width: 100%; border: 1px solid #cfd8dc; border-radius: 9px; padding: 10px 11px; background: #fbfcfc; }
.actions { display: grid; gap: 8px; margin-top: 9px; }
button { border: 0; border-radius: 9px; padding: 11px 13px; cursor: pointer; background: #173b4f; color: white; font-weight: 650; }
button.secondary { background: #e9eff2; color: #173b4f; }
.summary { margin: 18px 0 12px; padding: 13px; border-radius: 10px; background: #f2f6f7; line-height: 1.4; }
.summary small { color: #6a7880; }
.results { display: grid; gap: 8px; }
.route-card { border: 1px solid #dde5e8; background: white; border-radius: 11px; padding: 11px 12px; cursor: pointer; transition: opacity .15s ease, border-color .15s ease, box-shadow .15s ease; }
.route-card:hover { border-color: #8da5af; }
.route-card.active { border-color: #173b4f; box-shadow: 0 0 0 2px rgba(23,59,79,.11); }
.route-card.dimmed { opacity: .38; }
.route-top { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 9px; align-items: center; margin-bottom: 7px; }
.route-chip { width: 32px; height: 32px; border-radius: 999px; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .86rem; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.route-title-wrap { min-width: 0; }
.route-name { font-weight: 720; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-sub { color: #78858b; font-size: .76rem; margin-top: 1px; }
.route-distance { font-size: .85rem; color: #405159; white-space: nowrap; }
.route-meta { display: flex; justify-content: space-between; gap: 12px; color: #607078; font-size: .82rem; padding-left: 43px; }
.empty { color: #6b777c; padding: 12px 0; }
.map { min-width: 0; height: 100vh; }
.leaflet-container { background: #dde7ea; cursor: crosshair; }
.route-badge-wrapper { background: transparent !important; border: 0 !important; }
.route-badge { width: 30px; height: 30px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 12px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; box-shadow: 0 2px 7px rgba(0,0,0,.28); transition: transform .12s ease; }
.route-badge.active { transform: scale(1.23); box-shadow: 0 3px 10px rgba(0,0,0,.38); }
.leaflet-tooltip { font-weight: 650; }
@media (max-width: 780px) { .app { grid-template-columns: 1fr; grid-template-rows: 44vh 56vh; } .panel { border-right: 0; border-bottom: 1px solid #dfe5e8; padding: 16px; } .map { height: 56vh; } }

.grayscale-map-pane { filter: grayscale(1) saturate(0) brightness(1.06) contrast(.92); }
.leaflet-color-map-pane { overflow: visible; }

.direction-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: -2px 0 7px; padding: 4px; border-radius: 10px; background: #eef2f4; }
.direction-button { padding: 8px 10px; border-radius: 7px; background: transparent; color: #51636b; font-size: .84rem; font-weight: 720; }
.direction-button.active { background: #173b4f; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.direction-note { margin: 0 0 12px; color: #7a878d; font-size: .73rem; line-height: 1.35; }

.direction-marker-wrapper { background: transparent !important; border: 0 !important; }
.direction-marker { height: 24px; min-width: 56px; padding: 2px 5px; border: 1.5px solid; border-radius: 999px; background: rgba(255,255,255,.94); display: inline-flex; align-items: center; justify-content: center; gap: 4px; box-shadow: 0 1px 5px rgba(0,0,0,.18); font-size: 9px; font-weight: 800; letter-spacing: .04em; }
.direction-marker b { display: inline-block; font-size: 15px; line-height: 1; transform-origin: center; }
.direction-marker.regreso { border-style: dashed; }

/* Compact route index */
.results { gap: 5px; }
.route-card.compact { padding: 7px 9px; border-radius: 9px; }
.route-card.compact.expanded { padding-bottom: 10px; }
.route-row { display: grid; grid-template-columns: 28px minmax(0,1fr) auto 18px; gap: 8px; align-items: center; min-height: 36px; }
.compact-chip { width: 28px; height: 28px; font-size: .76rem; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.compact-name { font-size: .9rem; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-card.compact .route-distance { font-size: .8rem; }
.route-chevron { color: #718087; font-size: .9rem; text-align: center; line-height: 1; }
.route-card.compact.active .route-chevron { color: #173b4f; }
.route-details { margin: 7px 0 0 36px; padding: 8px 0 1px; border-top: 1px solid #e5ebee; display: grid; grid-template-columns: 1fr 1fr; gap: 7px 12px; }
.route-details div { min-width: 0; display: grid; gap: 1px; }
.route-details span { color: #7a878d; font-size: .68rem; }
.route-details strong { color: #405159; font-size: .78rem; font-weight: 680; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.place-search { position: relative; margin: 0 0 12px; }
.place-search > label { margin-bottom: 6px; font-size: .82rem; font-weight: 680; color: #45575f; }
.place-search-box { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; }
.place-search-box input { width: 100%; min-width: 0; border: 1px solid #cfd8dc; border-radius: 9px; padding: 10px 11px; background: #fbfcfc; }
.place-search-box button { padding: 9px 12px; }
.place-suggestions { position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 1200; max-height: 260px; overflow: auto; border: 1px solid #d5dfe3; border-radius: 10px; background: #fff; box-shadow: 0 8px 24px rgba(24,45,55,.16); }
.place-suggestions[hidden] { display: none; }
.place-option { width: 100%; display: grid; gap: 2px; padding: 10px 11px; border: 0; border-radius: 0; border-bottom: 1px solid #edf1f3; background: #fff; color: #172126; text-align: left; font-weight: 400; }
.place-option:last-child { border-bottom: 0; }
.place-option:hover, .place-option:focus { background: #f1f5f6; outline: none; }
.place-option strong { font-size: .86rem; line-height: 1.2; }
.place-option span { color: #5f7078; font-size: .75rem; line-height: 1.25; }
.place-option small { color: #87949a; font-size: .68rem; }
.place-empty { padding: 11px; color: #65767e; font-size: .78rem; }
.coord-status { margin-bottom: 10px; padding: 9px 11px; border: 1px solid #d8e0e3; border-radius: 10px; background: #f7f9fa; display: grid; gap: 2px; }
.coord-status span { color: #6a7880; font-size: .72rem; }
.coord-status strong { font-size: .84rem; line-height: 1.25; }
.coord-status small { color: #697981; font-size: .75rem; }

.pin-name-input { width: 100%; margin: 0 0 4px; border: 1px solid #b9c7cd; border-radius: 9px; padding: 10px 11px; background: #fff; font-weight: 650; }
.pin-name-input:focus { outline: 2px solid rgba(23,59,79,.13); border-color: #173b4f; }
.pin-name-help { margin: 0 0 15px; color: #78878e; font-size: .72rem; }
.collapse-location { width: 100%; margin-top: 10px; }
.collapse-location:disabled { cursor: not-allowed; background: #dfe6e9; color: #89979d; }
.pin-compact { margin: 0 0 14px; }
.pin-compact[hidden], .location-setup[hidden] { display: none !important; }
.pin-compact-button { width: 100%; padding: 12px 13px; border: 1px solid #d6e0e4; border-radius: 12px; background: #fff; color: #172126; text-align: left; box-shadow: 0 1px 3px rgba(25,45,55,.06); display: grid; grid-template-columns: minmax(0,1fr) 20px; gap: 10px; align-items: center; }
.pin-compact-button:hover, .pin-compact-button:focus { border-color: #8ea5af; background: #fbfcfc; outline: none; }
.pin-compact-copy { min-width: 0; display: grid; gap: 3px; }
.pin-compact-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
.pin-compact-copy small { overflow: hidden; color: #6f7e85; font-size: .76rem; font-weight: 520; line-height: 1.28; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pin-compact-chevron { color: #718087; font-size: 1rem; text-align: center; line-height: 1; }
