/* SinTextil - estilos proprios. O Bootstrap e a base; aqui ficam apenas os ajustes do layout. */

:root, .tema-previa[data-tema="claro"] {
    --cor-primaria: #1e4d8c;
    --cor-primaria-escura: #173c6e;
    --sidebar-bg: #16202e;
    --sidebar-texto: #b8c4d4;
    --sidebar-texto-forte: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, .07);
    --sidebar-ativo: rgba(255, 255, 255, .12);
    --sidebar-linha: rgba(255, 255, 255, .1);
    --sidebar-w: 290px;
    --sidebar-w-colapsada: 68px;
    --altura-cabecalho: 56px;
    --fundo: #f3f5f8;
    --borda: #dfe4ec;
    --texto-suave: #6b7686;
    --superficie: #ffffff;
    --superficie-suave: #fafbfd;
    --texto-base: #1f2a37;
    --texto-rotulo: #4a5565;
    --hover-claro: #eef1f6;
    --borda-tracejada: #c3ccd9;
    --cor-erro-codigo: #b9c3d1;
    --foco-borda: #7da0cf;
    --foco-sombra: rgba(30, 77, 140, .15);
    --avatar-bg: #3b6aa8;

    --bs-primary: #1e4d8c;
    --bs-primary-rgb: 30, 77, 140;
    --bs-link-color: #1e4d8c;
    --bs-link-color-rgb: 30, 77, 140;
    --bs-link-hover-color: #173c6e;
    --bs-link-hover-color-rgb: 23, 60, 110;
    --bs-body-bg: var(--fundo);
    --bs-border-color: var(--borda);
}

/* ---------- Temas. O <html> recebe data-tema (claro, escuro, oceano, grafite, floresta, vinho) e, nos escuros, data-bs-theme="dark".
   Cada tema e um conjunto de variaveis; .tema-previa repete o conjunto para desenhar os cartoes da aba Temas do sistema. ---------- */
:root[data-bs-theme="dark"], .tema-previa[data-tema="escuro"] {
    color-scheme: dark;
    --cor-primaria: #1e4d8c;
    --cor-primaria-escura: #173c6e;
    --sidebar-texto: #b8c4d4;
    --foco-borda: #7fb0ee;
    --foco-sombra: rgba(30, 77, 140, .15);
    --avatar-bg: #3b6aa8;
    --bs-primary: #1e4d8c;
    --bs-primary-rgb: 30, 77, 140;
    --fundo: #0e1520;
    --superficie: #172131;
    --superficie-suave: #131c2a;
    --texto-base: #e3e8ef;
    --texto-rotulo: #b3bdcb;
    --texto-suave: #98a5b7;
    --hover-claro: #223049;
    --borda: #2a3850;
    --borda-tracejada: #3a4a63;
    --cor-erro-codigo: #46566f;
    --sidebar-bg: #0b121c;
    --sidebar-linha: rgba(255, 255, 255, .08);

    --bs-body-bg: var(--fundo);
    --bs-body-color: var(--texto-base);
    --bs-border-color: var(--borda);
    --bs-link-color: #7fb0ee;
    --bs-link-color-rgb: 127, 176, 238;
    --bs-link-hover-color: #a9ccf5;
    --bs-link-hover-color-rgb: 169, 204, 245;
}

:root[data-tema="oceano"], .tema-previa[data-tema="oceano"] {
    --cor-primaria: #0e7490;
    --cor-primaria-escura: #0b5a72;
    --sidebar-bg: #0f2f3d;
    --sidebar-texto: #a9c7d2;
    --fundo: #eef6f8;
    --borda: #d3e3e8;
    --texto-suave: #55707b;
    --superficie: #ffffff;
    --superficie-suave: #f7fbfc;
    --texto-base: #16303a;
    --texto-rotulo: #3d5964;
    --hover-claro: #e1eef2;
    --borda-tracejada: #b5cdd5;
    --cor-erro-codigo: #b3cbd3;
    --foco-borda: #0e7490;
    --foco-sombra: rgba(14, 116, 144, .25);
    --avatar-bg: #2a8aa6;
    --bs-primary: #0e7490;
    --bs-primary-rgb: 14, 116, 144;
    --bs-link-color: #0e7490;
    --bs-link-color-rgb: 14, 116, 144;
    --bs-link-hover-color: #0b5a72;
    --bs-link-hover-color-rgb: 11, 90, 114;
    --bs-body-bg: var(--fundo);
    --bs-border-color: var(--borda);
}
:root[data-tema="grafite"], .tema-previa[data-tema="grafite"] {
    --cor-primaria: #475569;
    --cor-primaria-escura: #334155;
    --sidebar-bg: #2a2e35;
    --sidebar-texto: #b6bcc6;
    --fundo: #f3f4f6;
    --borda: #dcdfe4;
    --texto-suave: #646b77;
    --superficie: #ffffff;
    --superficie-suave: #fafafb;
    --texto-base: #1f2328;
    --texto-rotulo: #444b57;
    --hover-claro: #eaecef;
    --borda-tracejada: #c0c5cd;
    --cor-erro-codigo: #c3c8d0;
    --foco-borda: #475569;
    --foco-sombra: rgba(71, 85, 105, .25);
    --avatar-bg: #64748b;
    --bs-primary: #475569;
    --bs-primary-rgb: 71, 85, 105;
    --bs-link-color: #475569;
    --bs-link-color-rgb: 71, 85, 105;
    --bs-link-hover-color: #334155;
    --bs-link-hover-color-rgb: 51, 65, 85;
    --bs-body-bg: var(--fundo);
    --bs-border-color: var(--borda);
}
:root[data-tema="floresta"], .tema-previa[data-tema="floresta"] {
    color-scheme: dark;
    --cor-primaria: #1d8a5a;
    --cor-primaria-escura: #17724a;
    --sidebar-bg: #08110c;
    --sidebar-texto: #a3c2b0;
    --fundo: #0e1913;
    --borda: #25402f;
    --texto-suave: #8fab9c;
    --superficie: #16251c;
    --superficie-suave: #121f17;
    --texto-base: #e3efe8;
    --texto-rotulo: #b5cbbd;
    --hover-claro: #1f3528;
    --borda-tracejada: #36563f;
    --cor-erro-codigo: #3f5a49;
    --foco-borda: #5fd0a0;
    --foco-sombra: rgba(29, 138, 90, .25);
    --avatar-bg: #2f9d70;
    --bs-primary: #1d8a5a;
    --bs-primary-rgb: 29, 138, 90;
    --bs-link-color: #5fd0a0;
    --bs-link-color-rgb: 95, 208, 160;
    --bs-link-hover-color: #8fe3bf;
    --bs-link-hover-color-rgb: 143, 227, 191;
    --bs-body-bg: var(--fundo);
    --bs-border-color: var(--borda);
    --sidebar-linha: rgba(255, 255, 255, .08);
    --bs-body-color: var(--texto-base);
}
:root[data-tema="vinho"], .tema-previa[data-tema="vinho"] {
    color-scheme: dark;
    --cor-primaria: #c2416b;
    --cor-primaria-escura: #a23358;
    --sidebar-bg: #10080c;
    --sidebar-texto: #cdb0bc;
    --fundo: #180f14;
    --borda: #43262f;
    --texto-suave: #b49aa6;
    --superficie: #251820;
    --superficie-suave: #1f141a;
    --texto-base: #f3e6ec;
    --texto-rotulo: #d3bcc7;
    --hover-claro: #34202a;
    --borda-tracejada: #5a3844;
    --cor-erro-codigo: #5c3f4b;
    --foco-borda: #f08aa8;
    --foco-sombra: rgba(194, 65, 107, .25);
    --avatar-bg: #b24a6c;
    --bs-primary: #c2416b;
    --bs-primary-rgb: 194, 65, 107;
    --bs-link-color: #f08aa8;
    --bs-link-color-rgb: 240, 138, 168;
    --bs-link-hover-color: #f6adc2;
    --bs-link-hover-color-rgb: 246, 173, 194;
    --bs-body-bg: var(--fundo);
    --bs-border-color: var(--borda);
    --sidebar-linha: rgba(255, 255, 255, .08);
    --bs-body-color: var(--texto-base);
}

