/* ============================================================
   Altoke Delivery v2 — Frontend CSS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --atd-orange:  #FF5C1A;
  --atd-orange2: #FF8C42;
  --atd-dark:    #0F0F1A;
  --atd-dark2:   #181828;
  --atd-dark3:   #222236;
  --atd-card:    #1C1C30;
  --atd-border:  rgba(255,255,255,.08);
  --atd-text:    #F0F0F8;
  --atd-muted:   #8888AA;
  --atd-green:   #2ECC71;
  --atd-blue:    #3B9EFF;
  --atd-yellow:  #F7B731;
  --atd-red:     #E74C3C;
  --atd-fh:      'Syne', sans-serif;
  --atd-fb:      'DM Sans', sans-serif;
  --atd-radius:  14px;
}

/* ── Base ─────────────────────────────────────────────────── */
.atd-field { margin-bottom: 12px; }
.atd-field label {
  display: block; font-size: .72rem; font-weight: 600;
  color: var(--atd-muted); text-transform: uppercase;
  letter-spacing: .8px; margin-bottom: 5px; font-family: var(--atd-fh);
}
.atd-field input, .atd-field textarea, .atd-field select {
  width: 100%; padding: 10px 14px;
  background: var(--atd-dark3); border: 1.5px solid var(--atd-border);
  border-radius: 10px; color: var(--atd-text); font-family: var(--atd-fb);
  font-size: .9rem; outline: none; transition: border-color .15s;
  box-sizing: border-box;
}
.atd-field input:focus, .atd-field textarea:focus, .atd-field select:focus {
  border-color: var(--atd-orange);
}
.atd-field textarea { resize: vertical; }
.atd-btn-enviar {
  width: 100%; padding: 14px; background: linear-gradient(135deg,var(--atd-orange),var(--atd-orange2));
  border: none; border-radius: 12px; color: #fff; font-family: var(--atd-fh);
  font-size: .95rem; font-weight: 700; cursor: pointer; transition: opacity .15s;
  margin-top: 4px;
}
.atd-btn-enviar:disabled { opacity: .6; cursor: not-allowed; }
.atd-error {
  background: rgba(231,76,60,.12); border: 1px solid rgba(231,76,60,.3);
  color: #ff7f7f; border-radius: 8px; padding: 10px 14px;
  font-size: .85rem; margin-bottom: 10px;
}
.atd-sep { border: none; border-top: 1px solid var(--atd-border); margin: 18px 0; }
.atd-loading { color: var(--atd-muted); font-style: italic; padding: 12px 0; font-size: .88rem; }
.atd-aviso { font-family: var(--atd-fb); color: var(--atd-muted); padding: 12px; }
.atd-aviso a { color: var(--atd-orange); }

/* ── Vehículo selector ─────────────────────────────────────── */
.atd-vehiculo-grid {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 10px;
}
.atd-v-opt {
  background: var(--atd-dark3); border: 1.5px solid var(--atd-border);
  border-radius: 10px; padding: 10px 6px; text-align: center; cursor: pointer;
  transition: all .2s;
}
.atd-v-opt span { display: block; font-size: 1.4rem; }
.atd-v-opt small { font-size: .65rem; color: var(--atd-muted); }
.atd-v-opt.selected { border-color: var(--atd-orange); background: rgba(255,92,26,.1); }
.atd-v-opt.selected small { color: var(--atd-orange2); }

/* ── Confirmación ─────────────────────────────────────────── */
.atd-confirmacion { text-align: center; padding: 20px 0; }
.atd-confirm-check { font-size: 2.8rem; margin-bottom: 8px; }
.atd-confirmacion h3 { font-family: var(--atd-fh); font-size: 1.3rem; color: var(--atd-text); margin-bottom: 8px; }
.atd-codigo-box {
  background: var(--atd-dark); color: var(--atd-orange);
  font-family: var(--atd-fh); font-size: 1.8rem; font-weight: 800;
  letter-spacing: 4px; border-radius: 10px; padding: 14px; margin: 10px 0;
}
.atd-confirm-sub { color: var(--atd-muted); font-size: .82rem; }
.atd-btn-nueva {
  background: transparent; border: 2px solid var(--atd-orange); color: var(--atd-orange);
  padding: 10px 24px; border-radius: 8px; font-weight: 700;
  cursor: pointer; margin-top: 12px; font-family: var(--atd-fh);
}

