/* =========================================================================
   HANKACORP — Test de Perfil de Riesgo
   Identidad según Manual de Identidad Corporativa:
   Cromática principal: navy #1b1464 y celeste #5599ff, sobre fondo claro.
   Tipografías del manual: Baron Neue (títulos) y Avenir (texto).
   Como sustitutas web se usan Montserrat y Nunito Sans; si disponen de las
   fuentes originales, colóquenlas en assets/fonts/ y descomenten @font-face.
   ========================================================================= */

/*
@font-face {
  font-family: "Baron Neue";
  src: url("../assets/fonts/BaronNeue-Bold.woff2") format("woff2");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "Avenir";
  src: url("../assets/fonts/Avenir-Roman.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
*/

:root {
  --navy: #1b1464;          /* cromática principal */
  --celeste: #5599ff;       /* cromática principal */
  --celeste-soft: #e6efff;
  --bg: #f6f8fd;            /* matiz claro de la cromática secundaria */
  --surface: #ffffff;
  --line: #dde5f5;
  --line-strong: #ccd6ec;
  --ink: #232842;
  --muted: #5a6183;
  --faint: #8a90ad;
  --danger: #a32d2d;
  --danger-bg: #fdecec;
  --danger-line: #f0b1b1;
  --ok: #27500a;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 14px 40px rgba(27, 20, 100, 0.08);
  --font-display: "Baron Neue", "Montserrat", Arial, sans-serif;
  --font-body: "Avenir", "Nunito Sans", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 16px;
  /* Footer pegado abajo: body en columna, el <main> crece para llenar
     el espacio sobrante y empuja el footer al fondo del viewport aunque
     el contenido sea corto. Si el contenido es más alto que la pantalla,
     el footer simplemente queda después, como siempre. */
  display: flex;
  flex-direction: column;
}

.site-header { flex: 0 0 auto; }

.site-footer { flex: 0 0 auto; margin-top: auto; }

/* ---------- Encabezado ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--navy);
  padding: 16px clamp(16px, 4vw, 40px) 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: block; line-height: 0; }
.brand img { width: min(230px, 60vw); height: auto; display: block; }
.header-note {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--celeste);
}

/* ---------- Layout ---------- */
.wrap {
  width: min(640px, 100% - 32px);
  margin-inline: auto;
  padding: clamp(24px, 5vw, 48px) 0 64px;
  flex: 1 0 auto;
}
.wrap-wide { width: min(1080px, 100% - 32px); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 40px);
}

.screen { display: none; animation: fadeUp 0.35s ease both; }
.screen.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .screen, .option, .btn { animation: none !important; transition: none !important; }
}

/* ---------- Tipografía ---------- */
h1, h2, .display {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--navy);
}
h1 { font-size: clamp(25px, 5.5vw, 34px); }
h2 { font-size: clamp(19px, 4vw, 24px); }

.eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--celeste);
  margin-bottom: 12px;
}

.lead { color: var(--muted); margin: 14px 0 4px; font-size: 16.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 15.5px;
  padding: 14px 26px;
  min-height: 50px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
}
.btn:focus-visible, .option:focus-visible, input:focus-visible, a:focus-visible, select:focus-visible {
  outline: 2px solid var(--celeste);
  outline-offset: 3px;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--celeste);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(85, 153, 255, 0.35);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-ghost { border-color: var(--line-strong); color: var(--muted); background: var(--surface); }
.btn-ghost:hover { border-color: var(--celeste); color: var(--navy); }

.btn-gold {
  background: var(--navy);
  color: #ffffff;
}
.btn-gold:hover { filter: brightness(1.15); }

