/* ════════════════════════════════════════════
   shared.css — migrating-ces / Carga de datos
   Estilos comunes a todas las pantallas
   ════════════════════════════════════════════ */

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

/* Pantallas con requireAuth(): el <body> queda oculto hasta confirmar la
   sesión contra el servidor (evita el flash de contenido protegido). */
html.auth-gate:not(.auth-ready) body { visibility: hidden; }

:root {
  --brand:        #0c4c1c;
  --brand-light:  #e6f0ea;
  --navy:         #0f1e2d;
  --navy-mid:     #1a3045;
  --bg:           #f2f3f5;
  --card:         #ffffff;
  --border:       #dde1e7;
  --text:         #1a1f27;
  --muted:        #6b7280;
  --step-off:     #c4cad4;
  --danger:       #b91c1c;
  --danger-bg:    #fef2f2;
  --success-bg:   #f0faf3;
  --success-fg:   #166534;
  --radius:       8px;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  min-width: 260px;
  max-width: 380px;
  pointer-events: auto;
  animation: toast-in 0.22s ease;
}

.toast.toast-success { border-color: #bbf7d0; background: var(--success-bg); }
.toast.toast-error   { border-color: #fecaca; background: var(--danger-bg); }

.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.toast-msg   { font-size: 12px; color: var(--muted); word-break: break-all; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: var(--navy);
  height: 60px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 10px;
  flex-shrink: 0;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.header-mark {
  width: 22px;
  height: 22px;
  background: var(--brand);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-mark svg { display: block; }

.header-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

.header-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.15);
  margin: 0 4px;
}

.header-sub {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
}

.header-logos {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 16px;
}

.logo-slot {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  overflow: hidden;
  opacity: 0.85;
}

.logo-slot img {
  height: 32px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.logo-placeholder {
  height: 32px;
  width: 72px;
  border-radius: 4px;
  border: 1px dashed rgba(255,255,255,0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.03),
    rgba(255,255,255,0.03) 2px,
    transparent 2px,
    transparent 8px
  );
  cursor: default;
}

.logo-placeholder span {
  font-size: 9px;
  color: rgba(255,255,255,0.35);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.03em;
  text-align: center;
  line-height: 1.2;
}

.logo-big-sep {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.12);
  margin-right: 12px;
}

/* ── Header nav / auth badge ── */
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }

.header-nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color 0.15s;
}

.header-nav-link:hover { color: rgba(255,255,255,0.9); }

.auth-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid rgba(255,255,255,0.15);
}

.auth-user {
  font-size: 12px;
  color: rgba(255,255,255,0.75);
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
  background: rgba(230,240,234,0.9);
  border-radius: 20px;
  padding: 1px 7px;
}

.auth-logout {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.auth-logout:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* ── Main ── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 16px 64px;
}

/* ── Steps ── */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.step.done .step-circle   { background: var(--brand); color: #fff; }
.step.active .step-circle { background: var(--brand); color: #fff; }
.step.inactive .step-circle {
  background: #fff;
  border: 2px solid var(--step-off);
  color: var(--step-off);
}

.step-label { font-size: 13px; font-weight: 500; }
.step.done .step-label    { color: var(--muted); }
.step.active .step-label  { color: var(--brand); }
.step.inactive .step-label { color: var(--step-off); }

.step-connector {
  width: 48px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
}

/* ── Card base ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  padding: 32px 36px 32px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card + .card { margin-top: 16px; }

/* ── Modal de confirmación (genérico, reusado por varias pantallas) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.modal-desc strong { color: var(--text); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.btn-cancel {
  height: 34px;
  padding: 0 14px;
  background: #fff;
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-cancel:hover { border-color: var(--text); color: var(--text); }

.btn-danger {
  height: 34px;
  padding: 0 14px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover:not(:disabled) { background: #941f1f; }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }

.modal-code-list {
  max-height: 140px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 16px;
  font-family: monospace;
  font-size: 12px;
  color: var(--text);
  line-height: 1.7;
}

.card-divider {
  height: 1px;
  background: var(--border);
  margin: 0 -36px 24px;
}

/* ── Form elements ── */
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.field-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 5px;
}

.text-input {
  width: 100%;
  height: 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.text-input::placeholder { color: #b0b8c4; }

.text-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(12,76,28,0.10);
}

/* ── Button ── */
.btn-submit {
  width: 100%;
  height: 44px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.18s, opacity 0.18s;
}

.btn-submit:hover:not(:disabled) { background: #0a3d16; }
.btn-submit:active:not(:disabled) { background: #083010; }
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Feedback ── */
.feedback {
  margin-top: 14px;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  display: none;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.45;
}

.feedback.visible { display: flex; }

.feedback.loading {
  background: #f5f7fa;
  color: var(--muted);
  border: 1px solid var(--border);
}

.feedback.success {
  background: var(--success-bg);
  color: var(--success-fg);
  border: 1px solid #bbf7d0;
}

.feedback.error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.feedback-icon { flex-shrink: 0; margin-top: 1px; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(107,114,128,0.25);
  border-top-color: var(--muted);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
