:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --border: #e3e6ec;
  --text: #14161a;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-text: #ffffff;
  --accent-soft: #eef3ff;
  --danger: #dc2626;
  --danger-soft: #fdeded;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 8px 20px rgba(20, 22, 26, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { text-decoration: none; color: inherit; }

input, select, textarea, button { font-family: inherit; }

/* ---------- Login ---------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  padding: 20px;
}
.login-wrap { width: 100%; display: flex; justify-content: center; }
.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 34px;
  box-shadow: var(--shadow);
}
.login-logo { text-align: center; font-size: 1.4rem; font-weight: 800; letter-spacing: 0.5px; margin-bottom: 8px; line-height: 1.2; }
.login-logo span { display: block; font-size: 0.62rem; font-weight: 700; letter-spacing: 3.5px; color: var(--accent); margin-top: 2px; }
.login-sub { text-align: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 28px; }

.error-msg {
  background: var(--danger-soft);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[type="file"] { padding: 8px; color: var(--muted); border-style: dashed; }
.field-row { display: flex; gap: 14px; margin-bottom: 0; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 160px; }

.modal-divider { border: none; border-top: 1px solid var(--border); margin: 22px 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 13px; font-size: 0.78rem; background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-sm:hover { background: var(--surface-2); }

.welcome-box { display: none; text-align: center; padding: 20px 0; }
.welcome-box.active { display: block; }
.welcome-box h3 { font-size: 1.2rem; margin-bottom: 8px; font-weight: 600; }
.welcome-box p { color: var(--muted); }
.typing-cursor { color: var(--accent); animation: blink 0.8s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Panel shell ---------- */
.panel-body { min-height: 100vh; }

