/* =============================================
    DATATABLE — CSS DA LISTAGEM (padrão JPWeb — front)
    CLÁUSULA PÉTREA: este arquivo é O PADRÃO de todas as
    listagens (emendas, licitações, trans, concursos,
    engenharia...). Proibido estilo de tabela/modal por
    página — qualquer ajuste entra AQUI e vale para todas.
    Barra geral-filtros + tabela + scroll + paginação/footer
    + badges + botões de ação da linha
    Comportamento de colunas/scroll preservado:
    table-layout:fixed + width:100% + min-width:max-content + .table-scrollable
 ============================================= */


/* ---- geral-filtros (mesmo padrão do adm) ---- */
.geral-filtros          {display:flex; align-items:center; justify-content:space-between; gap:8px; flex-wrap:wrap; margin-bottom:5px; box-sizing:border-box; color:#000; }
.filtros-left,
.filtros-right          {display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.filtros-select         {padding:0 8px; border:1px solid #ced4da; border-radius:4px; font-size:13px; color:#333; background:#fff; cursor:pointer; box-sizing:border-box; height:32px; }
.filtros-search-wrap    {position:relative; flex:1; display:flex; align-items:center; }
.filtros-search-wrap input {padding:0 10px 0 35px; border:1px solid #ced4da; border-radius:4px; outline:none; background:#fff; font-size:13px; color:#333; width:100%; box-sizing:border-box; height:32px; }
.filtros-search-wrap input::placeholder { color:#999; }
.filtros-search-wrap i  {color:#888; font-size:13px; }
.filtros-search-wrap .fa-search {position:absolute; left:12px; top:50%; transform:translateY(-50%); z-index:9; }
.filtros-btn            {display:flex; align-items:center; gap:5px; padding:0 10px; border:1px solid #ced4da; border-radius:4px; font-size:12px; color:#333; background:#fff; cursor:pointer; white-space:nowrap; transition:background .15s, border-color .15s; box-sizing:border-box; height:32px; }
.filtros-btn:hover      {background:#f0f0f0; border-color:#999; }
.filtros-btn i          {font-size:13px; width:14px; text-align:center; flex:none; }
@media (max-width: 768px) {
  .filtros-search-wrap  {min-width:140px; }
  .filtros-btn          {font-size:11px; height:28px; }
  .filtros-select       {font-size:12px; height:28px; }
  .filtros-search-wrap input {font-size:12px; padding:0 10px 0 32px; height:28px; }  }

/* ---- Tabela (tema visual, comportamento é do DataTables) ---- */
/* app-table-wrap é só a moldura (borda/raio) de fora.
   O scroll horizontal fica isolado em .table-scrollable (só a <table>),
   assim dt-footer (info/paginação) fica sempre 100% de largura,
   fora da área que rola. */
.app-table-wrap         { border-radius:6px; border:1px solid #dee2e6; }
.table-scrollable       { overflow-x:auto; scrollbar-width:thin; scrollbar-color:#c8cdd5 #f2f4f6; }
.table-scrollable::-webkit-scrollbar { height:12px; }
.table-scrollable::-webkit-scrollbar-track { background:#f2f4f6; border-radius:10px; }
.table-scrollable::-webkit-scrollbar-thumb { background:#c8cdd5; border-radius:10px; }
.table-scrollable::-webkit-scrollbar-thumb:hover { background:#aab1ba; }
.app-table              { border-collapse:collapse; font-size:13px; background:#fff; table-layout:fixed; width:100%; min-width:max-content; font-family:'Lato', sans-serif; box-sizing:border-box; }
.app-table thead tr     { background:#1a6eb5; color:#fff; }
.app-table thead th     { padding:15px 26px 15px 12px; text-align:left; font-weight:600; white-space:nowrap; border:none !important; border-bottom:2px solid #155a94 !important; overflow:hidden; text-overflow:ellipsis; box-sizing:border-box !important; background-position:center right; }
.app-table tbody tr     { border-bottom:1px solid #e9ecef; transition:background 0.15s; }
.app-table tbody tr:nth-child(even) { background:#f8f9fa; }
.app-table tbody tr:hover { background:#e8f0fb; }
.app-table tbody td     { padding:10px 12px !important; text-align:left; white-space:nowrap; vertical-align:middle; color:#333; border:none !important; overflow:hidden; text-overflow:ellipsis; box-sizing:border-box !important; }
.app-table .td-objeto   { max-width:260px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-table .td-trunc    { max-width:200px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-table .td-maisinfo { max-width:240px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-table td.tem-mais  { cursor:pointer; }
.app-table td .app-ico-mais { display:none; color:#0d6efd; font-size:14px; margin-right:7px; line-height:1; }
.app-table td.tem-mais .app-ico-mais { display:inline-block; vertical-align:middle; transform:translateY(-3px); }
.app-table .td-valor    { white-space:nowrap; }
.app-acoes              { display:flex; align-items:center; gap:8px; white-space:nowrap; }

/* ---- Botão padrão de ação em linha (ex: "Detalhes") ---- */
.app-btn-detalhes       { background:#1a6eb5; color:#fff; border:none; padding:6px 14px; border-radius:4px; cursor:pointer; font-size:12px; font-weight:600; white-space:nowrap; }
.app-btn-detalhes:hover { background:#155a94; }

/* =========================================================
   GENÉRICO — aplica a QUALQUER table.dataTable no front
   ========================================================= */
div.dataTables_wrapper div.dataTables_info { color:#555 !important; }
.dt-footer              { display:flex !important; align-items:center !important; justify-content:space-between !important; padding:10px 16px !important; flex-wrap:wrap !important; gap:10px !important; }
.dt-left, .dt-right     { display:flex !important; align-items:center !important; gap:10px !important; flex-wrap:wrap !important; }
div.dt-buttons              { display:none !important; }
.pagination                 { display:flex !important; flex-wrap:wrap !important; gap:2px !important; padding-left:0 !important; list-style:none !important; margin:0 !important; }
.pagination > li > a,
.pagination > li > span     { background:#fff !important; border:1px solid #ced4da !important; color:#1a6eb5 !important; padding:6px 12px !important; display:block !important; font-size:13px !important; text-decoration:none !important; border-radius:4px !important; }
.pagination > li > a:hover  { background:#e8f0fb !important; color:#155a94 !important; }
.pagination > .active > a   { background:#1a6eb5 !important; border-color:#1a6eb5 !important; color:#fff !important; }
.pagination > .active > a:hover { background:#155a94 !important; }
.pagination > .disabled > a,
.pagination > .disabled > a:hover { background:#f8f9fa !important; color:#aaa !important; cursor:default !important; }
table.dataTable         { table-layout:fixed !important; width:100% !important; min-width:max-content !important; box-sizing:border-box !important; }
/* Mata a linha de medição clonada que o DataTables insere no thead durante o init */
table.dataTable > thead > tr[style*="height: 0"] { display:none !important; }
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc { background-position:center right; }

/* ---- Badges da listagem ---- */
.badge-nivel            { display:inline-block; width:90px; padding:6px 10px; border-radius:10px; font-size:12px; font-weight:700; white-space:nowrap; text-transform:uppercase; background:#6c757d; color:#fff; text-align:center; box-sizing:border-box; }
.badge-nivel.federal    { background:#0d6efd; }
.badge-nivel.estadual   { background:#6f42c1; }
.badge-nivel.municipal  { background:#fd7e14; }
.badge-status           { display:inline-block; flex:0 0 110px; width:110px; padding:6px 10px; border-radius:10px; font-size:12px; font-weight:700; background:#6c757d; color:#fff; white-space:nowrap; text-transform:uppercase; text-align:center; box-sizing:border-box; }
.badge-status.recebido  { background:#198754; }
.badge-status.pendente  { background:#dc3545; }
.badge-status.parcial   { background:#fd7e14; }

/* ---- Badges (Licitações / Trans) ---- */
.badge-status.aberto      { background:#28a745; }
.badge-status.encerrado   { background:#dc3545; }
.badge-status.suspenso    { background:#ffc107; color:#333; }
.badge-status.homologado  { background:#1a6eb5; }
.badge-cat                { display:inline-block; flex:0 0 130px; width:130px; padding:6px 10px; border-radius:10px; font-size:12px; font-weight:600; white-space:nowrap; background:#6c757d; color:#fff; text-transform:uppercase; text-align:center; box-sizing:border-box; }
.badge-cat.licitacao      { background:#0d6efd; }
.badge-cat.contrato       { background:#6f42c1; }
.badge-cat.convenio       { background:#fd7e14; }
.badge-cat.dispensa       { background:#20c997; }
.badge-cat.inexigibilidade{ background:#0dcaf0; color:#333; }
.badge-cat.penalidade     { background:#dc3545; }

/* =========================================================
   GENÉRICO DOS APPS TRANS — compartilhado por todas as listas
   (emendas, licitacoes, trans, etc.) — antes inline no list.php
   ========================================================= */

/* ---- Reset do wrapper ---- */
.app-wrap * { box-sizing:border-box; }

/* ---- Loading (preloader da lista — usar com .app-table-wrap display:none) ---- */
.app-loading        { text-align:center; padding:60px 0; color:#888; }
.app-loading p      { margin:12px 0 0; font-size:13px; }

/* ---- Filtros do topo (barra em 2 linhas) ---- */
.app-filtros            { background:#f8f9fa; border:1px solid #dee2e6; border-radius:6px; padding:16px 20px; margin-bottom:20px; display:flex; flex-direction:column; gap:12px; }
.app-filtros-linha      { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.app-select             { height:36px; padding:5px 10px; border:1px solid #ced4da; border-radius:4px; font-size:13px; color:#333; background:#fff; min-width:200px; }
.app-data-sm            { height:36px; padding:5px 8px; border:1px solid #ced4da; border-radius:4px; font-size:13px; color:#333; background:#fff; width:150px; }
.app-buscar-lg          { height:36px; padding:5px 12px; border:1px solid #ced4da; border-radius:4px; font-size:13px; color:#333; background:#fff; width:220px; }
.app-btn-pesquisar      { background:#1a6eb5; color:#fff; border:none; padding:10px 20px; border-radius:4px; cursor:pointer; font-size:13px; font-weight:600; }
.app-btn-pesquisar:hover{ background:#155a94; }
.app-btn-limpar         { background:#fff; color:#555; border:1px solid #ced4da; padding:8px 20px; border-radius:4px; cursor:pointer; font-size:13px; display:inline-flex; align-items:center; }
.app-btn-limpar:hover   { background:#f0f0f0; }
@media(max-width:700px) { .app-select { min-width:100%; } .app-buscar-lg { width:100%; } }

/* ---- Tooltip customizada (data-tooltip em qualquer elemento) ---- */
.app-tooltip            { position:fixed; z-index:10000; max-width:420px; background:#212529; color:#fff; font-size:12px; line-height:1.5; padding:8px 12px; border-radius:6px; box-shadow:0 4px 14px rgba(0,0,0,0.3); text-transform:none; white-space:pre-line; pointer-events:none; opacity:0; visibility:hidden; transition:opacity 0.15s; }
.app-tooltip.show       { opacity:1; visibility:visible; }

/* ---- Modal genérico de detalhes ---- */
.app-modal-overlay      { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.55); z-index:9999; align-items:center; justify-content:center; }
.app-modal-overlay.active { display:flex; }
.app-modal              { background:#fff; border-radius:8px; width:90%; max-width:1600px; max-height:88vh; overflow:hidden; box-shadow:0 8px 40px rgba(0,0,0,0.22); display:flex; flex-direction:column; scrollbar-width:thin; scrollbar-color:#c8cdd5 #f2f4f6; }
.app-modal::-webkit-scrollbar { width:10px; height:12px; }
.app-modal::-webkit-scrollbar-track { background:#f2f4f6; border-radius:10px; }
.app-modal::-webkit-scrollbar-thumb { background:#c8cdd5; border-radius:10px; }
.app-modal::-webkit-scrollbar-thumb:hover { background:#aab1ba; }
.app-modal-header       { background:#1a6eb5; color:#fff; padding:16px 20px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; border-radius:8px 8px 0 0; }
.app-modal-header h3    { margin:0; font-size:15px; font-weight:700; color:#fff; }
.app-modal-close        { background:transparent; border:2px solid rgba(255,255,255,0.6); color:#fff; border-radius:50%; width:30px; height:30px; font-size:16px; cursor:pointer; display:flex; align-items:center; justify-content:center; }
.app-modal-close:hover  { background:rgba(255,255,255,0.15); }
.app-modal-body         { padding:24px 24px 16px; flex:1; overflow-y:auto; }

.app-modal-body .objeto-texto { background:#f8f9fa; border-left:3px solid #1a6eb5; padding:10px 14px; border-radius:0 4px 4px 0; font-size:13px; color:#333; margin-top:4px; line-height:1.5; }
.app-modal-body .secao-titulo { font-size:13px; font-weight:700; color:#1a6eb5; text-transform:uppercase; margin:18px 0 10px; border-bottom:2px solid #e0eaf5; padding-bottom:5px; }
.app-modal-body .arquivo-item { display:flex; align-items:center; gap:10px; padding:9px 12px; border:1px solid #dee2e6; border-radius:5px; margin-bottom:7px; background:#f8f9fa; text-decoration:none; color:#333; transition:background 0.15s; cursor:pointer; }
.app-modal-body .arquivo-item:hover { background:#e8f0fb; }
.app-modal-body .arquivo-item .arq-icone { font-size:20px; color:#dc3545; flex-shrink:0; }
.app-modal-body .arquivo-item .arq-info { flex:1; }
.app-modal-body .arquivo-item .arq-nome { font-size:13px; font-weight:600; color:#1a6eb5; display:block; }
.app-modal-body .arquivo-item .arq-data { font-size:11px; color:#888; margin-top:1px; display:block; }
.app-modal-body .sem-arquivos { color:#888; font-size:13px; font-style:italic; }
.app-modal-filtros-arq  { display:flex; gap:8px; margin-bottom:12px; flex-wrap:wrap; }
.app-modal-filtros-arq input { padding:7px 10px; border:1px solid #ced4da; border-radius:4px; font-size:13px; height:36px; background:#fff; color:#333; }
.app-modal-filtros-arq input[type="text"] { flex:2; min-width:160px; }
.app-modal-filtros-arq input[type="date"] { flex:1; min-width:130px; }
.app-modal-footer       { padding:14px 24px; border-top:1px solid #e9ecef; display:flex; gap:10px; flex-wrap:wrap; flex-shrink:0; background:#fff; border-radius:0 0 8px 8px; }
.app-btn-imprimir       { background:#6c757d; color:#fff; border:none; padding:8px 16px; border-radius:4px; cursor:pointer; font-size:13px; display:flex; align-items:center; gap:6px; }
.app-btn-imprimir:hover { background:#5a6268; }
.app-btn-salvar         { background:#17a2b8; color:#fff; border:none; padding:8px 16px; border-radius:4px; cursor:pointer; font-size:13px; display:flex; align-items:center; gap:6px; }
.app-btn-salvar:hover   { background:#138496; }
.app-btn-fechar         { background:#fff; color:#555; border:1px solid #ced4da; padding:8px 16px; border-radius:4px; cursor:pointer; font-size:13px; margin-left:auto; }
.app-btn-fechar:hover   { background:#f0f0f0; }
.app-vazio              { padding:40px; text-align:center; color:#888; font-size:15px; }
@media(max-width:600px) { .app-modal { width:98%; } }

/* ---- Vars + Form Control (campos read-only do modal) ---- */
:root {
    --form-input: #fff;
    --form-font: #333;
    --form-color-scheme: light;
    --form: #fff;
    --form-f: #333;
    --forms-fundo-input: #fff;
    --forms-borda: #ced4da;
    --forms-texto: #333;
    --forms-texto-muted: #888;
    --fonte: #555;
}
.form-control           {background: var(--form-input); border: 1px solid var(--form-font); color: var(--form-font); color-scheme: var(--form-color-scheme); display: block; width: 100%; padding: 6px 12px; font-size: 13px; line-height: 1.5; box-sizing: border-box; border-radius: 0; height: 40px; }
.form-control:focus     {background: var(--form); color: var(--form-f); outline: none; box-shadow: none; }
.form-group             {margin-bottom: 15px; }
.form-group label       {color: var(--form-font); margin-bottom: 6px; display: inline-block; font-weight: 600; font-size: 13px; padding-left: 5px; }

/* ---- Grid (bootstrap simples) ---- */
.row                    {display:flex; flex-wrap:wrap; margin:0 -8px; }
.row > [class*="col-"]  {padding:0 8px; box-sizing:border-box; }
.col-xs-12              {width:100%; }
@media(min-width:768px) {.col-sm-2 {width:16.666%; } }

/* ---- Seções agrupadas (títulos entre tabelas: trans etc.) ---- */
.app-grupo-titulo       { display:flex; align-items:center; gap:10px; font-size:15px; font-weight:700; color:#1a6eb5; text-transform:uppercase; margin:24px 0 6px; border-bottom:2px solid #e0eaf5; padding-bottom:8px; }
.app-grupo-titulo .fa   { font-size:18px; color:#dc3545; }
.app-descricao-cat      { font-size:13px; color:#555; font-style:italic; margin:15px 0; }
.app-descricao-cat .fa  { color:#1a6eb5; margin-right:5px; }

/* ---- Abas internas do modal (engenharia etc.) ---- */
.app-modal-tabs         { display:flex; flex-wrap:wrap; gap:4px; margin:18px 0 0; border-bottom:2px solid #dee2e6; }
.app-modal-tab          { background:#f0f4fa; border:1px solid #dee2e6; border-bottom:none; color:#555; padding:7px 14px; border-radius:4px 4px 0 0; cursor:pointer; font-size:12px; font-weight:600; transition:background .15s; }
.app-modal-tab.active   { background:#1a6eb5; color:#fff; border-color:#1a6eb5; }
.app-modal-tab:hover:not(.active) { background:#e0eaf5; }
.app-tabcontent         { display:none; padding:16px 0 8px; }
.app-tabcontent.active  { display:block; }
.app-exec-item          { border-left:3px solid #1a6eb5; padding:10px 14px; margin-bottom:12px; background:#f8f9fa; border-radius:0 4px 4px 0; }
.app-img-grid           { display:flex; flex-wrap:wrap; gap:8px; }
.app-img-grid .app-img-item { width:calc(25% - 6px); }
.app-img-grid img       { width:100%; height:200px; object-fit:cover; border-radius:4px; border:2px solid #dee2e6; display:block; }
@media(max-width:600px) { .app-img-grid .app-img-item { width:calc(50% - 4px); } }
.app-video-item         { margin-bottom:12px; }
.app-video-item iframe  { width:100%; height:380px; border-radius:4px; }
.app-capa               { text-align:center; margin-bottom:12px; }
.app-capa img           { max-width:100%; border-radius:6px; display:inline-block; }

/* ---- Badges extras de situação ---- */
.badge-status.fechado    { background:#dc3545; }
.badge-status.aguardando { background:#ffc107; color:#333; }
