/* =====================================================================
   Painel Regenerar · camada Bio-Industrial (20/11/2026)
   Carregada depois de styles.css, cliente.css e efeitos.css.
   Estrutura escura no verde-petróleo da marca, fundo areia, status terrosos,
   barra lateral de setores, KPIs que filtram, busca com etiquetas e prévia de anexos.
   ===================================================================== */

/* ---------- topo escuro ---------- */
.topo {
  background: linear-gradient(100deg, var(--estrutura), var(--estrutura-2));
  border-color: rgba(255, 255, 255, .06); color: #fff;
  box-shadow: 0 10px 30px -14px rgba(8, 42, 38, .55);
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.topo .marca { color: #fff; font-weight: 700; letter-spacing: -.01em; }
.topo .marca small { color: var(--ciano); font-weight: 700; }
.topo .usuario { color: rgba(255, 255, 255, .72); }
.topo .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #fff; box-shadow: none; }
.topo .btn:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); }

/* ---------- corpo do administrador: barra lateral + conteúdo ---------- */
.admin-corpo { display: grid; grid-template-columns: 236px minmax(0, 1fr); align-items: start; padding: 0 16px; transition: grid-template-columns .35s var(--saida, ease); }
.admin-corpo.recolhido { grid-template-columns: 74px minmax(0, 1fr); }
.admin-corpo > main { max-width: none; margin: 0; min-width: 0; padding: 22px 0 48px 22px; }

.menu-setores {
  position: sticky; top: 100px; margin-top: 18px; height: calc(100vh - 118px);
  display: flex; flex-direction: column; gap: 4px; padding: 10px;
  background: linear-gradient(180deg, var(--estrutura), var(--estrutura-2));
  border-radius: 22px; color: #CFE0D9; box-shadow: 0 18px 40px -20px rgba(8, 42, 38, .6);
  overflow: hidden;
}
.menu-recolher { align-self: flex-end; display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 6px; border: 0; border-radius: 10px; background: transparent; color: rgba(255, 255, 255, .6); }
.menu-recolher:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.setor-item {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px;
  padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; color: inherit;
  font-weight: 600; font-size: 14.5px; text-align: left; white-space: nowrap; transition: background .2s, color .2s;
}
.setor-item svg { flex: none; }
.setor-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.setor-item[aria-pressed="true"] { background: rgba(255, 255, 255, .13); color: #fff; }
.setor-item[aria-pressed="true"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--ciano); box-shadow: 0 0 10px rgba(2, 221, 233, .6); }
.setor-n { margin-left: auto; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: rgba(255, 255, 255, .1); }
.recolhido .menu-recolher { align-self: center; }
.recolhido .setor-item { justify-content: center; padding: 10px 0; }
.recolhido .setor-nome, .recolhido .setor-n { display: none; }

/* ---------- KPIs como filtro ---------- */
.kpi { font: inherit; color: var(--texto); text-align: left; width: 100%; cursor: pointer; transition: transform .3s var(--mola, ease), box-shadow .3s, opacity .25s; }
.kpi:hover { transform: translateY(-3px); }
.kpi:active { transform: translateY(-1px) scale(.99); }
.kpi[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--c-mark), inset 0 1px 0 var(--vidro-luz, transparent), var(--sombra-2, none); }
.resumo.com-filtro .kpi[aria-pressed="false"] { opacity: .55; }
.resumo.com-filtro .kpi[aria-pressed="false"]:hover { opacity: .9; }
.kpi.d60 { --c-mark: var(--d60-mark); --c-glow: var(--d60-glow); }
.kpi.d60 .n { color: var(--d60); }
.kpi .t { font-weight: 600; }

