/* =================================================================
   ANDÉN MOBILITY — Feature-specific styles
   Chat · KYC dropzone · Heatmap legend · Schedule pills · Forecast bar
   ================================================================= */

/* ---------- Chat ---------- */
.chat-msgs {
  scroll-behavior: smooth;
}
.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: var(--r-4);
  font-size: var(--fs-sm);
  word-wrap: break-word;
  line-height: 1.4;
}
.chat-bubble.mine    { background: var(--gradient-brand); color: #001b13; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-bubble.theirs  { background: var(--bg-1); color: var(--text-0); align-self: flex-start; border: 1px solid var(--border); border-bottom-left-radius: 4px; }

.chat-fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--shell-bottomnav-h) + 78px);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #001b13;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 8px 22px rgba(0,217,144,0.40);
  z-index: 50;
  border: 0;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease-out);
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab .badge-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 14px; height: 14px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-0);
}

/* ---------- KYC dropzone ---------- */
.kyc-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-3);
  border: 1px solid var(--border);
  transition: border-color var(--dur-base) var(--ease-out), background var(--dur-base) var(--ease-out);
}
.kyc-row.verified { background: color-mix(in srgb, var(--success) 8%, transparent); border-color: var(--success-soft); }
.kyc-row.pending  { background: color-mix(in srgb, var(--warning) 6%, transparent); border-color: var(--warning-soft); }
.kyc-row.rejected { background: color-mix(in srgb, var(--danger) 8%, transparent);  border-color: var(--danger-soft); }
.kyc-row .doc-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
  font-size: 1.4rem;
  flex-shrink: 0;
}
.kyc-row.verified .doc-icon { background: var(--success-soft); color: var(--success); }
.kyc-row.pending  .doc-icon { background: var(--warning-soft); color: var(--warning); }
.kyc-row.rejected .doc-icon { background: var(--danger-soft);  color: var(--danger); }

/* ---------- Heatmap legend ---------- */
.heatmap-legend {
  position: absolute;
  top: var(--sp-3);
  left: var(--sp-3);
  background: color-mix(in srgb, var(--bg-1) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--r-3);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--text-1);
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.heatmap-legend .scale {
  width: 140px; height: 6px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, rgba(0, 217, 144, 0.6), rgba(255, 180, 84, 0.8), rgba(255, 93, 108, 1));
}
.heatmap-legend .scale-labels {
  display: flex; justify-content: space-between;
  font-size: 10px;
  color: var(--text-3);
}

/* ---------- Schedule pill ---------- */
.schedule-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--info-soft);
  color: var(--info);
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: var(--r-pill);
}
.schedule-pill .bi { font-size: 11px; }

/* ---------- Forecast bar (analytics) ---------- */
.fc-row {
  display: grid;
  grid-template-columns: 60px 60px 1fr 80px;
  gap: var(--sp-3);
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-xs);
}
.fc-row:last-child { border-bottom: 0; }
.fc-row .fc-bar {
  height: 8px;
  background: var(--bg-3);
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
}
.fc-row .fc-bar > div {
  height: 100%;
  background: var(--gradient-brand);
}

/* ---------- Multi-stop stop pin ---------- */
.stop-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: var(--info);
  color: #001b13;
  font-weight: 800;
  font-size: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-1);
}

/* ---------- TTS settings ---------- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--bg-3);
  border-radius: var(--r-pill);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px;
  background: var(--brand-500);
  border-radius: 50%;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--brand-500);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ---------- Refund timeline ---------- */
.refund-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.refund-row:last-child { border-bottom: 0; }
.refund-row .icon {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--info-soft);
  color: var(--info);
  border-radius: 50%;
  font-size: 1rem;
}

/* ---------- Invoice table ---------- */
.invoice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-4);
  background: var(--bg-1);
  transition: border-color var(--dur-base) var(--ease-out);
}
.invoice-card:hover { border-color: var(--border-strong); }
.invoice-card.unpaid { border-left: 4px solid var(--warning); }
.invoice-card.paid   { border-left: 4px solid var(--success); }

/* ---------- Cohort heat cells ---------- */
.cohort-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- Dashboard 2-col grid (chart + cohort) ----------
   En desktop ≥992px usa proporción 1.4 : 1 (chart un poco más ancho).
   Bajo 992px stackea en 1 columna para que ni el chart ni la tabla
   se aprieten ni desborden horizontalmente. */
.grid-dashboard {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}
@media (max-width: 991.98px) {
  .grid-dashboard { grid-template-columns: minmax(0, 1fr); }
}

/* Chart canvas wrapper: altura mínima responsive sin overflow.
   En desktop 260px, en mobile 220px (más legible en pantalla baja). */
.anden-chart-host {
  position: relative;
  width: 100%;
  min-height: 260px;
}
@media (max-width: 575.98px) {
  .anden-chart-host { min-height: 220px; }
}

/* Cohort retention table: en mobile el cuerpo scrollea horizontal con
   indicador de fade en el borde derecho. */
.cohort-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: var(--fs-xs);
}
.cohort-scroll table { min-width: 360px; }
@media (max-width: 575.98px) {
  .cohort-scroll table th,
  .cohort-scroll table td { padding: 6px 8px; }
}

/* ---------- Sync queue indicator ---------- */
.sync-indicator {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--text-2);
  box-shadow: var(--shadow-md);
  transform: translateY(120%);
  transition: transform var(--dur-base) var(--ease-out);
}
.sync-indicator.show { transform: translateY(0); }
.sync-indicator.syncing { color: var(--info); border-color: var(--info-soft); }
.sync-indicator.error   { color: var(--danger); border-color: var(--danger-soft); }
