/* ═══════════════════════════════════════════════════════════════════════════
   LMS L5 — certificates: Mis cursos (Admin + portal), the public verification
   page (portal host, no session), the course's Certificado tab, Inscritos and
   the CRM contact card. Design-system tokens only (light and the midnight-navy
   & gold dark theme). Prefix: crt-.
   ═══════════════════════════════════════════════════════════════════════════ */

/* The certificate itself is always paper-white with navy and gold, in both themes (like the PDF): the template thumbnails and the
   logo/signature previews use these on purpose. Everything else derives from the design-system tokens. */
:root {
  --crt-paper: #FFFFFF;
  --crt-ink: #06235A;
  --crt-gold: #C09000;
  --crt-rule: #D8E3EF;
}

/* ── status tones (chips, icons) ── */
.crt-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.crt-chip--ok, .crt-tone--ok { background: var(--green-100); color: var(--green-600); }
.crt-chip--warn, .crt-tone--warn { background: var(--orange-100); color: var(--orange-500); }
.crt-chip--bad, .crt-tone--bad { background: var(--red-100); color: var(--red-600); }
.crt-chip--muted, .crt-tone--muted { background: var(--gray-100); color: var(--gray-600); }
/* Small text actions (PDF, Reemitir, Revocar, Ver verificación) */
.crt-act { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 7px; border-radius: var(--r-sm);
  font: 600 12.5px var(--font-body); color: var(--blue-600); cursor: pointer; text-decoration: none; white-space: nowrap; }
.crt-act:hover { background: var(--gray-100); text-decoration: none; }
.crt-act:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 1px; }
.crt-act:disabled { opacity: .5; cursor: default; }
.crt-act i { font-size: 15px; }
.crt-act--danger { color: var(--red-500); }
.crt-code { font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; font-size: 12px; letter-spacing: .04em; color: var(--gray-700); }

/* ═════════════════ Mis cursos → Certificados ═════════════════ */
.crt-mine { display: flex; flex-direction: column; gap: 10px; }
.crt-mine__title { display: flex; align-items: center; gap: 8px; margin: 0; font: 400 20px/1.2 var(--font-display); color: var(--gray-900); }
.crt-mine__title i { color: var(--gold-500); }

.crt-pending { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--white); border: 1px solid var(--gold-300);
  border-left: 4px solid var(--gold-500); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); max-width: 640px; }
.crt-pending__head { display: flex; gap: 12px; align-items: flex-start; }
.crt-pending__icon { flex: none; width: 38px; height: 38px; border-radius: var(--r-md); background: var(--gold-100); color: var(--gold-700);
  display: flex; align-items: center; justify-content: center; font-size: 20px; }
.crt-pending__title { margin: 0; font: 700 15.5px var(--font-body); color: var(--gray-900); }
.crt-pending__sub { margin: 2px 0 0; font-size: 13px; color: var(--gray-600); line-height: 1.45; }
.crt-field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--gray-700); }
.crt-input { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--r-md);
  background: var(--gray-50); color: var(--gray-900); font: 500 16px var(--font-body); }
.crt-input:focus { outline: none; border-color: var(--gold-500); background: var(--white); }
.crt-input[aria-invalid="true"] { border-color: var(--red-500); }
.crt-hint { margin: 0; font-size: 12.5px; color: var(--gray-500); }
.crt-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.crt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.crt-item { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.crt-item__icon { flex: none; width: 38px; height: 38px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.crt-item__main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.crt-item__title { font: 600 14.5px var(--font-body); color: var(--gray-900); overflow-wrap: anywhere; }
.crt-item__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 12.5px; color: var(--gray-500); }
.crt-item__note { font-size: 12.5px; color: var(--red-600); }
.crt-item__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.crt-item__actions a, .crt-contact__row a { text-decoration: none; }

/* ═════════════════ Public verification (/verify/{code}) — light only, mobile first ═════════════════ */
.crt-verify { min-height: 100vh; box-sizing: border-box; background: var(--gray-50); color: var(--gray-900); font-family: var(--font-body);
  display: flex; flex-direction: column; align-items: center; padding: 20px 16px 32px; }
.crt-verify__wrap { width: 100%; max-width: 560px; display: flex; flex-direction: column; gap: 16px; }
.crt-verify__brand { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); }
.crt-verify__brand i { color: var(--gold-500); font-size: 18px; }
.crt-verify__card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r-xl); box-shadow: var(--shadow-md); overflow: hidden; }
.crt-verify__status { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 20px 22px; }
.crt-verify__status > i { font-size: 52px; line-height: 1; }
.crt-verify__status h1 { margin: 4px 0 0; font: 400 28px/1.15 var(--font-display); }
.crt-verify__status p { margin: 0; font-size: 14px; line-height: 1.5; max-width: 420px; opacity: .92; }
.crt-verify__status--ok { background: var(--green-100); color: var(--green-600); }
.crt-verify__status--warn { background: var(--orange-100); color: var(--orange-500); }
.crt-verify__status--bad { background: var(--red-100); color: var(--red-600); }
.crt-verify__status--muted { background: var(--gray-100); color: var(--gray-700); }
.crt-verify__current { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 9px 16px; border-radius: var(--r-md);
  background: var(--navy-900); color: var(--on-accent); font-weight: 700; font-size: 14px; text-decoration: none; }
