/* Kairos — réglage des colonnes des tableaux.
   Aucune couleur en dur : tout est dérivé du thème de l'application,
   comme pour la surcouche de verre. */

:root {
  --kc-fond: var(--surface, var(--card, var(--carte, var(--blanc, var(--craie,
             var(--win, var(--fond, var(--bg, Canvas))))))));
  --kc-texte: var(--ink, var(--texte, var(--encre, var(--fg, var(--tx, var(--ardoise, CanvasText))))));
  --kc-trait: var(--line, var(--ligne, var(--trait, var(--bd, rgba(128,128,128,.3)))));
  --kc-or: var(--chantier, var(--cordeau, var(--gold, var(--or, var(--accent, var(--brass, #C8A454))))));
}

/* Sur téléphone la pastille « Colonnes » recouvrait la fin du titre du tableau :
   en dessous de 700 px elle prend sa propre ligne au lieu de se superposer. */
@media (max-width: 700px) {
  .kcol-bar { position: static !important; justify-content: flex-end; margin: 6px 0 2px; }
}
.kcol-bar {
  position: absolute; top: 6px; right: 8px; z-index: 7;
  display: flex; justify-content: flex-end; align-items: center;
  pointer-events: none;
}
.kcol-bar > *, .kcol-bar > * * { pointer-events: auto; }

.kcol-btn {
  all: unset; pointer-events: auto; box-sizing: border-box; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--kc-trait);
  background: color-mix(in srgb, var(--kc-fond) 80%, transparent);
  color: var(--kc-texte);
  font: 500 12.5px/1 inherit; opacity: .78;
  transition: opacity .18s, border-color .18s, transform .18s;
}
.kcol-btn:hover, .kcol-btn:focus-visible { opacity: 1; border-color: var(--kc-or); }
.kcol-btn:active { transform: scale(.97); }
.kcol-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.kcol-btn .kcol-n {
  font-style: normal; font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--kc-or) 85%, transparent); color: #1F1B12;
}

/* ---------- le panneau ---------- */
.kcol-panneau {
  position: fixed; z-index: 2147483600;
  width: min(340px, calc(100vw - 24px));
  max-height: min(60vh, 460px); overflow: auto;
  padding: 12px; border-radius: 16px;
  border: 1px solid var(--kc-trait);
  background: var(--kc-fond);          /* opaque : un réglage doit rester lisible */
  color: var(--kc-texte);
  box-shadow: 0 20px 48px -18px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.12);
  text-align: left;
}
.kcol-titre {
  font: 650 13px/1.2 inherit; margin-bottom: 10px;
  /* le doré de certaines apps tombe à 2,3:1 sur un panneau clair :
     on garde la couleur de texte, assourdie. */
  color: var(--kc-texte); opacity: .72;
  text-transform: uppercase; letter-spacing: .06em;
}
.kcol-liste { display: flex; flex-direction: column; gap: 2px; }
.kcol-ligne {
  display: grid; grid-template-columns: minmax(0,1fr) 88px 42px;
  align-items: center; gap: 8px; padding: 5px 2px; border-radius: 8px;
}
.kcol-ligne:hover { background: color-mix(in srgb, var(--kc-texte) 7%, transparent); }
.kcol-off { opacity: .45; }
.kcol-case { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.kcol-case span {
  font: 500 13px/1.25 inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kcol-case input { width: 15px; height: 15px; accent-color: var(--kc-or); cursor: pointer; flex: 0 0 auto; }
.kcol-larg { width: 88px; accent-color: var(--kc-or); cursor: pointer; }
.kcol-larg:disabled { cursor: default; opacity: .4; }
.kcol-px { font: 400 11px/1 inherit; opacity: .78; text-align: right; }

.kcol-pied {
  display: flex; gap: 6px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--kc-trait); flex-wrap: wrap;
}
.kcol-pied button {
  all: unset; pointer-events: auto; box-sizing: border-box; cursor: pointer; flex: 1 1 auto; text-align: center;
  padding: 7px 10px; border-radius: 9px; font: 500 12.5px/1 inherit;
  border: 1px solid var(--kc-trait); color: var(--kc-texte);
}
.kcol-pied button:hover { border-color: var(--kc-or); }
.kcol-pied .kcol-ok {
  background: color-mix(in srgb, var(--kc-or) 85%, transparent);
  color: #1F1B12; font-weight: 650; border-color: transparent;
}

/* ---------- poignée de redimensionnement ---------- */
.kcol-poignee {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
  cursor: col-resize; touch-action: none; z-index: 3;
}
.kcol-poignee::after {
  content: ""; position: absolute; top: 18%; bottom: 18%; left: 3px; width: 1px;
  background: currentColor; opacity: 0; transition: opacity .15s;
}
.kcol-poignee:hover::after { opacity: .5; }
body.kcol-glisse { cursor: col-resize; user-select: none; }

/* sur un écran tactile, la poignée gêne plus qu'elle n'aide, et tout ce qui
   se touche doit faire au moins 32 px : cases, curseurs et boutons. */
@media (hover: none) {
  .kcol-poignee { display: none; }
  .kcol-ligne { grid-template-columns: minmax(0,1fr) 82px 40px; min-height: 40px; }
  .kcol-case { min-height: 40px; }
  .kcol-case input { width: 24px; height: 24px; }
  .kcol-larg { height: 32px; width: 82px; }
  .kcol-pied button { min-height: 40px; }
  .kcol-btn { min-height: 38px; padding: 9px 13px; }
  .kcol-panneau { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .kcol-btn { transition: none; }
}

/* Conteneur de tableau qui defile dans un panneau en verre : sa propre couche
   de composition, sinon WebKit laisse l'ancien rendu sous le nouveau et le
   tableau apparait dedouble pendant le defilement. */
.kcol-stable {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: scroll-position;
}
.kcol-stable > table { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
