:root {
  /* Fondo predominante Blanco */
  --bg-app: #ffffff;
  --bg-surface: #ffffff;
  --bg-subtle: #fffdf5;
  --bg-warm-tint: #fef9c3;

  /* Bordes en tonos arena / mostaza suave */
  --border-color: #ede4c8;
  --border-strong: #d9c382;
  --border-mustard: #ca8a04;

  /* Tipografía de alto contraste */
  --text-main: #1c1917;
  --text-secondary: #44403c;
  --text-muted: #78716c;

  /* Paleta Amarillos y Mostazas */
  --mustard-bright: #facc15;
  --mustard-main: #eab308;
  --mustard-dark: #ca8a04;
  --mustard-deep: #a16207;
  --mustard-accent: #d97706;
  --mustard-light: #fef08a;
  --mustard-soft: #fefce8;

  /* Estados complementarios */
  --success: #15803d;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --origin-color: #b45309;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;

  --shadow-sm: 0 2px 6px rgba(28, 25, 23, 0.05);
  --shadow-md: 0 6px 16px rgba(161, 98, 7, 0.10);
  --shadow-lg: 0 14px 30px rgba(28, 25, 23, 0.16);

  --mobile-nav-height: calc(68px + env(safe-area-inset-bottom, 0px));
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html,
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-main);
  background: var(--bg-app);
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   LAYOUT PRINCIPAL (ESCRITORIO >= 901px)
   ========================================================================== */
.app-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  height: 100dvh;
  width: 100vw;
  background: #ffffff;
}

/* SIDEBAR / PANEL PRINCIPAL */
.sidebar {
  background: #ffffff;
  border-right: 1.5px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  position: relative;
  z-index: 30;
  overflow: hidden;
}

/* ENCABEZADO FIJO */
.app-header {
  padding: 12px 16px;
  border-bottom: 2px solid var(--mustard-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #ffffff;
  flex-shrink: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--mustard-bright) 0%, var(--mustard-main) 100%);
  border: 1.5px solid var(--mustard-dark);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(234, 179, 8, 0.28);
}

.brand h1 {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.15;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--mustard-deep);
  font-weight: 600;
}

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

.btn-header-map {
  display: none;
}

/* CONTENIDO DESPLAZABLE */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #ffffff;
  -webkit-overflow-scrolling: touch;
}

/* TARJETAS DE SECCIÓN (FONDO BLANCO PURO) */
.card-section {
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-title-row h2 {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-main);
  flex: 1;
}

.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mustard-bright);
  border: 1.5px solid var(--mustard-dark);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* GRILLAS SIMÉTRICAS DE BOTONES (50% / 50%) */
.sym-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.sym-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

/* PUNTO DE ORIGEN */
.origin-box {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.origin-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.origin-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--mustard-main);
  margin-top: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.25);
}

.origin-status.is-active .origin-dot {
  background: var(--origin-color);
  box-shadow: 0 0 0 4px rgba(180, 83, 9, 0.25);
}

.origin-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.origin-info strong {
  font-size: 0.88rem;
  color: var(--text-main);
  word-break: break-word;
  line-height: 1.3;
}

