/* ═══════════════════════════════════════════════════════════════════
   GMAO Table Tools v3 — « Excel par défaut » (plus de toolbar)
   ═══════════════════════════════════════════════════════════════════ */

/* Sélection de texte autorisée dans les tables */
table, table * {
  -webkit-user-select: text !important;
  user-select: text !important;
}

/* ── Entonnoir de filtre dans chaque en-tête (CSS pur, zéro DOM) ────
   .tbx-on est posée par le JS sur les tables avec <thead>. */
table.tbx-on thead th {
  position: relative !important;
  padding-right: 30px !important;
}
table.tbx-on thead th::after {
  content: "\25BE"; /* ▾ */
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  line-height: 1;
  color: rgba(120, 120, 130, 0.55);
  pointer-events: none; /* le clic est géré par délégation sur le th */
  transition: color 0.12s ease;
}
table.tbx-on thead th:hover::after {
  color: #ff6a13;
}
/* Filtre actif sur la colonne → entonnoir orange plein */
table.tbx-on thead th.tbx-filt-on::after {
  content: "\25BC"; /* ▼ */
  color: #ff6a13;
  font-weight: bold;
}

/* ── Sélection par glisser (rang de cellules, façon Excel) ─────────── */
td.tbx-rng {
  background-color: rgba(255, 106, 19, 0.22) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 106, 19, 0.75);
}
body.tbx-dragging, body.tbx-dragging * {
  -webkit-user-select: none !important;
  user-select: none !important;
  cursor: cell !important;
}

/* ── Sélection de colonnes (via le menu d'en-tête) ─────────────────── */
th.tbx-sel-col, td.tbx-sel-col {
  background-color: rgba(255, 106, 19, 0.12) !important;
}
th.tbx-sel-col {
  box-shadow: inset 0 -2px 0 #ff6a13;
}

/* ── Menu de colonne (entonnoir) ───────────────────────────────────── */
.gmao-tx-colmenu {
  position: fixed;
  z-index: 99992;
  width: 220px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 8px;
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, "Geist", system-ui, sans-serif;
}
.gmao-tx-colmenu.show { display: block; }
.gmao-tx-cm-title {
  font-size: 11px;
  font-weight: 700;
  color: #f9fafb;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gmao-tx-cm-input {
  width: 100%;
  box-sizing: border-box;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 6px;
  color: #f9fafb;
  font-size: 12.5px;
  padding: 6px 8px;
  outline: none;
  margin-bottom: 6px;
}
.gmao-tx-cm-input:focus { border-color: #ff6a13; }
.gmao-tx-colmenu button {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.gmao-tx-colmenu button:hover { background: #374151; color: #fff; }

/* ── Menu contextuel (clic droit) ──────────────────────────────────── */
.gmao-tx-ctxmenu {
  position: fixed;
  z-index: 99993;
  min-width: 196px;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 6px;
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, "Geist", system-ui, sans-serif;
}
.gmao-tx-ctxmenu.show { display: block; }
.gmao-tx-cx-head {
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px 6px;
  border-bottom: 1px solid #374151;
  margin-bottom: 4px;
}
.gmao-tx-ctxmenu button {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 12.5px;
  padding: 7px 9px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.gmao-tx-ctxmenu button:hover { background: #ff6a13; color: #fff; }
.gmao-tx-cx-sep {
  height: 1px;
  background: #374151;
  margin: 4px 2px;
}

/* ── Flash cellule copiée ──────────────────────────────────────────── */
.gmao-tx-flash { animation: gmao-tx-flash-kf 0.6s ease; }
@keyframes gmao-tx-flash-kf {
  0%   { background-color: #fed7aa; }
  100% { background-color: transparent; }
}

/* ── Toast ─────────────────────────────────────────────────────────── */
.gmao-tx-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 99999;
  background: #111827;
  color: #f9fafb;
  border: 1px solid #ff6a13;
  font-size: 12.5px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  max-width: 86vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gmao-tx-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Densité des lignes ────────────────────────────────────────────── */
table.tbx-compact th, table.tbx-compact td {
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  font-size: 11.5px !important;
  line-height: 1.25 !important;
}
table.tbx-confort th, table.tbx-confort td {
  padding-top: 12px !important;
  padding-bottom: 12px !important;
}

/* ── Redimensionnement ─────────────────────────────────────────────── */
body.tbx-resizing, body.tbx-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}
body.tbx-row-resizing, body.tbx-row-resizing * {
  cursor: row-resize !important;
  user-select: none !important;
}
/* Lignes redimensionnées : la hauteur posée sur le <tr> agit comme
   hauteur exacte, et l'overflow caché permet de réduire sous le contenu. */
tr.tbx-rowfix > td, tr.tbx-rowfix > th {
  overflow: hidden;
}
table[style*="table-layout: fixed"] td,
table[style*="table-layout: fixed"] th {
  overflow: hidden;
  text-overflow: ellipsis;
}
