/* Listes Clients / Fournisseurs / Produits et fiches client / produit (app.js, fiches.js) */

/* Onglets Clients | Fournisseurs (en-tête, à droite, comme MonPOS) */
.ct-onglets{margin-right:var(--esp-2)}
.ct-onglets button{white-space:nowrap}

/* Tableaux sur une ligne : nom (couleur lien) + pastilles, WhatsApp sous le téléphone */
.ct-table td{white-space:nowrap}
.ct-table td,.ct-table th{padding-left:8px;padding-right:8px}
.ct-table td:first-child,.ct-table th:first-child{padding-left:12px}
.ct-nom{display:flex;align-items:center;gap:6px;min-width:0}
.ct-nom b{overflow:hidden;text-overflow:ellipsis;max-width:32ch}
.ct-lien{color:var(--cuivre-fonce,var(--copper));font-weight:var(--g-fort)}
tr.click:hover .ct-lien{text-decoration:underline}
.ct-wa{color:var(--ok)!important}
.ct-payer{font-size:var(--t-petit);margin-left:4px}
.ct-vide{display:inline-block;width:30px;flex:none}
.ct-table .actions{justify-content:flex-end}

/* Produits : nom et catégorie sur une ligne (coupés avec « … » si trop longs), stock + bouton ± */
.pr-table td{white-space:nowrap}
.pr-nom{min-width:0}
.pr-nom b{display:block;overflow:hidden;text-overflow:ellipsis;max-width:27ch}
.pr-table td,.pr-table th{padding-left:8px;padding-right:8px}
.pr-table td:first-child,.pr-table th:first-child{padding-left:12px}
.pr-cat{max-width:150px;overflow:hidden;text-overflow:ellipsis;font-size:var(--t-petit);text-transform:uppercase;letter-spacing:.02em}
.pr-stock{display:inline-flex;align-items:center;gap:6px;justify-content:flex-end}
.pr-stock .stk{font-size:var(--t-texte);color:var(--ink)}
.pr-stock .stk.low{color:var(--warn)}
.pr-stock .stk.zero{color:var(--bad);font-weight:var(--g-fort)}
.btn.ico.pr-pm{width:24px;min-height:24px;height:24px;font-weight:var(--g-fort);font-size:var(--t-petit)}
.btn.ico.pr-suppr{color:var(--bad)}
.pr-table .actions{justify-content:flex-end}
.pr-inactifs{white-space:nowrap;font-size:var(--t-petit)}

