/* =========================================================
   APUD ACTA · ClaroVeo × InterEidas
   Tokens del kit de marca (BRIEF.md §1)
   ========================================================= */
:root {
  --primary: #0D9669;
  --primary-hover: #047857;
  --primary-light: #10B981;
  --primary-tint: #E7F5EF;     /* fondo suave derivado del primario */
  --primary-tint-2: #D3EEE2;
  --background: #F8FAF9;
  --card: #FFFFFF;
  --text: #1A1A2E;
  --text-secondary: #6B7280;
  --border: #E2E8F0;
  --success: #16A34A;
  --success-bg: #ECFDF3;
  --warning: #CA8A04;
  --warning-bg: #FEF9E7;
  --error: #DC2626;
  --error-bg: #FEF2F2;
  --radius: 12px;
  --shadow-card: 0 1px 2px rgb(26 26 46 / .04), 0 8px 24px -8px rgb(26 26 46 / .08);
  --shadow-btn: 0 6px 16px -6px rgb(13 150 105 / .45);
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Franja modo pruebas ---------- */
.test-banner {
  background: var(--warning-bg); color: #713F12;
  border-bottom: 1px solid #F3E2A9;
  font-size: 13px; font-weight: 600; text-align: center;
  padding: 8px 16px;
}

/* ---------- Cabecera ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
}
/* Margen libre ≥ altura del ojo: el padding vertical del header lo respeta */
.site-header__logo img { height: 24px; width: auto; display: block; }

/* ---------- Layout ---------- */
.page {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

/* ---------- Stepper (3 pasos reales del flujo) ---------- */
.stepper {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.stepper li {
  font-size: 13px;
  color: var(--text-secondary);
  padding-top: 10px;
  border-top: 4px solid var(--border);
  border-radius: 2px;
}
.stepper li.is-done { border-top-color: var(--primary); }
.stepper li.is-current { border-top-color: var(--primary); color: var(--text); font-weight: 600; }

/* ---------- Tarjeta ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px 20px;
}

/* ---------- Tipografía ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; color: var(--text); margin: 0; }
.h-page { font-size: 24px; line-height: 1.25; letter-spacing: -0.015em; }
.h-section { font-size: 17px; line-height: 1.3; letter-spacing: -0.01em; }
.intro { color: var(--text-secondary); margin: 10px 0 24px; }
.small { font-size: 14px; }
.text-secondary { color: var(--text-secondary); }

/* ---------- Botones ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: 600 16px/1.2 var(--font-sans);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: #FFFFFF; box-shadow: var(--shadow-btn); }
.btn-primary:hover:not(:disabled), .btn-primary:active:not(:disabled) { background: var(--primary-hover); color: #FFFFFF; }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-hover); }
.btn-link {
  background: none; border: 0; padding: 8px; min-height: 0; width: auto;
  color: var(--text-secondary); font-weight: 500; text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:hover { color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.actions { display: grid; gap: 12px; margin-top: 24px; }

/* ---------- Formularios ---------- */
.field { margin-top: 18px; }
.field:first-child { margin-top: 0; }
.field-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field-hint { font-size: 14px; color: var(--text-secondary); margin-top: 6px; }
.input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font: 400 16px var(--font-sans);   /* nunca < 16 px: evita el zoom de iOS */
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: #9CA3AF; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(13 150 105 / .15); }
.input.error { border-color: var(--error); }
.input--dni { text-transform: uppercase; letter-spacing: .04em; }
.input--dni::placeholder { text-transform: none; letter-spacing: 0; }

select.input {
  appearance: none; -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.error-message { display: none; font-size: 14px; color: var(--error); margin-top: 6px; }
.error-message.active { display: block; }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 88px; }
.input-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--primary);
  font: 600 14px var(--font-sans); padding: 10px; border-radius: 8px; cursor: pointer;
}
.input-toggle:hover { background: var(--primary-tint); }

.section-divider { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---------- Subida de certificado ---------- */
.dropzone {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border: 1.5px dashed #B6CBC1;
  border-radius: var(--radius);
  background: var(--background);
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--primary); background: var(--primary-tint); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.dropzone__icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--primary-tint); color: var(--primary);
  display: grid; place-items: center; flex-shrink: 0;
}
.dropzone__title { font-weight: 600; }
.dropzone__hint { font-size: 14px; color: var(--text-secondary); word-break: break-all; }
.dropzone.has-file { border-style: solid; border-color: var(--primary); background: var(--primary-tint); }
.dropzone.has-file .dropzone__icon { background: var(--primary); color: #FFFFFF; }

/* ---------- Avisos ---------- */
.notice { display: flex; gap: 10px; padding: 14px 16px; border-radius: var(--radius); font-size: 15px; line-height: 1.5; }
.notice svg { flex-shrink: 0; margin-top: 2px; }
.notice--info { background: var(--primary-tint); color: #064E3B; }
.notice--warning { background: var(--warning-bg); color: #713F12; }
.notice--error { background: var(--error-bg); color: #991B1B; }
.notice + .actions { margin-top: 16px; }
.status { display: none; margin-top: 20px; }
.status.active { display: flex; }

/* ---------- Portada (página ancha) ---------- */
.is-wide .site-header__inner,
.is-wide .page,
.is-wide .site-footer__inner { max-width: 1120px; }
.site-header__logo .logo--tagline { height: 30px; min-width: 160px; }

.narrow { max-width: 528px; margin: 0 auto; }

.hero { display: grid; gap: 32px; align-items: start; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--primary-tint); color: #064E3B;
  font-size: 13px; font-weight: 500;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary-light); }
.h-hero {
  margin-top: 18px;
  font-size: clamp(30px, 7vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  max-width: 15ch;
}
.lead { font-size: 17px; color: var(--text-secondary); margin: 16px 0 0; max-width: 52ch; }

.dni-box {
  margin-top: 28px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  max-width: 460px;
}
.dni-box .field-hint { margin-top: 10px; }

.trust { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.trust li {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border);
  font-size: 14px;
}
.trust svg { color: var(--primary); flex-shrink: 0; }

.checklist { list-style: none; padding: 0; margin: 16px 0 0; }
.checklist li {
  display: grid; grid-template-columns: 40px 1fr; gap: 14px;
  padding: 14px 0; border-top: 1px solid var(--border);
}
.checklist li:first-child { border-top: 0; padding-top: 4px; }
.checklist__icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--primary-tint); color: var(--primary);
  display: grid; place-items: center;
}
.checklist strong { display: block; font-size: 15px; font-weight: 600; }
.checklist span { font-size: 14px; color: var(--text-secondary); }

@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 56px; padding-top: 16px; }
  .hero__aside { margin-top: 44px; }
}

