/* ── Envíos Celendín-Cajamarca — Frontend styles v1.1 ───────────────────── */
:root {
  --ecc-primary:    #1a56db;
  --ecc-primary-h:  #1e429f;
  --ecc-success:    #0e9f6e;
  --ecc-warning:    #c27803;
  --ecc-danger:     #c81e1e;
  --ecc-bg:         #f9fafb;
  --ecc-surface:    #ffffff;
  --ecc-border:     #e5e7eb;
  --ecc-text:       #111827;
  --ecc-muted:      #6b7280;
  --ecc-radius:     10px;
}

/* ── Wrapper ─────────────────────────────────────────────────────────── */
.ecc-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  color: var(--ecc-text);
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

/* ── LOGIN SCREEN ────────────────────────────────────────────────────── */
.ecc-login-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem 1rem;
  min-height: 60vh;
}
.ecc-login-card {
  background: #fff;
  border: 1.5px solid var(--ecc-border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.07);
}
.ecc-login-icon { font-size: 3rem; margin-bottom: .5rem; line-height: 1; }
.ecc-login-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 .25rem;
  color: var(--ecc-text);
}
.ecc-login-sub { color: var(--ecc-muted); font-size: 14px; margin: 0 0 1.5rem; }

.ecc-login-alert {
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 1rem;
  font-size: 13.5px;
  text-align: left;
}
.ecc-login-alert.error   { background: #fef2f2; color: #7f1d1d; border: 1px solid #fca5a5; }
.ecc-login-alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }

.ecc-login-field { text-align: left; margin-bottom: 1rem; }
.ecc-login-field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ecc-muted);
  margin-bottom: 6px;
}
.ecc-pw-wrap { position: relative; }
.ecc-pw-wrap input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--ecc-border);
  border-radius: 8px;
  padding: 10px 40px 10px 12px;
  font-size: 15px;
  transition: border-color .15s;
}
.ecc-pw-wrap input:focus {
  outline: none;
  border-color: var(--ecc-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.ecc-pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
  color: var(--ecc-muted);
}
.ecc-login-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  margin-top: .25rem;
}
.ecc-login-btn:hover  { filter: brightness(1.08); }
.ecc-login-btn:active { transform: scale(.98); }
.ecc-login-btn:disabled { opacity: .6; cursor: not-allowed; }

.ecc-login-footer { margin-top: 1.25rem; font-size: 13px; color: var(--ecc-muted); }
.ecc-login-footer a { color: var(--ecc-primary); text-decoration: none; }

/* ── Header (páginas autenticadas) ───────────────────────────────────── */
.ecc-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1.5rem 0 1rem;
  border-bottom: 1.5px solid var(--ecc-border);
  margin-bottom: 1.5rem;
}
.ecc-logo { font-size: 2rem; line-height: 1; }
.ecc-header h2 { margin: 0 0 2px; font-size: 1.35rem; font-weight: 700; }
.ecc-subtitle { margin: 0; color: var(--ecc-muted); font-size: .875rem; }

.ecc-btn-logout {
  background: none;
  border: 1.5px solid var(--ecc-border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ecc-muted);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.ecc-btn-logout:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* ── Secciones del formulario ────────────────────────────────────────── */
.ecc-section-title {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ecc-muted);
  margin: 1.75rem 0 .75rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ecc-border);
}
.ecc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.ecc-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 16px; }
@media (max-width: 600px) { .ecc-grid-2, .ecc-grid-3 { grid-template-columns: 1fr; } }