/* ---------- barra de ferramentas: busca com etiquetas + Por cliente/Matriz ---------- */
.barra-ferramentas { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.busca-bloco { flex: 1; min-width: 280px; max-width: 820px; }
.busca-global {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 48px; padding: 6px 12px;
  border: 1px solid var(--linha); border-radius: 14px; background: var(--vidro, var(--branco)); color: var(--suave); cursor: text;
  box-shadow: var(--sombra-1, none); transition: border-color .2s, box-shadow .2s;
}
.busca-global:focus-within { border-color: var(--verde); box-shadow: 0 0 0 3px color-mix(in srgb, var(--verde) 16%, transparent); }
.busca-global input { flex: 1; min-width: 180px; border: 0; outline: 0; background: transparent; font: inherit; color: var(--texto); padding: 6px 2px; }
.busca-global input::-webkit-search-cancel-button { display: none; }
.etiqueta { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 11px; border-radius: 99px; background: var(--estrutura); color: #fff; font-size: 13px; font-weight: 600; }
.etiqueta button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; font-size: 10px; }
.etiqueta button:hover { background: rgba(255, 255, 255, .3); }
.sugestoes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sugestao { padding: 4px 11px; border: 1px dashed color-mix(in srgb, var(--suave) 45%, transparent); border-radius: 99px; background: transparent; color: var(--suave); font-size: 12.5px; font-weight: 600; transition: color .15s, border-color .15s, background .15s; }
.sugestao:hover { color: var(--verde); border-color: var(--verde); background: var(--verde-claro); }
.alternar-visao button[aria-pressed="true"] { background: var(--estrutura); }
.contador-filtro { margin: 8px 0 12px; font-size: 13px; color: var(--suave); }
.limpar-filtros { min-height: 0; padding: 0 4px; font-size: 13px; }

/* ---------- matriz: hover nas linhas, células fora do filtro apagadas, clipe de anexos ---------- */
.matriz tbody td { transition: background .18s; }
.matriz tbody tr:hover td { background: color-mix(in srgb, var(--verde) 4%, transparent); }
.matriz tbody tr:hover td.cliente { background: color-mix(in srgb, var(--verde) 7%, var(--branco)); }
.matriz td.apagada > * { opacity: .26; filter: saturate(.3); transition: opacity .2s; }
.matriz td.apagada:hover > * { opacity: .7; }
.celula-caixa, .jc-cartao { position: relative; }
.jc-cartao { display: flex; }
.jc-cartao > .jc-doc { width: 100%; }
.celula-caixa .celula > .doc:first-child, .jc-cartao .jc-coluna { padding-right: 46px; }
.clipe {
  position: absolute; top: 7px; right: 7px; z-index: 1; display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 8px; border: 1px solid var(--linha); border-radius: 99px; background: var(--branco); color: var(--suave);
  font-size: 11.5px; font-weight: 700; line-height: 1; transition: color .15s, border-color .15s, transform .2s;
}
.clipe:hover, .clipe:focus-visible { color: var(--verde); border-color: var(--verde); transform: translateY(-1px); }

/* ---------- selos com ícone: check (em dia/cumprida), alerta (atenção), X (vencida) ---------- */
.selo::before { content: ""; flex: none; width: 11px; height: 11px; background: currentColor; -webkit-mask: var(--ic) center / contain no-repeat; mask: var(--ic) center / contain no-repeat; }
.selo.emdia, .selo.cumprida { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5l5 5L19.5 7'/%3E%3C/svg%3E"); }
.selo.atencao { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5L2.5 20h19z'/%3E%3Cpath d='M12 10v4.5M12 17.5v.1'/%3E%3C/svg%3E"); }
.selo.vencida { --ic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }

/* ---------- prévia de anexos (ao passar o mouse no clipe) e visualizador ---------- */
#previa {
  position: fixed; z-index: 40; width: min(370px, calc(100vw - 16px)); max-height: 60vh; overflow-y: auto; padding: 8px;
  background: var(--branco); border: 1px solid var(--linha); border-radius: 16px; box-shadow: var(--sombra-3, 0 20px 50px rgba(0, 0, 0, .25));
  animation: fx-modal .22s var(--saida, ease) both;
}
.previa-titulo { padding: 4px 8px 6px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--suave); }
.previa-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: transparent; color: var(--texto); text-align: left; }
.previa-item:hover, .previa-item:focus-visible { background: var(--suave-bg, var(--fundo)); }
.previa-item b { display: block; font-size: 13.5px; word-break: break-word; }
.previa-item small { display: block; font-size: 12px; color: var(--suave); margin-top: 2px; }
.previa-ext { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: var(--estrutura); color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; }
.visualizador { display: block; width: 100%; height: min(72vh, 900px); border: 1px solid var(--linha); border-radius: 12px; background: #fff; }
img.visualizador { height: auto; max-height: 72vh; object-fit: contain; }

/* ---------- linha do cliente: setor ---------- */
.lc-setor { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 3px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--verde); }

/* ---------- celular e tablet ---------- */
@media (max-width: 900px) {
  .admin-corpo, .admin-corpo.recolhido { grid-template-columns: minmax(0, 1fr); padding: 0; }
  .admin-corpo > main { padding: 14px 16px 40px; }
  .menu-setores { position: static; height: auto; flex-direction: row; margin: 12px 8px 0; padding: 6px; border-radius: 16px; overflow-x: auto; }
  .menu-recolher { display: none; }
  .setor-item, .recolhido .setor-item { flex: none; width: auto; min-height: 40px; padding: 8px 12px; justify-content: flex-start; }
  .recolhido .setor-nome, .recolhido .setor-n { display: inline; }
  .setor-item[aria-pressed="true"]::before { left: 10px; right: 10px; top: auto; bottom: 2px; width: auto; height: 3px; }
  .busca-bloco { min-width: 0; max-width: none; flex-basis: 100%; }
  .menu-setores { scrollbar-width: none; }
  .menu-setores::-webkit-scrollbar { display: none; }
}
@media (max-width: 600px) {
  .topo .usuario { display: none; }
}