/* ---------- Comprobación de datos ---------- */
.person {
  display: flex; align-items: center; gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
}
.person__avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); display: grid; place-items: center; flex-shrink: 0;
}
.person__avatar img { width: 30px; height: auto; }
.person__name { font-weight: 600; font-size: 17px; line-height: 1.3; }
.person__dni { color: var(--text-secondary); font-size: 15px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ---------- Bloque del poder ---------- */
.poder {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.poder__head {
  padding: 12px 16px;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
}
.poder__head strong { color: var(--text); font-weight: 600; }
.poder__list { list-style: none; margin: 0; padding: 0; }
.poder__item { padding: 14px 16px; border-top: 1px solid var(--border); }
.poder__item:first-child { border-top: 0; }
.poder__role { font-size: 13px; font-weight: 600; color: var(--primary-hover); }
.poder__name { font-weight: 600; margin-top: 2px; }
.poder__name--missing { color: var(--warning); font-weight: 500; font-style: italic; }
.poder__meta { font-size: 14px; color: var(--text-secondary); }
.poder__foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-secondary); }

.check {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 20px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.check:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.check input {
  appearance: none; -webkit-appearance: none;
  width: 22px; height: 22px; margin: 1px 0 0; flex-shrink: 0;
  border: 2px solid #A0AEC0; border-radius: 6px; background: var(--card);
  display: grid; place-items: center; cursor: pointer;
}
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after {
  content: ""; width: 6px; height: 11px; margin-top: -2px;
  border: solid #FFFFFF; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.check input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.check span { font-weight: 500; }

/* ---------- Proceso ---------- */
.loader { display: grid; place-items: center; margin: 8px 0 20px; }
.loader__eye {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary-tint);
  display: grid; place-items: center;
  animation: pulse 1.6s ease-in-out infinite;
}
.loader__eye img { width: 42px; height: auto; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); background: var(--primary-tint-2); } }

.progress__bar { height: 8px; border-radius: 999px; background: #EDF2F7; overflow: hidden; margin-top: 20px; }
.progress__fill { height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width .4s ease; }
.progress__text { margin-top: 10px; font-size: 14px; color: var(--text-secondary); display: flex; justify-content: space-between; gap: 12px; }
.progress__pct { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }

/* ---------- Hecho ---------- */
.done { text-align: center; padding: 8px 0; }
.done__badge {
  width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%;
  background: var(--success-bg); color: var(--success);
  display: grid; place-items: center;
}
.done .intro { margin-bottom: 0; }

/* ---------- Spinner ---------- */
.spinner { width: 18px; height: 18px; border: 2.5px solid rgb(255 255 255 / .35); border-top-color: #FFFFFF; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Pie legal ---------- */
.site-footer { border-top: 1px solid var(--border); }
.site-footer__inner {
  max-width: 560px; margin: 0 auto; padding: 20px 16px 28px;
  font-size: 13px; line-height: 1.6; color: var(--text-secondary);
}
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 6px; }
.site-footer a { color: var(--text-secondary); }
.site-footer a:hover { color: var(--text); }

/* ---------- Escritorio ---------- */
@media (min-width: 640px) {
  .page { padding-top: 40px; }
  .card { padding: 32px; }
  .h-page { font-size: 28px; }
  .actions--split { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
