/* ═══════════════════════════════════════════════════════════
   CRBOX — "Enviar paquetes juntos" grouping flow styles
   ═══════════════════════════════════════════════════════════ */

/* ── Modal overlays ──────────────────────────────────────── */
.ej-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
.ej-modal-overlay.ej-open {
  opacity: 1;
  pointer-events: auto;
}
.ej-modal {
  background: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 25px 60px -12px rgba(0,0,0,0.28);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(24px) scale(0.97);
  transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 250ms ease;
  opacity: 0;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}
.ej-modal-overlay.ej-open .ej-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.ej-modal-lg {
  max-width: 700px;
}
.ej-modal-sm {
  max-width: 400px;
}

/* Mobile: full-screen bottom sheet */
@media (max-width: 640px) {
  .ej-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .ej-modal {
    border-radius: 1.5rem 1.5rem 0 0;
    max-height: 92vh;
    max-width: 100%;
    transform: translateY(100%);
  }
  .ej-modal-overlay.ej-open .ej-modal {
    transform: translateY(0);
  }
}

/* ── Modal internals ─────────────────────────────────────── */
.ej-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}
.ej-modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
}
.ej-modal-close {
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  cursor: pointer;
  transition: background 150ms, color 150ms;
  background: transparent;
  border: none;
  flex-shrink: 0;
}
.ej-modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}
.ej-modal-body {
  padding: 1.25rem 1.5rem;
}
.ej-modal-footer {
  padding: 1rem 1.5rem 1.25rem;
  border-top: 1px solid #f3f4f6;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ── Form controls ───────────────────────────────────────── */
.ej-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}
.ej-input, .ej-textarea, .ej-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 0.625rem;
  font-size: 0.9375rem;
  color: #111827;
  background: #fff;
  transition: border-color 150ms, box-shadow 150ms;
  font-family: inherit;
  outline: none;
}
.ej-input:focus, .ej-textarea:focus, .ej-select:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.12);
}
.ej-textarea {
  min-height: 4.5rem;
  resize: vertical;
}
.ej-field-group {
  margin-bottom: 1rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.ej-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 0.625rem;
  padding: 0.5625rem 1.25rem;
  cursor: pointer;
  transition: all 180ms ease;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.ej-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}
.ej-btn-primary {
  background: #FF6B00;
  color: #fff;
  border-color: #FF6B00;
}
.ej-btn-primary:hover:not(:disabled) {
  background: #E05A00;
  border-color: #E05A00;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255,107,0,0.3);
}
.ej-btn-primary:active:not(:disabled) { transform: translateY(0); }
.ej-btn-purple {
  background: #7c3aed;
  color: #fff;
  border-color: #7c3aed;
}
.ej-btn-purple:hover:not(:disabled) {
  background: #6d28d9;
  border-color: #6d28d9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124,58,237,0.3);
}
.ej-btn-outline {
  background: #fff;
  color: #374151;
  border-color: #d1d5db;
}
.ej-btn-outline:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #9ca3af;
}
.ej-btn-danger-outline {
  background: transparent;
  color: #dc2626;
  border-color: #fca5a5;
  font-size: 0.8rem;
  padding: 0.375rem 0.875rem;
}
.ej-btn-danger-outline:hover:not(:disabled) {
  background: #fee2e2;
}
.ej-btn-ghost {
  background: transparent;
  color: #6b7280;
  border-color: transparent;
}
.ej-btn-ghost:hover:not(:disabled) {
  background: #f3f4f6;
  color: #374151;
}
.ej-btn-sm {
  font-size: 0.8125rem;
  padding: 0.4375rem 0.875rem;
  border-radius: 0.5rem;
}

/* Spinner inside button */
.ej-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ej-spin 0.6s linear infinite;
  display: none;
}
.ej-btn.ej-loading .ej-spinner { display: inline-block; }
.ej-btn.ej-loading .ej-btn-label { display: none; }
@keyframes ej-spin { to { transform: rotate(360deg); } }

