/* public/css/shared.css — Variables y estilos base compartidos */

:root {
  --bg:       #0a0c12;
  --bg2:      #0f1118;
  --surface:  #13161f;
  --surface2: #1a1d28;
  --border:   #252836;
  --border2:  #2e3245;
  --text:     #e8eaf2;
  --text2:    #8890aa;
  --text3:    #555d78;
  --accent:   #4f7ef8;
  --green:    #22c55e;
  --orange:   #f59e0b;
  --red:      #ef4444;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'Inter', sans-serif;

  /* Scrollbar moderna (Modo Oscuro) */
  --scrollbar-thumb:        rgba(255, 255, 255, 0.16);
  --scrollbar-thumb-hover:  rgba(255, 255, 255, 0.32);
  --scrollbar-thumb-active: rgba(79, 126, 248, 0.6);
  --scrollbar-track:        transparent;
  --scrollbar-width:        8px;

  /* Tokens Responsive según GUIA_RESPONSIVE.md */
  --page-inline: clamp(16px, 3vw, 32px);
  --page-block: clamp(16px, 3vw, 28px);
  --touch-size: 44px;
  --content-max: 1600px;
}

/* Modo Día (Light Mode) */
[data-theme="light"] {
  --bg:       #f4f6fa;
  --bg2:      #ffffff;
  --surface:  #ffffff;
  --surface2: #f1f4f9;
  --surface3: #e8edf5;
  --border:   #e2e8f0;
  --border2:  #cbd5e1;
  --text:     #0f172a;
  --text2:    #475569;
  --text3:    #94a3b8;
  --accent:   #2563eb;
  --green:    #16a34a;
  --orange:   #ea580c;
  --red:      #dc2626;

  /* Scrollbar moderna (Modo Día) */
  --scrollbar-thumb:        rgba(100, 116, 139, 0.28);
  --scrollbar-thumb-hover:  rgba(71, 85, 105, 0.5);
  --scrollbar-thumb-active: rgba(37, 99, 235, 0.7);
  --scrollbar-track:        rgba(0, 0, 0, 0.03);
}

/* ==========================================================================
   SCROLLBAR MODERNA GLOBAL (Firefox, Chrome, Edge, Safari)
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

::-webkit-scrollbar {
  width: var(--scrollbar-width);
  height: var(--scrollbar-width);
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-thumb:active {
  background-color: var(--scrollbar-thumb-active);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-width: 320px;
  overflow-x: clip;
  font-size: 14px;
}

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

a { text-decoration: none; }

/* ── TOP BAR ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 17, 24, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  gap: 16px;
  flex-wrap: wrap;
  transition: background-color 0.2s;
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: var(--border);
}

/* Logo imagen */
.topbar-logo {
  height: 38px;
  width: auto;
  display: block;
  /* El logo tiene fondo negro — lo recortamos con object-fit */
  object-fit: contain;
  filter: drop-shadow(0 0 1px rgba(255,255,255,.05));
}

/* Separador vertical entre logo y módulo */
.topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border2);
  flex-shrink: 0;
}

/* Nombre del módulo (Monitor / Seguimiento) */
.topbar-module {
  font-size: .7rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text3);
  white-space: nowrap;
}

/* Contenedor del logo + divider + módulo */
.logo {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Clases legacy — se mantienen por si algún template las usa */
.logo-text {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--accent);
}
.logo-sub {
  font-size: .68rem;
  color: var(--text3);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ── MAIN CONTAINER ── */
.main {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  padding: var(--page-block) var(--page-inline) 64px;
}

/* ── HEADER ROW ── */
.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.page-sub   { font-size: .78rem; color: var(--text2); font-family: var(--mono); }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #3d6fe8; }
.btn-ghost {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text3); }
.btn.loading { opacity: .6; pointer-events: none; }

/* ── STATS ── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.stat-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text3);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  font-family: var(--mono);
  line-height: 1;
}
.stat.s-red    .stat-value { color: var(--red); }
.stat.s-orange .stat-value { color: var(--orange); }
.stat.s-yellow .stat-value { color: #eab308; }
.stat.s-green  .stat-value { color: var(--green); }
.stat.s-blue   .stat-value { color: var(--accent); }

/* ── TABLE BASE ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
thead th {
  background: var(--surface2);
  padding: 12px 16px;
  text-align: left;
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--text2); }
tbody tr { border-bottom: 1px solid var(--border); transition: background .12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
td { padding: 12px 16px; vertical-align: middle; }

.td-num  { color: var(--text3); font-family: var(--mono); font-size: .72rem; width: 48px; }
.td-name { font-weight: 500; }
.td-date { font-family: var(--mono); font-size: .75rem; color: var(--text2); white-space: nowrap; }

.empty-row td {
  text-align: center;
  padding: 64px;
  color: var(--text3);
  font-style: italic;
}

/* ── FILTERS ── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.fbtn {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text2);
  transition: all .2s;
  font-family: var(--sans);
}
.fbtn:hover { border-color: var(--text3); color: var(--text); }
.fbtn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.fsearch {
  margin-left: auto;
  padding: 7px 14px;
  border: 1px solid var(--border2);
  border-radius: 20px;
  font-family: var(--sans);
  font-size: .78rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  width: 200px;
}
.fsearch:focus { border-color: var(--accent); }
.fsearch::placeholder { color: var(--text3); }

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: .83rem;
  font-weight: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  opacity: 0;
  transform: translateY(8px);
  transition: all .25s;
  pointer-events: none;
  z-index: 9999;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border2);
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.err  { background: #3a1010; color: #f87171; border-color: #5a2020; }

@media (max-width: 768px) {
  .topbar, .main { padding: 16px; }
}

/* ── TOPBAR USER SECTION & ROLES ── */
.topbar-user-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.user-badge-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 12px 4px 6px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-role-badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 4px 9px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: uppercase;
}

