/* ---------------------------------------------------------------------------
   Pantalla de acceso (gate) previa al menu y al dashboard.
   Se monta como overlay fijo: mientras esta visible, el contenido del dashboard
   queda detras y sin scroll, de modo que nadie ve el menu ni los datos hasta
   autenticarse.
--------------------------------------------------------------------------- */


body.app-locked {
    overflow: hidden;
}

#appGate {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
    background: radial-gradient(1100px 620px at 12% -10%, rgba(64, 132, 255, .28), transparent 60%),
    radial-gradient(900px 560px at 110% 10%, rgba(155, 89, 255, .22), transparent 58%),
    linear-gradient(160deg, #070b14 0%, #0d1524 55%, #0a1120 100%);
}

#appGate[hidden] {
    display: none !important;
}

.gate-wrap {
    width: min(460px, 100%);
    margin: auto;
    text-align: center;
}

/* ----------------------------- Marca / logo ----------------------------- */

.gate-brand {
    margin-bottom: 18px;
}

.gate-brand img {
    max-width: 260px;
    width: 70%;
    height: auto;
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, .55));
}

.gate-brand .gate-tagline {
    margin-top: 8px;
    color: #9fb1cc;
    font-size: 13px;
    letter-spacing: .4px;
}

/* ------------------------------ Tarjeta --------------------------------- */

.gate-card {
    background: rgba(14, 21, 36, .92);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
    padding: 22px;
    text-align: left;
    color: #e8eef8;
    backdrop-filter: blur(6px);
}

/* Las tarjetas de acceso, terminos y licencia son oscuras en los dos temas.
   Con el dashboard en claro, `body:not(.dark-mode) label` (style.css) pinta
   las etiquetas de #111 con !important y tapa su color de Tailwind: se
   devuelve aqui el suyo. Los titulos llevan .legal-title (blanco). */
.gate-card {
    --text: #e8eef8;
}

body:not(.dark-mode) .gate-card label {
    color: #c7d4e6 !important;
}

body:not(.dark-mode) .gate-card label[for$="Accept"] {
    color: #e8eef8 !important;
}

.gate-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
}

.gate-card .gate-sub {
    color: #9fb1cc;
    font-size: 13px;
    margin-bottom: 16px;
}

.gate-btn {
    width: 100%;
    font-weight: 600;
    padding: 10px 12px;
    border-radius: 10px;
}

/* ------------------------------ Mensajes -------------------------------- */

.gate-alert {
    border-radius: 10px;
    font-size: 13px;
    padding: 9px 12px;
    margin-bottom: 12px;
    display: none;
}

.gate-alert.show {
    display: block;
}

.gate-alert.error {
    background: rgba(220, 53, 69, .14);
    border: 1px solid rgba(220, 53, 69, .45);
    color: #ffb3bb;
}

.gate-alert.info {
    background: rgba(77, 140, 255, .12);
    border: 1px solid rgba(77, 140, 255, .4);
    color: #bcd6ff;
}

.gate-alert.success {
    background: rgba(77, 223, 154, .12);
    border: 1px solid rgba(77, 223, 154, .4);
    color: #b5f2d3;
}

.gate-hint {
    font-size: 12px;
    color: #8fa2bb;
    margin-top: 6px;
}

/* ============================================================
   MEDIDOR DE FORTALEZA DE LA CONTRASENA
   Lo pinta home/login.js con lo que calcula core/password-strength.js.
   El color NO es el unico canal: debajo va siempre el nivel escrito y,
   cuando falta algo, que es lo que falta.
   ============================================================ */

.gate-strength {
    margin-top: 8px;
    --gate-strength-color: #8fa2bb;
}

.gate-strength[data-level="invalid"],
.gate-strength[data-level="weak"] {
    --gate-strength-color: #ff7a86;
}

.gate-strength[data-level="fair"] {
    --gate-strength-color: #ffc266;
}

.gate-strength[data-level="good"] {
    --gate-strength-color: #7fd4a8;
}

.gate-strength[data-level="strong"] {
    --gate-strength-color: #4ddf9a;
}

.gate-strength__track {
    height: 4px;
    border-radius: 3px;
    background: rgba(143, 162, 187, .22);
    overflow: hidden;
}

.gate-strength__fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: var(--gate-strength-color);
    transition: width .15s ease, background-color .15s ease;
}

.gate-strength__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-top: 5px;
    font-size: 12px;
}

.gate-strength__level {
    color: var(--gate-strength-color);
    font-weight: 600;
    white-space: nowrap;
}

.gate-strength__tip {
    color: #8fa2bb;
    text-align: right;
}

.gate-strength__match {
    font-size: 12px;
    margin-top: 6px;
    color: #8fa2bb;
}

.gate-strength__match[data-state="mismatch"] {
    color: #ff7a86;
}

.gate-strength__match[data-state="match"] {
    color: #4ddf9a;
}

.gate-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.gate-links a {
    color: #7cb6ff;
    font-size: 13px;
    text-decoration: none;
}

.gate-links a:hover {
    text-decoration: underline;
}

.gate-foot {
    margin-top: 14px;
    text-align: center;
    color: #7d8ea6;
    font-size: 11px;
}

/* ---------------------------------------------------------------------------
   Paso 2: Terminos y acuerdos.
   Reutiliza la paleta y las clases del gate de acceso (.gate-wrap, .gate-card)
   y solo agrega lo propio de esta pantalla: el stepper y las filas de checkbox.
--------------------------------------------------------------------------- */