/* Fiches (sous-pages) */
.fi-page{display:flex;flex-direction:column;gap:var(--esp-3)}
.fi-etats{display:flex;gap:6px;margin-bottom:-4px;flex-wrap:wrap;align-items:center;min-width:0} /* sur téléphone : les pastilles passent à la ligne au lieu de pousser la page hors de l’écran */
.fi-kpis{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))!important;align-items:stretch}
.fi-kpis .kpi{min-height:0}
.fi-kpis .val,.fi-kpis .sub{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fi-kpis .val small{font-size:.6em;font-weight:var(--g-normal);color:var(--muted)}
.fi-alerte{background:color-mix(in srgb,var(--bad-soft) 60%,var(--panel))}
.fi-grille{display:grid;gap:var(--esp-3);align-items:start}
.fi-haut{grid-template-columns:minmax(260px,320px) minmax(0,1fr)}
.fi-bas{grid-template-columns:minmax(0,1.25fr) minmax(0,1fr)}
.fi-moitie{grid-template-columns:repeat(2,minmax(0,1fr))}
.fi-page .panel{padding:12px 14px;min-width:0}
.fi-page .panel-h{display:flex;align-items:center;justify-content:space-between;gap:var(--esp-2);margin-bottom:8px}
.fi-page .panel-h .row{gap:6px;flex-wrap:nowrap}
.fi-page .stack{gap:var(--esp-3)}
.fi-liste{display:flex;flex-direction:column}
.fi-li{display:flex;justify-content:space-between;gap:var(--esp-3);padding:5px 0;border-bottom:1px solid var(--line);font-size:var(--t-petit)}
.fi-li:last-child{border-bottom:0}
.fi-li span{color:var(--muted);white-space:nowrap}
.fi-li b{font-weight:var(--g-normal);text-align:right;min-width:0;overflow-wrap:anywhere}
.fi-note{margin:8px 0 0;padding:8px 10px;border-radius:var(--r-btn);background:var(--panel2);font-size:var(--t-petit);white-space:pre-wrap}
.fi-table td{white-space:nowrap}
.fi-table td.fi-coupe{max-width:220px;overflow:hidden;text-overflow:ellipsis}
.fi-table tr.fi-total td{font-weight:var(--g-fort);border-top:2px solid var(--line)}
.fi-table tr.fi-total td .num{font-weight:var(--g-fort)}
.fi-vide{margin:0;padding:10px 0;text-align:center;color:var(--muted);font-size:var(--t-petit)}
.fi-page .tw{overflow-x:auto}

/* En-tête de la fiche produit : photo + référence, catégorie, code-barres */
.fp-tete{display:flex;align-items:center;gap:var(--esp-3)}
.vignette.fp-photo{width:72px;height:72px}
.vignette.fp-photo svg{width:28px;height:28px}
.fp-id{display:flex;flex-direction:column;gap:4px;min-width:0}
.fp-ligne{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px}
.fp-ref{font-weight:var(--g-fort)}
.fp-cat{font-size:var(--t-petit);text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}

@media (max-width:1100px){.fi-haut,.fi-bas{grid-template-columns:minmax(0,1fr)}}
@media (max-width:760px){.fi-moitie{grid-template-columns:minmax(0,1fr)}.fp-photo{width:56px;height:56px}}
.fi-table td.fi-large{max-width:380px}
.fi-table td.fi-petit{max-width:150px}
/* Liste Clients : jamais plus large que la page — la liste de prix devient une petite icône (nom au survol),
   la colonne Échéance disparaît sur les écrans moyens (elle reste dans la fiche client) */
.ct-table .lp-pill{font-size:0;gap:0;padding:3px 6px}
.ct-table .lp-pill svg{width:12px;height:12px}
.ct-nom b{max-width:26ch}
@media (max-width:1500px){.ct-table th:nth-child(6),.ct-table td:nth-child(6){display:none}}
/* Espace client (fiche client) : dernières activités */
.ec-journal{margin-top:10px}
.ec-journal summary{cursor:pointer}
.ec-journal ul{margin:6px 0 0;padding-left:18px;font-size:var(--t-petit);display:flex;flex-direction:column;gap:2px}
/* Section mise en évidence quand on y arrive par le bouton du haut */
.fc-flash{box-shadow:0 0 0 3px var(--copper);transition:box-shadow .3s}
/* logo du client (section Espace client de la fiche) */
.ec-logo{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 14px;border-bottom:1px solid var(--line)}
.ec-logo-apercu{width:120px;height:48px;display:flex;align-items:center;justify-content:center;background:var(--side);border:1px solid var(--line);border-radius:6px;flex:none}
.ec-logo-apercu .muted{color:#b9c2c6}
.ec-logo-apercu img{max-width:110px;max-height:40px;display:block}
.ec-logo-t{display:flex;flex-direction:column;gap:2px;flex:1;min-width:180px}
/* Page « Espace client » (menu Clients) */
.ea-client{all:unset;cursor:pointer;font-weight:var(--g-fort);color:var(--copper)}
.ea-client:hover,.ea-client:focus-visible{color:var(--copper);text-decoration:underline}
.ea-table td{vertical-align:middle}
/* Même espacement que les autres pages (la page est dans un cadre #eaPage, hors de la grille de .content) */
#eaPage{display:flex;flex-direction:column;gap:var(--esp-4)}
@media (max-width:640px){#eaPage{gap:var(--esp-3)}}
#eaPage .ec-journal{margin-top:0}
/* Accès : droits et identifiant (numéro, e-mail) l'un sous l'autre, pour que le tableau tienne sans défiler */
.ec-l{display:block;line-height:1.35}
.ec-mail{overflow-wrap:break-word}
.ea-table{table-layout:auto;width:100%}
.ea-table th,.ea-table td{white-space:normal}
.ea-table td:last-child{white-space:nowrap;width:1%}
/* ---------- Téléphone : fiches client / produit et page Espace client ---------- */
@media (max-width:760px){
  .fi-page .panel{padding:12px}
  .fi-page .panel-h{flex-wrap:wrap;align-items:flex-start}
  .fi-page .panel-h .row{flex-wrap:wrap;justify-content:flex-start}
  .fi-page .panel-h .row .btn{min-height:38px}
  .fi-page .fi-li{font-size:var(--t-texte);padding:7px 0}
  .fi-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .ec-logo{padding:10px 0}
  .ec-logo .row .btn{min-height:38px}
  .ec-logo-t{min-width:0;flex:1 1 140px}
  #eaPage .filtres .seg{flex:1 1 100%}
  #eaPage .head>.row .btn{min-height:40px}
}
@media (max-width:760px){.fi-kpis .sub,.fi-kpis .val{white-space:normal;overflow-wrap:anywhere}}
@media (max-width:760px){.fi-page .tw.cartes-tel{margin:0 -12px}}
@media (max-width:400px){.fi-kpis .val{font-size:1.15rem}}
/* Téléphone : boutons du bas des fiches en grille compacte (3 par ligne) pour laisser la place au contenu */
@media (max-width:760px){
  .modal.souspage .fi-page+.sheet-f{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
  .modal.souspage .fi-page+.sheet-f>.btn{min-height:42px;margin:0;padding:6px 6px;font-size:var(--t-petit);white-space:normal;line-height:1.15;text-align:center;justify-content:center;gap:5px;width:auto}
  .modal.souspage .fi-page+.sheet-f>.btn svg{flex:none}
  .modal.souspage .fi-page+.sheet-f>.btn.pri{grid-column:1/-1}
  .fi-kpis .kpi{padding:10px 12px}
}
@media (max-width:760px){.cartes-tel>table.ea-table>tbody>tr>td:first-child .ea-client{font-size:var(--t-texte)}}
/* Téléphone couché, tablette (761–1100 px) : page Espace client sans la colonne Connexion pour tenir sans défiler */
@media (min-width:761px) and (max-width:1100px){.ea-table th:nth-child(6),.ea-table td:nth-child(6){display:none}.ea-table .ec-mail{overflow-wrap:anywhere}}
/* Connexions et sécurité (espace client) : l'historique passe à la ligne au lieu de déborder ; adresse IPv6 coupée si besoin */
.ec-hist .fi-table td{white-space:normal}
.ec-hist .fi-table td.ec-ip{overflow-wrap:anywhere;max-width:170px}
.ea-bloc h2 .ea-client{font-size:inherit}
/* Page Espace client : un client = une ligne repliée, ouverte d'un clic */
.ea-ligne{display:flex;align-items:center;gap:10px;flex-wrap:wrap;width:100%;text-align:left;font:inherit;color:inherit;cursor:pointer;padding:9px 14px;margin:0 0 6px}
.ea-ligne:hover{border-color:var(--copper)}
.ea-ligne b{font-weight:var(--g-fort)}
.ea-chev{color:var(--copper);font-weight:700;width:12px}
.ea-replier{all:unset;cursor:pointer;color:var(--copper);margin-right:8px;padding:0 4px}
