/* ── OpsCommand — Sistema de temas (igual que InspectPro) ── */

/* MODO CLARO (por defecto) */
:root,
[data-theme="light"],
html[data-theme="light"],
body[data-theme="light"] {
  --bg-main:    #f6f8fb;
  --bg-panel:   #ffffff;
  --bg-card:    #f8f9fa;
  --border-soft:#dee2e6;
  --text-primary:   #212529;
  --text-secondary: #6c757d;
  --text-tertiary:  #9ca3af;
  --accent:     #0EA5E9;
  --accent-muted: rgba(14,165,233,0.10);
  --accent-dark:#0284C7;
  --success:    #198754;
  --success-muted: rgba(25,135,84,0.12);
  --danger:     #dc3545;
  --danger-muted: rgba(220,53,69,0.12);
  --warning:    #ffc107;
  --warning-muted: rgba(255,193,7,0.15);
  --info:       #0EA5E9;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  18px;
  --topbar-bg:  #ffffff;
  --sidebar-bg: #f8f9fa;
  --btn-ghost-bg: #f1f3f5;
  --btn-ghost-border: #dee2e6;
  --btn-ghost-text: #495057;
  --input-bg:   #ffffff;
  --table-stripe: rgba(0,0,0,0.025);
  --table-hover:  rgba(14,165,233,0.05);
}

/* MODO OSCURO */
[data-theme="dark"],
html[data-theme="dark"],
body[data-theme="dark"] {
  --bg-main:    #0B1220;
  --bg-panel:   #0F1A2E;
  --bg-card:    #121F36;
  --border-soft:#1C2A44;
  --text-primary:   #E6EDF3;
  --text-secondary: #C9D1D9;
  --text-tertiary:  #8B949E;
  --accent:     #0EA5E9;
  --accent-muted: rgba(14,165,233,0.12);
  --accent-dark:#38BDF8;
  --success:    #3FB950;
  --success-muted: rgba(63,185,80,0.12);
  --danger:     #F85149;
  --danger-muted: rgba(248,81,73,0.12);
  --warning:    #D29922;
  --warning-muted: rgba(210,153,34,0.15);
  --info:       #58A6FF;
  --shadow:     0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
  --topbar-bg:  #0F1A2E;
  --sidebar-bg: #0B1220;
  --btn-ghost-bg: #121F36;
  --btn-ghost-border: #1C2A44;
  --btn-ghost-text: #C9D1D9;
  --input-bg:   #121F36;
  --table-stripe: rgba(255,255,255,0.025);
  --table-hover:  rgba(14,165,233,0.07);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}
/* Numeros y datos con Fira Code — sensacion de instrumento tecnico */
.stat-val, .badge, .map-vehicle-speed, .data-mono {
  font-family: 'Fira Code', 'Courier New', monospace;
}

