/* ==========================================================================
   GK Industries ERP — thème visuel
   Palette reprise directement du logo officiel (nuancier fourni) :
   brun foncé, brun clair/tan, vert, vert clair, orange, gris.
   Design volontairement sobre — pas d'effets superflus.
   ========================================================================== */

:root {
  --gk-brun-fonce: #171717;      /* barre latérale — noir neutre légèrement chaud */
  --gk-brun-marine: #262626;     /* survols dans la sidebar */
  --gk-brun-tan: #c99d66;        /* accent secondaire (badges, graphiques) */
  --gk-or: #b98f4c;              /* icônes de la sidebar, filets d'accent */
  --gk-vert: #2f9e2f;            /* accent principal — boutons, liens, actif */
  --gk-vert-clair: #8cbf43;
  --gk-vert-fond: #e8f5e6;
  --gk-orange: #f29221;          /* alertes / attention */
  --gk-orange-fond: #fdf1e2;
  --gk-gris: #7c7c7a;            /* texte secondaire */
  --gk-noir: #1c1c1b;            /* texte principal */
  --gk-gris-bordure: #ececea;
  --gk-gris-fond: #f6f6f4;       /* fond général */
  --gk-blanc: #ffffff;
  --gk-rouge: #d13b3b;
  --gk-sidebar-label: #e7e7e5;
  --gk-sidebar-section: #7d7d7a;
  --gk-rayon: 14px;             /* cartes/widgets */
  --gk-rayon-btn: 10px;         /* boutons, champs de formulaire */
  --gk-ombre: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* --- Icônes en traits (sprite core/_icones_sprite.html) --- */
.gk-icon {
  display: inline-block;
  vertical-align: -0.18em;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gk-icon--or { color: var(--gk-or); }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--gk-gris-fond);
  color: var(--gk-noir);
  font-size: 14px;
}

a { color: var(--gk-vert); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout général : sidebar + contenu --- */
.gk-app { display: flex; min-height: 100vh; }

.gk-sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--gk-brun-fonce);
  color: var(--gk-sidebar-label);
  display: flex;
  flex-direction: column;
  border-right: 1px solid #0d0d0d;
  transition: width 0.18s ease;
}