.role-badge--admin {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.35));
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.role-badge--operador {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.35));
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.user-email-text {
  font-size: .78rem;
  font-family: var(--mono);
  color: var(--text2);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 6px 13px;
  border-radius: 8px;
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  font-family: var(--sans);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-logout:active {
  transform: scale(0.96);
}

.logout-icon {
  font-size: .85rem;
}

/* ── RESTRICCIONES DE ACCESO POR ROL ── */
body:not([data-role="admin"]) #btn-ref,
body:not([data-role="admin"]) .admin-only-action,
body[data-role="operador"] .reload-btn,
body[data-role="operador"] #btn-reload-tracking,
body[data-role="operador"] #btn-back-monitor,
body[data-role="operador"] #btn-ref,
body[data-role="operador"] a[href="/"],
body[data-role="operador"] a[href="/ahorro"],
body[data-role="operador"] .nav-item-monitor,
body[data-role="operador"] .nav-item-ahorro {
  display: none !important;
}

body[data-role="admin"] #btn-ref,
body[data-role="admin"] .admin-only-action {
  display: inline-flex !important;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.btn.loading .spin-icon,
.btn-action.loading .spin-icon,
.back-btn.loading .spin-icon {
  animation: spin 1s linear infinite;
}

/* ── TOPBAR LEFT (HAMBURGER + LOGO) ── */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ── BOTÓN HAMBURGER MENU ── */
.hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: rgba(79, 126, 248, 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(79, 126, 248, 0.3);
  transform: translateY(-1px);
}

.hamburger-btn:active {
  transform: scale(0.94);
}

.hamburger-box {
  width: 18px;
  height: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.25s ease;
}

.hamburger-btn:hover .hamburger-line {
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

.hamburger-btn.is-active .line-1 {
  transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.is-active .line-2 {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger-btn.is-active .line-3 {
  transform: translateY(-6px) rotate(-45deg);
}

/* ── HAMBURGER MENU LATERAL (DRAWER IZQUIERDO) ── */
.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 14, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease;
}

.nav-drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(86vw, 360px);
  max-width: 360px;
  height: 100dvh;
  max-height: 100dvh;
  background: rgba(10, 13, 24, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 15px 0 45px rgba(0, 0, 0, 0.75);
  z-index: 3000;
  transform: translateX(-100%);
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.nav-drawer.open {
  transform: translateX(0);
}

/* Cabecera del Drawer */
.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(15, 18, 32, 0.55);
}

.nav-drawer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-drawer-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(79, 126, 248, 0.35));
}

.nav-drawer-brand-text {
  display: none !important;
}

.nav-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text2);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-drawer-close:hover {
  color: #fff;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
  transform: rotate(90deg);
}

/* Contenido deslizable */
.nav-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.nav-drawer-content::-webkit-scrollbar {
  width: 5px;
}

.nav-drawer-content::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.nav-drawer-content::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

.nav-group {
  margin-bottom: 24px;
}

.nav-group-title {
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text3);
  padding: 0 8px 10px;
  font-weight: 600;
}

.nav-menu-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  background: rgba(20, 24, 45, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.nav-menu-item:hover {
  background: rgba(79, 126, 248, 0.1);
  border-color: rgba(79, 126, 248, 0.35);
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.nav-menu-item.active {
  background: linear-gradient(135deg, rgba(79, 126, 248, 0.22), rgba(42, 74, 127, 0.3));
  border-color: rgba(79, 126, 248, 0.55);
  box-shadow: 0 4px 20px rgba(79, 126, 248, 0.25);
}

.nav-menu-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.nav-item-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  border: 1px solid var(--border2);
  transition: transform 0.2s;
}

.nav-menu-item:hover .nav-item-icon-box {
  transform: scale(1.08);
}

.ico-monitor {
  background: rgba(79, 126, 248, 0.15);
  border-color: rgba(79, 126, 248, 0.35);
  box-shadow: 0 0 12px rgba(79, 126, 248, 0.2);
}

.ico-ahorro {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.ico-seguimiento {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.ico-certificados {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.35);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.ico-users {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.35);
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.2);
  color: #38bdf8;
}

.ico-lineas {
  background: rgba(236, 72, 153, 0.15);
  border-color: rgba(236, 72, 153, 0.35);
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.2);
  color: #f472b6;
}

.ico-ubicacion {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
  color: #22d3ee;
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #22d3ee;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.18);
}

[data-theme="light"] .badge-cyan {
  background: rgba(8, 145, 178, 0.1);
  border-color: rgba(8, 145, 178, 0.3);
  color: #0e7490;
  box-shadow: none;
}

[data-theme="light"] .ico-ubicacion {
  background: rgba(8, 145, 178, 0.12);
  border-color: rgba(8, 145, 178, 0.3);
  color: #0e7490;
  box-shadow: none;
}

.ico-configuracion {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.ico-manual {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

.nav-item-manual:hover .ico-manual {
  border-color: rgba(129, 140, 248, 0.65);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35);
}

.badge-indigo {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

[data-theme="light"] .ico-manual {
  background: rgba(79, 70, 229, 0.12);
  border-color: rgba(79, 70, 229, 0.3);
  color: #4f46e5;
  box-shadow: none;
}

[data-theme="light"] .badge-indigo {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.3);
  color: #4338ca;
}

.nav-item-configuracion:hover .ico-configuracion {
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

[data-theme="light"] .ico-configuracion {
  background: rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.3);
  color: #047857;
  box-shadow: none;
}

[data-theme="light"] .badge-green {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.3);
  color: #047857;
  box-shadow: none;
}

