* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: #202123;
    background: #ffffff;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}


/* ======================================
   APP
====================================== */

.app-layout {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 280px;
    min-width: 280px;
    height: 100vh;
    position: sticky;
    top: 0;
    background: #f7f7f8;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
}

.sidebar-topo {
    padding: 18px 14px;
}

.logo-app {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
}

.logo-app strong {
    display: block;
    font-size: 15px;
}

.logo-app small {
    display: block;
    margin-top: 2px;
    color: #777;
    font-size: 11px;
}

.logo-icone,
.auth-logo-icone {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #111827;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    font-weight: 300;
}

.botao-nova-consulta,
.menu-lateral-item {
    width: 100%;
    display: block;
    border: 1px solid #dedede;
    background: #fff;
    padding: 11px 12px;
    border-radius: 9px;
    text-align: left;
    margin-bottom: 8px;
    transition: 0.15s;
}

.botao-nova-consulta:hover,
.menu-lateral-item:hover {
    background: #ececec;
}

.sidebar-historico {
    flex: 1;
    min-height: 0;
    padding: 5px 10px 10px;
    display: flex;
    flex-direction: column;
}

.titulo-secao-sidebar {
    padding: 8px 8px 10px;
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.8px;
    color: #888;
    font-weight: 700;
}

.lista-historicos {
    overflow-y: auto;
}

.item-historico {
    display: block;
    padding: 9px 10px;
    border-radius: 8px;
    margin-bottom: 2px;
}

.item-historico:hover {
    background: #ededed;
}

.item-historico.ativo {
    background: #e3e3e3;
}

.historico-titulo {
    display: block;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.historico-data {
    display: block;
    margin-top: 4px;
    color: #969696;
    font-size: 10px;
}

.historico-vazio {
    padding: 12px 8px;
    color: #999;
    font-size: 12px;
    line-height: 1.5;
}


/* ======================================
   USO DE IA
====================================== */

.sidebar-uso {
    margin: 0 10px 10px;
    padding: 12px;
    border: 1px solid #dddddd;
    border-radius: 10px;
    background: #ffffff;
}

.uso-titulo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
}

.uso-titulo span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #666666;
    font-weight: 700;
}

.uso-titulo small {
    font-size: 9px;
    color: #999999;
}

.uso-destaque {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 4px;
}

.uso-destaque strong {
    font-size: 18px;
    color: #111827;
}

.uso-destaque span {
    font-size: 10px;
    color: #777777;
}

.uso-total {
    display: flex;
    align-items: baseline;
    gap: 5px;
    margin-bottom: 12px;
}

.uso-total strong {
    font-size: 12px;
}

.uso-total span {
    font-size: 9px;
    color: #888888;
}

.uso-detalhes {
    display: grid;
    grid-template-columns: repeat(
        3,
        1fr
    );
    gap: 5px;
    padding: 8px 0;
    border-top: 1px solid #eeeeee;
    border-bottom: 1px solid #eeeeee;
}

.uso-detalhes div {
    min-width: 0;
}

.uso-detalhes span {
    display: block;
    font-size: 8px;
    color: #999999;
    margin-bottom: 3px;
}

.uso-detalhes strong {
    display: block;
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.uso-custo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 9px;
    gap: 8px;
}

.uso-custo span {
    color: #888888;
    font-size: 8px;
}

.uso-custo strong {
    font-size: 9px;
    white-space: nowrap;
}


/* ======================================
   SIDEBAR RODAPÉ
====================================== */

.sidebar-rodape {
    padding: 13px;
    border-top: 1px solid #dedede;
}

.usuario-logado {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    margin-bottom: 10px;
}

.usuario-avatar {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #303030;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.usuario-info {
    min-width: 0;
}