.crt-verify__current:hover { background: var(--navy-800); color: var(--on-accent); text-decoration: none; }
.crt-verify__holder { padding: 20px 20px 4px; text-align: center; }
.crt-verify__holder small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); }
.crt-verify__holder b { display: block; margin-top: 4px; font: 400 26px/1.2 var(--font-display); color: var(--navy-900); overflow-wrap: anywhere; }
.crt-verify__facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 12px 0 0; padding: 0 20px 18px; }
.crt-verify__facts > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--gray-100); }
.crt-verify__facts dt { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--gray-500); }
.crt-verify__facts dd { margin: 0; font-size: 15px; font-weight: 600; color: var(--gray-900); overflow-wrap: anywhere; }
.crt-verify__form { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--r-xl); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.crt-verify__form label { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.crt-verify__row { display: flex; gap: 8px; }
.crt-verify__row .crt-input { flex: 1; min-width: 0; font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
.crt-verify__btn { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border: 0; border-radius: var(--r-md);
  background: var(--gold-500); color: var(--navy-900); font: 700 14px var(--font-body); cursor: pointer; }
.crt-verify__btn:hover { background: var(--gold-400); }
.crt-verify__btn:focus-visible, .crt-verify__current:focus-visible { outline: 2px solid var(--navy-900); outline-offset: 2px; }
.crt-verify__msg { font-size: 13px; color: var(--red-600); margin: 0; }
.crt-verify__foot { text-align: center; font-size: 12px; color: var(--gray-500); line-height: 1.5; }
.crt-verify__loading { display: flex; justify-content: center; gap: 8px; padding: 40px 16px; color: var(--gray-500); }
.crt-spin { display: inline-block; animation: crt-spin 1s linear infinite; }
@keyframes crt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .crt-spin { animation: none; } }
/* The static placeholder of /verify (App.razor) while WebAssembly loads; gone as soon as the interactive page is in the document. */
body:has([data-testid="verify-page"]) .crt-boot { display: none; }
@media (min-width: 560px) {
  .crt-verify { padding-top: 48px; }
  .crt-verify__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; }
  .crt-verify__facts > div.crt-wide { grid-column: 1 / -1; }
}

/* ═════════════════ Admin: Curso → Certificado ═════════════════ */
.crt-tab { display: flex; flex-direction: column; gap: 18px; }
.crt-tab > .crs-banner { margin: 0; }
.crt-label { font-size: 12px; font-weight: 600; color: var(--gray-600); margin-top: 6px; }
.crt-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.crt-tpl { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--white); border: 2px solid var(--gray-200); border-radius: var(--r-lg);
  cursor: pointer; text-align: left; font-family: var(--font-body); color: var(--gray-900); }