#appTerms {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
    background: radial-gradient(1100px 620px at 12% -10%, rgba(64, 132, 255, .28), transparent 60%),
    radial-gradient(900px 560px at 110% 10%, rgba(155, 89, 255, .22), transparent 58%),
    linear-gradient(160deg, #070b14 0%, #0d1524 55%, #0a1120 100%);
}

#appTerms[hidden] {
    display: none !important;
}

.terms-wrap {
    width: min(560px, 100%);
}

/* -------------------------------- Stepper -------------------------------- */

.terms-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
}

.terms-steps li {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #7d8ea6;
    font-size: 12px;
    letter-spacing: .3px;
}

.terms-steps li + li::before {
    content: "";
    width: 22px;
    height: 1px;
    background: rgba(255, 255, 255, .18);
    margin-right: 4px;
}

.terms-step-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .2);
    font-size: 11px;
    font-weight: 700;
}

.terms-steps li.done {
    color: #7ee2a8;
}

.terms-steps li.done .terms-step-dot {
    background: rgba(40, 167, 69, .18);
    border-color: #38b06a;
    color: #7ee2a8;
}

.terms-steps li.current {
    color: #eaf1fb;
}

.terms-steps li.current .terms-step-dot {
    background: rgba(77, 140, 255, .2);
    border-color: #4d8cff;
    color: #cfe2ff;
}

/* --------------------------- Filas de aceptacion -------------------------- */

.terms-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: #0b111d;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: border-color .15s ease, background .15s ease;
}

/* Marcado (2026-11-14, a peticion del usuario): la tarjeta ya no se pone
   verde; solo la casilla, con fondo verde y la palomita blanca. accent-color
   pinta el fondo de la casilla marcada en todos los navegadores modernos (y en
   Electron); el selector gana a la clase tw-accent-[#4d8cff] del HTML. */
.terms-item input[type="checkbox"]:checked {
    accent-color: #22a35a;
}

/* "Los documentos legales solo existen en ingles" (solo con la app en otro idioma). */
.terms-lang-note {
    margin-top: 8px;
    color: #f0c674;
}

.terms-lang-note[hidden] {
    display: none !important;
}

.terms-item-desc {
    display: block;
    color: #9fb1cc;
    font-size: 12px;
    margin-top: 2px;
    line-height: 1.4;
}

.terms-readmark {
    background: rgba(56, 176, 106, .2);
    border: 1px solid rgba(56, 176, 106, .5);
    color: #7ee2a8;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.terms-read-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

#termsContinue:disabled {
    opacity: .55;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .terms-item {
        flex-direction: column;
        align-items: stretch;
    }

    .terms-read-btn {
        width: 100%;
    }
}

/* Bootstrap re-declara display en .badge y en algunos bloques; se refuerza el
   atributo hidden para que las insignias y la pista no se vean antes de tiempo. */
.terms-readmark[hidden],
#termsHint[hidden] {
    display: none !important;
}


/* ---------------------------------------------------------------------------
   Paso 3: Licencia (home/accessGate.js).
   Mismo overlay, paleta y stepper que los pasos 1 y 2. Lo propio de esta
   pantalla: los datos de la cuenta, la casilla de la clave y la ayuda.
--------------------------------------------------------------------------- */

#appLicense {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow-y: auto;
    background: radial-gradient(1100px 620px at 12% -10%, rgba(64, 132, 255, .28), transparent 60%),
    radial-gradient(900px 560px at 110% 10%, rgba(155, 89, 255, .22), transparent 58%),
    linear-gradient(160deg, #070b14 0%, #0d1524 55%, #0a1120 100%);
}

#appLicense[hidden],
#appLicense [hidden] {
    display: none !important;
}

.license-details-toggle {
    margin-bottom: 10px;
}

.license-details {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 14px;
    background: #0b111d;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 14px;
    font-size: 13px;
}

.license-details dt {
    color: #8fa2bb;
    font-weight: 500;
}

.license-details dd {
    margin: 0;
    color: #e8eef8;
    overflow-wrap: anywhere;
}

.license-input {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    resize: vertical;
}

.license-actions {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.license-actions .gate-btn {
    width: 100%;
}

/* Ayuda: por encima del overlay de la licencia, dentro de el. */
.license-help {
    position: fixed;
    inset: 0;
    z-index: 20010;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: rgba(4, 7, 14, .72);
    backdrop-filter: blur(3px);
}

.license-help__card {
    position: relative;
    width: min(520px, 100%);
}

.license-help__close {
    position: absolute;
    top: 14px;
    right: 14px;
}

.license-help__steps {
    margin: 12px 0 0;
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.5;
}

.license-help__steps li + li {
    margin-top: 10px;
}

.license-help__steps strong {
    display: block;
    color: #e8eef8;
}

.license-help__steps span {
    color: #9fb1cc;
}

@media (max-width: 480px) {
    .license-actions {
        grid-template-columns: 1fr;
    }

    .license-details {
        grid-template-columns: 1fr;
    }
}
/* El paso de licencia anade un cuarto punto al stepper: en un movil ya no cabe
   en una linea y empujaba la tarjeta fuera de la pantalla. */
.terms-steps {
    flex-wrap: wrap;
    row-gap: 6px;
}

@media (max-width: 480px) {
    .terms-steps {
        gap: 6px;
    }

    .terms-steps li + li::before {
        width: 10px;
    }
}

/* Cancelar y "Ver mis datos" no compiten con Aceptar. */
#appLicense .license-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .24);
    color: #cfdcf0;
    box-shadow: none;
}

#appLicense .license-secondary:hover,
#appLicense .license-secondary:focus-visible {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .4);
    color: #fff;
}