/* ── Group section header ─────────────────────────────────── */
#enviar-juntos-section .ej-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
  background: linear-gradient(90deg, #faf5ff 0%, #fff 100%);
}
#enviar-juntos-section .ej-section-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
}
#enviar-juntos-section .ej-section-icon {
  width: 2.25rem;
  height: 2.25rem;
  background: #ede9fe;
  color: #7c3aed;
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Empty state ─────────────────────────────────────────── */
.ej-empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
}
.ej-empty-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  background: #ede9fe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7c3aed;
  font-size: 1.5rem;
}
.ej-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
}
.ej-empty-desc {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1.5rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* ── Empty state — how-it-works steps ───────────────────── */
.ej-how-steps {
  list-style: none;
  margin: 0 auto 1.75rem;
  padding: 0;
  max-width: 26rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.ej-how-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.ej-step-badge {
  flex-shrink: 0;
  width: 1.625rem;
  height: 1.625rem;
  background: #7c3aed;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
  margin-top: 0.125rem;
}
.ej-step-icon {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  background: #ede9fe;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7c3aed;
  font-size: 0.875rem;
  margin-top: 0.0625rem;
}
.ej-step-body {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.ej-step-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.4;
}
.ej-step-text {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.5;
}

/* Secondary CTA button variant */
.ej-btn.ej-btn-secondary {
  opacity: 0.85;
}
.ej-btn.ej-btn-secondary:hover {
  opacity: 1;
}

/* "No packages yet" note */
.ej-empty-no-pkgs {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.5;
  max-width: 26rem;
  margin-left: auto;
  margin-right: auto;
}
.ej-link {
  color: #7c3aed;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ej-link:hover {
  color: #6d28d9;
}

@media (max-width: 480px) {
  .ej-how-steps {
    max-width: 100%;
  }
  .ej-empty-no-pkgs {
    max-width: 100%;
  }
}

/* ── Group cards ─────────────────────────────────────────── */
.ej-group-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}
.ej-group-card {
  border: 1.5px solid #e9d5ff;
  border-radius: 1rem;
  background: #fff;
  overflow: hidden;
  transition: box-shadow 200ms, border-color 200ms;
}
.ej-group-card:hover {
  box-shadow: 0 4px 16px rgba(139,92,246,0.12);
  border-color: #c4b5fd;
}
.ej-group-card.ej-confirmed {
  border-color: #bfdbfe;
  background: #eff6ff;
}
.ej-group-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  gap: 0.5rem;
}
.ej-group-name {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.2rem;
}
.ej-group-meta {
  font-size: 0.78rem;
  color: #6b7280;
}
.ej-group-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.2rem 0.7rem;
  flex-shrink: 0;
}
.ej-status-waiting   { background: #eff6ff; color: #2563eb; }
.ej-status-prepare   { background: #fef3c7; color: #b45309; }
.ej-status-invoices  { background: #fff7ed; color: #c2410c; }
.ej-status-confirm   { background: #ede9fe; color: #7c3aed; }
.ej-status-sent      { background: #dcfce7; color: #16a34a; }
.ej-status-confirmed { background: #dbeafe; color: #1d4ed8; }
.ej-status-received  { background: #dcfce7; color: #15803d; }
.ej-status-closed    { background: #f3f4f6; color: #6b7280; }

/* ── Progress bar ────────────────────────────────────────── */
.ej-progress-wrap {
  padding: 0 1.25rem 0.75rem;
}
.ej-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: #4b5563;
  margin-bottom: 0.4rem;
}
.ej-progress-label strong { color: #0f172a; }
.ej-progress-track {
  height: 8px;
  border-radius: 9999px;
  background: #e9d5ff;
  overflow: hidden;
}
.ej-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #7c3aed, #a855f7);
  transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.ej-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: ej-pshine 1.8s infinite;
}
@keyframes ej-pshine {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.ej-progress-fill.ej-complete {
  background: linear-gradient(90deg, #059669, #10b981);
}
.ej-progress-fill.ej-almost {
  background: linear-gradient(90deg, #d97706, #f59e0b);
}
.ej-progress-checkmark {
  color: #10b981;
  font-size: 0.9rem;
}

/* ── Group actions bar ───────────────────────────────────── */
.ej-group-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0 1.25rem 1rem;
}

/* ── Packages-in-group list ──────────────────────────────── */
.ej-pkg-list {
  border-top: 1px solid #f3f4f6;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ej-pkg-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #faf5ff;
  border-radius: 0.625rem;
  border: 1px solid #e9d5ff;
  min-height: 48px;
}
.ej-pkg-row.ej-pkg-warn {
  background: #fffbeb;
  border-color: #fcd34d;
}
.ej-pkg-tracking {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ej-pkg-sub {
  font-size: 0.75rem;
  color: #6b7280;
}
.ej-pkg-remove {
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.375rem;
  transition: color 150ms, background 150ms;
  flex-shrink: 0;
}
.ej-pkg-remove:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* ── Quick-group banner ──────────────────────────────────── */
.ej-quick-group-banner {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #eff6ff 0%, #fefce8 100%);
  border: 1.5px solid #bfdbfe;
  border-radius: 0.875rem;
  margin: 1rem 1.25rem 0;
}
.ej-qgb-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: #dbeafe;
  color: #2563eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.ej-qgb-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.ej-qgb-text strong {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #1e40af;
  line-height: 1.3;
}
.ej-qgb-text span {
  font-size: 0.8125rem;
  color: #3b82f6;
}
@media (max-width: 480px) {
  .ej-quick-group-banner {
    flex-wrap: wrap;
    margin: 0.75rem 0.75rem 0;
  }
  .ej-quick-group-banner .ej-btn-quick-group {
    width: 100%;
    justify-content: center;
  }
}

/* ── Quick-create modal: package preview ─────────────────── */
.ej-qc-pkg-preview {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 200px;
  overflow-y: auto;
  padding: 0.625rem 0.75rem;
  background: #f5f3ff;
  border: 1.5px solid #e9d5ff;
  border-radius: 0.625rem;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}
.ej-qc-pkg-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
}
.ej-qc-carrier-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
}
.ej-qc-tracking {
  font-weight: 600;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ej-qc-pkg-count-note {
  font-size: 0.8125rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* ── Selector row (in package selector modal) ────────────── */
.ej-sel-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1.5px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
  min-height: 56px;
  user-select: none;
}
.ej-sel-row:hover {
  border-color: #a78bfa;
  background: #faf5ff;
}
.ej-sel-row.ej-selected {
  border-color: #FF6B00;
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(255,107,0,0.1);
}
.ej-sel-row.ej-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f9fafb;
}
.ej-sel-row.ej-disabled:hover {
  border-color: #e5e7eb;
  background: #f9fafb;
}
.ej-check-ring {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 150ms, background 150ms;
  color: transparent;
  font-size: 0.7rem;
}
.ej-sel-row.ej-selected .ej-check-ring {
  border-color: #FF6B00;
  background: #FF6B00;
  color: #fff;
}
.ej-sel-info {
  flex: 1;
  min-width: 0;
}
.ej-sel-tracking {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ej-sel-sub {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.1rem;
}
.ej-sel-lock {
  color: #9ca3af;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.ej-sel-date {
  font-size: 0.75rem;
  color: #6b7280;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}
.ej-carrier-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.5;
}
.ej-age-label {
  font-weight: 500;
  font-size: 0.7rem;
  margin-left: 0.3rem;
}
.ej-selector-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

/* ── Group summary card (invoice + summary modals) ───────── */
.ej-group-summary-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #f5f3ff;
  border: 1.5px solid #ddd6fe;
  border-radius: 0.875rem;
  overflow: hidden;
  margin-bottom: 1rem;
}
.ej-gsc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid #ede9fe;
  gap: 0.5rem;
}
.ej-gsc-row:last-child {
  border-bottom: none;
}
.ej-gsc-label {
  font-size: 0.8125rem;
  color: #5b21b6;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.ej-gsc-label i {
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
}
.ej-gsc-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: #3b0764;
  text-align: right;
}
.ej-gsc-freight {
  color: #15803d;
}

/* ── Invoice step ────────────────────────────────────────── */
.ej-invoice-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  min-height: 52px;
}
.ej-inv-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  padding: 0.2rem 0.6rem;
  flex-shrink: 0;
}
.ej-inv-ok   { background: #dcfce7; color: #16a34a; }
.ej-inv-warn { background: #fef9c3; color: #b45309; }
.ej-inv-unk  { background: #f3f4f6; color: #6b7280; }
.ej-inv-info {
  flex: 1;
  min-width: 0;
}
.ej-inv-tracking {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ej-inv-sub {
  font-size: 0.75rem;
  color: #6b7280;
}

/* ── Per-row invoice acknowledgment ─────────────────────── */
.ej-inv-pkg-block {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ej-invoice-row-pending {
  border-color: #fcd34d;
  background: #fffbeb;
}

.ej-inv-ack-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.625rem;
  background: #fef9c3;
  border: 1px solid #fcd34d;
  border-top: none;
  border-radius: 0 0 0.75rem 0.75rem;
  cursor: pointer;
  font-size: 0.8125rem;
  color: #92400e;
  font-weight: 500;
  user-select: none;
}

.ej-inv-ack-row:hover {
  background: #fef08a;
}

.ej-inv-ack-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  accent-color: #d97706;
  cursor: pointer;
}

.ej-inv-ack-row input[type="checkbox"]:checked + span {
  color: #78350f;
}

/* ── Invoice summary count line ──────────────────────────── */
.ej-invoice-summary {
  font-size: 0.8125rem;
  color: #4b5563;
  padding: 0.5rem 0.25rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.ej-inv-sum-ok {
  color: #16a34a;
  font-weight: 600;
}

.ej-inv-sum-warn {
  color: #b45309;
  font-weight: 600;
}

/* ── Unknown invoice neutral note ────────────────────────── */
.ej-inv-unk-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem 0.5rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 0.75rem 0.75rem;
  font-size: 0.78rem;
  color: #6b7280;
}

/* ── Drift banner ────────────────────────────────────────── */
.ej-drift-banner {
  margin: 0 1.25rem 0.75rem;
  background: #fffbeb;
  border: 1.5px solid #fbbf24;
  border-radius: 0.75rem;
  overflow: hidden;
}
.ej-drift-header {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem 0.5rem;
}
.ej-drift-icon {
  color: #d97706;
  flex-shrink: 0;
  margin-top: 0.1rem;
  font-size: 0.9rem;
}
.ej-drift-msg {
  font-size: 0.82rem;
  color: #92400e;
  line-height: 1.4;
}
.ej-drift-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0 0.75rem 0.65rem;
}
.ej-drift-detail {
  border-top: 1px solid #fcd34d;
  padding: 0.5rem 0.9rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.ej-drift-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  background: #fef3c7;
  border-radius: 0.4rem;
}
.ej-drift-detail-tracking {
  font-weight: 600;
  color: #78350f;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ej-drift-detail-status {
  font-size: 0.75rem;
  font-weight: 600;
  color: #b45309;
  background: #fde68a;
  border-radius: 9999px;
  padding: 0.15rem 0.55rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Warning card ────────────────────────────────────────── */
.ej-warning-card {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: 0.875rem;
  padding: 1rem 1.25rem;
}
.ej-warning-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 0.5rem;
}
.ej-warning-desc {
  font-size: 0.875rem;
  color: #78350f;
  line-height: 1.5;
}

/* ── Step indicator ──────────────────────────────────────── */
.ej-steps {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.ej-steps::-webkit-scrollbar { display: none; }
.ej-step {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  flex-shrink: 0;
}
.ej-step-dot {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: #e5e7eb;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}
.ej-step.ej-step-done .ej-step-dot {
  background: #10b981;
  color: #fff;
}
.ej-step.ej-step-active {
  color: #7c3aed;
}
.ej-step.ej-step-active .ej-step-dot {
  background: #7c3aed;
  color: #fff;
}
.ej-step-connector {
  width: 1.25rem;
  height: 2px;
  background: #e5e7eb;
  border-radius: 9999px;
  flex-shrink: 0;
}

/* ── Big checkbox ────────────────────────────────────────── */
.ej-big-check-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  border-radius: 0.875rem;
  cursor: pointer;
}
.ej-big-check-wrap input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  accent-color: #16a34a;
  cursor: pointer;
  margin-top: 0.125rem;
}
.ej-big-check-label {
  font-size: 0.9rem;
  color: #14532d;
  line-height: 1.5;
  font-weight: 500;
  cursor: pointer;
}

/* ── Success state ───────────────────────────────────────── */
.ej-success-card {
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1.5px solid #86efac;
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
}
.ej-success-icon {
  width: 3.5rem;
  height: 3.5rem;
  background: #dcfce7;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  font-size: 1.5rem;
  margin: 0 auto 0.75rem;
}
.ej-success-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #14532d;
  margin-bottom: 0.5rem;
}
.ej-success-desc {
  font-size: 0.875rem;
  color: #15803d;
  line-height: 1.6;
  max-width: 28rem;
  margin: 0 auto;
}

/* ── Confirmed / en proceso state ────────────────────────── */
.ej-confirmed-card {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1.5px solid #93c5fd;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  text-align: center;
}
.ej-confirmed-icon {
  width: 3.5rem;
  height: 3.5rem;
  background: #dbeafe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1d4ed8;
  font-size: 1.4rem;
  margin: 0 auto 0.75rem;
}
.ej-confirmed-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 0.375rem;
}
.ej-confirmed-desc {
  font-size: 0.875rem;
  color: #1d4ed8;
  line-height: 1.6;
  max-width: 28rem;
  margin: 0 auto 0.625rem;
}
.ej-confirmed-ts {
  font-size: 0.78rem;
  font-weight: 600;
  color: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

/* ── Error / fallback ────────────────────────────────────── */
.ej-error-card {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-radius: 0.875rem;
  padding: 1rem 1.25rem;
}
.ej-error-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #991b1b;
  margin-bottom: 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ej-error-desc {
  font-size: 0.875rem;
  color: #7f1d1d;
  line-height: 1.5;
}
.ej-error-desc a {
  color: #b91c1c;
  text-decoration: underline;
}

/* ── Tooltip ─────────────────────────────────────────────── */
.ej-tooltip {
  position: relative;
}
.ej-tooltip-text {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  font-size: 0.72rem;
  padding: 0.35rem 0.6rem;
  border-radius: 0.4rem;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.ej-tooltip:hover .ej-tooltip-text {
  display: block;
}

/* ── "Agregar a grupo" table button ──────────────────────── */
.btn-group-add {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.6rem;
  border-radius: 0.5rem;
  font-size: 0.73rem;
  font-weight: 600;
  color: #7c3aed;
  background: #ede9fe;
  border: 1px solid #c4b5fd;
  cursor: pointer;
  white-space: nowrap;
  transition: background 150ms, border-color 150ms;
}
.btn-group-add:hover {
  background: #ddd6fe;
  border-color: #8b5cf6;
}

/* ── Dashboard card active state ─────────────────────────── */
.ej-dash-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ej-dash-link {
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.5rem;
  padding: 0.375rem 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 150ms;
}
.ej-dash-link-primary {
  background: #7c3aed;
  color: #fff;
}
.ej-dash-link-primary:hover { background: #6d28d9; }
.ej-dash-link-ghost {
  background: transparent;
  color: #7c3aed;
  border: 1px solid #c4b5fd;
}
.ej-dash-link-ghost:hover {
  background: #ede9fe;
}

/* ── Divider ─────────────────────────────────────────────── */
.ej-divider {
  border: none;
  border-top: 1px solid #f3f4f6;
  margin: 0.75rem 0;
}

/* ── Confirmation summary table ──────────────────────────── */
.ej-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.ej-summary-table th,
.ej-summary-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #f3f4f6;
}
.ej-summary-table th {
  color: #6b7280;
  font-weight: 500;
  width: 40%;
}
.ej-summary-table td {
  color: #0f172a;
  font-weight: 600;
}

/* ── Info note ───────────────────────────────────────────── */
.ej-info-note {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.8125rem;
  color: #5b21b6;
  background: #ede9fe;
  border-radius: 0.625rem;
  padding: 0.75rem 1rem;
  line-height: 1.5;
}
.ej-info-note i { flex-shrink: 0; margin-top: 0.1rem; }

/* ── Summary modal — confirmed banner ───────────────────── */
.ej-summary-confirmed-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #dbeafe;
  border: 1.5px solid #93c5fd;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #1e3a8a;
  font-weight: 500;
  margin-bottom: 1rem;
}
.ej-summary-confirmed-banner i {
  color: #2563eb;
  font-size: 1rem;
  flex-shrink: 0;
}
.ej-summary-confirmed-banner strong {
  font-weight: 700;
}

/* ── Summary modal — package table ──────────────────────── */
.ej-summary-pkg-wrap {
  overflow-x: auto;
  border: 1px solid #e9d5ff;
  border-radius: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}
.ej-summary-pkg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.ej-summary-pkg-table thead tr {
  background: #f5f3ff;
  border-bottom: 1.5px solid #e9d5ff;
}
.ej-summary-pkg-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  white-space: nowrap;
}
.ej-summary-pkg-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
}
.ej-summary-pkg-table tbody tr:last-child {
  border-bottom: none;
}
.ej-summary-pkg-table tbody tr:hover {
  background: #faf5ff;
}
.ej-summary-pkg-table td {
  padding: 0.5rem 0.75rem;
  color: #0f172a;
  vertical-align: middle;
}
.ej-spkg-num {
  color: #9ca3af !important;
  font-size: 0.72rem !important;
  width: 2rem;
  text-align: center;
}
.ej-spkg-tracking {
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.775rem !important;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ej-spkg-carrier {
  color: #374151 !important;
  white-space: nowrap;
}
.ej-spkg-date {
  color: #6b7280 !important;
  white-space: nowrap;
}

/* ── History (Historial de envíos) section ───────────────── */
.ej-history-section {
  border-top: 1px solid #e5e7eb;
  margin-top: 0.25rem;
}
.ej-history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: #f9fafb;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: #4b5563;
  gap: 0.5rem;
  transition: background 150ms, color 150ms;
}
.ej-history-toggle:hover {
  background: #f3f4f6;
  color: #1f2937;
}
.ej-history-toggle-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ej-history-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 1.375rem;
  height: 1.375rem;
  padding: 0 0.35rem;
}
.ej-history-chevron {
  color: #9ca3af;
  font-size: 0.8rem;
  flex-shrink: 0;
  transition: transform 200ms;
}
.ej-history-list {
  padding: 0.75rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Closed / archived card ──────────────────────────────── */
.ej-group-card.ej-confirmed.ej-closed-card-wrap {
  border-color: #e5e7eb;
  background: #f9fafb;
  opacity: 0.9;
}
.ej-closed-card {
  background: linear-gradient(135deg, #f9fafb, #f3f4f6);
  border: 1.5px solid #e5e7eb;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  text-align: center;
}
.ej-closed-icon {
  width: 3rem;
  height: 3rem;
  background: #e5e7eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 1.2rem;
  margin: 0 auto 0.625rem;
}
.ej-closed-title {
  font-size: 1rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 0.25rem;
}
.ej-closed-desc {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.5;
  max-width: 26rem;
  margin: 0 auto 0.5rem;
}

/* ── Auto-added in-card notification strip ───────────────── */
.ej-auto-added-strip {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0 1.25rem 0.75rem;
  padding: 0.6rem 0.9rem;
  background: #f5f3ff;
  border: 1px solid #c4b5fd;
  border-radius: 0.625rem;
  font-size: 0.82rem;
  color: #5b21b6;
}
.ej-auto-added-strip > .fas {
  color: #7c3aed;
  flex-shrink: 0;
  margin-top: 0.15rem;
}
.ej-auto-added-text {
  flex: 1;
  line-height: 1.4;
}

/* ── Section-level ambiguous banner ──────────────────────── */
.ej-ambiguous-banner {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.25rem;
  padding: 0.7rem 1.25rem;
  background: #fffbeb;
  border-bottom: 1px solid #fcd34d;
  font-size: 0.82rem;
  color: #92400e;
}
.ej-ambiguous-banner > .fas {
  color: #d97706;
  flex-shrink: 0;
}
.ej-ambiguous-text {
  flex: 1;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .ej-ambiguous-banner {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .ej-ambiguous-banner .ej-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Named classes replacing inline styles ───────────────── */
.ej-card-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ej-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  border-radius: 0.375rem;
  transition: color 150ms, background 150ms;
}
.ej-icon-btn:hover {
  color: #374151;
  background: #f3f4f6;
}
.ej-btn-prepare-continue {
  border-color: #FF6B00;
  color: #FF6B00;
  font-weight: 700;
}
.ej-btn-prepare-continue:hover:not(:disabled) {
  background: #fff7ed;
  border-color: #E05A00;
}
.ej-btn-delete-confirm {
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
}
.ej-btn-ver-grupos {
  font-size: 0.78rem;
  padding: 0.2rem 0.7rem;
}

/* ── Confirmed-state card action buttons ─────────────────── */
.ej-confirmed-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

/* ══════════════════════════════════════════════════════════
   MOBILE RESPONSIVE OVERRIDES  (≤ 640 px)
   ══════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Modal header / body / footer padding */
  .ej-modal-header {
    padding: 1rem 1rem 0.75rem;
  }
  .ej-modal-body {
    padding: 1rem;
  }

  /* Footer: stack buttons vertically, primary on top */
  .ej-modal-footer {
    flex-direction: column-reverse;
    padding: 0.875rem 1rem max(1.25rem, env(safe-area-inset-bottom));
    gap: 0.5rem;
  }
  .ej-modal-footer .ej-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* Group list / card padding */
  .ej-group-list {
    padding: 0.875rem 0.875rem;
    gap: 0.875rem;
  }
  .ej-group-card-header {
    padding: 0.875rem 1rem 0.625rem;
  }
  .ej-progress-wrap {
    padding: 0 1rem 0.625rem;
  }
  .ej-pkg-list {
    padding: 0.625rem 1rem;
  }

  /* Group action buttons: stack vertically */
  .ej-group-actions {
    flex-direction: column;
    align-items: stretch;
    padding: 0 1rem 0.875rem;
    gap: 0.5rem;
  }
  .ej-group-actions .ej-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* Confirmed-state action buttons */
  .ej-confirmed-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .ej-confirmed-actions .ej-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  /* Selector list: cap height for short screens */
  .ej-selector-list {
    max-height: 40vh;
  }

  /* Safe-area bottom padding for iOS */
  .ej-modal {
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Section header button comfortable tap target */
  #enviar-juntos-section .ej-section-header .ej-btn {
    min-height: 40px;
  }

  /* Empty-state create button */
  .ej-empty-state .ej-btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
}

/* ── Activity log timeline ───────────────────────────────── */
.ej-timeline-section {
  border-top: 1px solid #f3f4f6;
  margin-top: 0;
}

.ej-tl-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  text-align: left;
  transition: background 150ms, color 150ms;
  border-radius: 0 0 1rem 1rem;
}

.ej-tl-toggle:hover {
  background: #f9fafb;
  color: #374151;
}

.ej-tl-toggle-icon {
  color: #9ca3af;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.ej-tl-chevron {
  margin-left: auto;
  font-size: 0.7rem;
  color: #9ca3af;
  flex-shrink: 0;
}

.ej-tl-body {
  padding: 0.5rem 1.25rem 1rem;
}

.ej-timeline {
  display: flex;
  flex-direction: column;
}

.ej-tl-row {
  display: flex;
  gap: 0.75rem;
  min-height: 2rem;
}

.ej-tl-dot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 1.25rem;
}

.ej-tl-dot {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  flex-shrink: 0;
}

.ej-tl-dot-blue  { background: #dbeafe; color: #2563eb; }
.ej-tl-dot-green { background: #dcfce7; color: #16a34a; }
.ej-tl-dot-gray  { background: #f3f4f6; color: #6b7280; }

.ej-tl-connector {
  width: 1.5px;
  flex: 1;
  background: #e5e7eb;
  margin: 0.2rem 0;
  min-height: 0.75rem;
}

.ej-tl-content {
  padding-bottom: 0.75rem;
  flex: 1;
  min-width: 0;
}

.ej-tl-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  line-height: 1.3;
}

.ej-tl-ts {
  font-size: 0.72rem;
  color: #9ca3af;
  margin-top: 0.1rem;
}

.ej-tl-empty {
  font-size: 0.8125rem;
  color: #9ca3af;
  text-align: center;
  padding: 0.5rem 0;
}
