:root {
  --bg: #050e17;
  --panel: #0b1a2b;
  --panel-2: #0f2438;
  --text: #e8f2fb;
  --soft: #c8d7e4;
  --muted: #8da5b8;
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .18);
  --accent: #19c6d3;
  --accent-dark: #0f9faf;
  --accent-soft: #67e8f9;
  --blue: #2ba6e0;
  --blue-light: #62c4f2;
  --green: #28c978;
  --warning: #ffd166;
  --warning-bg: rgba(255, 209, 102, .12);
  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, .12);
  --success: #28c978;
  --success-bg: rgba(40, 201, 120, .12);
  --info-bg: rgba(43, 166, 224, .12);
  --shadow: 0 30px 90px rgba(0, 0, 0, .45);
  --radius: 28px;
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box
}

html {
  min-height: 100%;
  scroll-behavior: smooth
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(circle at 78% 10%, rgba(43, 166, 224, .24), transparent 32%), radial-gradient(circle at 10% 32%, rgba(25, 198, 211, .13), transparent 28%), linear-gradient(180deg, var(--bg), #06111d 44%, var(--bg));
  overflow-x: hidden
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .8), transparent 72%);
  z-index: -1
}

img {
  display: block;
  max-width: 100%
}

a {
  color: inherit;
  text-decoration: none
}

button,
input {
  font: inherit
}

.d-none {
  display: none !important
}

.auth-page {
  width: min(100% - 40px, 520px);
  min-height: calc(100vh - 76px);
  margin-inline: auto;
  display: grid;
  place-items: center;
  padding: 42px 0 30px
}

.auth-page-wide {
  width: min(100% - 40px, 980px)
}

.auth-card {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 42px;
  background: radial-gradient(circle at 84% 10%, rgba(25, 198, 211, .22), transparent 34%), linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .04));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden
}

.auth-card-wide {
  padding: 0;
  display: grid;
  grid-template-columns: .42fr .58fr
}

.auth-card::before {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  right: -180px;
  top: -160px;
  background: radial-gradient(circle, rgba(43, 166, 224, .30), transparent 64%);
  pointer-events: none
}

.auth-card::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, .055);
  border-radius: 22px;
  pointer-events: none
}

.auth-logo,
.card-header,
.alert,
.login-form,
.auth-links,
.create-account-box,
.form-panel,
.brand-panel,
.success-panel {
  position: relative;
  z-index: 1
}

.auth-logo {
  display: inline-flex;
  align-items: center;
  margin-bottom: 34px
}

.auth-logo img {
  height: 38px;
  width: auto;
  object-fit: contain
}

.brand-panel {
  padding: 34px;
  border-right: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(15, 36, 56, .60), rgba(5, 14, 23, .18));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px
}

.brand-panel .brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  margin-bottom: 36px
}

.brand-panel h1,
.brand-panel h2 {
  margin: 18px 0 0;
  font-size: clamp(34px, 4vw, 50px);
  line-height: 1.02;
  letter-spacing: -.055em
}

.brand-panel p,
.brand-note {
  color: var(--soft);
  line-height: 1.65;
  margin: 14px 0 0
}

.form-panel {
  padding: 38px
}

.secure-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  margin-bottom: 18px;
  background: rgba(43, 166, 224, .12);
  border: 1px solid rgba(98, 196, 242, .22);
  color: var(--accent-soft);
  box-shadow: 0 16px 38px rgba(25, 198, 211, .12)
}

.secure-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase
}

.live-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(40, 201, 120, .11)
}

.card-header h1,
.card-header h2 {
  margin: 16px 0 0;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.04;
  letter-spacing: -.055em
}

.card-header p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 15px
}

.section-title {
  margin: 28px 0 14px;
  color: var(--accent-soft);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase
}

.alert {
  display: block;
  margin-top: 20px;
  padding: 13px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
  border: 1px solid transparent
}

.alert-warning {
  color: #ffe7a3;
  background: var(--warning-bg);
  border-color: rgba(255, 209, 102, .28)
}

.alert-danger {
  color: #ffc7c7;
  background: var(--danger-bg);
  border-color: rgba(255, 107, 107, .28)
}

