/* ==========================================================================================================
   Artesanal Conecta - design system
   Paleta institucional do SIA (PADRAO-LAYOUT.md): petroleo #006B5E, verde #159B89, laranja de acento #F68E34,
   escala de atingimento verde/laranja/azul/vermelho. Layout novo: superficies claras, cantos arredondados,
   tipografia Inter, sombras suaves, modo escuro.
   ========================================================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  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 {
  --petroleo: #006B5E;
  --petroleo-escuro: #004E45;
  --verde: #159B89;
  --verde-hover: #12897a;
  --laranja: #F68E34;
  --ok: #28a745;
  --info: #2f7fd1;
  --perigo: #dc3545;
  --aviso: #F68E34;

  --fundo: #F3F6F5;
  --superficie: #FFFFFF;
  --superficie-2: #F8FAF9;
  --superficie-3: #EDF2F0;
  --borda: #E2E8E6;
  --borda-forte: #CFD9D6;
  --texto: #0F1F1C;
  --texto-2: #4A5B58;
  --texto-3: #7B8B88;
  --primaria: var(--petroleo);
  --primaria-hover: var(--petroleo-escuro);
  --primaria-suave: #E4F6F2;
  --primaria-texto: #0f7c6d;
  --foco: rgba(21, 155, 137, 0.35);
  --usuario-bolha: #0E6F62;
  --sidebar: linear-gradient(180deg, #053B34 0%, #006B5E 100%);
  --sombra-1: 0 1px 2px rgba(15, 31, 28, .05), 0 1px 3px rgba(15, 31, 28, .07);
  --sombra-2: 0 10px 30px rgba(15, 31, 28, .10), 0 2px 6px rgba(15, 31, 28, .06);
  --sombra-3: 0 24px 60px rgba(15, 31, 28, .22);
  --raio-sm: 8px;
  --raio: 12px;
  --raio-lg: 16px;
  --fonte: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fundo: #0A1110; --superficie: #111A18; --superficie-2: #15201E; --superficie-3: #1B2826;
    --borda: #22302D; --borda-forte: #30413D; --texto: #E6EFED; --texto-2: #A7B7B3; --texto-3: #7A8B87;
    --primaria: #17A08D; --primaria-hover: #1BB7A1; --primaria-suave: #0F2E29; --primaria-texto: #4FD1BC;
    --usuario-bolha: #136E61; --sombra-1: 0 1px 2px rgba(0,0,0,.4); --sombra-2: 0 10px 30px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-tema="escuro"] {
  --fundo: #0A1110; --superficie: #111A18; --superficie-2: #15201E; --superficie-3: #1B2826;
  --borda: #22302D; --borda-forte: #30413D; --texto: #E6EFED; --texto-2: #A7B7B3; --texto-3: #7A8B87;
  --primaria: #17A08D; --primaria-hover: #1BB7A1; --primaria-suave: #0F2E29; --primaria-texto: #4FD1BC;
  --usuario-bolha: #136E61; --sombra-1: 0 1px 2px rgba(0,0,0,.4); --sombra-2: 0 10px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto); font-family: var(--fonte); font-size: 14px;
  line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
#app { height: 100%; }
a { color: var(--primaria-texto); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
/* sem ligaduras em codigo: a Cascadia Code transformaria >= e <= em simbolos e o SQL pareceria outro */
code, pre, .bloco-sql, textarea.sql, .campo.sql { font-family: var(--mono); font-size: 12.5px; font-variant-ligatures: none; font-feature-settings: "calt" 0, "liga" 0; }
::selection { background: rgba(21, 155, 137, .25); }
.mudo { color: var(--texto-3); }
.texto-2 { color: var(--texto-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.linha { display: flex; align-items: center; gap: 8px; }
.linha-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entre { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.coluna { display: flex; flex-direction: column; gap: 12px; }
.cresce { flex: 1 1 auto; min-width: 0; }
.trunca { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.espaco { height: 12px; }

/* ---------------------------------------------- carregamento inicial ---------------------------------------- */
.carregando-tela { height: 100%; display: grid; place-items: center; }
/* a marca (catavento) gira enquanto o app carrega */
.marca-anim { width: 52px; height: 52px; animation: girar 1.6s cubic-bezier(.5, .1, .5, .9) infinite; }
@keyframes girar { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) { .marca-anim { animation: none; } }

/* ---------------------------------------------- botoes ------------------------------------------------------- */
.btn {
  --h: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h);
  padding: 0 14px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 550;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  background: var(--superficie); color: var(--texto); border-color: var(--borda-forte);
}
.btn:hover { background: var(--superficie-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .campo:focus-visible, .seg button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--foco); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primaria { background: var(--primaria); color: #fff; border-color: var(--primaria); }
.btn-primaria:hover { background: var(--primaria-hover); border-color: var(--primaria-hover); }
.btn-acento { background: var(--laranja); color: #fff; border-color: var(--laranja); }
.btn-acento:hover { background: #e47c22; }
.btn-fantasma { background: transparent; border-color: transparent; color: var(--texto-2); }
.btn-fantasma:hover { background: var(--superficie-3); color: var(--texto); }
.btn-perigo { background: transparent; color: var(--perigo); border-color: rgba(220, 53, 69, .35); }
.btn-perigo:hover { background: rgba(220, 53, 69, .08); }
.btn-p { --h: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-g { --h: 44px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-icone { width: var(--h); padding: 0; }
.btn-bloco { width: 100%; }

/* ---------------------------------------------- campos ------------------------------------------------------- */
.campo {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--borda-forte);
  background: var(--superficie); color: var(--texto); font: inherit; transition: border-color .15s, box-shadow .15s;
}
.campo:hover { border-color: var(--texto-3); }
.campo:focus { border-color: var(--verde); outline: none; box-shadow: 0 0 0 3px var(--foco); }
textarea.campo { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
textarea.campo.sql { font-family: var(--mono); font-size: 12.5px; min-height: 120px; white-space: pre; tab-size: 2; }
select.campo { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--texto-3) 50%),
  linear-gradient(135deg, var(--texto-3) 50%, transparent 50%); background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.campo-p { height: 32px; font-size: 13px; border-radius: 8px; }
.rotulo { display: block; font-size: 12.5px; font-weight: 600; color: var(--texto-2); margin-bottom: 6px; }
.ajuda { font-size: 12px; color: var(--texto-3); margin-top: 4px; }
.grupo-campo { margin-bottom: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--verde); }
.busca { position: relative; }
.busca svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--texto-3); }
.busca .campo { padding-left: 34px; }

/* ---------------------------------------------- cartoes, chips e selos -------------------------------------- */
.card { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio-lg); box-shadow: var(--sombra-1); }
.card-corpo { padding: 18px; }
.card-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--borda); }
.selo { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px;
  font-weight: 600; background: var(--superficie-3); color: var(--texto-2); white-space: nowrap; }
.selo-ok { background: rgba(40, 167, 69, .12); color: #1d7a34; }
.selo-perigo { background: rgba(220, 53, 69, .12); color: #b52a37; }
.selo-aviso { background: rgba(246, 142, 52, .15); color: #b4600f; }
.selo-info { background: rgba(47, 127, 209, .12); color: #2565a8; }
.selo-primaria { background: var(--primaria-suave); color: var(--primaria-texto); }
:root[data-tema="escuro"] .selo-ok { color: #6bd68a; } :root[data-tema="escuro"] .selo-perigo { color: #ff8a95; }
:root[data-tema="escuro"] .selo-aviso { color: #ffb073; } :root[data-tema="escuro"] .selo-info { color: #84b8ef; }
.ponto { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }

/* ---------------------------------------------- controle segmentado (Consultas | Paineis) ------------------- */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--superficie-3); border: 1px solid var(--borda); }
.seg button { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 14px; border: 0; border-radius: 9px;
  background: transparent; color: var(--texto-2); font: inherit; font-weight: 600; cursor: pointer; transition: all .15s; }
.seg button svg { width: 16px; height: 16px; }
.seg button:hover { color: var(--texto); }
.seg button.ativo { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra-1); }

/* ---------------------------------------------- shell do app ------------------------------------------------ */
.app { display: grid; grid-template-columns: 236px 1fr; height: 100%; }
.app.recolhido { grid-template-columns: 68px 1fr; }
.sidebar { background: var(--sidebar); color: #fff; display: flex; flex-direction: column; padding: 14px 12px; gap: 6px; min-height: 0; position: relative; z-index: 10; }
.sidebar .menu-pop { color: var(--texto); }
.sidebar .usuario-card .btn-fantasma { color: rgba(255, 255, 255, .8); }
.sidebar .usuario-card .btn-fantasma:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.sidebar .marca { display: flex; align-items: center; gap: 10px; padding: 6px 6px 16px; }
.sidebar .marca img { width: 36px; height: 36px; padding: 4px; border-radius: 11px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25); flex: none; }
.logo-azulejo { padding: 5px; border-radius: 12px; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.sidebar .marca b { font-size: 15px; letter-spacing: -0.01em; line-height: 1.15; }
.sidebar .marca small { display: block; font-size: 11px; opacity: .7; font-weight: 500; }
.nav-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; color: rgba(255,255,255,.82);
  font-weight: 550; cursor: pointer; border: 0; background: transparent; font: inherit; width: 100%; text-align: left; position: relative; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.ativo { background: rgba(255,255,255,.14); color: #fff; }
.nav-item.ativo::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--laranja); }
.nav-titulo { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 14px 12px 4px; font-weight: 700; }
.sidebar .rodape { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.usuario-card { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(0,0,0,.18); }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
  background: linear-gradient(135deg, var(--laranja), #e0701a); color: #fff; }
.usuario-card .nome { font-weight: 600; font-size: 13px; line-height: 1.2; }
.usuario-card .setor { font-size: 11.5px; opacity: .7; }
.app.recolhido .sidebar .esconde { display: none; }
.app.recolhido .nav-item { justify-content: center; padding: 0; }
.app.recolhido .usuario-card { justify-content: center; padding: 8px 0; background: transparent; }

.principal { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.topo { display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 20px; border-bottom: 1px solid var(--borda);
  background: color-mix(in srgb, var(--superficie) 88%, transparent); backdrop-filter: blur(8px); flex: none; }
.topo .titulo-pagina { font-weight: 650; font-size: 15px; }
.conteudo { flex: 1 1 auto; min-height: 0; overflow: auto; }
.pagina { padding: 24px; max-width: 1400px; margin: 0 auto; }
.pagina-cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.pagina-cab p { margin: 4px 0 0; color: var(--texto-2); }

/* seletor de dominio (sistemas) */
.dominios { display: flex; gap: 6px; flex-wrap: wrap; }
.dominio-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--borda-forte); background: var(--superficie); color: var(--texto-2); font: inherit; font-weight: 600; font-size: 13px;
  transition: all .15s; }
.dominio-btn:hover { border-color: var(--texto-3); color: var(--texto); }
.dominio-btn .ico { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; color: #fff; }
.dominio-btn .ico svg { width: 13px; height: 13px; }
.dominio-btn.ativo { color: var(--texto); border-color: var(--cor, var(--verde)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cor, var(--verde)) 18%, transparent);
  background: color-mix(in srgb, var(--cor, var(--verde)) 7%, var(--superficie)); }

/* ---------------------------------------------- chat --------------------------------------------------------- */
.chat-layout { display: grid; grid-template-columns: 272px 1fr; height: 100%; min-height: 0; }
.chat-layout.sem-lista { grid-template-columns: 1fr; }
.lista-conversas { border-right: 1px solid var(--borda); background: var(--superficie-2); display: flex; flex-direction: column; min-height: 0; }
.lista-conversas .topo-lista { padding: 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--borda); }
.lista-conversas .itens { overflow: auto; padding: 8px; flex: 1; }
.conversa-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--texto-2); font-size: 13.5px; }
.conversa-item:hover { background: var(--superficie-3); color: var(--texto); }
.conversa-item.ativo { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra-1); font-weight: 600; }
.conversa-item svg { flex: none; }
.conversa-item .acoes { opacity: 0; }
.conversa-item:hover .acoes { opacity: 1; }
.grupo-data { font-size: 11px; font-weight: 700; color: var(--texto-3); text-transform: uppercase; letter-spacing: .06em; padding: 12px 10px 4px; }

.chat { display: flex; flex-direction: column; min-height: 0; height: 100%; position: relative; }
.chat-rolagem { flex: 1 1 auto; overflow: auto; scroll-behavior: smooth; }
.chat-coluna { max-width: 880px; margin: 0 auto; padding: 24px 24px 12px; }
.chat-vazio { min-height: calc(100% - 20px); display: flex; flex-direction: column; justify-content: center; padding: 32px 0 16px; }
.saudacao { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.saudacao span { background: linear-gradient(90deg, var(--verde), var(--petroleo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-tema="escuro"] .saudacao span { background: linear-gradient(90deg, #3fd2bb, #17A08D); -webkit-background-clip: text; background-clip: text; }
.sugestoes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 24px; }
.sugestao { text-align: left; padding: 14px; border-radius: 14px; border: 1px solid var(--borda); background: var(--superficie); color: var(--texto);
  font: inherit; cursor: pointer; transition: all .15s; display: flex; gap: 10px; align-items: flex-start; box-shadow: var(--sombra-1); }
.sugestao:hover { border-color: var(--verde); transform: translateY(-1px); box-shadow: var(--sombra-2); }
.sugestao svg { width: 18px; height: 18px; color: var(--verde); flex: none; margin-top: 1px; }

.turno { margin-bottom: 26px; }
.msg-usuario { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.msg-usuario .bolha { background: var(--usuario-bolha); color: #fff; padding: 10px 14px; border-radius: 16px 16px 4px 16px; max-width: 78%;
  white-space: pre-wrap; word-wrap: break-word; box-shadow: var(--sombra-1); }
.msg-ia { display: grid; grid-template-columns: 30px 1fr; gap: 12px; }
.msg-ia .marca-ia { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--verde), var(--petroleo)); display: grid;
  place-items: center; color: #fff; }
.msg-ia .marca-ia svg { width: 16px; height: 16px; }
.msg-ia .corpo { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.md { line-height: 1.65; word-wrap: break-word; }
.md p { margin: 0 0 10px; } .md p:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 4px 0 10px; padding-left: 22px; } .md li { margin: 2px 0; }
.md table { border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--borda); padding: 6px 10px; text-align: left; }
.md th { background: var(--superficie-2); font-weight: 600; }
.md code { background: var(--superficie-3); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--superficie-2); border: 1px solid var(--borda); padding: 12px; border-radius: 10px; overflow-x: auto; }
.md strong { font-weight: 650; }
.md h1, .md h2, .md h3 { font-size: 15px; margin: 12px 0 6px; }
.cursor-digitando::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px; background: var(--verde);
  border-radius: 2px; animation: pisca 1s steps(2) infinite; }
@keyframes pisca { 50% { opacity: 0 } }

.ferramenta { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 10px; border-radius: 10px; font-size: 12.5px;
  background: var(--superficie-2); border: 1px solid var(--borda); color: var(--texto-2); cursor: pointer; align-self: flex-start; }
.ferramenta svg { width: 14px; height: 14px; flex: none; }
.ferramenta.rodando svg.giro { animation: girar 1s linear infinite; color: var(--verde); }
.ferramenta.erro { border-color: rgba(220, 53, 69, .35); color: var(--perigo); }
.ferramenta-detalhe { margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--superficie-2); border: 1px solid var(--borda); font-size: 12px; }
.ferramenta-detalhe pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; }
@keyframes girar { to { transform: rotate(360deg) } }
.raciocinio { font-size: 13px; color: var(--texto-3); }
.raciocinio summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; list-style: none; font-weight: 550; }
.raciocinio summary::-webkit-details-marker { display: none; }
.raciocinio[open] .texto-raciocinio { margin-top: 6px; padding: 10px 12px; border-left: 2px solid var(--borda-forte); white-space: pre-wrap; }
.aviso-linha { font-size: 12.5px; padding: 8px 12px; border-radius: 10px; background: rgba(246, 142, 52, .1); color: #a5570f; border: 1px solid rgba(246,142,52,.3); }
.erro-linha { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: rgba(220, 53, 69, .08); color: var(--perigo); border: 1px solid rgba(220,53,69,.25); }
.meta-turno { font-size: 11.5px; color: var(--texto-3); display: flex; gap: 10px; }

.composer-area { padding: 12px 24px 18px; background: linear-gradient(180deg, transparent, var(--fundo) 30%); flex: none; }
.composer { max-width: 880px; margin: 0 auto; background: var(--superficie); border: 1px solid var(--borda-forte); border-radius: 18px;
  box-shadow: var(--sombra-2); padding: 10px 10px 10px 16px; display: flex; align-items: flex-end; gap: 10px; transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: var(--verde); box-shadow: 0 0 0 3px var(--foco), var(--sombra-2); }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; color: var(--texto); font: inherit; font-size: 15px;
  line-height: 1.5; max-height: 220px; min-height: 24px; padding: 6px 0; }