html { font-size: 15px; }
body { background: var(--fundo); color: var(--texto-base); }

.btn-primary {
    --bs-btn-bg: var(--cor-primaria);
    --bs-btn-border-color: var(--cor-primaria);
    --bs-btn-hover-bg: var(--cor-primaria-escura);
    --bs-btn-hover-border-color: var(--cor-primaria-escura);
    --bs-btn-active-bg: var(--cor-primaria-escura);
    --bs-btn-active-border-color: var(--cor-primaria-escura);
    --bs-btn-disabled-bg: var(--cor-primaria);
    --bs-btn-disabled-border-color: var(--cor-primaria);
}
.form-control, .form-select { background-color: var(--superficie); }
.form-control:focus, .form-select:focus {
    background-color: var(--superficie);
    border-color: var(--foco-borda);
    box-shadow: 0 0 0 .2rem var(--foco-sombra);
}

/* ---------- Menu lateral ---------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-texto);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width .2s ease, transform .2s ease;
}
.sidebar-topo {
    height: var(--altura-cabecalho);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid var(--sidebar-linha);
    flex-shrink: 0;
}
.marca {
    display: flex;
    align-items: center;
    gap: .7rem;
    color: var(--sidebar-texto-forte);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
    min-width: 0;
}
.marca:hover { color: var(--sidebar-texto-forte); }
.marca-icone {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--cor-primaria);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.marca-nome { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .75rem .6rem;
}
.menu-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    width: 100%;
    padding: .6rem .75rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--sidebar-texto);
    text-decoration: none;
    font-size: .93rem;
    text-align: left;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.menu-item i.bi:first-child { flex: 0 0 20px; font-size: 1.1rem; text-align: center; }
.menu-item:hover { background: var(--sidebar-hover); color: var(--sidebar-texto-forte); }
.menu-item.ativo { background: var(--sidebar-ativo); color: var(--sidebar-texto-forte); }
.menu-texto { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-seta { font-size: .75rem; transition: transform .2s ease; }
.menu-grupo.aberto > .menu-grupo-botao .menu-seta { transform: rotate(180deg); }
.menu-sub { display: none; padding: .15rem 0 .25rem 1.1rem; }
.menu-grupo.aberto > .menu-sub { display: block; }
.menu-subitem { font-size: .88rem; padding-top: .5rem; padding-bottom: .5rem; }
.menu-divisor { border: 0; border-top: 1px solid var(--sidebar-linha); margin: .75rem .25rem; opacity: 1; }

.sidebar-usuario {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .8rem 1rem;
    border-top: 1px solid var(--sidebar-linha);
    color: var(--sidebar-texto);
    text-decoration: none;
    flex-shrink: 0;
    transition: background .15s ease;
}
.sidebar-usuario:hover, .sidebar-usuario.ativo { background: var(--sidebar-hover); color: var(--sidebar-texto-forte); }
.avatar {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--avatar-bg);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 600;
}
.avatar-grande { width: 56px; height: 56px; flex-basis: 56px; font-size: 1.2rem; }
.usuario-dados { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.usuario-nome { color: var(--sidebar-texto-forte); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-tipo { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-seta { font-size: .8rem; opacity: .7; }

/* Botoes de tema e sair (abaixo do perfil) */
.sidebar-acoes {
    display: flex;
    gap: .5rem;
    padding: .6rem .8rem .8rem;
    flex-shrink: 0;
}
.sidebar-acoes form { flex: 1; margin: 0; }
.sidebar-acao {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .45rem .5rem;
    border: 1px solid var(--sidebar-linha);
    border-radius: 6px;
    background: transparent;
    color: var(--sidebar-texto);
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.sidebar-acao:hover { background: var(--sidebar-hover); color: var(--sidebar-texto-forte); }
.sidebar-acao .bi { font-size: 1rem; }

.sidebar-fundo {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 35, .5);
    z-index: 1030;
}

/* ---------- Area de conteudo ---------- */
.conteudo-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-w);
    transition: margin-left .2s ease;
}
.cabecalho {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--altura-cabecalho);
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    background: var(--superficie);
    border-bottom: 1px solid var(--borda);
}
.btn-icone {
    border: 0;
    background: transparent;
    font-size: 1.4rem;
    line-height: 1;
    padding: .25rem .5rem;
    color: var(--texto-rotulo);
}
.btn-icone:hover { background: var(--hover-claro); }
.cabecalho-empresa { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.empresa-rotulo { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); white-space: nowrap; }
.empresa-nome { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empresa-nenhuma { color: var(--texto-suave); font-size: .9rem; }
.empresa-form { min-width: 0; }
.empresa-form .form-select { min-width: 180px; max-width: 320px; }

.conteudo { flex: 1; padding: 1.5rem; }
.pagina-titulo { margin-bottom: 1.25rem; }
.pagina-titulo h1 { font-size: 1.45rem; font-weight: 600; margin-bottom: .15rem; }

.rodape {
    position: sticky;   /* sempre visivel na parte de baixo da janela */
    bottom: 0;
    z-index: 1010;
    padding: .8rem 1.5rem;
    border-top: 1px solid var(--borda);
    background: var(--superficie);
    font-size: .8rem;
    color: var(--texto-suave);
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .75rem;
}
.rodape strong, .acesso-rodape strong { font-weight: 600; color: var(--texto-rotulo); }
.rodape-sep { opacity: .5; }
.rodape-icone { font-size: .9em; color: var(--texto-suave); margin-right: .2rem; vertical-align: -.05em; }
.acesso-rodape .rodape-sep { display: none; }

/* ---------- Cartoes e blocos ---------- */
.cartao-info, .cartao-bloco {
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: 8px;
    padding: 1rem 1.15rem;
}
.cartao-info { display: flex; flex-direction: column; gap: .15rem; height: 100%; }
.cartao-info-rotulo { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); }
.cartao-info-valor { font-size: 1.15rem; font-weight: 600; }
.cartao-info-nota { font-size: .85rem; color: var(--texto-suave); }

.area-dashboard {
    border: 1px dashed var(--borda-tracejada);
    border-radius: 8px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--texto-suave);
    background: var(--superficie-suave);
}
.area-dashboard i { font-size: 1.8rem; display: block; margin-bottom: .6rem; opacity: .7; }