/* ── Helpers ── */
.d-none { display: none !important; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.w-100  { width: 100%; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.mt-1   { margin-top: 4px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mb-3   { margin-bottom: 12px; }
.mb-4   { margin-bottom: 16px; }
.ms-auto { margin-left: auto; }
.text-muted { color: var(--text-secondary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-accent { color: var(--accent); }
.fw-600  { font-weight: 600; }
.fw-700  { font-weight: 700; }
.fs-sm   { font-size: 12px; }
.fs-xs   { font-size: 11px; }

/* ── Topbar ── */
.topbar {
  height: 58px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0EA5E9, #0284C7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.topbar-brand-img {
  width: 36px; height: 36px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-name  { font-size: 17px; font-weight: 700; letter-spacing: -0.4px; }
.brand-sub   { font-size: 10px; color: var(--text-tertiary); line-height: 1; }

/* topbar-actions — igual que InspectPro */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Boton tema — identico a InspectPro */
.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color, #30363d);
  color: var(--text-secondary, #8b949e);
  padding: 5px 10px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: border-color 0.15s;
}
.theme-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-icon-wrapper { display: flex; align-items: center; }
#themeIconApp { font-size: 15px; line-height: 1; }

/* ── App layout ── */
.app-layout {
  display: flex;
  height: calc(100vh - 58px);
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  overflow-y: auto;
}
.sidebar-section { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-tertiary); padding: 12px 10px 4px; }
.snav-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  width: 100%;
  transition: background 0.12s, color 0.12s;
}
.snav-btn:hover  { background: var(--bg-card); color: var(--text-primary); }
.snav-btn.active { background: var(--accent-muted); color: var(--accent); font-weight: 600; }
.snav-ico { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.sidebar-manual-link { display: flex; align-items: center; gap: 7px; padding: 8px 10px; margin-bottom: 6px; font-size: 12px; color: var(--text-secondary); border-radius: 6px; text-decoration: none; transition: background 0.15s, color 0.15s; }
.sidebar-manual-link:hover { background: var(--bg-hover); color: var(--accent); }
.sidebar-manual-link svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-manual-link:hover svg { opacity: 1; }

/* ── Main content ── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

/* ── Page header ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title  { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.page-sub    { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── Stats strip ── */
.stats-strip { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 18px;
  flex: 1;
  min-width: 120px;
}
.stat-val   { font-size: 24px; font-weight: 800; letter-spacing: -1px; }
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ── Card ── */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-primary); }

/* ── Tabla ── */
.table-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg-card);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-primary);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--table-stripe); }
tbody tr:hover { background: var(--table-hover); }

