/**
 * Telas de fora do painel: entrar, convite, escolher rádio, sem permissão,
 * redirecionamento e primeiro acesso.
 *
 * Todas seguem a mesma ideia: fundo do app, um cartão centrado e nada de menu
 * ou barra lateral, porque em nenhuma delas há para onde navegar. As medidas
 * saem dos tokens do painel, então o tema claro e o escuro vêm de graça.
 *
 * Carregada só por essas telas: elas não usam o cabeçalho nem o menu, então
 * nada aqui precisa disputar com o resto do painel.
 */

.auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 28px 18px;
    background: var(--bg);
}

.auth__box { width: 100%; max-width: 420px; }
.auth__box--wide { max-width: 720px; }

.auth__brand {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.auth__brand img { height: 50px; }

.auth__card {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.auth__head { margin-bottom: 22px; text-align: center; }

.auth__title {
    margin: 0 0 6px;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

.auth__sub {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--text-muted);
}

.auth__form { display: flex; flex-direction: column; gap: 16px; }

.auth__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.auth__check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 14.5px;
    color: var(--text);
    cursor: pointer;
}

.auth__check input {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 19px;
    height: 19px;
    margin: 0;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.auth__check input:hover { border-color: var(--brand); }

.auth__check input:checked {
    border-color: var(--brand);
    background: var(--brand) center / 12px 12px no-repeat;
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 fill=%27none%27 stroke=%27white%27 stroke-width=%273%27 stroke-linecap=%27round%27 stroke-linejoin=%27round%27%3E%3Cpath d=%27M3 8.5l3.2 3.2L13 4.8%27/%3E%3C/svg%3E");
}

.auth__check input:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-100, rgba(0, 0, 0, .12)); }

.auth__link { font-size: 14.5px; font-weight: 600; color: var(--brand); text-decoration: none; }
.auth__link:hover { color: var(--brand-700); text-decoration: underline; }

.auth__foot {
    margin: 22px 0 0;
    font-size: 13.5px;
    text-align: center;
    color: var(--text-soft);
}

/* Espera: acesso vindo da central e criação da estação */

.auth__wait { text-align: center; }

.auth__spin {
    width: 46px;
    height: 46px;
    margin: 0 auto 20px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: authspin 0.8s linear infinite;
}

@keyframes authspin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .auth__spin { animation-duration: 2.4s; }
}

.auth__secure {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding: 7px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ok-fg);
    border-radius: var(--radius-pill);
    background: var(--ok-bg);
}

/* Sem permissão */

.auth__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    margin: 0 auto 18px;
    font-size: 26px;
    color: var(--err-fg);
    border-radius: 50%;
    background: var(--err-bg);
}

/* Escolher rádio */

.auth__list { display: flex; flex-direction: column; gap: 10px; }

.auth__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.auth__item:hover { border-color: var(--brand-300); background: var(--brand-50); }

.auth__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-700);
    border-radius: var(--radius-sm);
    background: var(--brand-100);
}

.auth__item-info { flex: 1 1 auto; min-width: 0; }

