/* Data table (assets/js/datatable.js): toolbar, header sort and filters, selection, paging, virtual rows. */

.dt { position: relative; display: grid; min-width: 0; }
.dt-panel { overflow: visible; }
.dt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.dt-search { flex: 0 1 300px; min-width: 200px; }
.dt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.dt-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.dt-chips .sort-tag { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.dt-bulk {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 14px;
  background: color-mix(in oklab, var(--accent) 9%, var(--surface)); border-bottom: 1px solid var(--accent-line); font-size: 12.5px;
}
.dt-bulk-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }

.dt-scroll { overflow: auto; min-width: 0; }
.dt-scroll:focus-visible { outline-offset: -2px; }
.dt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dt-table th {
  position: sticky; top: 0; z-index: 2; padding: 0 6px 0 12px; height: 36px;
  text-align: left; white-space: nowrap; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.dt-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dt-table tbody tr:last-child td { border-bottom: 0; }
.dt-table tbody tr { transition: background 0.12s; }
.dt-table tbody tr:hover td { background: var(--surface-2); }
.dt-table tbody tr.selected td { background: color-mix(in oklab, var(--accent) 7%, var(--surface)); }
.dt-table tbody tr.link-row { cursor: pointer; }
.dt-table .end { text-align: right; }
.dt-table th.end .dt-th { justify-content: flex-end; }
.dt[data-density="compact"] .dt-table td { padding-top: 5px; padding-bottom: 5px; }
.dt[data-density="compact"] .machine-cell .tile { width: 22px; height: 22px; }
.dt[data-density="compact"] .machine-cell .role { display: none; }
.dt-check { width: 40px; padding-right: 0 !important; }
.dt-check .check { gap: 0; }

.dt-th { display: flex; align-items: center; gap: 2px; }
.dt-sort, .dt-label {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 6px; margin-left: -6px;
  border-radius: 6px; font: inherit; color: inherit; text-transform: none;
}
.dt-sort:hover { background: var(--sunken); color: var(--ink); }
.dt-sort.on { color: var(--ink); }
.dt-arrow { display: inline-grid; opacity: 0.45; }
.dt-sort:hover .dt-arrow, .dt-sort.on .dt-arrow { opacity: 1; }
.dt-sort.on .dt-arrow { color: var(--accent); }
.dt-filter { position: relative; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--ink-3); opacity: 0.7; }
.dt-filter:hover, .dt-filter[aria-expanded="true"] { background: var(--sunken); color: var(--ink); opacity: 1; }
.dt-filter.on { color: var(--accent); opacity: 1; }
.dt-filter.on::after { content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1.5px var(--surface-2); }

.dt-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 9px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2);
}
.dt-size { display: inline-flex; align-items: center; gap: 8px; }
.dt-size .field { height: 28px; padding: 0 28px 0 9px; font-size: 12.5px; }
.dt-size .select-wrap .icon { top: 7.5px; right: 8px; }
.dt-count { margin-right: auto; }
.dt-foot .pager button { display: inline-flex; align-items: center; justify-content: center; }
.dt-foot .pager .dbl { margin-left: -9px; }
.dt-window { color: var(--ink-3); }

.dt-pop {
  position: absolute; z-index: 20; width: 260px; padding: 12px;
  border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
  animation: pop 0.16s var(--ease-out);
}
.dt-filter-pop { display: grid; gap: 10px; }
.dt-filter-pop > strong { font-size: 13px; }
.dt-values { display: grid; gap: 7px; max-height: 236px; overflow: auto; padding: 2px; }
.dt-values .check { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
.dt-values .check .muted { font-size: 11.5px; }
.dt-filter-pop .dt-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dt-pop-actions { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.dt-pop-actions span { flex: 1; }

/* Virtual rows keep one height so the scroll maths hold. */
.dt[data-virtual="true"] .dt-table { table-layout: fixed; }
.dt[data-virtual="true"] .dt-table td { height: var(--rh); padding-top: 0; padding-bottom: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt[data-virtual="true"] .dt-spacer td { padding: 0; border: 0; height: auto; }
.dt-ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt .no-results { padding: 30px 12px; }

.sev { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-size: 12px; }
.sev.info { color: var(--accent); }
.sev.warn { color: var(--wait); }
.sev.crit { color: var(--crit); }
.dt-error { padding: 14px; }

@media (max-width: 860px) {
  .dt-search { flex: 1 1 100%; }
  .dt-tools { margin-left: 0; }
  .dt-table { min-width: 980px; }
  .dt-table td { white-space: nowrap; }
  .dt[data-virtual="true"] .dt-table { min-width: 860px; }
}