/* ── Inputs ── */
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.field-input, .field-select, .field-textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.field-input:focus, .field-select:focus, .field-textarea:focus { border-color: var(--accent); }
.field-input::placeholder, .field-textarea::placeholder { color: var(--text-tertiary); }
.field-textarea { resize: vertical; min-height: 80px; }
.field-group { margin-bottom: 14px; }

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-ghost {
  background: var(--btn-ghost-bg);
  border: 1px solid var(--btn-ghost-border);
  color: var(--btn-ghost-text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); opacity: 1; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: 6px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-agendado     { background: var(--accent-muted);   color: var(--accent); }
.badge-en_curso     { background: var(--warning-muted);  color: var(--warning); }
.badge-completado   { background: var(--success-muted);  color: var(--success); }
.badge-cancelado    { background: rgba(108,117,125,0.12); color: #6c757d; }
.badge-pendiente    { background: var(--warning-muted);  color: var(--warning); }
.badge-aprobada     { background: var(--success-muted);  color: var(--success); }
.badge-rechazada    { background: var(--danger-muted);   color: var(--danger); }
.badge-propuesto    { background: rgba(217,119,6,0.15);  color: #B45309; }
.badge-rechazado    { background: var(--danger-muted);   color: var(--danger); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-body  { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border-soft); display: flex; gap: 8px; justify-content: flex-end; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-main);
}
.login-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.login-brand-icon-img {
  width: 52px; height: 52px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  flex-shrink: 0;
}
.login-brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.login-brand-sub  { font-size: 12px; color: var(--text-secondary); }
.login-alt-toggle {
  display: flex; align-items: center; gap: 6px;
  margin-top: 18px; font-size: 12px; color: var(--text-tertiary);
  cursor: pointer; transition: color 0.15s;
}
.login-alt-toggle:hover { color: var(--text-secondary); }
.login-tabs { display: flex; border-bottom: 1px solid var(--border-soft); margin-bottom: 20px; }
.login-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  padding: 8px 16px; cursor: pointer; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.login-tab.active { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ── Mapa ── */
#map { height: 300px; border-radius: var(--radius); border: 1px solid var(--border-soft); }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  animation: toastIn 0.2s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger);  }
.toast.info    { border-left: 3px solid var(--accent);  }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* ── Spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state-text { font-size: 14px; }

/* ── Badges adicionales ── */
.badge-retorno_tardio { background: var(--danger-muted); color: var(--danger); }
.badge-expirada       { background: rgba(108,117,125,0.12); color: #6c757d; }
.badge-en_punto       { background: var(--success-muted);  color: var(--success); }
.badge-fuera_de_punto { background: var(--danger-muted);   color: var(--danger); }
.badge-sin_gps        { background: rgba(108,117,125,0.12); color: #6c757d; }
.badge-visita         { background: var(--success-muted);  color: var(--success); margin-left: 4px; }

/* ── Porcentaje pill ── */
.pct-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.pct-ok   { background: var(--success-muted);  color: var(--success); }
.pct-warn { background: var(--warning-muted);  color: var(--warning); }
.pct-bad  { background: var(--danger-muted);   color: var(--danger);  }

/* ── Desvio cards ── */
.desvio-card {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid;
}
.desvio-pending { background: var(--danger-muted);  border-left-color: var(--danger); }
.desvio-ok      { background: var(--success-muted); border-left-color: var(--success); }

/* ── Section divider ── */
.section-divider {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 10px;
}

/* ── Timeline (pernoctas) ── */
.timeline { padding: 4px 0; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  background: var(--accent);
}
.timeline-dot-aprobacion  { background: var(--success); }
.timeline-dot-rechazo     { background: var(--danger); }
.timeline-dot-escalamiento{ background: var(--warning); }
.timeline-dot-expiracion  { background: #6c757d; }
.timeline-dot-solicitud   { background: var(--accent); }
.timeline-content { flex: 1; }

/* ── Alert banner ── */
.alert-banner {
  background: var(--warning-muted);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--warning);
  margin-bottom: 16px;
}

/* ── Export dropdown ── */
.export-dropdown { position: relative; display: inline-flex; }
.export-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  z-index: 500;
  overflow: hidden;
}
.export-item {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.1s;
}
.export-item:hover { background: var(--bg-card); color: var(--accent); }

/* ── Busqueda de mapa (Nominatim) ── */
.map-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}
.map-search-bar .field-input { flex: 1; }
.map-search-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.map-search-results {
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
.map-search-results:not(:empty) {
  border-color: var(--border-soft);
}
.map-search-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-card);
  border: none;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s;
  line-height: 1.5;
}
.map-search-item:last-child { border-bottom: none; }
.map-search-item:hover { background: var(--bg-hover); color: var(--accent); }
.map-search-item svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.map-search-loading,
.map-search-noresult {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-tertiary);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

/* ── Waypoints ── */
.waypoint-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.waypoint-num {
  width: 22px;
  height: 22px;
  background: #F59E0B;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── APK download banner ── */
.login-apk-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--bg-main);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}
.login-apk-banner svg { color: var(--accent); flex-shrink: 0; }
.login-apk-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.login-apk-link:hover { text-decoration: underline; }

/* ── Flex wrap helper ── */
.flex-wrap { flex-wrap: wrap; }

/* ── Safe areas (iPhone notch / Android cutout) ── */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

/* ── Bottom nav (movil) ── */
.bottom-nav { display: none; }

/* ── Responsive / mobile ── */
@media (max-width: 768px) {
  /* Safe area: topbar y login */
  .topbar {
    padding-top: calc(8px + var(--sat));
    height: calc(58px + var(--sat));
  }
  .login-wrap {
    padding-top: calc(24px + var(--sat));
    padding-bottom: calc(24px + var(--sab));
    padding-left: calc(16px + var(--sal));
    padding-right: calc(16px + var(--sar));
    min-height: 100dvh;
    align-items: flex-start;
  }
  .login-card {
    padding: 28px 20px;
    border-radius: 16px;
    margin-top: auto;
    margin-bottom: auto;
    box-shadow: none;
    border: none;
    width: 100%;
  }

  /* Layout */
  .sidebar { display: none !important; }
  .main-content {
    padding: 16px;
    padding-bottom: calc(72px + var(--sab));
  }
  .app-layout { height: calc(100dvh - 58px - var(--sat)); }

  /* Stats */
  .stats-strip { gap: 8px; }
  .stat-card { min-width: 80px; padding: 10px 12px; }
  .stat-val { font-size: 20px; }

  /* Inputs: 16px evita el auto-zoom de iOS */
  .field-input,
  .field-select,
  .field-textarea {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 48px;
  }
  .field-label { font-size: 12px; }

  /* Botones: targets de al menos 44px */
  .btn { min-height: 44px; padding: 10px 18px; }
  .btn-sm { min-height: 36px; padding: 6px 14px; }
  .btn:active { opacity: 0.7; transform: scale(0.98); }

  /* Topbar: ocultar texto marca, solo icono */
  .brand-name, .brand-sub { display: none; }
  #topbarUser { max-width: 100px; }
  /* Ocultar boton APK en movil (ya estan en el movil) */
  #topbarApkBtn { display: none !important; }

  /* Modales pantalla completa */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box {
    max-width: 100vw !important;
    width: 100vw !important;
    max-height: 92dvh !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
  }
  .modal-body {
    max-height: calc(92dvh - 130px - var(--sab));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-footer {
    padding-bottom: calc(14px + var(--sab));
  }
  .modal-footer .btn-primary { min-height: 52px; font-size: 1rem; }

  /* Tablas: scroll horizontal solo si no cabe */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { display: block; overflow-x: auto; white-space: nowrap; min-width: 100%; }

  /* Page header en mobile */
  .page-header { flex-direction: column; gap: 10px; }
  .page-header > div:last-child { width: 100%; }
  .page-header .btn { width: 100%; justify-content: center; }

  /* Bottom nav visible con safe area */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(60px + var(--sab));
    padding-bottom: var(--sab);
    padding-left: var(--sal);
    padding-right: var(--sar);
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 0;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-soft);
    z-index: 900;
    box-shadow: 0 -1px 0 var(--border-soft);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .bnav-btn {
    background: none; border: none;
    display: flex; flex-direction: column; align-items: center;
    gap: 3px; font-size: .65rem; color: var(--text-secondary);
    cursor: pointer; padding: 8px 16px 4px;
    min-width: 56px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
  }
  .bnav-btn.active { color: var(--accent); }
  .bnav-btn:active { opacity: 0.6; }
  .bnav-btn svg { width: 22px; height: 22px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PREMIUM VISUAL ENHANCEMENTS — UI/UX Pro Max recommendations
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Skeleton loading (reemplaza spinner en listas/tablas) ── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--border-soft) 25%,
    var(--bg-card)     50%,
    var(--border-soft) 75%
  );
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
  display: block;
}
.skeleton-row {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
}
.skeleton-row + .skeleton-row {
  border-top: 1px solid var(--border-soft);
}