.auth__item-name {
    display: block;
    font-size: 15px;
    font-weight: 650;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth__item-domain {
    display: block;
    font-size: 13.5px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth__empty {
    padding: 26px 18px;
    font-size: 14.5px;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

/**
 * Campos.
 *
 * O componente `.field`/`.input` do painel vive na folha de uma página interna
 * (pages/siteconfig.css). Estas telas ficam fora do painel e não carregam
 * aquela folha, então as regras que elas usam vêm daqui, iguais às de lá.
 */

.auth .field { display: flex; flex-direction: column; gap: 7px; }

.auth .field__label {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
}

.auth .field__err { font-size: 13.5px; font-weight: 700; color: var(--danger); }
.auth .field:has(.field__err:not([hidden])) .input { border-color: var(--danger); }

.auth .input {
    width: 100%;
    padding: 11px 13px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth .input:hover { border-color: var(--brand-300); }

.auth .input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-100);
}

.auth .input[readonly] { color: var(--text-muted); background: var(--surface-2); }

/* o botão de uma tela dessas é sempre o único: ocupa a linha */
.auth__form .btn,
.auth__action .btn {
    justify-content: center;
    width: 100%;
    padding: 12px 16px;
    font-size: 15.5px;
}

.auth__action { margin-top: 20px; }
/**
 * As telas que não são formulário.
 *
 * Esperar e levar um "não" não são tarefas: não há o que preencher nem para
 * onde navegar, então o cartão só desenharia uma caixa em volta de duas linhas.
 * Aqui o conteúdo fica solto sobre o fundo do app, com um brilho de marca por
 * trás para a tela não parecer inacabada.
 *
 * Tudo sai dos tokens do painel, então tema claro e escuro vêm de graça.
 */

.plain {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 30px 20px;
    overflow: hidden;
    background: var(--bg);
}

/* o brilho: um sopro da cor da marca, sem virar fundo colorido */
.plain::before {
    content: "";
    position: absolute;
    top: -30%;
    left: 50%;
    z-index: 0;
    width: 900px;
    height: 900px;
    transform: translateX(-50%);
    background: radial-gradient(circle, var(--brand-100) 0%, transparent 62%);
    opacity: 0.85;
    pointer-events: none;
}

.plain__box { position: relative; z-index: 1; width: 100%; max-width: 460px; text-align: center; }

/* a marca centra por flex: com img em bloco, text-align nao alcanca */
.plain__brand { display: flex; justify-content: center; margin-bottom: 26px; }
.plain__brand img { height: 50px; }

.plain__title {
    margin: 0 0 10px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.plain__text {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.6;
    color: var(--text-muted);
}

.plain__actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.plain__actions .btn { padding: 12px 22px; font-size: 15.5px; }

.plain__foot { margin: 26px 0 0; font-size: 13.5px; color: var(--text-soft); }
.plain__foot a { font-weight: 600; color: var(--brand); text-decoration: none; }
.plain__foot a:hover { text-decoration: underline; }

/**
 * Espera.
 *
 * O giro e o mesmo de todo o painel: o loader-circle que includes/spinner
 * entrega, no mesmo compasso. Inventar uma animacao so para estas telas
 * seria uma segunda linguagem de espera dentro do mesmo produto.
 */

.plain__spin { width: 34px; height: 34px; margin: 0 auto 22px; color: var(--brand); }

.plain__note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    padding: 8px 15px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ok-fg);
    border-radius: var(--radius-pill);
    background: var(--ok-bg);
}

/**
 * Sem permissão.
 *
 * O cadeado grande atrás do texto diz o assunto antes da leitura, e fica claro
 * o bastante para não disputar com a frase.
 */

.plain__mark {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 0;
    font-size: 300px;
    line-height: 1;
    color: var(--text);
    opacity: 0.035;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.plain__badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 18px;
    padding: 7px 15px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--err-fg);
    border: 1px solid var(--err-bd);
    border-radius: var(--radius-pill);
    background: var(--err-bg);
}

/**
 * Estados de erro do login.
 *
 * O login é enviado por ajax, e o script marca os campos com as classes que ele
 * sempre usou (`is-invalid`, `invalid-feedback`, `d-none`, `alert-login-user`).
 * Trocar a marcação da tela sem trocar essas classes manteria o script antigo
 * funcionando às cegas, então elas ganham aqui a aparência do painel em vez de
 * o script ser reescrito por causa de uma troca de visual.
 */

.auth .d-none { display: none !important; }

.auth .invalid-feedback {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--danger);
}

.auth .input.is-invalid { border-color: var(--danger); }
.auth .input.is-invalid:focus { box-shadow: 0 0 0 3px var(--err-bg); }

.auth__alert {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
    border-radius: var(--radius-sm);
}

.auth__alert[hidden] { display: none; }

.auth__alert i { flex: none; margin-top: 2px; font-size: 15px; }

.auth__alert--err { color: var(--err-fg); border: 1px solid var(--err-bd); background: var(--err-bg); }
.auth__alert--ok { color: var(--ok-fg); border: 1px solid var(--ok-bd); background: var(--ok-bg); }

/* Recuperação de senha */

.authcode { display: flex; gap: 8px; justify-content: space-between; }

.authcode__box {
    width: 100%;
    max-width: 56px;
    height: 58px;
    padding: 0;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    transition: border-color .12s ease, box-shadow .12s ease;
}

.authcode__box:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-100);
}

.auth__send { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.auth__send.is-busy { opacity: .75; cursor: progress; }

.auth__link--center { display: block; align-self: center; margin-top: 16px; text-align: center; }

.auth__link--button {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.auth__again {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

.auth__note { margin: 0; font-size: 13.5px; color: var(--text-muted); text-align: center; }

/* the eye sits inside the field, so the input keeps the full width */
.auth__pass { position: relative; display: block; }
.auth__pass .input { width: 100%; padding-right: 44px; }

.auth__eye {
    position: absolute;
    top: 50%;
    right: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--text-soft);
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
}

.auth__eye:hover { color: var(--text); background: var(--surface-2); }

@media (max-width: 420px) {
    .authcode { gap: 6px; }
    .authcode__box { height: 52px; font-size: 21px; }
}