.ico-future {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.07);
}

.nav-item-info {
  flex: 1;
  min-width: 0;
}

.nav-item-name {
  font-family: 'Outfit', var(--sans);
  font-weight: 600;
  font-size: 0.88rem;
  display: block;
  margin-bottom: 2px;
  color: #fff;
}

.nav-item-desc {
  font-size: 0.72rem;
  color: var(--text2);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item-arrow {
  color: var(--text3);
  font-size: 0.95rem;
  font-family: var(--mono);
  transition: all 0.2s;
}

.nav-menu-item:hover .nav-item-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.nav-item-badge {
  font-size: 0.62rem;
  font-family: var(--mono);
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.badge-future {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text3);
}

/* Opciones futuras inactivas */
.nav-item-disabled {
  opacity: 0.65;
  cursor: default;
}

.nav-item-disabled:hover {
  transform: none !important;
  background: rgba(20, 24, 45, 0.4) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  box-shadow: none !important;
}

/* Pie del Drawer: Usuario + Logout */
.nav-drawer-footer {
  padding: 16px 18px max(20px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 9, 18, 0.85);
  margin-top: auto;
}

.nav-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(79, 126, 248, 0.2), rgba(139, 92, 246, 0.25));
  border: 1px solid rgba(79, 126, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  box-shadow: 0 0 12px rgba(79, 126, 248, 0.2);
  flex-shrink: 0;
}

.nav-user-details {
  flex: 1;
  min-width: 0;
}

.nav-user-name {
  font-family: 'Outfit', var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-user-email {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-user-role-badge {
  display: inline-block;
  margin-top: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 10px;
}

.nav-drawer-logout-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.nav-drawer-logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.6);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.35);
}

.nav-drawer-logout-btn:active {
  transform: scale(0.97);
}

.nav-drawer-version {
  text-align: center;
  margin-top: 10px;
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--text3);
}

/* ══════════════════════════════════════════════════════════════════════════════
   TOPBAR USER & NOTIFICATION CENTER
   ══════════════════════════════════════════════════════════════════════════════ */
.topbar-user-section {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.topbar-notif-wrap {
  position: relative;
}

.btn-topbar-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-topbar-bell:hover {
  background: rgba(79, 126, 248, 0.15);
  border-color: rgba(79, 126, 248, 0.4);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 14px rgba(79, 126, 248, 0.3);
}

.notif-badge-counter {
  position: absolute;
  top: -4px;
  right: -4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 10px;
  background: #ef4444;
  color: #fff;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
  animation: notifPulse 2s infinite;
}

@keyframes notifPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.topbar-user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 12px 4px 5px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.user-avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.avatar-admin {
  background: linear-gradient(135deg, #8b5cf6, #d946ef);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

.avatar-operator {
  background: linear-gradient(135deg, #0ea5e9, #3b82f6);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.4);
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-pill-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.2px;
}

.user-pill-role {
  font-size: 0.58rem;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.6px;
  margin-top: 1px;
}

.badge-role-admin {
  color: #c084fc;
}

.badge-role-operator {
  color: #38bdf8;
}

/* ══════════════════════════════════════════════════════════════════════════════
   NOTIFICATIONS POPOVER
   ══════════════════════════════════════════════════════════════════════════════ */
.notif-dropdown {
  position: fixed;
  top: 64px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: rgba(14, 17, 27, 0.97);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75), 0 0 20px rgba(79, 126, 248, 0.15);
  z-index: 99999;
  overflow: hidden;
  animation: notifSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifSlide {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.notif-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.notif-title {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Outfit', var(--sans);
}

.btn-notif-action {
  font-size: 0.68rem;
  font-family: var(--sans);
  color: var(--accent);
  background: rgba(79, 126, 248, 0.12);
  border: 1px solid rgba(79, 126, 248, 0.3);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-notif-action:hover {
  background: rgba(79, 126, 248, 0.25);
  color: #fff;
}

.notif-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.notif-list::-webkit-scrollbar {
  width: 5px;
}
.notif-list::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 999px;
  transition: background-color 0.2s ease;
}
.notif-list::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

.notif-loading, .notif-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text2);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.2s ease;
}

.notif-item.unread {
  background: rgba(79, 126, 248, 0.08);
  border-color: rgba(79, 126, 248, 0.25);
}

.notif-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(79, 126, 248, 0.15);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-item-icon.icon-acceso-gps {
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
}

.notif-item-icon.icon-cert {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-msg {
  font-size: 0.78rem;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 4px;
}

.notif-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  color: var(--text3);
}

.notif-item-op {
  color: var(--text2);
}
.notif-item-op strong {
  color: var(--accent);
}

.notif-item-time {
  font-family: var(--mono);
  font-size: 0.64rem;
}

/* ══════════════════════════════════════════════════════════════════════════════
   USER MANAGEMENT MODAL
   ══════════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  z-index: 100000;
}

.modal-card-users {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 860px;
  max-height: 88vh;
  overflow-y: auto;
  background: rgba(14, 17, 28, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(139, 92, 246, 0.15);
  z-index: 100001;
  padding: 24px 28px;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-users-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.modal-users-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 1px;
  color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.3);
  padding: 3px 8px;
  border-radius: 8px;
  margin-bottom: 6px;
}

.modal-users-title {
  font-family: 'Outfit', var(--sans);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.modal-users-sub {
  font-size: 0.78rem;
  color: var(--text2);
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text2);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fff;
}

.modal-users-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.user-create-card, .users-list-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 16px 18px;
}

.card-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 14px;
}

.form-create-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  align-items: flex-end;
}

.f-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.f-field label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text2);
}

.f-field input, .f-field select {
  width: 100%;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 0.82rem;
  font-family: var(--sans);
  outline: none;
  transition: border-color 0.2s;
}

.f-field select option {
  background: #0f111a;
  color: #fff;
}

.f-field input:focus, .f-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(79, 126, 248, 0.25);
}

.f-submit-wrap {
  display: flex;
}

.btn-create-user {
  width: 100%;
  padding: 9px 16px;
  background: linear-gradient(135deg, #4f7ef8, #8b5cf6);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-create-user:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 126, 248, 0.4);
}

.user-mgmt-alert {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Tabla de usuarios */
.users-table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.users-table th {
  text-align: left;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.users-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.td-username strong {
  color: #fff;
  letter-spacing: 0.3px;
}

.master-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.6rem;
  background: rgba(139, 92, 246, 0.2);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 4px;
  padding: 1px 5px;
}

.user-badge {
  display: inline-block;
  font-size: 0.64rem;
  font-family: var(--mono);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}

.badge-admin {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c084fc;
}

.badge-operador {
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.4);
  color: #38bdf8;
}

.td-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text2);
}

