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

:root {
  --bg: #f0f2f7;
  --card: #ffffff;
  --primary: #1a56db;
  --primary-dark: #1344b8;
  --primary-light: #e8effe;
  --accent: #0ea5e9;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warn: #d97706;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(26,86,219,0.10), 0 1px 4px rgba(0,0,0,0.06);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background-image: radial-gradient(ellipse at 20% 20%, rgba(26,86,219,0.07) 0%, transparent 60%),
                    radial-gradient(ellipse at 80% 80%, rgba(14,165,233,0.06) 0%, transparent 60%);
}

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  border: 1px solid rgba(26,86,219,0.08);
}

/* ── HEADER ── */
.header {
  background: linear-gradient(135deg, #1a56db 0%, #0ea5e9 100%);
  padding: 32px 36px 28px;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
}
.header::after {
  content: '';
  position: absolute;
  bottom: -60px; left: 30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}
.header-icon {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.2);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  font-size: 22px;
  position: relative; z-index: 1;
}
.header h1 {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  position: relative; z-index: 1;
}
.header p {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin-top: 6px;
  position: relative; z-index: 1;
}

/* ── BODY ── */
.body { padding: 32px 36px 36px; }

/* ── PROGRESS ── */
.progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 28px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

/* ── CAMPO ── */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.field label .req { color: var(--primary); margin-left: 2px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.10);
}
.field input.valid { border-color: var(--success); }
.field input.invalid,
.field select.invalid,
.field textarea.invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(220,38,38,0.08); }

.field textarea { resize: none; min-height: 80px; }

.field-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 5px;
  display: none;
  align-items: center;
  gap: 5px;
}
.field-error.show { display: flex; }

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

.char-count {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
}
.char-count.warn { color: var(--warn); }
.char-count.ok { color: var(--success); }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── FILE ZONE ── */
.file-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
  position: relative;
}
.file-zone:hover, .file-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.file-zone.has-file {
  border-color: var(--success);
  background: var(--success-bg);
  border-style: solid;
}
.file-zone input[type="file"] { display: none; }
.file-icon { font-size: 28px; margin-bottom: 8px; display: block; }
.file-name {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}
.file-name.ok { color: var(--success); font-weight: 500; }
.file-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.file-remove {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 16px;
  display: none;
}
.file-zone.has-file .file-remove { display: block; }

/* ── ALERTA DUPLICADO ── */
.alert-warn {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #92400e;
  display: none;
  margin-bottom: 16px;
  align-items: center;
  gap: 8px;
}
.alert-warn.show { display: flex; }

/* ── BOTÓN ── */
.btn-submit {
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  margin-top: 6px;
  box-shadow: 0 2px 12px rgba(26,86,219,0.25);
}
.btn-submit:hover { background: var(--primary-dark); box-shadow: 0 4px 18px rgba(26,86,219,0.35); }
.btn-submit:active { transform: scale(0.98); }
.btn-submit:disabled { background: #93c5fd; cursor: not-allowed; box-shadow: none; }

/* ── LOADING ── */
#screen-loading { display: none; text-align: center; padding: 52px 0 32px; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#screen-loading p { color: var(--muted); font-size: 14px; }
#screen-loading .step-label {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin-top: 6px;
}

/* ── ÉXITO ── */
#screen-success { display: none; text-align: center; padding: 36px 0 16px; }
.success-icon {
  width: 72px; height: 72px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  border: 2px solid #bbf7d0;
}
#screen-success h2 {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
#screen-success p { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.id-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-family: monospace;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  margin: 10px 0 22px;
  font-weight: 600;
}
.btn-tg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0088cc;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 28px;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(0,136,204,0.3);
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-tg:hover { background: #0077b3; box-shadow: 0 4px 18px rgba(0,136,204,0.4); }
.tg-hint { font-size: 11px; color: var(--muted); margin-top: 12px; }

/* ── ERROR ── */
#screen-error { display: none; text-align: center; padding: 36px 0 16px; }
.error-icon {
  width: 72px; height: 72px;
  background: var(--error-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
  border: 2px solid #fecaca;
}
#screen-error h2 {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
}
#error-msg {
  background: var(--error-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  color: #991b1b;
  margin-bottom: 22px;
}
.btn-retry {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary); color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600; font-size: 14px;
  padding: 12px 28px;
  border-radius: 50px;
  border: none; cursor: pointer;
  box-shadow: 0 2px 12px rgba(26,86,219,0.25);
  transition: background 0.2s;
}
.btn-retry:hover { background: var(--primary-dark); }