:root {
  --ink: #16302E; --ink-soft: #3E5250; --ground: #FBF8F2; --surface: #FFFFFF; --surface-tint: #F1ECE0;
  --line: #DDD5C3; --teal: #0B6E63; --teal-deep: #0A4B45; --teal-tint: #E4F1EE;
  --amber: #C1832A; --amber-tint: #FBF0DC; --coral: #A8402F; --coral-tint: #FBEAE5;
  --focus: #1E8A7C; --shadow: 0 1px 2px rgba(22,48,46,0.06), 0 8px 24px -12px rgba(22,48,46,0.18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #EAF2F0; --ink-soft: #AEC4C0; --ground: #0E211F; --surface: #142C29; --surface-tint: #1B3733;
    --line: #2B4B46; --teal: #4FBFAE; --teal-deep: #8ED9CC; --teal-tint: #1B3D38; --amber: #E3B15C;
    --amber-tint: #2E2515; --coral: #E58975; --coral-tint: #33201B; --focus: #6FD3C2;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px -12px rgba(0,0,0,0.55);
  }
}
:root[data-theme="dark"] {
  --ink: #EAF2F0; --ink-soft: #AEC4C0; --ground: #0E211F; --surface: #142C29; --surface-tint: #1B3733;
  --line: #2B4B46; --teal: #4FBFAE; --teal-deep: #8ED9CC; --teal-tint: #1B3D38; --amber: #E3B15C;
  --amber-tint: #2E2515; --coral: #E58975; --coral-tint: #33201B; --focus: #6FD3C2;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px -12px rgba(0,0,0,0.55);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--ground); color: var(--ink); font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif; font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: "Fraunces", ui-serif, Georgia, serif; text-wrap: balance; color: var(--ink); margin: 0; }
h4 { font-family: "IBM Plex Sans", sans-serif; margin: 0; color: var(--ink); }
.measure { max-width: 68ch; }
a { color: var(--teal-deep); }
button { font-family: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
p { margin: 0 0 14px; }
ul.plain, ol.plain { margin: 0 0 14px; padding-left: 1.3em; }
ul.plain li, ol.plain li { margin-bottom: 8px; }
[hidden] { display: none !important; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 640px; margin: 0 auto; padding: 0 24px; }

.topnav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--ground) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topnav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; max-width: 1080px; margin: 0 auto; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 8px; font-family: "Fraunces", serif; font-weight: 600; font-size: 1.02rem; text-decoration: none; color: var(--ink); }
.brand small { font-family: "IBM Plex Sans", sans-serif; font-weight: 500; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.nav-links { display: flex; align-items: center; gap: 18px; font-size: .88rem; }
.nav-links a { color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.nav-links a:hover { color: var(--teal-deep); }
.nav-links .user-name { color: var(--ink); font-weight: 600; }

.hero { padding: 40px 0 28px; }
.kicker { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--amber); margin-bottom: 10px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 600; }
.hero p.lede { margin-top: 12px; font-size: 1.02rem; color: var(--ink-soft); }

section.block { padding: 34px 0; border-top: 1px solid var(--line); }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal); margin-bottom: 8px; }
h2.title { font-size: clamp(1.3rem, 3vw, 1.6rem); font-weight: 600; margin-bottom: 6px; }
.lede-sm { color: var(--ink-soft); margin-top: 8px; }