.alert-success {
  color: #aaf4cf;
  background: var(--success-bg);
  border-color: rgba(40, 201, 120, .28)
}

.alert-info {
  color: #bfeeff;
  background: var(--info-bg);
  border-color: rgba(43, 166, 224, .28)
}

.login-form,
.stack-form {
  display: grid;
  gap: 18px;
  margin-top: 28px
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px
}

.span-2 {
  grid-column: span 2
}

.field {
  display: grid;
  gap: 8px;
  color: var(--soft);
  font-size: 14px;
  font-weight: 800
}

.form-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 2px
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(5, 14, 23, .62);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease
}

.input-wrap:focus-within {
  border-color: rgba(103, 232, 249, .60);
  box-shadow: 0 0 0 4px rgba(25, 198, 211, .12);
  background: rgba(5, 14, 23, .78)
}

.input-wrap svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--blue-light);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px
}

.input-wrap input::placeholder {
  color: rgba(200, 215, 228, .48)
}

.plain-input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(5, 14, 23, .62);
  color: var(--text);
  outline: 0
}

.plain-input:focus {
  border-color: rgba(103, 232, 249, .60);
  box-shadow: 0 0 0 4px rgba(25, 198, 211, .12)
}

.verification-code {
  font-size: 26px;
  letter-spacing: 10px;
  text-align: center;
  font-weight: 900
}

.hp-field {
  position: absolute;
  left: -5000px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none
}

.form-check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55
}

.form-check input {
  margin-top: 3px;
  accent-color: var(--accent)
}

.form-check a,
.auth-links a,
.inline-link {
  color: var(--accent-soft);
  font-weight: 800
}

.form-check a:hover,
.auth-links a:hover,
.inline-link:hover {
  color: #fff
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px
}

.form-actions-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 26px
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 14px 20px;
  border-radius: 15px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease
}

.btn:hover {
  transform: translateY(-2px)
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #04111b;
  box-shadow: 0 16px 38px rgba(25, 198, 211, .28)
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-dark));
  box-shadow: 0 20px 46px rgba(25, 198, 211, .38);
  color: #031018
}

.btn-secondary,
.btn-outline-secondary {
  background: rgba(255, 255, 255, .06);
  border-color: var(--line);
  color: var(--text)
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
  background: rgba(255, 255, 255, .10);
  border-color: var(--line-strong)
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #18a86b);
  color: #04111b
}

.btn-create {
  width: 100%;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(103, 232, 249, .35);
  color: var(--text)
}

.btn-create:hover {
  background: rgba(25, 198, 211, .12);
  border-color: rgba(103, 232, 249, .70);
  color: #fff
}

.auth-links {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
  color: var(--muted);
  font-size: 14px
}

.create-account-box {
  margin-top: 26px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .045);
  text-align: center
}

.create-account-box p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5
}

.success-panel {
  text-align: center
}

.success-icon {
  width: 66px;
  height: 66px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: rgba(40, 201, 120, .14);
  border: 1px solid rgba(40, 201, 120, .28);
  color: var(--success);
  font-size: 34px;
  font-weight: 900
}

.success-panel h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -.04em
}

.success-panel p {
  color: var(--muted);
  line-height: 1.6
}

.auth-footer {
  width: min(100% - 40px, 980px);
  margin: 0 auto;
  padding: 0 0 26px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px
}

.legal-page {
  width: min(100% - 40px, 940px);
  margin-inline: auto;
  padding: 42px 0
}

.legal-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 42px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .075), rgba(255, 255, 255, .04));
  box-shadow: var(--shadow)
}

.legal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
  margin-bottom: 28px
}

.legal-header img {
  height: 34px
}

.legal-header h1 {
  margin: 16px 0 8px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.04;
  letter-spacing: -.055em
}

.legal-header p,
.legal-content p,
.legal-content li {
  color: var(--muted);
  line-height: 1.75
}

.legal-content .notice {
  border: 1px solid rgba(103, 232, 249, .28);
  background: rgba(25, 198, 211, .10);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 28px;
  color: var(--soft);
  line-height: 1.6
}

