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

:root {
  --bg:       #0f1117;
  --surface:  #1a1d2e;
  --surface2: #232740;
  --border:   #2d3748;
  --text:     #e2e8f0;
  --text2:    #94a3b8;
  --text3:    #64748b;

  --verde:    #22c55e;
  --gris:     #6b7280;
  --azul:     #3b82f6;
  --azul2:    #60a5fa;
  --violeta:  #a855f7;
  --rojo:     #ef4444;
  --rojo2:    #dc2626;
  --naranja:  #f97316;
  --amarillo: #eab308;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── HEADER ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo .icon {
  width: 32px; height: 32px;
  background: var(--azul);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.header-logo h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}
.header-logo span {
  font-size: 11px;
  color: var(--text2);
  display: block;
  font-weight: 400;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.header-clock {
  text-align: right;
}
.header-clock .time {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.header-clock .date {
  font-size: 11px;
  color: var(--text2);
}
.sync-badge {
  font-size: 11px;
  color: var(--verde);
  display: flex;
  align-items: center;
  gap: 4px;
}
.sync-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--verde);
  border-radius: 50%;
  display: inline-block;
}

/* ── MAIN LAYOUT ── */
.main {
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ── PANELES KPI ── */
.paneles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.panel-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  border-radius: 12px 0 0 12px;
}
.panel-card.p-operativas::before { background: var(--verde); }
.panel-card.p-reparacion::before { background: var(--rojo); }
.panel-card.p-ruta::before       { background: var(--azul); }
.panel-card.p-pendientes::before { background: var(--amarillo); }
.panel-card.p-despachados::before{ background: var(--gris); }

.panel-card:hover { border-color: var(--text3); transform: translateY(-1px); }
.panel-card.activo { border-color: var(--azul2); }
.panel-card.p-operativas.activo  { border-color: var(--verde); }
.panel-card.p-reparacion.activo  { border-color: var(--rojo); }
.panel-card.p-ruta.activo        { border-color: var(--azul); }
.panel-card.p-pendientes.activo  { border-color: var(--amarillo); }
.panel-card.p-despachados.activo { border-color: var(--gris); }