.ecc-field { display: flex; flex-direction: column; gap: 5px; }
.ecc-field label { font-size: .8rem; font-weight: 600; color: #374151; }
.ecc-field .req { color: var(--ecc-danger); }
.ecc-field input,
.ecc-field select,
.ecc-field textarea {
  border: 1.5px solid var(--ecc-border);
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 14px;
  color: var(--ecc-text);
  background: var(--ecc-surface);
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s;
  font-family: inherit;
}
.ecc-field input:focus,
.ecc-field select:focus,
.ecc-field textarea:focus {
  outline: none;
  border-color: var(--ecc-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

/* Botones */
.ecc-actions { display: flex; gap: 10px; margin-top: 1.75rem; flex-wrap: wrap; }
.ecc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
  text-decoration: none;
}
.ecc-btn:active { transform: scale(.97); }
.ecc-btn-primary   { background: var(--ecc-primary); color: #fff; }
.ecc-btn-primary:hover { background: var(--ecc-primary-h); }
.ecc-btn-secondary { background: #f3f4f6; color: var(--ecc-text); border: 1.5px solid var(--ecc-border); }
.ecc-btn-secondary:hover { background: #e5e7eb; }
.ecc-btn-icon { font-size: 16px; }

/* Alertas */
.ecc-alert {
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 1rem;
  font-size: 14px;
  line-height: 1.5;
}
.ecc-alert.success { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.ecc-alert.error   { background: #fef2f2; color: #7f1d1d; border: 1px solid #fca5a5; }

/* Badges */
.ecc-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #7f1d1d; }
.badge-secondary { background: #f3f4f6; color: #374151; }

/* Comprobante */
.ecc-comprobante { border: 2px solid var(--ecc-success); border-radius: var(--ecc-radius); padding: 1.5rem; margin-top: 1.5rem; background: #ecfdf5; }
.ecc-comp-header { font-size: 1.1rem; font-weight: 700; color: var(--ecc-success); margin-bottom: .5rem; }
.ecc-codigo-big { font-size: 1.6rem; font-weight: 800; letter-spacing: .08em; color: var(--ecc-primary); background: #fff; border: 2px dashed var(--ecc-primary); border-radius: 8px; padding: 10px 20px; display: inline-block; margin: 10px 0; }
.ecc-comp-data { font-size: 13px; color: #374151; margin: 10px 0; line-height: 1.8; }

/* Rastreo */
.ecc-rastreo-row { display: flex; gap: 10px; margin-bottom: 1rem; }
.ecc-rastreo-row input { flex: 1; border: 1.5px solid var(--ecc-border); border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: monospace; }
#ecc-rastreo-result .ecc-rastreo-card { background: var(--ecc-surface); border: 1.5px solid var(--ecc-border); border-radius: var(--ecc-radius); padding: 1.25rem; }
.ecc-rastreo-card h3 { margin: 0 0 .75rem; font-size: 1.1rem; }
.ecc-rastreo-row-data { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; font-size: 13.5px; }
.ecc-rastreo-row-data .lbl { color: var(--ecc-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; }

/* Panel gestión */
.ecc-totales { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 10px; margin-bottom: 1.25rem; }
.ecc-total-card { background: var(--ecc-surface); border: 1.5px solid var(--ecc-border); border-radius: var(--ecc-radius); padding: 14px; text-align: center; }
.ecc-total-num { display: block; font-size: 1.75rem; font-weight: 800; }
.ecc-total-lbl { font-size: 11px; text-transform: uppercase; color: var(--ecc-muted); font-weight: 600; }
.ecc-filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; }
.ecc-filtros input, .ecc-filtros select { border: 1.5px solid var(--ecc-border); border-radius: 7px; padding: 7px 10px; font-size: 13px; }
.ecc-table-wrap { overflow-x: auto; }
.ecc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ecc-table th { background: #f9fafb; border-bottom: 1.5px solid var(--ecc-border); padding: 8px 10px; text-align: left; font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--ecc-muted); }
.ecc-table td { padding: 9px 10px; border-bottom: 1px solid var(--ecc-border); vertical-align: top; }
.ecc-table tr:hover td { background: #f9fafb; }
.ecc-loading { text-align: center; color: var(--ecc-muted); padding: 2rem !important; }

/* Modal */
.ecc-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.ecc-modal-box { background: var(--ecc-surface); border-radius: 12px; padding: 1.5rem; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.ecc-modal-box h3 { margin: 0 0 1rem; }

/* ── COMPROBANTE MEJORADO ────────────────────────────────────────────── */
.ecc-comprobante {
  border: 2px solid var(--ecc-success);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  margin-top: 1.5rem;
  background: #ecfdf5;
  text-align: center;
}
.ecc-comp-check   { font-size: 3rem; line-height: 1; margin-bottom: .25rem; }
.ecc-comp-titulo  { font-size: 1.25rem; font-weight: 700; color: var(--ecc-success); margin: 0 0 .75rem; }

.ecc-codigo-big {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: .1em;
  color: var(--ecc-primary);
  background: #fff;
  border: 2.5px dashed var(--ecc-primary);
  border-radius: 10px;
  padding: 10px 24px;
  display: inline-block;
  margin: 0 auto 1.5rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

/* Grid de resumen */
.ecc-resumen-grid {
  background: #fff;
  border: 1.5px solid #a7f3d0;
  border-radius: 10px;
  overflow: hidden;
  margin: 0 0 1.5rem;
  text-align: left;
}
.ecc-res-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid #f0fdf4;
}
.ecc-res-row:last-child { border-bottom: none; }
.ecc-res-row:nth-child(even) { background: #f0fdf4; }
.ecc-res-lbl {
  flex-shrink: 0;
  width: 140px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b7280;
}
.ecc-res-val {
  font-size: 14px;
  color: var(--ecc-text);
  font-weight: 500;
  word-break: break-word;
}
.ecc-res-precio .ecc-res-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ecc-success);
}

/* Botones del comprobante */
.ecc-comp-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.ecc-btn-print {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: #1f2937;
  color: #fff;
  transition: background .15s, transform .1s;
}
.ecc-btn-print:hover  { background: #111827; }
.ecc-btn-print:active { transform: scale(.97); }

@media (max-width: 500px) {
  .ecc-res-lbl { width: 110px; }
}

/* ── CAMPO PIN DE ENTREGA (formulario de registro) ───────────────────── */
.ecc-clave-wrap .ecc-clave-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-left: 6px;
  vertical-align: middle;
}
.ecc-pin-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ecc-pin-input-wrap input {
  flex: 1;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 8px;
  text-align: center;
  border: 2px solid #fbbf24;
  border-radius: 8px;
  padding: 9px 12px;
  background: #fffbeb;
}
.ecc-pin-input-wrap input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}
.ecc-btn-genpin {
  white-space: nowrap;
  padding: 9px 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #374151;
  transition: background .12s;
}
.ecc-btn-genpin:hover { background: #f3f4f6; }
.ecc-clave-desc {
  font-size: 12px;
  color: var(--ecc-muted);
  margin-top: 6px;
  line-height: 1.5;
}

/* PIN en el resumen del comprobante */
.ecc-res-pin .ecc-res-lbl { color: #92400e; }
.ecc-res-pin .ecc-res-val {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: #92400e;
  background: #fef3c7;
  border: 1.5px dashed #fbbf24;
  border-radius: 6px;
  padding: 4px 14px;
  display: inline-block;
}

/* ── WIDGET VERIFICACIÓN DE PIN (panel) ──────────────────────────────── */
.ecc-verify-widget {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ecc-verify-inner {
  background: #fff;
  border-radius: 14px;
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.ecc-verify-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.ecc-verify-header h4 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.ecc-verify-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #9ca3af;
  padding: 2px 6px;
  border-radius: 5px;
}
.ecc-verify-close:hover { background: #f3f4f6; color: #374151; }
.ecc-verify-info {
  font-size: 12px;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 6px;
  padding: 6px 10px;
  margin-bottom: 1rem;
}
.ecc-verify-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 1rem;
}
.ecc-verify-row input {
  flex: 1;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  font-size: 1.4rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
  background: #f9fafb;
}
.ecc-verify-row input:focus {
  outline: none;
  border-color: #1a56db;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.ecc-verify-result {
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}
.ecc-verify-result.pin-ok   { background: #ecfdf5; color: #065f46; border: 1.5px solid #6ee7b7; }
.ecc-verify-result.pin-fail { background: #fef2f2; color: #7f1d1d; border: 1.5px solid #fca5a5; }

/* Botón PIN en tabla del panel */
.ecc-btn-pin {
  background: #fef3c7 !important;
  color: #92400e !important;
  border: 1.5px solid #fbbf24 !important;
  font-weight: 700 !important;
}
.ecc-btn-pin:hover { background: #fde68a !important; }

/* ── PAGINACIÓN (panel frontend) ─────────────────────────────────────── */
.ecc-pag {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: .5rem 0;
}
.ecc-pag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1.5px solid var(--ecc-border);
  border-radius: 7px;
  background: var(--ecc-surface);
  color: var(--ecc-text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  text-decoration: none;
}
.ecc-pag-btn:hover { background: #f3f4f6; border-color: #9ca3af; }
.ecc-pag-active {
  background: var(--ecc-primary) !important;
  border-color: var(--ecc-primary) !important;
  color: #fff !important;
}
.ecc-pag-dots { color: var(--ecc-muted); padding: 0 4px; font-size: 13px; }
.ecc-pag-info {
  font-size: 12px;
  color: var(--ecc-muted);
  margin-left: 6px;
}