.callout { background: var(--teal-tint); border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line)); border-radius: 10px; padding: 16px 18px; margin: 18px 0; font-size: .93rem; }
.callout strong { color: var(--teal-deep); }
.callout.warn { background: var(--amber-tint); border-color: color-mix(in srgb, var(--amber) 35%, var(--line)); }
.callout.warn strong { color: var(--amber); }
.callout.danger { background: var(--coral-tint); border-color: color-mix(in srgb, var(--coral) 30%, var(--line)); }
.callout.danger strong { color: var(--coral); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table.data-table { border-collapse: collapse; width: 100%; font-size: .86rem; min-width: 420px; }
table.data-table th, table.data-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data-table th { background: var(--surface-tint); font-weight: 600; color: var(--ink); }
table.data-table tr:last-child td { border-bottom: none; }

.glossary { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.glossary span { font-size: .78rem; font-family: "IBM Plex Mono", monospace; background: var(--surface-tint); border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; color: var(--ink-soft); }

.case-card { background: var(--surface-tint); border-left: 3px solid var(--amber); border-radius: 0 10px 10px 0; padding: 16px 18px; margin: 18px 0; font-size: .93rem; }
.case-card .lab { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--amber); margin-bottom: 8px; }

.btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .95rem; padding: 12px 22px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; background: var(--teal); color: var(--surface); box-shadow: var(--shadow); transition: transform .12s ease, filter .12s ease; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--teal-deep); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-tint); }
.btn.sm { padding: 8px 16px; font-size: .85rem; }
.btn.danger { background: var(--coral); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field select, .field textarea { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--ground); color: var(--ink); }
.field input:focus, .field select:focus { border-color: var(--teal); }
.field .hint { font-size: .78rem; color: var(--ink-soft); }
.start-card, .auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); max-width: 440px; }

.flash { border-radius: 10px; padding: 14px 16px; margin: 0 0 20px; font-size: .92rem; }
.flash.error { background: var(--coral-tint); color: var(--coral); }
.flash.success { background: var(--teal-tint); color: var(--teal-deep); }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.badge.pending { background: var(--amber-tint); color: var(--amber); }
.badge.approved { background: var(--teal-tint); color: var(--teal-deep); }
.badge.rejected { background: var(--coral-tint); color: var(--coral); }
.badge.locked { background: var(--surface-tint); color: var(--ink-soft); }
.badge.passed { background: var(--teal-tint); color: var(--teal-deep); }

/* ---------- dashboard módulos ---------- */
.module-track { list-style: none; margin: 24px 0 0; padding: 0; display: grid; gap: 10px; }
.module-row { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.module-row.locked { opacity: .55; }
.module-row .num { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-family: "IBM Plex Mono", monospace; font-weight: 700; background: var(--surface-tint); color: var(--ink-soft); }
.module-row.passed .num { background: var(--teal); color: var(--surface); }
.module-row .info { flex: 1; }
.module-row .info h3 { font-size: 1rem; }
.module-row .info p { margin: 2px 0 0; font-size: .82rem; color: var(--ink-soft); }
.module-row .action { flex: none; }

/* ---------- checkpoint (quiz / orden) ---------- */
.checkpoint-box { margin-top: 34px; padding: 22px; border-radius: 12px; background: var(--surface-tint); border: 1px dashed color-mix(in srgb, var(--amber) 45%, var(--line)); }
.checkpoint-badge { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--amber); background: var(--amber-tint); padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.checkpoint-box h4 { font-size: 1rem; margin-bottom: 6px; }
.checkpoint-note { font-size: .88rem; color: var(--ink-soft); }
.checkpoint-score { margin-top: 14px; font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: .92rem; }

.order-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; font-size: .9rem; }
.order-item select { font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--ground); color: var(--ink); font-family: "IBM Plex Mono", monospace; font-weight: 700; flex: none; width: 66px; }
.order-item.correct { background: var(--teal-tint); border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }
.order-item.wrong { background: var(--coral-tint); border-color: color-mix(in srgb, var(--coral) 35%, var(--line)); }

