/* ──────────────────────────────────────────────────────────────────────────
   Lattice — drag-to-reorder columns
   Loaded by dashboard / flow-validator / watchlist. Active only on tables
   marked with `data-reorderable`. Inherits palette tokens from lattice.css.
   ────────────────────────────────────────────────────────────────────────── */

table[data-reorderable] thead th {
  /* Headers stay clickable (sort) and now also pointer-grabbable. */
  touch-action: pan-y;
}
table[data-reorderable] thead th.cr-grab-hint {
  cursor: grab;
}

/* While a drag is in flight, the table stops responding to native gestures
   so a horizontal pointer drag isn't hijacked by the page scroller. */
table[data-reorderable].cr-dragging,
table[data-reorderable].cr-dragging thead th,
table[data-reorderable].cr-dragging tbody td {
  touch-action: none !important;
  user-select: none;
  -webkit-user-select: none;
}
table[data-reorderable].cr-dragging thead th { cursor: grabbing !important; }

/* Source column dimmed while it's being moved. */
table[data-reorderable] thead th.cr-source,
table[data-reorderable] tbody td.cr-source {
  opacity: 0.35;
  transition: opacity 120ms ease;
}

/* Floating ghost — a clone of the dragged header that follows the pointer. */
.cr-ghost {
  position: fixed;
  top: 0; left: 0;
  z-index: 10000;
  padding: 8px 12px;
  background: var(--bg3, #191d27);
  color: var(--text, #e6e9ef);
  border: 1px solid var(--accent, #3b82f6);
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  font: 11px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0.95;
  transform: translate3d(-50%, -50%, 0);
  transition: transform 60ms linear;
}

/* Vertical drop indicator slotted between two columns of the live table. */
.cr-drop-line {
  position: absolute;
  top: 0;
  width: 3px;
  background: var(--accent, #3b82f6);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
  transition: left 80ms ease, height 80ms ease;
}

/* Columns hidden by data-hide-cols (still in DOM, just visually removed). */
table[data-reorderable] th.cr-hidden,
table[data-reorderable] td.cr-hidden {
  display: none !important;
}

/* Off-screen live region for screen-reader announcements. */
.cr-sr-live {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
  white-space: nowrap;
}
