/* Ported verbatim from Breckly/demo/assets/css/datatable.css. Change a value here only to match the reference. */
/* 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; }
/* Breckly.UI DataTable (operator, 2026-11-06): with a toolbar, the bulk bar takes its place while rows are selected, over it at
   the same height (taller only when its own content wraps), so selecting never pushes the rows down. */
.dt-top { position: relative; }
.dt-top > .dt-bulk { position: absolute; top: 0; left: 0; right: 0; min-height: 100%; z-index: 4; align-content: center; }
.dt-panel > .dt-top > .dt-bulk { border-radius: calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px) 0 0; }

.dt-scroll { overflow: auto; min-width: 0; }
/* Breckly.UI DataTable `AutoHeight` (opt-in, operator 2026-11-06): the rows area fits its rows up to --dt-max, then scrolls,
   so a short list leaves no empty band under its last row. A virtual table also states its rows' full height (--dt-rows). */
.dt[data-auto="true"] > .dt-scroll { max-height: var(--dt-max); }
/* In a fixed frame (kit.css) the table grows into its panel: toolbar, chips, bulk bar and pager
   stay put, the rows scroll under the sticky column titles. */
@media (min-width: 861px) and (min-height: 560px) {
  .frame .dt { display: flex; flex-direction: column; min-height: 0; }
  .frame .dt > * { flex: none; }
  .frame .dt > .dt-scroll { flex: 1 1 auto; min-height: 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: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
/* Deliberate fix over the reference: a number field's intrinsic width (~150px) overflowed the 260px pop. */
.dt-filter-pop .dt-range .field { width: 100%; min-width: 0; }
.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; }
}

/* Breckly.UI DataTable `Stack` (opt-in): below 860px the rows collapse into the stacked two-column rows
   of app.css `.data-table` (same values), header hidden; cells carry span, sm-hide or sm-note. Row tints
   move to the row, and a selection box sits at the row's left edge. Virtual tables keep fixed rows. */
@media (max-width: 860px) {
  .dt[data-stack="true"] .dt-table { min-width: 0; }
  .dt[data-stack="true"] .dt-table thead { display: none; }
  .dt[data-stack="true"] .dt-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; align-items: center; padding: 12px 13.5px; border-bottom: 1px solid var(--line); }
  .dt[data-stack="true"] .dt-table tbody tr:last-child { border-bottom: 0; }
  .dt[data-stack="true"] .dt-table td { padding: 0; border: 0; white-space: normal; }
  .dt[data-stack="true"] .dt-table td.span { grid-column: 1 / -1; }
  .dt[data-stack="true"] .dt-table td.sm-hide { display: none; }
  .dt[data-stack="true"] .dt-table td.sm-note { grid-column: 1 / -1; font-size: 11.5px; }
  .dt[data-stack="true"] .dt-table tbody tr:hover td, .dt[data-stack="true"] .dt-table tbody tr.selected td { background: none; }
  .dt[data-stack="true"] .dt-table tbody tr:hover { background: var(--surface-2); }
  .dt[data-stack="true"] .dt-table tbody tr.selected { background: color-mix(in oklab, var(--accent) 7%, var(--surface)); }
  .dt[data-stack="true"] .dt-table tbody tr:has(> td.dt-check) { position: relative; padding-left: 39.5px; }
  .dt[data-stack="true"] .dt-table td.dt-check { position: absolute; left: 13.5px; top: 12px; display: flex; align-items: center; width: auto; height: 29px; }
}

/* Breckly.UI DataTable `StackWhenNarrow`: the same stacked rows when the table itself is under 600px wide (a side column on a wide
   screen), whatever the screen. */
