:root[data-theme="dark"] {
    color-scheme: dark;
}

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

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.portal {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: .9375rem;
}

.portal a {
    color: var(--a);
}

.portal a.btn {
    text-decoration: none;
}

.portal .btn-primary {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: var(--white) !important;
}

.portal .btn-primary:hover,
.portal .btn-primary:focus-visible {
    background: var(--primary-blue-dark);
    border-color: var(--primary-blue-dark);
    color: var(--white) !important;
}

.portal-topo {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 4rem;
    padding: 0 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-subtle);
}

.portal-marca {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    color: var(--text) !important;
    text-decoration: none;
}

.portal-marca-logo {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
}

.portal-marca-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.portal-marca-logo svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--a);
}

.portal-marca-texto {
    min-width: 0;
}

.portal-marca strong {
    display: block;
    overflow: hidden;
    font-size: 1rem;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.portal-marca small {
    display: block;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .75rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.portal-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    height: 100%;
}

.portal-nav a {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    height: 100%;
    padding: 0 .75rem;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.portal-nav a:hover {
    color: var(--text);
}

.portal-nav a[aria-current="page"] {
    border-bottom-color: var(--border-active);
    color: var(--a);
    font-weight: 600;
}

.portal-nav svg {
    width: 1.0625rem;
    height: 1.0625rem;
}

.portal-conta {
    position: relative;
    margin-left: auto;
}

.portal-conta > summary {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem .5rem .25rem .25rem;
    border: 1px solid var(--border-subtle);
    border-radius: 2rem;
    color: var(--text);
    font-size: .875rem;
    font-weight: 500;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.portal-conta > summary::-webkit-details-marker {
    display: none;
}

.portal-conta > summary:hover,
.portal-conta[open] > summary {
    background: var(--surface-hover);
}

.portal-conta > summary > svg {
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
    transition: transform .15s ease;
}

.portal-conta[open] > summary > svg {
    transform: rotate(180deg);
}

.portal-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--info-bg);
    color: var(--a);
    font-size: .75rem;
    font-weight: 700;
}

.portal-conta-nome {
    max-width: 10rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.portal .portal-menu {
    top: calc(100% + .5rem);
    min-width: 17rem;
    padding: .375rem;
    border-radius: .75rem;
}

.portal-menu form {
    margin: 0;
}

.portal-menu-cabeca {
    display: flex;
    flex-direction: column;
    gap: .125rem;
    margin-bottom: .375rem;
    padding: .5rem .625rem .75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.portal-menu-cabeca strong {
    font-size: .875rem;
}

.portal-menu-cabeca small {
    color: var(--text-muted);
    font-size: .75rem;
}

.portal .portal-menu .simple-menu-item {
    color: var(--text);
    text-decoration: none;
}

.portal .portal-menu .simple-menu-item.is-perigo {
    color: var(--error-text);
}

.portal-menu-tema {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: .375rem 0;
    padding: .5rem .625rem;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
    font-size: .875rem;
}

.portal-tema {
    display: inline-flex;
    gap: .125rem;
    padding: .1875rem;
    border-radius: .5rem;
    background: var(--surface2);
}

.portal-tema button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .3125rem .5rem;
    border: none;
    border-radius: .375rem;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

.portal-tema button svg {
    width: 1rem;
    height: 1rem;
}

.portal-tema button span,
.portal-tema button small {
    display: none;
}

.portal-tema button[aria-checked="true"] {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(8, 16, 28, .18);
}

.portal-tema.is-grande {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    padding: 0;
    background: none;
}

.portal-tema.is-grande button {
    flex-direction: column;
    align-items: flex-start;
    gap: .375rem;
    padding: 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: .75rem;
    background: var(--surface);
    text-align: left;
}

.portal-tema.is-grande button svg {
    width: 1.375rem;
    height: 1.375rem;
}

.portal-tema.is-grande button span {
    display: block;
    color: var(--text);
    font-size: .9375rem;
    font-weight: 600;
}

.portal-tema.is-grande button small {
    display: block;
    color: var(--text-muted);
    font-size: .8125rem;
}

.portal-tema.is-grande button[aria-checked="true"] {
    border-color: var(--border-active);
    background: var(--info-bg);
    color: var(--a);
    box-shadow: 0 0 0 1px var(--border-active);
}

.portal-conteudo {
    flex: 1 0 auto;
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.portal-cabecalho {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.portal-cabecalho h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.portal-cabecalho p {
    margin: .25rem 0 0;
    color: var(--text-muted);
    font-size: .9375rem;
}

.portal-voltar {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    margin-bottom: 1rem;
    font-size: .875rem;
    text-decoration: none;
}

.portal-voltar svg {
    width: 1rem;
    height: 1rem;
}

.portal-folha {
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
    border-radius: .875rem;
    background: var(--surface);
}

.portal-folha-titulo {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.portal-folha-sub {
    margin: .25rem 0 1.25rem;
    color: var(--text-muted);
    font-size: .875rem;
}

.portal-rodape {
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: .8125rem;
    text-align: center;
}

.portal-destaque {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-active);
    border-radius: .875rem;
    background: var(--info-bg);
    color: var(--text) !important;
    text-decoration: none;
}

.portal-destaque > span:nth-child(2) {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: .125rem;
}

.portal-destaque > span:nth-child(2) > span {
    color: var(--text-muted);
    font-size: .875rem;
}

.portal-destaque > svg {
    color: var(--a);
}

.portal-atalhos {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.portal-atalho {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: 1.25rem;
    border: 1px solid var(--border-subtle);
    border-radius: .875rem;
    background: var(--surface);
    color: var(--text) !important;
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.portal-atalho:hover,
.portal-atalho:focus-visible {
    border-color: var(--border-active);
    box-shadow: 0 8px 20px rgba(8, 16, 28, .08);
    outline: none;
    transform: translateY(-1px);
}

.portal-atalho-icone {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: .25rem;
    border-radius: .75rem;
    background: var(--info-bg);
    color: var(--a);
}

.portal-atalho-icone svg {
    width: 1.375rem;
    height: 1.375rem;
}

.portal-atalho strong {
    font-size: 1rem;
}

.portal-atalho > span:not(.portal-atalho-icone) {
    color: var(--text-muted);
    font-size: .875rem;
    line-height: 1.45;
}

.portal-conta-grade {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
}

.portal-conta-nav {
    display: flex;
    flex-direction: column;
    gap: .125rem;
}

.portal-conta-nav a {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem .75rem;
    border-radius: .5rem;
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
}

.portal-conta-nav a:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.portal-conta-nav a[aria-current="page"] {
    background: var(--info-bg);
    color: var(--a);
    font-weight: 600;
}

.portal-conta-nav svg {
    width: 1.125rem;
    height: 1.125rem;
}

.portal-dados {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
    margin: 0 0 1.25rem;
}

.portal-dados dt {
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.portal-dados dd {
    margin: .25rem 0 0;
    font-weight: 500;
}

.portal-form-estreito {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 26rem;
}

.portal-msg {
    display: none;
    margin: .75rem 0;
    padding: .625rem .875rem;
    border: 1px solid var(--border-subtle);
    border-radius: .5rem;
    font-size: .875rem;
    line-height: 1.45;
}

.portal-msg.is-erro,
.portal-msg.is-ok,
.portal-msg.is-info {
    display: block;
}

.portal-msg.is-erro {
    border-color: var(--error-border);
    background: var(--error-bg);
    color: var(--error-text);
}

.portal-msg.is-ok {
    border-color: var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
}

.portal-msg.is-info {
    border-color: var(--info-blue);
    background: var(--info-bg);
    color: var(--text);
}

.portal-aviso {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    margin-bottom: 1.25rem;
    padding: .75rem .875rem;
    border: 1px solid var(--info-blue);
    border-radius: .625rem;
    background: var(--info-bg);
    font-size: .875rem;
    line-height: 1.45;
}

.portal-aviso.is-ok {
    border-color: var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
}

.portal-aviso svg {
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: .0625rem;
}

.portal .simple-campo.is-invalido input,
.portal .simple-campo.is-invalido select {
    border-color: var(--error-border);
}

.portal .simple-linha {
    align-items: flex-start;
}

.portal .simple-linha > .portal-col-botao {
    align-self: flex-end;
}

.portal .simple-campo-erro {
    color: var(--error-text);
    font-size: .75rem;
}

.portal .simple-campo input[readonly] {
    background: var(--surface-hover);
    color: var(--text-muted);
}

.portal .simple-campo > label small {
    color: var(--text-muted);
    font-weight: 400;
}

.portal-campo-icone {
    position: relative;
}

.portal-campo-icone > svg {
    position: absolute;
    top: 50%;
    left: .8125rem;
    width: 1.125rem;
    height: 1.125rem;
    color: var(--text-muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.portal .portal-campo-icone > input {
    height: 2.75rem;
    padding-left: 2.625rem;
    font-size: .9375rem;
}

.portal .portal-campo-icone > input:has(+ .portal-ver-senha) {
    padding-right: 2.75rem;
}

.portal-ver-senha {
    position: absolute;
    top: 50%;
    right: .375rem;
    display: inline-flex;
    padding: .375rem;
    border: none;
    border-radius: .375rem;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.portal-ver-senha:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.portal-ver-senha svg {
    width: 1.125rem;
    height: 1.125rem;
}

.portal-rotulo-linha {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
}

.portal-rotulo-linha label {
    font-size: .78rem;
    font-weight: 600;
}

.portal-rotulo-linha a {
    font-size: .8125rem;
    text-decoration: none;
}

.portal .portal-btn-grande {
    justify-content: center;
    width: 100%;
    height: 2.75rem;
    font-size: .9375rem;
    font-weight: 600;
}

.portal-separador {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: .5rem 0 .25rem;
    color: var(--text-muted);
    font-size: .8125rem;
}

.portal-separador::before,
.portal-separador::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.portal-nota {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    margin: 0;
    color: var(--text-muted);
    font-size: .8125rem;
    line-height: 1.45;
}

.portal-nota svg {
    flex: none;
    width: 1rem;
    height: 1rem;
    margin-top: .0625rem;
}

.portal-entrada {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background: linear-gradient(180deg, var(--header-bg) 0, var(--header-bg2) 46vh, var(--bg) 46vh);
}

.portal-entrada-cartao {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    width: 100%;
    max-width: 60rem;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    border-radius: 1.25rem;
    background: var(--surface);
    box-shadow: 0 24px 60px rgba(8, 16, 28, .22);
}

.portal-entrada-marca {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.75rem;
    padding: 3rem 2.75rem;
    background: linear-gradient(160deg, var(--header-bg2) 0%, var(--header-bg) 100%);
    color: var(--header-text);
}

.portal-entrada-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 5.5rem;
    height: 5.5rem;
    padding: .625rem;
    border-radius: 1.25rem;
    background: var(--header-text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.portal-entrada-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.portal-entrada-logo svg {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--header-bg);
}

.portal-entrada-marca h1 {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.portal-entrada-marca p {
    margin: .375rem 0 0;
    opacity: .85;
    font-size: .875rem;
}

.portal-entrada-lista {
    display: flex;
    flex-direction: column;
    gap: .875rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .9rem;
}

.portal-entrada-lista li {
    display: flex;
    align-items: center;
    gap: .75rem;
    opacity: .95;
}

.portal-entrada-lista span {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: .625rem;
    background: rgba(255, 255, 255, .14);
}

.portal-entrada-lista svg {
    width: 1.125rem;
    height: 1.125rem;
}

.portal-entrada-corpo {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 3rem;
}

.portal-entrada-corpo h2 {
    margin: 0;
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

.portal-entrada-sub {
    margin: .375rem 0 1.5rem;
    color: var(--text-muted);
    font-size: .9375rem;
}

.portal-entrada-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.portal-entrada-form .portal-msg {
    margin: 0;
}

.portal .portal-entrada-form .simple-campo input {
    height: 2.75rem;
    font-size: .9375rem;
}

.portal-entrada-rodape {
    margin: 1.5rem 0 0;
    color: var(--text-muted);
    font-size: .8125rem;
}

.portal-passos {
    display: flex;
    gap: 1.25rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
    color: var(--text-muted);
    font-size: .8125rem;
    font-weight: 500;
}

.portal-passos li {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.portal-passos span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    font-size: .75rem;
    font-weight: 700;
}

.portal-passos .is-atual {
    color: var(--text);
}

.portal-passos .is-atual span {
    border-color: var(--primary-blue);
    background: var(--primary-blue);
    color: var(--white);
}

.portal-passos .is-feito span {
    border-color: var(--success-border);
    background: var(--success-bg);
    color: var(--success-text);
}

.portal-concluido {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.portal-concluido-icone {
    display: inline-flex;
    margin-bottom: 1rem;
    padding: .75rem;
    border-radius: 50%;
    background: var(--success-bg);
    color: var(--success-text);
}

.portal-concluido-icone svg {
    width: 2rem;
    height: 2rem;
}

.portal-matricula {
    margin-top: 1rem;
}

.portal-matricula strong {
    color: var(--text-muted);
    font-size: .8125rem;
}

.portal-folhas {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .375rem;
}

@media (max-width: 56rem) {
    .portal-topo {
        flex-wrap: wrap;
        gap: 0 1rem;
        height: auto;
        padding: .625rem 1rem 0;
    }

    .portal-nav {
        order: 3;
        width: calc(100% + 2rem);
        height: 2.75rem;
        margin: .5rem -1rem 0;
        padding: 0 .5rem;
        overflow-x: auto;
        border-top: 1px solid var(--border-subtle);
    }

    .portal-conta {
        margin-left: auto;
    }

    .portal-entrada-cartao {
        grid-template-columns: 1fr;
    }

    .portal-entrada-marca {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        padding: 1.5rem;
    }

    .portal-entrada-logo {
        width: 4rem;
        height: 4rem;
        border-radius: 1rem;
    }

    .portal-entrada-marca h1 {
        font-size: 1.375rem;
    }

    .portal-entrada-marca p {
        font-size: .75rem;
    }

    .portal-entrada-lista {
        display: none;
    }

    .portal-conta-grade {
        grid-template-columns: 1fr;
    }

    .portal-conta-nav {
        flex-direction: row;
        overflow-x: auto;
    }
}

@media (max-width: 36rem) {
    .portal-entrada {
        justify-content: flex-start;
        padding: 0;
        background: var(--surface);
    }

    .portal-entrada-cartao {
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .portal-entrada-corpo {
        padding: 1.75rem 1.25rem 2rem;
    }

    .portal-entrada-rodape {
        margin: 0 0 1.5rem;
    }

    .portal-conta-nome {
        display: none;
    }

    .portal-conteudo {
        padding: 1.5rem 1rem 2.5rem;
    }

    .portal-folha {
        padding: 1.125rem;
    }

    .portal-dados,
    .portal-tema.is-grande {
        grid-template-columns: 1fr;
    }
}
