/* ═══════════════════════════════════════════════════════════════
   JHOANES DELIVERIES — CSS Principal
   Diseño: Mobile-First, Profesional, Logística/Transporte
   ═══════════════════════════════════════════════════════════════ */

/* ─── VARIABLES ──────────────────────────────────────────────── */
:root {
  --primary:        #1e3a5f;
  --primary-light:  #2a5298;
  --primary-dark:   #152a44;
  --accent:         #f59e0b;
  --accent-light:   #fcd34d;
  --accent-dark:    #d97706;

  --success:        #22c55e;
  --success-bg:     #dcfce7;
  --warning:        #f59e0b;
  --warning-bg:     #fef3c7;
  --danger:         #ef4444;
  --danger-bg:      #fee2e2;
  --info:           #3b82f6;
  --info-bg:        #dbeafe;
  --pending:        #94a3b8;
  --pending-bg:     #f1f5f9;

  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --border-dark:    #cbd5e1;

  --text:           #1e293b;
  --text-muted:     #64748b;
  --text-light:     #94a3b8;
  --text-on-dark:   #ffffff;

  --sidebar-width:  260px;
  --header-height:  60px;
  --radius:         10px;
  --radius-sm:      6px;
  --radius-lg:      16px;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow:         0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.14);

  --transition:     0.2s ease;
  --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ─── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--primary-light); text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea, button { font-size: inherit; }

/* ─── TYPOGRAPHY ─────────────────────────────────────────────── */
h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); }
h2 { font-size: 1.3rem; font-weight: 600; color: var(--text); }
h3 { font-size: 1.1rem; font-weight: 600; color: var(--text); }
h4 { font-size: 0.95rem; font-weight: 600; }

/* ─── LAYOUT PRINCIPAL ───────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar.open { transform: translateX(0); }

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .logo-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 6px;
}
.sidebar-logo .logo-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  line-height: 1.2;
}
.sidebar-logo .logo-sub {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.sidebar-user {
  padding: 12px 18px;
  background: rgba(255,255,255,0.05);
  margin: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}
.sidebar-user .user-name { font-weight: 600; color: #fff; }
.sidebar-user .user-role {
  font-size: 0.72rem;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}
.nav-section-label {
  padding: 14px 18px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.4);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.nav-item .nav-icon { font-size: 1.1rem; width: 22px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item.active {
  background: rgba(245,158,11,0.2);
  color: var(--accent-light);
  border-right: 3px solid var(--accent);
}
.nav-item.active .nav-icon { color: var(--accent); }

.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 0.85rem;
  width: 100%;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,0.25); }

/* ─── CONTENIDO PRINCIPAL ────────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ─── HEADER MÓVIL ───────────────────────────────────────────── */
.topbar {
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: env(safe-area-inset-top, 0px) 16px 0;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}
.btn-menu {
  background: none;
  border: none;
  font-size: 1.3rem;
  padding: 6px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.btn-menu:hover { background: var(--bg); }
.topbar-title {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.topbar-actions { display: flex; gap: 8px; }

/* ─── OVERLAY SIDEBAR ────────────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  display: none;
}
.sidebar-overlay.visible { display: block; }

/* ─── CONTENIDO DE PÁGINA ────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 20px 16px;
  overflow-x: hidden;
}

/* ─── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 16px 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ─── STATS GRID ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.stat-card .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat-card .stat-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.stat-card.accent { border-left: 3px solid var(--accent); }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-card.danger  { border-left: 3px solid var(--danger); }
.stat-card.info    { border-left: 3px solid var(--info); }

/* ─── BOTONES ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: 2px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-full { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: #16a34a; border-color: #16a34a; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); }

.btn-warning {
  background: var(--warning);
  color: #fff;
  border-color: var(--warning);
}

/* ─── FORMULARIOS ────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(42,82,152,0.12);
}
.form-control.error { border-color: var(--danger); }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-section {
  margin-bottom: 24px;
}
.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 12px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.checkbox-group input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
.checkbox-group label { cursor: pointer; font-size: 0.9rem; }

/* ─── TOGGLE SWITCH ──────────────────────────────────────────── */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-dark);
  border-radius: 24px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--primary-light); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ─── BADGES / CHIPS ─────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: #15803d; }