.panel-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: hidden;
  background: linear-gradient(115deg, #14245c, #2563eb 65%, #3b82f6);
  box-shadow: 0 10px 26px rgba(20, 36, 92, 0.28);
}
.panel-nav::after {
  content: '';
  position: absolute;
  top: 0; left: -30%;
  width: 26%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  transform: skewX(-20deg);
  animation: navShine 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes navShine {
  0% { left: -30%; }
  35% { left: 130%; }
  100% { left: 130%; }
}
.panel-nav-inner {
  width: min(1180px, 94%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 30px;
  height: 62px;
  position: relative;
}
.panel-logo { font-weight: 800; font-size: 1.05rem; letter-spacing: 0.5px; color: #ffffff; line-height: 1.15; }
.panel-logo span { display: block; font-size: 0.56rem; font-weight: 600; letter-spacing: 3px; color: #bcd4ff; margin-top: 1px; }
.panel-links { display: flex; gap: 22px; flex: 1; }
.panel-links a { color: rgba(255, 255, 255, 0.72); font-size: 0.88rem; padding: 8px 2px; border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s; }
.panel-links a:hover { color: #ffffff; }
.panel-links a.active { color: #ffffff; border-color: #ffffff; }
.panel-user { display: flex; align-items: center; gap: 14px; font-size: 0.86rem; color: rgba(255, 255, 255, 0.75); margin-left: auto; }
.btn-logout { border: 1px solid rgba(255, 255, 255, 0.35); color: #ffffff; padding: 7px 13px; border-radius: 7px; font-size: 0.8rem; transition: background 0.15s, border-color 0.15s; }
.btn-logout:hover { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.6); }

.panel-main { width: min(1180px, 94%); margin: 0 auto; padding: 34px 0 80px; }

.panel-header { margin-bottom: 26px; }
.panel-header h1 { margin: 0 0 6px; font-size: 1.5rem; font-weight: 600; }
.panel-header h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.panel-sub { color: var(--muted); margin: 0; font-size: 0.9rem; }
.row-header { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 14px; }

.back-link { display: inline-block; color: var(--muted); font-size: 0.86rem; margin-bottom: 18px; }
.back-link:hover { color: var(--accent); }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
/* Grid en vez de flex-column: el ícono ocupa las 2 filas de la columna 1,
   label y value quedan apiladas en la columna 2 — layout horizontal
   compacto sin necesidad de envolver label/value en un div nuevo en cada
   página que usa .stat-card (dashboard.php, cuenta.php). */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
  row-gap: 0;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.stat-card:hover { box-shadow: 0 10px 22px rgba(20, 22, 26, 0.08); transform: translateY(-2px); }
.stat-card.highlight { border-top-color: var(--accent); }
.stat-card.warn { border-top-color: var(--danger); }
.stat-icon {
  grid-row: 1 / 3;
  grid-column: 1;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 0.95rem;
  margin-bottom: 0;
}
.stat-card.highlight .stat-icon { background: var(--accent); }
.stat-card.warn .stat-icon { background: var(--danger-soft); }
.stat-label { grid-row: 1; grid-column: 2; align-self: end; font-size: 0.7rem; color: var(--muted); font-weight: 500; line-height: 1.3; }
.stat-value { grid-row: 2; grid-column: 2; align-self: start; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.3px; line-height: 1.3; }
.stat-value.negative { color: var(--danger); }

/* ---------- Actions ---------- */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 38px; }
.action-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  padding-right: 46px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.15s;
  box-shadow: var(--shadow);
}
.action-card::before {
  content: '';
  position: absolute;
  top: 0; left: -60%;
  width: 40%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(37, 99, 235, 0.08), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
  pointer-events: none;
}
.action-card::after {
  content: '→';
  position: absolute;
  right: 18px; top: 50%;
  transform: translate(6px, -50%);
  opacity: 0;
  color: var(--accent);
  font-weight: 700;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.action-card:hover::before { left: 120%; }
.action-card:hover::after { opacity: 1; transform: translate(0, -50%); }
.action-title { font-weight: 600; font-size: 0.98rem; }
.action-desc { color: var(--muted); font-size: 0.82rem; }

/* ---------- Table ---------- */
.panel-section { margin-top: 18px; }
.panel-section h2 { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.data-table th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-2); }
.empty-row { text-align: center; color: var(--muted); padding: 28px !important; }
.muted { color: var(--muted); font-size: 0.8rem; }
.acciones-wrap { display: flex; gap: 8px; flex-wrap: wrap; }

.monto-entra { color: var(--accent); }
.monto-sale { color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; border: 1px solid transparent; }
.badge-lg { padding: 7px 15px; font-size: 0.82rem; }
.badge-ok { border-color: var(--border); color: var(--text); }
.badge-strong { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--danger-soft); color: var(--danger); }
.badge-muted { border-color: var(--border); color: var(--muted); }

/* ---------- Search ---------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  max-width: 400px;
  margin-bottom: 20px;
}
.search-box input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 0.88rem; }
.search-icon { opacity: 0.5; }
.search-clear { color: var(--muted); font-size: 1.1rem; padding: 0 4px; }
.search-clear:hover { color: var(--text); }

/* ---------- Client card ---------- */
.client-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  box-shadow: 0 8px 22px rgba(20, 22, 26, 0.06);
}
.client-avatar {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.2rem;
  flex-shrink: 0;
}
.client-doc-thumb {
  width: 54px; height: 54px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--border);
  display: block;
}
.client-doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.client-info { flex: 1; min-width: 200px; }
.client-info h1 { margin: 0 0 8px; font-size: 1.2rem; font-weight: 600; }
.client-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.83rem; color: var(--muted); }
.client-notas { margin: 10px 0 0; font-size: 0.83rem; color: var(--muted); }
.cliente-ruta-editor { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 0.83rem; color: var(--muted); }
.cliente-ruta-editor select { padding: 6px 10px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.8rem; }
.client-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Tarjetas de clientes ---------- */
.clientes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.cliente-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  animation: fadeSlideUp 0.35s ease both;
}
.clientes-grid .cliente-card:nth-child(1) { animation-delay: 0.02s; }
.clientes-grid .cliente-card:nth-child(2) { animation-delay: 0.05s; }
.clientes-grid .cliente-card:nth-child(3) { animation-delay: 0.08s; }
.clientes-grid .cliente-card:nth-child(4) { animation-delay: 0.11s; }
.clientes-grid .cliente-card:nth-child(5) { animation-delay: 0.14s; }
.clientes-grid .cliente-card:nth-child(6) { animation-delay: 0.17s; }
.cliente-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(37, 99, 235, 0.14); border-color: var(--accent); }
.cliente-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cliente-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.05rem;
  flex-shrink: 0;
}
.cliente-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cliente-nombre { font-weight: 600; font-size: 0.96rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.cliente-celular { font-size: 0.8rem; color: var(--muted); }
.cliente-tipo-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 11px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.cliente-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.cliente-stat-label { display: block; font-size: 0.72rem; color: var(--muted); margin-bottom: 2px; }
.cliente-stat-value { display: block; font-weight: 700; font-size: 0.95rem; color: var(--text); }
.cliente-stat-value.debe { color: var(--danger); }

.info-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.info-box-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Fondos ---------- */
.fondo-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #14245c, #2563eb 70%, #3b82f6);
  border: none;
  border-radius: 16px;
  padding: 32px 34px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 30px;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.22);
}
.fondo-hero::after {
  content: '';
  position: absolute;
  top: 0; left: -30%;
  width: 26%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  transform: skewX(-20deg);
  animation: navShine 7s ease-in-out infinite;
  pointer-events: none;
}
.fondo-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 1.3rem;
  margin-bottom: 4px;
}
.fondo-label { font-size: 0.85rem; color: rgba(255, 255, 255, 0.78); }
.fondo-monto { font-size: 2.3rem; font-weight: 800; color: #ffffff; letter-spacing: -0.5px; }

/* ---------- Tipo toggle ---------- */
.tipo-toggle { display: flex; gap: 8px; margin-bottom: 20px; }
.tipo-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.83rem;
  cursor: pointer;
  transition: all 0.15s;
}
.tipo-btn.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 25, 0.45);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-box {
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(15, 18, 25, 0.18);
  transform: scale(0.94) translateY(10px);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(.2, .8, .2, 1), opacity 0.2s ease;
}
.modal-overlay.active .modal-box { transform: scale(1) translateY(0); opacity: 1; }