.crt-tpl:hover { border-color: var(--gray-300); }
.crt-tpl[aria-checked="true"] { border-color: var(--gold-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-500) 22%, transparent); }
.crt-tpl:focus-visible { outline: 2px solid var(--gold-500); outline-offset: 2px; }
.crt-tpl:disabled { cursor: default; opacity: .7; }
.crt-tpl b { font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.crt-tpl small { font-size: 12px; color: var(--gray-500); line-height: 1.35; }

/* The thumbnails are drawings of the PDF, which is always paper-white with navy and gold (the same in both themes, like the PDF itself). */
.crt-thumb { --paper: var(--crt-paper); --ink: var(--crt-ink); --gold: var(--crt-gold); --line: var(--crt-rule);
  position: relative; aspect-ratio: 11 / 8.5; background: var(--paper); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.crt-thumb span { position: absolute; display: block; border-radius: 2px; }
.crt-thumb--clasico .f1 { inset: 6%; border: 2px solid var(--ink); border-radius: 3px; }
.crt-thumb--clasico .f2 { inset: 9%; border: 1px solid var(--gold); border-radius: 2px; }
.crt-thumb--clasico .t1 { left: 32%; right: 32%; top: 24%; height: 5%; background: var(--gold); }
.crt-thumb--clasico .t2 { left: 22%; right: 22%; top: 38%; height: 9%; background: var(--ink); }
.crt-thumb--clasico .t3 { left: 30%; right: 30%; top: 55%; height: 4%; background: var(--line); }
.crt-thumb--clasico .t4 { left: 26%; width: 16%; bottom: 18%; height: 2px; background: var(--ink); }
.crt-thumb--clasico .qr { right: 16%; bottom: 14%; width: 11%; aspect-ratio: 1; background: var(--ink); }
.crt-thumb--moderno .band { left: 0; top: 0; bottom: 0; width: 26%; background: var(--ink); border-radius: 0; }
.crt-thumb--moderno .logo { left: 7%; top: 10%; width: 12%; height: 8%; background: var(--gold); }
.crt-thumb--moderno .qr { left: 6%; bottom: 10%; width: 14%; aspect-ratio: 1; background: var(--paper); }
.crt-thumb--moderno .t1 { left: 33%; width: 30%; top: 18%; height: 5%; background: var(--gold); }
.crt-thumb--moderno .t2 { left: 33%; right: 10%; top: 32%; height: 11%; background: var(--ink); }
.crt-thumb--moderno .t3 { left: 33%; right: 22%; top: 52%; height: 4%; background: var(--line); }
.crt-thumb--moderno .t4 { left: 33%; width: 18%; bottom: 16%; height: 2px; background: var(--ink); }
.crt-thumb--minimal .rule { left: 8%; right: 8%; top: 18%; height: 1px; background: var(--gold); border-radius: 0; }
.crt-thumb--minimal .t1 { left: 8%; width: 24%; top: 27%; height: 4%; background: var(--line); }
.crt-thumb--minimal .t2 { left: 8%; right: 30%; top: 38%; height: 9%; background: var(--ink); }
.crt-thumb--minimal .t3 { left: 8%; right: 40%; top: 55%; height: 4%; background: var(--line); }
.crt-thumb--minimal .t4 { left: 8%; width: 16%; bottom: 16%; height: 2px; background: var(--ink); }
.crt-thumb--minimal .qr { right: 8%; bottom: 10%; width: 11%; aspect-ratio: 1; background: var(--ink); }

.crt-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.crt-image { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px dashed var(--gray-300); border-radius: var(--r-lg); background: var(--gray-50); }
.crt-image__label { font-size: 12.5px; font-weight: 700; color: var(--gray-700); }
/* Logo and signature previews on paper (they are printed on a white page). */
.crt-image__box { height: 84px; display: flex; align-items: center; justify-content: center; background: var(--crt-paper); border: 1px solid var(--gray-200); border-radius: var(--r-md);
  color: var(--gray-400); font-size: 12.5px; overflow: hidden; }
.crt-image__box img { max-width: 92%; max-height: 72px; object-fit: contain; display: block; }
.crt-image__row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.crt-file { position: relative; overflow: hidden; }
.crt-file input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
/* The real control is the invisible file input: show its keyboard focus on the visible button. */
.crt-file:focus-within { outline: 2px solid var(--gold-500); outline-offset: 2px; }
.crt-preview { width: 100%; height: 520px; border: 1px solid var(--gray-200); border-radius: var(--r-lg); background: var(--gray-100); display: block; }
.crt-dirty { font-size: 12.5px; color: var(--gold-600); display: inline-flex; gap: 4px; align-items: center; }

/* ═════════════════ Admin: Inscritos (certificate column) ═════════════════ */
.crt-cell { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.crt-cell__line { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crt-cell__wait { font-size: 12px; color: var(--gold-600); display: inline-flex; gap: 4px; align-items: center; }
.crt-cell__actions { display: flex; gap: 2px; flex-wrap: wrap; margin-left: -7px; }

/* ═════════════════ CRM contact card ═════════════════ */
.crt-contact { display: flex; flex-direction: column; gap: 8px; }
.crt-contact__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--gray-100); }
.crt-contact__row:first-child { border-top: 0; padding-top: 0; }
.crt-contact__main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.crt-contact__main b { font-size: 13.5px; color: var(--gray-900); overflow-wrap: anywhere; }
.crt-contact__main > span { font-size: 12px; color: var(--gray-500); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