.origin-info small {
  font-size: 0.77rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.origin-manual-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.route-mode-selector {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.mode-option {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 2px;
  line-height: 1.35;
}

.mode-option input[type="radio"] {
  accent-color: var(--mustard-dark);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ZONA DE SUBIDA EXCEL / CSV */
.dropzone {
  border: 2px dashed var(--mustard-dark);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 20px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dropzone:hover,
.dropzone.dragover {
  background: var(--mustard-soft);
  border-color: var(--mustard-deep);
}

.dropzone-icon {
  color: var(--mustard-deep);
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dropzone-text strong {
  font-size: 0.9rem;
  color: var(--text-main);
}

.dropzone-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.template-actions {
  margin-top: 10px;
}

/* ==========================================================================
   SISTEMA DE BOTONES GRANDES, SIMÉTRICOS Y FÁCILES DE TOCAR EN IPHONE
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1.2;
  text-align: center;
  user-select: none;
}

.btn svg {
  flex-shrink: 0;
}

.btn-sym {
  min-height: 48px;
  width: 100%;
  padding: 10px 10px;
}

.btn-sym-inline {
  min-height: 46px;
  padding: 8px 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-lg {
  min-height: 52px;
  font-size: 0.96rem;
  font-weight: 800;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Botón Principal Mostaza / Amarillo Oro */
.btn-primary {
  background: linear-gradient(180deg, var(--mustard-bright) 0%, var(--mustard-main) 100%);
  color: var(--text-main);
  border-color: var(--mustard-dark);
  box-shadow: 0 3px 10px rgba(234, 179, 8, 0.30);
}

.btn-primary:hover:not(:disabled),
.btn-primary:active:not(:disabled) {
  background: linear-gradient(180deg, var(--mustard-main) 0%, var(--mustard-dark) 100%);
  color: #1c1917;
}

/* Botón Secundario Blanco con Borde Mostaza */
.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-strong);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.04);
}

.btn-secondary svg {
  color: var(--mustard-deep);
}

.btn-secondary:hover:not(:disabled),
.btn-secondary:active:not(:disabled) {
  background: var(--mustard-soft);
  border-color: var(--mustard-dark);
}

/* Botón Contorno Mostaza */
.btn-outline {
  background: var(--mustard-soft);
  color: var(--mustard-deep);
  border-color: var(--mustard-main);
}

.btn-outline:hover:not(:disabled),
.btn-outline:active:not(:disabled) {
  background: var(--mustard-light);
  color: var(--text-main);
}

/* Botón Destacado para Ver Mapa */
.btn-map-cta {
  background: #1c1917;
  color: var(--mustard-bright);
  border-color: #1c1917;
  min-height: 48px;
  font-size: 0.92rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(28, 25, 23, 0.18);
}

.btn-map-cta:hover,
.btn-map-cta:active {
  background: #292524;
  color: #ffffff;
}

.btn-ghost {
  background: #ffffff;
  color: var(--mustard-deep);
  border: 1px dashed var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--mustard-soft);
  color: var(--text-main);
}

.btn-light {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-strong);
}

.btn-sm {
  font-size: 0.84rem;
  min-height: 44px;
  padding: 8px 12px;
}

.btn-xs {
  font-size: 0.8rem;
  min-height: 40px;
  padding: 6px 12px;
}

.btn-block {
  width: 100%;
}

.btn-icon-only {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-icon-only:hover {
  background: #fee2e2;
  color: var(--danger);
  border-color: #fca5a5;
}

/* INPUTS (16px para evitar auto-zoom en iPhone) */
.input-text,
.input-select {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  min-height: 46px;
  padding: 10px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
}

.input-text:focus,
.input-select:focus {
  border-color: var(--mustard-dark);
  box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.22);
}

/* SECCIÓN DE OPTIMIZACIÓN Y MÉTRICAS */
.optimize-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1.5px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric-card {
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metric-label {
  font-size: 0.7rem;
  color: var(--mustard-deep);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.metric-value {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-main);
}

.progress-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.progress-bar-track {
  height: 10px;
  background: #f5f0db;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mustard-main), var(--mustard-accent));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.global-route-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gmaps-multi-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-gmaps-multi {
  background: var(--mustard-soft);
  color: var(--text-main);
  border: 1.5px solid var(--mustard-dark);
  min-height: 48px;
  font-weight: 700;
}

.btn-gmaps-multi:hover {
  background: var(--mustard-light);
}

/* ==========================================================================
   LISTA DE PARADAS ORDENADA (#1 AL MÁS LEJANO)
   ========================================================================== */
.stops-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stops-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.stops-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stops-header h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
}

.stops-filter {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.filter-chip {
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
}

.filter-chip.active {
  background: var(--mustard-bright);
  color: var(--text-main);
  border-color: var(--mustard-dark);
}

.empty-state {
  background: #ffffff;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.empty-state small {
  font-size: 0.82rem;
  line-height: 1.45;
  display: block;
}

.stops-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 32px;
}

/* TARJETA DE CADA CLIENTE */
.stop-card {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-left: 5px solid var(--mustard-main);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stop-card.is-visited {
  background: #f0fdf4;
  border-color: #86efac;
  border-left: 5px solid var(--success);
}

.stop-card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.stop-leg-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-main);
  background: var(--mustard-light);
  border: 1px solid var(--mustard-main);
  padding: 5px 10px;
  border-radius: 8px;
}

.stop-card.is-visited .stop-leg-banner {
  background: var(--success-light);
  border-color: #86efac;
  color: var(--success);
}