/* ── Pulso para vehículos en vivo — sección de mapa ── */
@keyframes live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(14,165,233,0.4); }
  50%       { opacity: 0.85; box-shadow: 0 0 0 6px rgba(14,165,233,0); }
}
.vehicle-live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--success-muted); color: var(--success);
  font-size: 11px; font-weight: 600;
}
.vehicle-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  animation: live-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

/* ── Alerta urgente — pulso rojo ── */
@keyframes alert-pulse {
  0%, 100% { background: var(--danger-muted); }
  50%       { background: rgba(220,53,69,0.22); }
}
.alert-urgent { animation: alert-pulse 1.5s ease-in-out infinite; }

/* ── Botón con estado de carga ── */
.btn-loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}
.btn-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}

/* ── Spinner consistente ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm {
  width: 16px; height: 16px;
  border-width: 2px;
}

/* ── Transiciones suaves en cards y filas ── */
.card { transition: box-shadow 0.2s, border-color 0.2s; }
.card:hover { box-shadow: var(--shadow-lg); }
tbody tr { transition: background 0.12s; }

/* ── Focus visible para teclado/accesibilidad ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Cursor pointer en todo elemento interactivo ── */
.btn, .snav-btn, .bnav-btn, .modal-header button,
tbody tr[onclick], .badge[onclick], [role="button"] {
  cursor: pointer;
}

/* ── prefers-reduced-motion: respeta configuracion del usuario ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .skeleton { animation: none; background: var(--border-soft); }
}