.dt[data-stack-narrow="true"] { container: dt / inline-size; }
@container dt (max-width: 600px) {
  .dt[data-stack-narrow="true"] .dt-table { min-width: 0; }
  .dt[data-stack-narrow="true"] .dt-table thead { display: none; }
  .dt[data-stack-narrow="true"] .dt-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; align-items: center; padding: 12px 13.5px; border-bottom: 1px solid var(--line); }
  .dt[data-stack-narrow="true"] .dt-table tbody tr:last-child { border-bottom: 0; }
  .dt[data-stack-narrow="true"] .dt-table td { padding: 0; border: 0; white-space: normal; }
  .dt[data-stack-narrow="true"] .dt-table td.span { grid-column: 1 / -1; }
  .dt[data-stack-narrow="true"] .dt-table td.sm-hide { display: none; }
  .dt[data-stack-narrow="true"] .dt-table td.sm-note { grid-column: 1 / -1; font-size: 11.5px; }
  .dt[data-stack-narrow="true"] .dt-table tbody tr:hover td, .dt[data-stack-narrow="true"] .dt-table tbody tr.selected td { background: none; }
  .dt[data-stack-narrow="true"] .dt-table tbody tr:hover { background: var(--surface-2); }
  .dt[data-stack-narrow="true"] .dt-table tbody tr.selected { background: color-mix(in oklab, var(--accent) 7%, var(--surface)); }
}

/* Breckly.UI DataTable pager (operator, 2026-11-06: pages with an adjustable number of rows instead of infinite scrolling).
   Beside the demo's rows-per-page select, range and page window: « Aller à la page » when some pages are out of the window,
   a cursor list's « Précédent » and « Suivant » around « Page N », and in a narrow footer a compact pager (« 3 / 12 » between
   the first, previous, next and last arrows; the select without its words). Same 29px buttons and 28px fields as the demo's pager. */
