/* ═════════════════════════════════════════════════════════════════════════
   datatable.css — Tabela reusável com filtros, ordenação e visualizações
   Funciona em conjunto com datatable.js
   ═════════════════════════════════════════════════════════════════════════ */

.dt{
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  font-size: 12.5px;
}

/* ─── Toolbar ─────────────────────────────────────────────────────────── */
.dt-toolbar{
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}
.dt-search{
  flex: 1;
  min-width: 200px;
  padding: 7px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  outline: none;
}
.dt-search:focus{
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}
.dt-count{
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}
.dt-clear-btn{
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #64748b;
}
.dt-clear-btn:hover{ background: #f1f5f9; color: #0f172a; }

/* ─── View toggle (Lista | Detalhes) ──────────────────────────────────── */
.dt-views{
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 2px;
}
.dt-view-btn{
  padding: 5px 12px;
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
}
.dt-view-btn.on{ background: #2563eb; color: #fff; }

/* ─── Filtros por coluna (linha sob o header) ─────────────────────────── */
.dt-col-filters{
  display: none;
  background: #fafbfc;
  border-bottom: 1px solid #e2e8f0;
}
.dt-col-filters.on{ display: table-row; }
.dt-col-filters td{
  padding: 6px 8px !important;
  border-bottom: 1px solid #e2e8f0;
}
.dt-col-filter-input,
.dt-col-filter-select{
  width: 100%;
  padding: 4px 7px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  font-size: 11px;
  font-family: inherit;
  background: #fff;
  outline: none;
}
.dt-col-filter-input:focus,
.dt-col-filter-select:focus{ border-color: #2563eb; }

/* ─── Table ───────────────────────────────────────────────────────────── */
.dt table{
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 12.5px;
}
.dt th{
  text-align: left;
  padding: 10px 12px;
  background: #f1f5f9;
  font-size: 10.5px;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  position: relative;
}
.dt th.dt-sortable{ cursor: pointer; user-select: none; }
.dt th.dt-sortable:hover{ background: #e2e8f0; color: #0f172a; }
.dt th.dt-sortable .dt-sort-arrow{
  font-size: 9px;
  margin-left: 4px;
  color: #94a3b8;
}
.dt th.dt-sortable.asc .dt-sort-arrow,
.dt th.dt-sortable.desc .dt-sort-arrow{ color: #2563eb; }

.dt td{
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.dt tr:last-child td{ border-bottom: 0; }
.dt tr.dt-clickable{ cursor: pointer; transition: background .12s; }
.dt tr.dt-clickable:hover{ background: #f8fafc; }
.dt td.dt-empty{
  padding: 30px;
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}

/* ─── Modo Detalhes ───────────────────────────────────────────────────── */
.dt.dt-view-detail td{ padding: 12px; }
.dt.dt-view-detail .dt-detail-block{
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.5;
}
.dt-view-list .dt-only-detail{ display: none; }

/* ─── Pagination ──────────────────────────────────────────────────────── */
.dt-pagination{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  font-size: 11px;
  color: #64748b;
}
.dt-page-btn{
  padding: 4px 10px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11px;
}
.dt-page-btn:hover:not(:disabled){ background: #f1f5f9; }
.dt-page-btn:disabled{ opacity: .4; cursor: not-allowed; }

/* ─── Cell helpers (use nas suas funções render) ──────────────────────── */
.dt-cell-strong{ font-weight: 600; color: #0f172a; }
.dt-cell-mono{ font-family: ui-monospace, monospace; font-size: 11.5px; }
.dt-cell-right{ text-align: right; }
.dt-cell-center{ text-align: center; }

/* === Modo CARDS (detail customizado) === */
.dt-cards { display:grid; grid-template-columns:repeat(auto-fill, minmax(380px, 1fr)); gap:12px; padding:12px 0; }
.dt-card { background:#fff; border:1px solid #e2e8f0; border-radius:10px; padding:14px 16px; transition:all .15s; }
.dt-card.dt-clickable { cursor:pointer; }
.dt-card.dt-clickable:hover { border-color:#7c3aed; box-shadow:0 2px 8px rgba(124,58,237,.10); transform:translateY(-1px); }
.dt-card h4 { font-size:13px; margin:0 0 6px 0; display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.dt-card p { font-size:11px; color:#64748b; margin:6px 0; line-height:1.5; }
.dt-card .dt-card-actions { display:flex; gap:6px; margin-top:10px; flex-wrap:wrap; }