/* ══════════════════════════════════════════════════════════════
   CLIENTE
══════════════════════════════════════════════════════════════ */
/* ══ BOTÓN FLOTANTE ════════════════════════════════════ */
.atd-fab-wrap {
  position: fixed;
  bottom: 24px; right: 20px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.atd-fab-label {
  background: #111827;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(8px);
  transition: all .25s;
  pointer-events: none;
}
.atd-fab-wrap:hover .atd-fab-label { opacity: 1; transform: translateX(0); }
.atd-fab-btn {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #16A34A, #22C55E);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(22,163,74,.4), 0 2px 8px rgba(0,0,0,.15);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: transform .2s, box-shadow .2s;
}
.atd-fab-btn:active { transform: scale(.93); }
.atd-fab-ping {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(34,197,94,.35);
  animation: atdFabPing 2s infinite;
}
@keyframes atdFabPing {
  0%   { transform: scale(1);   opacity: .8; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ══ OVERLAY + MODAL ════════════════════════════════════ */
.atd-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.atd-modal-box {
  background: #fff;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: atdSlideUp .35s cubic-bezier(.32,1.2,.64,1);
}
@keyframes atdSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.atd-modal-handle-wrap {
  padding: 10px 0 0;
  display: flex; justify-content: center;
  flex-shrink: 0;
  background: #fff;
}
.atd-modal-handle {
  width: 44px; height: 4px;
  background: #E5E7EB;
  border-radius: 4px;
}
.atd-modal-close {
  position: absolute; top: 12px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%; border: none;
  cursor: pointer; font-size: .85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.atd-mh { padding: 14px 20px 16px; position: relative; flex-shrink: 0; }
.atd-mh-green {
  background: linear-gradient(135deg, #16A34A, #22C55E);
}
.atd-mh-green .atd-modal-close { background: rgba(255,255,255,.2); color: #fff; }
.atd-mh-white {
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
}
.atd-mh-white .atd-modal-close { background: #F9FAFB; color: #6B7280; }
.atd-mh-titulo { font-weight: 800; font-size: 1.1rem; }
.atd-mh-green .atd-mh-titulo { color: #fff; }
.atd-mh-white .atd-mh-titulo { color: #111827; }
.atd-mh-sub { font-size: .8rem; margin-top: 3px; }
.atd-mh-green .atd-mh-sub { color: rgba(255,255,255,.8); }
.atd-mh-white .atd-mh-sub { color: #6B7280; }

.atd-modal-body {
  padding: 16px 16px 20px;
  scrollbar-width: thin;
  scrollbar-color: #E5E7EB transparent;
}

/* ══ TABS AUTH ══════════════════════════════════════════ */
.atd-auth-tabs {
  display: flex; background: #F9FAFB;
  border-radius: 12px; padding: 3px;
  margin: 12px 16px 0; flex-shrink: 0;
}
.atd-auth-tab {
  flex: 1; padding: 9px;
  border-radius: 10px; border: none;
  background: none; font-weight: 800; font-size: .8rem;
  color: #6B7280; cursor: pointer; transition: all .15s;
}
.atd-auth-tab.active {
  background: #fff; color: #16A34A;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ══ CAMPOS NUEVOS ══════════════════════════════════════ */
.atd-nf { margin-bottom: 13px; }
.atd-nf label {
  display: block; font-size: .72rem; font-weight: 700;
  color: #374151; margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .5px;
}
.atd-ni-wrap {
  display: flex;
  align-items: center;
  background: #F9FAFB;
  border: 1.5px solid #E5E7EB;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.atd-ni-wrap:focus-within {
  border-color: #16A34A;
  box-shadow: 0 0 0 3px rgba(22,163,74,.1);
  background: #fff;
}
.atd-ni-wrap input { padding-left: 4px; }
.atd-ni-icon {
  font-size: .9rem;
  color: #9CA3AF;
  pointer-events: none;
  padding: 0 8px 0 12px;
  flex-shrink: 0;
  line-height: 1;
}
.atd-ni-wrap input {
  flex: 1; padding: 11px 14px 11px 0;
  background: none; border: none;
  font-family: inherit; font-size: .9rem;
  color: #111827; outline: none;
}
.atd-nf textarea,
.atd-nf select {
  width: 100%; padding: 11px 14px;
  background: #F9FAFB; border: 1.5px solid #E5E7EB;
  border-radius: 12px; font-family: inherit;
  font-size: .9rem; color: #111827; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  resize: none;
}
.atd-nf textarea:focus { border-color: #16A34A; background: #fff; box-shadow: 0 0 0 3px rgba(22,163,74,.1); }
.atd-nf-hint { font-size: .72rem; color: #9CA3AF; margin-top: 4px; }
.atd-link { color: #16A34A; text-decoration: none; }

/* ══ BOTONES NUEVOS ═════════════════════════════════════ */
.atd-nbtn {
  width: 100%; padding: 13px; border-radius: 14px; border: none;
  font-weight: 800; font-size: .9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s; margin-bottom: 10px;
}
.atd-nbtn:active { transform: scale(.98); }
.atd-nbtn-green {
  background: linear-gradient(135deg, #16A34A, #22C55E);
  position: sticky; bottom: 0; z-index: 10;
  color: #fff; box-shadow: 0 4px 16px rgba(22,163,74,.25);
}
.atd-nbtn-outline {
  background: #fff; color: #374151;
  border: 1.5px solid #E5E7EB;
}
.atd-nbtn-ghost {
  background: none; color: #6B7280;
  font-weight: 600; font-size: .85rem;
  padding: 10px; box-shadow: none;
}

/* ══ DIVIDER ════════════════════════════════════════════ */
.atd-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0; color: #9CA3AF; font-size: .75rem;
}
.atd-divider::before, .atd-divider::after {
  content: ''; flex: 1; height: 1px; background: #E5E7EB;
}

/* ══ BANNER INVITADO ════════════════════════════════════ */
.atd-guest-banner {
  background: #F9FAFB; border: 1.5px dashed #E5E7EB;
  border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.atd-guest-title { font-weight: 800; font-size: .85rem; color: #111827; margin-bottom: 4px; }
.atd-guest-sub   { font-size: .75rem; color: #6B7280; margin-bottom: 10px; }
.atd-guest-benefits { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.atd-benefit { font-size: .75rem; color: #374151; display: flex; align-items: center; gap: 6px; }

/* ══ BIENVENIDA USUARIO ═════════════════════════════════ */
.atd-user-welcome {
  display: flex; align-items: center; gap: 10px;
  background: #F0FDF4; border: 1px solid #DCFCE7;
  border-radius: 12px; padding: 10px 14px; margin-bottom: 12px;
}
.atd-user-av {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #16A34A, #22C55E);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem; color: #fff; flex-shrink: 0;
}
.atd-user-name  { font-weight: 700; font-size: .88rem; color: #111827; }
.atd-user-email { font-size: .72rem; color: #6B7280; }
.atd-user-logout {
  background: none; border: none; color: #6B7280;
  font-size: .72rem; cursor: pointer; margin-left: auto;
  text-decoration: underline;
}

/* ══ ACCESO RÁPIDO ══════════════════════════════════════ */
.atd-acceso-rapido {
  background: #F0FDF4; border: 1px solid #DCFCE7;
  border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; margin-bottom: 14px; font-size: .82rem;
  font-weight: 600; color: #16A34A; transition: background .15s;
}
.atd-acceso-rapido:active { background: #DCFCE7; }
.atd-acceso-txt { flex: 1; }

/* ══ RUTA NUEVA ════════════════════════════════════════ */
.atd-nruta {
  background: #F9FAFB; border: 1.5px solid #E5E7EB;
  border-radius: 16px; padding: 12px 14px; margin-bottom: 13px;
}
.atd-nruta-label {
  font-size: .72rem; font-weight: 700; color: #374151;
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px;
}
.atd-nruta-item { display: flex; align-items: flex-start; gap: 12px; }
.atd-nruta-dot-col {
  display: flex; flex-direction: column; align-items: center;
  padding-top: 6px; flex-shrink: 0;
}
.atd-nruta-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.atd-dot-verde   { background: #16A34A; box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.atd-dot-naranja { background: #EA580C; box-shadow: 0 0 0 3px rgba(234,88,12,.15); }
.atd-nruta-line  { width: 2px; height: 18px; background: #E5E7EB; border-radius: 2px; margin: 4px 0; }
.atd-nruta-field { flex: 1; }
.atd-nruta-field label {
  display: block; font-size: .65rem; font-weight: 700;
  color: #9CA3AF; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px;
}
.atd-nruta-field textarea {
  width: 100%; padding: 8px 10px;
  background: #fff; border: 1.5px solid #E5E7EB;
  border-radius: 10px; font-family: inherit;
  font-size: .85rem; color: #111827; outline: none; resize: none;
  transition: border-color .15s, box-shadow .15s;
}
.atd-nruta-field textarea:focus { border-color: #16A34A; box-shadow: 0 0 0 3px rgba(22,163,74,.1); }

/* Dirs guardadas */
.atd-dir-guardadas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.atd-dir-chip {
  padding: 3px 10px; background: #F0FDF4;
  border: 1px solid #DCFCE7; border-radius: 20px;
  font-size: .7rem; font-weight: 600; color: #16A34A; cursor: pointer;
}

/* ══ MÉTODO PAGO NUEVO ══════════════════════════════════ */
.atd-nmetodo-btns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px;
}
.atd-nmetodo-btn {
  padding: 12px 8px; background: #F9FAFB;
  border: 2px solid #E5E7EB; border-radius: 12px;
  font-weight: 700; font-size: .85rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #374151; transition: all .15s;
}
.atd-nmetodo-icon { font-size: 1.3rem; }
.atd-nmetodo-btn.active { border-color: #16A34A; background: #F0FDF4; color: #16A34A; }

/* ══ PRECIO ════════════════════════════════════════════ */
.atd-nprecio {
  background: #FEF9C3; border: 1px solid #FEF08A;
  border-radius: 10px; padding: 10px 14px;
  margin-bottom: 13px; font-size: .84rem; color: #92400E;
}

/* ══ OK SCREENS ═════════════════════════════════════════ */
.atd-ok-wrap { text-align: center; padding: 8px 0 16px; }
.atd-ok-icono {
  width: 72px; height: 72px; background: #F0FDF4;
  border-radius: 50%; font-size: 2rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px; border: 3px solid #DCFCE7;
}
.atd-ok-titulo { font-weight: 800; font-size: 1.2rem; color: #111827; margin-bottom: 6px; }
.atd-ok-sub    { font-size: .84rem; color: #6B7280; margin-bottom: 18px; line-height: 1.5; }
.atd-ok-cod-label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: #6B7280; margin-bottom: 8px;
}
.atd-ok-cod {
  background: #F0FDF4; border: 2px dashed #16A34A;
  border-radius: 14px; padding: 14px 20px;
  font-weight: 800; font-size: 1.5rem; color: #16A34A;
  letter-spacing: 3px; margin-bottom: 6px; display: block;
}
.atd-ok-cod-hint { font-size: .72rem; color: #9CA3AF; margin-bottom: 18px; }

/* ══ RETENCIÓN INVITADO ═════════════════════════════════ */
.atd-retencion {
  background: linear-gradient(135deg, #1e3a5f, #1e4d7b);
  border-radius: 14px; padding: 16px; margin-bottom: 14px;
}
.atd-ret-titulo { font-weight: 800; font-size: .88rem; color: #fff; margin-bottom: 6px; }
.atd-ret-sub    { font-size: .76rem; color: rgba(255,255,255,.75); margin-bottom: 10px; line-height: 1.5; }
.atd-ret-items  { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.atd-ret-item   { font-size: .75rem; color: rgba(255,255,255,.9); display: flex; align-items: center; gap: 6px; }
.atd-ret-btn {
  width: 100%; padding: 10px; background: #fff;
  color: #1e3a5f; border: none; border-radius: 10px;
  font-weight: 800; font-size: .82rem; cursor: pointer;
}

/* ══ ACCESO RÁPIDO EXTERIOR ═════════════════════════════ */
.atd-seg-btn-rapido {
  width: 100%; padding: 12px;
  background: rgba(22,163,74,.1); color: #16A34A;
  border: 2px solid rgba(22,163,74,.2); border-radius: 12px;
  font-weight: 700; font-size: .9rem; cursor: pointer;
  margin-bottom: 12px;
}

.atd-perfil-wrap { max-width: 540px; margin: 0 auto; font-family: var(--atd-fb); }

.atd-perfil-header {
  background: var(--atd-dark2); border: 1px solid var(--atd-border);
  border-radius: var(--atd-radius); padding: 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.atd-perfil-avatar-wrap { position: relative; flex-shrink: 0; }
.atd-perfil-foto {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--atd-dark3); display: flex; align-items: center;
  justify-content: center; font-size: 2rem;
}
.atd-foto-placeholder { border: 2px solid var(--atd-border); }
.atd-foto-activo-dot {
  position: absolute; bottom: 2px; right: 2px;
  width: 12px; height: 12px; border-radius: 50%; background: #555;
  border: 2px solid var(--atd-dark2);
}
.atd-foto-activo-dot.online { background: var(--atd-green); box-shadow: 0 0 6px rgba(46,204,113,.6); }
.atd-perfil-headerinfo { flex: 1; }
.atd-perfil-headerinfo h2 { font-family: var(--atd-fh); font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; color: var(--atd-text); }
.atd-perfil-headerinfo p  { font-size: .8rem; color: var(--atd-muted); margin: 1px 0; }

/* Toggle */
.atd-toggle-wrap { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.atd-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.atd-switch input { opacity: 0; width: 0; height: 0; }
.atd-slider {
  position: absolute; inset: 0; background: #555;
  border-radius: 26px; cursor: pointer; transition: background .3s;
}
.atd-slider:before {
  content: ''; position: absolute; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; bottom: 4px; left: 4px;
  transition: transform .3s; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.atd-switch input:checked + .atd-slider { background: var(--atd-green); }
.atd-switch input:checked + .atd-slider:before { transform: translateX(24px); }
.atd-estado-lbl { font-size: .8rem; font-weight: 700; color: var(--atd-muted); }
.atd-estado-lbl.online { color: var(--atd-green); }

/* Tabs */
.atd-tabs { display: flex; border-bottom: 1px solid var(--atd-border); margin-bottom: 16px; gap: 0; }
.atd-tab {
  flex: 1; padding: 10px 8px; background: transparent; border: none;
  border-bottom: 2px solid transparent; font-family: var(--atd-fh);
  font-size: .72rem; font-weight: 700; letter-spacing: .5px;
  color: var(--atd-muted); cursor: pointer; transition: all .15s;
  text-transform: uppercase;
}
.atd-tab.active { color: var(--atd-orange); border-bottom-color: var(--atd-orange); }
.atd-tab-badge {
  display: inline-flex; width: 16px; height: 16px;
  background: var(--atd-orange); color: #fff; border-radius: 50%;
  font-size: .6rem; align-items: center; justify-content: center;
  margin-left: 4px; font-family: var(--atd-fb);
}
.atd-tab-content { display: none; }
.atd-tab-content.active { display: block; }

/* Tarjeta pedido cadete */
.atd-pedido-card {
  background: var(--atd-card); border: 1.5px solid var(--atd-border);
  border-radius: var(--atd-radius); padding: 14px; margin-bottom: 12px;
  transition: border-color .2s;
}
.atd-pedido-card.nuevo {
  border-color: var(--atd-orange); animation: atdPulse 1.2s ease 4;
}
.atd-pedido-card-cod { font-family: var(--atd-fh); font-size: .7rem; color: var(--atd-orange2); letter-spacing: 2px; margin-bottom: 3px; }
.atd-pedido-card h4 { font-size: .95rem; font-weight: 700; color: var(--atd-text); margin-bottom: 8px; }
.atd-pedido-card p  { font-size: .82rem; color: var(--atd-muted); margin: 3px 0; }
.atd-pedido-card-ruta { background: rgba(0,0,0,.2); border-radius: 10px; overflow: hidden; margin: 8px 0; }
.atd-pedido-ruta-item {
  padding: 8px 12px; display: flex; align-items: center; gap: 8px; font-size: .8rem;
}
.atd-pedido-ruta-item + .atd-pedido-ruta-item { border-top: 1px solid rgba(255,255,255,.04); }
.atd-pedido-ruta-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.atd-pedido-card-btns { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }

/* Botón WhatsApp cadete */
.atd-btn-wa {
  padding: 8px 12px; background: rgba(37,211,102,.15);
  border: 1px solid rgba(37,211,102,.3); border-radius: 8px;
  color: #25D366; font-weight: 700; font-size: .78rem;
  cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 5px; font-family: var(--atd-fb);
}
.atd-btn-camino {
  padding: 8px 12px; background: var(--atd-dark3); border: 1px solid var(--atd-border);
  border-radius: 8px; color: var(--atd-text); font-weight: 600;
  font-size: .78rem; cursor: pointer; font-family: var(--atd-fb);
}
.atd-btn-firma-card {
  padding: 8px 12px; background: linear-gradient(135deg,var(--atd-orange),var(--atd-orange2));
  border: none; border-radius: 8px; color: #fff; font-weight: 700;
  font-size: .78rem; cursor: pointer; font-family: var(--atd-fb);
}
.atd-btn-maps {
  padding: 8px 12px; background: rgba(59,158,255,.12);
  border: 1px solid rgba(59,158,255,.25); border-radius: 8px;
  color: var(--atd-blue); font-weight: 600; font-size: .78rem;
  cursor: pointer; font-family: var(--atd-fb); text-decoration: none;
  display: inline-flex; align-items: center; gap: 5px;
}

/* Historial */
.atd-historial-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
}
.atd-historial-titulo { font-family: var(--atd-fh); font-size: .75rem; font-weight: 700; color: var(--atd-muted); letter-spacing: 1.5px; text-transform: uppercase; }
.atd-historial-total { background: rgba(46,204,113,.1); border: 1px solid rgba(46,204,113,.2); color: var(--atd-green); border-radius: 20px; padding: 3px 12px; font-size: .78rem; font-weight: 700; font-family: var(--atd-fh); }
.atd-hist-item {
  background: var(--atd-card); border: 1px solid var(--atd-border);
  border-radius: 12px; padding: 11px 14px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.atd-hist-icon { width: 34px; height: 34px; background: rgba(46,204,113,.1); border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: .95rem; flex-shrink: 0; }
.atd-hist-info { flex: 1; }
.atd-hist-cod { font-size: .65rem; color: var(--atd-muted); letter-spacing: 1px; font-family: var(--atd-fh); }
.atd-hist-cliente { font-size: .84rem; font-weight: 600; margin: 2px 0; color: var(--atd-text); }
.atd-hist-destino { font-size: .72rem; color: var(--atd-muted); }
.atd-hist-fecha { font-size: .65rem; color: var(--atd-muted); text-align: right; }

/* Perfil editar */
.atd-perfil-edit-section {
  background: var(--atd-card); border: 1px solid var(--atd-border);
  border-radius: var(--atd-radius); padding: 16px; margin-bottom: 14px;
}
.atd-perfil-edit-section h4 { font-family: var(--atd-fh); font-size: .78rem; font-weight: 700; color: var(--atd-muted); letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 12px; }
.atd-foto-upload-wrap { display: flex; align-items: center; gap: 14px; }
.atd-foto-upload-prev {
  width: 60px; height: 60px; border-radius: 50%; background: var(--atd-dark3);
  border: 2px solid var(--atd-border); display: flex; align-items: center;
  justify-content: center; font-size: 1.8rem; overflow: hidden; flex-shrink: 0;
}
.atd-foto-upload-prev img { width: 100%; height: 100%; object-fit: cover; }
.atd-foto-btn {
  background: var(--atd-dark3); border: 1px solid var(--atd-border);
  border-radius: 8px; padding: 8px 14px; font-size: .8rem; font-weight: 600;
  color: var(--atd-text); cursor: pointer;
}

/* Ringtones */
.atd-rings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.atd-ring-item {
  background: var(--atd-dark3); border: 1.5px solid var(--atd-border);
  border-radius: 10px; padding: 10px 12px; display: flex;
  align-items: center; gap: 8px; cursor: pointer; transition: all .2s;
}
.atd-ring-item.selected { border-color: var(--atd-orange); background: rgba(255,92,26,.08); }
.atd-ring-play {
  width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.08);
  border: none; color: var(--atd-text); cursor: pointer; font-size: .8rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.atd-ring-item.selected .atd-ring-play { background: var(--atd-orange); }
.atd-ring-name { font-size: .8rem; font-weight: 700; color: var(--atd-text); }
.atd-ring-desc { font-size: .65rem; color: var(--atd-muted); }

/* Firma overlay */
/* ── Firma digital — pantalla completa ─────────────────────── */
.atd-firma-overlay {
  position: fixed; inset: 0; background: #fff; z-index: 99999;
  display: flex; flex-direction: column; overflow: hidden;
}
/* Cabecera firma */
.atd-firma-header {
  background: var(--atd-dark); padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.atd-firma-header h3 {
  font-family: var(--atd-fh); font-size: 1rem; font-weight: 800;
  color: #fff; margin: 0; display: flex; align-items: center; gap: 8px;
}
.atd-firma-cod {
  font-size: .75rem; color: var(--atd-orange2);
  font-family: var(--atd-fh); letter-spacing: 2px; margin-top: 2px;
}
.atd-firma-header-right { text-align: right; }
/* Instrucción */
.atd-firma-instruccion-bar {
  background: #F8F8FA; border-bottom: 1px solid #E8E8EE;
  padding: 10px 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.atd-firma-instruccion-bar p { font-size: .88rem; color: #555; margin: 0; }
.atd-firma-limpiar-inline {
  background: #EEEEF5; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: .82rem; font-weight: 700;
  color: #555; cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
/* Canvas — ocupa todo el espacio disponible */
.atd-canvas-wrap {
  flex: 1; overflow: hidden;
  cursor: crosshair; touch-action: none;
  background: #FAFAFA; position: relative;
}
.atd-canvas-wrap::after {
  content: 'Firmar aquí';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #DDD; pointer-events: none;
  font-family: var(--atd-fh); letter-spacing: 1px;
}
.atd-canvas-wrap.has-firma::after { display: none; }
#atd-canvas-firma { display: block; width: 100%; height: 100%; }
/* Footer firma */
.atd-firma-footer {
  background: #fff; border-top: 1px solid #E8E8EE;
  padding: 14px 18px; display: flex; gap: 10px; flex-shrink: 0;
}
.atd-btn-cancelar-firma {
  background: #F0F0F5; color: #666; border: none; border-radius: 12px;
  padding: 14px 20px; font-weight: 700; cursor: pointer; font-size: .9rem;
  font-family: var(--atd-fh);
}
.atd-btn-confirmar-firma {
  flex: 1; background: linear-gradient(135deg,#2ECC71,#27AE60);
  color: #fff; border: none; border-radius: 12px;
  padding: 14px; font-weight: 800; cursor: pointer; font-size: 1rem;
  font-family: var(--atd-fh); box-shadow: 0 4px 14px rgba(46,204,113,.35);
}
.atd-btn-confirmar-firma:disabled { opacity: .6; cursor: not-allowed; }
/* Compat — ocultar elementos viejos que ya no se usan */
.atd-firma-box { display: contents; }
.atd-firma-btns { display: none; }
.atd-btn-limpiar-firma { display: none; }

/* Estado avisos */
.atd-estado-aviso {
  text-align: center; padding: 40px 20px; border-radius: var(--atd-radius);
  background: var(--atd-card); max-width: 400px; margin: 0 auto;
}
.atd-aviso-icon { font-size: 3rem; display: block; margin-bottom: 10px; }
.atd-estado-aviso h3 { font-family: var(--atd-fh); font-size: 1.2rem; color: var(--atd-text); margin-bottom: 6px; }
.atd-estado-aviso p  { color: var(--atd-muted); font-size: .88rem; }

/* ══════════════════════════════════════════════════════════════
   PANEL DESPACHO
══════════════════════════════════════════════════════════════ */
.atd-despacho-app {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
  font-family: var(--atd-fb);
  background: var(--atd-dark);
  color: var(--atd-text);
}
/* Si está dentro de WP body, ocupar viewport */
body.page-template-default .atd-despacho-app,
.entry-content .atd-despacho-app {
  position: fixed; inset: 0; z-index: 9000;
  margin: 0; padding: 0;
}
/* Compensar adminbar WP cuando está logueado */
body.admin-bar .atd-despacho-app {
  top: 32px;
  height: calc(100vh - 32px);
}
@media screen and (max-width:782px) {
  body.admin-bar .atd-despacho-app { top: 46px; height: calc(100vh - 46px); }
}

/* Topbar despacho */
.atd-dp-topbar {
  display: flex; align-items: center; gap: 12px;
  background: var(--atd-dark2); border-bottom: 1px solid var(--atd-border);
  padding: 0 16px; height: 52px; flex-shrink: 0; position: relative; z-index: 200;
}
.atd-dp-logo {
  font-family: var(--atd-fh); font-size: .95rem; font-weight: 800;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.atd-dp-badge {
  background: var(--atd-orange); color: #fff; font-size: .52rem;
  font-weight: 700; padding: 2px 7px; border-radius: 20px;
  letter-spacing: 1px; text-transform: uppercase;
}
.atd-dp-sidebar-toggle {
  background: var(--atd-dark3); border: 1px solid var(--atd-border);
  color: var(--atd-text); border-radius: 7px; padding: 5px 9px;
  cursor: pointer; font-size: .95rem; margin-left: 4px;
}
.atd-dp-topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* Notificaciones despacho */
.atd-dp-notif-wrap { position: relative; }
.atd-dp-notif-btn {
  background: var(--atd-dark3); border: 1px solid var(--atd-border);
  color: var(--atd-text); border-radius: 8px; padding: 6px 10px;
  cursor: pointer; font-size: .9rem; position: relative;
}
.atd-dp-notif-dot {
  width: 8px; height: 8px; background: var(--atd-orange); border-radius: 50%;
  position: absolute; top: 5px; right: 5px; border: 2px solid var(--atd-dark2);
  animation: atdBlink 1.5s ease-in-out infinite;
}
.atd-dp-notif-dropdown {
  position: absolute; top: 40px; right: 0; width: 300px;
  background: var(--atd-dark2); border: 1px solid var(--atd-border);
  border-radius: 14px; box-shadow: 0 16px 48px rgba(0,0,0,.5);
  z-index: 999; overflow: hidden;
}
.atd-dp-notif-header {
  padding: 12px 14px; border-bottom: 1px solid var(--atd-border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: .78rem;
}
.atd-dp-notif-header button {
  background: none; border: none; color: var(--atd-orange); cursor: pointer; font-size: .72rem;
}
.atd-dp-notif-item {
  padding: 10px 14px; display: flex; gap: 8px; border-bottom: 1px solid var(--atd-border);
  cursor: pointer; transition: background .15s;
}
.atd-dp-notif-item:hover { background: var(--atd-dark3); }
.atd-dp-notif-item.unread { background: rgba(255,92,26,.05); }
.atd-dp-notif-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.atd-dp-notif-msg  { font-size: .8rem; line-height: 1.3; }
.atd-dp-notif-time { font-size: .65rem; color: var(--atd-muted); margin-top: 2px; }
.atd-dp-notif-vacia { padding: 14px; color: var(--atd-muted); font-size: .82rem; text-align: center; }

.atd-dp-usuario { display: flex; align-items: center; gap: 7px; font-size: .82rem; }
.atd-dp-user-avatar {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg,var(--atd-orange),var(--atd-orange2));
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; font-family: var(--atd-fh);
}

/* Body despacho */
.atd-dp-body { display: flex; flex: 1; overflow: hidden; }

/* Sidebar despacho */
.atd-dp-sidebar {
  width: 210px; flex-shrink: 0; background: var(--atd-dark2);
  border-right: 1px solid var(--atd-border); padding: 14px 10px;
  overflow-y: auto; transition: width .25s, padding .25s;
}
.atd-dp-sidebar.collapsed { width: 0; padding: 0; overflow: hidden; }

.atd-dp-nav-section { margin-bottom: 20px; }
.atd-dp-nav-label {
  font-size: .58rem; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--atd-muted);
  padding: 0 8px; margin-bottom: 6px; font-family: var(--atd-fh);
}
.atd-dp-nav-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border-radius: 9px; cursor: pointer; font-size: .82rem; font-weight: 500;
  color: var(--atd-muted); transition: all .15s; margin-bottom: 2px;
  position: relative; white-space: nowrap;
}
.atd-dp-nav-item:hover { background: var(--atd-dark3); color: var(--atd-text); }
.atd-dp-nav-item.active {
  background: rgba(255,92,26,.1); color: var(--atd-text);
  border: 1px solid rgba(255,92,26,.2);
}
.atd-dp-nav-badge {
  margin-left: auto; background: var(--atd-orange); color: #fff;
  border-radius: 20px; font-size: .6rem; font-weight: 700; padding: 1px 6px;
}
.atd-dp-sc-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px;
  border-radius: 7px; font-size: .76rem; color: var(--atd-text); margin-bottom: 2px;
}
.atd-dp-sc-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.atd-dp-sc-dot.online  { background: var(--atd-green); box-shadow: 0 0 5px rgba(46,204,113,.6); }
.atd-dp-sc-dot.busy    { background: var(--atd-yellow); }
.atd-dp-sc-dot.offline { background: #444; }
.atd-dp-sc-info { flex: 1; }
.atd-dp-sc-nombre { font-size: .76rem; }
.atd-dp-sc-estado { font-size: .62rem; color: var(--atd-muted); }

/* Main despacho */
.atd-dp-main {
  flex: 1; overflow-y: auto; padding: 16px; display: flex;
  flex-direction: column; gap: 14px; min-width: 0;
}

/* Stats */
.atd-dp-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; flex-shrink: 0; }
.atd-dp-stat {
  background: var(--atd-card); border: 1px solid var(--atd-border);
  border-radius: 12px; padding: 12px 14px;
}
.atd-dp-stat-icon { font-size: 1.1rem; display: block; margin-bottom: 6px; }
.atd-dp-stat-val { font-family: var(--atd-fh); font-size: 1.5rem; font-weight: 800; line-height: 1; margin-bottom: 3px; }
.atd-dp-stat-lbl { font-size: .72rem; color: var(--atd-muted); }
#atd-st-pendiente .atd-dp-stat-val { color: var(--atd-yellow); }
#atd-st-camino    .atd-dp-stat-val { color: var(--atd-blue); }
#atd-st-entregado .atd-dp-stat-val { color: var(--atd-green); }
#atd-st-cobrar    .atd-dp-stat-val { color: var(--atd-orange2); }

/* Filtros */
.atd-dp-filtros { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.atd-dp-filtros select {
  background: var(--atd-card); border: 1px solid var(--atd-border);
  border-radius: 9px; padding: 7px 12px; color: var(--atd-text);
  font-family: var(--atd-fb); font-size: .82rem; outline: none;
}

/* Botones despacho */
.atd-dp-btn {
  padding: 7px 14px; background: var(--atd-dark3);
  border: 1px solid var(--atd-border); border-radius: 8px;
  color: var(--atd-text); font-size: .8rem; font-weight: 600;
  cursor: pointer; font-family: var(--atd-fb); transition: background .15s;
  white-space: nowrap;
}
.atd-dp-btn:hover { background: var(--atd-card); }
.atd-dp-btn:disabled { opacity: .5; cursor: not-allowed; }
.atd-dp-btn-primary {
  background: linear-gradient(135deg,var(--atd-orange),var(--atd-orange2));
  border-color: transparent; color: #fff;
}
.atd-dp-btn-primary:hover { opacity: .9; }
.atd-dp-btn-full { width: 100%; padding: 13px; font-size: .9rem; }

/* Tab content */
.atd-dp-tab-content { display: none; }
.atd-dp-tab-content.active { display: flex; gap: 14px; }
#atd-dptab-viajes.active,
#atd-dptab-pagados.active,
#atd-dptab-cadetes.active,
#atd-dptab-nuevo-cadete.active { display: block; }

/* Panel */
.atd-dp-panel {
  background: var(--atd-card); border: 1px solid var(--atd-border);
  border-radius: 16px; overflow: hidden; flex: 1; min-width: 0;
}
.atd-dp-panel-head {
  padding: 12px 16px; border-bottom: 1px solid var(--atd-border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.atd-dp-panel-title { font-family: var(--atd-fh); font-size: .85rem; font-weight: 700; }
.atd-dp-filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.atd-dp-chip {
  padding: 4px 12px; border-radius: 20px; font-size: .7rem; font-weight: 600;
  cursor: pointer; border: 1px solid var(--atd-border); color: var(--atd-muted);
  font-family: var(--atd-fh); transition: all .15s; white-space: nowrap;
}
.atd-dp-chip.active {
  background: rgba(255,92,26,.12); border-color: rgba(255,92,26,.3); color: var(--atd-orange2);
}

/* Tabla despacho */
.atd-dp-tabla-wrap { overflow-x: auto; }
.atd-dp-tabla { width: 100%; border-collapse: collapse; }
.atd-dp-tabla th {
  padding: 9px 14px; font-size: .62rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--atd-muted); text-align: left;
  border-bottom: 1px solid var(--atd-border); font-family: var(--atd-fh); white-space: nowrap;
}
.atd-dp-tabla td {
  padding: 10px 14px; font-size: .8rem; border-bottom: 1px solid var(--atd-border);
  vertical-align: middle;
}
.atd-dp-tabla tr { cursor: pointer; transition: background .1s; }
.atd-dp-tabla tr:hover td { background: rgba(255,255,255,.02); }
.atd-dp-tabla tr:last-child td { border-bottom: none; }
.atd-dp-tabla tr.row-sel td { background: rgba(255,92,26,.05); }

/* Badges tabla */
.atd-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: .65rem;
  font-weight: 700; font-family: var(--atd-fh); white-space: nowrap;
}
.atd-badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.atd-badge.pendiente { background:rgba(247,183,49,.12); border:1px solid rgba(247,183,49,.25); color:var(--atd-yellow); }
.atd-badge.asignado  { background:rgba(59,158,255,.12);  border:1px solid rgba(59,158,255,.25);  color:var(--atd-blue); }
.atd-badge.en_camino { background:rgba(46,204,113,.12);  border:1px solid rgba(46,204,113,.25);  color:var(--atd-green); }
.atd-badge.entregado { background:rgba(46,204,113,.08);  border:1px solid rgba(46,204,113,.15);  color:#5dbb8a; }
.atd-badge.cancelado { background:rgba(231,76,60,.1);    border:1px solid rgba(231,76,60,.2);    color:var(--atd-red); }
.atd-badge.pagado    { background:rgba(46,204,113,.1);   border:1px solid rgba(46,204,113,.2);   color:var(--atd-green); }
.atd-badge.porcobrar { background:rgba(247,183,49,.1);   border:1px solid rgba(247,183,49,.2);   color:var(--atd-yellow); }
.atd-badge.activo    { background:rgba(46,204,113,.1);   border:1px solid rgba(46,204,113,.2);   color:var(--atd-green); }
.atd-badge.suspendido{ background:rgba(231,76,60,.1);    border:1px solid rgba(231,76,60,.2);    color:var(--atd-red); }

.atd-tbl-cod { font-family: var(--atd-fh); font-size: .7rem; color: var(--atd-orange2); letter-spacing: 1px; }
.atd-tbl-ruta { font-size: .75rem; color: var(--atd-muted); line-height: 1.5; }
.atd-tbl-ruta strong { color: var(--atd-text); font-weight: 500; }

.atd-tbl-btn {
  padding: 4px 10px; border-radius: 6px; border: 1px solid var(--atd-border);
  background: var(--atd-dark3); color: var(--atd-text); font-size: .72rem;
  font-weight: 600; cursor: pointer; margin-right: 4px; margin-bottom: 2px;
  font-family: var(--atd-fb); white-space: nowrap; transition: background .15s;
}
.atd-tbl-btn:hover { background: rgba(255,255,255,.06); }
.atd-tbl-btn.asignar   { background:rgba(255,92,26,.1);   border-color:rgba(255,92,26,.25);   color:var(--atd-orange2); }
.atd-tbl-btn.cancelar  { background:rgba(231,76,60,.08);  border-color:rgba(231,76,60,.2);    color:var(--atd-red); }
.atd-tbl-btn.firma     { background:rgba(59,158,255,.08); border-color:rgba(59,158,255,.2);   color:var(--atd-blue); }
.atd-tbl-btn.aprobar   { background:rgba(46,204,113,.1);  border-color:rgba(46,204,113,.25);  color:var(--atd-green); }
.atd-tbl-btn.suspender { background:rgba(247,183,49,.1);  border-color:rgba(247,183,49,.25);  color:var(--atd-yellow); }
.atd-tbl-btn.pago      { background:rgba(46,204,113,.1);  border-color:rgba(46,204,113,.25);  color:var(--atd-green); }
.atd-tbl-btn.wa        { background:rgba(37,211,102,.1);  border-color:rgba(37,211,102,.25);  color:#25D366; }

/* Panel asignación */
.atd-dp-assign-panel {
  width: 300px; flex-shrink: 0; background: var(--atd-card);
  border: 1.5px solid rgba(255,92,26,.25); border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
}
.atd-dp-assign-head {
  background: linear-gradient(135deg,rgba(255,92,26,.15),rgba(255,140,66,.08));
  padding: 11px 14px; border-bottom: 1px solid rgba(255,92,26,.15);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--atd-fh); font-size: .82rem; font-weight: 700;
}
.atd-dp-assign-head button { background: none; border: none; color: var(--atd-muted); cursor: pointer; font-size: 1rem; }
.atd-dp-assign-info { padding: 10px 14px; border-bottom: 1px solid var(--atd-border); font-size: .8rem; }
.atd-dp-assign-cadetes-title {
  padding: 8px 14px 4px; font-size: .62rem; font-weight: 700;
  letter-spacing: 2px; text-transform: uppercase; color: var(--atd-muted); font-family: var(--atd-fh);
}
.atd-dp-assign-cadetes-list { flex: 1; overflow-y: auto; padding: 4px 10px; }
.atd-dp-cadete-opt {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  background: var(--atd-dark3); border: 1.5px solid var(--atd-border);
  border-radius: 10px; margin-bottom: 7px; cursor: pointer; transition: all .2s;
}
.atd-dp-cadete-opt:hover { border-color: rgba(255,92,26,.3); }
.atd-dp-cadete-opt.selected { border-color: var(--atd-orange); background: rgba(255,92,26,.08); }
.atd-dp-copt-av {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg,var(--atd-orange),var(--atd-orange2));
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; font-family: var(--atd-fh); flex-shrink: 0;
}
.atd-dp-copt-info { flex: 1; }
.atd-dp-copt-nombre { font-size: .8rem; font-weight: 600; }
.atd-dp-copt-detail { font-size: .65rem; color: var(--atd-muted); }
.atd-dp-copt-status { font-size: .62rem; font-weight: 700; font-family: var(--atd-fh); display: flex; align-items: center; gap: 4px; }
.atd-dp-copt-status.libre   { color: var(--atd-green); }
.atd-dp-copt-status.ocupado { color: var(--atd-yellow); }
.atd-dp-copt-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.atd-dp-copt-radio { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--atd-border); flex-shrink: 0; transition: all .2s; }
.atd-dp-cadete-opt.selected .atd-dp-copt-radio { border-color: var(--atd-orange); background: var(--atd-orange); }

.atd-dp-assign-footer { padding: 10px 12px; border-top: 1px solid var(--atd-border); display: flex; gap: 7px; }
.atd-dp-assign-footer button { flex: 1; padding: 9px; }

/* Form despacho */
.atd-dp-form-panel { max-width: 680px; }
.atd-dp-form-body { padding: 16px; }
.atd-dp-form-section { background: var(--atd-dark3); border: 1px solid var(--atd-border); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.atd-dp-form-section h4 { font-size: .68rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--atd-muted); font-family: var(--atd-fh); margin-bottom: 12px; }
.atd-dp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.atd-dp-foto-area { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.atd-dp-foto-prev { width: 64px; height: 64px; border-radius: 50%; background: var(--atd-dark2); border: 2px dashed var(--atd-border); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; overflow: hidden; flex-shrink: 0; }
.atd-dp-foto-prev img { width: 100%; height: 100%; object-fit: cover; }
.atd-dp-form-note { font-size: .7rem; color: var(--atd-muted); font-style: italic; }
.atd-dp-cred-nota { background: rgba(59,158,255,.08); border: 1px solid rgba(59,158,255,.2); border-radius: 9px; padding: 10px 12px; font-size: .78rem; color: #7fbfff; margin-bottom: 10px; line-height: 1.5; }
.atd-dp-success { background: rgba(46,204,113,.1); border: 1px solid rgba(46,204,113,.25); color: var(--atd-green); border-radius: 8px; padding: 10px 14px; font-size: .85rem; margin-bottom: 10px; }

/* Modal firma despacho */
.atd-dp-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.atd-dp-modal-box { background: var(--atd-dark2); border: 1px solid var(--atd-border); border-radius: 16px; max-width: 440px; width: 100%; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.atd-dp-modal-head { padding: 14px 16px; border-bottom: 1px solid var(--atd-border); display: flex; justify-content: space-between; align-items: center; font-family: var(--atd-fh); font-size: .85rem; font-weight: 700; }
.atd-dp-modal-head button { background: none; border: none; color: var(--atd-muted); cursor: pointer; font-size: 1rem; }
#atd-dp-firma-img img { max-width: 100%; border-radius: 8px; border: 1px solid var(--atd-border); }

/* ── Animaciones ──────────────────────────────────────────── */
@keyframes atdFadeIn  { from{opacity:0;transform:scale(.97)} to{opacity:1;transform:scale(1)} }
@keyframes atdPulse   { 0%,100%{border-color:var(--atd-orange)} 50%{border-color:var(--atd-orange2)} }
@keyframes atdBlink   { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 600px) {
  .atd-dp-stats      { grid-template-columns: repeat(2,1fr); }
  .atd-dp-form-grid  { grid-template-columns: 1fr; }
  .atd-dp-tab-content.active { flex-direction: column; }
  .atd-dp-assign-panel { width: 100%; }
}

/* ══════════════════════════════════════════════════════════════
   PUSH NOTIFICATIONS — Banner y notifs in-page
══════════════════════════════════════════════════════════════ */

/* Banner de invitación */
.atd-push-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 99998;
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
  font-family: var(--atd-fb); font-size: .88rem;
  animation: atdSlideUp .3s ease;
}
.atd-push-invite   { background: var(--atd-dark2); border-top: 2px solid var(--atd-orange); }
.atd-push-bloqueado{ background: #2A2A3A; border-top: 2px solid var(--atd-muted); }

.atd-push-banner-icon { font-size: 1.5rem; flex-shrink: 0; }
.atd-push-banner-txt  { flex: 1; }
.atd-push-banner-txt strong { display: block; color: var(--atd-text); font-weight: 700; margin-bottom: 2px; }
.atd-push-banner-txt span   { color: var(--atd-muted); font-size: .8rem; }

.atd-push-btn-si {
  background: linear-gradient(135deg, var(--atd-orange), var(--atd-orange2));
  color: #fff; border: none; border-radius: 10px; padding: 10px 18px;
  font-weight: 700; font-size: .85rem; cursor: pointer; white-space: nowrap;
  font-family: var(--atd-fh);
}
.atd-push-btn-no {
  background: transparent; border: 1px solid var(--atd-border);
  color: var(--atd-muted); border-radius: 10px; padding: 10px 14px;
  font-size: .82rem; cursor: pointer; white-space: nowrap; font-family: var(--atd-fb);
}

/* Notificaciones in-page (toast) */
.atd-inpage-notif {
  position: fixed; top: 20px; right: 16px; z-index: 99997;
  padding: 13px 18px; border-radius: 14px; font-size: .88rem; font-weight: 600;
  box-shadow: 0 8px 28px rgba(0,0,0,.4); max-width: 320px;
  transform: translateX(120%); transition: transform .3s ease;
  font-family: var(--atd-fb); line-height: 1.4;
}
.atd-inpage-notif.visible { transform: translateX(0); }
.atd-inpage-info    { background: var(--atd-dark2); color: var(--atd-text); border: 1px solid var(--atd-border); }
.atd-inpage-success { background: rgba(46,204,113,.15); color: #5debb7; border: 1px solid rgba(46,204,113,.3); }
.atd-inpage-warning { background: rgba(247,183,49,.12); color: var(--atd-yellow); border: 1px solid rgba(247,183,49,.25); }

@keyframes atdSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* En panel despacho el toast va abajo-derecha */
.atd-despacho-app .atd-inpage-notif { top: auto; bottom: 20px; }

/* ── Mercado Pago info block ─────────────────────────── */
.atd-mp-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: #f0f7ff;
    border: 1px solid #c3daf9;
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 0 8px;
    font-size: 15px;
    color: #1a3c6e;
    text-align: center;
}
.atd-mp-icon {
    font-size: 22px;
    margin-bottom: 2px;
}
.atd-mp-sub {
    font-size: 12px;
    color: #5580aa;
    margin-top: 2px;
}

/* ── OneSignal banner de permiso push ───────────────────── */
.atd-push-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a1a2e;
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 14px;
    font-size: 14px;
    flex-wrap: wrap;
}
.atd-push-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.atd-push-banner span:nth-child(2) {
    flex: 1;
    min-width: 150px;
}
.atd-push-btn {
    background: #4f8ef7;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.atd-push-btn:hover { background: #3a7de0; }
.atd-push-cerrar {
    background: transparent;
    color: #aaa;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}

/* ── Método de pago selector (cliente) ─────────────────── */
.atd-metodo-pago-wrap { margin-bottom: 14px; }
.atd-metodo-pago-btns { display: flex; gap: 10px; margin-top: 6px; }
.atd-metodo-btn {
  flex: 1;
  padding: 10px 8px;
  border: 2px solid var(--atd-border, #e0e0e0);
  border-radius: 10px;
  background: #fff;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.atd-metodo-btn.active {
  border-color: var(--atd-green, #22c55e);
  background: rgba(34,197,94,.08);
  color: var(--atd-green, #16a34a);
}

/* ── Badge método pago en card cadete ───────────────────── */
.atd-metodo-badge {
  font-size: .82rem;
  font-weight: 600;
  color: var(--atd-muted, #888);
  margin: 2px 0 6px;
}

/* ── Panel QR ──────────────────────────────────────────── */
.atd-qr-overlay { background: #0f172a; }
.atd-qr-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 20px;
}
.atd-qr-imagen {
  max-width: min(320px, 90vw);
  max-height: 50vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 4px 30px rgba(0,0,0,.5);
  background: #fff;
  padding: 12px;
}
.atd-qr-instruccion {
  color: rgba(255,255,255,.75);
  font-size: .95rem;
  text-align: center;
  max-width: 300px;
}

/* ── Card meta: método, precio, tiempo ─────────────────── */
.atd-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
  align-items: center;
}
.atd-metodo-badge,
.atd-precio-badge,
.atd-tiempo-badge {
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.atd-metodo-badge {
  background: rgba(34,197,94,.12);
  color: #16a34a;
}
.atd-precio-badge {
  background: rgba(234,179,8,.15);
  color: #b45309;
}
.atd-tiempo-badge {
  background: rgba(99,102,241,.12);
  color: #4338ca;
  margin-left: auto;
}

/* ── Tab Historial ──────────────────────────────────────── */
.atd-hist-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 16px;
  background: var(--atd-surface, #f9fafb);
  border-radius: 12px;
  margin-bottom: 16px;
}
.atd-hist-filtro-grupo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--atd-muted, #888);
}
.atd-hist-filtro-grupo input,
.atd-hist-filtro-grupo select {
  padding: 8px 10px;
  border: 1px solid var(--atd-border, #e0e0e0);
  border-radius: 8px;
  font-size: .9rem;
  background: #fff;
}
.atd-btn-primary {
  padding: 9px 18px;
  background: var(--atd-green, #22c55e);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-end;
}
.atd-btn-secondary {
  padding: 9px 18px;
  background: #fff;
  color: var(--atd-text, #1e293b);
  border: 1px solid var(--atd-border, #e0e0e0);
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-end;
}
.atd-hist-totales-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.atd-hist-total-card {
  flex: 1;
  min-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: var(--atd-surface, #f9fafb);
  border: 1px solid var(--atd-border, #e0e0e0);
  border-radius: 12px;
  gap: 4px;
}
.atd-hist-total-card.verde   { border-color: #22c55e; background: rgba(34,197,94,.06); }
.atd-hist-total-card.rojo    { border-color: #ef4444; background: rgba(239,68,68,.06); }
.atd-hist-total-card.amarillo{ border-color: #eab308; background: rgba(234,179,8,.06); }
.atd-hist-total-num {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--atd-text, #1e293b);
}
.atd-hist-total-label {
  font-size: .75rem;
  color: var(--atd-muted, #888);
  font-weight: 600;
}

/* ── Seguimiento ────────────────────────────────────────── */
.atd-seg-btn-rapido {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  background: rgba(99,102,241,.1);
  color: #4338ca;
  border: 2px solid rgba(99,102,241,.3);
  border-radius: 12px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
}
.atd-btn-ver-estado {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  background: rgba(99,102,241,.1);
  color: #4338ca;
  border: 2px solid rgba(99,102,241,.3);
  border-radius: 12px;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
}
.atd-seguimiento-wrap {
  padding: 16px;
}
.atd-seg-buscar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.atd-seg-buscar input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--atd-border, #e0e0e0);
  border-radius: 10px;
  font-size: .9rem;
  text-transform: uppercase;
}
.atd-seg-buscar button {
  padding: 10px 16px;
  background: var(--atd-green, #22c55e);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
.atd-seg-btn-volver {
  width: 100%;
  margin-top: 14px;
  padding: 10px;
  background: none;
  border: 1px solid var(--atd-border, #e0e0e0);
  border-radius: 10px;
  color: var(--atd-muted, #888);
  cursor: pointer;
  font-size: .9rem;
}
.atd-seg-card {
  background: var(--atd-surface, #f9fafb);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.atd-seg-estado {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
}
.atd-seg-estado-icon { font-size: 1.6rem; }
.atd-seg-codigo {
  font-size: .8rem;
  font-weight: 700;
  color: var(--atd-muted, #888);
  letter-spacing: .05em;
}
.atd-seg-ruta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--atd-border, #e0e0e0);
}
.atd-seg-ruta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
}
.atd-seg-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.atd-seg-dot.verde   { background: #22c55e; }
.atd-seg-dot.naranja { background: #f97316; }
.atd-seg-cadete,
.atd-seg-metodo,
.atd-seg-fecha {
  font-size: .85rem;
  color: var(--atd-muted, #888);
}
.atd-seg-btn-actualizar {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--atd-border, #e0e0e0);
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  font-size: .9rem;
}
.atd-seg-error {
  padding: 14px;
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 10px;
  color: #dc2626;
  font-size: .9rem;
  text-align: center;
}

.atd-seg-auto-info {
  font-size: .75rem;
  color: var(--atd-muted, #aaa);
  text-align: center;
  padding-top: 4px;
}

/* ── Precio envío cliente ───────────────────────────────── */
.atd-precio-envio-info {
  background: rgba(234,179,8,.1);
  border: 1px solid rgba(234,179,8,.3);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .9rem;
  color: #92400e;
  margin-bottom: 12px;
  text-align: center;
}

/* ── Panel Calificación ─────────────────────────────────── */
.atd-calif-overlay { background: #1e1b4b; }
.atd-calif-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 30px 20px;
}
.atd-calif-instruccion {
  color: rgba(255,255,255,.85);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
}
.atd-calif-estrellas {
  display: flex;
  gap: 12px;
}
.atd-calif-estrella {
  font-size: 2.8rem;
  background: none;
  border: none;
  color: rgba(255,255,255,.3);
  cursor: pointer;
  line-height: 1;
  transition: color .15s, transform .1s;
  padding: 0;
}
.atd-calif-estrella.activa,
.atd-calif-estrella:hover {
  color: #fbbf24;
  transform: scale(1.15);
}

/* Calificación en historial despacho */
.atd-calif-stars { color: #fbbf24; font-size: .85rem; }

/* ── Botón notas en tabla ───────────────────────────────── */
.atd-tbl-btn.notas {
  background: rgba(59,130,246,.1);
  color: #2563eb;
  border: 1px solid rgba(59,130,246,.25);
}

/* ── Cadete con límite lleno ────────────────────────────── */
.atd-cadete-lleno {
  opacity: .5;
  pointer-events: none;
}
.atd-dp-copt-status.lleno {
  color: #ef4444;
  font-weight: 700;
}
.atd-dp-copt-status.lleno .atd-dp-copt-dot {
  background: #ef4444;
}

/* ══════════════════════════════════════════════════════════════
   DESPACHO MÓVIL — responsive < 768px
   En desktop todo sigue igual (sidebar + tabla)
══════════════════════════════════════════════════════════════ */

/* Ocultar elementos móvil en desktop */
.atd-mob-cadetes-strip,
.atd-mob-nav,
.atd-mob-chips { display: none; }

@media (max-width: 768px) {

  /* ── Ocultar elementos desktop en móvil ── */
  .atd-dp-sidebar,
  .atd-dp-sidebar-toggle,
  .atd-dp-filtros { display: none !important; }

  /* ── App ocupa toda la pantalla ── */
  .atd-despacho-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }

  /* ── Topbar compacto ── */
  .atd-dp-topbar {
    padding: 0 12px;
    height: 48px;
    flex-shrink: 0;
  }
  .atd-dp-logo { font-size: .82rem; }
  .atd-dp-user-name { display: none; }

  /* ── Stats: 4 columnas compactas ── */
  .atd-dp-stats {
    grid-template-columns: repeat(4,1fr) !important;
    gap: 0 !important;
    border-bottom: 1px solid var(--atd-border);
    flex-shrink: 0;
  }
  .atd-dp-stat {
    border-right: 1px solid var(--atd-border);
    border-radius: 0 !important;
    padding: 8px 4px !important;
    text-align: center;
  }
  .atd-dp-stat:last-child { border-right: none; }
  .atd-dp-stat-icon { font-size: .85rem !important; }
  .atd-dp-stat-val  { font-size: 1rem !important; }
  .atd-dp-stat-lbl  { font-size: .55rem !important; }

  /* ── Strip cadetes activos ── */
  .atd-mob-cadetes-strip {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: var(--atd-dark2);
    border-bottom: 1px solid var(--atd-border);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
    gap: 10px;
  }
  .atd-mob-cadetes-strip::-webkit-scrollbar { display: none; }

  .atd-mob-cad-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
  }
  .atd-mob-cad-av {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--atd-dark3);
    border: 2px solid var(--atd-green);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--atd-fh); font-size: .68rem; font-weight: 800;
    color: var(--atd-text); position: relative;
  }
  .atd-mob-cad-dot {
    position: absolute; bottom: -1px; right: -1px;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--atd-muted);
    border: 1.5px solid var(--atd-dark2);
  }
  .atd-mob-cad-dot.online {
    background: var(--atd-green);
    box-shadow: 0 0 5px rgba(46,204,113,.5);
  }
  .atd-mob-cad-name {
    font-size: .62rem;
    color: var(--atd-muted);
    font-weight: 600;
    max-width: 40px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .atd-mob-cad-ped {
    font-size: .58rem;
    color: var(--atd-orange);
    font-weight: 700;
  }
  .atd-mob-cad-loading {
    font-size: .75rem;
    color: var(--atd-muted);
  }

  /* ── Nav tabs móvil ── */
  .atd-mob-nav {
    display: flex;
    background: var(--atd-dark2);
    border-bottom: 1px solid var(--atd-border);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
  }
  .atd-mob-nav::-webkit-scrollbar { display: none; }
  .atd-mob-tab {
    flex-shrink: 0;
    padding: 9px 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: var(--atd-fh);
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--atd-muted);
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color .15s;
  }
  .atd-mob-tab.active {
    color: var(--atd-orange);
    border-bottom-color: var(--atd-orange);
  }
  .atd-mob-tab-count {
    background: var(--atd-orange);
    color: #fff;
    font-size: .52rem;
    padding: 1px 5px;
    border-radius: 10px;
    font-family: var(--atd-fh);
  }

  /* ── Chips de filtro móvil ── */
  .atd-mob-chips {
    display: flex;
    padding: 8px 10px;
    background: var(--atd-dark2);
    border-bottom: 1px solid var(--atd-border);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
    gap: 6px;
  }
  .atd-mob-chips::-webkit-scrollbar { display: none; }
  .atd-mob-chip {
    flex-shrink: 0;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--atd-border);
    background: var(--atd-dark3);
    color: var(--atd-muted);
    white-space: nowrap;
    font-family: var(--atd-fb);
    transition: all .15s;
  }
  .atd-mob-chip.active {
    background: rgba(255,92,26,.15);
    border-color: rgba(255,92,26,.3);
    color: var(--atd-orange);
  }

  /* ── Body y main ── */
  .atd-dp-body {
    flex: 1;
    overflow: hidden;
    display: block !important;
  }
  .atd-dp-main {
    height: 100%;
    overflow-y: auto;
    padding: 10px !important;
    display: flex;
    flex-direction: column;
  }

  /* ── Stats arriba del main (ya están fuera en el panel) ── */
  .atd-dp-stats { flex-shrink: 0; }

  /* ── Tabla → Cards en móvil ── */
  .atd-dp-tabla-wrap table { display: none !important; }
  .atd-dp-tabla-wrap::before { content: ''; }

  /* ── Panel asignación full width ── */
  .atd-dp-assign-panel {
    width: 100% !important;
    position: fixed !important;
    bottom: 0; left: 0; right: 0;
    max-height: 70vh;
    border-radius: 20px 20px 0 0 !important;
    z-index: 500;
    overflow-y: auto;
  }

  /* ── Modales full width ── */
  .atd-dp-modal-box {
    width: calc(100vw - 24px) !important;
    max-width: 100% !important;
    margin: 0 12px;
    border-radius: 16px !important;
  }

  /* ── Historial filtros en grid 2 col ── */
  .atd-hist-filtros {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 10px !important;
  }
  .atd-hist-filtros .atd-btn-primary,
  .atd-hist-filtros .atd-btn-secondary {
    padding: 9px !important;
    font-size: .78rem !important;
  }

  /* ── Totales historial 4 col ── */
  .atd-hist-totales-row {
    display: grid !important;
    grid-template-columns: repeat(4,1fr) !important;
    gap: 0 !important;
    border-radius: 0 !important;
    margin-bottom: 8px !important;
  }
  .atd-hist-total-card {
    border-radius: 0 !important;
    padding: 8px 4px !important;
    border-right: 1px solid var(--atd-border) !important;
  }
  .atd-hist-total-num { font-size: 1.1rem !important; }
  .atd-hist-total-label { font-size: .55rem !important; }

  /* ── Tabla historial → lista ── */
  #atd-dp-tabla-historial table { font-size: .72rem; }
  #atd-dp-tabla-historial th:nth-child(3),
  #atd-dp-tabla-historial td:nth-child(3),
  #atd-dp-tabla-historial th:nth-child(4),
  #atd-dp-tabla-historial td:nth-child(4) { display: none; }

  /* ── Tabla pedidos: ocultar columnas menos importantes ── */
  #atd-dp-tabla-pedidos th:nth-child(4),
  #atd-dp-tabla-pedidos td:nth-child(4),
  #atd-dp-tabla-pedidos th:nth-child(6),
  #atd-dp-tabla-pedidos td:nth-child(6) { display: none; }
  #atd-dp-tabla-pedidos { font-size: .75rem; }
  .atd-tbl-ruta { font-size: .7rem; }
  .atd-tbl-btn { padding: 5px 8px !important; font-size: .68rem !important; }

  /* ── Formulario nuevo cadete ── */
  .atd-dp-form-grid { grid-template-columns: 1fr !important; }
}

/* ── Cards móvil despacho ───────────────────────────────── */
@media (max-width: 768px) {
  .atd-mob-cards { display: flex; flex-direction: column; gap: 10px; }

  .atd-mob-dp-card {
    background: var(--atd-card, #1A1A2E);
    border: 1px solid var(--atd-border);
    border-radius: 14px;
    overflow: hidden;
  }
  .atd-mob-dp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--atd-border);
  }
  .atd-mob-dp-cod {
    font-family: var(--atd-fh);
    font-size: .8rem;
    font-weight: 800;
    color: var(--atd-orange);
    letter-spacing: 1px;
  }
  .atd-mob-dp-hora {
    font-size: .68rem;
    color: var(--atd-muted);
    margin-top: 1px;
  }
  .atd-mob-dp-body { padding: 10px 12px; }

  .atd-mob-dp-client {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }
  .atd-mob-dp-name {
    font-weight: 700;
    font-size: .88rem;
    color: var(--atd-text);
  }
  .atd-mob-dp-tel {
    font-size: .72rem;
    color: var(--atd-muted);
    margin-top: 1px;
  }
  .atd-mob-wa-btn {
    background: rgba(37,211,102,.1);
    color: #25D366;
    border: 1px solid rgba(37,211,102,.2);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    flex-shrink: 0;
  }

  .atd-mob-dp-ruta {
    background: var(--atd-dark3);
    border-radius: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
  }
  .atd-mob-dp-ruta-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 3px 0;
  }
  .atd-mob-dp-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
  }
  .atd-mob-dp-dot.verde   { background: var(--atd-green); }
  .atd-mob-dp-dot.naranja { background: var(--atd-orange); }
  .atd-mob-dp-sep {
    width: 1px; height: 6px;
    background: var(--atd-border);
    margin-left: 3px;
  }
  .atd-mob-dp-rlbl {
    display: block;
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--atd-muted);
    font-family: var(--atd-fh);
  }
  .atd-mob-dp-rdir {
    font-size: .8rem;
    color: var(--atd-text);
  }
  .atd-mob-dp-cadete {
    font-size: .75rem;
    color: var(--atd-muted);
    margin-bottom: 8px;
  }
  .atd-mob-dp-motivo {
    font-size: .72rem;
    color: var(--atd-red);
    margin-bottom: 8px;
  }
  .atd-mob-dp-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .atd-mob-dp-actions .atd-tbl-btn {
    flex: 1;
    padding: 8px 6px !important;
    font-size: .72rem !important;
    border-radius: 9px !important;
    text-align: center;
    justify-content: center;
  }
  .atd-mob-dp-actions .atd-tbl-btn.asignar { flex: 2; }
  .atd-mob-dp-actions .atd-tbl-btn.firma    { flex: 2; }
}

/* ══ HISTORIAL CLIENTE ══════════════════════════════════ */
.atd-hcli-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s;
}
.atd-hcli-item:active { background: #F0FDF4; }
.atd-hcli-ico {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.atd-hcli-info { flex: 1; min-width: 0; }
.atd-hcli-cod {
  font-weight: 800; font-size: .78rem;
  color: #16A34A; letter-spacing: .8px; margin-bottom: 2px;
}
.atd-hcli-ruta {
  font-size: .8rem; color: #111827;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-bottom: 2px;
}
.atd-hcli-meta { font-size: .72rem; color: #6B7280; }
.atd-hcli-arrow { color: #9CA3AF; font-size: 1.1rem; flex-shrink: 0; }



/* ══ PANELES — flex column para que footer quede fijo ══ */
#atd-panel-auth,
#atd-panel-form,
#atd-panel-ok-logged,
#atd-panel-ok-guest,
#atd-panel-seguimiento,
#atd-panel-historial {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* El modal-body dentro de un panel ocupa el espacio restante */
#atd-panel-auth    > .atd-modal-body,
#atd-panel-form    > .atd-modal-body,
#atd-panel-ok-logged > .atd-modal-body,
#atd-panel-ok-guest  > .atd-modal-body,
#atd-panel-seguimiento > .atd-modal-body,
#atd-panel-historial > .atd-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  min-height: 0;
}

/* Las tabs de auth son parte del panel, no del body */
.atd-auth-tabs { flex-shrink: 0; }

/* ══ MODAL FOOTER FIJO (botón enviar) ══════════════════ */
.atd-modal-footer {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #E5E7EB;
  flex-shrink: 0;
}
.atd-modal-footer .atd-nbtn { margin-bottom: 0; }

/* ══ CHAT — compartido cadete y cliente ════════════════ */
.atd-chat-overlay { background: #0d1b2a; }

/* Panel chat cadete (overlay pantalla completa) */
.atd-chat-overlay .atd-firma-header { flex-shrink: 0; }
.atd-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.atd-chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,.05);
  border-top: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.atd-chat-input-wrap input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  color: #fff;
  font-size: .9rem;
  outline: none;
}
.atd-chat-input-wrap input::placeholder { color: rgba(255,255,255,.4); }
.atd-chat-input-wrap button {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--atd-green, #22c55e);
  color: #fff;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

/* Burbujas */
.atd-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 78%;
}
.atd-msg-propio { align-self: flex-end; align-items: flex-end; }
.atd-msg-otro   { align-self: flex-start; align-items: flex-start; }
.atd-chat-burbuja {
  padding: 8px 12px;
  border-radius: 14px;
  font-size: .85rem;
  line-height: 1.4;
  word-break: break-word;
}
.atd-msg-propio .atd-chat-burbuja {
  background: var(--atd-green, #22c55e);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.atd-msg-otro .atd-chat-burbuja {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-bottom-left-radius: 4px;
}
.atd-chat-hora {
  font-size: .62rem;
  color: rgba(255,255,255,.45);
  margin-top: 2px;
  padding: 0 4px;
}

/* Badge no leídos */
.atd-chat-badge {
  background: #ef4444;
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Chat dentro del panel seguimiento del cliente */
.atd-chat-wrap {
  background: #F9FAFB;
  border: 1.5px solid #E5E7EB;
  border-radius: 14px;
  overflow: hidden;
  margin-top: 14px;
}
.atd-chat-wrap .atd-chat-header {
  padding: 10px 14px;
  border-bottom: 1px solid #E5E7EB;
  font-weight: 700;
  font-size: .82rem;
  color: #374151;
  background: #fff;
  display: flex;
  align-items: center;
}
.atd-chat-wrap .atd-chat-msgs {
  max-height: 200px;
  padding: 10px 12px;
  background: #fff;
  flex: none;
}
.atd-chat-wrap .atd-msg-propio .atd-chat-burbuja {
  background: #16A34A;
}
.atd-chat-wrap .atd-msg-otro .atd-chat-burbuja {
  background: #E5E7EB;
  color: #111827;
}
.atd-chat-wrap .atd-chat-hora { color: #9CA3AF; }
.atd-chat-wrap .atd-chat-input-wrap {
  background: #F9FAFB;
  border-top: 1px solid #E5E7EB;
}
.atd-chat-wrap .atd-chat-input-wrap input {
  background: #fff;
  border: 1.5px solid #E5E7EB;
  color: #111827;
  border-radius: 20px;
}
.atd-chat-wrap .atd-chat-input-wrap input::placeholder { color: #9CA3AF; }

/* ── Checkbox recordar sesión ───────────────────────────── */
.atd-remember-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
}
.atd-remember-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #16A34A;
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ══ MAPA CLIENTE ═══════════════════════════════════════ */
.atd-mapa-wrap {
  margin-top: 12px;
  background: var(--bg, #F9FAFB);
  border: 1.5px solid var(--border, #E5E7EB);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 4px;
}
.atd-mapa-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border, #E5E7EB);
  font-size: .75rem;
}
.atd-mapa-titulo {
  flex: 1;
  font-weight: 700;
  color: var(--text2, #374151);
}
.atd-mapa-tiempo {
  font-size: .68rem;
  color: var(--muted, #9CA3AF);
}
.atd-mapa-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--green-bg, #F0FDF4);
  color: var(--green, #16A34A);
  border: 1px solid var(--green-mid, #DCFCE7);
  border-radius: 20px;
  padding: 2px 8px;
  font-size: .68rem;
  font-weight: 700;
  flex-shrink: 0;
}
.atd-live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green, #16A34A);
  animation: livePulse 1.5s infinite;
}
.atd-mapa-placeholder {
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted, #9CA3AF);
  font-size: .82rem;
}
.atd-mapa-placeholder-icon { font-size: 2rem; opacity: .5; }
.atd-mapa-footer {
  padding: 6px 12px;
  font-size: .65rem;
  color: var(--muted, #9CA3AF);
  text-align: center;
  background: #fff;
  border-top: 1px solid var(--border, #E5E7EB);
}

/* Mapa clickeable */
#atd-mapa-cliente {
  cursor: pointer;
}

/* Mapa en pantalla completa */
.atd-mapa-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 99999 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
.atd-mapa-fullscreen #atd-mapa-cliente {
  flex: 1 !important;
  height: auto !important;
}


/* ══ SEGUIMIENTO — HEADER VERDE ══════════════════════════ */
.atd-seg-header {
  background: linear-gradient(135deg, #16A34A, #22C55E);
  padding: 14px 20px 16px;
  flex-shrink: 0;
  position: relative;
}
.atd-seg-header-handle {
  width: 44px; height: 4px;
  background: rgba(255,255,255,.3);
  border-radius: 4px;
  margin: 0 auto 12px;
}
.atd-seg-header-close {
  position: absolute !important;
  top: 14px !important; right: 14px !important;
  width: 30px !important; height: 30px !important;
  background: rgba(255,255,255,.2) !important;
  border-radius: 50% !important;
  color: #fff !important;
  font-size: .85rem !important;
}
.atd-seg-header-titulo {
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}
.atd-seg-header-sub {
  font-size: .78rem;
  color: rgba(255,255,255,.85);
  margin-top: 2px;
}

/* ══ SEGUIMIENTO — BARRA DE PROGRESO ═════════════════════ */
.atd-seg-steps-wrap {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border, #E5E7EB);
  background: #fff;
}
.atd-seg-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.atd-seg-steps-track {
  position: absolute;
  top: 11px; left: 12px; right: 12px;
  height: 2px;
  background: var(--border, #E5E7EB);
  z-index: 0;
}
.atd-seg-steps-fill {
  height: 100%;
  background: #16A34A;
  width: 0%;
  border-radius: 2px;
  transition: width .4s ease;
}
.atd-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 1;
}
.atd-step-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .62rem;
  font-weight: 700;
  background: var(--border, #E5E7EB);
  color: #9CA3AF;
  transition: all .3s ease;
}
.atd-step.done .atd-step-dot {
  background: #16A34A;
  color: #fff;
}
.atd-step.active .atd-step-dot {
  background: #F0FDF4;
  border: 2px solid #16A34A;
  color: #16A34A;
}
.atd-step-lbl {
  font-size: .58rem;
  color: #9CA3AF;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.atd-step.done .atd-step-lbl,
.atd-step.active .atd-step-lbl {
  color: #16A34A;
}


/* ══ CALIFICACIÓN CON ESTRELLAS ══════════════════════════ */
.atd-seg-calific {
  margin-top: 14px;
  padding: 14px;
  background: #F0FDF4;
  border-radius: 12px;
  border: 1px solid #BBF7D0;
  text-align: center;
}
.atd-seg-calific-titulo {
  font-size: .82rem;
  font-weight: 700;
  color: #15803D;
  margin-bottom: 10px;
}
.atd-seg-estrellas {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.atd-estrella {
  font-size: 1.6rem;
  cursor: pointer;
  transition: transform .15s ease;
  user-select: none;
}
.atd-estrella:hover {
  transform: scale(1.2);
}
.atd-seg-calific-hecha {
  margin-top: 12px;
  padding: 10px;
  background: #F0FDF4;
  border-radius: 10px;
  font-size: .82rem;
  color: #15803D;
  font-weight: 600;
  text-align: center;
  border: 1px solid #BBF7D0;
}


/* ══ HISTORIAL DE ESTADOS ════════════════════════════════ */
.atd-estados-hist {
  margin-top: 12px;
  padding: 12px 14px;
  background: #F9FAFB;
  border-radius: 12px;
  border: 1px solid var(--border, #E5E7EB);
}
.atd-estados-titulo {
  font-size: .75rem;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 10px;
}
.atd-estado-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border, #E5E7EB);
  font-size: .8rem;
}
.atd-estado-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.atd-estado-item-label {
  color: #374151;
  font-weight: 600;
}
.atd-estado-item-hora {
  color: #9CA3AF;
  font-size: .72rem;
}


/* ══ COMPATIBILIDAD CON MENÚ INFERIOR SPYA ══════════════ */
/* Cuando el menú inferior está activo, los modales suben para no quedar tapados */
body.spya-has-nav .atd-modal-sheet {
  bottom: var(--spya-nav-h, 60px) !important;
  padding-bottom: env(safe-area-inset-bottom);
}
body.spya-has-nav #atd-overlay {
  bottom: var(--spya-nav-h, 60px) !important;
}
body.spya-has-nav .atd-fab-modal {
  bottom: var(--spya-nav-h, 60px) !important;
}


/* ══ OCULTAR BOTÓN EN PÁGINA DE CADETERÍA ═══════════════ */
/* Se oculta inmediatamente via CSS para evitar el parpadeo */
body[class*="solicitar-cadete"] #atd-btn-abrir,
.page-id-solicitar-cadete #atd-btn-abrir {
  display: none !important;
}