.dt-foot { container: dt-foot / inline-size; }
.dt-foot .pager .dt-pos { display: none; padding: 0 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.dt-foot .dt-steps .dt-pos { display: inline; }
.dt-foot .pager .dt-step { gap: 4px; padding: 0 9px 0 7px; }
.dt-foot .pager .dt-step:last-child { padding: 0 7px 0 9px; }
.dt-goto label { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.dt-goto .field { width: 56px; height: 28px; padding: 0 8px; font-size: 12.5px; text-align: center; }
@container dt-foot (max-width: 760px) {
  .dt-goto { display: none; }
}
@container dt-foot (max-width: 600px) {
  .dt-size-text, .dt-foot .pager .dt-pg, .dt-foot .pager .dt-gap { display: none; }
  .dt-foot .pager .dt-pos { display: inline; }
}

/* Breckly.UI DataTable Layout="Fill" (operator, 2026-11-06: virtual scrolling and sticky titles in fixed frames). A list inside a
   fixed frame (an inventory section, a side panel, a dialog) has no pager: its rows are virtual and scroll under the sticky column
   titles, the toolbar and the count footer stay put. In a flex column the table fits its rows and shrinks to the room its frame
   leaves, never under about six rows; elsewhere (a phone, a short window) its rows area stops short of the visible viewport. */
.dt[data-layout="fill"] { display: flex; flex-direction: column; flex: 0 1 auto; min-height: min(calc(var(--dt-rows, 0px) + 100px), 340px); }
.dt[data-layout="fill"] > * { flex: none; }
.dt[data-layout="fill"] > .dt-scroll { flex: 0 1 auto; min-height: 0; max-height: max(240px, calc(var(--view-h, 100dvh) - var(--top-h) - 160px)); }
/* The instant a virtual table sizes its columns (DataTable.razor.js `fit`): laid out as if its cells could wrap, then fixed. */
.dt[data-virtual="true"] .dt-table.dt-fit { table-layout: auto; }
.dt[data-virtual="true"] .dt-table.dt-fit td { white-space: normal; overflow-wrap: anywhere; }
/* Stacked virtual rows (below 860px) keep one height: each line of a row is one 20px line ending in an ellipsis. */
@media (max-width: 860px) {
  .dt[data-virtual="true"][data-stack="true"] .dt-table tbody tr.dt-spacer { display: block; padding: 0; border: 0; }
  .dt[data-virtual="true"][data-stack="true"] .dt-table tbody tr.dt-spacer td { display: block; }
  .dt[data-virtual="true"][data-stack="true"] .dt-table td { height: 20px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}

/* Breckly.UI DataTable additions (2026-11-12): header groups, per-column search and reorderable columns. Not in the reference demo;
   built from its tokens and header metrics. */
/* Several header rows stick as one block: each th sticking at top:0 would stack the rows on each other. */
.dt-table thead[data-rows="multi"] { position: sticky; top: 0; z-index: 2; }
.dt-table thead[data-rows="multi"] th { position: relative; top: auto; }
.dt-table .dt-groups th { height: 28px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; color: var(--ink-2); text-align: center; border-bottom: 1px solid var(--line); }
.dt-table .dt-groups th.dt-group:not(.empty) { box-shadow: inset 1px 0 var(--line), inset -1px 0 var(--line); }
.dt-table .dt-groups th.empty { background: var(--surface-2); }
.dt-table .dt-search-row th { height: auto; padding: 6px 6px 7px 12px; font-weight: 400; }
.dt-col-search { width: 100%; min-width: 72px; height: 28px; padding: 0 8px; font-size: 12px; }
.dt-table th[draggable="true"] { cursor: grab; }
.dt-table th[draggable="true"]:active { cursor: grabbing; }
.dt-table th.dt-col-dragging { opacity: 0.45; }
.dt-table th.dt-col-drop { box-shadow: inset 2px 0 var(--accent); background: color-mix(in oklab, var(--accent) 7%, var(--surface-2)); }
.dt-pop-hint { margin: -4px 0 0; font-size: 11.5px; color: var(--ink-3); }
.dt-col-line { display: flex; align-items: center; gap: 6px; }
.dt-col-line > .check { flex: 1 1 auto; min-width: 0; }
.dt-col-group { margin-left: auto; font-size: 11px; }
.dt-move { display: inline-flex; gap: 2px; flex: none; }
.dt-move .icon-btn { width: 24px; height: 24px; }
.dt-move .icon-btn:disabled { opacity: 0.35; }
/* Row groups (GroupBy), column resize (Resizable) and the pinned first column (PinFirstColumn). */
.dt-table tr.dt-group-row td { background: var(--surface-2); padding-top: 6px; padding-bottom: 6px; font-size: 12.5px; }
.dt-table tbody tr.dt-group-row:hover td { background: var(--sunken); }
.dt-group-toggle { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 3px 6px; margin-left: -6px; border-radius: 6px; font: inherit; color: var(--ink-2); text-align: left; }
.dt-group-toggle:hover { background: var(--sunken); color: var(--ink); }
.dt-group-toggle strong { color: var(--ink); font-weight: 700; }
.dt-group-chevron { flex: none; transition: transform 0.15s var(--ease-out); }
.dt-group-row:not(.collapsed) .dt-group-chevron { transform: rotate(90deg); }
.dt-group-count { margin-left: 4px; font-size: 11.5px; }
.dt-group-continued { font-size: 11.5px; }
.dt-table td.dt-group-agg { font-weight: 600; color: var(--ink-2); }
.dt-group-by { margin-bottom: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.dt-group-by .select-wrap { width: 100%; }
.dt-resize::after { content: ""; position: absolute; top: 8px; bottom: 8px; right: 0; width: 2px; border-radius: 2px; background: transparent; transition: background 0.12s; }
.dt-table th:hover .dt-resize::after { background: var(--line-strong); }
.dt-resize:hover::after, .dt-resize:focus-visible::after, .dt-resizing .dt-resize:active::after { background: var(--accent); }
.dt-resize:focus-visible { outline: none; }
.dt-table td.dt-pin { background: var(--surface); }
.dt-table .dt-pin { box-shadow: inset -1px 0 var(--line); }
.dt-table tbody tr:hover td.dt-pin { background: var(--surface-2); }
.dt-table tbody tr.selected td.dt-pin { background: color-mix(in oklab, var(--accent) 7%, var(--surface)); }
.dt-table td.dt-pin-check { background: var(--surface); }
.dt-table tbody tr:hover td.dt-pin-check { background: var(--surface-2); }