.usuario-info strong {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.usuario-info span {
    display: block;
    margin-top: 2px;
    color: #777;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.botao-logout {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    background: transparent;
    color: #555;
    font-size: 12px;
}

.botao-logout:hover {
    background: #ececec;
}

.retencao-info {
    display: block;
    color: #999;
    font-size: 10px;
    line-height: 1.4;
    margin-top: 9px;
}


/* ======================================
   CONTEÚDO
====================================== */

.conteudo-principal {
    flex: 1;
    min-width: 0;
}

.painel-app {
    width: min(
        100% - 40px,
        1100px
    );
    margin: 0 auto;
    padding: 55px 0 80px;
}

.oculto {
    display: none !important;
}

.cabecalho-principal {
    max-width: 760px;
    margin-bottom: 28px;
}

.cabecalho-eyebrow {
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-size: 11px;
    font-weight: 700;
}

.cabecalho-principal h1,
.regras-cabecalho h1 {
    margin: 7px 0 10px;
    font-size: 29px;
    line-height: 1.2;
    letter-spacing: -0.7px;
}

.cabecalho-principal p,
.regras-cabecalho p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.historico-carregado {
    padding: 10px 13px;
    border-radius: 8px;
    background: #f6f6f6;
    color: #666;
    font-size: 12px;
    margin-bottom: 14px;
}

.alerta-erro {
    background: #fff1f1;
    color: #a82424;
    border: 1px solid #f4cccc;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 13px;
}


/* ======================================
   CONSULTA
====================================== */

.form-consulta {
    margin-bottom: 35px;
}

.textarea-wrapper {
    border: 1px solid #d6d6d6;
    border-radius: 13px;
    overflow: hidden;
    background: #fff;
    transition: 0.2s;
}

.textarea-wrapper:focus-within {
    border-color: #909090;
    box-shadow:
        0 0 0 3px
        rgba(0, 0, 0, 0.04);
}

#textoConsulta {
    width: 100%;
    min-height: 250px;
    border: none;
    resize: vertical;
    outline: none;
    padding: 18px;
    font-size: 14px;
    line-height: 1.65;
}

.textarea-rodape {
    border-top: 1px solid #eee;
    padding: 7px 13px;
    text-align: right;
    color: #999;
    font-size: 10px;
}

.botao-principal {
    border: none;
    background: #111827;
    color: #fff;
    border-radius: 9px;
    padding: 11px 18px;
    font-weight: 600;
    font-size: 13px;
}

.form-consulta > .botao-principal {
    margin-top: 12px;
    float: right;
}

.botao-principal:hover {
    background: #242b36;
}

.botao-principal:disabled {
    opacity: 0.6;
    cursor: default;
}

.botao-secundario {
    border: 1px solid #d7d7d7;
    background: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
}

.botao-secundario:hover {
    background: #f5f5f5;
}


/* ======================================
   RESULTADOS
====================================== */

.resultado-container {
    clear: both;
    padding-top: 24px;
}

.resultado-abas {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
}

.aba {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    padding: 11px 13px;
    color: #777;
    font-size: 12px;
    white-space: nowrap;
}

.aba.ativa {
    color: #111;
    border-bottom-color: #111;
    font-weight: 600;
}

.contador-atencao {
    background: #e7e7e7;
    border-radius: 20px;
    padding: 2px 5px;
    margin-left: 3px;
    font-size: 9px;
}

.conteudo-aba {
    display: none;
    padding: 24px 2px;
}

.conteudo-aba.ativo {
    display: block;
}

.conteudo-aba h2 {
    font-size: 18px;
    margin-top: 0;
}