.q { padding: 20px 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: none; padding-top: 4px; }
.q-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 12px; }
.q-num { font-family: "IBM Plex Mono", monospace; font-weight: 600; color: var(--teal); font-size: .85rem; flex: none; }
.q-text { font-weight: 600; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.opt:hover { background: var(--surface-tint); }
.opt input { margin-top: 3px; accent-color: var(--teal); }
.opt.correct { background: var(--teal-tint); }
.opt.wrong { background: var(--coral-tint); }

.result-badge { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; padding: 8px 16px; border-radius: 999px; font-size: 1.05rem; }
.result-badge.pass { background: var(--teal-tint); color: var(--teal-deep); }
.result-badge.fail { background: var(--coral-tint); color: var(--coral); }

.cert { position: relative; background: var(--surface); border: 2px solid var(--teal); border-radius: 4px; padding: 52px 44px; text-align: center; overflow: hidden; }
.cert::before, .cert::after { content: ""; position: absolute; inset: 12px; border: 1px solid var(--amber); border-radius: 2px; pointer-events: none; }
.cert::after { inset: 16px; border-width: 1px; opacity: .5; }
.cert .mark { font-size: .75rem; letter-spacing: .18em; text-transform: uppercase; color: var(--amber); font-weight: 700; }
.cert h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 10px 0 4px; }
.cert .name { font-family: "Fraunces", serif; font-size: clamp(1.5rem, 4.5vw, 2.2rem); font-weight: 600; color: var(--teal-deep); margin: 18px 0 6px; border-bottom: 2px solid var(--line); display: inline-block; padding-bottom: 8px; }
.cert .role { color: var(--ink-soft); font-size: .95rem; margin-bottom: 22px; }
.cert .body-text { max-width: 48ch; margin: 0 auto 22px; color: var(--ink-soft); }
.cert .score { font-family: "IBM Plex Mono", monospace; font-weight: 600; color: var(--ink); }
.cert-foot { display: flex; justify-content: space-between; margin-top: 30px; gap: 20px; flex-wrap: wrap; }
.cert-sig { text-align: center; font-size: .82rem; color: var(--ink-soft); }
.cert-sig .line { width: 190px; border-top: 1px solid var(--ink-soft); margin: 0 auto 6px; padding-top: 4px; }
.cert-corner { position: absolute; top: 0; left: 0; width: 0; height: 0; border-style: solid; border-width: 80px 80px 0 0; border-color: var(--teal) transparent transparent transparent; opacity: .9; }
.cert-corner.br { top: auto; bottom: 0; left: auto; right: 0; border-width: 0 0 80px 80px; border-color: transparent transparent var(--amber) transparent; }
.cert-meta { font-size: .78rem; color: var(--ink-soft); margin-top: 6px; }
.cert-folio { font-family: "IBM Plex Mono", monospace; font-size: .72rem; letter-spacing: .04em; color: var(--ink-soft); text-align: center; margin-top: 18px; }

/* ---------- curso: sidebar + contenido ---------- */
.course-shell { display: grid; grid-template-columns: 280px 1fr; gap: 28px; align-items: start; }
@media (max-width: 860px) { .course-shell { grid-template-columns: 1fr; } }
.nav-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow); position: sticky; top: 76px; }
@media (max-width: 860px) { .nav-card { position: static; } }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.side-list a { display: block; padding: 8px 10px; border-radius: 9px; font-size: .84rem; font-weight: 500; color: var(--ink-soft); text-decoration: none; }
.side-list a:hover { background: var(--surface-tint); }
.side-list a.active { background: var(--teal-tint); color: var(--teal-deep); font-weight: 700; }
.content-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: var(--shadow); min-height: 320px; }
.content-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }

/* ---------- admin ---------- */
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th, .admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table th { background: var(--surface-tint); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; box-shadow: var(--shadow); }
.switch-row .label { font-weight: 600; }
.switch-row .sub { font-size: .82rem; color: var(--ink-soft); margin-top: 2px; }

footer.page { padding: 40px 0 60px; color: var(--ink-soft); font-size: .82rem; border-top: 1px solid var(--line); }

@media print {
  .topnav, .hero, footer.page, .no-print { display: none !important; }
  body { background: #fff; }
}
