/* Painel Gerencial - visual inspirado no Gentelella (barra lateral escura, x_panel, tile_count) */
:root {
  color-scheme: light;
  --pagina: #f7f7f7;
  --superficie: #ffffff;
  --superficie-2: #f9f9f9;
  --borda: #e6e9ed;
  --texto: #191919;
  --texto-2: #5a6570;
  --texto-3: #73879c;
  --lateral: #2a3f54;
  --lateral-2: #1f3044;
  --lateral-texto: #e7e7e7;
  --lateral-ativo: #ffffff;
  --destaque: #1abb9c;
  --primaria: #257de0;
  --bom: #006c10;
  --bom-fundo: #e3f5e6;
  --ruim: #c12f30;
  --ruim-fundo: #fde8e8;
  --alerta: #8a5a00;
  --alerta-fundo: #fff4d6;
  --grade: #e7e7e7;
  --eixo: #c2c2c2;
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600;
  --s5: #ee7fac; --s6: #008a17; --s7: #6a4ce2; --s8: #ec4647;
  --mid: #efefef;
  --sombra: 0 1px 2px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --pagina: #0b0b0b; --superficie: #191919; --superficie-2: #212121; --borda: #2e2e2e;
    --texto: #efefef; --texto-2: #b5b5b5; --texto-3: #9c9c9c;
    --lateral: #121a23; --lateral-2: #0d141b; --lateral-texto: #cfd8e3; --lateral-ativo: #ffffff;
    --primaria: #338ced; --bom: #53c556; --bom-fundo: #12301a; --ruim: #f07071; --ruim-fundo: #3a1717;
    --alerta: #f3c14f; --alerta-fundo: #352a0c; --grade: #303030; --eixo: #474747;
    --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05;
    --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #eb6263;
    --mid: #383838;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --pagina: #0b0b0b; --superficie: #191919; --superficie-2: #212121; --borda: #2e2e2e;
  --texto: #efefef; --texto-2: #b5b5b5; --texto-3: #9c9c9c;
  --lateral: #121a23; --lateral-2: #0d141b; --lateral-texto: #cfd8e3; --lateral-ativo: #ffffff;
  --primaria: #338ced; --bom: #53c556; --bom-fundo: #12301a; --ruim: #f07071; --ruim-fundo: #3a1717;
  --alerta: #f3c14f; --alerta-fundo: #352a0c; --grade: #303030; --eixo: #474747;
  --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05;
  --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #eb6263;
  --mid: #383838;
}

* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
body {
  margin: 0; background: var(--pagina); color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px;
}
a { color: var(--primaria); }
.text-muted-2 { color: var(--texto-3); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

/* ---------------- login ---------------- */
/* identidade visual Hamilton Gomes: esmeralda #0F3D2E, dourado #D4AF37, preto #0B0B0D, marfim #F5F1E6 */
:root { --hg-esmeralda: #0F3D2E; --hg-esmeralda-2: #0A2C21; --hg-dourado: #D4AF37; --hg-preto: #0B0B0D; --hg-marfim: #F5F1E6; }
.login-wrap {
  min-height: 100vh; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 40px 72px; padding: 32px 16px;
  background-color: var(--hg-esmeralda);
  background-image: radial-gradient(rgba(245,241,230,.06) 1px, transparent 1.2px); background-size: 6px 6px;
}
.hg-marca { display: flex; align-items: center; gap: 28px; color: var(--hg-marfim); }
.hg-cart { width: 170px; height: 137px; flex: none; color: var(--hg-marfim); }
.hg-nome { font-family: "Archivo Black", "Arial Black", system-ui, sans-serif; font-size: 64px; line-height: .92; letter-spacing: -.01em; color: var(--hg-marfim); }
.hg-nome span, .hg-assina span, .hg-rodape > span { color: var(--hg-dourado); }
.hg-tag { display: inline-flex; margin-top: 16px; font-family: "Archivo Black", "Arial Black", system-ui, sans-serif; font-size: 13px; letter-spacing: .14em; }
.hg-tag b { background: var(--hg-dourado); color: var(--hg-preto); padding: 8px 12px; font-weight: 400; }
.hg-tag span { background: var(--hg-marfim); color: var(--hg-esmeralda); padding: 8px 12px; }
.login-card { width: 100%; max-width: 380px; background: var(--superficie); border-radius: 12px; padding: 30px 28px; box-shadow: 0 18px 50px rgba(0,0,0,.35); border-top: 5px solid var(--hg-dourado); }
.login-card h1 { font-size: 22px; margin: 10px 0 2px; font-weight: 700; }
.login-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--hg-esmeralda); color: var(--hg-marfim); display: grid; place-items: center; }
.login-logo svg { width: 38px; height: 31px; }
.login-card .btn-primary { background: var(--hg-esmeralda); border-color: var(--hg-esmeralda); }
.login-card .btn-primary:hover, .login-card .btn-primary:focus { background: var(--hg-esmeralda-2); border-color: var(--hg-dourado); }
.login-card .form-check-input:checked { background-color: var(--hg-esmeralda); border-color: var(--hg-esmeralda); }
@media (max-width: 760px) {
  .login-wrap { gap: 24px; align-content: center; }
  .hg-marca { flex-direction: column; text-align: center; gap: 12px; max-width: 100%; }
  .hg-cart { width: 96px; height: 78px; }
  .hg-nome { font-size: 40px; }
  .hg-tag { font-size: 9px; letter-spacing: .1em; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
  .hg-tag b, .hg-tag span { padding: 6px 8px; }
}
.login-erro { color: var(--ruim); margin-top: 12px; min-height: 20px; }
.login-carregando { margin-top: 8px; color: var(--texto-2); }

/* ---------------- layout ---------------- */
.lateral {
  position: fixed; inset: 0 auto 0 0; width: 230px; background: var(--lateral); color: var(--lateral-texto);
  display: flex; flex-direction: column; z-index: 1040; transition: transform .2s;
}
.lateral-topo { display: flex; align-items: center; justify-content: space-between; height: 57px; padding: 0 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.marca { color: #fff; text-decoration: none; font-size: 17px; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.marca i { color: var(--destaque); font-size: 20px; }
.marca-cart { width: 30px; height: 24px; flex: none; color: var(--hg-marfim); }
.lateral-topo { box-shadow: inset 0 -2px 0 rgba(212,175,55,.55); }
.hg-assina { font-family: "Archivo Black", "Arial Black", system-ui, sans-serif; font-size: 11px; letter-spacing: .06em; color: var(--hg-marfim); opacity: .85; margin-bottom: 4px; }
.hg-assina small { display: block; font-family: system-ui, sans-serif; font-size: 10px; letter-spacing: .04em; color: #8ea1b5; text-transform: uppercase; }
.hg-rodape { white-space: nowrap; }
.btn-fechar-menu { display: none; background: none; border: 0; color: #fff; font-size: 20px; }
.perfil { display: flex; gap: 10px; align-items: center; padding: 18px 14px; }
.perfil-avatar { width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.1); display: grid; place-items: center; font-size: 18px; color: #fff; border: 2px solid rgba(255,255,255,.15); }
.perfil-ola { display: block; font-size: 12px; color: #bab8b8; }
.perfil strong { color: #ecf0f1; font-weight: 500; }
.menu { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.menu h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8ea1b5; margin: 14px 14px 6px; font-weight: 600; }
.menu a { display: flex; align-items: center; gap: 12px; padding: 10px 16px; color: var(--lateral-texto); text-decoration: none; border-right: 4px solid transparent; }
.menu a i { width: 20px; text-align: center; opacity: .85; }
.menu a:hover { background: rgba(255,255,255,.05); color: #fff; }
.menu a.ativo { background: linear-gradient(var(--lateral-2), var(--lateral-2)); color: var(--lateral-ativo); border-right-color: var(--hg-dourado); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.lateral-rodape { padding: 10px 14px; font-size: 11px; color: #8ea1b5; background: var(--lateral-2); }
.fundo-menu { display: none; }

.principal { margin-left: 230px; min-height: 100vh; display: flex; flex-direction: column; }
.barra-topo {
  position: sticky; top: 0; z-index: 1020; background: var(--superficie); border-bottom: 1px solid var(--borda);
  display: flex; align-items: flex-end; gap: 12px; padding: 8px 16px; flex-wrap: wrap; min-height: 57px;
}
.btn-menu { display: none; background: none; border: 0; font-size: 20px; color: var(--texto-2); padding: 4px 8px; align-self: center; }
.filtros { display: flex; gap: 12px; flex-wrap: wrap; flex: 1; align-items: flex-end; }
.filtro { display: flex; flex-direction: column; gap: 2px; }
.filtro label { font-size: 11px; color: var(--texto-3); text-transform: uppercase; letter-spacing: .04em; }
.filtro-datas { flex-direction: row; align-items: center; gap: 6px; }
.filtro-datas label { text-transform: none; font-size: 12px; }
.filtro-datas.oculto { display: none; }
#f-loja { min-width: 210px; }
.acoes-topo { display: flex; gap: 6px; align-self: center; }
.conteudo { padding: 16px; flex: 1; }
.rodape { padding: 12px 16px; color: var(--texto-3); font-size: 12px; border-top: 1px solid var(--borda); background: var(--superficie); }

/* ---------------- titulos e paineis (x_panel) ---------------- */
.titulo-pagina { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 2px 0 14px; }
.titulo-pagina h2 { font-size: 22px; font-weight: 500; margin: 0; }
.titulo-pagina .sub { color: var(--texto-3); font-size: 13px; }
.x-painel { background: var(--superficie); border: 1px solid var(--borda); border-radius: 6px; padding: 10px 16px 16px; margin-bottom: 16px; box-shadow: var(--sombra); min-width: 0; }
.x-titulo { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 2px solid var(--borda); padding: 4px 0 8px; margin-bottom: 12px; flex-wrap: wrap; }
.x-titulo h3 { font-size: 16px; font-weight: 500; margin: 0; color: var(--texto); }
.x-titulo .sub { font-size: 12px; color: var(--texto-3); }
.x-ferramentas { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------------- tiles de indicadores (tile_count) ---------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--superficie); border: 1px solid var(--borda); border-radius: 6px; padding: 12px 14px; border-left: 3px solid var(--destaque); min-width: 0; }
.tile-nome { color: var(--texto-3); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.tile-valor { font-size: 26px; font-weight: 600; line-height: 1.25; margin: 4px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-extra { font-size: 12px; color: var(--texto-2); margin-top: -4px; margin-bottom: 6px; }
.comps { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.comp { display: flex; justify-content: space-between; gap: 6px; color: var(--texto-3); }
.var { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.var.bom { color: var(--bom); }
.var.ruim { color: var(--ruim); }
.var.neutro { color: var(--texto-3); }
.var i { font-size: 10px; margin-right: 2px; }

/* ---------------- tabelas ---------------- */
.tabela-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th { position: sticky; top: 0; background: var(--superficie-2); color: var(--texto-2); font-weight: 600; font-size: 12px; text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--borda); white-space: nowrap; cursor: default; }
.tabela th.ordenavel { cursor: pointer; user-select: none; }
.tabela th.ordenavel:hover { color: var(--texto); }
.tabela th .seta { opacity: .5; margin-left: 3px; font-size: 10px; }
.tabela th.num { text-align: right; }
.tabela td { padding: 7px 8px; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tabela td:first-child { min-width: 170px; }
.tabela.dre td:first-child { min-width: 260px; }
.tabela tbody tr:hover td { background: var(--superficie-2); }
.tabela tr.total td { font-weight: 700; background: var(--superficie-2); border-top: 2px solid var(--borda); }
.tabela tr.sub td:first-child { padding-left: 28px; color: var(--texto-2); }
.tabela tr.sub td { font-size: 12px; }
.tabela .expandir { background: none; border: 0; color: var(--destaque); padding: 0 6px 0 0; width: 22px; font-size: 15px; line-height: 1; cursor: pointer; vertical-align: -1px; }
.tabela .expandir:hover { filter: brightness(1.2); }
.tabela .expandir.aberto { color: var(--texto-3); }
.tabela .expandir:focus-visible { outline: 2px solid var(--destaque); outline-offset: 2px; border-radius: 3px; }
/* matriz expansivel: grupo > coleta > produtos */
.tabela.matriz tr.grupo > td { background: var(--superficie-2); border-top: 2px solid var(--borda); font-weight: 600; }
.tabela.matriz tr.grupo > td .chip { font-weight: 500; }
.tabela.matriz tr.n1 > td:first-child { padding-left: 30px; }
.exp-barra { display: inline-flex; gap: 6px; margin-right: 4px; }
@media (max-width: 760px) { .exp-barra .btn { font-size: 0; padding: 4px 8px; } .exp-barra .btn i { font-size: 13px; margin: 0 !important; } }
.tabela-limite { max-height: 560px; overflow: auto; }
.barra-mini { height: 6px; border-radius: 3px; background: var(--s1); min-width: 2px; }
.celula-barra { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.celula-barra .trilho { width: 60px; background: var(--grade); border-radius: 3px; }

/* ---------------- dicas ---------------- */
.dica { color: var(--texto-3); cursor: help; font-size: 12px; }
.dica:hover { color: var(--primaria); }
.tooltip-inner { max-width: 300px; text-align: left; font-size: 13px; line-height: 1.4; padding: 8px 10px; }

/* ---------------- tarefas ---------------- */
.tarefas { display: grid; gap: 10px; }
.tarefa { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; padding: 12px; border: 1px solid var(--borda); border-radius: 6px; background: var(--superficie-2); }
.tarefa-num { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--lateral); color: #fff; font-weight: 700; }
.tarefa h4 { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
.tarefa p { margin: 0 0 4px; color: var(--texto-2); font-size: 13px; }
.tarefa .acao { color: var(--texto); font-size: 13px; }
.tarefa .acao i { color: var(--destaque); }
.tarefa-lado { text-align: right; font-size: 12px; color: var(--texto-3); white-space: nowrap; }
.tarefa-lado strong { display: block; font-size: 14px; color: var(--texto); }
.tarefa.feita { opacity: .55; }
.tarefa.feita h4 { text-decoration: line-through; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: var(--superficie); border: 1px solid var(--borda); color: var(--texto-2); }
.chip.ruim { background: var(--ruim-fundo); color: var(--ruim); border-color: transparent; }
.chip.bom { background: var(--bom-fundo); color: var(--bom); border-color: transparent; }
.chip.alerta { background: var(--alerta-fundo); color: var(--alerta); border-color: transparent; }

/* ---------------- graficos ---------------- */
.grafico { position: relative; height: 280px; }
.grafico.alto { height: 360px; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--texto-2); margin-bottom: 6px; }
.legenda span::before { content: ""; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--cor); }

/* ---------------- mapa de calor ---------------- */
.calor { border-collapse: separate; border-spacing: 2px; font-size: 12px; width: 100%; }
.calor th { font-weight: 500; color: var(--texto-3); padding: 2px 4px; white-space: nowrap; font-size: 11px; }
.calor th.linha { text-align: left; color: var(--texto-2); position: sticky; left: 0; background: var(--superficie); z-index: 1; }
.calor td { height: 30px; min-width: 42px; text-align: center; border-radius: 3px; font-variant-numeric: tabular-nums; font-size: 11px; cursor: default; }
.calor td.vazio { background: transparent; }
.escala { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--texto-3); margin-top: 8px; flex-wrap: wrap; }
.escala .degrade { width: 180px; height: 10px; border-radius: 5px; }

/* ---------------- DRE ---------------- */
.dre td input.ajuste { width: 110px; text-align: right; padding: 2px 6px; font-size: 12px; border: 1px dashed var(--eixo); background: transparent; color: var(--texto); border-radius: 3px; font-variant-numeric: tabular-nums; }
.dre td input.ajuste:focus { border-style: solid; border-color: var(--primaria); outline: none; }
.dre tr.linha-total td { font-weight: 700; background: var(--superficie-2); }
.dre tr.linha-destaque td:first-child { font-weight: 600; }
.dre tr.final td { background: var(--lateral); color: #fff; }
.dre tr.final td .var.bom { color: #7ee08a; }
.dre tr.final td .var.ruim { color: #ff9a9b; }
.dre tr.final td.neg { color: #ff9a9b; }
.dre tr.final td input.ajuste { color: #fff; border-color: rgba(255,255,255,.4); }
.dre tr.final .dica { color: rgba(255,255,255,.7); }
.dre tr.linha-subtotal td { font-weight: 600; background: transparent; border-top: 1px dashed var(--borda); }
.chip.fx-vencido { background: #7f1d1d; color: #fff; border-color: transparent; font-weight: 600; }
.chip.fx-critico { background: #dc2626; color: #fff; border-color: transparent; font-weight: 600; }
.chip.fx-urgente { background: #f97316; color: #fff; border-color: transparent; }
.chip.fx-alto { background: #facc15; color: #3a2e00; border-color: transparent; }
.chip.fx-medio { background: #fde68a; color: #3a2e00; border-color: transparent; }
.chip.fx-atencao { background: #bfdbfe; color: #0c2d57; border-color: transparent; }
.chip.fx-monitorar { background: #dcfce7; color: #064e1c; border-color: transparent; }
.dre tr.linha-memo td { font-size: 12px; font-style: italic; color: var(--texto-2); background: transparent; }
.dre tr.linha-memo td:first-child { padding-left: 34px; }
.dre tr.linha-manual td:first-child { color: var(--alerta); }
.dre tr.linha-indicador td { font-style: italic; background: var(--bom-fundo); color: var(--texto); border-top: 2px solid var(--borda); }
/* DRE gerencial: analise automatica e divergencias */
.dre-achados { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.dre-achado { display: flex; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--borda); background: var(--superficie); border-left-width: 4px; }
.dre-achado > i { margin-top: 3px; font-size: 15px; }
.dre-achado.alto { border-left-color: var(--ruim); } .dre-achado.alto > i { color: var(--ruim); }
.dre-achado.medio { border-left-color: var(--alerta); } .dre-achado.medio > i { color: var(--alerta); }
.dre-achado.info { border-left-color: var(--destaque); } .dre-achado.info > i { color: var(--destaque); }
.dre-achado.bom { border-left-color: var(--bom); } .dre-achado.bom > i { color: var(--bom); }
.dre-achado .t { font-weight: 600; font-size: 13px; }
.dre-achado .d { font-size: 12.5px; color: var(--texto-2); margin-top: 3px; line-height: 1.45; }
#t-dre-div td .motivo { white-space: normal; min-width: 320px; max-width: 560px; font-size: 12px; line-height: 1.4; color: var(--texto-2); }
.dre td.neg { color: var(--ruim); }
.abas { display: flex; gap: 4px; flex-wrap: wrap; }
.abas button { border: 1px solid var(--borda); background: var(--superficie); color: var(--texto-2); padding: 5px 12px; border-radius: 4px; font-size: 13px; }
.abas button.ativo { background: var(--lateral); color: #fff; border-color: var(--lateral); }
:root[data-theme="dark"] .abas button.ativo { background: var(--primaria); border-color: var(--primaria); }

.aviso { padding: 10px 12px; border-radius: 6px; background: var(--alerta-fundo); color: var(--alerta); font-size: 13px; margin-bottom: 12px; }
.aviso.info { background: var(--superficie-2); color: var(--texto-2); border: 1px solid var(--borda); }
.vazio-msg { color: var(--texto-3); padding: 24px; text-align: center; }

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

/* ---------------- menu recolhido (so icones) ---------------- */
.btn-menu { display: block; }
.btn-filtros { display: none; }
body.menu-recolhido .lateral { width: 64px; }
body.menu-recolhido .principal { margin-left: 64px; }
body.menu-recolhido .lateral .marca span,
body.menu-recolhido .perfil > div:not(.perfil-avatar),
body.menu-recolhido .menu h3,
body.menu-recolhido .menu a span,
body.menu-recolhido .lateral-rodape { display: none; }
body.menu-recolhido .lateral-topo { justify-content: center; padding: 0; }
body.menu-recolhido .perfil { justify-content: center; padding: 14px 0; }
body.menu-recolhido .perfil-avatar { width: 38px; height: 38px; font-size: 15px; }
body.menu-recolhido .menu a { justify-content: center; padding: 12px 0; }
body.menu-recolhido .menu a i { font-size: 17px; }
body.menu-recolhido .menu { padding-top: 6px; }
.lateral, .principal { transition: width .2s, margin-left .2s, transform .2s; }

/* ---------------- quadro de bom dia ---------------- */
.bomdia { background: linear-gradient(135deg, var(--lateral) 0%, #1d6b73 100%); color: #fff; border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--sombra); }
:root[data-theme="dark"] .bomdia { background: linear-gradient(135deg, #16222e 0%, #0f3d42 100%); }
.bomdia-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.bomdia h2 { font-size: 22px; font-weight: 600; margin: 0; }
.bomdia .data { color: rgba(255,255,255,.75); font-size: 13px; }
.bomdia-recolher { background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 4px; padding: 4px 10px; font-size: 12px; }
.bomdia-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 14px; }
.bd-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 10px 12px; min-width: 0; }
.bd-card .rot { font-size: 12px; color: rgba(255,255,255,.75); display: flex; gap: 6px; align-items: center; }
.bd-card .val { font-size: 22px; font-weight: 700; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bd-card .det { font-size: 12px; color: rgba(255,255,255,.85); display: flex; flex-direction: column; gap: 1px; }
.bd-card .det .linha { display: flex; justify-content: space-between; gap: 6px; }
.bomdia .var.bom { color: #7ee08a; }
.bomdia .var.ruim { color: #ffa3a4; }
.bomdia .var.neutro { color: rgba(255,255,255,.6); }
.bomdia .dica { color: rgba(255,255,255,.6); }
.bd-alertas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bd-alerta { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.12); color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 16px; font-size: 13px; }
.bd-alerta:hover { background: rgba(255,255,255,.2); color: #fff; }
.bd-alerta.ruim i { color: #ffa3a4; }
.bd-alerta.bom i { color: #7ee08a; }
.bomdia.recolhido .bomdia-grade, .bomdia.recolhido .bd-alertas { display: none; }

/* ---------------- responsivo ---------------- */
@media (max-width: 1100px) {
  .grade-2, .grade-3, .grade-2-1 { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 900px) {
  .lateral, body.menu-recolhido .lateral { transform: translateX(-100%); width: 250px; }
  .lateral.aberta { transform: none; }
  body.menu-recolhido .lateral.aberta .marca span, body.menu-recolhido .lateral.aberta .menu a span,
  body.menu-recolhido .lateral.aberta .menu h3, body.menu-recolhido .lateral.aberta .perfil > div,
  body.menu-recolhido .lateral.aberta .lateral-rodape { display: revert; }
  .btn-fechar-menu { display: block; }
  .fundo-menu.ativo { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1030; }
  .principal, body.menu-recolhido .principal { margin-left: 0; }
  .conteudo { padding: 12px 12px; }
  .barra-topo { align-items: center; padding: 6px 10px; gap: 6px; min-height: 52px; }
  .btn-filtros { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 0; background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 6px; padding: 6px 10px; color: var(--texto); font-size: 13px; text-align: left; }
  .btn-filtros span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .filtros { display: none; order: 10; flex-basis: 100%; padding: 6px 0 4px; }
  .filtros.aberto { display: flex; }
  .filtros .filtro { flex: 1 1 140px; }
  .filtro-datas { flex-wrap: wrap; }
  #f-loja { min-width: 0; }
  .titulo-pagina h2 { font-size: 19px; }
  .titulo-pagina .sub { font-size: 12px; }
  .x-painel { padding: 8px 12px 12px; }
  .grafico { height: 240px; }
  .grafico.alto { height: 320px; }
  /* tabelas: primeira coluna fica parada ao rolar para o lado */
  .tabela td:first-child, .tabela th:first-child { position: sticky; left: 0; z-index: 1; background: var(--superficie); min-width: 130px; max-width: 170px; white-space: normal; }
  .tabela th:first-child { z-index: 2; background: var(--superficie-2); }
  .tabela tr.total td:first-child, .dre tr.linha-total td:first-child { background: var(--superficie-2); }
  .dre tr.final td:first-child { background: var(--lateral); }
  .tabela.dre td:first-child { min-width: 170px; }
  .tabela { font-size: 12px; }
  .tabela td, .tabela th { padding: 6px 6px; }
  .bomdia { padding: 14px; }
  .bomdia h2 { font-size: 19px; }
  .bomdia-grade { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bd-card .val { font-size: 18px; }
  .dropdown-menu { font-size: 14px; }
  .filtros { gap: 8px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile-valor { font-size: 20px; }
  .tarefa { grid-template-columns: 30px 1fr; }
  .tarefa-lado { grid-column: 2; text-align: left; }
  .tarefa-num { width: 30px; height: 30px; }
}
@media (max-width: 420px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 10px; }
  .tile-valor { font-size: 18px; }
  .comp { flex-direction: column; gap: 0; }
  .bomdia-grade { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filtro-datas input { width: 130px; }
}

/* ---------------- impressao ---------------- */
@media print {
  .lateral, .barra-topo, .rodape, .fundo-menu, .x-ferramentas, .nao-imprimir { display: none !important; }
  .principal { margin: 0; }
  body, .x-painel, .tile { background: #fff !important; color: #000 !important; box-shadow: none; }
  .tabela-limite { max-height: none; overflow: visible; }
  .x-painel { break-inside: avoid; }
}

/* Usuarios do painel: grade de modulos x nivel de acesso */
.us-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 6px 14px; }
.us-mod { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; margin: 0; }
.us-mod span { flex: 1; min-width: 0; }
.us-mod select { width: 130px; flex: none; }

/* Controladoria (titulos de fornecedor) */
.ct-filtros .form-select, .ct-filtros .form-control { min-width: 0; }
.ct-filtros input[type=date] { width: 140px; }
.btn-link-ct { background: none; border: 0; padding: 0; color: var(--primaria); text-align: left; font: inherit; cursor: pointer; }
.btn-link-ct:hover { text-decoration: underline; }
.btn-chip { background: none; border: 0; padding: 0 0 0 4px; color: inherit; font-weight: 700; line-height: 1; cursor: pointer; }
.ct-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; margin-bottom: 10px; border-radius: 6px; background: var(--superficie-2); border: 1px solid var(--borda); font-size: 13px; position: sticky; top: 0; z-index: 2; }
.ct-tab td { vertical-align: top; }
.ct-tab tbody tr:hover { background: var(--superficie-2); }
.ct-pontos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.ct-ponto { background: var(--superficie); border: 1px solid var(--borda); border-left: 4px solid var(--s1); border-radius: 6px; padding: 12px; box-shadow: var(--sombra); }
.ct-ponto.ruim { border-left-color: var(--ruim); }
.ct-ponto.alerta { border-left-color: var(--s4); }
.ct-ponto.zerado { border-left-color: var(--bom); opacity: .75; }
.ct-ponto-n { font-size: 20px; font-weight: 700; color: var(--texto); }
.ct-ponto-v { font-size: 15px; font-weight: 600; color: var(--texto); margin-top: 2px; }
.ct-ponto-t { font-size: 12px; color: var(--texto-2); margin-top: 6px; }
.ct-modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2500; display: flex; align-items: flex-start; justify-content: center; padding: 32px 16px; overflow-y: auto; }
.ct-modal { background: var(--superficie); color: var(--texto); border-radius: 8px; width: min(920px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.35); display: flex; flex-direction: column; max-height: calc(100vh - 64px); }
.ct-modal-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--borda); }
.ct-modal-topo h3 { font-size: 17px; margin: 0; }
.ct-x { background: none; border: 0; color: var(--texto-2); font-size: 20px; line-height: 1; padding: 4px 8px; }
.ct-modal-corpo { padding: 14px 18px; overflow-y: auto; }
.ct-modal-pe { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--borda); }
.ct-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 10px 16px; }
.ct-info > div { display: flex; flex-direction: column; font-size: 13px; }
.ct-info span { color: var(--texto-3); font-size: 11px; text-transform: uppercase; letter-spacing: .02em; }
.ct-h4 { font-size: 14px; font-weight: 600; margin: 18px 0 8px; }
.ct-hist { list-style: none; padding: 0; margin: 0; }
.ct-hist li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--borda); font-size: 13px; }
.ct-hist li > i { color: var(--texto-3); margin-top: 3px; width: 16px; text-align: center; }
@media (max-width: 600px) { .ct-modal-fundo { padding: 0; } .ct-modal { border-radius: 0; max-height: 100vh; min-height: 100vh; } .ct-filtros input[type=date] { width: 120px; } }
.ct-tab .chip { white-space: nowrap; }
.ct-tab td:nth-child(3), .ct-tab th:nth-child(3) { min-width: 210px; }
.ct-tab td:nth-child(4) { white-space: nowrap; }