.btn-block { width: 100%; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.btn-row .spacer { flex: 1; }

/* ---------- Formularios ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 7px; color: var(--navy); }
.field .optional { color: var(--faint); font-weight: 400; }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="date"], select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 13px 15px;
  min-height: 50px;
  transition: border-color 0.2s ease;
}
input:focus, select:focus { border-color: var(--celeste); }
input.invalid { border-color: var(--danger); }

.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; display: none; }
.field-error.show { display: block; }

.check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
  cursor: pointer;
}
.check input {
  width: 20px; height: 20px; min-height: 0;
  accent-color: var(--navy);
  margin-top: 2px;
  flex: none;
}
.check a { color: var(--celeste); }

/* Campo trampa anti-spam: invisible para personas */
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* ---------- Progreso ---------- */
.progress { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.progress-rail {
  position: relative;
  flex: 1;
  height: 5px;
  border-radius: 5px;
  background: var(--line);
}
.progress-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  border-radius: 5px;
  background: var(--celeste);
  transition: width 0.35s ease;
}
.progress-ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; }
.progress-ticks i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  transform: translateY(-2px);
}
.progress-ticks i.done { background: var(--celeste); border-color: var(--celeste); }
.progress-label {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ---------- Cuestionario ---------- */
.question-text { margin-bottom: 22px; text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-weight: 700; color: var(--navy); font-size: clamp(17px, 4vw, 21px); }

.options { display: grid; gap: 12px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.45;
  padding: 16px 18px;
  min-height: 58px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.option:hover { border-color: var(--celeste); }
.option .letter {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  color: var(--faint);
}
.option[aria-checked="true"] {
  border-color: var(--celeste);
  background: var(--celeste-soft);
}
.option[aria-checked="true"] .letter {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
}

.quiz-alert {
  display: none;
  margin-top: 16px;
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  color: var(--danger);
  font-size: 14px;
}
.quiz-alert.show { display: block; }

/* ---------- Resultado ---------- */
.result-code {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--navy);
  background: var(--celeste-soft);
  border: 1px solid #b5d0f8;
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 16px;
}

.profile-name {
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  font-size: clamp(28px, 7vw, 40px);
  color: var(--navy);
  margin: 6px 0 10px;
  line-height: 1.15;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  color: var(--muted);
  font-size: 14px;
  margin: 14px 0 24px;
}
.result-meta b { color: var(--navy); font-variant-numeric: tabular-nums; }

.adjust-note {
  border-left: 3px solid var(--navy);
  background: #eef2fc;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px;
  font-size: 14.5px;
  color: var(--navy);
  margin: 18px 0;
  display: none;
}
.adjust-note.show { display: block; }

/* Dimensiones */
.dims { display: grid; gap: 16px; margin: 22px 0 8px; }
.dim .dim-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 14px; margin-bottom: 7px;
}
.dim .dim-val { font-variant-numeric: tabular-nums; color: var(--navy); font-weight: 800; }
.dim-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.dim-bar i {
  display: block; height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--navy), var(--celeste));
  transition: width 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.considerations { margin: 18px 0 6px; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.considerations li {
  display: flex; gap: 11px; align-items: flex-start;
  font-size: 15px; color: var(--ink);
}
.considerations li::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--celeste);
  margin-top: 8px;
  flex: none;
}

.divider { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }

.status-line { display: none; align-items: center; gap: 10px; font-size: 14.5px; margin-top: 18px; }
.status-line.show { display: flex; }
.status-line.ok { color: var(--ok); }
.status-line.err { color: var(--danger); }
.spinner {
  width: 17px; height: 17px;
  border: 2px solid rgba(85, 153, 255, 0.3);
  border-top-color: var(--celeste);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fin-icon { width: 20px; height: 20px; flex: none; color: currentColor; opacity: 0.9; }

/* ---------- Textos legales ---------- */
.prose h2 { margin: 26px 0 10px; }
.prose p, .prose li { color: var(--muted); font-size: 15px; }
.prose ul { padding-left: 20px; margin: 10px 0; }

/* ---------- Panel administrativo ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.stat .stat-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.stat .stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 25px;
  color: var(--navy);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat .stat-value.gold { color: var(--celeste); }

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: #ffffff; background: var(--navy); position: sticky; top: 0; }
tbody tr:hover { background: var(--celeste-soft); }
td .pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid var(--line-strong);
}
.pill.p0 { color: #185fa5; border-color: #b5d4f4; background: #e6f1fb; }
.pill.p1 { color: #3c3489; border-color: #cecbf6; background: #eeedfe; }
.pill.p2 { color: #0f6e56; border-color: #9fe1cb; background: #e1f5ee; }
.pill.p3 { color: #993c1d; border-color: #f5c4b3; background: #faece7; }

.row-actions { display: flex; gap: 8px; }
.link-btn {
  background: none; border: none; cursor: pointer;
  color: var(--celeste); font-size: 13.5px; font-family: var(--font-body); font-weight: 700;
  padding: 4px 6px;
}
.link-btn.danger { color: var(--danger); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(27, 20, 100, 0.45);
  display: none;
  align-items: center; justify-content: center;
  padding: 18px;
  z-index: 50;
}
.modal-backdrop.show { display: flex; }
.modal { width: min(560px, 100%); max-height: 86vh; overflow-y: auto; }
.detail-list { display: grid; gap: 9px; margin-top: 14px; font-size: 14.5px; }
.detail-list div { display: flex; justify-content: space-between; gap: 16px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Pie institucional ---------- */
.site-footer {
  background: var(--navy);
  padding: 22px clamp(16px, 4vw, 40px) 28px;
  color: #c9d6f5;
  font-size: 13px;
  text-align: center;
}
.site-footer a { color: #ffffff; text-decoration: none; }

@media (max-width: 480px) {
  .btn-row { flex-direction: column-reverse; }
  .btn-row .spacer { display: none; }
  .btn { width: 100%; }
}