.composer .enviar { width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--primaria); color: #fff; display: grid; place-items: center; cursor: pointer; }
.composer .enviar:disabled { background: var(--borda-forte); cursor: not-allowed; }
.composer .enviar svg { width: 18px; height: 18px; }
.composer-nota { max-width: 880px; margin: 8px auto 0; font-size: 11.5px; color: var(--texto-3); text-align: center; }

/* ---------------------------------------------- resultado (grafico/tabela) ---------------------------------- */
.resultado { border: 1px solid var(--borda); border-radius: 14px; background: var(--superficie); box-shadow: var(--sombra-1); overflow: hidden; }
.resultado-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--borda); }
.resultado-cab .titulo { font-weight: 650; font-size: 13.5px; }
.resultado-cab .sub { font-size: 11.5px; color: var(--texto-3); }
.resultado-corpo { padding: 8px 12px 12px; }
.grafico { width: 100%; height: 300px; }
.tabela-wrap { overflow: auto; max-height: 380px; border-radius: 10px; }
.tabela { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tabela th { position: sticky; top: 0; background: var(--superficie-2); color: var(--texto-2); font-weight: 600; text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--borda); white-space: nowrap; cursor: pointer; user-select: none; z-index: 1; }
.tabela th.num { text-align: right; }
.tabela td { padding: 8px 12px; border-bottom: 1px solid var(--borda); white-space: nowrap; }
.tabela tbody tr:hover td { background: var(--superficie-2); }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tfoot td { position: sticky; bottom: 0; background: var(--superficie-3); font-weight: 650; border-top: 1px solid var(--borda-forte); }
.tabela .clicavel { cursor: pointer; }
.kpi-solo { padding: 18px 16px 8px; }
.kpi-solo .valor { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------- paineis ----------------------------------------------------- */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.painel-card { padding: 18px; cursor: pointer; display: flex; flex-direction: column; gap: 12px; transition: transform .15s, box-shadow .15s, border-color .15s; position: relative; }
.painel-card:hover { transform: translateY(-2px); box-shadow: var(--sombra-2); border-color: var(--borda-forte); }
/* miniatura do card: layout real do painel em escala (12 colunas, linhas de 6px), cortada na altura */
.painel-card .mini { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 6px; grid-auto-flow: dense;
  gap: 3px; height: 84px; overflow: hidden; padding: 6px; border-radius: 10px; background: var(--superficie-2); border: 1px solid var(--borda); }
.painel-card .mini-vazio { display: grid; place-items: center; font-size: 12px; color: var(--texto-3); }
.mini .w { position: relative; border-radius: 3px; background: var(--superficie); border: 1px solid var(--borda); overflow: hidden; }
.mini .w i { position: absolute; inset: 3px; }
.mini .kpi { background: color-mix(in srgb, var(--cor) 22%, var(--superficie)); border-color: transparent; }
.mini .kpi i { inset: auto 4px 4px 4px; height: 3px; border-radius: 2px; background: var(--cor); width: 45%; }
.mini .barras i { background: linear-gradient(to top, var(--cor) 0 55%, transparent 55%) 0 100% / 14% 100% no-repeat,
  linear-gradient(to top, var(--cor) 0 85%, transparent 85%) 25% 100% / 14% 100% no-repeat,
  linear-gradient(to top, var(--cor) 0 40%, transparent 40%) 50% 100% / 14% 100% no-repeat,
  linear-gradient(to top, var(--cor) 0 70%, transparent 70%) 75% 100% / 14% 100% no-repeat,
  linear-gradient(to top, var(--cor) 0 95%, transparent 95%) 100% 100% / 14% 100% no-repeat; opacity: .75; }
.mini .barras-h i { background: linear-gradient(to right, var(--cor) 0 90%, transparent 90%) 0 0 / 100% 16% no-repeat,
  linear-gradient(to right, var(--cor) 0 70%, transparent 70%) 0 33% / 100% 16% no-repeat,
  linear-gradient(to right, var(--cor) 0 55%, transparent 55%) 0 66% / 100% 16% no-repeat,
  linear-gradient(to right, var(--cor) 0 35%, transparent 35%) 0 100% / 100% 16% no-repeat; opacity: .75; }
.mini .linha svg { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); }
.mini .linha polyline { fill: none; stroke: var(--cor); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.mini .linha polygon { fill: var(--cor); opacity: .18; }
.mini .pizza i { inset: 3px auto 3px 50%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%;
  background: conic-gradient(var(--cor) 0 45%, color-mix(in srgb, var(--cor) 45%, transparent) 45% 75%, var(--borda-forte) 75%); }
.mini .tabela i { background: repeating-linear-gradient(to bottom, var(--borda-forte) 0 1px, transparent 1px 5px); }
.mini .texto i { background: repeating-linear-gradient(to bottom, var(--borda) 0 2px, transparent 2px 5px); inset: 4px 30% 4px 4px; }
.painel-card .titulo-card { font-size: 18px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.25; margin: 0 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.painel-card .sem-legenda { color: var(--texto-3); font-style: italic; }
.painel-card .desc { color: var(--texto-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.painel-card .rodape { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--texto-3); }
.estrela { color: var(--texto-3); } .estrela.on { color: #f5b301; }
.btn-favorito { --h: 34px; background: var(--superficie); border: 1px solid var(--borda-forte); color: var(--texto-2); font-weight: 600; }
.btn-favorito svg { width: 16px; height: 16px; color: var(--texto-3); }
.btn-favorito:hover { border-color: #f5b301; color: var(--texto); }
.btn-favorito.on { background: rgba(245, 179, 1, .12); border-color: rgba(245, 179, 1, .55); color: #9a6f00; }
.btn-favorito.on svg { color: #f5b301; fill: #f5b301; }
:root[data-tema="escuro"] .btn-favorito.on { color: #ffd05a; }
.btn-favorito.btn-p { --h: 28px; font-size: 12.5px; padding: 0 10px; }
.barra-painel > .cresce { flex: 1 1 260px; }
.barra-painel > .btn, .barra-painel > .menu { flex-shrink: 0; }
.titulo-painel { font-size: 22px; font-weight: 750; letter-spacing: -0.015em; margin: 0; line-height: 1.25; }
.legenda-painel { font-size: 13.5px; color: var(--texto-2); margin-top: 2px; }
.legenda-vazia { border: 0; background: none; padding: 0; margin-top: 2px; font: inherit; font-size: 12.5px; color: var(--verde); cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; }
.legenda-editavel { font-size: 13px; color: var(--texto-2); border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 3px 8px; width: 100%; }
.legenda-editavel:hover { border-color: var(--borda); } .legenda-editavel:focus { outline: none; border-color: var(--verde); color: var(--texto); }
.estrela svg { width: 18px; height: 18px; }

.construtor { display: grid; grid-template-columns: 400px 1fr; height: 100%; min-height: 0; }
.construtor.so-painel { grid-template-columns: 1fr; }
.construtor .lado-chat { border-right: 1px solid var(--borda); display: flex; flex-direction: column; min-height: 0; background: var(--superficie-2); }
.construtor .lado-chat .chat-coluna { padding: 16px; }
.construtor .lado-chat .composer-area { padding: 10px 12px 14px; background: transparent; }
.construtor .lado-chat .composer { border-radius: 14px; }
.construtor .lado-painel { min-height: 0; overflow: auto; }
.barra-painel { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--borda);
  background: var(--superficie); position: sticky; top: 0; z-index: 5; }
.titulo-editavel { font-size: 18px; font-weight: 700; border: 1px solid transparent; background: transparent; color: var(--texto); border-radius: 8px;
  padding: 4px 8px; font-family: inherit; min-width: 200px; }
.titulo-editavel:hover { border-color: var(--borda); } .titulo-editavel:focus { outline: none; border-color: var(--verde); }
.filtros-painel { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px 0; }
.filtro-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 12px; border-radius: 10px; border: 1px solid var(--borda-forte);
  background: var(--superficie); font-size: 13px; }
.filtro-chip .rot { color: var(--texto-3); font-weight: 600; }
.filtro-chip select, .filtro-chip input { border: 0; background: transparent; color: var(--texto); font: inherit; font-weight: 600; height: 30px; outline: none; max-width: 220px; }
.grade { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: 112px; gap: 14px; padding: 16px 20px 28px; }
.widget { background: var(--superficie); border: 1px solid var(--borda); border-radius: 16px; box-shadow: var(--sombra-1); display: flex; flex-direction: column;
  min-width: 0; min-height: 0; overflow: hidden; position: relative; }
.widget-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; padding: 12px 12px 0 16px; }
.widget-cab .t { font-weight: 650; font-size: 13.5px; line-height: 1.3; }
.widget-cab .s { font-size: 11.5px; color: var(--texto-3); }
.widget-corpo { flex: 1; min-height: 0; padding: 4px 10px 10px; display: flex; flex-direction: column; }
.widget .acoes-w { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.widget:hover .acoes-w { opacity: 1; }
.widget.editando { outline: 2px dashed transparent; }
.widget.editando:hover { outline-color: var(--borda-forte); }
.widget { container-type: inline-size; }
.kpi { padding: 2px 6px; display: flex; flex-direction: column; justify-content: center; height: 100%; min-width: 0; }
/* o numero acompanha a largura do widget (container query): em grade estreita nao corta */
.kpi .valor { font-size: clamp(17px, 10cqi, 28px); font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
  line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .delta { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650; margin-top: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.kpi .delta svg { width: 13px; height: 13px; }
.kpi .delta.bom { color: var(--ok); } .kpi .delta.ruim { color: var(--perigo); } .kpi .delta.neutro { color: var(--texto-3); }
.kpi .comp { font-size: 11.5px; color: var(--texto-3); font-weight: 500; }
.widget-erro { margin: auto; text-align: center; font-size: 12.5px; color: var(--texto-3); padding: 10px; }
.esqueleto { background: linear-gradient(90deg, var(--superficie-3) 25%, var(--superficie-2) 37%, var(--superficie-3) 63%); background-size: 400% 100%;
  animation: brilho 1.3s ease infinite; border-radius: 8px; }
@keyframes brilho { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }
.vazio-painel { display: grid; place-items: center; text-align: center; padding: 60px 20px; color: var(--texto-2); }
.vazio-painel .ilustra { width: 72px; height: 72px; border-radius: 22px; background: var(--primaria-suave); display: grid; place-items: center; color: var(--primaria-texto); margin: 0 auto 14px; }
.vazio-painel .ilustra svg { width: 34px; height: 34px; }

/* ---------------------------------------------- abas, tabelas de admin ------------------------------------- */
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--borda); margin-bottom: 18px; overflow-x: auto; }
.abas button { height: 40px; padding: 0 14px; border: 0; background: transparent; color: var(--texto-2); font: inherit; font-weight: 600; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.abas button:hover { color: var(--texto); }
.abas button.ativo { color: var(--texto); border-bottom-color: var(--laranja); }
.admin { display: grid; grid-template-columns: 220px 1fr; height: 100%; min-height: 0; }
.admin-nav { border-right: 1px solid var(--borda); background: var(--superficie-2); padding: 16px 10px; overflow: auto; }
.admin-nav button { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent;
  color: var(--texto-2); font: inherit; font-weight: 550; cursor: pointer; text-align: left; }
.admin-nav button svg { width: 17px; height: 17px; }
.admin-nav button:hover { background: var(--superficie-3); color: var(--texto); }
.admin-nav button.ativo { background: var(--superficie); color: var(--texto); box-shadow: var(--sombra-1); }
.admin-corpo { overflow: auto; min-height: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { padding: 16px 18px; }
.kpi-card .rot { font-size: 12.5px; color: var(--texto-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi-card .rot svg { width: 16px; height: 16px; color: var(--verde); }
.kpi-card .valor { font-size: 26px; font-weight: 750; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.grade-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.mestre-detalhe { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.mestre-detalhe > * { min-width: 0; }
.lista-sel { max-height: calc(100vh - 220px); overflow: auto; padding: 6px; }
.lista-sel .item { padding: 10px 12px; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lista-sel .item:hover { background: var(--superficie-3); }
.lista-sel .item.ativo { background: var(--primaria-suave); color: var(--primaria-texto); font-weight: 600; }
.form-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.form-grade .largo { grid-column: 1 / -1; }
.bloco-sql { background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 10px; padding: 12px; font-family: var(--mono); font-size: 12px;
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto; }
.segredo { font-family: var(--mono); letter-spacing: .04em; }

/* ---------------------------------------------- modelo semantico (mapa do Cube) --------------------------- */
.mapa-wrap { overflow-x: auto; }
.mapa { display: block; width: 100%; min-width: 760px; height: auto; }
.mapa .col-titulo { font: 600 10.5px var(--fonte); fill: var(--texto-3); letter-spacing: .06em; text-transform: uppercase; }
.mapa .no { cursor: pointer; transition: opacity .15s; }
.mapa .no .caixa { fill: var(--superficie); stroke: var(--borda-forte); stroke-width: 1; }
.mapa .no:hover .caixa { fill: var(--superficie-2); }
.mapa .no.sel .caixa { stroke: var(--primaria); stroke-width: 2; fill: var(--primaria-suave); }
.mapa .no-view .faixa { fill: var(--verde); } .mapa .no-cubo .faixa { fill: var(--laranja); } .mapa .no-dim .faixa { fill: var(--info); }
.mapa .no-titulo { font: 600 13px var(--fonte); fill: var(--texto); }
.mapa .no-sub { font: 11px var(--mono); fill: var(--texto-3); }
.mapa .aresta { fill: none; stroke: var(--borda-forte); stroke-width: 1.4; transition: opacity .15s; }
.mapa .aresta.juncao { stroke-dasharray: 5 4; }
.mapa .aresta.rel { stroke: var(--primaria); stroke-width: 2.2; }
.mapa.com-sel .no:not(.sel):not(.rel) { opacity: .4; }
.mapa.com-sel .aresta:not(.rel) { opacity: .3; }
.legenda { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.leg-view { background: var(--verde); } .leg-cubo { background: var(--laranja); } .leg-dim { background: var(--info); }
.matriz th.centro, .matriz td.centro { text-align: center; }
.matriz td.clicavel { cursor: pointer; }
.cartao-view { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.cartao-view:hover { border-color: var(--primaria); box-shadow: var(--sombra-2); }

/* ---------------------------------------------- orcamento de IA ------------------------------------------- */
.barra-uso { font-size: 12px; }
.barra-uso-cab { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.barra-uso-cab b { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.barra-uso-cab .de { font-weight: 500; opacity: .7; }
.barra-uso .trilho, .barra-tabela .trilho { height: 6px; border-radius: 99px; background: var(--superficie-3); overflow: hidden; margin-top: 4px; }
.barra-uso .trilho i, .barra-tabela .trilho i { display: block; height: 100%; border-radius: 99px; background: var(--verde); transition: width .4s; }
.barra-uso.alerta .trilho i, .barra-tabela.alerta .trilho i { background: var(--laranja); }
.barra-uso.esgotado .trilho i, .barra-tabela.esgotado .trilho i { background: var(--perigo); }
.barra-uso .sem-teto { opacity: .6; font-size: 11px; margin-top: 2px; }
.barra-uso.clara .trilho { background: rgba(255, 255, 255, .16); }
.barra-uso.clara.alerta .trilho i { background: #FFB066; }
.barra-uso.clara.esgotado .trilho i { background: #FF7A85; }
.uso-ia { margin: 6px 4px 8px; padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .18); display: flex; flex-direction: column; gap: 8px; }
.uso-ia-titulo { display: flex; align-items: center; gap: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; opacity: .7; }
.aviso-orcamento { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin: 0 auto 8px; max-width: 860px; padding: 8px 12px;
  border-radius: 10px; background: rgba(246, 142, 52, .1); color: #a5570f; border: 1px solid rgba(246, 142, 52, .3); }
.aviso-orcamento.esgotado { background: rgba(220, 53, 69, .08); color: var(--perigo); border-color: rgba(220, 53, 69, .25); }
:root[data-tema="escuro"] .aviso-orcamento:not(.esgotado) { color: #ffb073; }
.barra-tabela { display: flex; align-items: center; gap: 8px; }
.barra-tabela .trilho { flex: 1; margin-top: 0; min-width: 70px; }
.barra-tabela span { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.campo.campo-dinheiro { width: 92px; text-align: right; }
.tabela-orcamento td { vertical-align: middle; padding-left: 8px; padding-right: 8px; }
.tabela-orcamento tr.inativo td { opacity: .55; }
.tabela-orcamento tr.detalhe td { background: var(--superficie-2); white-space: normal; }
.tabela-compacta td, .tabela-compacta th { padding: 5px 8px; font-size: 12.5px; }
.kpi-card.alerta .valor { color: var(--laranja); }
.passos { margin: 6px 0 0; padding-left: 20px; font-size: 13px; color: var(--texto-2); display: grid; gap: 4px; }

/* ---------------------------------------------- modal, gaveta, menu, toast ---------------------------------- */
.veu { position: fixed; inset: 0; background: rgba(5, 20, 17, .45); backdrop-filter: blur(2px); z-index: 50; display: grid; place-items: center; padding: 20px;
  animation: aparecer .15s ease; }
@keyframes aparecer { from { opacity: 0 } }
.modal { background: var(--superficie); border-radius: 18px; box-shadow: var(--sombra-3); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex;
  flex-direction: column; animation: subir .18s ease; border: 1px solid var(--borda); }
.modal.largo { width: min(920px, 100%); }
@keyframes subir { from { transform: translateY(8px); opacity: 0 } }
.modal-cab { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.modal-corpo { padding: 4px 20px 16px; overflow: auto; }
.modal-rodape { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--borda); }
.gaveta-veu { position: fixed; inset: 0; background: rgba(5, 20, 17, .35); z-index: 40; animation: aparecer .15s ease; }
.gaveta { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--superficie); box-shadow: var(--sombra-3); z-index: 41;
  display: flex; flex-direction: column; animation: deslizar .2s ease; border-left: 1px solid var(--borda); }
.gaveta.larga { width: min(860px, 100vw); }
@keyframes deslizar { from { transform: translateX(24px); opacity: 0 } }
.menu-pop { position: absolute; z-index: 30; min-width: 190px; background: var(--superficie); border: 1px solid var(--borda); border-radius: 12px; box-shadow: var(--sombra-2);
  padding: 6px; animation: aparecer .1s ease; }
.menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; color: var(--texto);
  font: inherit; font-size: 13px; cursor: pointer; text-align: left; }
.menu-pop button svg { width: 15px; height: 15px; color: var(--texto-3); }
.menu-pop button:hover { background: var(--superficie-3); }
.menu-pop button.perigo { color: var(--perigo); } .menu-pop button.perigo svg { color: var(--perigo); }
.menu-pop hr { border: 0; border-top: 1px solid var(--borda); margin: 6px 0; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px; background: #10211E; color: #fff; box-shadow: var(--sombra-2);
  display: flex; gap: 10px; align-items: flex-start; animation: subir .2s ease; font-size: 13.5px; }
.toast.erro { background: #5b1820; } .toast.ok { background: #0f4a3f; }
.toast svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: girar .7s linear infinite; display: inline-block; }

/* ---------------------------------------------- login ------------------------------------------------------- */
.login { display: grid; grid-template-columns: 1.05fr 1fr; height: 100%; }
.login-marca { position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at -10% -10%, #1fb39e 0%, transparent 55%), radial-gradient(900px 500px at 110% 110%, rgba(246,142,52,.55) 0%, transparent 50%),
  linear-gradient(160deg, #053B34 0%, #006B5E 55%, #0b8a78 100%); }
.login-marca::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
  linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 36px 36px; mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent); pointer-events: none; }
.login-marca > * { position: relative; z-index: 1; }
.login-marca h1 { font-size: 40px; line-height: 1.08; letter-spacing: -0.03em; max-width: 520px; font-weight: 750; }
.login-marca h1 em { font-style: normal; color: #ffd2a8; }
.login-marca p { font-size: 16px; opacity: .85; max-width: 460px; }
.recursos { display: grid; gap: 12px; max-width: 460px; }
.recurso { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(4px); }
.recurso svg { width: 20px; height: 20px; flex: none; color: #ffd2a8; margin-top: 1px; }
.recurso b { display: block; } .recurso span { font-size: 13px; opacity: .8; }
.login-form { display: grid; place-items: center; padding: 32px; background: var(--superficie); }
.login-form .caixa { width: min(380px, 100%); }
.login-form h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.demo-dica { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--primaria-suave); color: var(--primaria-texto); font-size: 13px; }

/* ---------------------------------------------- responsivo --------------------------------------------------- */
@media (max-width: 1100px) {
  .construtor { grid-template-columns: 340px 1fr; }
  .mestre-detalhe { grid-template-columns: 1fr; }
}
.so-celular { display: none; }
@media (max-width: 900px) {
  .app, .app.recolhido { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .so-celular { display: block; }
  .topo .selo { display: none; }
  .chat-layout { grid-template-columns: 1fr; }
  .lista-conversas { display: none; }
  .construtor { grid-template-columns: 1fr; grid-template-rows: 46vh 1fr; }
  .construtor .lado-chat { border-right: 0; border-bottom: 1px solid var(--borda); }
  .grade { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grade > .widget { grid-column: span 2 !important; }
  .login { grid-template-columns: 1fr; } .login-marca { display: none; }
  .admin { grid-template-columns: 1fr; } .admin-nav { display: flex; overflow-x: auto; padding: 8px; gap: 4px; border-right: 0; border-bottom: 1px solid var(--borda); }
  .admin-nav button { width: auto; white-space: nowrap; } .admin-nav .nav-titulo { display: none; }
  .pagina { padding: 16px; } .topo { padding: 0 12px; }
}
/* abas dentro do mestre-detalhe (Setores: 6 abas) - mais justas para caber sem rolar */
.mestre-detalhe .abas { gap: 0; }
.mestre-detalhe .abas button { padding: 0 11px; }
.mestre-detalhe .abas button > svg { display: none; }

/* ---------------------------------------------- explorar (self-service) ------------------------------------------ */
.explorar { display: grid; grid-template-columns: minmax(0, 1fr) auto; height: 100%; min-height: 0; }
.explorar-tela { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.explorar-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--borda); background: var(--superficie); }
.titulo-explorar { flex: 1 1 260px; min-width: 0; font: inherit; font-size: 17px; font-weight: 650; color: var(--texto); padding: 6px 10px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; }
.titulo-explorar:hover { border-color: var(--borda); }
.titulo-explorar:focus { outline: none; border-color: var(--primaria); background: var(--superficie); }
.explorar-visual { flex: 1; min-height: 0; overflow: auto; }
.explorar-visual .grade { padding: 16px 20px 20px; }
.explorar-vazio { height: 100%; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; padding: 32px; color: var(--texto-2); max-width: 560px; margin: 0 auto; }
.explorar-vazio svg { color: var(--primaria); opacity: .8; }
.explorar-vazio b { color: var(--texto); }
.explorar-vazio > b { font-size: 17px; }
.explorar-lados { display: grid; grid-template-columns: 290px 280px; min-height: 0; border-left: 1px solid var(--borda); }
.explorar-abas { display: none; }
.explorar-lado { min-height: 0; overflow: auto; background: var(--superficie-2); padding-bottom: 18px; }
.explorar-lado + .explorar-lado { border-left: 1px solid var(--borda); }
.explorar-lado h3 { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); margin: 16px 14px 8px; }
.visuais { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0 14px; }
.visuais button { position: relative; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--borda);
  background: var(--superficie); color: var(--texto-2); cursor: pointer; }
.visuais button:hover { border-color: var(--borda-forte); color: var(--texto); }
.visuais button.ativo { border-color: var(--primaria); background: var(--primaria-suave); color: var(--primaria-texto); }
.visuais button .giro { display: none; }
.visuais button[aria-label="Barras horizontais"] svg { transform: rotate(90deg) scaleX(-1); }
.visual-nome { font-size: 12px; padding: 6px 14px 0; }
.poco { margin: 0 14px 10px; padding: 6px; min-height: 56px; display: flex; flex-direction: column; gap: 6px; border-radius: 12px;
  border: 1.5px dashed var(--borda-forte); transition: border-color .15s, background .15s; }
.poco.pode { border-color: var(--primaria); }
.poco.alvo { background: var(--primaria-suave); }
.poco-titulo { font-size: 12px; font-weight: 650; color: var(--texto-2); padding: 2px 4px 0; }
.poco .dica { font-size: 12px; color: var(--texto-3); padding: 6px 4px 8px; }
.ficha { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 6px 6px 9px; border-radius: 9px; background: var(--superficie);
  border: 1px solid var(--borda); font-size: 13px; }
.ficha.clicavel { cursor: pointer; }
.ficha.clicavel:hover { border-color: var(--borda-forte); }
.ficha .nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ficha .tipo-f { font-weight: 700; color: var(--primaria-texto); font-size: 12px; }
.ficha svg { flex: none; color: var(--texto-3); }
.ficha select { height: 24px; font: inherit; font-size: 12px; border: 1px solid var(--borda); border-radius: 7px; background: var(--superficie-2); color: var(--texto); padding: 0 4px; }
.ficha .x { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: var(--texto-3); cursor: pointer; }
.ficha .x:hover { background: var(--superficie-2); color: var(--perigo); }
.opcoes-explorar { display: grid; gap: 8px; padding: 0 14px; }
.opcoes-explorar label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--texto-2); }
.opcoes-explorar select { width: 170px; }
.descricao-assunto { font-size: 12px; line-height: 1.4; margin: 8px 0 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.campos-lista { padding: 4px 8px 0; }
.campos-grupo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--texto-3); margin: 12px 8px 4px; }
.campo-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 8px; border-radius: 8px; cursor: grab; font-size: 13px; user-select: none; }
.campo-item:hover { background: var(--superficie); }
.campo-item:active { cursor: grabbing; }
.campo-item .tipo { width: 18px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--texto-3); }
.campo-item .nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campo-item.usado .nome { color: var(--primaria-texto); font-weight: 600; }
.campo-item .add { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 7px; background: transparent;
  color: var(--texto-3); cursor: pointer; opacity: 0; }
.campo-item:hover .add, .campo-item.usado .add { opacity: 1; }
.campo-item .add:hover { background: var(--primaria-suave); color: var(--primaria-texto); }
.lista-valores { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow: auto; border: 1px solid var(--borda); border-radius: 10px; padding: 6px 10px; }
.lista-valores.marcados { max-height: 120px; margin-bottom: 8px; background: var(--primaria-suave); }
.lista-valores .check { padding: 4px 0; font-size: 13.5px; }
@media (max-width: 1280px) {
  .explorar-lados { grid-template-columns: 300px; grid-template-rows: auto minmax(0, 1fr); }
  .explorar-abas { display: flex; gap: 4px; padding: 8px 10px 0; background: var(--superficie-2); border-bottom: 1px solid var(--borda); }
  .explorar-abas button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border: 0; border-bottom: 2px solid transparent;
    background: transparent; color: var(--texto-2); font: inherit; font-weight: 600; cursor: pointer; }
  .explorar-abas button.ativo { color: var(--texto); border-bottom-color: var(--laranja); }
  .explorar-lado + .explorar-lado { border-left: 0; }
  .explorar-lados[data-aba="montar"] .campos, .explorar-lados[data-aba="campos"] .montar { display: none; }
}
@media (max-width: 900px) {
  .explorar { grid-template-columns: 1fr; height: auto; }
  .explorar-lados { grid-template-columns: 1fr; border-left: 0; border-top: 1px solid var(--borda); }
  .explorar-visual { min-height: 420px; }
}