.legal-content h2 {
  font-size: 22px;
  letter-spacing: -.025em;
  margin: 30px 0 10px;
  color: var(--text)
}

.legal-content a {
  color: var(--accent-soft);
  font-weight: 800
}

/* Índice de secciones de los documentos legales versionados */
.legal-content .legal-toc {
  border: 1px solid rgba(103, 232, 249, .18);
  border-radius: 18px;
  padding: 14px 18px;
  margin-bottom: 28px;
  color: var(--soft)
}

.legal-content .legal-toc ol {
  margin: 8px 0 0;
  padding-left: 22px
}

.legal-content .legal-toc li {
  line-height: 1.6
}

.legal-content .legal-toc a {
  font-weight: 600;
  text-decoration: none
}

.legal-content h2 {
  scroll-margin-top: 16px
}

.legal-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 34px;
  padding-top: 22px;
  color: var(--muted)
}

@media (max-width:760px) {

  .auth-page,
  .auth-page-wide,
  .auth-footer,
  .legal-page {
    width: min(100% - 28px, 980px)
  }

  .auth-page {
    min-height: calc(100vh - 82px);
    padding: 26px 0 22px
  }

  .auth-card {
    padding: 28px 22px;
    border-radius: 24px
  }

  .auth-card-wide {
    display: block;
    padding: 0
  }

  .auth-card::after {
    inset: 12px;
    border-radius: 19px
  }

  .auth-logo {
    margin-bottom: 28px
  }

  .auth-logo img,
  .brand-panel .brand-logo {
    height: 32px
  }

  .brand-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 26px
  }

  .form-panel {
    padding: 26px 22px
  }

  .secure-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px
  }

  .card-header h1,
  .card-header h2 {
    font-size: 36px
  }

  .form-grid,
  .form-actions {
    grid-template-columns: 1fr
  }

  .span-2 {
    grid-column: span 1
  }

  .form-actions-between {
    display: grid;
    grid-template-columns: 1fr
  }

  .form-actions-between .btn,
  .form-actions-between a.btn {
    width: 100%
  }

  .auth-footer {
    display: block
  }

  .auth-footer span {
    display: block;
    margin-top: 8px
  }

  .legal-card {
    padding: 28px 22px
  }

  .legal-header {
    display: block
  }

  .legal-header img {
    margin-bottom: 18px
  }

  .legal-footer {
    display: block
  }

  .legal-footer a {
    display: block;
    margin-top: 10px
  }
}

@media (prefers-reduced-motion:reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important
  }
}

/* =========================================================
   REGISTRO: VALIDACIÓN DE TERMINAL
   ========================================================= */

.validation-panel {
    padding: 18px;
    border: 1px solid rgba(103, 232, 249, 0.24);
    border-radius: 20px;
    background: rgba(25, 198, 211, 0.06);
}

/*
 * Estilo utilizado para el serial y el PIN.
 */
.terminal-code-input {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
}

/*
 * Contenedor del mensaje de estado y el botón Validar.
 */
.terminal-validation-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
}

.terminal-validation-status {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

/*
 * Estado mostrado cuando el backend confirmó
 * correctamente el serial y el PIN.
 */
.terminal-validation-status.is-valid {
    color: #aaf4cf;
    font-weight: 800;
}

/*
 * Evita que los botones deshabilitados conserven
 * efectos visuales de hover.
 */
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
    box-shadow: none;
}

/*
 * Adaptación para celulares y pantallas pequeñas.
 */
@media (max-width: 760px) {
    .terminal-validation-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .terminal-validation-actions .btn {
        width: 100%;
    }
}
/*
 * Serial y código de activación, uno debajo del otro.
 */
.terminal-validation-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

.terminal-validation-grid .field {
    width: 100%;
    align-content: start;
}

.terminal-validation-grid .plain-input {
    width: 100%;
}

/*
 * Mantiene alineados verticalmente los campos que comparten una fila,
 * aunque alguno tenga un texto de ayuda adicional.
 */
.form-grid > .field {
    align-content: start;
    grid-auto-rows: max-content;
}