.resultado-cabecalho {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prontuario-texto {
    color: #333;
    font-size: 14px;
    line-height: 1.7;
}

.resultado-card,
.atencao-card {
    border: 1px solid #e1e1e1;
    border-radius: 10px;
    padding: 14px 15px;
    margin-bottom: 10px;
}

.resultado-card h3,
.atencao-card h3 {
    margin: 0 0 6px;
    font-size: 14px;
}

.resultado-card p,
.atencao-card p {
    margin: 0;
    color: #555;
    font-size: 12px;
    line-height: 1.6;
}

.atencao-card {
    border-color: #ead6a5;
    background: #fffdf7;
}

.status-item {
    display: inline-block;
    background: #f1f1f1;
    margin-top: 10px;
    padding: 4px 7px;
    border-radius: 5px;
    color: #666;
    font-size: 9px;
}

.resultado-vazio {
    padding: 20px;
    background: #f8f8f8;
    border-radius: 8px;
    color: #888;
    font-size: 12px;
}


/* ======================================
   REGRAS
====================================== */

.regras-cabecalho {
    display: flex;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 25px;
}

.regras-cabecalho > div {
    max-width: 700px;
}

.nova-regra-box {
    border: 1px solid #dedede;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 28px;
}

.nova-regra-box h2 {
    margin: 0 0 17px;
    font-size: 17px;
}

.form-nova-regra {
    display: grid;
    gap: 12px;
}

.campo-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.campo-form label {
    font-size: 12px;
    color: #444;
    font-weight: 600;
}

.campo-form input,
.campo-form textarea,
.campo-form select,
.form-editar-regra input,
.form-editar-regra textarea {
    width: 100%;
    border: 1px solid #d5d5d5;
    border-radius: 8px;
    padding: 10px 11px;
    outline: none;
    background: #fff;
    font-size: 13px;
}

.campo-form input:focus,
.campo-form textarea:focus,
.campo-form select:focus,
.form-editar-regra input:focus,
.form-editar-regra textarea:focus {
    border-color: #8c8c8c;
}

.regras-colunas {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.coluna-regras-titulo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 11px;
}

.coluna-regras-titulo h2 {
    margin: 0;
    font-size: 15px;
}

.coluna-regras-titulo span {
    background: #eee;
    padding: 3px 7px;
    border-radius: 20px;
    font-size: 10px;
}

.regra-card {
    border: 1px solid #e1e1e1;
    border-radius: 10px;
    padding: 13px;
    margin-bottom: 10px;
    background: #fff;
}

.regra-inativa {
    opacity: 0.55;
}

.regra-topo {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.regra-topo h4 {
    margin: 0 0 6px;
    font-size: 13px;
}

.badge-sistema,
.badge-personalizada {
    font-size: 8px;
    border-radius: 4px;
    padding: 3px 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-sistema {
    background: #edf1f4;
}

.badge-personalizada {
    background: #edf7ed;
}

.regra-descricao {
    color: #666;
    font-size: 11px;
    line-height: 1.55;
    margin: 12px 0;
}

.switch-regra {
    width: 34px;
    height: 19px;
    border-radius: 30px;
    border: 0;
    background: #ccc;
    padding: 2px;
    position: relative;
}

.switch-regra span {
    display: block;
    width: 15px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    transition: 0.15s;
}

.switch-regra.ativa {
    background: #111827;
}

.switch-regra.ativa span {
    transform: translateX(15px);
}

.regra-edicao {
    border-top: 1px solid #eee;
    padding-top: 9px;
}

.regra-edicao summary {
    cursor: pointer;
    color: #666;
    font-size: 10px;
}

.form-editar-regra {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.form-excluir-regra {
    margin-top: 8px;
}

.botao-excluir {
    border: 0;
    background: transparent;
    color: #b44949;
    padding: 4px 0;
    font-size: 10px;
}


/* ======================================
   AUTENTICAÇÃO
====================================== */

.auth-body {
    min-height: 100vh;
    background: #f8f8f8;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 35px 20px;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 16px;
    padding: 32px;
    box-shadow:
        0 8px 30px
        rgba(0, 0, 0, 0.04);
}

.auth-card-cadastro {
    max-width: 680px;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 30px;
}

.auth-logo h1 {
    margin: 0;
    font-size: 16px;
}

.auth-logo p {
    margin: 3px 0 0;
    color: #888;
    font-size: 10px;
}

.auth-cabecalho {
    margin-bottom: 22px;
}

.auth-cabecalho h2 {
    margin: 0 0 7px;
    font-size: 24px;
}

.auth-cabecalho p {
    margin: 0;
    color: #777;
    font-size: 12px;
}

.auth-form {
    display: grid;
    gap: 15px;
}

.auth-form input {
    min-height: 42px;
}

.auth-forgot {
    text-align: left;
}

.auth-forgot a {
    font-size: 14px;
    text-decoration: none;
}

.auth-botao {
    width: 100%;
    min-height: 43px;
    margin-top: 5px;
}

.auth-rodape {
    text-align: center;
    border-top: 1px solid #eee;
    margin-top: 23px;
    padding-top: 19px;
    color: #777;
    font-size: 12px;
}

.auth-rodape a {
    color: #111827;
    font-weight: 600;
    margin-left: 3px;
}

.erro-campo {
    color: #b22d2d;
    font-size: 10px;
}

.linha-form {
    display: flex;
    gap: 12px;
}

.campo-menor {
    max-width: 220px;
}


/* ======================================
   TERMOS E PRIVACIDADE
====================================== */

.documentos-legais {
    display: grid;
    gap: 14px;
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid #eeeeee;
}

.documento-legal {
    border: 1px solid #dedede;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}

.documento-legal-cabecalho {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 12px 14px;
    background: #f7f7f8;
    border-bottom: 1px solid #dedede;
}

.documento-legal-cabecalho h3 {
    margin: 0;
    font-size: 13px;
}

.documento-legal-cabecalho span {
    color: #888888;
    font-size: 10px;
}

.documento-legal-texto {
    max-height: 260px;
    overflow-y: auto;
    padding: 15px;
    color: #555555;
    font-size: 11px;
    line-height: 1.65;
    background: #ffffff;
}

.checkbox-legal {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1.5;
    color: #444444;
}

.checkbox-legal input[type="checkbox"] {
    width: 17px;
    height: 17px;
    min-height: auto;
    margin: 1px 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

.checkbox-legal strong {
    color: #111827;
}


/* ======================================
   RESPONSIVO
====================================== */

@media (
    max-width: 900px
) {

    .sidebar {
        width: 230px;
        min-width: 230px;
    }

    .regras-colunas {
        grid-template-columns: 1fr;
    }

    .regras-cabecalho {
        flex-direction: column;
    }
}


@media (
    max-width: 650px
) {

    .app-layout {
        display: block;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        height: auto;
        position: static;
    }

    .sidebar-historico {
        display: none;
    }

    .sidebar-uso {
        margin: 0 14px 10px;
    }

    .sidebar-rodape {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sidebar-rodape form {
        margin-left: auto;
    }

    .botao-logout {
        width: auto;
    }

    .retencao-info {
        display: none;
    }

    .painel-app {
        width: min(
            100% - 28px,
            1100px
        );
        padding-top: 30px;
    }

    .cabecalho-principal h1,
    .regras-cabecalho h1 {
        font-size: 23px;
    }

    #textoConsulta {
        min-height: 210px;
    }

    .linha-form {
        flex-direction: column;
    }

    .campo-menor {
        max-width: none;
    }

    .auth-card {
        padding: 23px;
    }
}



/* ======================================
   MODELO DE RESUMO
====================================== */

.menu-lateral-item {
    position: relative;
}

.menu-status-dot {
    position: absolute;
    right: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #16a34a;
    transform: translateY(-50%);
}

.ativo-menu {
    background: #e7e7e7;
    font-weight: 600;
}

.modelo-sidebar-info {
    padding: 15px 10px;
    color: #666666;
}

.modelo-sidebar-info strong {
    display: block;
    margin-bottom: 7px;
    color: #333333;
    font-size: 12px;
}

.modelo-sidebar-info p {
    margin: 0;
    font-size: 11px;
    line-height: 1.55;
}

.painel-modelo {
    max-width: 900px;
}

.modelo-aviso {
    margin-bottom: 25px;
    padding: 16px 18px;
    border: 1px solid #dfe4ea;
    border-radius: 10px;
    background: #f8fafc;
}

.modelo-aviso strong {
    display: block;
    margin-bottom: 8px;
    color: #111827;
    font-size: 13px;
}

.modelo-aviso p {
    margin: 4px 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.55;
}

.form-modelo-resumo {
    display: grid;
    gap: 20px;
}

.modelo-label-linha {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.modelo-status {
    padding: 4px 8px;
    border-radius: 20px;
    background: #eeeeee;
    color: #777777;
    font-size: 9px;
    font-weight: 600;
}

.modelo-status.ativo {
    background: #e8f7ed;
    color: #217a3c;
}

.textarea-modelo {
    min-height: 450px;
    resize: vertical;
    font-family:
        "SFMono-Regular",
        Consolas,
        "Liberation Mono",
        monospace;
    line-height: 1.6;
    font-size: 13px !important;
}

.modelo-exemplo {
    border: 1px dashed #d3d3d3;
    border-radius: 10px;
    padding: 15px;
    background: #fafafa;
}

.modelo-exemplo strong {
    display: block;
    margin-bottom: 10px;
    color: #555555;
    font-size: 11px;
}

.modelo-exemplo pre {
    margin: 0;
    color: #777777;
    font-family:
        "SFMono-Regular",
        Consolas,
        monospace;
    font-size: 10px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.acoes-modelo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.link-botao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.alerta-sucesso {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #b8e0c2;
    border-radius: 8px;
    background: #eefaf1;
    color: #28753a;
    font-size: 12px;
}

.remover-modelo-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 35px;
    padding-top: 22px;
    border-top: 1px solid #eeeeee;
}

.remover-modelo-box strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.remover-modelo-box p {
    margin: 0;
    color: #888888;
    font-size: 10px;
}

.botao-perigo {
    border: 1px solid #efcaca;
    border-radius: 8px;
    padding: 8px 12px;
    background: #ffffff;
    color: #b42323;
    font-size: 11px;
}

.botao-perigo:hover {
    background: #fff4f4;
}

.modelo-ativo-aviso {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px 13px;
    border: 1px solid #cde5d3;
    border-radius: 9px;
    background: #f4fbf6;
}

.modelo-ativo-aviso > span {
    color: #27833f;
    font-size: 16px;
}

.modelo-ativo-aviso div {
    flex: 1;
}

.modelo-ativo-aviso strong {
    display: block;
    color: #285d35;
    font-size: 11px;
}

.modelo-ativo-aviso small {
    display: block;
    margin-top: 2px;
    color: #64806b;
    font-size: 9px;
}

.modelo-ativo-aviso a {
    color: #28733a;
    font-size: 10px;
    font-weight: 600;
}


@media (
    max-width: 650px
) {

    .textarea-modelo {
        min-height: 330px;
    }

    .remover-modelo-box {
        align-items: flex-start;
        flex-direction: column;
    }

    .modelo-label-linha {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }
}
