/* Smart table kit (spec §16) — used with partials/_smart_table.html and js/achat_table.js */
.st-wrap { position: relative; }
.st-toolbar { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; min-height: 32px; flex-wrap: wrap; }
.st-title { margin: 0; }
.st-toolbar-right { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.st-bulkbar { display: flex; align-items: center; gap: .4rem; padding: .25rem .5rem; background: var(--accent-50);
  border: 1px solid #c8daf3; border-radius: 6px; }
.st-bulkbar[hidden] { display: none; }
.st-bulk-count { font-weight: 600; color: var(--accent-600); margin-right: .25rem; }
.st-colmenu-wrap { position: relative; }
.st-colmenu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); padding: .5rem .75rem;
  min-width: 210px; max-height: 60vh; overflow: auto; }
.st-colmenu[hidden] { display: none; }
.st-colmenu label { display: flex; gap: .4rem; align-items: center; padding: .2rem 0; font-weight: 400; cursor: pointer; }
.st-colmenu .st-reset { margin-top: .4rem; width: 100%; justify-content: center; }

.st-scroll { overflow: auto; max-height: var(--st-max-height, 72vh); border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); }
.smart-table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; min-width: 100%;
  font-variant-numeric: tabular-nums; }
.smart-table th, .smart-table td { padding: .38rem .55rem; border-bottom: 1px solid var(--border);
  border-right: 1px solid #edf0f4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--surface);
  vertical-align: middle; }
.smart-table thead th { position: sticky; top: 0; z-index: 3; background: #f1f4f8; font-weight: 600; text-align: left;
  user-select: none; }
.smart-table thead tr.st-filter-row th { top: 34px; background: #f7f9fb; padding: .25rem .35rem; }
.st-filter { width: 100%; padding: .2rem .4rem !important; font-size: .82rem; }
.smart-table .st-sticky { position: sticky; z-index: 2; }
.smart-table thead .st-sticky { z-index: 4; }
.smart-table tbody tr:hover td { background: #f6f9fd; }
.smart-table tbody tr.st-selected td { background: #eaf2fd; }
.smart-table .st-hidden { display: none; }
.st-select { width: 36px; text-align: center; }
.st-align-right { text-align: right !important; }
.st-align-center { text-align: center !important; }
.st-th-inner { overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.st-sort { color: inherit; display: inline-flex; gap: .25rem; align-items: center; }
.st-sort:hover { text-decoration: none; color: var(--accent); }
.st-sort-ind::after { content: "⇅"; opacity: .3; font-size: .8em; }
.st-sorted-asc .st-sort-ind::after { content: "▲"; opacity: .9; }
.st-sorted-desc .st-sort-ind::after { content: "▼"; opacity: .9; }
th[draggable="true"] { cursor: grab; }
th.st-drag-over { box-shadow: inset 3px 0 0 var(--accent); }
th.st-dragging { opacity: .5; }

.smart-table thead th { position: sticky; }
.smart-table th .resize-handle { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize;
  z-index: 5; }
.smart-table th .resize-handle:hover, .smart-table th .resize-handle.active { background: var(--accent); opacity: .6; }
body.st-resizing, body.st-resizing * { cursor: col-resize !important; user-select: none !important; }

.st-editable { cursor: cell; }
.st-editable:hover { box-shadow: inset 0 0 0 1px #b9cdea; }
td.st-editing { padding: 2px !important; overflow: visible; background: #fffdf2 !important; }
.st-cell-form { margin: 0 !important; }
.st-input { width: 100%; padding: .25rem .35rem !important; font-size: .9rem; }
.st-cell-error { color: var(--danger); font-size: .75rem; white-space: normal; padding: 2px 4px; }
.st-empty td { text-align: center; color: var(--muted); padding: 1.5rem; }
.st-footer { display: flex; justify-content: space-between; align-items: center; padding: .45rem .15rem; font-size: .85rem; }
.st-pages { display: flex; gap: .6rem; align-items: center; }
.st-pages a { padding: .1rem .5rem; border: 1px solid var(--border); border-radius: 4px; }
.htmx-request .smart-table, .smart-table.htmx-request { opacity: .7; transition: opacity .2s; }