.stop-order-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-mini-ctrl {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.btn-mini-ctrl:hover:not(:disabled) {
  background: var(--mustard-soft);
  border-color: var(--mustard-dark);
}

.btn-mini-ctrl:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stop-top-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.stop-index-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--mustard-bright);
  border: 2px solid var(--mustard-dark);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.25);
}

.stop-card.is-visited .stop-index-badge {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}

.stop-main-info {
  flex: 1;
  min-width: 0;
}

.stop-client-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  line-height: 1.3;
  word-break: break-word;
}

.stop-card.is-visited .stop-client-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.stop-address {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.35;
}

.stop-coords {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 4px;
}

.stop-leg-sub {
  font-size: 0.79rem;
  color: var(--mustard-deep);
  font-weight: 700;
  margin-top: 4px;
}

.stop-notes {
  font-size: 0.8rem;
  color: var(--text-main);
  background: var(--mustard-soft);
  border: 1px solid var(--border-strong);
  padding: 6px 10px;
  border-radius: 8px;
  margin-top: 6px;
}

/* BOTONES DE ACCIÓN EN CADA TARJETA DE CLIENTE (100% SIMÉTRICOS) */
.stop-actions-primary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.stop-actions-secondary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-gmaps,
.btn-waze,
.btn-visit-toggle,
.btn-focus-map {
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
}

.btn-gmaps {
  background: linear-gradient(180deg, var(--mustard-bright) 0%, var(--mustard-main) 100%);
  color: var(--text-main);
  border: 1.5px solid var(--mustard-dark);
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.25);
}

.btn-visit-toggle {
  border: 1.5px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-main);
}

.btn-visit-toggle.visited {
  background: var(--success-light);
  color: var(--success);
  border-color: #86efac;
}

.btn-waze,
.btn-focus-map {
  min-height: 42px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}

/* ==========================================================================
   MAPA INTERACTIVO Y CONTROLES FLOTANTES
   ========================================================================== */
.map-wrapper {
  position: relative;
  height: 100dvh;
  width: 100%;
  z-index: 10;
  background: #f8f5eb;
}

#map,
.map-canvas {
  height: 100%;
  width: 100%;
  z-index: 1;
}

.map-picker-banner {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  width: min(94%, 440px);
  z-index: 1000;
  background: #1c1917;
  color: #ffffff;
  border: 2px solid var(--mustard-bright);
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.map-floating-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 800;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  pointer-events: none;
}

.map-tool-btn {
  pointer-events: auto;
  background: #ffffff;
  border: 1.5px solid var(--mustard-dark);
  box-shadow: var(--shadow-md);
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.map-tool-btn-primary {
  background: var(--mustard-bright);
  color: var(--text-main);
  border-color: var(--mustard-dark);
}

.btn-back-to-list-mobile {
  display: none;
}

/* PINES PERSONALIZADOS EN EL MAPA */
.custom-map-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-main);
  border: 2.5px solid #ffffff;
  box-shadow: 0 3px 10px rgba(28, 25, 23, 0.35);
}

.custom-map-pin.pin-origin {
  background: #1c1917;
  color: var(--mustard-bright);
  border-color: var(--mustard-bright);
  width: 36px;
  height: 36px;
}

.custom-map-pin.pin-pending {
  background: var(--mustard-bright);
  color: #1c1917;
  border-color: #1c1917;
  width: 32px;
  height: 32px;
}

.custom-map-pin.pin-visited {
  background: var(--success);
  color: #ffffff;
  border-color: #ffffff;
  width: 32px;
  height: 32px;
}

/* POPUP EN EL MAPA */
.map-popup-card {
  font-family: 'Inter', sans-serif;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-popup-card h4 {
  font-size: 0.94rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-main);
}

.map-popup-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

