/* ==========================================================================
   Sistema de Validación de Certificados · ACORP Capacitación
   ========================================================================== */

:root {
  --navy-950: #071033;
  --navy-900: #0A1740;
  --navy-800: #13235A;
  --navy-700: #1E3170;

  --primary: #0B4FE3;
  --primary-hover: #0942C2;
  --primary-50: #EDF3FF;
  --primary-100: #DCE7FE;
  --cyan: #1DB4E9;

  --text: #0F1B3D;
  --text-2: #4A5572;
  --text-3: #8791A7;

  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --border: #E2E7F0;
  --border-strong: #CFD6E3;

  --green: #16803C;
  --green-600: #1C9A4A;
  --green-50: #E8F6EE;
  --green-100: #D5EFDE;

  --red: #D63A32;
  --red-600: #C22F28;
  --red-50: #FDEEEE;
  --red-100: #F9DADA;

  --amber: #B86A00;
  --amber-50: #FFF6E7;
  --amber-100: #FDE9C6;

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 61, .05);
  --shadow: 0 1px 3px rgba(15, 27, 61, .06), 0 6px 18px rgba(15, 27, 61, .05);
  --shadow-lg: 0 12px 40px rgba(10, 23, 64, .18);

  --font: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Nunito", "Nunito Sans", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }

:where(svg.icon) {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn svg, .alert svg, .field__hint svg, .sidebar svg, .bottom-nav svg, .icon-tile svg,
.stat-card__icon svg, .status-circle svg, .result-card__seal svg, .secure-badge svg,
.input__action svg, .input__status svg, .modal__icon svg, .empty-page__icon svg, .combo__search svg {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.mono { font-family: var(--font-mono); font-weight: 700; letter-spacing: .01em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.only-mobile { display: none; }

:focus-visible { outline: 3px solid rgba(11, 79, 227, .35); outline-offset: 2px; }

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none !important;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn svg { width: 17px; height: 17px; }
.btn:disabled, .btn.is-loading { opacity: .65; cursor: not-allowed; }
.btn--lg { height: 52px; padding: 0 26px; font-size: 16px; border-radius: 10px; }
.btn--lg svg { width: 19px; height: 19px; }
.btn--block { width: 100%; }
.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(11, 79, 227, .25); }
.btn--primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn--outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn--outline:hover:not(:disabled) { background: var(--surface-2); border-color: #B9C2D3; }
.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover:not(:disabled) { background: var(--red-600); }
.btn--danger-outline { background: var(--surface); color: var(--red); border-color: #F1B7B4; }
.btn--danger-outline:hover { background: var(--red-50); }
.btn--icon { width: 42px; padding: 0; }

.btn.is-loading::after {
  content: "";
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Campos ---------- */

.input {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 79, 227, .14); }
.input input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
}
.input input::placeholder { color: #9AA3B5; }
.input input::-webkit-search-cancel-button { cursor: pointer; }
.input__icon { color: #7C879E; width: 18px; height: 18px; }
.input--lg { height: 52px; }
.input--lg input { font-size: 16px; }
.input__action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin-right: -8px;
  border: 0; background: none; color: #7C879E; border-radius: 6px; cursor: pointer;
}
.input__action:hover { color: var(--text); background: var(--surface-2); }
.input__action svg { width: 18px; height: 18px; }
.input__status { display: inline-flex; color: var(--green-600); }
.input__status svg { width: 18px; height: 18px; }
.input__chevron { color: #7C879E; pointer-events: none; }
.input--select input::-webkit-calendar-picker-indicator { opacity: 0; position: absolute; right: 10px; width: 24px; cursor: pointer; }
.input--readonly { background: var(--surface-2); border-color: var(--border); }
.input__static { flex: 1; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.input__static--placeholder { color: #8A94A8; font-style: italic; }

.input.is-invalid { border-color: var(--red); background: #FFF8F8; }
.input.is-invalid:focus-within { box-shadow: 0 0 0 3px rgba(214, 58, 50, .14); }
.input.is-valid { border-color: #7CCB97; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field__label { font-weight: 700; font-size: 13.5px; color: var(--text); }
.field__hint { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-top: -1px; }
.field__hint svg { width: 14px; height: 14px; }
.field__hint--ok { color: var(--green); font-weight: 600; }
.field__hint--error { color: var(--red); font-weight: 600; }
.field__hint--info { color: var(--primary); font-weight: 600; }

.form-stack { display: flex; flex-direction: column; gap: 18px; }

/* Lista desplegable con búsqueda (combo) */
.combo { position: relative; min-width: 0; }
.combo__trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 44px;
  padding: 0 12px 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.combo__trigger:hover { border-color: #B9C2D3; }
.combo.is-open .combo__trigger, .combo__trigger:focus-visible { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11, 79, 227, .14); }
.combo.has-value .combo__trigger { border-color: #9DB8F5; background: #F8FAFF; }
.combo__prefix { color: var(--text-3); white-space: nowrap; }
.combo__value { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo__chevron { color: #6B7690; transition: transform .15s; }
.combo.is-open .combo__chevron, .combo--field.is-open .input__chevron { transform: rotate(180deg); }
.input__chevron { transition: transform .15s; }

.combo__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 100%;
  min-width: 240px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 23, 64, .16), 0 2px 6px rgba(10, 23, 64, .06);
  animation: drop .14s ease-out;
}
.combo--field > .combo__panel { left: -1px; width: calc(100% + 2px); cursor: default; }
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } }
.combo__search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  margin-bottom: 6px;
  padding: 0 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #7C879E;
}
.combo__search svg { width: 16px; height: 16px; }
.combo__search:focus-within { border-color: var(--primary); background: #fff; }
.combo__search-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--text); }
.combo__list { list-style: none; margin: 0; padding: 0; max-height: 264px; overflow-y: auto; outline: 0; }
.combo__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
}
.combo__option.is-active { background: var(--primary-50); }
.combo__option.is-selected { color: var(--primary); font-weight: 700; }
.combo__option svg { width: 16px; height: 16px; color: var(--primary); fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.combo__option mark { background: #FFF1B8; color: inherit; border-radius: 2px; padding: 0 1px; }
.combo__empty { padding: 12px 10px; font-size: 13.5px; color: var(--text-3); }

/* Indicador de carga */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid var(--primary-100);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -3px;
}
.input__spinner { margin-left: 4px; }

/* ---------- Alertas y notas ---------- */

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 14px;
  font-weight: 700;
}
.alert svg { width: 18px; height: 18px; }
.alert--error { background: var(--red-50); border-color: #F4C2C0; color: #B42A23; }
.alert--success { background: var(--green-50); border-color: #B9E2C7; color: #136A33; }

.note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 14px;
  line-height: 1.5;
}
.note__icon { width: 20px; height: 20px; margin-top: 1px; }
.note--info { background: #EEF4FF; border-color: #D3E0FB; color: var(--text); }
.note--info .note__icon { color: var(--primary); }
.note--plain { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.note--plain .note__icon { color: var(--text-3); }
.note--plain strong { color: var(--text); }
.note--error { background: var(--red-50); border-color: #F4C2C0; color: #9E231D; }
.note--error .note__icon { color: var(--red); }

/* ---------- Insignias ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--active { background: var(--green-50); color: var(--green); }
.badge--inactive { background: var(--red-50); color: var(--red); }

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 10px;
  background: var(--primary-50);
  color: var(--primary);
}
.icon-tile svg { width: 20px; height: 20px; }
.icon-tile--sm { width: 34px; height: 34px; border-radius: 8px; }
.icon-tile--sm svg { width: 17px; height: 17px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.eyebrow { display: block; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }

/* Dato con ícono (nombre, RUT, curso…) */
.data-item { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.data-item__icon { width: 22px; height: 22px; margin-top: 3px; color: #56617C; stroke-width: 1.7; }
.data-item__label { display: block; font-size: 13px; color: var(--text-2); margin: 0 0 1px; }
.data-item__value { display: block; font-size: 16.5px; font-weight: 800; color: var(--text); margin: 0; overflow-wrap: anywhere; }
.data-item__value.mono { font-size: 15.5px; }
.data-item dd { margin: 0; }

/* ==========================================================================
   Web pública
   ========================================================================== */

.page-public { min-height: 100vh; display: flex; flex-direction: column; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 16px; color: var(--text); text-decoration: none !important; min-width: 0; }
.brand__logo { width: 124px; height: auto; }
.brand__divider { width: 1px; height: 30px; background: var(--border-strong); }
.brand__text { font-weight: 700; font-size: 15px; color: var(--text-2); white-space: nowrap; }
.secure-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 14px; }
.secure-badge svg { width: 16px; height: 16px; }

.validate { flex: 1; padding: 48px 20px 56px; }
.validate__inner { max-width: 960px; margin: 0 auto; }
.validate__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 40px;
  font-weight: 900;
  line-height: 1.15;
  color: var(--text);
}
.validate__title-icon { width: 40px; height: 40px; stroke-width: 2; }
.validate__subtitle { text-align: center; color: var(--text-2); font-size: 16.5px; margin-top: 10px; }

.validate-form {
  display: flex;
  gap: 12px;
  max-width: 760px;
  margin: 30px auto 0;
}
.validate-form__field { flex: 1; }
.validate-form__field input { font-size: 17px; letter-spacing: .01em; }
.validate-form__btn { min-width: 150px; }
.validate-form__error { max-width: 760px; margin: 8px auto 0; }
.field-error { color: var(--red); font-size: 13.5px; font-weight: 600; }

.validate__result { margin-top: 30px; display: flex; flex-direction: column; gap: 14px; }
.validate__result:empty { display: none; }

.result-loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 44px; color: var(--text-2); font-weight: 600;
}
.result-loading::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--primary); border-right-color: transparent; animation: spin .7s linear infinite;
}

/* Tarjeta de resultado */
.result-card {
  display: grid;
  grid-template-columns: 250px 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(10, 23, 64, .10), 0 2px 6px rgba(10, 23, 64, .06);
  overflow: hidden;
  animation: rise .35s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.result-card__aside { display: flex; align-items: center; justify-content: center; padding: 32px; }
.result-card__seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 136px;
  height: 136px;
  border-radius: 50%;
}
.result-card__seal svg { width: 58px; height: 58px; stroke-width: 1.8; }

.result-card--valid .result-card__aside { background: linear-gradient(160deg, #EAF7EF, #DDF1E4); }
.result-card--valid .result-card__seal { border: 3px dashed #7CCB97; color: var(--green); }

.result-card--notfound .result-card__aside { background: linear-gradient(160deg, #FFF8EC, #FDEBCB); }
.result-card--notfound .result-card__seal { background: #fff; color: var(--amber); width: 112px; height: 112px; box-shadow: 0 4px 16px rgba(184, 106, 0, .12); }
.result-card--notfound .result-card__seal svg { width: 50px; height: 50px; }

.result-card__body { padding: 30px 38px 32px; min-width: 0; }
.result-card__head { display: flex; align-items: center; gap: 14px; }
.result-card__title { font-size: 30px; font-weight: 800; line-height: 1.2; }
.result-card--valid .result-card__title { color: var(--green); }
.result-card--notfound .result-card__title { color: var(--amber); font-size: 26px; }
.result-card__desc { color: var(--text-2); font-size: 15.5px; margin-top: 10px; }
.result-card--notfound .result-card__desc { color: var(--text); }

.status-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  color: #fff;
}
.status-circle svg { width: 21px; height: 21px; stroke-width: 3; }
.status-circle--valid { background: var(--green-600); }
.status-circle--notfound { background: #C77A0A; width: 34px; height: 34px; }
.status-circle--notfound svg { width: 17px; height: 17px; }

.result-card__grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 26px 32px;
  margin-top: 22px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.result-card__grid--single { grid-template-columns: 1fr; }
.result-card__col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* Guía rápida */
.guide { margin-top: 34px; }
.guide__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.guide-step {
  display: flex;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.guide-step__eyebrow { display: block; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.guide-step__title { display: block; font-size: 16px; font-weight: 800; margin-top: 2px; }
.guide-step__text { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.guide__qr {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  color: var(--text-2);
}
.guide__qr strong { color: var(--text); }
.guide__qr-icon { width: 22px; height: 22px; color: var(--primary); }

.site-footer {
  padding: 18px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}
.site-footer a { color: var(--primary); font-weight: 700; }
.site-footer a:hover { color: var(--primary); text-decoration: underline; }

.empty-page { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 30px; }
.empty-page .btn { margin-top: 18px; }
.empty-page__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 84px; height: 84px; border-radius: 50%; background: var(--primary-50); color: var(--primary);
}
.empty-page__icon svg { width: 40px; height: 40px; }

/* ==========================================================================
   Login
   ========================================================================== */

.page-login { min-height: 100vh; background: #EDF0F6; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-card {
  display: grid;
  grid-template-columns: 44% 56%;
  width: 100%;
  max-width: 940px;
  min-height: 560px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.login-card__brand {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 64px 50px;
  background: var(--navy-900);
  color: #fff;
  overflow: hidden;
}
.login-card__logo { width: 190px; height: auto; }
.login-card__tagline { font-size: 25px; font-weight: 800; line-height: 1.3; margin-top: 42px; max-width: 300px; }
.login-card__note { color: #B7C1DC; font-size: 14.5px; margin-top: 16px; }
.login-card__waves { position: absolute; left: 0; bottom: 0; width: 100%; height: 44%; }

.login-card__form { display: flex; flex-direction: column; padding: 64px 70px 30px; }
.login-form-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; width: 100%; max-width: 380px; margin: 0 auto; }
.login-card__title { font-size: 30px; font-weight: 800; text-align: center; }
.login-card__subtitle { text-align: center; color: var(--text-2); font-size: 15px; margin: 8px 0 28px; }
.login-form-wrap .alert { margin-bottom: 18px; }
.login-form-wrap .btn { margin-top: 8px; }
.login-card__footer { text-align: center; color: var(--text-3); font-size: 13px; margin-top: 30px; }

/* ==========================================================================
   Panel administrativo
   ========================================================================== */

.page-admin { background: var(--bg); }
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--navy-900) 250px, var(--bg) 250px); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--navy-900);
  color: #fff;
  padding: 26px 16px 22px;
}
.sidebar__brand { display: block; padding: 0 8px; text-decoration: none !important; }
.sidebar__brand img { width: 136px; height: auto; }
.sidebar__caption { display: block; margin-top: 12px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: #8F9BC0; font-weight: 600; }
.sidebar__nav { margin-top: 30px; display: flex; flex-direction: column; gap: 6px; }
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 16px;
  border-radius: 9px;
  color: #C9D1E8;
  font-weight: 700;
  text-decoration: none !important;
  transition: background-color .15s, color .15s;
}
.sidebar__link svg { width: 19px; height: 19px; }
.sidebar__link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar__link.is-active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(11, 79, 227, .35); }
.sidebar__footer { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .1); }
.sidebar__user { display: block; padding: 6px 8px 14px; color: #fff; text-decoration: none !important; border-radius: 8px; }
.sidebar__user strong { display: block; font-size: 14.5px; }
.sidebar__user span { display: block; font-size: 13px; color: #8F9BC0; overflow: hidden; text-overflow: ellipsis; }
.sidebar__user:hover strong { text-decoration: underline; }
.sidebar__logout {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 9px;
  background: transparent;
  color: #E4E9F7;
  font-weight: 700;
  cursor: pointer;
}
.sidebar__logout svg { width: 18px; height: 18px; }
.sidebar__logout:hover { background: rgba(255, 255, 255, .06); }

.admin__main { min-width: 0; padding: 30px 34px 40px; max-width: 1320px; width: 100%; margin: 0 auto; }

.bottom-nav { display: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head__title { font-size: 28px; font-weight: 800; }
.page-head__subtitle { color: var(--text-2); margin-top: 4px; }
.page-title { font-size: 26px; font-weight: 800; margin: 6px 0 22px; }
.page-title--flush { margin-top: 0; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; }
.back-link svg { width: 16px; height: 16px; }

/* Tarjetas resumen */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 22px; }
.stat-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.stat-card__icon { display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; border-radius: 50%; flex: none; }
.stat-card__icon svg { width: 23px; height: 23px; }
.stat-card__icon--blue { background: var(--primary-50); color: var(--primary); }
.stat-card__icon--green { background: var(--green-50); color: var(--green); }
.stat-card__icon--red { background: var(--red-50); color: var(--red); }
.stat-card__label { display: block; font-size: 14px; color: var(--text-2); }
.stat-card__value { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 900; line-height: 1.15; }

/* Filtros */
.filters { display: flex; gap: 12px; padding: 14px; margin-top: 18px; }
.filters__search { flex: 1 1 42%; display: flex; gap: 10px; min-width: 0; }
.filters__search .input { flex: 1; }
.filters__toggle { display: none; position: relative; }
.filters__dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.filters__extra { display: flex; gap: 12px; flex: 1 1 58%; min-width: 0; }
.filters__extra .combo--curso { flex: 1.5; }
.filters__extra .combo--estado { flex: 1; }

/* Tabla */
.table-card { position: relative; margin-top: 18px; overflow: hidden; }
.table-card__progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 3; overflow: hidden; opacity: 0; transition: opacity .2s; }
.table-card__progress::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: 35%;
  background: linear-gradient(90deg, transparent, var(--primary), var(--cyan), transparent);
  animation: progress 1.1s ease-in-out infinite;
}
@keyframes progress { from { left: -35%; } to { left: 100%; } }
.table-card__loading {
  position: absolute; top: 58px; left: 50%; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow); font-size: 13px; font-weight: 700; color: var(--text-2);
  opacity: 0; transform: translate(-50%, -4px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.table-card.is-loading .table-card__progress { opacity: 1; }
.table-card.is-loading .table-card__loading { opacity: 1; transform: translate(-50%, 0); transition-delay: .15s; }
.table-card.is-loading tbody, .table-card.is-loading .cert-cards { opacity: .45; transition: opacity .2s .1s; pointer-events: none; }
.table__placeholder .spinner { margin-right: 8px; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  text-align: left;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFBFD; }
.table__code { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--navy-800); white-space: nowrap; }
.table__name { font-weight: 700; }
.table__nowrap { white-space: nowrap; }
.table__actions-head { text-align: left; }
.table__placeholder td, .table__empty td { text-align: center; color: var(--text-2); padding: 46px 16px !important; }
.table__empty strong { display: block; color: var(--text); font-size: 15.5px; margin-bottom: 4px; }
tr.is-inactive .table__name, tr.is-inactive .table__code { color: var(--text-2); }

.btn-png {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--primary); font-weight: 800; font-size: 13.5px;
  text-decoration: none !important; white-space: nowrap; cursor: pointer;
}
.btn-png svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-png:hover { background: var(--primary-50); border-color: #B8CCF8; }

.row-actions { display: flex; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 34px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); cursor: pointer; text-decoration: none !important;
}
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn--edit { color: var(--primary); }
.icon-btn--edit:hover { background: var(--primary-50); border-color: #B8CCF8; }
.icon-btn--off { color: var(--red); }
.icon-btn--off:hover { background: var(--red-50); border-color: #F1B7B4; }
.icon-btn--on { color: var(--green-600); }
.icon-btn--on:hover { background: var(--green-50); border-color: #A9DDBA; }
.icon-btn:disabled { opacity: .5; cursor: wait; }

.table-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.table-card__summary { color: var(--text-2); font-size: 14px; }
.table-card__summary strong { color: var(--text); }

.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-width: 36px; height: 36px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer;
}
.page-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.page-btn:hover:not(:disabled):not(.is-current) { background: var(--surface-2); }
.page-btn.is-current { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { color: #A9B1C2; cursor: default; }
.page-btn--gap { border-style: dashed; color: var(--text-3); cursor: default; }

/* Tarjetas (móvil) */
.cert-cards { display: none; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(10, 23, 64, .45); animation: fade .15s ease-out; }
body.has-modal { overflow: hidden; }
.modal__close {
  position: absolute; top: 14px; right: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-3); cursor: pointer;
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modal__dialog--qr { max-width: 400px; text-align: center; }
.modal__dialog--qr .modal__title { margin-top: 0; }
.qr-modal__who { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; font-size: 14px; color: var(--text-2); }
.qr-modal__who strong { color: var(--text); font-size: 15px; }
.qr-modal__preview { position: relative; width: 244px; height: 244px; }
.qr-modal__preview .spinner { position: absolute; width: 26px; height: 26px; border-width: 3px; }
.qr-modal__code { margin-top: 14px; font-size: 18px; color: var(--navy-900); letter-spacing: .03em; }
.qr-modal__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.modal__dialog--qr .alert { margin-top: 14px; text-align: left; font-weight: 600; font-size: 13px; align-items: flex-start; }
.alert--warning { background: var(--amber-50); border-color: #F5D9A8; color: #8A5000; }
.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 26px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  animation: rise .2s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.modal__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 50px; height: 50px; border-radius: 50%; background: var(--red-50); color: var(--red);
}
.modal__icon svg { width: 25px; height: 25px; }
.modal__title { font-size: 21px; font-weight: 800; margin-top: 16px; }
.modal__cert {
  margin-top: 14px; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; display: flex; flex-direction: column; gap: 3px;
}
.modal__cert .mono { font-size: 13px; }
.modal__text { margin-top: 14px; font-size: 14px; color: var(--text-2); line-height: 1.55; }
.modal__text strong { color: var(--text); }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 260px; max-width: 380px;
  padding: 13px 16px;
  background: var(--navy-900); color: #fff;
  border-radius: 10px; box-shadow: var(--shadow-lg);
  font-weight: 700; font-size: 14px;
  animation: rise .2s ease-out;
}
.toast svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast--success svg { color: #6EE7A0; }
.toast--error { background: #8F1D17; }

/* Formulario */
.form-layout { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.form-card { padding: 26px; }
.form-card .alert { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px 20px; }
.field--full { grid-column: 1 / -1; }
.estado-line { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.estado-line__text { font-size: 13.5px; color: var(--text-2); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
form[aria-busy="true"] { opacity: .55; pointer-events: none; }

.side-card { padding: 24px; }
.side-card__title { font-size: 17px; font-weight: 800; }
.side-card .icon-tile + .side-card__title { margin-top: 16px; }
.side-card__text { color: var(--text-2); font-size: 14px; margin-top: 8px; line-height: 1.6; }
.save-steps { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.save-steps li { display: flex; gap: 12px; }
.save-steps strong { display: block; font-size: 14.5px; }
.save-steps span:not(.icon-tile) { display: block; font-size: 13px; color: var(--text-2); margin-top: 1px; }

.qr-preview {
  display: flex; align-items: center; justify-content: center;
  margin: 18px auto 0;
  width: 228px; height: 228px; max-width: 100%;
  padding: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
}
.qr-preview img { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-preview--sm { width: 176px; height: 176px; }
.qr-url { text-align: center; margin-top: 10px; font-size: 12px; font-weight: 500; color: var(--text-2); overflow-wrap: anywhere; }

/* Detalle / certificado creado */
#created-alert { margin-bottom: 20px; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, 1fr); gap: 20px; align-items: start; }
.detail-layout[aria-busy="true"] { opacity: .5; }
.detail-card { padding: 28px 30px; }
.detail-card__code { font-size: 34px; font-weight: 700; letter-spacing: .03em; color: var(--navy-900); margin-top: 8px; overflow-wrap: anywhere; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; margin: 0; }
.detail-card__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.qr-card { padding: 24px; text-align: center; }
.qr-card__title { font-size: 17px; font-weight: 800; }
.qr-card__subtitle { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.qr-card .btn { margin-top: 16px; }
.qr-card__file { margin-top: 8px; font-size: 12px; font-weight: 500; color: var(--text-3); }

/* Cuenta */
.account-card { padding: 6px 24px; max-width: 560px; }
.account-card__list { margin: 0; }
.account-card__list > div { padding: 16px 0; border-bottom: 1px solid var(--border); }
.account-card__list > div:last-child { border-bottom: 0; }
.account-card__list dt { font-size: 13px; color: var(--text-2); }
.account-card__list dd { margin: 2px 0 0; font-weight: 800; font-size: 16px; }
.account-logout { max-width: 560px; margin-top: 16px; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1180px) {
  .filters { flex-wrap: wrap; }
  .filters__search, .filters__extra { flex-basis: 100%; }
  .form-layout, .detail-layout { grid-template-columns: 1fr; }
  .side-card, .qr-card { max-width: 640px; }
}

@media (max-width: 900px) {
  .only-desktop { display: none; }
  .only-mobile { display: inline; }

  /* Panel: sin barra lateral, con barra inferior */
  .admin { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar { display: none; }
  .admin__main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
    background: var(--navy-900);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 20px rgba(10, 23, 64, .2);
  }
  .bottom-nav__item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 4px 0; border: 0; background: none; cursor: pointer;
    color: #B7C1DC; font-size: 12px; font-weight: 700; text-decoration: none !important;
  }
  .bottom-nav__icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 30px; border-radius: 999px; }
  .bottom-nav__icon svg { width: 20px; height: 20px; }
  .bottom-nav__item.is-active { color: #fff; }
  .bottom-nav__item.is-active .bottom-nav__icon { background: var(--primary); }
  .bottom-nav__item--danger { color: #FF8F87; }

  .page-head { align-items: center; }
  .page-head__title { font-size: 24px; }
  .page-head__subtitle { display: none; }
  .page-head__action { height: 36px; padding: 0 14px; }

  .stats { display: none; }

  .filters { padding: 0; margin-top: 14px; background: none; border: 0; box-shadow: none; }
  .filters__toggle { display: inline-flex; }
  .filters__extra { display: none; flex-direction: column; background: var(--surface); padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
  .filters.is-open .filters__extra { display: flex; }

  .table-card { background: none; border: 0; box-shadow: none; overflow: visible; margin-top: 14px; }
  .table-scroll { display: none; }
  .cert-cards { display: flex; flex-direction: column; gap: 12px; }
  .cert-card {
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
  }
  .cert-card__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .cert-card__code { font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; color: var(--navy-800); }
  .cert-card__name { font-weight: 800; font-size: 16px; margin-top: 8px; }
  .cert-card__meta { font-size: 13px; color: var(--text-2); margin-top: 2px; }
  .cert-card__actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
  .cert-card__actions .btn { height: 36px; padding: 0 8px; font-size: 13px; }
  .cert-card__actions .btn--outline.is-edit { color: var(--primary); }
  .cert-card__actions .btn--outline.is-off { color: var(--red); }
  .cert-card__actions .btn--outline.is-on { color: var(--green); }
  .cert-cards__empty { padding: 36px 16px; text-align: center; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
  .cert-cards__empty strong { display: block; color: var(--text); }

  .table-card__footer { flex-direction: column; border: 0; padding: 16px 0 0; }
  .pagination { justify-content: center; }

  .form-card, .side-card, .detail-card, .qr-card { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 16px; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .page-title { font-size: 22px; margin: 4px 0 16px; }
  .detail-card__code { font-size: 25px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-card__actions .btn { flex: 1 1 auto; }

  .toasts { left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
}

@media (max-width: 760px) {
  /* Web pública en celular */
  .site-header__inner { padding: 12px 16px; }
  .brand__logo { width: 100px; }
  .brand__divider, .brand__text, .secure-badge span { display: none; }

  .validate { padding: 26px 16px 36px; }
  .validate__title { justify-content: flex-start; font-size: 25px; gap: 10px; }
  .validate__title-icon { width: 26px; height: 26px; }
  .validate__subtitle { text-align: left; font-size: 14.5px; margin-top: 6px; }
  .validate-form { flex-direction: column; margin-top: 18px; gap: 10px; }
  .validate-form__field { flex: none; }
  .validate-form__btn { width: 100%; }
  .validate__result { margin-top: 18px; }

  .result-card { grid-template-columns: 1fr; }
  .result-card__aside { display: none; }
  .result-card__body { padding: 0; }
  .result-card__head {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 22px 18px 6px;
  }
  .result-card--notfound .result-card__head { padding-bottom: 18px; }
  .result-card--valid .result-card__head { background: linear-gradient(180deg, #EAF7EF, #E1F3E7); }
  .result-card--notfound .result-card__head { background: linear-gradient(180deg, #FFF7EA, #FDEFD4); }
  .status-circle, .status-circle--notfound { width: 46px; height: 46px; }
  .status-circle svg { width: 24px; height: 24px; }
  .result-card__title, .result-card--notfound .result-card__title { font-size: 21px; }
  .result-card__desc { margin: 0; font-size: 13.5px; }
  .result-card--valid .result-card__desc { text-align: center; padding: 0 18px 18px; background: #E1F3E7; }
  .result-card--notfound .result-card__desc { padding: 14px 18px; margin: 0 18px; padding-left: 0; padding-right: 0; border-bottom: 1px solid var(--border); font-size: 14px; }
  .result-card__grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0;
    padding: 4px 18px 8px;
    border-top: 0;
  }
  .result-card__col { gap: 0; }
  .result-card__grid .data-item { padding: 13px 0; border-bottom: 1px solid var(--border); }
  .result-card__grid .result-card__col:last-child .data-item:last-child,
  .result-card__grid--single .data-item { border-bottom: 0; }
  .data-item__value { font-size: 15.5px; }

  .guide { margin-top: 20px; }
  .guide__steps { grid-template-columns: 1fr; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
  .guide-step { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; padding: 14px 16px; align-items: center; }
  .guide-step:last-child { border-bottom: 0; }
  .guide-step .icon-tile { width: 34px; height: 34px; }
  .guide-step__eyebrow { display: none; }
  .guide-step__title { font-size: 14.5px; margin-top: 0; }
  .guide-step__text { font-size: 13px; margin-top: 1px; }
  .guide__qr { align-items: flex-start; font-size: 13px; padding: 12px 16px; }
  .site-footer { font-size: 12.5px; }

  /* Login en celular: banda azul superior y formulario debajo */
  .page-login { background: var(--surface); }
  .login { padding: 0; align-items: stretch; }
  .login-card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100vh; border-radius: 0; box-shadow: none; }
  .login-card__brand { padding: 30px 22px 28px; }
  .login-card__logo { width: 136px; }
  .login-card__tagline { font-size: 18px; margin-top: 18px; max-width: none; }
  .login-card__note, .login-card__waves { display: none; }
  .login-card__form { padding: 28px 22px 24px; }
  .login-form-wrap { justify-content: flex-start; max-width: none; }
  .login-card__title { text-align: left; font-size: 24px; }
  .login-card__subtitle { text-align: left; margin-bottom: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Escáner de QR (web pública)
   ========================================================================== */

.input__action--scan { width: 40px; height: 40px; color: var(--primary); }
.input__action--scan svg { width: 22px; height: 22px; }
.input__action--scan:hover { color: var(--primary-hover); background: var(--primary-50); }

.scanner__dialog { max-width: 420px; text-align: center; }
.scanner__dialog .modal__title { margin-top: 0; }
.scanner__subtitle { color: var(--text-2); font-size: 14px; margin-top: 6px; }

.scanner__viewport {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 1 / 1;
  margin: 18px auto 0;
  overflow: hidden;
  border-radius: 16px;
  background: var(--navy-900);
}
.scanner__viewport video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner__viewport video.is-mirrored { transform: scaleX(-1); }

.scanner__frame {
  position: absolute;
  inset: 16%;
  --c: #fff;
  --l: 30px;
  --t: 4px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) top left / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) top right / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) bottom left / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) bottom right / var(--t) var(--l);
  background-repeat: no-repeat;
  box-shadow: 0 0 0 999px rgba(7, 16, 51, .38);
  border-radius: 6px;
  opacity: 0;
  transition: opacity .2s;
}
.scanner.is-streaming .scanner__frame { opacity: 1; }
.scanner__line {
  position: absolute;
  left: 8%;
  right: 8%;
  height: 2px;
  background: var(--cyan);
  box-shadow: 0 0 12px 2px rgba(29, 180, 233, .7);
  border-radius: 2px;
  animation: scanline 2.2s ease-in-out infinite alternate;
}
@keyframes scanline { from { top: 6%; } to { top: 94%; } }

.scanner__state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: #DDE4F5;
}
.scanner__state-text { font-size: 14px; line-height: 1.5; max-width: 260px; }
.scanner__spinner { width: 28px; height: 28px; border-width: 3px; border-color: rgba(255, 255, 255, .2); border-top-color: #fff; }
.scanner__state-icon { display: none; color: #FFB4AE; }
.scanner__state-icon svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.scanner__state[data-kind="error"] .scanner__spinner { display: none; }
.scanner__state[data-kind="error"] .scanner__state-icon { display: inline-flex; }

.scanner__status { min-height: 21px; margin-top: 12px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.scanner__status.is-warning { color: #9A5B00; }
.scanner__upload { margin-top: 12px; cursor: pointer; }
.scanner__upload:focus-within { box-shadow: 0 0 0 3px rgba(11, 79, 227, .2); }

@media (max-width: 760px) {
  .scanner .modal__dialog { padding: 22px 18px; }
}