.gk-sidebar__marque {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.gk-sidebar__marque img { max-width: 100%; height: 46px; object-fit: contain; object-position: left; display: block; }
.gk-sidebar__marque small { display: block; font-weight: 400; font-size: 11px; color: #8a8a86; margin-top: 6px; }

.gk-sidebar__nav { padding: 14px 12px; flex: 1; }

.gk-sidebar__section-titre {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gk-sidebar-section);
  padding: 16px 12px 6px;
}
.gk-sidebar__section-titre:first-child { padding-top: 4px; }

.gk-sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--gk-sidebar-label);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.gk-sidebar__item:hover { background: var(--gk-brun-marine); text-decoration: none; color: #fff; }
.gk-sidebar__item.actif {
  background: #fff;
  color: var(--gk-vert);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(47, 158, 47, 0.28), 0 1px 3px rgba(0, 0, 0, 0.18);
}
.gk-sidebar__item .gk-icon { color: var(--gk-or); }
.gk-sidebar__item:hover .gk-icon { color: #e7c78f; }
.gk-sidebar__item.actif .gk-icon { color: var(--gk-vert); }

.gk-sidebar__icone { display: flex; align-items: center; justify-content: center; width: 20px; flex-shrink: 0; }

.gk-sidebar__reduire {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #cfcfcb;
  width: 28px; height: 28px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.gk-sidebar__reduire:hover { background: rgba(255,255,255,0.16); color: #fff; }

/* --- Sidebar rétractée (bureau) : icônes seules, libère la largeur pour le contenu --- */
.gk-sidebar--reduite { width: 72px; }
.gk-sidebar--reduite .gk-sidebar__marque { justify-content: center; padding: 16px 8px; }
.gk-sidebar--reduite .gk-sidebar__marque img,
.gk-sidebar--reduite .gk-sidebar__marque small { display: none; }
.gk-sidebar--reduite .gk-sidebar__label { display: none; }
.gk-sidebar--reduite .gk-sidebar__section-titre { display: none; }
.gk-sidebar--reduite .gk-sidebar__item { justify-content: center; padding: 12px; }
.gk-sidebar--reduite .gk-sidebar__footer { display: none; }
.gk-sidebar--reduite .gk-sidebar__reduire { transform: rotate(180deg); }

.gk-sidebar__footer {
  padding: 12px 18px;
  font-size: 10.5px;
  color: #6f6f6c;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* --- Zone principale --- */
.gk-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.gk-topbar {
  background: var(--gk-blanc);
  border-bottom: 1px solid var(--gk-gris-bordure);
  padding: 0 28px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.gk-topbar__titre { font-size: 20px; font-weight: 700; color: var(--gk-noir); }
.gk-topbar__fil { font-size: 12.5px; color: var(--gk-gris); }
.gk-horloge {
  font-size: 13px; font-weight: 600; color: var(--gk-noir);
  font-variant-numeric: tabular-nums; /* chiffres de largeur fixe : pas de tremblement à chaque seconde */
  background: var(--gk-fond-secondaire, #f4f1ec); border-radius: 6px; padding: 3px 8px;
}
.gk-horloge__sec { color: var(--gk-gris); font-weight: 400; }

.gk-topbar__icone-btn {
  background: none; border: none; cursor: pointer; color: var(--gk-gris);
  position: relative; padding: 4px; display: flex; align-items: center;
}
.gk-topbar__icone-btn:hover { color: var(--gk-noir); }

.gk-topbar__profil {
  display: flex; align-items: center; gap: 9px;
  color: var(--gk-noir); text-decoration: none; font-size: 13px;
}
.gk-topbar__profil:hover { text-decoration: none; }
.gk-topbar__nom { font-weight: 500; }
.gk-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1e1e1e; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.3px; flex-shrink: 0;
}

.gk-contenu { padding: 26px 28px; flex: 1; max-width: 1240px; margin: 0 auto; width: 100%; }

/* --- Barre d'actions en haut d'une page de liste --- */
.gk-page-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.gk-page-actions--haut { align-items: flex-start; }
.gk-page-actions > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.gk-page-actions > p { margin: 0; }
/* quand il n'y a qu'un seul groupe, il se colle à droite */
.gk-page-actions > div:only-child { margin-left: auto; }
.gk-page-intro { font-size: 12.5px; color: var(--gk-gris); margin: 0; max-width: 640px; line-height: 1.5; }

/* Lien "← Retour ..." en haut d'une fiche : discret, pas un gros bouton */
.gk-detail-retour {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gk-gris);
  background: none;
  border: none;
  padding: 4px 2px;
  margin-bottom: 14px;
}
.gk-detail-retour:hover { color: var(--gk-noir); text-decoration: none; }
.gk-detail-retour .gk-icon { color: currentColor; }

/* Bloc d'infos d'une fiche : lignes "Libellé : valeur" alignées en colonnes,
   avec séparateurs — à la place d'une pile de <p><strong>. */
.gk-carte--infos p:has(> strong) {
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid #f1f1ef;
  font-size: 13.5px;
  display: flex;
  gap: 14px;
  align-items: baseline;
}
.gk-carte--infos p:has(> strong):last-of-type { border-bottom: none; }
.gk-carte--infos p > strong {
  color: var(--gk-gris);
  font-weight: 600;
  font-size: 12px;
  text-transform: none;
}
.gk-carte--infos p > strong:first-child { flex: 0 0 132px; }
@media (max-width: 600px) {
  .gk-carte--infos p:has(> strong) { flex-direction: column; gap: 1px; padding: 7px 0; }
  .gk-carte--infos p > strong:first-child { flex-basis: auto; }
}

/* --- Boutons --- */
.gk-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--gk-rayon-btn);
  border: 1px solid var(--gk-gris-bordure);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--gk-blanc);
  color: var(--gk-noir);
}
.gk-btn:hover { background: var(--gk-gris-fond); text-decoration: none; }
.gk-btn .gk-icon { color: currentColor; }
.gk-btn--sm { padding: 6px 12px; font-size: 12.5px; }

.gk-btn--primaire { background: var(--gk-vert); color: #fff; border-color: var(--gk-vert); }
.gk-btn--primaire:hover { background: #268226; color: #fff; }

.gk-btn--danger { color: var(--gk-rouge); border-color: var(--gk-rouge); background: #fff; }
.gk-btn--danger:hover { background: #fdecec; }

/* --- Cartes / KPI --- */
.gk-grille-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.gk-carte {
  background: var(--gk-blanc);
  border: 1px solid var(--gk-gris-bordure);
  border-radius: var(--gk-rayon);
  box-shadow: var(--gk-ombre);
  padding: 18px 20px;
}

.gk-carte__label {
  font-size: 11.5px;
  color: var(--gk-gris);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.gk-carte__valeur { font-size: 22px; font-weight: 700; color: var(--gk-noir); }
.gk-carte__valeur--accent { color: var(--gk-vert); }

/* Carte KPI avec badge d'icône sombre à gauche */
.gk-kpi { display: flex; gap: 14px; align-items: flex-start; }
.gk-kpi__ico {
  width: 42px; height: 42px; border-radius: 12px;
  background: #1e1e1e; color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.gk-kpi__corps { min-width: 0; }
.gk-kpi .gk-carte__label { margin-bottom: 4px; }

/* En-tête de widget : icône dans une pastille claire + titre */
.gk-widget__entete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.gk-widget__titre { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; }
.gk-widget__ico {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--gk-gris-fond); border: 1px solid var(--gk-gris-bordure);
  color: var(--gk-noir);
  display: flex; align-items: center; justify-content: center;
}

/* --- Raccourcis modules (tuiles) en haut du tableau de bord --- */
.gk-raccourcis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.gk-raccourci {
  background: var(--gk-blanc);
  border: 1px solid var(--gk-gris-bordure);
  border-radius: var(--gk-rayon);
  box-shadow: var(--gk-ombre);
  padding: 18px 10px 14px;
  text-align: center;
  color: var(--gk-noir);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.gk-raccourci:hover { text-decoration: none; border-color: #d6d6d2; transform: translateY(-1px); }
.gk-raccourci__icone {
  display: flex; align-items: center; justify-content: center;
  color: var(--gk-noir);
  padding-bottom: 8px;
  position: relative;
}
.gk-raccourci__icone::after {
  content: ""; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 18px; height: 2px; border-radius: 2px; background: var(--gk-or);
}
.gk-raccourci__label { font-size: 12px; font-weight: 600; margin-top: 4px; }

/* --- Widgets du tableau de bord : même taille pour tous, quel que soit
       le volume d'information affiché --- */
.gk-widgets-grille {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}
.gk-widget {
  min-height: 300px;
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* --- Tableaux type vue liste --- */
.gk-table-wrap {
  background: var(--gk-blanc);
  border: 1px solid var(--gk-gris-bordure);
  border-radius: var(--gk-rayon);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--gk-ombre);
}

table.gk-table { width: 100%; border-collapse: collapse; }

.gk-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--gk-gris);
  background: #fafafa;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gk-gris-bordure);
}

.gk-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f1ef;
  font-size: 13.5px;
}

.gk-table tr:last-child td { border-bottom: none; }
.gk-table tbody tr:hover { background: #fafafa; }

.gk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.gk-badge--brouillon { background: #eeece9; color: var(--gk-gris); }
.gk-badge--validee { background: var(--gk-vert-fond); color: #237a20; }
.gk-badge--attente { background: var(--gk-orange-fond); color: #a8620f; }

/* --- Formulaires --- */
.gk-form { max-width: 640px; background: var(--gk-blanc);
  border: 1px solid var(--gk-gris-bordure);
  border-radius: var(--gk-rayon); padding: 24px; box-shadow: var(--gk-ombre); }

.gk-champ { margin-bottom: 16px; }
.gk-champ label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gk-gris); margin-bottom: 5px; }
.gk-champ input, .gk-champ select, .gk-champ textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--gk-gris-bordure);
  border-radius: var(--gk-rayon-btn);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--gk-gris-fond);
}
.gk-champ input, .gk-champ select, .gk-champ textarea { background: #fbfbfa; }
.gk-champ input:focus, .gk-champ select:focus, .gk-champ textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--gk-vert);
  box-shadow: 0 0 0 3px rgba(47, 158, 47, 0.14);
}
.gk-champ .errorlist { color: var(--gk-rouge); font-size: 12px; margin: 4px 0 0; padding: 0; list-style: none; }

/* --- Grille de formulaire compacte (2-3 colonnes selon la largeur
   d'écran, façon Odoo) — remplace l'empilement vertical d'un champ par
   ligne qui rendait les formulaires trop longs. --- */
.gk-champs-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 24px;
}
.gk-champs-grille .gk-champ { margin-bottom: 12px; }
.gk-champ--pleine-largeur { grid-column: 1 / -1; }
.gk-champs-grille .gk-champ:has(textarea) { grid-column: 1 / -1; }

/* --- Onglets légers (CSS + petit script) — pour scinder une fiche
   longue (facture, devis...) en sections consultées une par une,
   plutôt qu'un long défilement. --- */
.gk-onglets-barre {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gk-gris-bordure);
  margin-bottom: 18px;
  overflow-x: auto;
}
.gk-onglet-bouton {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gk-gris);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
}
.gk-onglet-bouton:hover { color: var(--gk-noir); }
.gk-onglet-bouton.gk-onglet-actif { color: var(--gk-vert); border-bottom-color: var(--gk-vert); }
.gk-onglet-panneau { display: none; }
.gk-onglet-panneau.gk-onglet-actif { display: block; }

/* Onglets qui sont de vrais liens (une page par onglet) — même look que
   les onglets légers ci-dessus, sans passer par leur script. */
.gk-onglets-liens {
  display: flex; gap: 4px; border-bottom: 1px solid var(--gk-gris-bordure);
  margin-bottom: 18px; overflow-x: auto;
}
.gk-onglets-liens a {
  padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--gk-gris);
  border-bottom: 2.5px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.gk-onglets-liens a:hover { color: var(--gk-noir); text-decoration: none; }
.gk-onglets-liens a.gk-onglet-actif { color: var(--gk-vert); border-bottom-color: var(--gk-vert); }
.gk-pastille {
  background: var(--gk-rouge); color: #fff; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* --- Ruban de statut diagonal (ex: "PAYÉ"), façon Odoo --- */
.gk-ruban-conteneur { position: relative; overflow: hidden; }
.gk-ruban {
  position: absolute; top: 14px; right: -38px; width: 150px;
  transform: rotate(45deg); text-align: center; padding: 4px 0;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--gk-blanc); background: var(--gk-vert);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.gk-ruban--rouge { background: var(--gk-rouge); }
.gk-ruban--orange { background: var(--gk-orange); }

/* --- Lignes de tableau plus compactes (formulaires de lignes facture/
   devis/produits) — moins de hauteur par ligne, alignement vertical
   propre même avec plusieurs champs par ligne. --- */
.gk-table--compact td { padding: 6px 10px; }
.gk-table--compact input, .gk-table--compact select {
  padding: 6px 8px; font-size: 13px; border-radius: 6px;
}

.gk-actions-form { display: flex; gap: 8px; margin-top: 20px; }

/* --- Facture imprimable --- */
.gk-facture-doc {
  background: var(--gk-blanc);
  border: 1px solid var(--gk-gris-bordure);
  border-radius: var(--gk-rayon);
  padding: 32px;
  max-width: 800px;
}
.gk-facture-doc__entete { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.gk-facture-doc__entete img { height: 52px; object-fit: contain; }
.gk-facture-doc h1 { font-size: 20px; margin: 0 0 4px; }
.gk-facture-lignes { width: 100%; border-collapse: collapse; margin: 20px 0; }
.gk-facture-lignes th { text-align: left; font-size: 12px; color: var(--gk-gris); border-bottom: 2px solid var(--gk-noir); padding: 6px 8px; }
.gk-facture-lignes td { padding: 8px; border-bottom: 1px solid var(--gk-gris-bordure); font-size: 13.5px; }
.gk-facture-totaux { margin-left: auto; width: 260px; }
.gk-facture-totaux div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13.5px; }
.gk-facture-totaux .total { font-weight: 700; font-size: 16px; border-top: 2px solid var(--gk-noir); margin-top: 6px; padding-top: 8px; }
.gk-dgi-encadre {
  margin-top: 20px; padding: 12px 16px; background: var(--gk-gris-fond);
  border: 1px dashed var(--gk-gris-bordure); border-radius: var(--gk-rayon); font-size: 12px; color: var(--gk-gris);
}

.gk-vide {
  text-align: center;
  padding: 40px 20px;
  color: var(--gk-gris);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Garde-fou anti-débordement horizontal : rien ne doit pousser la page
   sur le côté sur mobile — les éléments larges (tableaux, blocs de code)
   défilent DANS leur propre conteneur, pas la page entière. */
html, body { max-width: 100%; }
.gk-main { min-width: 0; overflow-x: hidden; }
.gk-contenu { min-width: 0; }
.gk-contenu img, .gk-contenu video, .gk-contenu canvas { max-width: 100%; height: auto; }
.gk-contenu pre { overflow-x: auto; }

.gk-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}

@media (max-width: 900px) {
  .gk-app { flex-direction: column; }

  .gk-sidebar { width: 100%; flex-direction: row; align-items: center; padding: 0; }
  .gk-sidebar__marque { border-bottom: none; padding: 10px 16px; flex: 1; }
  .gk-sidebar__marque img { height: 32px; }
  .gk-menu-toggle { display: block; }
  .gk-sidebar__reduire { display: none; }

  .gk-sidebar__nav {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--gk-brun-fonce);
    z-index: 50;
    padding: 8px;
  }
  .gk-sidebar__nav.gk-ouvert { display: flex; }
  .gk-sidebar__footer { display: none; }

  .gk-topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; min-height: 0; }
  .gk-topbar__titre { font-size: 17px; }
  .gk-topbar__nom { display: none; }
  .gk-contenu { padding: 14px; }

  .gk-grille-kpi { grid-template-columns: 1fr 1fr; }
  table.gk-table { font-size: 12.5px; }
  .gk-table th, .gk-table td { padding: 8px 10px; }

  .gk-form { max-width: 100%; padding: 16px; }

  .gk-widgets-grille { grid-template-columns: 1fr; }
  .gk-widget { max-height: none; }

  /* Facture / devis imprimable : le doc scrolle en interne, la page non */
  .gk-facture-doc { max-width: 100%; padding: 16px; overflow-x: auto; }
  .gk-facture-doc__entete { flex-direction: column; gap: 12px; }
  .gk-facture-doc__entete img { height: 40px; }
  .gk-facture-lignes { min-width: 460px; }
  .gk-facture-totaux { width: 100%; }

  /* Onglets : défilent horizontalement plutôt que de casser la mise en page */
  .gk-onglets-barre { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .gk-onglet-bouton { white-space: nowrap; flex-shrink: 0; }

  /* Barre d'actions de page : les groupes passent à la ligne proprement */
  .gk-page-actions { gap: 8px; }
  .gk-page-actions > div { width: 100%; }
  .gk-page-actions > div:only-child { margin-left: 0; }

  /* Cibles tactiles un peu plus grandes */
  .gk-btn { padding: 10px 14px; }
}

@media (max-width: 600px) {
  .gk-grille-kpi { grid-template-columns: 1fr; }
  .gk-carte__valeur { font-size: 19px; }
  .gk-topbar__fil { display: none; }               /* la date, place gagnée */
  .gk-horloge__sec { display: none; }              /* sur téléphone : HH:MM seulement */
  .gk-champs-grille { grid-template-columns: 1fr; gap: 0 12px; }
  /* boutons pleine largeur dans les barres d'action de fiche/formulaire */
  .gk-actions-form .gk-btn, .gk-page-actions .gk-btn { flex: 1 1 auto; justify-content: center; }
}

/* --- Lignes de facture/devis en cartes empilées sur mobile — un
   tableau large avec beaucoup de colonnes est illisible sur petit
   écran, chaque ligne devient une carte avec ses champs les uns sous
   les autres, étiquetés. --- */
@media (max-width: 700px) {
  #table-lignes thead { display: none; }
  #table-lignes, #table-lignes tbody, #table-lignes tr, #table-lignes td {
    display: block; width: 100%; box-sizing: border-box;
  }
  .gk-table-wrap--lignes { overflow: visible; border: none; box-shadow: none; background: none; }
  #table-lignes tr.ligne-formset {
    border: 1px solid var(--gk-gris-bordure);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--gk-blanc);
  }
  #table-lignes tr.ligne-formset td {
    padding: 6px 0;
    border: none;
  }
  #table-lignes tr.ligne-formset td:before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--gk-gris);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  #table-lignes tr.ligne-formset input, #table-lignes tr.ligne-formset select {
    width: 100%; box-sizing: border-box;
    padding: 11px 12px; font-size: 15px;   /* ≥16px évite le zoom auto iOS ; 15 + line-height reste net */
  }
  #table-lignes tr.ligne-details-formset td { padding: 0; border: none; }
  #table-lignes tr.ligne-details-formset td:before { display: none; }

  /* Colonne produit : la min-width de bureau (180px) est neutralisée,
     et la liste de suggestions s'ancre sous le champ (au lieu du
     position:fixed calculé en JS qui saute quand le clavier s'ouvre). */
  #table-lignes .cellule-produit { min-width: 0; }
  #table-lignes .liste-suggestions-produit,
  #liste-suggestions-client {
    position: absolute !important;
    left: 0 !important;
    top: 100% !important;
    width: 100% !important;
    max-height: 40vh;
  }

  /* Grille de champs (entête facture/devis) : une colonne, pleine largeur */
  .gk-champs-grille { grid-template-columns: 1fr; }
  .gk-champs-grille input, .gk-champs-grille select, .gk-champs-grille textarea { font-size: 15px; }
}