.badge-warning { background: var(--warning-bg); color: #b45309; }
.badge-danger  { background: var(--danger-bg);  color: #b91c1c; }
.badge-info    { background: var(--info-bg);    color: #1d4ed8; }
.badge-pending { background: var(--pending-bg); color: var(--text-muted); }
.badge-primary { background: rgba(30,58,95,0.1); color: var(--primary); }
.badge-accent  { background: rgba(245,158,11,0.15); color: #b45309; }

/* ─── STATUS COLORS ──────────────────────────────────────────── */
.status-completed   { color: var(--success); }
.status-en_route    { color: var(--info); }
.status-arriving    { color: var(--warning); }
.status-delivering  { color: var(--accent); }
.status-problem     { color: var(--danger); }
.status-pending     { color: var(--pending); }
.status-not_delivered { color: var(--danger); }

/* ─── TABLAS ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-2); }
.table-actions { display: flex; gap: 4px; }

/* ─── LISTA MÓVIL (reemplaza tabla en móvil) ─────────────────── */
.mobile-list { display: flex; flex-direction: column; gap: 10px; }
.mobile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.mobile-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}
.mobile-card-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.mobile-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

/* ─── FILTROS Y BÚSQUEDA ──────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 12px 9px 36px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
  position: relative;
}
.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}
.search-wrapper input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}
.search-wrapper input:focus {
  outline: none;
  border-color: var(--primary-light);
}

/* ─── PAGE HEADER ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.3rem; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── ALERTS / TOAST ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-width: 1px;
  border-style: solid;
}
.alert-success { background: var(--success-bg); border-color: #86efac; color: #15803d; }
.alert-danger  { background: var(--danger-bg);  border-color: #fca5a5; color: #b91c1c; }
.alert-warning { background: var(--warning-bg); border-color: #fcd34d; color: #b45309; }
.alert-info    { background: var(--info-bg);    border-color: #93c5fd; color: #1d4ed8; }

#toast-container {
  position: fixed;
  top: 70px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  width: calc(100vw - 32px);
}
.toast {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info    { background: var(--primary-light); }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  padding: 0;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.center { align-items: center; padding: 16px; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
.modal-overlay.center .modal {
  border-radius: var(--radius-lg);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
}
.modal-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-header h3 { font-size: 1.05rem; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: var(--surface-2);
  position: sticky;
  bottom: 0;
}
.btn-close-modal {
  background: var(--bg);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.9rem; }

/* ─── LOADING ────────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  gap: 10px;
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── BALANCE INDICATOR ──────────────────────────────────────── */
.balance-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 12px 0;
}
.balance-excellent { background: var(--success-bg); color: #15803d; border: 1px solid #86efac; }
.balance-good      { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.balance-acceptable{ background: var(--warning-bg); color: #b45309; border: 1px solid #fcd34d; }
.balance-unbalanced{ background: var(--danger-bg); color: #b91c1c; border: 1px solid #fca5a5; }
.balance-critical  { background: #450a0a; color: #fca5a5; border: 1px solid var(--danger); }

/* ─── PARADAS DE RUTA ─────────────────────────────────────────── */
.stop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
  transition: box-shadow var(--transition);
}
.stop-card:hover { box-shadow: var(--shadow); }
.stop-card.completed { border-left: 4px solid var(--success); opacity: 0.8; }
.stop-card.problem   { border-left: 4px solid var(--danger); }
.stop-card.en_route  { border-left: 4px solid var(--info); }
.stop-card.active    { border-left: 4px solid var(--accent); box-shadow: var(--shadow); }

.stop-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.stop-number {
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}
.stop-info { flex: 1; }
.stop-name { font-weight: 700; font-size: 0.95rem; }
.stop-address { font-size: 0.8rem; color: var(--text-muted); }
.stop-indicators { display: flex; gap: 4px; }
.stop-indicator { font-size: 0.85rem; }

.stop-body { padding: 12px 14px 14px; border-top: 1px solid var(--border); }
.stop-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
.stop-detail-icon { color: var(--text-muted); flex-shrink: 0; margin-top: 1px; }
.stop-detail-label { font-weight: 600; color: var(--text-muted); font-size: 0.75rem; }
.stop-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.stop-actions-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* ─── DRIVER PORTAL ──────────────────────────────────────────── */
.driver-header {
  background: var(--primary);
  color: #fff;
  padding: 20px 16px 16px;
}
.driver-header h1 { color: #fff; font-size: 1.2rem; }
.driver-header .route-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
.route-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.1);
  padding: 5px 10px;
  border-radius: 20px;
}

/* ─── LOGIN ──────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
  color: #fff;
}
.login-logo .logo-icon { font-size: 3.5rem; display: block; margin-bottom: 10px; }
.login-logo h1 { font-size: 1.6rem; color: #fff; margin-bottom: 4px; }
.login-logo p { color: rgba(255,255,255,0.7); font-size: 0.9rem; }

.login-tabs {
  display: flex;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 4px;
  margin-bottom: 24px;
  width: 100%;
  max-width: 400px;
}
.login-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.login-tab.active { background: #fff; color: var(--primary); }

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-card .form-control { font-size: 1rem; padding: 13px 14px; }
.login-card .btn-lg { font-size: 1rem; padding: 14px; }

.pin-input {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}
.pin-digit {
  width: 52px; height: 60px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  outline: none;
  transition: border-color var(--transition);
}
.pin-digit:focus { border-color: var(--primary-light); background: #fff; }

/* ─── RESPONSIVE DESKTOP ─────────────────────────────────────── */
@media (min-width: 768px) {
  .sidebar {
    transform: translateX(0);
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
  }
  .sidebar-overlay { display: none !important; }
  .btn-menu { display: none; }
  .main-content { margin-left: 0; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .form-row { grid-template-columns: 1fr 1fr; }
  .mobile-list { display: none; }
  .table-wrapper { display: block; }
  .topbar { display: none; }
  .page-content { padding: 24px 28px; }
  #toast-container { top: 20px; }
}

@media (max-width: 767px) {
  .table-wrapper { display: none; }
  .mobile-list { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .modal-overlay:not(.center) .modal { max-height: 95vh; }
  .stop-actions { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(5, 1fr); }
  :root { --sidebar-width: 280px; }
}

/* ─── UTILIDADES ─────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-1 { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hidden { display: none !important; }
.sensitive-field {
  background: #fffbeb;
  border: 1px dashed var(--warning);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.88rem;
}
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}
