/* ── Tipografía corporativa: Red Hat Display (self-hosted) ───────── */
/* Variable font (un solo archivo cubre todos los pesos 300-800).
 * Latin subset cubre español-Colombia; latin-ext se carga solo si hay caracteres extendidos.
 * font-display: swap → texto visible inmediatamente con la fuente fallback. */
@font-face {
  font-family: 'Red Hat Display';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/redhat-display-latin.7e28f9c03ec4.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Red Hat Display';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url("../fonts/redhat-display-latin-ext.858fefc36cb6.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
                 U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
                 U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

html {
  font-size: 14px;
  font-family: 'Red Hat Display', system-ui, sans-serif;
}
body, button, input, select, textarea {
  font-family: 'Red Hat Display', system-ui, sans-serif;
}

/* ── Brand color override ────────────────────────────────────────── */
:root {
  --pico-primary:                  #128ece;
  --pico-primary-hover:            #0f7ab8;
  --pico-primary-focus:            rgba(18, 142, 206, 0.25);
  --pico-primary-inverse:          #fff;
  --pico-primary-underline:        rgba(18, 142, 206, 0.5);
  --brand-bg:                      #3d3d3c;
  --brand-text:                    #fff;
}

[role=group]:has(input:not([type=submit],[type=button]):focus,select:focus), [role=search]:has(input:not([type=submit],[type=button]):focus,select:focus){
  --pico-group-box-shadow: none;
}
[role=group]:has(button:focus,[type=submit]:focus,[type=button]:focus,[role=button]:focus), [role=search]:has(button:focus,[type=submit]:focus,[type=button]:focus,[role=button]:focus){
  --pico-group-box-shadow: none;
}

/* ── Skip link (accesibilidad) ───────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--brand-bg);
  color: var(--brand-text);
  border-radius: 0 0 6px 6px;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.1s;
}
.skip-link:focus { top: 0; }

/* ── Navbar ──────────────────────────────────────────────────────── */
header.site-header {
  background: var(--brand-bg);
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
header.site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0;
  flex-wrap: wrap;
  gap: 0;
}
header.site-header nav > ul { margin: 0; padding: 0; list-style: none; }

/* Marca */
header.site-header a,
header.site-header span.nav-user {
  color: rgba(255,255,255,.88);
  font-size: 0.875rem;
}
header.site-header a:hover { color: #fff; text-decoration: none; }
header.site-header .brand {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

/* Botón hamburguesa — visible solo en móvil */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  margin: 0;
  width: auto;
  line-height: 1;
}
.hamburger,
.hamburger::before,
.hamburger::after {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .25s, opacity .2s;
  position: relative;
}
.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
}
.hamburger::before { top: -7px; }
.hamburger::after  { top:  7px; }

/* Menú de links — horizontal en desktop */
.nav-menu {
  display: flex;
  align-items: center;
  flex-direction: row;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-menu li {
  padding: 0;
  display: flex;
  align-items: center;
}
.nav-menu a {
  display: flex;
  align-items: center;
  padding: 0.35rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
  line-height: 1;
}
@media (min-width: 641px) {
  .nav-menu li { margin: 0 8px; }
}
.nav-menu a:hover { background: rgba(255,255,255,.12); }
.nav-user { color: rgba(255,255,255,.65); font-size: 0.8rem; padding: 0 0.75rem; }

/* Botón salir en navbar */
button.nav-logout {
  background: none;
  border: 1px solid rgba(255,255,255,.4);
  color: rgba(255,255,255,.88);
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  border-radius: 5px;
  cursor: pointer;
  margin: 0;
  width: auto;
  line-height: 1.4;
}
button.nav-logout:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── Responsive: menú hamburguesa en móvil ───────────────────────── */
@media (max-width: 640px) {
  .nav-toggle { display: block; }

  .nav-menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 0.5rem 0 0.75rem;
    gap: 0.1rem;
    border-top: 1px solid rgba(255,255,255,.15);
    margin-top: 0.25rem;
  }
  .nav-menu.is-open { display: flex; }

  .nav-menu a,
  .nav-menu button.nav-logout {
    width: 100%;
    text-align: left;
    padding: 0.85rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.2rem;
  }
  .nav-user { padding: 0.85rem 0.75rem; }
  .nav-menu li form { width: 100%; }
  .nav-menu button.nav-logout { border: none; font-size: 0.875rem; }
  .nav-menu button.nav-logout:hover { background: rgba(255,255,255,.1); }

  header.site-header nav { flex-wrap: wrap; padding: 0.25rem 0; }
}

/* ── Stats (dashboard) ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  text-align: center;
  padding: 1.5rem 1rem;
  margin: 0;
}
.stat-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--pico-primary);
  line-height: 1;
  display: block;
}
.stat-label {
  font-size: 0.85rem;
  color: var(--pico-muted-color, #6b7280);
  margin-top: 0.4rem;
  display: block;
}

/* ── Acciones principales ────────────────────────────────────────── */
.action-row {
  margin-bottom: 1.5rem;
}
.action-row > button,
.action-row > a[role="button"] {
  margin-bottom: 0;
}
/* Modificador: reintroduce el margen abajo del submit en el form de ruta */
.action-row--spaced > button,
.action-row--spaced > a[role="button"] {
  margin-bottom: 1rem;
}
.action-row--tight { margin-bottom: 0.5rem; }

/* Bloque de nota suelto (observaciones, lista de distribución) */
.note-block h2 { font-size: 0.95rem; margin-bottom: 0.5rem; }
.note-block p { margin: 0; }

/* Igualar altura entre <button> y <a role="button"> */
[role="button"] {
  padding-top: var(--pico-form-element-spacing-vertical, 0.75rem);
  padding-bottom: var(--pico-form-element-spacing-vertical, 0.75rem);
  line-height: var(--pico-line-height, 1.5);
  box-sizing: border-box;
}

/* ── Switch toggle ───────────────────────────────────────────────── */
.switch-wrapper {
  margin-bottom: 1rem;
}
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  user-select: none;
}
.switch-track {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch-track input[type="checkbox"] {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.switch-knob {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: background .2s;
}
.switch-knob::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch-track input:checked + .switch-knob { background: var(--pico-primary); }
.switch-track input:checked + .switch-knob::before { transform: translateX(20px); }
.switch-track input:focus-visible + .switch-knob {
  outline: 3px solid var(--pico-primary-focus);
  outline-offset: 2px;
}

.switch-wrapper:has(label[for="id_free_trade_zone"]) {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* ── Fieldset como sección de formulario ─────────────────────────── */
fieldset.form-section { border-radius: 8px; margin-bottom: 1rem; }
fieldset.form-section legend { font-weight: 700; font-size: 1rem; }

/* ── Errores de campo ────────────────────────────────────────────── */
.field-error {
  color: var(--pico-del-color, #c0392b);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: block;
}

/* ── Detalle de guía ─────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.detail-section { margin: 0; }
.detail-section h2 {
  font-size: 0.95rem;
  border-bottom: 1px solid var(--pico-muted-border-color, #e5e7eb);
  padding-bottom: 0.4rem;
  margin-bottom: 0.75rem;
}

/* ── Auditoría ───────────────────────────────────────────────────── */
.audit-section {
  background: var(--pico-card-background-color, #f9fafb);
  border: 1px solid var(--pico-muted-border-color, #e5e7eb);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-top: 1rem;
}
.audit-section h2 {
  font-size: 0.9rem;
  color: var(--pico-muted-color, #6b7280);
  margin-bottom: 0.5rem;
}

/* ── Filtro de fecha ─────────────────────────────────────────────── */
.date-filter-form {
  margin-bottom: 1.5rem;
}
.date-filter-form label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--pico-muted-color, #6b7280);
}
.date-filter-row {
  display: flex;
  /* `flex-end` para que los botones queden a la altura del input, no al
     centro del wrapper (label + input). */
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
/* Dejamos que inputs, selects y botones usen el sizing nativo de Pico para
   que todos compartan la misma altura. Solo neutralizamos el `margin-bottom`
   por defecto y el `width: 100%` para que no se estiren en el flex row. */
.date-filter-row input,
.date-filter-row select,
.date-filter-row button,
.date-filter-row a[role="button"] {
  width: auto;
  margin: 0;
  box-sizing: border-box;
}
.filter-badge {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--pico-primary);
  margin-left: 0.5rem;
}

/* ── Separadores de día en el listado ───────────────────────────── */
.day-heading {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--pico-muted-color, #6b7280);
  text-transform: capitalize;
  border-bottom: 1px solid var(--pico-muted-border-color, #e5e7eb);
  padding-bottom: 0.3rem;
  margin: 1.5rem 0 0.5rem;
}
.day-heading:first-of-type { margin-top: 0; }

/* Encabezado de agrupación por día */
.day-heading {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--pico-muted-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.25rem 0 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--pico-muted-border-color, #e5e7eb);
}
.filter-badge { font-weight: 400; color: var(--pico-primary); }

/* ── Tabla ───────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

/* ── Logo ────────────────────────────────────────────────────────── */
.nav-logo {
  height: 48px;
  width: 48px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 0.25rem;
}
.login-logo {
  display: block;
  height: 160px;
  width: 160px;
  object-fit: contain;
  margin: 0 auto 0.75rem;
}

/* ── Página de login ─────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pico-background-color, #f5f7fa);
  padding: 1rem;
}
.login-card { width: 100%; max-width: 380px; }
.login-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pico-primary);
  margin-bottom: 0.25rem;
  display: block;
}

/* ── Visually hidden (accesibilidad) ────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Route builder (isla Vue de logística) ──────────────────────── */
[v-cloak] { display: none !important; }

.rb-grid { gap: 1.5rem; }
.rb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--pico-muted-border-color, #e5e7eb);
  border-radius: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.rb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--pico-muted-border-color, #eef0f2);
}
.rb-item:last-child { border-bottom: 0; }
.rb-item-stack { flex-direction: column; align-items: stretch; }
.rb-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.rb-details {
  margin-top: 0.4rem;
  font-size: 0.78rem;
}
.rb-details summary {
  cursor: pointer;
  color: var(--pico-primary);
  padding: 0.25rem 0;
  user-select: none;
}
.rb-details summary:hover { text-decoration: underline; }
.rb-details-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 0.75rem;
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.75rem;
  background: var(--pico-card-background-color, #f9fafb);
  border-radius: 6px;
}
.rb-details-dl dt { font-weight: 600; color: var(--pico-muted-color, #6b7280); margin: 0; }
.rb-details-dl dd { margin: 0; word-break: break-word; }
.rb-label { display: flex; flex-direction: column; font-size: 0.85rem; line-height: 1.3; }
.rb-label small { color: var(--pico-muted-color, #6b7280); font-size: 0.75rem; }
.rb-controls { display: flex; gap: 0.25rem; flex-shrink: 0; }
.rb-btn {
  width: auto;
  margin: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  min-height: 36px;
  line-height: 1;
}
.rb-remove { color: var(--pico-del-color, #c0392b); }
.rb-empty {
  padding: 1rem 0.75rem;
  color: var(--pico-muted-color, #6b7280);
  font-style: italic;
  font-size: 0.85rem;
}
.rb-estimate {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: var(--pico-card-background-color, #f9fafb);
  border: 1px solid var(--pico-muted-border-color, #e5e7eb);
  border-radius: 8px;
}
.rb-estimate-label { font-weight: 600; }
.rb-estimate-value { font-size: 1rem; }
.rb-estimate-value small { color: var(--pico-muted-color, #6b7280); font-size: 0.78rem; margin-left: 0.35rem; }
.rb-estimate-value small.rb-warn { color: var(--pico-del-color, #c0392b); }
.rb-recalc { width: auto; margin: 0 0 0 auto; padding: 0.4rem 0.9rem; font-size: 0.82rem; }

/* ── Fase 6: modal de sugerencia de orden (route builder + detalle) ─── */
.rb-optimize-row { margin: 0.5rem 0 0.75rem; }
.rb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.rb-modal {
  background: var(--pico-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color, #e5e7eb);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
}
.rb-modal:focus { outline: none; }
.rb-modal h3 { margin-top: 0; }
.rb-modal h4 { margin: 0 0 0.5rem; font-size: 0.9rem; }
/* Columnas de "Orden actual / Orden sugerido" — el borde de <ol> quedaba
 * pegado al texto. Padding interno para que respire. */
.rb-modal .grid > div {
  padding: 0.75rem;
  border: 1px solid var(--pico-muted-border-color, #e5e7eb);
  border-radius: 6px;
}
/* Separa el resumen "Tiempo actual · Optimizado · Ahorro" del bloque de listas
 * y del pie del modal. */
.rb-modal .grid + p { margin-top: 1rem; margin-bottom: 1rem; }
.rb-modal .action-row > button + button { margin-left: 0.75rem; }
.rb-optimize-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.rb-optimize-badge--optimized {
  background: #e6f4ea;
  color: #1e7e34;
}
.rb-optimize-badge--modified {
  background: #fdf3d9;
  color: #8a6d1a;
}
@media (prefers-color-scheme: dark) {
  .rb-optimize-badge--optimized { background: #123a20; color: #6fd28c; }
  .rb-optimize-badge--modified { background: #3a3113; color: #e8c766; }
}

.sede-address {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--pico-muted-color, #6b7280);
}

/* ── Mapa de la ruta (detalle) ───────────────────────────────────── */
/* Google Maps lee clientHeight al iniciar; una altura real (55vh + mínimo)
 * mantiene fitBounds exacto en desktop y móvil. */
.route-map {
  position: relative;
  width: 100%;
  height: 55vh;
  min-height: 360px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--pico-muted-border-color, #e5e7eb);
}
.route-map iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
/* Aviso cuando falta la clave de Google Maps (degradación sin mapa). */
.map-unavailable {
  padding: 1rem;
  color: var(--pico-muted-color, #6b7280);
  font-size: 0.9rem;
}

/* Pico estiliza globalmente button / [role=button] / [type=button]. Google Maps
 * marca los marcadores (AdvancedMarkerElement) y algunos controles con esos
 * selectores, así que heredaban el skin azul de Pico y se veían como cuadros
 * azules. Anclando al id del contenedor ganamos especificidad sobre Pico y
 * anulamos el skin SOLO dentro del mapa. Los controles nativos usan estilos
 * inline (que ganan a cualquier hoja), así que no se ven afectados. */
#route-map button,
#route-map [role="button"],
#route-map [type="button"],
#live-map button,
#live-map [role="button"],
#live-map [type="button"],
gmp-advanced-marker,
gmp-advanced-marker button,
gmp-advanced-marker [role="button"] {
  --pico-background-color: transparent;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  box-shadow: none;
  color: inherit;
  font: inherit;
  min-width: 0;
  min-height: 0;
  margin-top: -10px !important;
}
.route-map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--pico-muted-color, #6b7280);
}
.route-map-legend li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.route-map-legend__swatch {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}
.route-map-legend__swatch--planned {
  background: var(--pico-primary);
  opacity: 0.75;
}
.route-map-legend__swatch--gps {
  background: #3c3c3b;
}
.route-map-legend__swatch--moto {
  background: #f8e000;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid #3c3c3b;
}
.rb-map { margin-top: 1rem; }
.route-map-slot { margin-top: 1.5rem; }

/* ── Recorrido de ruta (detalle) ─────────────────────────────────── */
.route-stops { list-style: none; margin: 0; padding: 0; }
.route-stop {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color, #eef0f2);
}
.route-stop:last-child { border-bottom: 0; }
.route-stop > div { display: flex; flex-direction: column; gap: 0.15rem; }
.route-stop small { color: var(--pico-muted-color, #6b7280); font-size: 0.8rem; }
.route-stop-badge {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--pico-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}
.route-stop--sede .route-stop-badge { background: var(--brand-bg, #3d3d3c); }

.route-stop-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  align-self: flex-start;
  margin-top: 0.1rem;
}
.route-stop-status--delivered {
  background: rgba(46, 160, 67, 0.12);
  color: #1f7a35;
}
.route-stop-status--failed {
  background: rgba(192, 57, 43, 0.12);
  color: #a93226;
}
.route-stop-evidence-btn {
  align-self: flex-start;
  margin-top: 0.4rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.2;
}

/* ── Evidencia (modal compartido + sección en guía) ──────────────── */
.evidence-section dl { margin-bottom: 0.75rem; }
.evidence-section button { margin: 0; }

/* ── Novedades de no-entrega (Fase 7) ────────────────────────────── */
.novedad-section { border-left: 3px solid #c0392b; padding-left: 1rem; }
.novedad-section h2 { color: #c0392b; }
.novedad-section dl { margin-bottom: 0.75rem; }
.novedad-section button { margin: 0; }
.novedad-section hr { margin: 0.75rem 0; }

.evidence-modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(960px, 95vw);
  width: 100%;
  color: inherit;
}
.evidence-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.evidence-modal > article {
  margin: 0;
  border-radius: var(--pico-border-radius, 0.5rem);
  background: var(--pico-card-background-color, #fff);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.evidence-modal > article > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color, #eef0f2);
}
.evidence-modal__title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}
.evidence-modal__close {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  border-radius: 0.25rem;
}
.evidence-modal__close:hover,
.evidence-modal__close:focus-visible {
  background: rgba(0, 0, 0, 0.06);
}
.evidence-modal__body {
  padding: 1rem;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.evidence-modal__status,
.evidence-modal__error {
  margin: 0;
  text-align: center;
}
.evidence-modal__error { color: var(--pico-del-color, #c0392b); }
.evidence-modal__figure {
  margin: 0;
  width: 100%;
  display: flex;
  justify-content: center;
}
.evidence-modal__figure img {
  max-width: 100%;
  max-height: 70vh;
  height: auto;
  width: auto;
  border-radius: 0.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.evidence-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--pico-muted-border-color, #eef0f2);
  flex-wrap: wrap;
}
.evidence-modal__footer button,
.evidence-modal__footer a[role="button"] { margin: 0; }

/* ── Fase 6: modal de sugerencia de orden (detalle de ruta, dialog nativo) ── */
.optimize-modal {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(640px, 95vw);
  width: 100%;
  color: inherit;
}
.optimize-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.optimize-modal > article {
  margin: 0;
  border-radius: var(--pico-border-radius, 0.5rem);
  background: var(--pico-card-background-color, #fff);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.optimize-modal > article > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color, #eef0f2);
}
.optimize-modal__title { margin: 0; font-size: 1rem; line-height: 1.2; }
.optimize-modal__close {
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  border-radius: 0.25rem;
}
.optimize-modal__close:hover,
.optimize-modal__close:focus-visible { background: rgba(0, 0, 0, 0.06); }
.optimize-modal__body { padding: 1rem; overflow: auto; }
.optimize-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--pico-muted-border-color, #eef0f2);
  flex-wrap: wrap;
}
.optimize-modal__footer button { margin: 0; }
.optimize-modal__footer button + button { margin-left: 0.75rem; }
.optimize-modal__note { color: var(--pico-muted-color, #6b7280); }
/* Columnas "Orden actual / Orden sugerido" del <dialog> nativo — mismo
 * tratamiento visual que en el modal Vue. */
.optimize-modal__body .grid > div {
  padding: 0.75rem;
  border: 1px solid var(--pico-muted-border-color, #e5e7eb);
  border-radius: 6px;
}
.optimize-modal__body [data-optimize-summary] { margin-top: 1rem; margin-bottom: 1rem; }

/* ── Isla de subida de lista de distribución ─────────────────────── */
.distribution-list-island { margin-bottom: 1rem; }
.distribution-list-island__label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.distribution-list-island__help {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--pico-muted-color, #6b7280);
}
.distribution-list-island__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.75rem;
  border: 1px dashed var(--pico-muted-border-color, #d4d8de);
  border-radius: var(--pico-border-radius, 0.5rem);
  background: var(--pico-card-background-color, #fbfcfd);
}
.distribution-list-island__row button { margin: 0; padding: 0.35rem 0.85rem; font-size: 0.85rem; }
.distribution-list-island__file {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
}
.distribution-list-island__file strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.distribution-list-island__file--ok { color: #1f7a35; }
.distribution-list-island__hint {
  color: var(--pico-muted-color, #6b7280);
  font-size: 0.8rem;
}
.distribution-list-island__error {
  color: var(--pico-del-color, #c0392b);
  font-size: 0.85rem;
  flex: 1 1 auto;
}
.distribution-list-island__spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: distribution-list-spin 0.8s linear infinite;
  vertical-align: -2px;
}
@keyframes distribution-list-spin { to { transform: rotate(360deg); } }

/* ── Form actions (submit + cancelar en formularios CRUD) ──────────── */
.form-actions {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0 1.5rem;
}
/* En desktop el flex estira al botón a la altura del Cancelar (que arrastra
   margin-bottom de Pico). Quitamos el margin del submit para que ambos
   queden a la misma altura; en móvil mantenemos el margin para separar
   visualmente cuando colapsan. */
@media (min-width: 641px) {
  .form-actions > button[type="submit"] { margin-bottom: 0; }
}

/* ── Encabezado de página ─────────────────────────────────────────── */
.page-title { margin-bottom: 1rem; }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.page-header h1 { margin: 0; }
.page-header__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.page-header__actions > [role="button"] { margin: 0; }

/* ── Isla multi-anexos (M-002) ─────────────────────────────────────── */
.attachments-island { margin-top: 1rem; }
.attachments-island__label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.attachments-island__help {
  display: block;
  color: var(--pico-muted-color, #6b7280);
  margin-bottom: 0.75rem;
}
.attachments-island__list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.attachments-island__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(18, 142, 206, 0.06);
  border-radius: 6px;
  flex-wrap: wrap;
}
.attachments-island__file { flex: 1 1 auto; word-break: break-word; }
.attachments-island__hint { color: var(--pico-muted-color, #6b7280); font-weight: 400; }
.attachments-island__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.attachments-island__actions > * { margin: 0; }
.attachments-island__row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.attachments-island__pending {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--pico-muted-color, #6b7280);
}
.attachments-island__spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(18, 142, 206, 0.3);
  border-top-color: #128ece;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  display: inline-block;
}
.attachments-island__error {
  display: block;
  color: var(--pico-color-red-600, #dc2626);
  margin-top: 0.5rem;
}
.attachments-readonly {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.attachments-readonly small {
  color: var(--pico-muted-color, #6b7280);
  margin-left: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.section-title { margin-bottom: 0.75rem; }

/* Aviso discreto de guías nuevas en el dashboard (realce vía JS). */
.new-guides-alert {
  display: inline-block;
  margin-left: 0.6rem;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--pico-primary-inverse, #fff);
  background: var(--pico-primary, #128ece);
  border-radius: 999px;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}
.new-guides-alert:hover { background: var(--pico-primary-hover, #0f7ab8); }
.new-guides-alert[hidden] { display: none; }

/* ── Texto auxiliar ───────────────────────────────────────────────── */
.text-muted { color: var(--pico-muted-color, #6b7280); }
.text-hint {
  color: var(--pico-muted-color, #6b7280);
  font-style: italic;
}
.subtitle {
  color: var(--pico-muted-color, #6b7280);
  margin-top: -0.5rem;
}

/* ── Espaciado ────────────────────────────────────────────────────── */
.spaced-top { margin-top: 1.5rem; }
.inline-form { display: inline; }

/* ── Empty state ──────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--pico-muted-color, #6b7280);
  font-style: italic;
  padding: 2rem;
}

/* ── Alertas (mensajes flash y errores de formulario) ─────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--pico-muted-border-color, #e5e7eb);
  border-radius: var(--pico-border-radius, 0.375rem);
}
.alert > :first-child { margin-top: 0; }
.alert > :last-child  { margin-bottom: 0; }
.alert--error   { border-left-color: var(--pico-del-color, #c0392b); }
.alert--success { border-left-color: var(--pico-ins-color, #27ae60); }

/* Warning ámbar, autoconsistente por tema. Claro: crema + texto marrón (~9:1).
   Oscuro: ámbar oscuro + texto claro (~11:1). Cubre el media query (preferencia
   del SO) y el toggle de tema de la app ([data-theme]). */
.alert--warning {
  border-left-color: #d97706;
  background: #fff8eb;
  color: #663c00;
}
.alert--warning a { color: inherit; text-decoration: underline; }
@media (prefers-color-scheme: dark) {
  .alert--warning { background: #33240a; color: #fcd9a0; border-left-color: #f59e0b; }
}
:root[data-theme="light"] .alert--warning { background: #fff8eb; color: #663c00; border-left-color: #d97706; }
:root[data-theme="dark"]  .alert--warning { background: #33240a; color: #fcd9a0; border-left-color: #f59e0b; }

/* ── Ayuda de campo de formulario ─────────────────────────────────── */
.field-row { margin-bottom: 0.75rem; }
.field-help { display: block; margin-top: 0.2rem; }

/* Acordeón compacto de días con restricción, bajo el input de fecha */
.schedule-hint { font-size: 0.85rem; margin-top: 0.25rem; }
.schedule-hint summary { cursor: pointer; color: var(--pico-muted-color, #6b7280); }
.schedule-hint ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
#delivery-restriction-alert { margin-top: 0.5rem; }

/* ── Places Autocomplete (isla JS en el form de guías) ───────────── */
.address-autocomplete-wrapper { margin-bottom: 0.75rem; }
.address-autocomplete-wrapper gmp-place-autocomplete { width: 100%; max-width: 100%; }
.address-autocomplete-manual {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--pico-primary, #128ece);
  font-size: 0.875rem;
  text-decoration: underline;
  cursor: pointer;
  width: auto;
}
.address-autocomplete-manual:hover { text-decoration: none; }
.form-error-summary {
  font-size: 0.875rem;
  color: var(--pico-del-color, #c0392b);
}

/* ── Paginación ───────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}
.pagination a[role="button"] {
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
}
.pagination__status {
  font-size: 0.9rem;
  color: var(--pico-muted-color, #6b7280);
}

/* ── Badge de estado de ruta ──────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.status-badge::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-badge--pending     { background: rgba(107, 114, 128, 0.14); color: #4b5563; }
.status-badge--in_progress { background: rgba(18, 142, 206, 0.14);  color: #0f6fa3; }
.status-badge--completed   { background: rgba(46, 160, 67, 0.14);   color: #1f7a35; }

/* ── Indicadores de métricas (a tiempo / fuera de tiempo) ─────────── */
.metric-yes { color: #1f7a3a; font-weight: 600; }
.metric-no  { color: var(--pico-del-color, #c0392b); font-weight: 600; }

/* ── Toast de estado de subida ────────────────────────────────────
   Inspirado en Sonner / react-hot-toast: fondo blanco, borde sutil,
   acento de color por variante en el ícono y una franja izquierda.
   Desktop: esquina inferior derecha. Móvil: arriba full-width.
*/
.upload-status-popup {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: min(360px, calc(100vw - 2rem));
  padding: 0.85rem 1rem 0.85rem 0.9rem;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-left: 3px solid var(--upload-accent, #128ece);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.35;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.12),
    0 6px 10px -6px rgba(0, 0, 0, 0.08);
  animation: upload-status-popup-in 220ms cubic-bezier(0.16, 1, 0.3, 1);
}
.upload-status-popup[hidden] { display: none !important; }

/* Variantes: solo cambian el color de acento e ícono, no el fondo. */
.upload-status-popup--info  { --upload-accent: #128ece; }
.upload-status-popup--ok    { --upload-accent: #16a34a; }
.upload-status-popup--error { --upload-accent: #dc2626; }

.upload-status-popup__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  color: var(--upload-accent);
}

.upload-status-popup__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.upload-status-popup__title {
  font-weight: 600;
  font-size: 0.92rem;
  color: #111827;
}
.upload-status-popup__text {
  color: #4b5563;
  font-weight: 400;
  font-size: 0.85rem;
}

.upload-status-popup__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-top: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #9ca3af;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.upload-status-popup__close:hover { background: #f3f4f6; color: #374151; }
.upload-status-popup__close:focus-visible {
  outline: 2px solid var(--upload-accent);
  outline-offset: 1px;
}

/* Spinner del estado "uploading" — círculo con arco animado. */
.upload-status-popup__spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(18, 142, 206, 0.22);
  border-top-color: var(--upload-accent);
  animation: upload-status-spin 700ms linear infinite;
}

@keyframes upload-status-popup-in {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0)   scale(1);    opacity: 1; }
}
@keyframes upload-status-spin {
  to { transform: rotate(360deg); }
}

/* Móvil: arriba, full-width con márgenes, entra desde arriba. */
@media (max-width: 600px) {
  .upload-status-popup {
    top: 0.75rem;
    right: 0.75rem;
    left: 0.75rem;
    bottom: auto;
    width: auto;
    animation: upload-status-popup-in-mobile 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes upload-status-popup-in-mobile {
    from { transform: translateY(-12px) scale(0.98); opacity: 0; }
    to   { transform: translateY(0)     scale(1);    opacity: 1; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .upload-status-popup,
  .upload-status-popup__spinner { animation: none; }
}

/* ── Estado de guía (badge de color en el dashboard) ─────────────── */
/* Columna angosta al inicio de la tabla: solo un dot con tooltip. */
.col-status { width: 24px; padding-right: 0 !important; text-align: center; }

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.04);
}
.status-dot.status-sin_leer   { background: #9ca3af; }
.status-dot.status-leida      { background: #128ece; }
.status-dot.status-asignada   { background: #e08e00; }
.status-dot.status-completada { background: #1f7a3a; }
.status-dot.status-con_novedad { background: #c0392b; }

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: #555;
  margin: 0.25rem 0 0.75rem;
  padding: 0;
  list-style: none;
}
.status-legend li { display: inline-flex; align-items: center; gap: 0.4rem; }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  header.site-header { padding: 0 0.75rem; }
  .rb-recalc { margin-left: 0; }
  
  .action-row > button,
  .action-row > a[role="button"] {
    margin-bottom: 1rem;
  }
}

/* ── Fase 5 · Live GPS map ─────────────────────────────────────────── */
.live-map-page .page-header {
  margin-bottom: 1rem;
}
.live-map-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: stretch;
}
.live-map {
  height: 70vh;
  min-height: 420px;
  border-radius: 6px;
  border: 1px solid var(--pico-muted-border-color, #ccc);
}
.live-map-sidebar {
  background: var(--pico-card-background-color, #fff);
  border: 1px solid var(--pico-muted-border-color, #ccc);
  border-radius: 6px;
  padding: 0.75rem;
  max-height: 70vh;
  overflow-y: auto;
}
.live-map-sidebar h2 {
  font-size: 1rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.dispatcher-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
}
.dispatcher-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color, #eee);
  min-height: 44px;
  align-items: center;
}
.dispatcher-item span {
  grid-column: 2;
  font-weight: 500;
}
.dispatcher-item small {
  grid-column: 2;
  display: block;
}
.dispatcher-item__label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.dispatcher-item__dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #8a8a8a;
  flex-shrink: 0;
}
.dispatcher-item.is-active .dispatcher-item__dot { background: #25a244; }
.dispatcher-item.is-delayed .dispatcher-item__dot { background: #e58e26; }
.dispatcher-item.is-offline .dispatcher-item__dot { background: #8a8a8a; }
.dispatcher-item.is-no_signal .dispatcher-item__dot { background: #6b7280; }
.dispatcher-item.is-pending .dispatcher-item__dot { background: #128ece; }
.dispatcher-item.is-completed .dispatcher-item__dot { background: #5aa8d6; }
.dispatcher-item.is-available .dispatcher-item__dot { background: #8a8a8a; }
.dispatcher-item__swatch {
  display: inline-block;
  width: 6px;
  height: 18px;
  border-radius: 2px;
  margin-right: 0.25rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.dispatcher-item.is-empty {
  grid-template-columns: 1fr;
  font-style: italic;
  padding: 0.75rem 0;
}
/* Backwards-compat con el estado 'is-stale' que usaba el markup anterior. */
.dispatcher-item.is-stale .dispatcher-item__dot { background: #8a8a8a; }

/* Leyenda + resumen ─────────────────────────────────────────────── */
.live-map-legend {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--pico-muted-color, #6b7280);
}
.live-map-legend li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.live-map-legend__dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #8a8a8a;
}
.live-map-legend__dot.is-active { background: #25a244; }
.live-map-legend__dot.is-delayed { background: #e58e26; }
.live-map-legend__dot.is-offline { background: #8a8a8a; }
.live-map-legend__dot.is-pending { background: #128ece; }
.live-map-legend__dot.is-completed { background: #5aa8d6; }
.dispatcher-summary {
  margin: 0.4rem 0;
  font-size: 0.95rem;
}
.dispatcher-summary__pill {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 0.35rem;
  color: white;
}
.dispatcher-summary__pill.is-active { background: #25a244; }
.dispatcher-summary__pill.is-delayed { background: #e58e26; }
.dispatcher-summary__pill.is-offline { background: #8a8a8a; }
.dispatcher-summary__pill.is-pending { background: #128ece; }
.dispatcher-summary__pill.is-completed { background: #5aa8d6; }
.dispatcher-summary__pill.is-available { background: #6b7280; }
.live-map-table {
  margin-top: 1.5rem;
}
.live-map-table h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 900px) {
  .live-map-layout {
    grid-template-columns: 1fr;
  }
  .live-map {
    height: 55vh;
  }
  .live-map-sidebar {
    max-height: none;
  }
}

/* Google Maps popups (InfoWindow). Google fija inline overflow:scroll y unos
 * paddings/altos generosos que dejan una barra de scroll y mucho aire para un
 * texto corto. Ajustamos con !important (los estilos inline de Google mandan si
 * no forzamos). El botón de cierre viene con 48x48 de área táctil; lo reducimos. */
.gm-style .gm-style-iw-c {
  padding: 0.75rem !important;
}

.gm-style .gm-style-iw-d {
  overflow: visible !important;
  max-height: none !important;
}

.gm-style .gm-style-iw-d > div {
  font-family: 'Red Hat Display', system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #3c3c3b;
  font-weight: bold;
}

/* Botón de cierre: viene con 48x48 de área táctil. Lo reducimos pero SIN
 * colapsar la fila (si le ponemos height:0 se recorta y desaparece). El icono
 * es un <span> con mask-image; su color sale del background-color del span. */
.gm-style .gm-style-iw-chr .gm-ui-hover-effect {
  width: 32px !important;
  height: 32px !important;
}

.gm-style .gm-style-iw-chr .gm-ui-hover-effect > span {
  width: 16px !important;
  height: 16px !important;
  margin: 7px !important;
  background-color: #3c3c3b !important;
}

.gm-style .gm-style-iw-chr {
  height: 0 !important;
}