/* =========================================================
   Portal de validación de certificados (validar.html)
   Hereda tokens, tipografía y botones de styles.css
   ========================================================= */
.vpage {
  --ok: #1f7a4a;     --ok-bg: #e6f3ec;
  --warn: #8a5a00;   --warn-bg: #fbf0d6;
  --bad: #b2391f;    --bad-bg: #fbeae6;
  --field-line: rgba(13, 18, 20, .2);
  --ph: #6b7578;
  background: var(--paper);
  caret-color: var(--brand-ink);
}
.vpage ::selection { background: var(--brand); color: var(--white); }
html { scrollbar-color: #8f9a9c var(--paper); }
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: #8f9a9c; border-radius: 999px; border: 3px solid var(--paper); }
/* Foco visible sobre fondos claros: el azul de relleno global queda justo sobre blanco y paper */
.vcard__main :focus-visible, .vbelow :focus-visible, .vchip:focus-visible { outline-color: var(--brand-ink); }
.vband h1, .vpanel h2, .vstatus h2, .vbelow h2 { text-wrap: balance; }
.vwrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.vnum, .vfolio__n, .vfolio__d, .vdata dd.is-num { font-variant-numeric: tabular-nums; }

/* ---------- Header del portal ---------- */
.vhead { background: var(--ink); color: var(--white); border-bottom: 1px solid var(--line-dark); }
.vhead__inner { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.vhead .brand { font-size: 1.3rem; }
.vhead .brand svg { width: 36px; height: 36px; }
.vhead .brand span { background: none; color: #cfcfcf; }
.vhead__nav { display: flex; align-items: center; gap: 8px; }
.vhead__link {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px;
  font-size: .92rem; font-weight: 700; text-decoration: none; color: var(--white);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.28); transition: background .25s, box-shadow .25s;
}
.vhead__link:hover { background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.5); }
.vhead__link svg { width: 16px; height: 16px; }
.vhead__link--quiet { box-shadow: none; color: var(--muted-dark); }
.vhead__link--quiet:hover { color: var(--white); box-shadow: none; }

/* ---------- Banda ---------- */
.vband { position: relative; overflow: hidden; background: var(--ink); color: var(--white); padding: clamp(40px, 6vw, 68px) 0 clamp(140px, 14vw, 172px); }
.vband h1 { font-size: clamp(2.3rem, 4.8vw, 3.9rem); max-width: 18ch; }
.vband p { margin: 16px 0 0; max-width: 54ch; font-size: clamp(1rem, 1.4vw, 1.12rem); color: var(--muted-dark); }
.vband__mark {
  position: absolute; right: max(16px, calc(50% - 600px)); top: clamp(28px, 4vw, 48px);
  width: clamp(150px, 14vw, 200px); height: auto; aspect-ratio: 1;
  --logo-fill: rgba(255,255,255,.04); pointer-events: none;
}

/* ---------- Tarjeta de trabajo ---------- */
.vstage { position: relative; margin-top: clamp(-128px, -11vw, -96px); }
.vcard {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 1px 2px rgba(13,18,20,.06), 0 32px 64px -32px rgba(13,18,20,.38);
}
.vcard__main { padding: clamp(24px, 4vw, 48px); min-width: 0; }

/* Progreso */
.vsteps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; list-style: none; margin: 0 0 clamp(28px, 4vw, 40px); padding: 0; counter-reset: s; }
.vsteps li {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--paper); color: var(--muted); font-size: .88rem; font-weight: 700; white-space: nowrap; min-width: 0;
  transition: background .35s var(--ease), color .35s var(--ease);
}
.vsteps__t { overflow: hidden; text-overflow: ellipsis; }
.vsteps__n {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--paper-2); color: var(--ink); font-size: .8rem; font-weight: 800; font-variant-numeric: tabular-nums;
}
.vsteps__n svg { width: 14px; height: 14px; }
.vsteps li.is-current { background: var(--ink); color: var(--white); }
.vsteps li.is-current .vsteps__n { background: var(--brand); color: var(--white); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.vsteps li.is-done { background: #e4eff0; color: var(--brand-ink); }
.vsteps li.is-done .vsteps__n { background: var(--brand-ink); color: var(--white); }

/* Paneles */
.vpanel h2 { font-size: clamp(1.55rem, 2.5vw, 2.1rem); max-width: 24ch; outline: none; }
.vlead { margin: 10px 0 28px; max-width: 56ch; color: var(--muted); font-size: 1.02rem; }
.vlead b { color: var(--ink); }
.vpanel.is-entering { animation: vin .45s var(--ease) both; }
@keyframes vin { from { opacity: 0; transform: translateY(10px); } }

/* Campos */
.vfield { display: flex; flex-direction: column; gap: 8px; max-width: 520px; }
.vfield label { font-weight: 700; font-size: .92rem; }
.vopt { font-weight: 500; color: var(--muted); }
.vfield > input, .vphone {
  height: 58px; border: 1.5px solid var(--field-line); border-radius: var(--radius-sm); background: var(--white);
  transition: border-color .25s, box-shadow .25s;
}
.vfield > input { width: 100%; padding: 0 18px; font-size: 1.02rem; outline: none; }
.vfield > input:focus, .vphone:focus-within { border-color: var(--brand-ink); box-shadow: 0 0 0 4px rgba(30,77,84,.18); }
.vfield input::placeholder { color: var(--ph); opacity: 1; }
.vphone { display: flex; align-items: stretch; }
.vphone input { flex: 1; min-width: 0; border: 0; outline: none; background: none; padding: 0 18px; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.vselect { position: relative; flex: none; display: flex; border-right: 1.5px solid var(--line); }
.vselect select {
  -webkit-appearance: none; appearance: none; border: 0; outline: none; background: var(--paper); cursor: pointer;
  padding: 0 38px 0 16px; font-weight: 700; font-size: .98rem;
}
.vselect select:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-ink); }
.vselect > svg { position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; translate: 0 -50%; pointer-events: none; color: var(--muted); }
.vselect select, .vcc { border-radius: 12.5px 0 0 12.5px; }

/* Selector de país con bandera (validar.js lo construye sobre el <select>) */
.vselect.is-enhanced > select, .vselect.is-enhanced > svg { display: none; }
.vcc {
  position: relative; display: flex; align-items: center; gap: 9px; height: 100%; padding: 0 38px 0 14px;
  border: 0; background: var(--paper); font-weight: 700; font-size: .98rem; font-variant-numeric: tabular-nums;
}
.vcc:hover { background: var(--paper-2); }
.vcc:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: -2px; }
.vchev { position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; translate: 0 -50%; color: var(--muted); transition: rotate .25s var(--ease); }
.vcc[aria-expanded="true"] .vchev { rotate: 180deg; }
.vflag { flex: none; width: 24px; height: 16px; border-radius: 3px; outline: 1px solid rgba(13,18,20,.16); outline-offset: -1px; }
.vcc__list {
  position: absolute; z-index: 20; top: calc(100% + 8px); left: -1.5px; min-width: 240px;
  margin: 0; padding: 6px; list-style: none; background: var(--white); border-radius: var(--radius-sm); outline: none;
  box-shadow: 0 1px 2px rgba(13,18,20,.08), 0 18px 40px -16px rgba(13,18,20,.38);
  animation: vin .2s var(--ease) both;
}
.vcc__list li { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.vcc__list li.is-active { background: #eaf3f3; }
.vcc__list li[aria-selected="true"] { font-weight: 800; }
.vcc__pre { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.vcc__tick { flex: none; width: 16px; height: 16px; color: var(--brand-ink); visibility: hidden; }
.vcc__list li[aria-selected="true"] .vcc__tick { visibility: visible; }
.vcc__list:focus-visible li.is-active { box-shadow: inset 0 0 0 2px var(--brand-ink); }
.verr { margin: 0; color: var(--bad); font-size: .86rem; font-weight: 600; }
/* Vacío sigue en el árbol de accesibilidad (role="alert" se anuncia al llenarse); solo cancela el gap del campo */
.vfield > .verr:empty { margin-top: -8px; }
.vfield.has-error > input, .vfield.has-error .vphone { border-color: #c8412b; background: #fdf4f2; }
.vfield.has-error .vphone input { background: none; }
.vgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; max-width: 760px; }
.vgrid .vfield { max-width: none; }

/* Código OTP */
.votp { display: flex; align-items: center; gap: 10px; border: 0; margin: 0 0 8px; padding: 0; }
.votp input {
  width: 58px; height: 68px; border: 1.5px solid var(--field-line); border-radius: var(--radius-sm); background: var(--white);
  text-align: center; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.votp input:focus { border-color: var(--brand-ink); box-shadow: 0 0 0 4px rgba(30,77,84,.18); }
.votp input.is-filled { background: var(--paper); }
.votp__gap { width: 10px; height: 2px; border-radius: 2px; background: var(--field-line); }
.votp.has-error input { border-color: #c8412b; background: #fdf4f2; }
.votp.is-shake { animation: shake .4s; }
@keyframes shake { 25% { translate: -6px 0; } 50% { translate: 6px 0; } 75% { translate: -3px 0; } }

/* Acciones */
.vactions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 22px; margin-top: 20px; }
.vbtn { padding: 17px 26px; font-size: 1rem; }
.vbtn[disabled] { cursor: progress; opacity: .85; }
.vbtn.is-loading svg { display: none; }
.vbtn.is-loading::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent; animation: vspin .7s linear infinite;
}
@keyframes vspin { to { transform: rotate(1turn); } }
.vlink {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;
  color: var(--brand-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px;
}
.vlink:hover { color: var(--ink); }
.vlink[disabled] { color: var(--muted); text-decoration: none; cursor: default; }
.vlink svg { width: 16px; height: 16px; }
.vlink--back { text-decoration: none; }
.valt { margin: 22px 0 0; color: var(--muted); font-size: .95rem; }

/* Ayuda de la demostración (se oculta con DEMO = false en validar.js) */
.vdemo {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 0; max-width: 620px;
  padding: 12px 14px; border-radius: 12px; background: var(--paper); color: var(--muted); font-size: .86rem; line-height: 1.5;
}
p.vdemo { display: block; }
.vdemo b { color: var(--ink); font-variant-numeric: tabular-nums; }
.vchip {
  border: 1.5px solid var(--field-line); background: var(--white); border-radius: 999px; padding: 5px 12px;
  font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; transition: border-color .2s, background .2s;
}
.vchip:hover { border-color: var(--brand-ink); background: #eef5f5; }

/* ---------- Registro "Tu verificación" (movimiento firma) ---------- */
.vrecord { display: flex; flex-direction: column; background: var(--ink-2); color: var(--white); padding: clamp(26px, 3vw, 36px) 28px; }
.vrecord__title { font-size: 1.4rem; margin-bottom: 20px; }
.vrecord__list { list-style: none; margin: 0; padding: 0; }
.vrecord__list li {
  display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto; column-gap: 14px;
  padding: 16px 0; border-top: 1px solid var(--line-dark);
}
.vrecord__list li:last-child { border-bottom: 1px solid var(--line-dark); }
.vrecord__mark {
  grid-row: 1 / 3; align-self: center; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px dashed rgba(255,255,255,.3); color: transparent;
}
.vrecord__mark svg { width: 15px; height: 15px; }
.vrecord__k { font-weight: 600; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-dark); }
.vrecord__v { font-size: .98rem; font-weight: 600; color: rgba(255,255,255,.5); overflow-wrap: anywhere; }
.vrecord__list li.is-done .vrecord__mark { border: 0; background: var(--brand); color: var(--white); box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); animation: vstamp .55s var(--ease) both; }
.vrecord__list li.is-done .vrecord__v { color: var(--white); }
.vrecord__list li.is-bad .vrecord__mark { background: #f2b8ab; }
.vrecord__list li.is-warn .vrecord__mark { background: #f4d68c; }
@keyframes vstamp { 0% { transform: scale(1.7); opacity: 0; } 60% { transform: scale(.9); opacity: 1; } 100% { transform: none; } }
.vfolio { display: grid; gap: 4px; margin-top: 24px; padding: 18px; border-radius: var(--radius-sm); background: rgba(255,255,255,.05); animation: vin .5s var(--ease) both; }
.vfolio__n { font-weight: 600; font-size: 1.25rem; letter-spacing: .02em; line-height: 1.3; }
.vfolio__d { font-size: .86rem; color: var(--muted-dark); }
.vfolio__copy {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 14px; border-radius: 999px;
  border: 0; background: rgba(255,255,255,.1); color: var(--white); font-size: .84rem; font-weight: 700; transition: background .2s;
}
.vfolio__copy:hover { background: rgba(255,255,255,.18); }
.vfolio__copy svg { width: 15px; height: 15px; }
.vrecord__note { margin: auto 0 0; padding-top: 24px; font-size: .84rem; line-height: 1.5; color: var(--muted-dark); }

/* ---------- Resultado ---------- */
.vstatus { display: flex; gap: 18px; align-items: flex-start; padding: 22px 24px; border-radius: var(--radius-sm); background: var(--ok-bg); color: var(--ok); }
.vstatus__icon { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ok); color: var(--white); }
.vstatus__icon svg { width: 24px; height: 24px; }
.vstatus h2 { color: var(--ink); font-size: clamp(1.5rem, 2.4vw, 2rem); }
.vstatus p { margin: 6px 0 0; color: var(--ink); max-width: 60ch; }
.vstatus--warn { background: var(--warn-bg); color: var(--warn); }
.vstatus--warn .vstatus__icon { background: var(--warn); }
.vstatus--bad { background: var(--bad-bg); color: var(--bad); }
.vstatus--bad .vstatus__icon { background: var(--bad); }
.vstatus--none { background: var(--paper); color: var(--muted); }
.vstatus--none .vstatus__icon { background: var(--ink-3); }
.vtag { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 4px; font-weight: 800; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }
.vdata { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; margin: 26px 0 0; }
.vdata > div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.vdata .is-full { grid-column: 1 / -1; }
.vdata dt { font-weight: 600; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.vdata dd { margin: 4px 0 0; font-weight: 600; font-size: 1.02rem; }
.vresult .vactions { margin-top: 26px; }

/* ---------- Debajo de la tarjeta ---------- */
.vbelow { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(32px, 6vw, 88px); padding: clamp(48px, 7vw, 80px) 0 clamp(56px, 8vw, 96px); }
.vbelow h2 { font-size: clamp(1.4rem, 2.2vw, 1.75rem); margin-bottom: 18px; }
.vlegend dl { margin: 0; }
.vstate { display: grid; grid-template-columns: 150px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.vstate:last-child { border-bottom: 1px solid var(--line); }
.vstate dt { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.vstate dd { margin: 0; color: var(--muted); }
.vdot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.vstate--warn .vdot { background: #c98a00; }
.vstate--bad .vdot { background: var(--bad); }
.vsupport p { margin: 0 0 16px; color: var(--muted); }
.vsupport__mail { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--brand-ink); text-underline-offset: 3px; overflow-wrap: anywhere; }
.vsupport__mail svg { width: 20px; height: 20px; flex: none; }
.vsupport ul { list-style: none; margin: 18px 0 0; padding: 0; }
.vsupport li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.vsupport li:last-child { border-bottom: 1px solid var(--line); }
.vsupport li span { color: var(--muted); }
.vsupport li a { font-weight: 700; text-decoration: none; font-variant-numeric: tabular-nums; }
.vsupport li a:hover { color: var(--brand-ink); }
.vsupport__hours { margin-top: 16px !important; font-size: .9rem; }

.vfoot { background: var(--ink); color: var(--muted-dark); padding: 28px 0; font-size: .88rem; }
.vfoot .vwrap { display: flex; justify-content: space-between; gap: 12px 32px; flex-wrap: wrap; }
.vfoot p { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .vcard { grid-template-columns: 1fr; }
  .vrecord__list { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 20px; }
  .vrecord__list li, .vrecord__list li:last-child { border-bottom: 1px solid var(--line-dark); }
  .vrecord__note { margin-top: 0; }
}
@media (max-width: 760px) {
  .vbelow { grid-template-columns: 1fr; }
  .vgrid { grid-template-columns: 1fr; }
  .vdata { grid-template-columns: 1fr; }
  .vstate { grid-template-columns: 1fr; gap: 4px; }
  .vband__mark { display: none; }
  .vsteps { display: flex; gap: 6px; }
  .vsteps li { flex: none; width: 42px; height: 46px; justify-content: center; padding: 10px 0; }
  .vsteps li.is-current { flex: 1; width: auto; justify-content: flex-start; gap: 8px; padding: 10px 12px; }
  .vsteps li:not(.is-current) .vsteps__t { display: none; }
  .vrecord__list { grid-template-columns: 1fr; }
  /* Registro compacto: las filas pendientes ocupan una sola línea hasta tener dato */
  .vrecord { padding: 22px 20px; }
  .vrecord__title { font-size: 1.2rem; margin-bottom: 10px; }
  .vrecord__list li:not(.is-done) { grid-template-columns: 22px auto 1fr; grid-template-rows: auto; align-items: center; padding: 10px 0; }
  .vrecord__list li:not(.is-done) .vrecord__mark { grid-row: auto; width: 22px; height: 22px; }
  .vrecord__list li:not(.is-done) .vrecord__v { justify-self: end; font-size: .9rem; }
  .vrecord__note { padding-top: 14px; }
}
@media (max-width: 520px) {
  .vhead .brand { font-size: 1.05rem; gap: 8px; }
  .vhead .brand svg { width: 30px; height: 30px; }
  .vhead__link--quiet { display: none; }
  .vhead__link { padding: 0 14px; }
  .vcard { border-radius: 18px; }
  .votp { gap: 6px; }
  .votp input { width: 100%; min-width: 0; height: 58px; font-size: 1.35rem; }
  .votp__gap { flex: none; width: 6px; }
  .vbtn { width: 100%; justify-content: center; }
  .vstatus { flex-direction: column; gap: 12px; padding: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .vpanel.is-entering, .vfolio, .vrecord__list li.is-done .vrecord__mark { animation: none; }
}

/* ---------- Constancia impresa ---------- */
@media print {
  .vhead, .vband, .vsteps, .vresult .vactions, .vbelow, .vfoot, .vdemo, .vfolio__copy, .vrecord__note { display: none !important; }
  .vpage { background: #fff; }
  .vstage { margin-top: 0; width: 100%; }
  .vcard { display: block; box-shadow: none; border: 1px solid #ccc; }
  .vrecord { background: #fff; color: #000; border-top: 1px solid #ccc; }
  .vrecord__v, .vrecord__list li.is-done .vrecord__v { color: #000; }
  .vrecord__mark { border-color: #999 !important; }
  .vfolio { background: none; border: 1px solid #ccc; }
}