.td-actions {
  text-align: right;
  white-space: nowrap;
}

.btn-action-pass {
  background: rgba(79, 126, 248, 0.12);
  border: 1px solid rgba(79, 126, 248, 0.3);
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  margin-right: 6px;
  transition: all 0.2s;
}

.btn-action-pass:hover {
  background: rgba(79, 126, 248, 0.25);
  color: #fff;
}

.btn-action-del {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-action-del:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fff;
}

/* ══════════════════════════════════════════════════════════════════════════════
   REGLAS RESPONSIVE GLOBALES (Basadas en GUIA_RESPONSIVE.md)
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Móvil y Pantallas Pequeñas (<= 767px) ── */
@media (max-width: 767px) {
  /* Prevenir zoom automático de Safari en inputs */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* Topbar ultra compacta y limpia en móvil */
  .topbar {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    padding: 8px var(--page-inline) !important;
    gap: 8px !important;
    min-height: 52px !important;
  }

  .topbar-left {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .logo {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .topbar-logo {
    height: 26px !important;
    max-width: 130px !important;
    width: auto !important;
  }

  /* Ocultar en móvil según requerimiento explícito */
  .topbar-divider,
  .topbar-module,
  .topbar-user-pill,
  .schedule-pill,
  .user-role-badge {
    display: none !important;
  }

  /* El botón de notificaciones (campana) se ubica a la derecha de la cabecera */
  .topbar-user-section {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
  }

  .topbar-notif-wrap {
    display: flex !important;
    align-items: center !important;
  }

  .btn-topbar-bell {
    width: 38px !important;
    height: 38px !important;
  }

  /* Tarjetas de estadísticas (.stats) más compactas en móvil */
  .stats {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 14px !important;
  }

  .stat {
    padding: 10px 12px !important;
    border-radius: 8px !important;
  }

  .stat-label {
    font-size: 0.62rem !important;
    letter-spacing: 0.8px !important;
    margin-bottom: 3px !important;
  }

  .stat-value {
    font-size: 1.35rem !important;
  }

  /* Tablas: celdas más compactas para facilitar lectura en móvil */
  table td, table th {
    padding: 8px 10px !important;
    font-size: 0.78rem !important;
  }

  /* Área táctil mínima de 44x44px en controles de cabecera */
  .hamburger-btn,
  .topbar-user-section button,
  .notif-bell-btn {
    min-width: var(--touch-size);
    min-height: var(--touch-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Dropdown de notificaciones centrado en móvil */
  .notif-dropdown {
    position: fixed;
    top: 58px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    border-radius: 14px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
  }

  /* Tablas desplazables sin romper el layout global */
  .table-wrap,
  .table-wrap-trk,
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  /* Acciones de cabecera apiladas */
  .header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions .btn {
    width: 100%;
    min-height: var(--touch-size);
    justify-content: center;
  }
}

/* ── Móvil Muy Pequeño (<= 359px) ── */
@media (max-width: 359px) {
  :root {
    --page-inline: 12px;
    --page-block: 12px;
  }

  .topbar-module {
    display: none;
  }
}

/* ── Reducción de Movimiento (Accesibilidad) ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   SELECTOR DE TEMA: MODO DÍA & MODO OSCURO (SHARED UI)
   ========================================================================== */

/* Botón rápido de alternar tema en Topbar */
.btn-topbar-theme {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
  flex-shrink: 0;
}

.btn-topbar-theme:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(79, 126, 248, 0.12);
  transform: translateY(-1px);
}

.btn-topbar-theme:active {
  transform: scale(0.94);
}

.btn-topbar-theme .theme-icon-sun {
  display: none;
}
.btn-topbar-theme .theme-icon-moon {
  display: block;
}

[data-theme="light"] .btn-topbar-theme .theme-icon-sun {
  display: block;
  color: #ea580c;
}

[data-theme="light"] .btn-topbar-theme .theme-icon-moon {
  display: none;
}

/* Selector segmentado de Tema en el Menú Drawer */
.nav-theme-switcher {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-theme-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.nav-theme-label svg {
  color: var(--accent);
}

.theme-switch-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(0, 0, 0, 0.28);
  padding: 3px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.theme-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 7px;
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text2);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.theme-switch-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.theme-switch-btn.active {
  background: var(--surface2);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ==========================================================================
   REGLAS VISUALES MODO DÍA (LIGHT MODE) — SHARED UI
   ========================================================================== */
[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="light"] .topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .logo {
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

[data-theme="light"] .topbar-logo {
  filter: none;
}

[data-theme="light"] .topbar-divider {
  background: var(--border2);
}

[data-theme="light"] .topbar-module {
  color: var(--text2);
}

[data-theme="light"] .topbar-user-pill {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .user-pill-name {
  color: #0f172a;
}

[data-theme="light"] .btn-topbar-bell,
[data-theme="light"] .btn-topbar-theme {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--text2);
}

[data-theme="light"] .btn-topbar-bell:hover,
[data-theme="light"] .btn-topbar-theme:hover {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .hamburger-btn {
  background: #f8fafc;
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .hamburger-line {
  background: #334155;
}

[data-theme="light"] .hamburger-btn:hover {
  background: #eff6ff;
  border-color: var(--accent);
}

[data-theme="light"] .hamburger-btn:hover .hamburger-line {
  background: var(--accent);
}

/* Tablas, Cards y Estadísticas en Modo Día */
[data-theme="light"] .table-wrap {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] thead th {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  color: #475569;
}

[data-theme="light"] thead th:hover {
  color: #0f172a;
}

[data-theme="light"] tbody tr {
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] tbody tr:hover {
  background: #f8fafc;
}

[data-theme="light"] .stat {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .stat-label {
  color: #64748b;
}

[data-theme="light"] .btn-ghost {
  background: #f8fafc;
  border-color: var(--border2);
  color: #334155;
}

[data-theme="light"] .btn-ghost:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

[data-theme="light"] .fbtn {
  background: #ffffff;
  border-color: var(--border2);
  color: #475569;
}

[data-theme="light"] .fbtn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

[data-theme="light"] .fsearch {
  background: #ffffff;
  border-color: var(--border2);
  color: #0f172a;
}

[data-theme="light"] .fsearch::placeholder {
  color: #94a3b8;
}

/* Menú Drawer lateral en Modo Día */
[data-theme="light"] .nav-drawer {
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 15px 0 45px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .nav-drawer-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] .nav-drawer-brand {
  background: transparent;
  padding: 0;
  border-radius: 0;
}

[data-theme="light"] .nav-drawer-logo {
  filter: none;
}

[data-theme="light"] .nav-drawer-backdrop {
  background: rgba(15, 23, 42, 0.45);
}

[data-theme="light"] .nav-drawer-close {
  background: #ffffff;
  border-color: var(--border2);
  color: #64748b;
}

[data-theme="light"] .nav-drawer-close:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #dc2626;
}

[data-theme="light"] .nav-group-title {
  color: #64748b;
}

[data-theme="light"] .nav-menu-item {
  background: #ffffff;
  border: 1px solid var(--border);
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .nav-menu-item:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

[data-theme="light"] .nav-menu-item.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

[data-theme="light"] .nav-item-name {
  color: #0f172a;
}

[data-theme="light"] .nav-item-desc {
  color: #64748b;
}

[data-theme="light"] .nav-item-icon-box {
  background: #f1f5f9;
  border-color: var(--border);
}

[data-theme="light"] .nav-drawer-footer {
  background: #f8fafc;
  border-top: 1px solid var(--border);
}

[data-theme="light"] .nav-theme-switcher {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .theme-switch-group {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

[data-theme="light"] .theme-switch-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .theme-switch-btn.active {
  background: #ffffff;
  color: #2563eb;
  border-color: #cbd5e1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .nav-user-card {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .nav-user-name {
  color: #0f172a;
}

[data-theme="light"] .nav-user-email {
  color: #64748b;
}

/* Centro de Notificaciones en Modo Día */
[data-theme="light"] .notif-dropdown {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .notif-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  color: #0f172a;
}

[data-theme="light"] .notif-title {
  color: #0f172a;
}

[data-theme="light"] .btn-notif-action {
  background: #ffffff;
  border-color: var(--border2);
  color: var(--text2);
}

[data-theme="light"] .btn-notif-action:hover {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .notif-item {
  border-bottom: 1px solid #f1f5f9;
}

[data-theme="light"] .notif-item:hover {
  background: #f8fafc;
}

[data-theme="light"] .notif-item.unread {
  background: #eff6ff;
}

[data-theme="light"] .notif-item-title {
  color: #0f172a;
}

[data-theme="light"] .notif-item-msg {
  color: #475569;
}

[data-theme="light"] .notif-item-time {
  color: #94a3b8;
}

[data-theme="light"] #toast {
  background: #ffffff;
  color: #0f172a;
  border-color: var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   BOTÓN Y VENTANA MODAL DE CONFIGURACIÓN GPS (SMS INFINIREACH)
   ========================================================================== */
.btn-config-gps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid rgba(6, 182, 212, 0.38);
  background: rgba(6, 182, 212, 0.12);
  color: #22d3ee;
  font-family: var(--sans);
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}

.btn-config-gps:hover:not(:disabled) {
  background: rgba(6, 182, 212, 0.24);
  border-color: #22d3ee;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-config-gps:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gcm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 18, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99990;
}

.gcm-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(94vw, 560px);
  max-height: 90dvh;
  overflow-y: auto;
  background: #131622;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
  z-index: 99991;
  color: var(--text);
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.gcm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.gcm-title-group {
  min-width: 0;
}

.gcm-eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #22d3ee;
  margin-bottom: 2px;
}

.gcm-device-name {
  font-family: 'Outfit', var(--sans);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gcm-head-btns {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.gcm-api-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.gcm-api-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.gcm-api-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.gcm-api-dot.is-ok   { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.gcm-api-dot.is-warn { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }

.gcm-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gcm-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}

.gcm-api-panel {
  padding: 12px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.gcm-api-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr auto auto;
  gap: 8px;
}

.gcm-api-save {
  padding: 0 14px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.gcm-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.gcm-pill {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.gcm-pill-copy {
  cursor: pointer;
}

.gcm-pill-copy:hover {
  border-color: var(--accent);
}

.gcm-pill-lbl {
  font-size: 0.63rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text3);
}

.gcm-pill-val {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gcm-sim-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.gcm-sim-input {
  width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: #22d3ee;
  font-size: 0.78rem;
  font-weight: 700;
  outline: none;
  padding: 0;
}

.gcm-mini-copy {
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  border-radius: 5px;
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  cursor: pointer;
  flex-shrink: 0;
}

.gcm-mini-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.gcm-pack-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, #059669, #0284c7);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.32);
  transition: all 0.18s;
}

.gcm-pack-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

.gcm-pack-btn:disabled,
.gcm-qbtn:disabled,
.gcm-custom-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.gcm-progress-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.gcm-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.gcm-progress-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: #93c5fd;
}

.gcm-stop-btn {
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.gcm-steps-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.gcm-step-pill {
  font-size: 0.68rem;
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text3);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gcm-step-pill.is-sending {
  background: rgba(79, 126, 248, 0.18);
  border-color: #60a5fa;
  color: #93c5fd;
}

.gcm-step-pill.is-done {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.45);
  color: #4ade80;
}

.gcm-step-pill.is-error {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #f87171;
}

.gcm-section-lbl {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
  margin-bottom: 7px;
}

.gcm-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.gcm-qbtn {
  padding: 8px 9px;
  border-radius: 9px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  transition: all 0.15s;
}

.gcm-qbtn span {
  font-size: 0.76rem;
  font-weight: 600;
}

.gcm-qbtn small {
  font-size: 0.64rem;
  color: var(--text3);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gcm-qbtn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(79, 126, 248, 0.1);
}

.gcm-custom-row {
  display: flex;
  gap: 8px;
}

.gcm-input {
  flex: 1;
  height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--bg2);
  color: var(--text);
  font-size: 0.78rem;
  outline: none;
  min-width: 0;
}

.gcm-token-input {
  -webkit-text-security: disc;
  text-security: disc;
}

.gcm-input:focus {
  border-color: var(--accent);
}

.gcm-custom-send {
  padding: 0 16px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.gcm-custom-send:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.gcm-status-bar {
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 500;
}

.gcm-status-bar.is-sending { background: rgba(79, 126, 248, 0.14); border: 1px solid rgba(79, 126, 248, 0.35); color: #93c5fd; }
.gcm-status-bar.is-success { background: rgba(34, 197, 94, 0.14); border: 1px solid rgba(34, 197, 94, 0.38); color: #4ade80; }
.gcm-status-bar.is-warn    { background: rgba(245, 158, 11, 0.14); border: 1px solid rgba(245, 158, 11, 0.38); color: #fbbf24; }
.gcm-status-bar.is-error   { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.4); color: #f87171; }

/* Modo Día Modal Configuración GPS */
[data-theme="light"] .btn-config-gps {
  background: #ecfeff;
  border-color: #67e8f9;
  color: #0e7490;
}

[data-theme="light"] .btn-config-gps:hover:not(:disabled) {
  background: #0891b2;
  border-color: #0891b2;
  color: #ffffff;
}

[data-theme="light"] .gcm-modal {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .gcm-head,
[data-theme="light"] .gcm-api-panel {
  background: #f8fafc;
}

[data-theme="light"] .gcm-eyebrow {
  color: #0e7490;
}

[data-theme="light"] .gcm-pill,
[data-theme="light"] .gcm-progress-wrap,
[data-theme="light"] .gcm-input,
[data-theme="light"] .gcm-qbtn,
[data-theme="light"] .gcm-api-btn,
[data-theme="light"] .gcm-close-btn,
[data-theme="light"] .gcm-custom-send,
[data-theme="light"] .gcm-mini-copy {
  background: #f8fafc;
  border-color: var(--border2);
  color: #0f172a;
}

[data-theme="light"] .gcm-sim-input {
  color: #0e7490;
}

[data-theme="light"] .gcm-progress-label { color: #1d4ed8; }
[data-theme="light"] .gcm-step-pill { background: #ffffff; color: #64748b; }
[data-theme="light"] .gcm-step-pill.is-sending { background: #dbeafe; border-color: #60a5fa; color: #1d4ed8; }
[data-theme="light"] .gcm-step-pill.is-done { background: #dcfce7; border-color: #86efac; color: #15803d; }
[data-theme="light"] .gcm-step-pill.is-error { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }

[data-theme="light"] .gcm-status-bar.is-sending { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
[data-theme="light"] .gcm-status-bar.is-success { background: #f0fdf4; border-color: #86efac; color: #15803d; }
[data-theme="light"] .gcm-status-bar.is-warn    { background: #fffbeb; border-color: #fcd34d; color: #b45309; }
[data-theme="light"] .gcm-status-bar.is-error   { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }

@media (max-width: 767px) {
  .gcm-info-grid {
    grid-template-columns: 1fr;
  }

  .gcm-quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gcm-api-grid {
    grid-template-columns: 1fr;
  }

  .gcm-steps-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==========================================================================
   VISTA DEDICADA /configuracion (BUSCADOR POR PLACA + ENVÍO SMS)
   ========================================================================== */
.cfg-main {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  padding: var(--page-block) var(--page-inline) 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cfg-search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.cfg-search-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.cfg-plate-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.cfg-search-ico {
  position: absolute;
  left: 14px;
  color: var(--text3);
  display: inline-flex;
  pointer-events: none;
}

.cfg-plate-input {
  width: 100%;
  height: 46px;
  padding: 0 38px 0 42px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 11px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.94rem;
  font-weight: 600;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cfg-plate-input::placeholder {
  text-transform: none;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--text3);
}

.cfg-plate-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 126, 248, 0.2);
}

.cfg-clear-btn {
  position: absolute;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.cfg-clear-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.cfg-select-btn {
  height: 46px;
  padding: 0 20px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(135deg, #2563eb, #0891b2);
  color: #ffffff;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}

.cfg-select-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

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

.cfg-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  z-index: 1200;
  max-height: 300px;
  overflow-y: auto;
  padding: 6px;
}

.cfg-sug-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.cfg-sug-item:hover,
.cfg-sug-item.is-active {
  background: rgba(79, 126, 248, 0.16);
}

.cfg-sug-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cfg-sug-name {
  font-weight: 600;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cfg-sug-sub {
  font-size: 0.72rem;
  color: var(--text3);
}

.cfg-sug-min {
  font-size: 0.75rem;
  font-weight: 600;
  color: #22d3ee;
  flex-shrink: 0;
}

.cfg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

[data-theme="light"] .cfg-search-card,
[data-theme="light"] .cfg-card {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .cfg-plate-input {
  background: #f8fafc;
  border-color: var(--border2);
  color: #0f172a;
}

[data-theme="light"] .cfg-clear-btn {
  background: #e2e8f0;
  color: #475569;
}

[data-theme="light"] .cfg-suggestions {
  background: #ffffff;
  border-color: var(--border2);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

[data-theme="light"] .cfg-sug-item {
  color: #0f172a;
}

[data-theme="light"] .cfg-sug-min {
  color: #0e7490;
}

@media (max-width: 767px) {
  .cfg-search-form {
    flex-direction: column;
  }

  .cfg-plate-input {
    font-size: 16px !important;
  }

  .cfg-select-btn {
    width: 100%;
  }

  .gcm-pack-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Botones de Configuración SMS (Completa / Despertar / Gnxys 900) ── */
.gcm-pack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 720px) {
  .gcm-pack-grid {
    grid-template-columns: 1fr;
  }
}

.gcm-pack5-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.28);
  transition: all 0.18s;
}

.gcm-pack5-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
}

.gcm-pack5-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.gcm-pack-gnxys-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: linear-gradient(135deg, #d97706, #ea580c);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.28);
  transition: all 0.18s;
}

.gcm-pack-gnxys-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(234, 88, 12, 0.45);
}

.gcm-pack-gnxys-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.gcm-wd-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.gcm-wd-btn:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.25);
  color: #ffffff;
}

/* ==========================================================================
   GPS ESPECIALES: PANEL DE MÉTRICAS VISUALES Y TABLA
   ========================================================================== */
.wd-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 4px;
}

.wd-metric-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  transition: all 0.2s ease;
}

.wd-metric-card:hover {
  transform: translateY(-2px);
}

.wd-metric-val {
  font-size: 1.55rem;
  font-weight: 800;
  font-family: var(--mono);
  line-height: 1.1;
  margin-bottom: 4px;
}

.wd-metric-lbl {
  font-size: 0.72rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.metric-total .wd-metric-val { color: #f8fafc; }
.metric-ok .wd-metric-val { color: #4ade80; }
.metric-waiting .wd-metric-val { color: #38bdf8; }
.metric-blocked .wd-metric-val { color: #f87171; }

.metric-total { border-color: rgba(255, 255, 255, 0.12); }
.metric-ok { border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.05); }
.metric-waiting { border-color: rgba(56, 189, 248, 0.3); background: rgba(56, 189, 248, 0.05); }
.metric-blocked { border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.05); }

.wd-table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg2);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.wd-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.wd-table th {
  background: var(--surface2);
  color: var(--text3);
  padding: 12px 16px;
  font-size: 0.72rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.wd-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.wd-table tbody tr:last-child td {
  border-bottom: none;
}

.wd-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.wd-tb-name {
  font-weight: 700;
  color: #fff;
  display: block;
  font-size: 0.88rem;
}

.wd-tb-meta {
  font-size: 0.72rem;
  color: var(--text3);
}

.wd-empty-cell {
  text-align: center;
  padding: 30px 16px !important;
  color: var(--text3);
  font-size: 0.85rem;
}

.wd-status-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 170px;
}

.wd-status-desc {
  font-size: 0.7rem;
  color: var(--text3);
  line-height: 1.25;
}

[data-theme="light"] .wd-metric-card {
  background: #ffffff;
  border-color: #e2e8f0;
}
[data-theme="light"] .metric-total .wd-metric-val { color: #0f172a; }
[data-theme="light"] .metric-ok { background: #f0fdf4; border-color: #bbf7d0; }
[data-theme="light"] .metric-waiting { background: #f0f9ff; border-color: #bae6fd; }
[data-theme="light"] .metric-blocked { background: #fef2f2; border-color: #fecaca; }
[data-theme="light"] .wd-table-responsive {
  background: #ffffff;
  border-color: #e2e8f0;
}
[data-theme="light"] .wd-table th {
  background: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}
[data-theme="light"] .wd-table td {
  border-color: #f1f5f9;
  color: #1e293b;
}
[data-theme="light"] .wd-table tbody tr:hover td {
  background: #f8fafc;
}
[data-theme="light"] .wd-tb-name {
  color: #0f172a;
}

@media (max-width: 767px) {
  .wd-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.wd-cycle-pill {
  font-size: 0.7rem;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text2);
  white-space: nowrap;
}

.wd-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wd-empty {
  text-align: center;
  padding: 18px 12px;
  font-size: 0.8rem;
  color: var(--text3);
  border: 1px dashed var(--border2);
  border-radius: 11px;
}

.wd-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wd-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.wd-item-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.wd-item-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text);
}

.wd-item-sub {
  font-size: 0.72rem;
  color: var(--text3);
}

.wd-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.wd-badge.is-ok      { background: rgba(34, 197, 94, 0.15); border: 1px solid rgba(34, 197, 94, 0.4); color: #4ade80; }
.wd-badge.is-waiting { background: rgba(56, 189, 248, 0.15); border: 1px solid rgba(56, 189, 248, 0.4); color: #38bdf8; }
.wd-badge.is-blocked { background: rgba(239, 68, 68, 0.16); border: 1px solid rgba(239, 68, 68, 0.45); color: #f87171; }
.wd-badge.is-idle    { background: var(--surface2); border: 1px solid var(--border2); color: var(--text2); }

.wd-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--text2);
}

.wd-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.wd-status-msg {
  font-size: 0.74rem;
  color: var(--text3);
}

.wd-item-actions {
  display: flex;
  gap: 6px;
}

.wd-btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text2);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  line-height: 1;
}

.wd-btn-mini svg {
  flex-shrink: 0;
}

.wd-btn-mini.is-reactivate {
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.08);
  color: #4ade80;
}

.wd-btn-mini.is-reactivate:hover {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.wd-btn-mini.is-remove {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.05);
  color: #f87171;
}

.wd-btn-mini.is-remove:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  transform: translateY(-1px);
}

[data-theme="light"] .wd-btn-mini.is-reactivate {
  background: #ecfdf5;
  border-color: #86efac;
  color: #047857;
}

[data-theme="light"] .wd-btn-mini.is-reactivate:hover {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

[data-theme="light"] .wd-btn-mini.is-remove {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

[data-theme="light"] .wd-btn-mini.is-remove:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

[data-theme="light"] .gcm-wd-btn {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}

[data-theme="light"] .gcm-wd-btn:hover:not(:disabled) {
  background: #059669;
  color: #ffffff;
}

[data-theme="light"] .wd-rule-note,
[data-theme="light"] .wd-cycle-pill,
[data-theme="light"] .wd-item {
  background: #f8fafc;
  border-color: var(--border);
}

[data-theme="light"] .wd-badge.is-ok      { background: #dcfce7; border-color: #86efac; color: #15803d; }
[data-theme="light"] .wd-badge.is-waiting { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
[data-theme="light"] .wd-badge.is-blocked { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }

[data-theme="light"] .wd-btn-mini {
  background: #ffffff;
  border-color: var(--border2);
  color: #334155;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL DE CONFIRMACIÓN ELEGANTE CENTRADO (UNIVERSAL)
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes fadeInBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalPopRefined {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 19, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeInBackdrop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal-card {
  background: rgba(20, 24, 45, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  width: 100%;
  max-width: 440px;
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.12);
  animation: modalPopRefined 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.confirm-icon-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.confirm-icon-wrap.info-mode {
  background: rgba(79, 126, 248, 0.14);
  border-color: rgba(79, 126, 248, 0.35);
  color: #60a5fa;
  box-shadow: 0 0 20px rgba(79, 126, 248, 0.2);
}

.confirm-icon-wrap.success-mode {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}

.confirm-icon-wrap.warning-mode {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.confirm-modal-title {
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

.confirm-modal-message {
  font-size: 0.9rem;
  color: var(--text2, #94a3b8);
  line-height: 1.5;
  margin: 0 0 14px 0;
}

.confirm-modal-extra {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
  font-family: var(--mono, monospace);
  font-size: 0.85rem;
  color: #38bdf8;
  word-break: break-all;
  box-sizing: border-box;
}

.confirm-modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

.confirm-btn-cancel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.confirm-btn-accept {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #ffffff;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-btn-accept:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
  transform: translateY(-1px);
}

.confirm-btn-accept.primary-mode {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

.confirm-btn-accept.primary-mode:hover {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

.confirm-btn-accept.success-mode {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.confirm-btn-accept.success-mode:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

[data-theme="light"] .confirm-modal-backdrop {
  background: rgba(15, 23, 42, 0.6);
}

[data-theme="light"] .confirm-modal-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .confirm-modal-title {
  color: #0f172a;
}

[data-theme="light"] .confirm-modal-message {
  color: #475569;
}

[data-theme="light"] .confirm-btn-cancel {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

[data-theme="light"] .confirm-btn-cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* ==========================================================================
   MEJORA VISUAL DE TABLAS (ZEBRA STRIPING WEB Y MÓVIL — MODO OSCURO Y CLARO)
   ========================================================================== */
table tbody tr:not(.empty-row):not(.filter-row):nth-child(odd) {
  background-color: rgba(15, 20, 38, 0.55);
}

table tbody tr:not(.empty-row):not(.filter-row):nth-child(even) {
  background-color: rgba(34, 43, 74, 0.45);
}

table tbody tr:not(.empty-row):not(.filter-row):hover {
  background-color: rgba(79, 126, 248, 0.13) !important;
}

[data-theme="light"] table tbody tr:not(.empty-row):not(.filter-row):nth-child(odd) {
  background-color: #ffffff;
}

[data-theme="light"] table tbody tr:not(.empty-row):not(.filter-row):nth-child(even) {
  background-color: #f1f5f9;
}

[data-theme="light"] table tbody tr:not(.empty-row):not(.filter-row):hover {
  background-color: #e0ecff !important;
}
