/* =====================================================
   GoChatbot | Base do painel
   Fonte, cores, navegação e componentes comuns a todas as páginas.

   Regra de cantos: controles, cartões e campos 8px; balões de mensagem 12px;
   avatar sempre redondo. Nada de pílula, nada de gradiente.
   Cor de destaque: uma só (--destaque). Estados usam cinza, não outra cor.
   ===================================================== */

@font-face {
    font-family: "Geist";
    src: url("../_assets/fontes/geist-latin-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Geist";
    src: url("../_assets/fontes/geist-latin-ext-wght-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --fundo:            #f5f5f6;
    --superficie:       #ffffff;
    --superficie_2:     #f0f0f2;
    --superficie_3:     #e8e8eb;
    --borda:            #e4e4e8;
    --borda_forte:      #d0d0d6;
    --texto:            #18181c;
    --texto_2:          #4f4f58;
    --texto_3:          #85858f;
    --destaque:         #15664f;
    --destaque_hover:   #0f5240;
    --destaque_fundo:   #e7f1ed;
    --destaque_borda:   #c8ded5;
    --perigo:           #b42318;
    --perigo_fundo:     #fcefed;
    --aviso_texto:      #7a5200;
    --aviso_fundo:      #fbf4e2;
    --raio:             8px;
    --raio_balao:       12px;
    --sombra:           0 1px 2px rgba(24, 24, 28, .05);
    --sombra_flutuante: 0 12px 32px rgba(24, 24, 28, .14), 0 2px 6px rgba(24, 24, 28, .06);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
    font-family: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--texto);
    background: var(--fundo);
    font-feature-settings: "ss01", "tnum";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.icone { width: 20px; height: 20px; flex: none; }

:focus-visible { outline: 2px solid var(--destaque); outline-offset: 2px; }

/* ─── Seção de configurações ─────────────────────────────────────────── */

.app_config {
    display: grid;
    grid-template-columns: 248px 1fr;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.menu_config {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
    background: var(--superficie);
    border-right: 1px solid var(--borda);
    overflow-y: auto;
}
.menu_voltar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    padding: 6px 8px;
    border-radius: var(--raio);
    color: var(--texto_2);
    font-weight: 550;
    text-decoration: none;
}
.menu_voltar:hover { background: var(--superficie_2); color: var(--texto); }
.menu_voltar .icone { width: 18px; height: 18px; }
.menu_titulo { display: grid; gap: 2px; padding: 18px 10px 14px; }
.menu_titulo strong { font-size: 18px; font-weight: 650; letter-spacing: -.02em; }
.menu_titulo span { color: var(--texto_3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu_itens { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.menu_item {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--raio);
    color: var(--texto_2);
    font-weight: 550;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.menu_item:hover { background: var(--superficie_2); color: var(--texto); }
.menu_item.ativo { background: var(--superficie_2); color: var(--texto); }
.menu_item.ativo .icone { color: var(--destaque); }
.menu_sair { margin-top: auto; }

/* ─── Cabeçalho de página ────────────────────────────────────────────── */

.pagina { overflow-y: auto; min-width: 0; min-height: 0; }
.pagina_conteudo { max-width: 920px; margin: 0 auto; padding: 36px 32px 64px; }
.pagina_topo { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.pagina_titulo { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.pagina_descricao { margin: 6px 0 0; color: var(--texto_2); max-width: 60ch; }

/* ─── Botões ─────────────────────────────────────────────────────────── */

.botao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--borda_forte);
    border-radius: var(--raio);
    background: var(--superficie);
    color: var(--texto);
    font-weight: 550;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--sombra);
    transition: background .15s, border-color .15s, transform .08s;
}
.botao:hover { background: var(--superficie_2); }
.botao:active { transform: translateY(1px); }
.botao:disabled { opacity: .55; cursor: default; transform: none; }
.botao .icone { width: 18px; height: 18px; }

.botao_primario { background: var(--destaque); border-color: var(--destaque); color: #fff; }
.botao_primario:hover { background: var(--destaque_hover); border-color: var(--destaque_hover); }
.botao_perigo { color: var(--perigo); }
.botao_perigo:hover { background: var(--perigo_fundo); border-color: #f0c9c4; }
.botao_pequeno { height: 30px; padding: 0 10px; font-size: 13px; }

.botao_icone {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: var(--raio);
    background: transparent;
    color: var(--texto_2);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.botao_icone:hover { background: var(--superficie_2); color: var(--texto); }
.botao_icone .icone { width: 19px; height: 19px; }

/* ─── Campos ─────────────────────────────────────────────────────────── */

.campo_rotulo { display: block; margin-bottom: 6px; font-weight: 550; }
.campo_ajuda  { margin: 6px 0 0; font-size: 12.5px; color: var(--texto_2); }

.campo {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--borda_forte);
    border-radius: var(--raio);
    background: var(--superficie);
    outline: 0;
    transition: border-color .15s, box-shadow .15s;
}
textarea.campo { height: auto; min-height: 140px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.campo:focus { border-color: var(--destaque); box-shadow: 0 0 0 3px var(--destaque_fundo); }
.campo::placeholder { color: var(--texto_3); }

/* Busca com ícone dentro */
.busca { position: relative; }
.busca .icone { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--texto_3); pointer-events: none; }
.busca .campo { padding-left: 36px; }
.busca kbd {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    padding: 1px 6px;
    border: 1px solid var(--borda);
    border-radius: 5px;
    background: var(--superficie_2);
    color: var(--texto_3);
    font: 500 11px/1.4 "Geist", system-ui, sans-serif;
}
.busca .campo:focus + kbd, .busca .campo:not(:placeholder-shown) + kbd { display: none; }

/* Controle segmentado (filtros) */
.segmentado { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--raio); background: var(--superficie_2); }
.segmentado button {
    height: 28px;
    padding: 0 11px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--texto_2);
    font-size: 13px;
    font-weight: 550;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.segmentado button:hover { color: var(--texto); }
.segmentado button[aria-pressed="true"] { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra), 0 0 0 1px var(--borda); }

/* Chave liga/desliga */
.chave { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.chave input { position: absolute; opacity: 0; pointer-events: none; }
.chave_trilho { position: relative; flex: none; width: 34px; height: 20px; border-radius: 10px; background: var(--borda_forte); transition: background .2s; }
.chave_trilho::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(24, 24, 28, .25);
    transition: transform .2s;
}
.chave input:checked + .chave_trilho { background: var(--destaque); }
.chave input:checked + .chave_trilho::after { transform: translateX(14px); }
.chave input:focus-visible + .chave_trilho { outline: 2px solid var(--destaque); outline-offset: 2px; }
.chave input:disabled + .chave_trilho { opacity: .5; }
.chave_texto { font-size: 13px; font-weight: 550; color: var(--texto_2); }

/* ─── Avatar e etiquetas ─────────────────────────────────────────────── */

.avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--superficie_3);
    color: var(--texto_2);
    font-weight: 600;
    font-size: 13.5px;
    letter-spacing: .01em;
}

.etiqueta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 6px;
    border-radius: 5px;
    background: var(--superficie_2);
    color: var(--texto_2);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}
.etiqueta .icone { width: 12px; height: 12px; }

/* ─── Carregando (esqueleto no formato do conteúdo) ──────────────────── */

.esqueleto {
    display: block;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--superficie_2) 0%, var(--superficie_3) 50%, var(--superficie_2) 100%);
    background-size: 200% 100%;
    animation: esqueleto 1.3s ease-in-out infinite;
}
@keyframes esqueleto { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ─── Aviso flutuante ────────────────────────────────────────────────── */

.aviso_flutuante {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(92vw, 460px);
    padding: 11px 16px;
    border-radius: var(--raio);
    background: var(--texto);
    color: #fff;
    line-height: 1.4;
    box-shadow: var(--sombra_flutuante);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 8px);
    transition: opacity .2s, transform .2s;
}
.aviso_flutuante.visivel { opacity: 1; transform: translate(-50%, 0); }
.aviso_flutuante.erro { background: var(--perigo); }

/* ─── Estado vazio ───────────────────────────────────────────────────── */

.vazio { padding: 40px 24px; text-align: center; color: var(--texto_2); }
.vazio strong { display: block; margin-bottom: 4px; color: var(--texto); font-size: 15px; font-weight: 600; }

/* ─── Celular ────────────────────────────────────────────────────────── */

@media screen and (max-width: 780px) {
    /* Configurações: menu vira um topo com abas roláveis */
    /* minmax(0, 1fr): sem isso a faixa de abas larga empurra a página para fora da tela */
    .app_config { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .menu_config { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--borda); overflow: visible; }
    .menu_titulo { display: none; }
    .menu_itens { display: flex; flex-basis: 100%; order: 3; gap: 4px; overflow-x: auto; scrollbar-width: none; }
    .menu_item { flex: none; height: 34px; white-space: nowrap; }
    .menu_sair { margin: 0 0 0 auto; height: 34px; }
    .pagina_conteudo { padding: 22px 16px 40px; }
    .pagina_topo { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