/* ---------- Confirmación al intentar salir de un formulario con datos ---------- */
.confirm-leave-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 25, 0.55);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.confirm-leave-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
.confirm-leave-box {
  width: min(320px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
  box-shadow: 0 20px 50px rgba(15, 18, 25, 0.25);
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.22s cubic-bezier(.2, .8, .2, 1);
}
.confirm-leave-overlay.active .confirm-leave-box { transform: scale(1); }
.confirm-leave-box p { margin: 0 0 18px; font-size: 0.92rem; font-weight: 600; line-height: 1.4; }
.confirm-leave-box p span { display: block; font-weight: 400; color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.confirm-leave-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-danger { background: var(--danger); color: #ffffff; }
.btn-danger:hover { background: #b91c1c; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-error {
  background: var(--danger-soft);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ---------- Transición suave entre páginas (móvil y escritorio) ----------
   Mejora progresiva: donde el navegador la soporte, evita el "flash" blanco
   típico al navegar entre páginas del panel. Si no la soporta, no pasa nada
   (navegación normal). */
@view-transition {
  navigation: auto;
}

/* ---------- Retroalimentación táctil ---------- */
.btn:active { transform: scale(0.96); }
.cliente-card:active, .action-card:active, .ruta-card:active { transform: scale(0.98); }

/* ---------- Chips de ruta / filtro ---------- */
.chip-filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip-filtro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.15s;
}
.chip-filtro:hover { border-color: var(--accent); color: var(--accent); }
.chip-filtro.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.cliente-ruta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  margin-left: 8px;
}

/* ---------- Rutas (grupos de cobro) ---------- */
.rutas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.ruta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: fadeSlideUp 0.35s ease both;
}
.ruta-card:hover { transform: translateY(-3px); box-shadow: 0 14px 28px rgba(37, 99, 235, 0.14); }
.ruta-card-nombre { font-weight: 700; font-size: 1rem; margin-bottom: 2px; display: block; }
.ruta-card-cobrador { font-size: 0.82rem; color: var(--accent); font-weight: 600; }
.ruta-card-zona { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
.ruta-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ruta-card-count { font-size: 0.78rem; color: var(--muted); }
.ruta-card-borrar { background: none; border: none; color: var(--muted); font-size: 0.78rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.ruta-card-borrar:hover { color: var(--danger); background: var(--danger-soft); }
.ruta-card-borrar:disabled { opacity: 0.4; cursor: not-allowed; }
.ruta-card-borrar:disabled:hover { color: var(--muted); background: none; }

/* Grupos de cobro dentro de "Cobros de hoy": una sección por ruta */
.grupo-cobro { margin-bottom: 28px; animation: fadeSlideUp 0.35s ease both; }
.grupo-cobro-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-soft);
}
.grupo-cobro-titulo { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.grupo-cobro-titulo h3 { margin: 0; font-size: 1rem; font-weight: 700; }
.grupo-cobro-cobrador { font-size: 0.8rem; color: var(--accent); font-weight: 600; }
.grupo-cobro-meta { font-size: 0.82rem; color: var(--muted); text-align: right; }
.grupo-cobro-meta strong { color: var(--text); }

/* ---------- Animaciones de entrada ---------- */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.stats-grid .stat-card, .action-grid .action-card {
  animation: fadeSlideUp 0.4s ease both;
}
.stats-grid .stat-card:nth-child(1) { animation-delay: 0.02s; }
.stats-grid .stat-card:nth-child(2) { animation-delay: 0.06s; }
.stats-grid .stat-card:nth-child(3) { animation-delay: 0.10s; }
.stats-grid .stat-card:nth-child(4) { animation-delay: 0.14s; }
.stats-grid .stat-card:nth-child(5) { animation-delay: 0.18s; }
.stats-grid .stat-card:nth-child(6) { animation-delay: 0.22s; }
.action-grid .action-card:nth-child(1) { animation-delay: 0.10s; }
.action-grid .action-card:nth-child(2) { animation-delay: 0.16s; }
.action-grid .action-card:nth-child(3) { animation-delay: 0.22s; }
.action-grid .action-card:nth-child(4) { animation-delay: 0.28s; }

.action-card { transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.action-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(37, 99, 235, 0.12); }
.action-card:active { transform: translateY(-1px); }

.data-table tbody tr { transition: background 0.12s ease; }

/* ---------- Barra de navegación inferior (móvil, estilo app) ---------- */
.mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(20, 22, 26, 0.06);
  z-index: 150;
}
.mobile-tabbar-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.mobile-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 12px;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.mobile-tab-icon { font-size: 1.3rem; line-height: 1; transition: transform 0.2s ease; }
.mobile-tab:active { transform: scale(0.9); background: var(--surface-2); }
.mobile-tab.active { color: var(--accent); background: var(--accent-soft); }
.mobile-tab.active .mobile-tab-icon { transform: scale(1.15) translateY(-1px); }
.mobile-tab.active::after {
  content: '';
  position: absolute;
  bottom: 1px;
  left: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  animation: tabDotPop 0.25s ease;
}
@keyframes tabDotPop {
  from { transform: translateX(-50%) scale(0); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ---------- Tablas responsivas (se ven como tarjetas en móvil) ---------- */
@media (max-width: 640px) {
  .table-wrap { border: none; background: none; box-shadow: none; overflow-x: visible; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; min-width: 0; }
  .data-table thead { display: none; }
  .data-table tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
  }
  .data-table tr:last-child { margin-bottom: 0; }
  .data-table td {
    border: none;
    padding: 6px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.86rem;
    text-align: right;
  }
  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: left;
  }
  .data-table td.empty-row { display: block; text-align: center; padding: 20px !important; }
  .data-table td.empty-row::before { content: none; }
}

/* ---------- Formulario por pasos (stepper) ---------- */
.stepper-progress { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.stepper-dot { flex: 1; height: 4px; border-radius: 999px; background: var(--border); transition: background 0.2s; }
.stepper-dot.active, .stepper-dot.done { background: var(--accent); }
.stepper-label { font-size: 0.78rem; color: var(--muted); margin-bottom: 20px; }
.step { display: none; }
.step.active { display: block; animation: fadeSlideUp 0.25s ease; }
.step-nav { display: flex; gap: 10px; margin-top: 22px; }
.step-nav .btn { flex: 1; }

@media (max-width: 720px) {
  .panel-links { display: none; }
  .mobile-tabbar { display: block; }
  .panel-main { padding-bottom: 92px; }
  .panel-nav-inner { height: 60px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  /* Los accesos a Clientes/Cobros/Fondos ya están en la barra inferior. */
  .action-grid { display: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 30px 22px; }
  .modal-box { padding: 22px 18px; }
}