.panel-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 8px;
}
.panel-count {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.panel-card.p-operativas  .panel-count { color: var(--verde); }
.panel-card.p-reparacion  .panel-count { color: var(--rojo); }
.panel-card.p-ruta        .panel-count { color: var(--azul2); }
.panel-card.p-pendientes  .panel-count { color: var(--amarillo); }
.panel-card.p-despachados .panel-count { color: var(--gris); }

.panel-sub {
  font-size: 11px;
  color: var(--text3);
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  background: none;
  border: none;
  padding: 10px 20px;
  color: var(--text2);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.activo {
  color: var(--text);
  border-bottom-color: var(--azul2);
}
.tab-content { display: none; }
.tab-content.activo { display: block; }

/* ── FILTROS ── */
.filtros {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filtro-select, .filtro-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.filtro-select:focus, .filtro-input:focus { border-color: var(--azul2); }
.filtro-input { min-width: 200px; }
.filtro-select option { background: var(--surface2); }
.btn-reset {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-reset:hover { border-color: var(--text2); color: var(--text); }

/* ── TABLA FLOTA ── */
.tabla-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.tabla-info {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
td {
  padding: 10px 14px;
  vertical-align: middle;
}
.td-interno { font-weight: 700; color: var(--text); font-size: 13px; }
.td-cat { color: var(--text2); font-size: 12px; max-width: 160px; }
.td-dom { font-weight: 600; color: var(--azul2); font-family: monospace; font-size: 13px; }
.td-semi { color: var(--text3); font-family: monospace; font-size: 12px; }
.td-zona { color: var(--text2); font-size: 12px; }
.td-chofer { color: var(--text2); font-size: 12px; max-width: 140px; }
.td-chofer small { display: block; color: var(--text3); font-size: 10px; }
.td-tarea { color: var(--text2); font-size: 12px; }
.td-acciones { white-space: nowrap; }

/* ── BADGES ESTADO ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-DISPONIBLE    { color: var(--verde);   background: #22c55e18; }
.badge-NO-DISPONIBLE { color: var(--gris);    background: #6b728018; }
.badge-EN-RUTA       { color: var(--azul);    background: #3b82f618; }
.badge-EN-VIAJE      { color: var(--azul2);   background: #60a5fa18; }
.badge-EN-SERVICIO   { color: var(--violeta); background: #a855f718; }
.badge-REPARACION    { color: var(--rojo);    background: #ef444418; }
.badge-MANTENIMIENTO { color: var(--naranja); background: #f9731618; }
.badge-SUSPENDIDO    { color: var(--rojo2);   background: #dc262618; }
.badge-NOTIFICADO    { color: var(--amarillo); background: #eab30818; animation: pulseNot 1.5s infinite; }
@keyframes pulseNot { 0%,100% { opacity:1; } 50% { opacity:0.6; } }

/* ── BOTONES ACCIÓN ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.btn:hover { opacity: 0.85; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-verde    { background: #22c55e22; color: var(--verde); border: 1px solid #22c55e44; }
.btn-rojo     { background: #ef444422; color: var(--rojo);  border: 1px solid #ef444444; }
.btn-azul     { background: #3b82f622; color: var(--azul2); border: 1px solid #3b82f644; }
.btn-gris     { background: #6b728022; color: var(--gris);  border: 1px solid #6b728044; }
.btn-amarillo { background: #eab30822; color: var(--amarillo); border: 1px solid #eab30844; }
.btn-primary  { background: var(--azul); color: #fff; border: none; padding: 8px 18px; border-radius: 8px; font-size: 13px; }
.btn-primary:hover { opacity: 0.9; }
.btn-danger   { background: var(--rojo); color: #fff; border: none; padding: 8px 18px; border-radius: 8px; font-size: 13px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ── SECCIÓN PEDIDOS ── */
.pedidos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.pedidos-header h2 { font-size: 15px; color: var(--text2); font-weight: 600; }

.pedidos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.pedido-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  border-left: 4px solid transparent;
  position: relative;
}
.pedido-card:hover { transform: translateY(-2px); border-color: var(--border); }
.pedido-card.pr-URGENTE    { border-left-color: var(--rojo); }
.pedido-card.pr-PRECAUCION { border-left-color: var(--amarillo); }
.pedido-card.pr-NORMAL     { border-left-color: var(--verde); }

.pedido-card.kpi-warn { animation: pulseWarn 2s infinite; }
.pedido-card.kpi-crit { animation: pulseCrit 1.5s infinite; }

@keyframes pulseWarn {
  0%, 100% { box-shadow: 0 0 0 0 #eab30840; }
  50% { box-shadow: 0 0 0 4px #eab30840; }
}
@keyframes pulseCrit {
  0%, 100% { box-shadow: 0 0 0 0 #ef444450; }
  50% { box-shadow: 0 0 0 6px #ef444450; }
}

.pedido-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.pedido-cliente {
  font-weight: 700;
  font-size: 14px;
  flex: 1;
  min-width: 0;
}
.badge-pr {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.badge-pr-URGENTE    { background: #ef444420; color: var(--rojo); }
.badge-pr-PRECAUCION { background: #eab30820; color: var(--amarillo); }
.badge-pr-NORMAL     { background: #22c55e20; color: var(--verde); }

.badge-turno {
  font-size: 10px;
  color: var(--text2);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.pedido-desc {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 12px;
  line-height: 1.5;
}
.pedido-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text2);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 20px;
}
.chip.chip-warn { color: var(--amarillo); border-color: #eab30840; background: #eab30810; }
.chip.chip-crit { color: var(--rojo); border-color: #ef444440; background: #ef444410; }
.chip.chip-ok   { color: var(--verde); border-color: #22c55e40; background: #22c55e10; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── MODALES ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #00000080;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.abierto { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.modal-lg { max-width: 700px; }
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  margin-left: 12px;
}
.modal-close:hover { color: var(--text); }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}
.form-control:focus { border-color: var(--azul2); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-control option { background: var(--surface2); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── MODAL SUSPENDER ── */
.campo-comentario { display: none; }
.campo-comentario.visible { display: block; }
.alert-comentario {
  font-size: 11px;
  color: var(--rojo);
  margin-top: 4px;
}

/* ── MODAL DETALLE PEDIDO ── */
.detalle-seccion {
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.detalle-seccion h4 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 10px;
}
.detalle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.detalle-item label {
  display: block;
  font-size: 10px;
  color: var(--text3);
  margin-bottom: 2px;
}
.detalle-item span { font-size: 13px; font-weight: 600; }

.unidades-compatibles { margin-top: 6px; }
.unidad-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
}
.unidad-item-info { flex: 1; }
.unidad-item-info strong { font-size: 13px; display: block; }
.unidad-item-info small { font-size: 11px; color: var(--text2); }

/* ── TAREA CELL ── */
.tarea-en-curso { font-size: 10px; font-weight: 700; color: var(--azul2); letter-spacing: 0.05em; text-transform: uppercase; }
.tarea-ruta     { font-size: 12px; font-weight: 600; color: var(--azul2); display: inline; }
.tarea-ref      { font-size: 10px; color: var(--text3); margin-left: 4px; display: inline; }
.tarea-proximo  { font-size: 11px; color: var(--amarillo); font-weight: 600; display: inline; }
.tarea-sub      { font-size: 11px; color: var(--text2); }
.tarea-texto    { font-size: 12px; color: var(--text2); }
.chip-cola      { color: var(--amarillo); border-color: #eab30840; background: #eab30810; }

/* ── TIMER KPI ── */
.timer-kpi {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.timer-ok   { color: var(--text2); }
.timer-warn { color: var(--amarillo); font-weight: 700; }
.timer-crit { color: var(--rojo); font-weight: 700; }

/* ── DRAWER FLOTANTE ── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #00000050;
  z-index: 200;
}
.drawer-overlay.abierto { display: block; }

.drawer-panel {
  position: fixed;
  top: 57px;
  right: -440px;
  width: 420px;
  height: calc(100vh - 57px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transition: right 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.drawer-panel.abierto { right: 0; }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-header h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.drawer-close:hover { background: var(--surface2); color: var(--text); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.drawer-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* Cards dentro del drawer (Operativas) */
.drawer-unidad-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--verde);
}
.drawer-unidad-card .du-interno {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 3px;
}
.drawer-unidad-card .du-cat {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 4px;
}
.drawer-unidad-card .du-chofer {
  font-size: 11px;
  color: var(--text3);
}

/* Tabla dentro del drawer (Reparación) */
.drawer-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.drawer-table th {
  background: var(--surface2);
  padding: 8px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.drawer-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.drawer-table tr:last-child td { border-bottom: none; }
.drawer-table .obs-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  outline: none;
  font-family: inherit;
}
.drawer-table .obs-input:focus { border-color: var(--azul2); }

/* Cards dentro del drawer (En Ruta) */
.drawer-ruta-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-left: 3px solid var(--azul);
}
.drawer-ruta-card .dr-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}
.drawer-ruta-card .dr-sub {
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 10px;
}
.drawer-ruta-card .dr-sub span { color: var(--amarillo); }
.drawer-ruta-card .dr-acciones {
  display: flex;
  gap: 8px;
}

/* ── CARDS PEDIDOS REDISEÑADAS ── */
.pedido-card {
  cursor: default;
}
.pedido-card-body {
  display: flex;
  flex-direction: column;
}
.pedido-card-info { min-width: 0; }
.pedido-card-acciones {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}
.pedido-card-acciones .btn {
  white-space: nowrap;
  font-size: 12px;
}
.chip-pendientes {
  font-size: 10px;
  color: var(--azul2);
  background: #3b82f620;
  border: 1px solid #3b82f640;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.pedido-pas {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  font-family: monospace;
}

/* ── ALERT CONFIRMACIÓN WHATSAPP ── */
.alert-conf-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 400;
  align-items: flex-end;
}
.alert-confirmacion {
  position: relative;
  bottom: auto;
  right: auto;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 8px 32px #00000060;
  transition: border-color 0.3s;
}
.alert-confirmacion.sin-respuesta {
  border-color: var(--rojo);
  animation: pulseCrit 1.5s infinite;
}

.alert-conf-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.alert-conf-header .ac-icon { font-size: 18px; }
.alert-conf-header h4 { font-size: 13px; font-weight: 700; flex: 1; }
.ac-rec-badge {
  font-size: 10px;
  font-weight: 700;
  background: #ef444420;
  color: var(--rojo);
  border: 1px solid #ef444440;
  border-radius: 5px;
  padding: 2px 6px;
}
#ac-cola-badge {
  font-size: 10px;
  font-weight: 700;
  background: #eab30825;
  color: var(--amarillo);
  border: 1px solid #eab30850;
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
}

.alert-conf-unidad {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 10px;
}

.alert-conf-timer {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--verde);
  margin-bottom: 4px;
  transition: color 0.3s;
}
.alert-conf-timer.warn { color: var(--amarillo); }
.alert-conf-timer.crit { color: var(--rojo); }

.alert-conf-status {
  font-size: 11px;
  color: var(--text2);
  text-align: center;
  margin-bottom: 12px;
}
.alert-conf-status.sin-resp { color: var(--rojo); font-weight: 700; }

.alert-conf-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.alert-conf-btns .btn { flex: 1; justify-content: center; font-size: 11px; }

/* ── TOAST NOTIFICACIONES ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 4px 20px #00000050;
  animation: toastIn 0.25s ease, toastOut 0.3s ease 2.7s forwards;
  white-space: nowrap;
}
.toast.toast-ok { border-color: #22c55e40; }
.toast.toast-err { border-color: #ef444440; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px); }
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .paneles { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .paneles { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 12px; }
  .header { padding: 10px 12px; }
  .form-row { grid-template-columns: 1fr; }
  .pedidos-grid { grid-template-columns: 1fr; }
  table { font-size: 12px; }
  td, th { padding: 8px 10px; }
  .drawer-panel { width: 100%; right: -100%; }
  .alert-conf-stack { right: 12px; left: 12px; align-items: stretch; }
  .alert-confirmacion { width: auto; }
}

/* ═══════════════════════════════════════════════════════
   VISUAL POLISH LAYER — Inter + Lucide + Depth & Motion
   ═══════════════════════════════════════════════════════ */

/* ── FONT ── */
body { font-family: 'Inter', 'Segoe UI', sans-serif; }

/* ── FONDO CON PROFUNDIDAD ── */
body {
  background-image:
    radial-gradient(ellipse at 12% 45%, #1e243880 0%, transparent 55%),
    radial-gradient(ellipse at 88% 8%,  #1a203060 0%, transparent 45%);
}

/* ── HEADER GLASS ── */
.header {
  box-shadow: 0 1px 0 var(--border), 0 4px 32px #00000055;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.header-logo .icon {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 2px 12px #3b82f650;
}
.header-logo .icon svg {
  width: 17px; height: 17px;
  color: #fff; stroke: #fff;
}

/* ── KPI CARDS — glow por tipo ── */
.panel-card {
  box-shadow: 0 1px 4px #00000050;
  transition: border-color 0.22s, transform 0.2s, box-shadow 0.28s;
}
.panel-card.p-operativas:hover  { box-shadow: 0 0 30px #22c55e22, 0 8px 32px #00000055; border-color: var(--verde); }
.panel-card.p-reparacion:hover  { box-shadow: 0 0 30px #ef444422, 0 8px 32px #00000055; border-color: var(--rojo); }
.panel-card.p-ruta:hover        { box-shadow: 0 0 30px #3b82f622, 0 8px 32px #00000055; border-color: var(--azul); }
.panel-card.p-pendientes:hover  { box-shadow: 0 0 30px #eab30822, 0 8px 32px #00000055; border-color: var(--amarillo); }
.panel-card.p-despachados:hover { box-shadow: 0 0 30px #6b728022, 0 8px 32px #00000055; border-color: var(--gris); }
.panel-card.p-operativas.activo  { box-shadow: 0 0 22px #22c55e30; }
.panel-card.p-reparacion.activo  { box-shadow: 0 0 22px #ef444430; }
.panel-card.p-ruta.activo        { box-shadow: 0 0 22px #3b82f630; }
.panel-card.p-pendientes.activo  { box-shadow: 0 0 22px #eab30830; }
.panel-card.p-despachados.activo { box-shadow: 0 0 22px #6b728030; }
.panel-count { letter-spacing: -0.02em; }

/* ── CARDS PEDIDOS — animación + hover por prioridad ── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pedido-card {
  animation: fadeInUp 0.26s ease backwards;
  box-shadow: 0 2px 8px #00000030;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.25s;
}
.pedido-card:hover { box-shadow: 0 10px 40px #00000060; transform: translateY(-3px); }
.pedido-card.pr-URGENTE:hover    { box-shadow: 0 10px 40px #ef444422; }
.pedido-card.pr-PRECAUCION:hover { box-shadow: 0 10px 40px #eab30822; }
.pedido-card.pr-NORMAL:hover     { box-shadow: 0 10px 40px #22c55e18; }

/* ── BOTONES PRINCIPALES ── */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 2px 14px #3b82f640;
  transition: box-shadow 0.2s, opacity 0.2s, transform 0.15s;
}
.btn-primary:hover { box-shadow: 0 4px 22px #3b82f658; opacity: 1; }
.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 2px 14px #ef444430;
  transition: box-shadow 0.2s, opacity 0.2s, transform 0.15s;
}
.btn-danger:hover { box-shadow: 0 4px 22px #ef444448; opacity: 1; }

/* ── TABLA — acento lateral en hover ── */
tbody tr { transition: background 0.12s, box-shadow 0.12s; }
tbody tr:hover { background: var(--surface2); box-shadow: inset 3px 0 0 var(--azul2); }

/* ── BADGES GLOW SUTIL ── */
.badge-EN-VIAJE   { box-shadow: 0 0 10px #60a5fa22; }
.badge-DISPONIBLE { box-shadow: 0 0 10px #22c55e22; }
.badge-REPARACION { box-shadow: 0 0 10px #ef444422; }

/* ── TAB ACTIVO ── */
.tab-btn { transition: color 0.2s, border-color 0.2s; }
.tab-btn.activo { text-shadow: 0 0 18px #60a5fa55; }

/* ── MODAL BACKDROP BLUR ── */
.modal-overlay.abierto {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.modal {
  box-shadow: 0 24px 80px #00000090;
  border-color: #3a4060;
}

/* ── DRAWER SOMBRA ── */
.drawer-panel { box-shadow: -8px 0 40px #00000060; }

/* ── ALERT CONFIRMACIÓN ── */
.alert-confirmacion {
  box-shadow: 0 12px 48px #00000070, 0 0 0 1px #3a4060;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── ICONOS LUCIDE EN UI ── */
.tab-icon { width: 15px; height: 15px; vertical-align: -3px; margin-right: 5px; }
.btn-icon { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
.modal-close { display: inline-flex; align-items: center; justify-content: center; }
.modal-close svg { width: 18px; height: 18px; }
.header-logo .icon { display: flex; align-items: center; justify-content: center; }

/* ── DRAWER CLOSE SVG ── */
.drawer-close svg { width: 16px; height: 16px; }

/* ══════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════ */
.login-screen {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(59,130,246,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(168,85,247,0.08) 0%, transparent 60%);
  align-items: center;
  justify-content: center;
}
.login-screen.visible {
  display: flex;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 44px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
  animation: fadeInUp 0.35s ease both;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--azul), var(--violeta));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(59,130,246,0.35);
}
.login-logo-icon svg { width: 28px; height: 28px; color: #fff; }
.login-logo h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.login-logo span {
  font-size: 12px;
  color: var(--text2);
}
.login-form .form-group {
  margin-bottom: 16px;
}
.login-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.login-pass-wrap {
  position: relative;
}
.login-pass-wrap .form-control {
  padding-right: 44px;
}
.login-toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text3);
  padding: 4px;
  line-height: 1;
}
.login-toggle-pass:hover { color: var(--text2); }
.login-error {
  font-size: 12px;
  color: var(--rojo);
  min-height: 18px;
  margin-bottom: 8px;
  font-weight: 500;
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  margin-top: 4px;
}
.login-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 11px;
  color: var(--text3);
}

/* ── HEADER USER ── */
.header-user {
  display: none;
  align-items: center;
  gap: 10px;
}
.header-user.visible {
  display: flex;
}
.header-user-nombre {
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
}
.btn-logout {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-logout:hover {
  background: var(--rojo);
  border-color: var(--rojo);
  color: #fff;
}

/* ══════════════════════════════════════════════
   LOG DE ACTIVIDAD
══════════════════════════════════════════════ */
.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 12px;
  margin-bottom: 8px;
}
.log-header h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.log-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 0.2s ease backwards;
}
.log-item:hover { background: var(--surface2); }
.log-hora {
  font-size: 12px;
  color: var(--text3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 36px;
}
.log-hora::before {
  content: '●';
  color: var(--azul);
  margin-right: 6px;
  font-size: 8px;
  vertical-align: 2px;
}
.log-texto {
  font-size: 13px;
  color: var(--text2);
}

/* ══════════════════════════════════════════════
   BANDEJA DE EMAILS
══════════════════════════════════════════════ */
.bandeja-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  height: calc(100vh - 200px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.bandeja-lista {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.email-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.email-item:hover { background: var(--surface2); }
.email-item.seleccionado { background: var(--surface2); border-left: 3px solid var(--azul); }
.email-item.no-leido .email-nombre { color: var(--text); font-weight: 600; }
.email-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.email-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--azul);
  flex-shrink: 0;
}
.email-dot.leido { background: transparent; }
.email-nombre {
  font-size: 13px;
  color: var(--text2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-hora {
  font-size: 11px;
  color: var(--text3);
  white-space: nowrap;
}
.email-asunto {
  font-size: 12px;
  color: var(--text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bandeja-detalle {
  overflow-y: auto;
  padding: 20px 24px;
}
.email-detalle-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.email-detalle-header strong { font-size: 14px; color: var(--text); }
.email-from { font-size: 12px; color: var(--text3); }
.email-asunto-full {
  font-size: 13px;
  color: var(--text2);
  margin: 6px 0 4px;
  line-height: 1.4;
}
.email-hora-full { font-size: 11px; color: var(--text3); }
.ia-block {
  background: #1e2d4020;
  border: 1px solid #3b82f630;
  border-left: 3px solid var(--azul);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.ia-block.ia-block-info {
  background: var(--surface2);
  border-color: var(--border);
  border-left-color: var(--text3);
}
.ia-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 12px;
  font-weight: 600;
}
.ia-badge {
  background: var(--azul);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.ia-badge.ia-badge-gris {
  background: var(--surface2);
  color: var(--text3);
  border: 1px solid var(--border);
}
.ia-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin-bottom: 14px;
}
.ia-grid div { display: flex; flex-direction: column; gap: 2px; }
.ia-grid label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.ia-grid span { font-size: 13px; color: var(--text); }
.ia-grid em { color: var(--amarillo); font-style: normal; }
.ia-acciones { display: flex; gap: 8px; }
.email-cuerpo {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
  white-space: pre-wrap;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}

/* ══════════════════════════════════════════════
   BANDEJA — BARRA ACCIONES EMAIL
══════════════════════════════════════════════ */
.email-acciones-bar {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.email-badge-estado {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  border-radius: 5px;
  padding: 2px 7px;
  margin-top: 4px;
}
.email-badge-estado.procesado {
  background: #22c55e20;
  color: var(--verde);
  border: 1px solid #22c55e40;
}
.email-badge-estado.rechazado {
  background: #ef444420;
  color: var(--rojo);
  border: 1px solid #ef444440;
}

/* ══════════════════════════════════════════════
   MODAL NUEVO PEDIDO — REFERENCIA EMAIL
══════════════════════════════════════════════ */
.np-ref-email {
  background: #1a2a1a;
  border: 1px solid #22c55e30;
  border-left: 3px solid var(--verde);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}
.np-ref-header {
  font-size: 12px;
  color: var(--text3);
  margin-bottom: 6px;
  font-weight: 600;
}
.np-ref-asunto {
  color: var(--text2);
  font-weight: 400;
}
.np-ref-cuerpo {
  font-size: 12px;
  color: var(--text2);
  max-height: 90px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
  background: var(--surface2);
  border-radius: 6px;
  padding: 8px 10px;
  margin-top: 4px;
}

/* ══════════════════════════════════════════════
   MODAL ASIGNACIÓN — UNIDADES BLOQUEADAS
══════════════════════════════════════════════ */
.unidad-bloqueada {
  opacity: 0.6;
  cursor: default;
}
.unidad-bloqueada:hover { background: transparent; }

/* ── PEDIDO SUSPENDIDO ── */
.card-suspendida {
  opacity: 0.75;
  border-left: 3px solid var(--rojo);
}
.badge-suspendido {
  background: #ef444420;
  border: 1px solid #ef444440;
  color: var(--rojo);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}
.btn-amarillo {
  background: #eab30820;
  border: 1px solid #eab30840;
  color: var(--amarillo);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-amarillo:hover { background: #eab30835; }

/* ── EN RUTA CARDS ── */
.en-ruta-card {
  border-left: 3px solid var(--verde);
}
.en-ruta-unidades {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.en-ruta-unidad {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff08;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
}
.en-ruta-unidad-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.badge-interno {
  background: #3b82f620;
  border: 1px solid #3b82f640;
  color: #60a5fa;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}
.en-ruta-chofer {
  color: var(--text2);
  font-size: 13px;
}

@media (max-width: 768px) {
  .bandeja-layout { grid-template-columns: 1fr; height: auto; }
  .bandeja-lista { border-right: none; border-bottom: 1px solid var(--border); max-height: 220px; }
  .ia-grid { grid-template-columns: 1fr; }
}