/* ---------- financeiro (só o dono) ---------- */
.menu-divisor { display: block; height: 1px; margin: 10px 12px; background: rgba(255, 255, 255, .12); }
.setor-cadeado { margin-left: auto; display: inline-flex; opacity: .55; }
.recolhido .setor-cadeado, .recolhido .menu-divisor { display: none; }
.financeiro .cabecalho-pagina p svg { vertical-align: -2px; }
.selo.aberto { color: var(--suave); background: color-mix(in srgb, var(--suave) 12%, transparent); }
.selo.aberto::before { display: none; }
.btn.perigo { color: var(--vencida); }
.btn.perigo:not(.fantasma) { border-color: color-mix(in srgb, var(--vencida) 40%, transparent); }
.kpi.fin .n { font-size: clamp(22px, 2.3vw, 30px); letter-spacing: -.02em; white-space: nowrap; }
.kpi.fin .sub { margin-top: 4px; font-size: 12px; color: var(--suave); }
div.kpi.fin { cursor: default; }
.fin-mes { display: flex; align-items: center; gap: 6px; margin: 4px 0 14px; }
.fin-mes b { font-size: 18px; min-width: 190px; text-align: center; }
.fin-mes .btn { min-height: 34px; padding: 4px 12px; font-size: 18px; }
.fin-mes #fin-mes-hoje { font-size: 13px; }
.fin-filtros { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.grupo-filtro { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.etiqueta-filtro { font: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linha); background: var(--branco); color: var(--suave); cursor: pointer; transition: background .15s, color .15s; }
.etiqueta-filtro:hover { color: var(--texto); }
.etiqueta-filtro[aria-pressed="true"] { background: var(--estrutura); border-color: var(--estrutura); color: #fff; }
.fin-lista { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.fin-linha { display: grid; grid-template-columns: 104px minmax(0, 1fr) 150px 190px auto; gap: 14px; align-items: center; padding: 12px 16px; background: var(--branco); border: 1px solid var(--linha); border-left: 4px solid var(--emdia); border-radius: 14px; transition: box-shadow .18s, transform .18s; }
.fin-linha.pagar { border-left-color: var(--d60); }
.fin-linha:hover { box-shadow: 0 6px 18px -10px rgba(0, 0, 0, .25); transform: translateY(-1px); }
.fin-linha.pago { opacity: .72; }
.fin-data b { display: block; font-variant-numeric: tabular-nums; }
.fin-data small, .fin-desc small { display: block; font-size: 12px; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-desc b { font-weight: 700; }
.fin-parc { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--verde) 10%, transparent); color: var(--verde); }
.fin-valor { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; color: var(--emdia); white-space: nowrap; }
.pagar .fin-valor { color: var(--vencida); }
.fin-acoes { display: flex; gap: 4px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.fin-acoes .btn { min-height: 34px; padding: 5px 10px; font-size: 13px; }
.fin-totais { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px 24px; margin: 14px 4px 30px; font-size: 14px; color: var(--suave); }
.fin-totais b { margin-left: 6px; font-size: 16px; font-variant-numeric: tabular-nums; }
.fin-totais .pos { color: var(--emdia); } .fin-totais .neg { color: var(--vencida); }
.fin-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.fin-form .larga { grid-column: 1 / -1; }
.fin-form textarea { border: 1px solid var(--linha); border-radius: 8px; padding: 10px 12px; font: inherit; resize: vertical; }
.fin-form label:has(input[type="checkbox"]) { display: flex; align-items: center; gap: 6px; }
.fin-form label input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; accent-color: var(--verde); }
@media (max-width: 1100px) {
  .fin-linha { grid-template-columns: 96px minmax(0, 1fr) auto; }
  .fin-sit { grid-column: 2; }
  .fin-acoes { grid-column: 2 / -1; justify-content: flex-start; }
}
@media (max-width: 600px) {
  .fin-linha { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .fin-data { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; }
  .fin-sit, .fin-acoes { grid-column: 1 / -1; }
  .fin-form { grid-template-columns: 1fr; }
  .fin-mes b { min-width: 0; flex: 1; }
}
