/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #F0F2F5;
  color: #1A1A2E;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --green:    #217346;
  --green-d:  #185C37;
  --green-l:  #E8F5EE;
  --blue:     #1B3A6B;
  --blue-l:   #EBF0F8;
  --red:      #C0392B;
  --yellow:   #F39C12;
  --gray:     #6B7280;
  --light:    #F9FAFB;
  --border:   #D1D5DB;
  --card-bg:  #FFFFFF;
  --shadow:   0 2px 8px rgba(0,0,0,.08);
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.header {
  background: var(--blue);
  color: #fff;
  padding: 0 1.5rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: .9rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.header-icon {
  background: var(--green);
  color: #fff;
  font-size: 1.1rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -.5px;
}
.header-texts { display: flex; flex-direction: column; gap: .1rem; }
.header-title { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.header-sub   { font-size: .75rem; opacity: .7; }

/* ── Main ───────────────────────────────────────────────────────────────────── */
.main { flex: 1; padding: 2rem 1rem; }
.container { max-width: 680px; margin: 0 auto; }
.container-wide { max-width: 960px; margin: 0 auto; }

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 2rem 2.5rem;
}
@media (max-width: 520px) {
  .card { padding: 1.5rem 1.25rem; }
}

/* ── Typography ─────────────────────────────────────────────────────────────── */
h1 { font-size: 1.55rem; font-weight: 700; color: var(--blue); margin-bottom: .4rem; }
h2 { font-size: 1.15rem; font-weight: 600; color: var(--blue); margin-bottom: 1rem; }
.subtitle { color: var(--gray); font-size: .9rem; margin-bottom: 1.5rem; }
.lead { font-size: 1rem; line-height: 1.6; color: #374151; }

/* ── Divider ────────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ── Form ───────────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: #374151; margin-bottom: .4rem; }
.form-group label .req { color: var(--red); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  transition: border-color .2s;
  background: var(--light);
}
.form-control:focus { outline: none; border-color: var(--green); background: #fff; }

.error-msg {
  background: #FEF2F2;
  color: var(--red);
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .9rem;
  margin-bottom: 1.2rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .7rem 1.6rem;
  border-radius: 8px;
  border: none;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary  { background: var(--green); color: #fff; }
.btn-primary:hover  { background: var(--green-d); }
.btn-blue     { background: var(--blue); color: #fff; }
.btn-blue:hover     { background: #142d54; }
.btn-ghost    { background: transparent; color: var(--gray); border: 1.5px solid var(--border); }
.btn-ghost:hover    { background: var(--light); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover   { background: #a93226; }
.btn-sm { padding: .4rem 1rem; font-size: .82rem; }
.btn-full { width: 100%; justify-content: center; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}
.badge-green  { background: var(--green-l); color: var(--green-d); }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-gray   { background: #F3F4F6; color: var(--gray); }

/* ── Info band ──────────────────────────────────────────────────────────────── */
.info-band {
  background: var(--blue-l);
  border-left: 4px solid var(--blue);
  border-radius: 0 8px 8px 0;
  padding: .8rem 1rem;
  font-size: .88rem;
  color: #1e3a6e;
  margin-bottom: 1.5rem;
}

/* ── Progress bar ────────────────────────────────────────────────────────────── */
.progress-wrap { margin-bottom: 1.5rem; }
.progress-label { font-size: .8rem; color: var(--gray); margin-bottom: .35rem; }
.progress-bar-bg {
  background: #E5E7EB;
  border-radius: 999px;
  height: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  background: var(--green);
  height: 100%;
  border-radius: 999px;
  transition: width .3s;
}

/* ── Questions ───────────────────────────────────────────────────────────────── */
.question-block {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--light);
  transition: border-color .2s;
}
.question-block.answered { border-color: var(--green); background: var(--green-l); }
.question-num {
  font-size: .72rem;
  font-weight: 700;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .35rem;
}
.question-text {
  font-size: .97rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: .9rem;
  line-height: 1.45;
}
.question-text code {
  font-family: 'Courier New', monospace;
  background: #E5E7EB;
  padding: .05rem .3rem;
  border-radius: 4px;
  font-size: .9em;
}

/* Radio options */
.options { display: flex; flex-direction: column; gap: .5rem; }
.option-label {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem .8rem;
  border-radius: 7px;
  cursor: pointer;
  font-size: .92rem;
  border: 1.5px solid transparent;
  transition: background .15s, border-color .15s;
}
.option-label:hover { background: #fff; border-color: var(--border); }
.option-label input[type="radio"] { display: none; }
.option-label input[type="radio"]:checked ~ .opt-key {
  background: var(--green);
  color: #fff;
}
.option-label:has(input:checked) { background: #fff; border-color: var(--green); }
.opt-key {
  min-width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: #E5E7EB;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.opt-text { line-height: 1.35; }
.opt-text code {
  font-family: 'Courier New', monospace;
  background: #E5E7EB;
  padding: .05rem .3rem;
  border-radius: 4px;
  font-size: .88em;
}

/* ── Submit bar ──────────────────────────────────────────────────────────────── */
.submit-bar {
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 -2px 10px rgba(0,0,0,.07);
  z-index: 10;
}
.submit-counter { font-size: .88rem; color: var(--gray); }
.submit-counter strong { color: #111827; }

/* ── Gracias ─────────────────────────────────────────────────────────────────── */
.check-icon {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: var(--green-l);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
}
.gracias-center { text-align: center; }

/* ── Admin Panel ─────────────────────────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.stat-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
  flex: 1;
  min-width: 130px;
}
.stat-num  { font-size: 2rem; font-weight: 700; color: var(--blue); line-height: 1; }
.stat-lbl  { font-size: .78rem; color: var(--gray); margin-top: .2rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead { background: var(--blue); color: #fff; }
thead th { padding: .7rem .9rem; text-align: left; font-weight: 600; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--light); }
td { padding: .6rem .9rem; vertical-align: middle; }
td.score-cell { font-weight: 700; font-size: .95rem; }

/* ── Admin detalle ───────────────────────────────────────────────────────────── */
.detail-grid { display: flex; flex-direction: column; gap: .6rem; }
.detail-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: start;
  gap: .7rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  background: var(--light);
  font-size: .88rem;
}
.detail-row.ok    { background: var(--green-l); }
.detail-row.fail  { background: #FEF2F2; }
.detail-num { font-weight: 700; color: var(--gray); font-size: .8rem; }
.detail-mark { font-size: 1rem; }

/* ── Admin login ─────────────────────────────────────────────────────────────── */
.login-wrap { max-width: 380px; margin: 3rem auto; }

/* ── Topbar admin ────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .7rem;
}
.topbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1rem;
  font-size: .75rem;
  color: #9CA3AF;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

/* ── Utilities ───────────────────────────────────────────────────────────────── */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-gray { color: var(--gray); }
.text-sm { font-size: .85rem; }
.font-mono { font-family: 'Courier New', monospace; }