.perfil-topo { display: flex; align-items: center; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--borda); }
.perfil-topo .avatar { background: var(--cor-primaria); }
.perfil-nome { font-size: 1.15rem; font-weight: 600; }
.perfil-dados { display: grid; grid-template-columns: 200px 1fr; gap: .6rem 1rem; margin: 0; }
.perfil-dados dt { color: var(--texto-suave); font-weight: 500; }
.perfil-dados dd { margin: 0; }

.erro-pagina { max-width: 480px; margin: 3rem auto; text-align: center; }
.erro-codigo { font-size: 3.5rem; font-weight: 700; color: var(--cor-erro-codigo); line-height: 1; }
.erro-titulo { font-size: 1.3rem; margin: .5rem 0; }
.erro-detalhe { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; background: var(--superficie); border: 1px solid var(--borda); border-radius: 6px; padding: .5rem .75rem; text-align: left; word-break: break-word; }

/* ---------- Tabelas ordenaveis (classe sortable-table + data-col nos th) ---------- */
.sortable-table th[data-col] { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable-table th[data-col]::after { content: "\21C5"; margin-left: .35rem; opacity: .3; font-size: .8em; }
.sortable-table th[data-col][aria-sort="ascending"]::after { content: "\25B2"; opacity: .8; }
.sortable-table th[data-col][aria-sort="descending"]::after { content: "\25BC"; opacity: .8; }

/* ---------- Telas de acesso (login) ---------- */
.tela-acesso { background: var(--fundo); }
.acesso-centro { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; gap: 1.25rem; }
.acesso-caixa { width: 100%; max-width: 400px; background: var(--superficie); border: 1px solid var(--borda); border-radius: 10px; padding: 2rem; }
.acesso-marca { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-bottom: 1.5rem; }
.acesso-marca-nome { font-size: 1.3rem; font-weight: 600; }
.acesso-titulo { font-size: 1.3rem; font-weight: 600; margin-bottom: .25rem; }
.acesso-sub { font-size: .9rem; margin-bottom: 1.25rem; }
.acesso-rodape { font-size: .8rem; color: var(--texto-suave); text-align: center; display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem .75rem; max-width: 520px; }

/* ---------- Menu retratil (computador) ---------- */
@media (min-width: 992px) {
    body.sidebar-colapsada .sidebar { width: var(--sidebar-w-colapsada); }
    body.sidebar-colapsada .conteudo-wrap { margin-left: var(--sidebar-w-colapsada); }
    body.sidebar-colapsada .marca-nome,
    body.sidebar-colapsada .menu-texto,
    body.sidebar-colapsada .menu-seta,
    body.sidebar-colapsada .usuario-dados,
    body.sidebar-colapsada .usuario-seta,
    body.sidebar-colapsada .acao-texto { display: none; }
    body.sidebar-colapsada .sidebar-acoes { flex-direction: column; padding-left: .6rem; padding-right: .6rem; }
    body.sidebar-colapsada .menu-sub { display: none !important; }
    body.sidebar-colapsada .sidebar-topo,
    body.sidebar-colapsada .sidebar-usuario { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-colapsada .menu-item { justify-content: center; padding-left: 0; padding-right: 0; }
}

/* ---------- Telas menores: menu vira painel sobreposto ---------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-aberta .sidebar { transform: translateX(0); }
    body.sidebar-aberta .sidebar-fundo { display: block; }
    .conteudo-wrap { margin-left: 0; }
    .conteudo { padding: 1rem; }
    .cabecalho { padding: 0 .75rem; gap: .5rem; }
    .empresa-rotulo { display: none; }
    .empresa-form .form-select { min-width: 140px; }
    .perfil-dados { grid-template-columns: 1fr; gap: .1rem; }
    .perfil-dados dd { margin-bottom: .6rem; }
    .rodape { padding: .8rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar, .conteudo-wrap, .menu-seta { transition: none; }
}

/* ---------- Cadastro de empresas ---------- */
.pagina-titulo-acoes { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.bloco-titulo { font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; }
.bloco-cabecalho { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.filtros-lista { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filtros-lista .input-group { flex: 1 1 280px; width: auto; }
.filtros-lista .form-select { width: auto; flex: 0 0 auto; }
.filtros-lista input[type=date].form-control, .filtros-lista input[type=month].form-control { width: auto; flex: 0 0 auto; }
.paginacao-linha { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .75rem; }
.socio-item { border: 1px solid var(--borda); border-radius: 8px; background: var(--superficie-suave); padding: 1rem; margin-bottom: .75rem; }
.socio-topo { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.responsavel-grupo { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
.responsavel-grupo + .responsavel-grupo { padding-top: 1.1rem; border-top: 1px solid var(--borda); }
.responsavel-grupo legend { float: none; width: auto; font-size: .95rem; font-weight: 600; margin-bottom: .75rem; }
.responsavel-nome { font-weight: 600; margin-bottom: .5rem; }
@media (max-width: 575.98px) { .perfil-dados { grid-template-columns: 1fr; gap: .1rem; } .perfil-dados dd { margin-bottom: .5rem; } }

/* ---------- Consulta de tela por codigo (menu lateral) e codigo da tela ---------- */
.menu-ir { padding: .6rem .8rem; border-top: 1px solid var(--sidebar-linha); flex-shrink: 0; margin: 0; }
.menu-ir .input-group-text,
.menu-ir .form-control {
    background: var(--sidebar-hover);
    border-color: var(--sidebar-linha);
    color: var(--sidebar-texto);
}
.menu-ir .form-control::placeholder { color: var(--sidebar-texto); opacity: .65; }
.menu-ir .form-control:focus { background: var(--sidebar-ativo); color: var(--sidebar-texto-forte); border-color: var(--sidebar-texto); box-shadow: none; }
.menu-codigo { margin-left: auto; font-size: .72rem; color: var(--sidebar-texto); opacity: .7; font-variant-numeric: tabular-nums; }
body.sidebar-colapsada .menu-ir,
body.sidebar-colapsada .menu-codigo { display: none; }
.cabecalho-tela { font-size: .8rem; color: var(--texto-suave); white-space: nowrap; }
.cabecalho-tela strong { color: var(--texto-base); font-variant-numeric: tabular-nums; }
@media (max-width: 575.98px) { .cabecalho-tela { display: none; } }

/* ---------- Painel "Sobre a tela" (somente Desenvolvedor Principal) ---------- */
.painel-dev { width: min(480px, 100vw); }
.painel-dev .offcanvas-title { font-size: 1.1rem; font-weight: 600; }
.dev-titulo { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.dev-dados { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: .4rem .75rem; margin: 0 0 1rem; font-size: .9rem; }
.dev-dados dt { color: var(--texto-suave); font-weight: 500; }
.dev-dados dd { margin: 0; overflow-wrap: anywhere; }
.dev-secao { font-size: .95rem; font-weight: 600; margin: 1rem 0 .5rem; }
.dev-tabela { border: 1px solid var(--borda); border-radius: 6px; padding: .5rem .75rem; margin-bottom: .5rem; background: var(--superficie-suave); }
.dev-tabela summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; }
.dev-tabela[open] summary { margin-bottom: .5rem; }
.dev-colunas { font-size: .8rem; }
.cabecalho-acoes { display: flex; align-items: center; gap: .5rem; }

/* ---------- Usuarios: guias e matriz de permissoes ---------- */
.guias-usuario { margin-bottom: 0; }
.guias-usuario .nav-link { color: var(--texto-suave); }
.guias-usuario .nav-link.active { color: var(--texto-base); background: var(--superficie); border-color: var(--borda) var(--borda) var(--superficie); }
.guias-conteudo { border-top-left-radius: 0; border-top-right-radius: 0; }
.lista-marcar { display: grid; gap: .5rem; }
.matriz-legenda { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .85rem; color: var(--texto-suave); margin-bottom: .75rem; }
.matriz { font-size: .85rem; }
.matriz-modulo { min-width: 190px; position: sticky; left: 0; background: var(--superficie); z-index: 1; font-weight: 500; }
.matriz-acao { font-weight: 500; font-size: .75rem; white-space: nowrap; }
.perm-celula {
    position: relative; width: 34px; height: 30px; border: 1px solid var(--borda); border-radius: 6px;
    background: var(--superficie-suave); color: var(--texto-suave); line-height: 1; padding: 0;
}
.perm-celula:hover:not(:disabled) { border-color: var(--texto-suave); }
.perm-celula:disabled { opacity: .6; cursor: not-allowed; }
.perm-celula.perm-1, .perm-exemplo.perm-1 { background: #d1e7dd; border-color: #75b798; color: #0a3622; }
.perm-celula.perm-0, .perm-exemplo.perm-0 { background: #f8d7da; border-color: #ea868f; color: #58151c; }
[data-bs-theme="dark"] .perm-celula.perm-1, [data-bs-theme="dark"] .perm-exemplo.perm-1 { background: #0f3d2a; border-color: #2c7a55; color: #9be0bd; }
[data-bs-theme="dark"] .perm-celula.perm-0, [data-bs-theme="dark"] .perm-exemplo.perm-0 { background: #4a1a20; border-color: #a94350; color: #f1aeb5; }
.perm-celula.perm-perfil-1::after, .perm-celula.perm-perfil-0::after {
    content: ""; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%;
}
.perm-celula.perm-perfil-1::after { background: #198754; }
.perm-celula.perm-perfil-0::after { background: #dc3545; }
.perm-exemplo { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 22px; border: 1px solid var(--borda); border-radius: 5px; background: var(--superficie-suave); }

/* ---------- Foto do usuario (avatar) ---------- */
.avatar-foto { overflow: hidden; background: transparent !important; }
.avatar-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-previa { width: 88px; height: 88px; flex: 0 0 88px; font-size: 1.8rem; background: var(--cor-primaria); }
.avatar-form { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.avatar-campos { flex: 1 1 260px; max-width: 420px; }
.avatar-botoes { align-self: flex-start; }
.lista-avatar { width: 28px; height: 28px; flex-basis: 28px; font-size: .7rem; margin-right: .5rem; vertical-align: middle; }

/* ---------- Autoria do registro (cadastrado por / alterado por) ---------- */
.registro-info { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--borda); color: var(--texto-suave); font-size: .8rem; }
.registro-info i { opacity: .7; }
.registro-icone { color: var(--texto-suave); opacity: .7; margin-right: .35rem; cursor: help; font-size: .9rem; vertical-align: middle; }

/* ---------- Configuracoes do sistema: SQL, backup e relatorio ---------- */
.sql-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; align-items: start; }
.sql-tabelas { max-height: 70vh; overflow: auto; padding: .75rem; }
.sql-tabelas { position: relative; }
.sql-tabela { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .25rem .4rem; border-radius: 4px; font-size: .82rem; color: var(--texto); }
.sql-tabela:hover { background: var(--superficie-suave); }
.sql-editor, .sql-realce { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; line-height: 1.5; tab-size: 4; }
/* Realce de sintaxe: o <pre> colorido fica por tras do textarea transparente (ativado por js/sql.js) */
.sql-editor-caixa { position: relative; }
.sql-realce { display: none; position: absolute; inset: 0; margin: 0; padding: .375rem .75rem; border: 1px solid transparent; border-radius: var(--bs-border-radius, .375rem); overflow: hidden; white-space: pre; color: var(--texto); pointer-events: none; }
.sql-editor-caixa.sql-ativo .sql-realce { display: block; }
.sql-editor-caixa.sql-ativo .sql-editor { position: relative; background: transparent !important; color: transparent; caret-color: var(--texto); white-space: pre; overflow: auto; }
.sql-editor-caixa.sql-ativo .sql-editor::selection { background: rgba(13, 110, 253, .28); color: transparent; }
.sql-editor-caixa.sql-ativo { background: var(--bs-body-bg, #fff); border-radius: var(--bs-border-radius, .375rem); }
.sql-kw { color: #0b4fd1; font-weight: 600; }
.sql-fn { color: #7a3ea8; }
.sql-str { color: #1a7f37; }
.sql-num { color: #b35900; }
.sql-id { color: #0a7d8c; }
.sql-com { color: #6e7781; font-style: italic; }
.sql-op { color: #b3261e; }
[data-bs-theme="dark"] .sql-kw { color: #7fb2ff; }
[data-bs-theme="dark"] .sql-fn { color: #d2a8ff; }
[data-bs-theme="dark"] .sql-str { color: #7ee2a0; }
[data-bs-theme="dark"] .sql-num { color: #ffb86b; }
[data-bs-theme="dark"] .sql-id { color: #6fdbe8; }
[data-bs-theme="dark"] .sql-com { color: #8b949e; }
[data-bs-theme="dark"] .sql-op { color: #ff8e86; }
.sql-opcoes { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin-top: .75rem; }
.sql-resultado { max-height: 55vh; overflow: auto; font-size: .82rem; }
.sql-cmd { max-width: 340px; word-break: break-word; }
.sql-principal { min-width: 0; }
@media (max-width: 991.98px) { .sql-layout { grid-template-columns: 1fr; } .sql-tabelas { max-height: 160px; } }
.backup-icone { font-size: 1.6rem; color: var(--cor-primaria); margin-bottom: .4rem; }
.relatorio-previa { border: 1px dashed var(--borda); border-radius: 6px; padding: 1rem; background: var(--superficie-suave); }
.relatorio-previa-cab { border-bottom: 1px solid var(--borda); padding-bottom: .6rem; margin-bottom: .6rem; }
.relatorio-previa-corpo { padding: 1.2rem 0; text-align: center; }
.relatorio-previa-rod { border-top: 1px solid var(--borda); padding-top: .5rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.relatorio-previa-cab { padding: .6rem .8rem; border-bottom: 3px solid var(--borda); border-radius: 4px 4px 0 0; }
.relatorio-previa-tabela { width: 100%; font-size: .82rem; border-collapse: collapse; margin: .6rem 0; background: #fff; color: #000; }
.relatorio-previa-tabela th, .relatorio-previa-tabela td { padding: .3rem .5rem; border: 1px solid #d0d7de; }
.relatorio-previa-tabela th { border-bottom-width: 2px; }
.relatorio-previa-tabela tfoot td { font-weight: 600; border-top-width: 2px; }
.cor-seletor { max-width: 3.2rem; padding: .25rem; }
.relatorio-previa-logo { display: inline-block; float: left; margin-right: .8rem; padding: .5rem .7rem; border: 1px dashed currentColor; border-radius: 4px; font-size: .7rem; font-weight: 700; letter-spacing: .05em; opacity: .85; }
.relatorio-previa-cab::after { content: ""; display: table; clear: both; }
.texto-quebra-linha { white-space: pre-line; }
.plano-toggle { border: 0; background: transparent; padding: 0; margin-right: .35rem; line-height: 1; color: var(--bs-primary); cursor: pointer; font-size: 1.05rem; }
.plano-toggle:hover { color: var(--bs-primary-text-emphasis, #0a3a78); }
.plano-toggle-espaco { display: inline-block; width: 1.4rem; }
.resumo-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.resumo-card { background: var(--superficie); border: 1px solid var(--borda); border-radius: .6rem; padding: .75rem 1rem; }
.resumo-card .rotulo { color: var(--texto-suave); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.resumo-card .valor { font-size: 1.25rem; font-weight: 700; color: var(--texto-base); }
.resumo-card.perigo .valor { color: var(--bs-danger); }
.acao-bloco { border: 1px solid var(--borda); border-radius: .6rem; background: var(--superficie); margin-bottom: .75rem; }
.acao-bloco > summary { cursor: pointer; padding: .6rem 1rem; font-weight: 600; list-style: none; }
.acao-bloco > summary::-webkit-details-marker { display: none; }
.acao-bloco[open] > summary { border-bottom: 1px solid var(--borda); }
.acao-bloco .acao-corpo { padding: 1rem; }
.linha-tempo { list-style: none; margin: 0; padding: 0; }
.linha-tempo li { padding: .5rem 0; border-bottom: 1px solid var(--borda); display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.linha-tempo li:last-child { border-bottom: 0; }
.linha-tempo .quando { color: var(--texto-suave); font-size: .8rem; }

/* Plano de contas: recuo por nivel (o padding da celula e do Bootstrap, entao o recuo vai num span) */
.plano-no { display: inline-flex; align-items: center; }
.plano-recuo-1 { margin-left: 0; }
.plano-recuo-2 { margin-left: 1.75rem; }
.plano-recuo-3 { margin-left: 3.5rem; }
.plano-recuo-4 { margin-left: 5.25rem; }
.plano-recuo-5 { margin-left: 7rem; }
/* Grupos (sinteticas): faixa colorida na lateral e fundo mais forte nos niveis mais altos */
.plano-linha-sintetica > td { background-color: rgba(var(--bs-primary-rgb), 0.07); }
.plano-linha-sintetica > td:first-child { border-left: 4px solid rgba(var(--bs-primary-rgb), 0.55); }
.plano-linha-n1 > td { background-color: rgba(var(--bs-primary-rgb), 0.16); border-top: 2px solid rgba(var(--bs-primary-rgb), 0.35); }
.plano-linha-n1 > td:first-child { border-left: 4px solid var(--bs-primary); }
.plano-linha-n1 .plano-no { font-size: 1.02rem; }
.plano-linha-n1 .bi-folder2-open, .plano-linha-n1 .bi-folder2 { font-size: 1.15rem; }
/* Lancamentos (analiticas): fundo branco, codigo discreto e texto normal */
.plano-linha-analitica > td { background-color: var(--bs-body-bg); }
.plano-linha-analitica > td:first-child { color: var(--bs-secondary-color); border-left: 4px solid transparent; }
.plano-linha-analitica .plano-no { color: var(--bs-body-color); font-weight: 400; }

/* Tabelas de formulario (ex.: parcelas da nota) */
.col-estreita-num { width: 4rem; }
.col-estreita-acao { width: 3rem; }

.link-saldo { color: inherit; text-decoration: underline dotted; }
.resumo-link { display: block; color: inherit; text-decoration: none; }
.resumo-link:hover { border-color: var(--bs-primary); }
.resumo-link.ativo { border-color: var(--bs-primary); box-shadow: 0 0 0 1px var(--bs-primary); }
.resumo-link.atraso .valor { color: var(--bs-danger); }
.resumo-cards.cinco { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* DRE: demonstrativo em arvore */
.tabela-dre td, .tabela-dre th { padding: .45rem .75rem; }
.tabela-dre .dre-secao td { font-weight: 700; background: var(--bs-tertiary-bg); }
.tabela-dre .dre-total td { font-weight: 700; border-top: 2px solid var(--bs-border-color); background: var(--bs-secondary-bg); }
.tabela-dre .dre-grupo td { font-weight: 600; }
.tabela-dre .dre-nivel-2 { padding-left: 1.5rem; }
.tabela-dre .dre-nivel-3 { padding-left: 2.5rem; }
.tabela-dre .dre-nivel-4 { padding-left: 3.5rem; }

/* Manual do usuario */
.manual-imagem { max-width: 100%; height: auto; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .4rem; margin: .5rem 0; display: block; }
.manual-modulo-link { color: inherit; }
.manual-modulo-link:hover strong { text-decoration: underline; }

/* Indicador da IA (menu lateral, abaixo do usuario; so desenvolvedores) */
.sidebar-ia {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .2rem 1rem .1rem;
    font-size: .72rem;
    line-height: 1.3;
    color: var(--sidebar-texto);
    opacity: .85;
    text-decoration: none;
    flex-shrink: 0;
    min-width: 0;
}
a.sidebar-ia:hover { opacity: 1; color: var(--sidebar-texto-forte); }
.ia-ponto { width: .55rem; height: .55rem; border-radius: 50%; flex: 0 0 .55rem; background: #8a929c; }
.sidebar-ia[data-estado="ok"] .ia-ponto { background: #2fb36d; }
.sidebar-ia[data-estado="instavel"] .ia-ponto { background: #f0ad4e; }
.sidebar-ia[data-estado="indisponivel"] .ia-ponto { background: #e5534b; }
.sidebar-ia[data-estado="desconhecido"] .ia-ponto { background: #8a929c; opacity: .6; }
.ia-texto { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 992px) {
    body.sidebar-colapsada .sidebar-ia { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-colapsada .ia-texto { display: none; }
}

/* Versao do sistema (menu lateral, abaixo do usuario) */
.sidebar-versao {
    display: block;
    padding: .25rem 1rem .1rem;
    font-size: .72rem;
    line-height: 1.3;
    color: var(--sidebar-texto);
    opacity: .75;
    text-decoration: none;
    flex-shrink: 0;
}
a.sidebar-versao:hover { opacity: 1; color: var(--sidebar-texto-forte); }
.sidebar-versao .bi-exclamation-triangle-fill { color: #f0ad4e; }
@media (min-width: 992px) {
    body.sidebar-colapsada .sidebar-versao { display: none; }
}
.manual-busca { max-width: 28rem; }
.manual-secao { scroll-margin-top: calc(var(--altura-cabecalho) + 1rem); }

/* Atalhos da matriz de permissoes */
.matriz-atalhos { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.matriz-rotulo { background: none; border: 0; padding: 0; font: inherit; color: inherit; font-weight: inherit; text-align: inherit; cursor: pointer; }
.matriz-rotulo:hover { text-decoration: underline; color: var(--bs-primary, #0d6efd); }

/* ---------- Temas do sistema ---------- */
.sidebar-tema { position: relative; flex: 1; }
.sidebar-tema .dropdown-menu { min-width: 190px; font-size: .88rem; }
.sidebar-tema .dropdown-item { display: flex; align-items: center; gap: .55rem; width: 100%; }
.sidebar-tema .dropdown-item.ativo { font-weight: 600; }
.tema-bolinha { flex: 0 0 14px; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .5); }
.tema-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.tema-opcao { display: block; cursor: pointer; margin: 0; }
.tema-opcao input { position: absolute; opacity: 0; pointer-events: none; }
.tema-cartao { display: block; border: 2px solid var(--borda); border-radius: .6rem; padding: .6rem; background: var(--superficie); transition: border-color .15s ease, box-shadow .15s ease; }
.tema-opcao:hover .tema-cartao { border-color: var(--borda-tracejada); }
.tema-opcao input:checked + .tema-cartao { border-color: var(--cor-primaria); box-shadow: 0 0 0 .2rem var(--foco-sombra); }
.tema-opcao input:focus-visible + .tema-cartao { outline: 2px solid var(--cor-primaria); outline-offset: 2px; }
.tema-nome { display: flex; align-items: center; justify-content: space-between; margin-top: .55rem; font-weight: 600; color: var(--texto-base); }
.tema-nome small { font-weight: 400; color: var(--texto-suave); }
.tema-previa { display: flex; height: 124px; border-radius: .4rem; overflow: hidden; border: 1px solid var(--borda); background: var(--fundo); color: var(--texto-base); }
.tema-previa .tp-topo, .tema-previa .tp-linha, .tema-previa .tp-botao { display: block; }
.tema-previa .tp-menu { width: 30%; background: var(--sidebar-bg); padding: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.tema-previa .tp-menu i { display: block; height: 7px; border-radius: 4px; background: var(--sidebar-texto); opacity: .45; }
.tema-previa .tp-menu i.ativo { background: #fff; opacity: .9; }
.tema-previa .tp-corpo { flex: 1; padding: .5rem; display: flex; flex-direction: column; gap: .4rem; }
.tema-previa .tp-topo { height: 9px; border-radius: 4px; background: var(--superficie); border: 1px solid var(--borda); }
.tema-previa .tp-cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: .3rem; padding: .4rem; flex: 1; display: flex; flex-direction: column; gap: .3rem; }
.tema-previa .tp-linha { height: 6px; border-radius: 3px; background: var(--texto-suave); opacity: .5; }
.tema-previa .tp-linha.curta { width: 60%; }
.tema-previa .tp-botao { margin-top: auto; align-self: flex-start; width: 42px; height: 12px; border-radius: 3px; background: var(--cor-primaria); }
.tema-bolinha[data-tema="claro"] { background: linear-gradient(135deg, #16202e 50%, #f3f5f8 50%); }
.tema-bolinha[data-tema="escuro"] { background: linear-gradient(135deg, #0b121c 50%, #5b9bf0 50%); }
.tema-bolinha[data-tema="oceano"] { background: linear-gradient(135deg, #0f2f3d 50%, #0e7490 50%); }
.tema-bolinha[data-tema="grafite"] { background: linear-gradient(135deg, #2a2e35 50%, #475569 50%); }
.tema-bolinha[data-tema="floresta"] { background: linear-gradient(135deg, #08110c 50%, #34b27b 50%); }
.tema-bolinha[data-tema="vinho"] { background: linear-gradient(135deg, #10080c 50%, #e0668a 50%); }
.tema-cartao > small, .tema-desc { display: block; }

/* Destaque rapido nos campos preenchidos pela consulta de CEP */
@keyframes cep-preenchido { from { border-color: var(--cor-primaria); box-shadow: 0 0 0 .25rem var(--foco-sombra); } to { box-shadow: 0 0 0 0 transparent; } }
.cep-preenchido { animation: cep-preenchido 1.6s ease-out; }

/* Previa do endereco encontrado pela consulta de CEP */
.cep-previa { border: 1px solid var(--borda); border-left: 3px solid var(--cor-primaria); border-radius: .4rem; background: var(--superficie-suave); padding: .5rem .65rem; margin-top: .4rem; }

/* Logomarca da empresa (cadastro) */
.logo-previa { width: 200px; height: 88px; flex: 0 0 200px; display: flex; align-items: center; justify-content: center; padding: .5rem; background: #fff; border: 1px dashed var(--bs-border-color); border-radius: .5rem; }
.logo-previa img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Logomarca da empresa no menu, cabecalho e login */
.marca-logo { flex: 0 0 auto; height: 40px; max-width: 48px; padding: 3px; background: #fff; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.marca-logo img { max-height: 100%; max-width: 100%; object-fit: contain; }
.marca-logo-larga { max-width: 190px; padding: 4px 8px; }
body.sidebar-colapsada .marca-logo-larga { max-width: 44px; padding: 3px; }
.empresa-logo { height: 26px; max-width: 90px; object-fit: contain; margin-right: .6rem; }
.acesso-logo { display: inline-flex; max-width: 240px; max-height: 100px; }
.acesso-logo img { max-width: 100%; max-height: 100px; object-fit: contain; }
.rodape-ss { display: inline-flex; align-items: center; }
.rodape-ss a { display: inline-flex; }
.logo-ss-escuro-fundo { display: none; }
:root[data-bs-theme="dark"] .logo-ss-claro-fundo { display: none; }
:root[data-bs-theme="dark"] .logo-ss-escuro-fundo { display: inline-block; }
.acesso-rodape .rodape-ss { flex-basis: 100%; justify-content: center; }
.relatorio-previa-logo-img { float: left; margin-right: .8rem; max-height: 44px; max-width: 120px; object-fit: contain; }

/* Matrizes de permissoes: grupos de modulos (linha pai com +) */
.matriz-grupo > th, .matriz-grupo > td { background-color: rgba(var(--bs-primary-rgb), 0.08); border-top: 1px solid rgba(var(--bs-primary-rgb), 0.3); }
.matriz-grupo > th { box-shadow: inset 4px 0 0 rgba(var(--bs-primary-rgb), 0.6); }
.matriz-grupo .plano-toggle { margin-left: .15rem; }
.matriz-grupo-qtd { color: var(--texto-suave); font-size: .75rem; font-weight: 400; }
.matriz-filho > th { padding-left: 2.1rem; font-weight: 400; }
.perm-celula.perm-grupo { opacity: .95; border-style: dashed; }
.perm-celula.perm-parcial { background: #fff3cd; border-color: #ffda6a; color: #664d03; }
[data-bs-theme="dark"] .perm-celula.perm-parcial { background: #4d3b05; border-color: #a38212; color: #ffda6a; }
.perm-exemplo.perm-parcial { background: #fff3cd; border-color: #ffda6a; color: #664d03; }

/* Guia de configuracao da IA */
.ia-passo { margin-top: 1.25rem; display: flex; align-items: center; gap: .5rem; }
.ia-num { display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--bs-primary, #0d6efd); color: #fff; font-size: .8rem; flex: 0 0 1.5rem; }
.ia-cmd { display: flex; align-items: center; gap: .5rem; padding: .4rem .6rem; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .375rem; background: var(--bs-tertiary-bg, #f8f9fa); }
.ia-cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; }
.ia-pre { padding: .6rem .8rem; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .375rem; background: var(--bs-tertiary-bg, #f8f9fa); margin-bottom: .5rem; }
.ia-cores { list-style: none; padding-left: 0; }
.ia-cores li { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.ia-bolinha { width: .7rem; height: .7rem; border-radius: 50%; background: #8a929c; flex: 0 0 .7rem; }
.ia-bolinha[data-estado="ok"] { background: #2fb36d; }
.ia-bolinha[data-estado="instavel"] { background: #f0ad4e; }
.ia-bolinha[data-estado="indisponivel"] { background: #e5534b; }

/* Guia Geral das Configuracoes do Sistema */
.geral-bloco { max-width: 46rem; }

/* Console SQL: um bloco por comando de um script */
.sql-item { margin-top: 1rem; padding-top: .75rem; border-top: 1px solid var(--borda); }
.sql-item-titulo { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .75rem; margin-bottom: .4rem; font-size: .9rem; }
.sql-item-titulo code { word-break: break-word; }

/* Guia Usuarios online */
.online-onde { min-width: 9rem; }
.online-usuario { max-width: 13rem; }

/* ---------- Configuracoes do Sistema > Geral: tabela de parametros ---------- */
.tabela-parametros th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); font-weight: 600; white-space: nowrap; }
.tabela-parametros .param-grupo th { background: var(--superficie-suave); color: var(--texto-rotulo); border-top: 1px solid var(--borda); }
.tabela-parametros .param-nome label { font-weight: 500; }
.tabela-parametros .param-valor { min-width: 220px; max-width: 320px; }
.tabela-parametros tr.param-linha > td { transition: background .15s ease; }
.tabela-parametros tr.param-alterada > td { background: color-mix(in srgb, var(--bs-link-color) 7%, transparent); }
.tabela-parametros tr.param-recusada > td { background: color-mix(in srgb, #dc3545 7%, transparent); }
.tabela-parametros tr.param-erro td { color: var(--bs-danger); font-size: .88rem; border-top: 0; padding-top: 0; }
@media (max-width: 767.98px) {
    .tabela-parametros thead { display: none; }
    .tabela-parametros tr.param-linha { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--borda); }
    .tabela-parametros tr.param-linha > td { border: 0; padding: 0; background: transparent; }
    .tabela-parametros tr.param-linha > td.param-nome { flex: 1 1 100%; }
    .tabela-parametros tr.param-linha > td.param-valor { flex: 1 1 auto; min-width: 0; max-width: none; }
    .tabela-parametros .param-grupo th, .tabela-parametros tr.param-erro td { display: block; }
}

/* ---------- Menu moderno: faixa de modulos + painel do modulo atual ----------
   Com painel a barra tem a largura do menu classico (faixa + painel); sem painel (Home, modulo de uma tela so) ou com o painel
   recolhido, fica so a faixa. No celular a mesma barra e a gaveta do botao do menu. */
body.menu-moderno { --rail-w: 84px; --painel-w: 206px; --sidebar-w: calc(var(--rail-w) + var(--painel-w)); --sidebar-w-colapsada: var(--rail-w); }
.menu-faixa { flex: 1; display: flex; min-height: 0; }
.rail {
    flex: 0 0 var(--rail-w);
    width: var(--rail-w);
    overflow-y: auto;
    overflow-x: hidden;
    padding: .6rem .3rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-right: 1px solid var(--sidebar-linha);
}
.rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: .5rem .15rem;
    border-radius: 8px;
    color: var(--sidebar-texto);
    text-decoration: none;
    font-size: .64rem;
    line-height: 1.15;
    text-align: center;
    transition: background .15s ease, color .15s ease;
}
.rail-item i { font-size: 1.3rem; line-height: 1; }
.rail-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item:hover { background: var(--sidebar-hover); color: var(--sidebar-texto-forte); }
.rail-item.ativo { background: var(--sidebar-ativo); color: var(--sidebar-texto-forte); }
.painel { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: .6rem .6rem .9rem; }
.painel-titulo { display: block; font-weight: 600; font-size: .95rem; color: var(--sidebar-texto-forte); padding: .35rem .55rem .5rem; text-decoration: none; }
a.painel-titulo:hover { color: var(--sidebar-texto-forte); text-decoration: underline; }
.painel-secao { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sidebar-texto); opacity: .65; padding: .8rem .6rem .25rem; }
.painel-modulos { display: none; }
@media (min-width: 992px) {
    body.menu-moderno.sidebar-colapsada .painel { display: none; }
    body.menu-moderno.menu-sem-painel [data-alternar-menu] { display: none; }
    body.menu-moderno.sidebar-colapsada .rail { padding-left: .2rem; padding-right: .2rem; }
}
@media (max-width: 991.98px) {
    body.menu-moderno { --sidebar-w: calc(var(--rail-w) + var(--painel-w)); }
    body.menu-moderno .painel-modulos { display: block; }
}

/* ---------- Home: cartoes dos modulos e pagina do modulo ---------- */
.home-titulo { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; color: var(--texto-rotulo); }
.home-modulos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.cartao-modulo {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    min-width: 0;
    background: var(--superficie);
    border: 1px solid var(--borda);
    border-radius: 12px;
    padding: .9rem 1rem;
}
.cartao-modulo-topo { display: flex; align-items: center; gap: .5rem; }
.cartao-modulo-cabeca { display: flex; align-items: center; gap: .55rem; flex: 1; min-width: 0; font-weight: 600; color: var(--texto-base); text-decoration: none; }
.cartao-modulo-cabeca i { flex: 0 0 auto; font-size: 1.25rem; color: var(--bs-link-color); }
.cartao-modulo-cabeca:hover { color: var(--bs-link-hover-color); }
.cartao-modulo-desc { font-size: .85rem; color: var(--texto-suave); }
.cartao-modulo-aviso { font-size: .75rem; color: var(--texto-suave); }
.cartao-destaque .cartao-modulo-cabeca { flex: 0 0 auto; }
.cartao-modulo-links { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .1rem; font-size: .88rem; }
.cartao-modulo-links a { display: inline-block; padding: .2rem 0; text-decoration: none; }
.cartao-modulo-links a:hover { text-decoration: underline; }
.cartao-modulo-todas a { font-size: .8rem; color: var(--texto-suave); }
.cartao-modulo-abrir { display: none; border: 0; background: transparent; color: var(--texto-suave); padding: .25rem .4rem; line-height: 1; }
.cartao-modulo.em-breve { border-style: dashed; background: transparent; }
.cartao-destaque {
    color: var(--texto-base);
    text-decoration: none;
    border-color: var(--bs-link-color);
    background: color-mix(in srgb, var(--bs-link-color) 8%, var(--superficie));
}
.cartao-destaque:hover { color: var(--texto-base); border-color: var(--bs-link-hover-color); }
@media (max-width: 767.98px) {
    .home-modulos { grid-template-columns: 1fr; }
    .cartao-modulo-abrir { display: inline-flex; }
    .cartao-modulo-links { display: none; }
    .cartao-modulo.aberto .cartao-modulo-links { display: flex; }
    .cartao-modulo.aberto .cartao-modulo-abrir i { transform: rotate(180deg); }
}
.modulo-secoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem 1.5rem; align-items: start; }
.modulo-secao-titulo { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); margin-bottom: .4rem; }
.modulo-lista { list-style: none; margin: 0; padding: 0; background: var(--superficie); border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; }
.modulo-lista li + li { border-top: 1px solid var(--borda); }
.modulo-lista a { display: flex; align-items: center; gap: .65rem; padding: .6rem .85rem; color: var(--texto-base); text-decoration: none; }
.modulo-lista a:hover { background: var(--hover-claro); }
.modulo-lista a i { color: var(--bs-link-color); font-size: 1.05rem; }

/* Painel do menu moderno: o codigo da tela fica sempre visivel e o nome quebra em duas linhas quando nao cabe. */
.painel .menu-texto { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; }
.painel .menu-item { align-items: flex-start; }
.painel .menu-item i.bi:first-child { margin-top: .1rem; }
.painel .menu-codigo { margin-top: .15rem; }


/* ---------- Menu moderno em tablet (768 a 991 px): a faixa de modulos fica sempre visivel; o botao do menu abre o painel por cima ---------- */
@media (min-width: 768px) and (max-width: 991.98px) {
    body.menu-moderno .sidebar { transform: none; width: var(--rail-w); }
    body.menu-moderno .conteudo-wrap { margin-left: var(--rail-w); }
    body.menu-moderno.sidebar-aberta .sidebar { width: var(--sidebar-w); }
    body.menu-moderno:not(.sidebar-aberta) .painel,
    body.menu-moderno:not(.sidebar-aberta) .marca-nome,
    body.menu-moderno:not(.sidebar-aberta) .usuario-dados,
    body.menu-moderno:not(.sidebar-aberta) .usuario-seta,
    body.menu-moderno:not(.sidebar-aberta) .acao-texto,
    body.menu-moderno:not(.sidebar-aberta) .ia-texto,
    body.menu-moderno:not(.sidebar-aberta) .sidebar-versao,
    body.menu-moderno:not(.sidebar-aberta) .menu-ir { display: none; }
    body.menu-moderno:not(.sidebar-aberta) .sidebar-acoes { flex-direction: column; padding-left: .6rem; padding-right: .6rem; }
    body.menu-moderno:not(.sidebar-aberta) .sidebar-topo,
    body.menu-moderno:not(.sidebar-aberta) .sidebar-usuario,
    body.menu-moderno:not(.sidebar-aberta) .sidebar-ia { justify-content: center; padding-left: 0; padding-right: 0; }
    body.menu-moderno:not(.sidebar-aberta) .marca-logo-larga { max-width: 44px; padding: 3px; }
}

/* ---------- Busca de telas (Ctrl+K), favoritos e recentes ---------- */
.cabecalho-busca kbd { font-size: .7rem; padding: .05rem .3rem; margin-left: .25rem; background: var(--hover-claro); color: var(--texto-suave); border-radius: 4px; }
.cabecalho-favorito { margin: 0; }
.cabecalho-favorito .btn-icone { font-size: 1.15rem; }
.busca { position: fixed; inset: 0; z-index: 1100; display: flex; justify-content: center; align-items: flex-start; padding: 8vh 1rem 1rem; }
.busca[hidden] { display: none !important; }
.busca-fundo { position: absolute; inset: 0; background: rgba(15, 23, 35, .5); }
.busca-caixa { position: relative; width: 100%; max-width: 580px; max-height: 76vh; display: flex; flex-direction: column; background: var(--superficie); color: var(--texto-base); border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; }
.busca-campo { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-bottom: 1px solid var(--borda); font-size: 1.05rem; }
.busca-campo i { color: var(--texto-suave); }
.busca-campo kbd { font-size: .7rem; color: var(--texto-suave); background: var(--hover-claro); border-radius: 4px; padding: .1rem .35rem; }
.busca-entrada { flex: 1; border: 0; outline: 0; background: transparent; color: inherit; font-size: 1rem; min-width: 0; }
.busca-lista { list-style: none; margin: 0; padding: .35rem; overflow-y: auto; }
.busca-grupo { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-suave); padding: .55rem .65rem .2rem; }
.busca-vazio { padding: 1rem; text-align: center; color: var(--texto-suave); }
.busca-item a { display: flex; align-items: center; gap: .7rem; padding: .5rem .65rem; border-radius: 8px; color: var(--texto-base); text-decoration: none; }
.busca-item.ativo a { background: var(--hover-claro); }
.busca-item a i { color: var(--bs-link-color); font-size: 1.05rem; flex: 0 0 auto; }
.busca-nome { font-weight: 500; white-space: nowrap; }
.busca-onde { flex: 1; min-width: 0; font-size: .8rem; color: var(--texto-suave); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.busca-codigo { color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.busca-rodape { padding: .45rem 1rem; border-top: 1px solid var(--borda); font-size: .75rem; color: var(--texto-suave); }
body.busca-aberta { overflow: hidden; }
.home-atalhos { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.25rem; }
.home-atalhos-grupo { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.home-atalhos-rotulo { font-size: .8rem; font-weight: 600; color: var(--texto-suave); margin-right: .25rem; }
.home-atalho { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; border: 1px solid var(--borda); border-radius: 999px; background: var(--superficie); color: var(--texto-base); font-size: .85rem; text-decoration: none; }
.home-atalho:hover { background: var(--hover-claro); color: var(--texto-base); }
.home-atalho i { color: var(--bs-link-color); }

/* ---------- Indicadores ---------- */
.home-kpis { display: flex; flex-direction: column; gap: .3rem; margin-top: .55rem; }
.home-kpi { display: flex; justify-content: space-between; gap: .75rem; font-size: .85rem; }
.home-kpi-rotulo { color: var(--texto-suave); }
.home-kpi-valor { font-weight: 600; font-variant-numeric: tabular-nums; }
.home-kpi.perigo .home-kpi-valor { color: var(--bs-danger); }
.indicadores-lista { display: flex; flex-direction: column; gap: 1rem; }
.indicador-cabeca { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .85rem; }
.indicador-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.indicador-kpi { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .9rem; border: 1px solid var(--borda); border-radius: 10px; background: var(--superficie-suave); color: var(--texto-base); text-decoration: none; }
.indicador-kpi:hover { border-color: var(--bs-link-color); color: var(--texto-base); }
.indicador-kpi-rotulo { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); }
.indicador-kpi-valor { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.indicador-kpi.perigo .indicador-kpi-valor { color: var(--bs-danger); }

/* Paginas padrao de estado: sem permissao, nao encontrada, modulo em construcao */
.pagina-estado { max-width: 560px; margin: 2rem auto; text-align: center; padding: 2rem 1.5rem; border: 1px solid var(--borda); border-radius: 12px; background: var(--superficie); }
.pagina-estado.em-construcao { border-style: dashed; background: var(--superficie-suave); }
.pagina-estado-icone { font-size: 2.4rem; line-height: 1; color: var(--bs-link-color); margin-bottom: .6rem; }
.pagina-estado-selo { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: .15rem .6rem; border-radius: 999px; background: var(--hover-claro); color: var(--texto-suave); margin-bottom: .6rem; }
.pagina-estado h1 { font-size: 1.35rem; font-weight: 600; margin-bottom: .5rem; }
.pagina-estado-detalhe { font-size: .85rem; color: var(--texto-suave); }
.pagina-estado-itens { text-align: left; display: inline-block; margin: .25rem 0 0; padding-left: 1.2rem; color: var(--texto-suave); }
.pagina-estado-acoes { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1.25rem; }
.indicadores-em-breve { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.indicador-em-breve { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border: 1px dashed var(--borda-tracejada); border-radius: 10px; color: var(--texto-suave); }
.indicadores-secao { font-size: 1rem; font-weight: 600; color: var(--texto-rotulo); margin: 0 0 .75rem; }
