/*
 * Camada própria sobre o tema compilado do Opimob (Tailwind 4, sem fonte para recompilar).
 * Tudo o que o CSS do tema não traz fica aqui, com as variáveis do próprio tema.
 */

/* ---------------------------------------------------------------- tipografia numérica */
.num, .n { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- tooltip único (dicas e textos cortados) */
.tip {
  position: fixed; z-index: 99999; left: 0; top: 0; max-width: 20rem; width: max-content;
  padding: .5rem .7rem; border-radius: .5rem; background: var(--color-gray-900, #101828); color: #fff;
  font-size: 12px; line-height: 1.45; font-weight: 400; text-align: left; white-space: pre-line;
  overflow-wrap: anywhere; box-shadow: 0 8px 24px rgba(16, 24, 40, .22);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .12s ease;
}
.tip.on { opacity: 1; visibility: visible; }
.tip b { font-weight: 600; }
.dica {
  display: inline-flex; align-items: center; justify-content: center; width: 1rem; height: 1rem; margin-inline-start: .3rem;
  border-radius: 9999px; background: var(--color-gray-100, #f3f4f6); color: var(--color-gray-500, #6b7280);
  font-size: 10px; line-height: 1; cursor: help; vertical-align: middle; flex: none;
}
.dica:hover, .dica:focus-visible { background: var(--color-primary-100, #ede6ff); color: var(--color-primary, #7a13f0); outline: none; }

/* ---------------------------------------------------------------- tabelas */
.tbl-wrap { width: 100%; overflow: hidden; }
.tbl { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; line-height: 1.35; }
.tbl thead th {
  padding: .6rem .7rem; background: var(--color-gray-50, #f9fafb); color: var(--color-gray-600, #4b5563);
  font-weight: 600; font-size: 12px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 1px solid var(--color-border-color, #e5e7eb);
}
.tbl tbody td, .tbl tfoot td {
  padding: .55rem .7rem; vertical-align: middle; border-bottom: 1px solid var(--color-border-color, #e5e7eb); overflow: hidden;
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--color-gray-50, #f9fafb); }
.tbl tfoot td { background: var(--color-gray-50, #f9fafb); font-weight: 600; border-top: 1px solid var(--color-border-color, #e5e7eb); border-bottom: 0; }
.tbl .n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c, .tbl th.c { text-align: center; }
.tbl .sub { color: var(--color-gray-500, #6b7280); font-size: 11.5px; }
.tbl .mudo { color: var(--color-gray-400, #9ca3af); }
.tbl tr.off td { opacity: .55; }
.tbl tr.destaque td { background: var(--color-primary-50, #f5f1ff); }
.tbl .grupo th { text-align: center; border-bottom: 1px solid var(--color-border-color, #e5e7eb); background: #fff; }
.tbl .linha-detalhe > td { white-space: normal; text-wrap: wrap; background: var(--color-gray-50, #f9fafb); padding: .9rem 1rem; }
.tbl-compacta { font-size: 12.5px; }
.tbl-compacta thead th { padding: .5rem .5rem; }
.tbl-compacta tbody td, .tbl-compacta tfoot td { padding: .45rem .5rem; }

/* texto cortado com reticências; o tooltip mostra o texto inteiro (app.js) */
.cel { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cel2 { white-space: normal; text-wrap: wrap; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; min-width: 0; }

/* campos dentro de tabelas */
.tbl .form-input, .tbl .form-select { height: 2rem; padding-top: 0; padding-bottom: 0; font-size: 12.5px; min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
.tbl .form-input { padding-inline: .5rem; }
.tbl .form-select { padding-inline: .5rem 1.6rem; text-overflow: ellipsis; background-position: right .4rem center; }
.tbl .form-checkbox { width: 1rem; height: 1rem; }

/* ---------------------------------------------------------------- paginação */
.pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding: .7rem 1rem; border-top: 1px solid var(--color-border-color, #e5e7eb); font-size: 12.5px; color: var(--color-gray-600, #4b5563); }
.pager-ctl { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.pager .pg {
  min-width: 2rem; height: 2rem; padding: 0 .5rem; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border-color, #e5e7eb); border-radius: .5rem; background: #fff; color: var(--color-gray-700, #364153);
  font-size: 12.5px; cursor: pointer; transition: background .12s, border-color .12s, color .12s;
}
.pager .pg:hover:not(:disabled):not(.atual) { background: var(--color-primary-50, #f5f1ff); border-color: var(--color-primary-200, #ded1ff); color: var(--color-primary, #7a13f0); }
.pager .pg.atual { background: var(--color-primary, #7a13f0); border-color: var(--color-primary, #7a13f0); color: #fff; cursor: default; }
.pager .pg:disabled { opacity: .45; cursor: not-allowed; }
.pager .pg-gap { padding: 0 .25rem; color: var(--color-gray-400, #9ca3af); }
.pager select { height: 2rem; padding: 0 1.6rem 0 .6rem; font-size: 12.5px; border-radius: .5rem; }
[data-frag].carregando { opacity: .55; transition: opacity .12s; pointer-events: none; }

/* ---------------------------------------------------------------- cartões de indicadores */
.kpi { background: #fff; border: 1px solid var(--color-border-color, #e5e7eb); border-radius: .75rem; padding: 1rem 1.1rem; min-width: 0; }
.kpi .kpi-rotulo { font-size: 12px; color: var(--color-gray-500, #6b7280); margin: 0 0 .25rem; }
.kpi .kpi-valor { font-size: 1.25rem; font-weight: 600; color: var(--color-dark, #101828); margin: 0; line-height: 1.2; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi .kpi-nota { font-size: 12px; color: var(--color-gray-500, #6b7280); margin: .35rem 0 0; }
.kpi.menor { box-shadow: 0 0 0 2px var(--color-success, #16a34a) inset; }
.kpi .kpi-topo { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 1.5rem; margin-bottom: .35rem; }
.kpi .kpi-nome { font-weight: 600; font-size: 14px; margin: 0; }
.kpi .kpi-sub { font-size: 11.5px; color: var(--color-gray-500, #6b7280); margin: -.25rem 0 .5rem; }

/* ---------------------------------------------------------------- abas */
.abas { display: flex; gap: .25rem; border-bottom: 1px solid var(--color-border-color, #e5e7eb); margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.abas::-webkit-scrollbar { display: none; }
.abas a { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem .72rem; font-size: 13.5px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--color-gray-600, #4b5563); }
.abas a:hover { color: var(--color-primary, #7a13f0); }
.abas a.on { color: var(--color-primary, #7a13f0); border-bottom-color: var(--color-primary, #7a13f0); font-weight: 500; }
.abas i { font-size: 1rem; }
.seg { display: inline-flex; padding: .2rem; border-radius: .6rem; background: var(--color-gray-100, #f3f4f6); gap: .15rem; }
.seg button { padding: .3rem .8rem; font-size: 12.5px; border-radius: .45rem; color: var(--color-gray-600, #4b5563); background: transparent; border: 0; cursor: pointer; }
.seg button.on { background: #fff; color: var(--color-primary, #7a13f0); font-weight: 500; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }

/* ---------------------------------------------------------------- envio de arquivo */
.dropzone { border: 1.5px dashed var(--color-gray-300, #d1d5db); border-radius: .75rem; padding: 1rem 1.25rem; display: flex; align-items: center; gap: 1rem; transition: background .15s, border-color .15s; background: var(--color-gray-50, #f9fafb); }
.dropzone.arrasta { background: var(--color-primary-50, #f5f1ff); border-color: var(--color-primary, #7a13f0); }
.dropzone .dz-icone { font-size: 1.75rem; color: var(--color-primary, #7a13f0); flex: none; }
.dropzone .dz-texto { flex: 1; min-width: 0; font-size: 13px; color: var(--color-gray-600, #4b5563); }
.dropzone .dz-texto strong { display: block; color: var(--color-dark, #101828); font-weight: 500; }
.btn-arquivo { position: relative; overflow: hidden; cursor: pointer; }
.btn-arquivo input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* ---------------------------------------------------------------- campos */
.campo-mes { width: 100%; text-align: center; }
.sugestoes { position: absolute; z-index: 40; left: 0; right: 0; top: 100%; margin-top: .25rem; background: #fff; border: 1px solid var(--color-border-color, #e5e7eb); border-radius: .5rem; max-height: 15rem; overflow-y: auto; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); }
.sugestoes div { padding: .45rem .7rem; cursor: pointer; font-size: 12.5px; }
.sugestoes div:hover, .sugestoes div.on { background: var(--color-primary-50, #f5f1ff); }
.rel { position: relative; }

/* ---------------------------------------------------------------- cores dos regimes */
.cor-lr { color: #4f46e5; } .cor-lp { color: #0891b2; } .cor-ret { color: #d97706; } .cor-reth { color: #16a34a; }
.is-oculto { display: none !important; }
.chart-box { min-height: 340px; }

/* ---------------------------------------------------------------- modo inspecionar (superadmin) */
body.inspecionando [data-insp] { cursor: help; outline: 1px dashed var(--color-primary-400, #aa7dff); outline-offset: 2px; border-radius: 4px; }
body.inspecionando [data-insp]:hover { outline-style: solid; background: var(--color-primary-50, #f5f1ff); }
.insp-barra { display: none; }
body.inspecionando .insp-barra { display: flex; }
.insp-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(30rem, 100vw); z-index: 9000; background: #fff; border-left: 1px solid var(--color-border-color, #e5e7eb); box-shadow: -12px 0 32px rgba(16, 24, 40, .12); transform: translateX(105%); transition: transform .2s ease; display: flex; flex-direction: column; }
.insp-drawer.on { transform: none; }
.insp-drawer header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border-color, #e5e7eb); display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.insp-drawer .insp-corpo { padding: 1rem 1.25rem 2rem; overflow-y: auto; flex: 1; font-size: 13px; }
.insp-drawer table { width: 100%; border-collapse: collapse; margin-top: .5rem; }
.insp-drawer td { padding: .5rem .25rem; border-bottom: 1px solid var(--color-border-color, #e5e7eb); vertical-align: top; white-space: normal; text-wrap: wrap; overflow-wrap: anywhere; }
.insp-drawer td.v { text-align: right; white-space: nowrap; text-wrap: nowrap; overflow-wrap: normal; width: 1%; font-variant-numeric: tabular-nums; font-weight: 500; }
.insp-drawer td .conta { display: block; color: var(--color-gray-500, #6b7280); font-size: 12px; margin-top: .15rem; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.insp-drawer tr.res td { border-bottom: 0; border-top: 2px solid var(--color-dark, #101828); font-weight: 600; padding-top: .7rem; }
.insp-drawer .nota { margin-top: 1rem; padding: .7rem .85rem; border-radius: .5rem; background: var(--color-gray-50, #f9fafb); color: var(--color-gray-600, #4b5563); font-size: 12px; }
.insp-fundo { position: fixed; inset: 0; z-index: 8999; background: rgba(16, 24, 40, .25); opacity: 0; visibility: hidden; transition: opacity .2s; }
.insp-fundo.on { opacity: 1; visibility: visible; }

/* ---------------------------------------------------------------- detalhes */
details.cartao > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; font-weight: 600; color: var(--color-dark, #101828); }
details.cartao > summary::-webkit-details-marker { display: none; }
details.cartao > summary::after { content: '\002B'; font-size: 1.25rem; color: var(--color-gray-500, #6b7280); }
details.cartao[open] > summary::after { content: '\2212'; }
.btn-icone { width: 1.9rem; height: 1.9rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .5rem; border: 1px solid var(--color-border-color, #e5e7eb); background: #fff; color: var(--color-gray-600, #4b5563); cursor: pointer; font-size: 1rem; padding: 0; }
.btn-icone:hover { background: var(--color-primary-50, #f5f1ff); border-color: var(--color-primary-200, #ded1ff); color: var(--color-primary, #7a13f0); }
.btn-icone.perigo:hover { background: var(--color-danger-50, #fef2f2); border-color: var(--color-danger, #e7000b); color: var(--color-danger, #e7000b); }
.btn-icone[aria-expanded=true] i { transform: rotate(180deg); }
nav ul, nav li { list-style: none; margin: 0; padding: 0; }

/* telas pequenas: tabelas podem rolar, o layout do notebook segue sem rolagem */
@media (max-width: 900px) {
  .tbl-wrap { overflow-x: auto; }
  .tbl { min-width: 760px; }
}

/* ---------------------------------------------------------------- ordenação por coluna */
.tbl th.ord { cursor: pointer; user-select: none; }
.tbl th.ord:hover { color: var(--color-primary, #7a13f0); background: var(--color-primary-50, #f5f1ff); }
.tbl th.ord .ord-in { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.tbl th.ord.n .ord-in { justify-content: flex-end; }
.tbl th.ord.c .ord-in { justify-content: center; }
.tbl th.ord .ord-seta { font-size: .8rem; opacity: .35; flex: none; }
.tbl th.ord:hover .ord-seta { opacity: .8; }
.tbl th.ord-on { color: var(--color-primary, #7a13f0); }
.tbl th.ord-on .ord-seta { opacity: 1; }