.map-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.map-popup-actions a,
.map-popup-actions button {
  min-height: 38px;
  font-size: 0.78rem;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: center;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.popup-btn-gmaps {
  grid-column: 1 / -1;
  background: var(--mustard-bright);
  border: 1.5px solid var(--mustard-dark);
  color: #1c1917 !important;
}

.popup-btn-visit {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  color: var(--text-main);
}

/* MODALES */
.app-dialog {
  border: 2px solid var(--mustard-main);
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(460px, 94vw);
  max-height: 90dvh;
  margin: auto;
  box-shadow: var(--shadow-lg);
  background: #ffffff;
}

.app-dialog::backdrop {
  background: rgba(28, 25, 23, 0.55);
  backdrop-filter: blur(2px);
}

.dialog-content {
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
}

.dialog-header {
  padding: 15px 18px;
  border-bottom: 1.5px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.dialog-header h3 {
  font-size: 1rem;
  font-weight: 800;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  width: 38px;
  height: 38px;
}

.dialog-body {
  padding: 16px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-main);
}

.form-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.input-with-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dialog-footer {
  padding: 12px 18px;
  border-top: 1.5px solid var(--border-color);
  background: var(--bg-subtle);
}

/* TOASTS */
.toast-container {
  position: fixed;
  bottom: calc(var(--mobile-nav-height) + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(92vw, 390px);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1c1917;
  color: var(--mustard-bright);
  border: 1.5px solid var(--mustard-main);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

/* BARRA DE NAVEGACIÓN INFERIOR MÓVIL */
.mobile-bottom-nav {
  display: none;
}

/* ==========================================================================
   VISTA MÓVIL OPTIMIZADA PARA IPHONE Y ANDROID (< 900px)
   ========================================================================== */
@media (max-width: 900px) {
  .app-layout {
    display: block;
    position: relative;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
  }

  .btn-header-map {
    display: inline-flex;
    background: var(--mustard-bright);
    color: var(--text-main);
    border: 1.5px solid var(--mustard-dark);
    font-weight: 800;
    min-height: 40px;
    padding: 6px 12px;
    border-radius: 10px;
  }

  .sidebar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--mobile-nav-height);
    height: calc(100dvh - var(--mobile-nav-height));
    width: 100%;
    border-right: none;
    z-index: 30;
  }

  .map-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: var(--mobile-nav-height);
    height: calc(100dvh - var(--mobile-nav-height));
    width: 100%;
    z-index: 20;
  }

  /* Cuando el usuario está en la Lista/Panel, ocultar el mapa al 100% para que NADA se encime arriba */
  .app-layout:not([data-mobile-view="map"]) .map-wrapper {
    display: none !important;
  }

  /* Cuando el usuario está viendo el Mapa, ocultar el panel lateral */
  .app-layout[data-mobile-view="map"] .sidebar {
    display: none !important;
  }

  .btn-back-to-list-mobile {
    display: inline-flex;
  }

  .map-floating-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .map-floating-toolbar #btnNextStopNav {
    grid-column: 1 / -1;
  }

  /* BARRA INFERIOR FIJA EN IPHONE: 2 BOTONES GRANDES Y SIMÉTRICOS (50% / 50%) */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #ffffff;
    border-top: 2px solid var(--mustard-main);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    z-index: 3000;
    box-shadow: 0 -4px 14px rgba(28, 25, 23, 0.08);
  }

  .mobile-nav-item {
    background: #ffffff;
    border: 1.5px solid var(--border-strong);
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-main);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px 12px;
  }

  .mobile-nav-item.active {
    background: linear-gradient(180deg, var(--mustard-bright) 0%, var(--mustard-main) 100%);
    color: #1c1917;
    border-color: var(--mustard-dark);
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.30);
  }

  .nav-badge {
    background: #1c1917;
    color: var(--mustard-bright);
    font-size: 0.75rem;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Ajustes para iPhones compactos (<= 390px) */
@media (max-width: 390px) {
  .sidebar-scroll {
    padding: 10px;
  }

  .card-section {
    padding: 13px;
  }

  .btn {
    font-size: 0.83rem;
    padding: 10px 10px;
  }
}

/* ==========================================================================
   TARJETA DE USUARIO Y RUTA (+200 USUARIOS) & PANEL PRIVADO DE REPORTE
   ========================================================================== */
.user-profile-card {
  background: var(--bg-subtle);
  border: 2px solid var(--mustard-main);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.user-profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.user-profile-tag {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mustard-deep);
}

.user-profile-name {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text-main);
  word-break: break-word;
}

.user-profile-route {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.app-dialog-wide {
  width: min(680px, 95vw);
}

.admin-logs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 46dvh;
  overflow-y: auto;
  padding-right: 2px;
}

.admin-log-card {
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-left: 4px solid var(--mustard-main);
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-log-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-log-user {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-main);
}

.admin-log-route {
  display: inline-flex;
  background: var(--mustard-light);
  border: 1px solid var(--mustard-dark);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
}

.admin-log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.79rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.admin-log-points {
  color: var(--mustard-deep);
  font-weight: 800;
}

