/* gp-table.css — tableau « façon Excel » + mise en page « données d'abord » (Claude chat, 23/09/2026)
   Couleurs par variables de l'habillage iOS, avec valeurs de repli. Mode sombre : les variables suffisent. */
:root{
  --gt-bg: var(--ios-bg-grouped, #f2f2f7);
  --gt-surface: var(--ios-card, #fff);
  --gt-text: var(--ios-label, #1c1c1e);
  --gt-muted: var(--ios-secondary-label, #6e6e73);
  --gt-line: var(--ios-separator, rgba(60,60,67,.18));
  --gt-accent: var(--ios-blue, #007aff);
  --gt-hover: color-mix(in srgb, var(--gt-accent) 7%, transparent);
  --gt-sel: color-mix(in srgb, var(--gt-accent) 14%, transparent);
  --gt-row-h: 34px;
  --gt-font: 13px;
}
@media (pointer:coarse){ :root{ --gt-row-h: 44px; --gt-font: 15px; } }
@media (prefers-color-scheme:dark){ :root:not([data-theme="light"]){
  --gt-bg: var(--ios-bg-grouped, #000); --gt-surface: var(--ios-card, #1c1c1e); --gt-text: var(--ios-label, #f2f2f7);
  --gt-muted: var(--ios-secondary-label, #98989f); --gt-line: var(--ios-separator, rgba(84,84,88,.6)); } }
body.dark-mode{ --gt-bg:#000; --gt-surface:#1c1c1e; --gt-text:#f2f2f7; --gt-muted:#98989f; --gt-line:rgba(84,84,88,.6); }

/* ── Page « données d'abord » : barre figée en haut, seules les données défilent ── */
.gp-page{ display:flex; flex-direction:column; height:100%; min-height:0; background:var(--gt-bg); color:var(--gt-text); }
.gp-page-bar{ flex:0 0 auto; display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  padding:8px 12px; background:var(--gt-surface); border-bottom:1px solid var(--gt-line); position:sticky; top:0; z-index:5; }
.gp-page-title{ font-size:17px; font-weight:600; margin:0 8px 0 0; white-space:nowrap; }
.gp-page-bar .gp-grow{ flex:1 1 auto; }
.gp-search{ height:32px; min-width:180px; flex:0 1 280px; padding:0 10px 0 30px; border-radius:9px; border:0;
  background: color-mix(in srgb, var(--gt-muted) 14%, transparent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E") 10px 50% no-repeat;
  color:inherit; font:inherit; font-size:14px; }
.gp-search:focus{ outline:2px solid var(--gt-accent); outline-offset:0; }
.gp-chip{ display:inline-flex; align-items:center; gap:4px; height:26px; padding:0 4px 0 10px; border-radius:13px;
  background:var(--gt-sel); color:var(--gt-accent); font-size:12px; font-weight:500; white-space:nowrap; }
.gp-chip button{ border:0; background:none; color:inherit; cursor:pointer; width:20px; height:20px; border-radius:10px; font-size:14px; line-height:1; }
.gp-chip button:hover{ background:var(--gt-hover); }
.gp-count{ font-size:12px; color:var(--gt-muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.gp-btn-link{ border:0; background:none; color:var(--gt-accent); font:inherit; font-size:13px; cursor:pointer; padding:4px 6px; }
.gp-page-body{ flex:1 1 auto; min-height:0; overflow:auto; -webkit-overflow-scrolling:touch; }

/* ── Tableau façon Excel : quadrillage, bandes alternées, en-tête teinté ── */
:root{ --gt-head-bg: color-mix(in srgb, var(--gt-accent) 12%, var(--gt-surface)); --gt-grid: color-mix(in srgb, var(--gt-muted) 28%, transparent);
  --gt-band: color-mix(in srgb, var(--gt-muted) 7%, var(--gt-surface)); }
.gt{ border-collapse:separate; border-spacing:0; font-size:var(--gt-font); background:var(--gt-surface); table-layout:auto; width:100%; }
.gt th,.gt td{ height:var(--gt-row-h); padding:0 8px; border-right:1px solid var(--gt-grid); border-bottom:1px solid var(--gt-grid);
  text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:320px; }
.gt tbody tr:nth-child(even) td{ background:var(--gt-band); }
.gt thead th{ position:sticky; top:0; z-index:3; background:var(--gt-head-bg); color:var(--gt-text); font-size:12px; font-weight:600;
  user-select:none; border-bottom:1px solid color-mix(in srgb, var(--gt-accent) 35%, transparent); }
.gt th .gt-h{ display:flex; align-items:center; gap:4px; height:100%; }
.gt th .gt-lbl{ cursor:pointer; overflow:hidden; text-overflow:ellipsis; flex:1 1 auto; }
.gt th .gt-sort{ font-size:10px; min-width:10px; color:var(--gt-accent); }
.gt th .gt-dd{ flex:0 0 auto; width:18px; height:18px; border:1px solid var(--gt-grid); border-radius:3px; background:var(--gt-surface);
  cursor:pointer; color:var(--gt-muted); font-size:10px; line-height:16px; padding:0; display:inline-grid; place-items:center; }
.gt th .gt-dd:hover,.gt th .gt-dd.open{ border-color:var(--gt-accent); color:var(--gt-text); }
.gt th.gt-filtered .gt-dd{ color:var(--gt-accent); border-color:var(--gt-accent); }
.gt th{ position:sticky; }
.gt th .gt-grip{ position:absolute; top:0; right:0; width:8px; height:100%; cursor:col-resize; z-index:2; }
.gt th.gt-num .gt-lbl,.gt td.gt-num{ text-align:right; font-variant-numeric:tabular-nums; }
.gt tbody tr.gt-click{ cursor:pointer; }
.gt tbody tr:hover td{ background:var(--gt-hover) !important; }
.gt tbody tr.gt-active td{ background:var(--gt-sel) !important; }
.gt td:first-child,.gt th:first-child{ position:sticky; left:0; z-index:1; }
.gt thead th:first-child{ z-index:4; }
.gt tbody td:first-child{ background:var(--gt-surface); font-weight:500; }
.gt tbody tr:nth-child(even) td:first-child{ background:var(--gt-band); }
.gt-empty{ padding:40px 16px !important; text-align:center !important; color:var(--gt-muted); height:auto !important; }
.gt-badge{ display:inline-block; padding:1px 8px; border-radius:10px; font-size:11px; font-weight:600; line-height:18px; }

/* ── Menu de colonne (disposition Excel) ── */
.gt-pop{ position:fixed; z-index:1000; width:280px; display:flex; flex-direction:column; padding:4px 0;
  background:var(--gt-surface); color:var(--gt-text); border-radius:8px; font-size:13px;
  box-shadow:0 8px 30px rgba(0,0,0,.22), 0 0 0 1px var(--gt-line); overflow:hidden; }
.gt-pop .gt-mi{ flex:0 0 auto; display:flex; align-items:center; gap:8px; width:100%; border:0; background:none; text-align:left;
  padding:7px 12px; cursor:pointer; color:inherit; font:inherit; }
.gt-pop .gt-mi:hover:not([disabled]){ background:var(--gt-hover); }
.gt-pop .gt-mi[disabled]{ color:var(--gt-muted); opacity:.55; cursor:default; }
.gt-pop .gt-mi.on{ color:var(--gt-accent); font-weight:600; }
.gt-pop .gt-ic{ width:30px; flex:0 0 30px; font-size:10px; font-weight:700; color:var(--gt-accent); letter-spacing:-.5px; }
.gt-pop .gt-chev{ margin-left:auto; color:var(--gt-muted); font-size:15px; }
.gt-pop .gt-sep{ height:1px; background:var(--gt-line); margin:4px 0; }
.gt-pop .gt-cond{ display:flex; gap:6px; padding:4px 12px 6px 50px; }
.gt-pop .gt-cond[hidden]{ display:none; }
.gt-pop .gt-cond select,.gt-pop .gt-cond input{ height:28px; border:1px solid var(--gt-line); border-radius:6px; background:var(--gt-bg); color:inherit; font:inherit; font-size:12px; min-width:0; }
.gt-pop .gt-cond select{ flex:0 0 118px; } .gt-pop .gt-cond input{ flex:1; padding:0 6px; }
.gt-pop .gt-q{ flex:0 0 auto; margin:6px 12px; height:30px; border-radius:6px; border:1px solid var(--gt-line); padding:0 8px; background:var(--gt-bg); color:inherit; font:inherit; }
.gt-pop .gt-q:focus,.gt-pop .gt-cond input:focus{ outline:2px solid var(--gt-accent); outline-offset:-1px; }
.gt-pop .gt-pop-list{ overflow:auto; flex:1 1 auto; min-height:90px; margin:0 12px; border:1px solid var(--gt-line); border-radius:6px; padding:2px 0; }
.gt-pop label{ display:flex; align-items:center; gap:8px; padding:3px 8px; cursor:pointer; }
.gt-pop label:hover{ background:var(--gt-hover); }
.gt-pop label.gt-all{ font-weight:500; }
.gt-pop label span.v{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.gt-pop label span.n{ color:var(--gt-muted); font-size:11px; font-variant-numeric:tabular-nums; }
.gt-pop .gt-more{ color:var(--gt-muted); font-size:11px; padding:4px 8px; }
.gt-pop .gt-pop-foot{ flex:0 0 auto; display:flex; justify-content:flex-end; gap:8px; padding:8px 12px 6px; }
.gt-pop .gt-b{ min-width:74px; height:28px; border-radius:6px; border:1px solid var(--gt-line); background:var(--gt-surface); color:inherit; font:inherit; cursor:pointer; }
.gt-pop .gt-b.gt-ok{ background:var(--gt-accent); border-color:var(--gt-accent); color:#fff; }
@media (pointer:coarse){ .gt-pop .gt-mi{ padding:11px 14px; } .gt-pop label{ padding:8px; } .gt th .gt-dd{ width:26px; height:26px; } }

/* ── Cases à cocher (sélection multiple) ── */
.gt th.gt-ck,.gt td.gt-ck{ width:36px; min-width:36px; max-width:36px; padding:0; text-align:center; position:sticky; left:0; z-index:2; }
.gt thead th.gt-ck{ z-index:5; }
.gt tbody td.gt-ck{ background:var(--gt-surface); }
.gt tbody tr:nth-child(even) td.gt-ck{ background:var(--gt-band); }
.gt .gt-ck input{ width:16px; height:16px; margin:0; cursor:pointer; accent-color:var(--gt-accent); vertical-align:middle; }
.gt th.gt-ck ~ th:nth-child(2),.gt tbody td.gt-ck ~ td:nth-child(2){ position:sticky; left:36px; z-index:1; }
.gt thead th.gt-ck ~ th:nth-child(2){ z-index:4; }
.gt td.gt-ck:first-child,.gt th.gt-ck:first-child{ left:0; }
.gt tbody tr.gt-picked td{ background:var(--gt-sel) !important; }
@media (pointer:coarse){ .gt th.gt-ck,.gt td.gt-ck{ width:44px; min-width:44px; max-width:44px; } .gt .gt-ck input{ width:20px; height:20px; }
  .gt th.gt-ck ~ th:nth-child(2),.gt tbody td.gt-ck ~ td:nth-child(2){ left:44px; } }
/* Barre d'actions : collée en bas de la zone de données, visible seulement quand des lignes sont cochées */
.gt-selbar{ position:sticky; bottom:12px; left:12px; z-index:6; display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap;
  margin:12px; padding:6px 8px 6px 14px; border-radius:12px; background:var(--gt-text); color:var(--gt-surface);
  box-shadow:0 8px 28px rgba(0,0,0,.28); font-size:13px; max-width:calc(100% - 24px); padding-bottom:calc(6px + env(safe-area-inset-bottom, 0px)); }
.gt-selbar .gt-seln{ font-weight:600; margin-right:6px; font-variant-numeric:tabular-nums; }
.gt-selbar .gt-act{ height:30px; padding:0 12px; border-radius:8px; border:0; cursor:pointer; font:inherit; font-weight:500;
  background:color-mix(in srgb, var(--gt-surface) 16%, transparent); color:inherit; }
.gt-selbar .gt-act:hover{ background:color-mix(in srgb, var(--gt-surface) 26%, transparent); }
.gt-selbar .gt-act.gt-danger{ background:var(--ios-red, #ff3b30); color:#fff; }
.gt-selbar .gt-act:disabled{ opacity:.5; cursor:default; }
.gt-selbar .gt-desel{ background:none; opacity:.8; }
@media (pointer:coarse){ .gt-selbar .gt-act{ height:38px; } }

/* ── gp-multi : listes déroulantes à cases pour la barre de filtres ── */
.gp-filters{ display:flex; flex-direction:column; gap:6px; padding:8px 16px; background:var(--gt-surface); border-bottom:1px solid var(--gt-line); }
.gp-filters-row{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; min-height:30px; }
.gp-ms{ height:30px; padding:0 10px; border-radius:8px; border:1px solid var(--gt-grid); background:var(--gt-surface); color:var(--gt-text);
  font:inherit; font-size:13px; font-weight:500; display:inline-flex; align-items:center; gap:4px; cursor:pointer; white-space:nowrap; }
.gp-ms.on{ border-color:var(--gt-accent); background:var(--gt-sel); color:var(--gt-accent); }
.gp-ms .gp-ms-n{ min-width:18px; height:18px; padding:0 5px; box-sizing:border-box; border-radius:9px; background:var(--gt-accent); color:#fff;
  font-size:11px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; }
.gp-ms .gp-ms-ch{ opacity:.7; font-size:11px; }
.gp-ms-pop{ position:fixed; z-index:1000; width:280px; display:flex; flex-direction:column; background:var(--gt-surface); color:var(--gt-text);
  border-radius:10px; box-shadow:0 10px 34px rgba(0,0,0,.22), 0 0 0 1px var(--gt-line); overflow:hidden; font-size:13px; }
.gp-ms-pop .gp-ms-q{ flex:0 0 auto; margin:8px; height:32px; border-radius:7px; border:1px solid var(--gt-line); padding:0 8px; font:inherit; background:var(--gt-bg); color:inherit; }
.gp-ms-pop label{ display:flex; align-items:center; gap:8px; padding:6px 12px; cursor:pointer; }
.gp-ms-pop label:hover{ background:var(--gt-hover); } .gp-ms-pop label.on{ background:var(--gt-sel); }
.gp-ms-pop .gp-ms-all{ flex:0 0 auto; font-weight:600; border-bottom:1px solid var(--gt-line); }
.gp-ms-pop input[type=checkbox]{ width:16px; height:16px; margin:0; accent-color:var(--gt-accent); }
.gp-ms-pop .gp-ms-list{ overflow:auto; flex:1 1 auto; }
.gp-ms-pop .v{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; } .gp-ms-pop .n{ color:var(--gt-muted); font-size:12px; }
.gp-ms-pop .gp-ms-empty{ padding:10px 12px; color:var(--gt-muted); }
.gp-ms-pop .gp-ms-extra{ flex:0 0 auto; border-top:1px solid var(--gt-line); }   /* case à part en bas (ex. « Archivées ») */
.gp-ms-pop .gp-ms-extra.on{ background:var(--gt-sel); }
.gp-ms-pop .gp-ms-foot{ flex:0 0 auto; display:flex; justify-content:flex-end; gap:8px; padding:8px 12px; border-top:1px solid var(--gt-line); }
.gp-ms-pop .gp-ms-b{ height:30px; padding:0 14px; border-radius:7px; border:1px solid var(--gt-line); background:var(--gt-surface); font:inherit; cursor:pointer; color:inherit; }
.gp-ms-pop .gp-ms-ok{ background:var(--gt-accent); border-color:var(--gt-accent); color:#fff; font-weight:600; }
.gp-status{ display:flex; gap:4px; flex-wrap:wrap; }
.gp-status button{ height:28px; padding:0 10px; border-radius:14px; border:1px solid var(--gt-line); background:var(--gt-surface); color:var(--gt-text); font:inherit; font-size:13px; font-weight:500; cursor:pointer; }
.gp-status button.on{ background:var(--gt-accent); border-color:var(--gt-accent); color:#fff; }
.gp-status button .c{ color:var(--gt-muted); margin-left:2px; } .gp-status button.on .c{ color:#fff; opacity:.85; }
@media (pointer:coarse){ .gp-ms{ height:40px; } .gp-ms-pop label{ padding:10px 12px; } .gp-status button{ height:36px; } }

/* pageSize : ligne « Afficher les N suivantes » (24/09) */
.gt tr.gt-more td{ text-align:center; padding:10px 8px; background:var(--gt-surface); }
.gt-more-btn{ height:30px; padding:0 14px; border-radius:8px; border:1px solid var(--gt-accent); background:var(--gt-surface);
  color:var(--gt-accent); font:inherit; font-weight:600; cursor:pointer; }
.gt-more-btn:hover{ background:color-mix(in srgb, var(--gt-accent) 10%, var(--gt-surface)); }
.gt-more-info{ margin-left:12px; color:var(--gt-muted); font-size:12px; font-variant-numeric:tabular-nums; }
@media (pointer:coarse){ .gt-more-btn{ height:40px; } }
