/* =============================================================
   SEB Gestion — composants de l'application
   ============================================================= */

/* ---------- Écran de connexion ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.login-card { background: var(--card); border-radius: var(--seb-r-lg); box-shadow: var(--seb-sh-pop); padding: 2.4rem; width: 100%; max-width: 410px; }
.login-brand { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.6rem; }
.logo-mark { background: var(--accent); color: var(--on-accent); font-weight: 700; letter-spacing: .5px; width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; border-radius: 14px; font-size: 1.25rem; flex-shrink: 0; }
.login-brand h1 { font-size: 1.25rem; }
.login-brand p { margin: 0.15rem 0 0; color: var(--ink-soft); font-size: 0.82rem; }
.login-note { font-size: 0.78rem; color: var(--ink-soft); margin-top: 1.1rem; background: var(--paper); padding: 0.6rem 0.75rem; border-radius: 10px; }
.login-error { color: var(--err-txt); background: var(--err-bg); border-radius: 8px; padding: 0.5rem 0.7rem; font-size: 0.84rem; margin-top: 0.8rem; display: none; }
.login-error.show { display: block; }

/* ---------- Boutons / champs ---------- */
.btn { border: none; border-radius: var(--seb-r-pill); padding: 0.6rem 1.05rem; font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 0.45rem; transition: transform .1s ease, background .15s ease, box-shadow .2s ease; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--card-2); }
.btn-block { width: 100%; justify-content: center; }

.input { width: 100%; padding: 0.62rem 0.8rem; border: 1px solid var(--line-strong); border-radius: var(--seb-r-md); font-family: inherit; font-size: 0.92rem; background: var(--card); color: var(--ink); transition: border-color .15s ease, box-shadow .15s ease; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--seb-focus); }
.field-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); margin: 0.85rem 0 0.3rem; }

/* ---------- Structure app : sidebar + contenu ---------- */
.app-shell { display: none; min-height: 100vh; }
.app-shell.on { display: flex; }

.sidebar { width: 232px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 1rem 0.8rem; }
.sb-brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.3rem 0.5rem 1rem; }
.sb-brand .logo-mark { width: 40px; height: 40px; border-radius: 11px; font-size: 1rem; }
.sb-brand-t b { display: block; font-size: 0.95rem; line-height: 1.2; }
.sb-brand-t span { font-size: 0.72rem; color: var(--ink-soft); }

.sb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sb-item { display: flex; align-items: center; gap: 0.65rem; padding: 0.58rem 0.75rem; border: none; background: none; border-radius: 10px; font-family: inherit; font-size: 0.9rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; text-align: left; }
.sb-item .lic { font-size: 1.1em; }
.sb-item:hover { background: var(--card-2); color: var(--ink); }
.sb-item.active { background: var(--accent); color: var(--on-accent); box-shadow: 0 2px 10px -3px color-mix(in srgb, var(--accent) 50%, transparent); }
.sb-item .soon { margin-left: auto; font-size: 0.62rem; font-weight: 700; letter-spacing: .4px; background: var(--card-2); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 999px; padding: 0.1rem 0.42rem; }
.sb-item.active .soon { background: color-mix(in srgb, var(--on-accent) 20%, transparent); border-color: transparent; color: var(--on-accent); }

.sb-foot { border-top: 1px solid var(--line); padding-top: 0.7rem; display: flex; gap: 0.4rem; }
.icon-btn { background: var(--card-2); border: 1px solid var(--line); border-radius: 9px; width: 36px; height: 36px; font-size: 1rem; cursor: pointer; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { border-color: var(--accent); }
.sb-user { flex: 1; display: flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; color: var(--ink-soft); min-width: 0; }
.sb-user b { color: var(--ink); font-size: 0.8rem; display: block; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { flex: 1; min-width: 0; padding: 1.4rem 1.8rem 3rem; }
.view { display: none; }
.view.on { display: block; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.view-head h2 { font-size: 1.35rem; }
.view-head .sub { color: var(--ink-soft); font-size: 0.85rem; margin-top: 0.15rem; }

/* ---------- Cartes / métriques ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--seb-r-lg); padding: 1.1rem 1.2rem; box-shadow: var(--seb-sh-card); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.9rem; margin-bottom: 1.2rem; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--seb-sh-1); }
.metric .v { font-size: 1.7rem; font-weight: 700; color: var(--accent); line-height: 1.15; }
.metric .k { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.35rem; }

.placeholder-card { text-align: center; padding: 3rem 1.5rem; color: var(--ink-soft); }
.placeholder-card .lic { font-size: 2rem; color: var(--accent); }
.placeholder-card h3 { margin: 0.6rem 0 0.3rem; color: var(--ink); }

/* ---------- Toolbar de module ---------- */
.toolbar { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search-wrap .lic { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.search-wrap .input { padding-left: 2.2rem; border-radius: var(--seb-r-pill); }
.toolbar .count { font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap; }

/* ---------- Tableau générique ---------- */
.gc-table { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--seb-sh-1); }
.gc-tr { display: grid; align-items: center; gap: 0.8rem; padding: 0.65rem 1rem; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.gc-tr:last-child { border-bottom: none; }
.gc-tr.head { background: var(--card-2); font-weight: 700; color: var(--ink-soft); font-size: 0.74rem; text-transform: uppercase; letter-spacing: .4px; cursor: default; }
.gc-tr:not(.head) { cursor: pointer; }
.gc-tr:not(.head):hover { background: var(--card-2); }
.gc-empty { padding: 2.2rem; text-align: center; color: var(--ink-soft); }
.tr-clients { grid-template-columns: 104px 1.6fr 1.5fr 58px 1fr 1fr 0.9fr; }
/* Empêche un code long (ex. FERMGRPRE) de déborder sur la raison sociale */
.tr-clients > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* En-têtes triables */
.gc-tr.head .sort-h { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 0.25rem; }
.gc-tr.head .sort-h:hover { color: var(--ink); }
.gc-tr.head .sort-h.active { color: var(--accent); }
.gc-tr.head .sort-h.num { justify-content: flex-end; }
.gc-tr.head .sort-h .arrow { font-style: normal; font-size: 0.62rem; line-height: 1; min-width: 0.7em; }

/* ---------- Badges ---------- */
.badge { font-size: 0.72rem; font-weight: 700; padding: 0.16rem 0.55rem; border-radius: 999px; display: inline-block; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok-txt); }
.badge.warn { background: var(--warn-bg); color: var(--warn-txt); }
.badge.err { background: var(--err-bg); color: var(--err-txt); }
.badge.off { background: var(--card-2); color: var(--ink-soft); border: 1px solid var(--line); }
.badge.web { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---------- Modale ---------- */
.gc-modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.gc-modal-backdrop { position: absolute; inset: 0; background: rgba(10, 20, 35, .45); }
.gc-modal-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--seb-r-lg); box-shadow: var(--seb-sh-pop); max-width: 660px; width: 100%; max-height: 90vh; overflow: auto; padding: 1.6rem; z-index: 1; }
.gc-modal-card.wide { max-width: 860px; }
.gc-modal-close { position: absolute; top: 0.9rem; right: 0.9rem; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Fiche client ---------- */
.cf-head { display: flex; align-items: flex-start; gap: 0.9rem; margin-bottom: 1rem; padding-right: 2.4rem; }
.cf-head h3 { font-size: 1.2rem; line-height: 1.25; }
.cf-code { font-size: 0.78rem; color: var(--ink-soft); font-weight: 600; margin-top: 0.15rem; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.7rem 1.1rem; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem 1rem; margin-bottom: 1.1rem; }
.cf-grid .cf-k { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); margin-bottom: 0.1rem; }
.cf-grid .cf-v { font-size: 0.88rem; font-weight: 600; }
.cf-section { margin-top: 1.2rem; }
.cf-section h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); margin-bottom: 0.55rem; }
.tr-factures { grid-template-columns: 1fr 1fr 1fr 1fr; }
.tr-achats { grid-template-columns: 1.8fr 1.3fr 1fr 1fr 0.8fr; }
.tr-cdocs { grid-template-columns: 110px 1.2fr 0.9fr 1fr 1fr; }
.tr-cart { grid-template-columns: 110px 2fr 0.9fr 1fr 0.8fr; }
.encours-bar { height: 7px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden; margin-top: 0.3rem; }
.encours-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.encours-bar.over i { background: var(--err-txt); }

/* ---------- Catalogue ---------- */
.tr-produits { grid-template-columns: 100px 1.9fr 1.1fr 70px 1.1fr; }
.tr-conds { grid-template-columns: 1.8fr 0.7fr 0.6fr 0.6fr 0.9fr 1fr 0.9fr; }
.tr-prix { grid-template-columns: 1.4fr 1.4fr 0.8fr 0.8fr 1fr; }
@media (max-width: 860px) {
  .tr-produits { grid-template-columns: 90px 1.6fr 1fr; }
  .tr-produits > :nth-child(n+4) { display: none; }
}

/* ---------- Divers documents ---------- */
.doc-client-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.doc-client-link:hover { text-decoration: underline; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; margin-top: 0.8rem; }
.choice-btn { background: var(--card-2); border: 1px solid var(--line-strong); border-radius: var(--seb-r-md); padding: 1rem; font-family: inherit; font-size: 0.95rem; font-weight: 700; color: var(--ink); cursor: pointer; text-align: center; }
.choice-btn:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--seb-focus); }
.choice-btn .muted { display: block; font-weight: 400; font-size: 0.76rem; margin-top: 0.2rem; }

/* ---------- Sélecteur client (autocomplétion) ---------- */
.cp-wrap { position: relative; }
.cp-list { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 70; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--seb-r-md); box-shadow: var(--seb-sh-pop); overflow: hidden; max-height: 320px; overflow-y: auto; }
.cp-row { padding: 0.5rem 0.8rem; font-size: 0.88rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.cp-row:last-child { border-bottom: none; }
.cp-row.hi { background: color-mix(in srgb, var(--accent) 12%, var(--card)); }

/* ---------- Onglets de type (Ventes) ---------- */
.v-tabs { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.v-tab { background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--seb-r-pill); padding: 0.42rem 0.95rem; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.v-tab:hover { border-color: var(--accent); color: var(--ink); }
.v-tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Ventes ---------- */
.tr-ventes { grid-template-columns: 110px 1fr 1.6fr 0.8fr 0.9fr 0.9fr; }
.tr-velines { grid-template-columns: 2fr 0.9fr 95px 115px 0.9fr 44px; }
/* Le tableau des lignes de l'éditeur ne doit PAS rogner le menu du
   sélecteur de lot (les .gc-table coupent par défaut pour leurs coins) */
#ve-lines.gc-table { overflow: visible; }
.ve-lot-err { border-color: var(--err-txt) !important; background: var(--err-bg); }
#ve-lines .gc-tr { overflow: visible; }
.gc-modal-card { overscroll-behavior: contain; }
.tr-dlines { grid-template-columns: 80px 1.9fr 0.9fr 0.55fr 0.8fr 0.8fr; }
.ve-addline { display: flex; gap: 0.6rem; margin-bottom: 0.5rem; align-items: stretch; }
.ve-port-row { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.ve-port-row .input { max-width: 120px; }
.ve-port-row .ve-port-btn { color: var(--ink); }
.ve-addline .cp-wrap { flex: 1; min-width: 0; }
.ve-prod-input { width: 100%; padding: 0.7rem 0.9rem; font-size: 0.95rem; }
.ve-qte-input { width: 110px; flex-shrink: 0; padding: 0.7rem 0.8rem; font-size: 0.95rem; text-align: right; }
#ve-condpick { margin-bottom: 0.6rem; }
.ve-condinfo { font-size: 0.84rem; color: var(--ink-soft); padding: 0.15rem 0.2rem 0.3rem; }
.ve-condchoices { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; padding: 0.15rem 0.2rem 0.3rem; }
.tr-velines .input { padding: 0.3rem 0.5rem; font-size: 0.85rem; text-align: right; }
.ve-totaux { display: flex; justify-content: flex-end; gap: 1.4rem; padding: 0.7rem 0.4rem 0; font-size: 0.92rem; align-items: center; }
.ve-totaux .ve-ttc { background: var(--accent); color: var(--on-accent); border-radius: var(--seb-r-pill); padding: 0.35rem 0.9rem; font-weight: 700; }
.ve-totaux .ve-ttc b { color: inherit; }
@media (max-width: 860px) {
  .tr-ventes { grid-template-columns: 90px 1.4fr 0.9fr; }
  .tr-ventes > :nth-child(2), .tr-ventes > :nth-child(4), .tr-ventes > :nth-child(6) { display: none; }
}

/* ---------- Règlements ---------- */
.tr-regl { grid-template-columns: 90px 1.6fr 0.8fr 1fr 0.9fr 0.9fr; }
.tr-lettr { grid-template-columns: 1fr 0.9fr 1fr 1fr; }
.tr-dues { grid-template-columns: 1.6fr 0.9fr 1fr 130px; }
.tr-dues .input { padding: 0.3rem 0.5rem; font-size: 0.85rem; text-align: right; }
.tr-remises { grid-template-columns: 90px 90px 0.9fr 1fr 0.9fr 1.4fr; }
.tr-nremise { grid-template-columns: 34px 90px 1.5fr 1.3fr 0.9fr; }
.tr-balance { grid-template-columns: 1.7fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr 1fr; }

/* ---------- Stock ---------- */
.tr-stock { grid-template-columns: 110px 2.4fr 0.8fr 1.4fr; }
.tr-lots { grid-template-columns: 1.4fr 1.4fr 0.7fr 1.4fr; }
.tr-mvts { grid-template-columns: 90px 2fr 1fr 0.7fr; }
/* Séparateur de groupe dans le tableau du stock (Boyaux / Autres) */
.st-groupe { padding: 0.5rem 1rem; background: var(--card-2); font-weight: 700; font-size: 0.76rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); border-bottom: 1px solid var(--line); }

/* ---------- Station d'impression (W2) ---------- */
#station-root { min-height: 100vh; padding: 1.4rem; background: var(--bg); }
.st-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.st-head h1 { font-size: 1.25rem; }
.st-head p { color: var(--ink-soft); font-size: 0.85rem; }
.st-auto { margin-left: auto; }
.st-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 760px) { .st-cols { grid-template-columns: 1fr; } }
.st-col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--seb-sh-1); }
.st-col h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); margin-bottom: 0.6rem; }
.st-list { display: flex; flex-direction: column; }
.st-job { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.st-job:last-child { border-bottom: none; }
.st-job-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.st-job-d { color: var(--ink-soft); font-size: 0.78rem; white-space: nowrap; }

/* ---------- Préparation mobile (W3) ---------- */
#prep-root { min-height: 100vh; padding: 0.9rem; background: var(--bg); max-width: 640px; margin: 0 auto; }
.pr-head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; }
.pr-head h1 { font-size: 1.15rem; }
.pr-head p { color: var(--ink-soft); font-size: 0.83rem; }
.pr-head .icon-btn:last-child { margin-left: auto; }
.pr-list { display: flex; flex-direction: column; gap: 0.6rem; }
.pr-card { display: flex; flex-direction: column; gap: 0.15rem; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; cursor: pointer; font-family: inherit; color: var(--ink); box-shadow: var(--seb-sh-1); }
.pr-card:active { transform: scale(0.99); }
.pr-card-num { font-weight: 800; font-size: 1.05rem; color: var(--accent); }
.pr-card-cli { font-weight: 700; font-size: 1rem; color: var(--ink); }
.pr-card-date { color: var(--ink-soft); font-size: 0.8rem; }
.pr-vide { text-align: center; padding: 3rem 1rem; font-size: 1.1rem; color: var(--ink-soft); line-height: 2; }
.pr-comm { background: var(--warn-bg); color: var(--warn-txt); border-radius: 10px; padding: 0.6rem 0.9rem; font-size: 0.86rem; margin-bottom: 0.8rem; }
.pr-astuce { color: var(--ink-soft); font-size: 0.85rem; margin-bottom: 0.7rem; }
.pr-scanbar { position: relative; margin-bottom: 0.8rem; }
.pr-scanbar .lic { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.pr-scan { width: 100%; padding: 0.9rem 1rem 0.9rem 2.5rem; font-size: 1.05rem; border-radius: 14px; border-width: 2px; }
.pr-scan:focus { border-color: var(--accent); }
.pr-vide-scan { text-align: center; padding: 2.2rem 1rem; color: var(--ink); font-size: 0.95rem; line-height: 1.8; }
.pr-warn { color: var(--warn-txt); font-weight: 700; font-size: 0.8rem; }
.pr-l-lot { display: block; font-size: 0.78rem; color: var(--accent); font-weight: 700; }
.pr-l-reste { display: block; font-size: 0.74rem; color: var(--ink-soft); }
.pr-l-reste.vide { color: var(--err-txt); font-weight: 700; }

/* ---------- P3 : réception de marchandise ---------- */
#rec-root { max-width: 680px; margin: 0 auto; padding: 0.8rem 0.9rem 5.5rem; }
.rc-form { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; }
.rc-photo-bloc { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0.9rem 1rem; margin-top: 0.7rem; }
.rm-hit {
  display: block; width: 100%; text-align: left; padding: 0.55rem 0.8rem;
  border: 1px solid var(--line); border-radius: 10px; margin-top: 0.3rem;
  background: var(--card); color: var(--ink); cursor: pointer; font-family: inherit; font-size: 0.9rem;
}
.rm-hit:hover { border-color: var(--accent); }
.tr-br { grid-template-columns: 0.8fr 0.9fr 1.6fr 0.6fr 1fr 0.5fr; }
.tr-brd { grid-template-columns: 0.9fr 2fr 1fr 0.9fr 0.6fr; }

/* ---------- P2 : traçabilité ---------- */
.tc-tabs { display: flex; gap: 0.4rem; margin-bottom: 0.9rem; }
.tc-tab {
  padding: 0.45rem 1rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  font-family: inherit; font-size: 0.85rem; font-weight: 700;
}
.tc-tab.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tc-entete { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.9rem 0 0.3rem; }
.tc-lotnum { font-size: 1.35rem; font-weight: 800; }
.tc-titre { margin: 1rem 0 0.4rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.tc-amont { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.tc-amont .info-b { flex: 1; min-width: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 0.5rem 0.7rem; background: var(--card); }
.tc-amont .k { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); font-weight: 700; }
.tc-amont .v { font-weight: 800; }
.tc-amont a, .tr-tcm a, .tr-tca a { color: var(--accent); text-decoration: none; font-weight: 700; }
.tr-tcm { grid-template-columns: 0.9fr 1.1fr 0.5fr 1.8fr 1fr; }

/* ---------- P4 : fabrication ---------- */
.fb-grille { display: flex; gap: 0.8rem; align-items: stretch; margin-top: 0.8rem; flex-wrap: wrap; }
.fb-col { flex: 1; min-width: 230px; border: 1px solid var(--line); border-radius: 14px; padding: 0.8rem 0.9rem; background: var(--card); }
.fb-col h4 { margin: 0 0 0.5rem; font-size: 0.85rem; }
.fb-fleche { align-self: center; font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.fb-recap { margin-top: 0.8rem; padding: 0.7rem 0.9rem; border: 1px dashed var(--line-strong); border-radius: 12px; line-height: 1.6; }
.fb-pb { color: var(--err-txt); font-weight: 700; }
.fb-perte { color: var(--warn-txt); font-weight: 700; }
.tr-fab { grid-template-columns: 0.6fr 0.8fr 2.2fr 1fr 1fr 0.9fr 0.9fr; }

/* ---------- P6 : logistique livreurs ---------- */
.tn-bandeau {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem;
  flex-wrap: wrap; margin-bottom: 0.7rem; padding: 0.7rem 0.9rem;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
}
.tr-tourn { grid-template-columns: 0.7fr 1.6fr 1.2fr 0.8fr 1.4fr; }
.tr-tourn .tn-sel { padding: 0.35rem 0.5rem; font-size: 0.85rem; width: 100%; }
.tr-paie { grid-template-columns: 1.6fr 1fr 1fr 0.8fr 1fr; }
.pa-hors {
  margin-top: 0.6rem; padding: 0.6rem 0.85rem; font-size: 0.85rem; color: var(--ink-soft);
  border: 1px dashed var(--line-strong); border-radius: 12px;
}
.pa-hors .pa-lien { color: var(--ink); cursor: pointer; text-decoration: underline dotted; }
.tr-paied { grid-template-columns: 0.9fr 0.8fr 1.8fr 0.8fr; }
.tr-enc { grid-template-columns: 0.8fr 0.7fr 1.5fr 1fr 0.9fr 0.7fr 1.4fr; }
.ab-ligne {
  display: flex; justify-content: space-between; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 0.35rem;
}
.lv-card.lv-planifie { border-style: dashed; }

/* ---------- P5 : prospection / relances ---------- */
.pp-ligne {
  display: flex; justify-content: space-between; align-items: center; gap: 0.8rem;
  flex-wrap: wrap; padding: 0.65rem 0.85rem; margin-bottom: 0.45rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.pp-txt { flex: 1; min-width: 240px; }
.pp-detail { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.15rem; }
.pp-retard { color: var(--err-txt); font-weight: 700; }
.pp-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
.pp-actions .btn, .pp-actions a.btn { color: var(--ink); text-decoration: none; }
.tr-tca { grid-template-columns: 1.3fr 2.4fr 0.7fr; }
.tr-tcr { grid-template-columns: 0.9fr 0.9fr 0.9fr 1.2fr 0.9fr 0.5fr; }
.pr-lots { display: flex; flex-direction: column; gap: 0.5rem; }
.pr-lot-btn { display: flex; flex-direction: column; gap: 0.1rem; text-align: left; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; cursor: pointer; font-family: inherit; font-size: 0.95rem; color: var(--ink); }
.pr-lot-btn.first { border-color: var(--accent); }
.pr-lot-btn span { color: var(--ink-soft); font-size: 0.8rem; }
.pr-lot-btn:active { transform: scale(0.99); }
.pr-lignes { display: flex; flex-direction: column; gap: 0.5rem; padding-bottom: 6.5rem; }
.pr-ligne { display: flex; align-items: center; gap: 0.7rem; background: var(--card); border: 2px solid var(--line); border-radius: 12px; padding: 0.8rem 0.9rem; cursor: pointer; }
.pr-ligne.ok { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.pr-check { width: 30px; height: 30px; border: 2.5px solid var(--line-strong); border-radius: 9px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--on-accent); }
.pr-ligne.ok .pr-check { background: var(--accent); border-color: var(--accent); }
.pr-l-txt { flex: 1; min-width: 0; font-size: 0.95rem; line-height: 1.35; }
.pr-l-qte { font-size: 1.1rem; margin-right: 0.25rem; }
.pr-l-qte s { color: var(--ink-soft); font-weight: 400; }
.pr-l-motif { display: block; font-size: 0.78rem; color: var(--warn-txt); }
.pr-foot { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); padding: 0.7rem 0.9rem calc(0.7rem + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 0.9rem; max-width: 640px; margin: 0 auto; }
.pr-progress { color: var(--ink-soft); font-size: 0.85rem; white-space: nowrap; }
.pr-fin { flex: 1; padding: 0.85rem; font-size: 1rem; }
.pr-fin:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Page livreur (W5) ---------- */
#liv-root { min-height: 100vh; padding: 0.9rem; background: var(--bg); max-width: 640px; margin: 0 auto; }
.lv-scanbar { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.lv-scanbar .pr-scan { flex: 1; padding-left: 1rem; }
.lv-card { cursor: pointer; }
.lv-card.lv-livre { opacity: 0.65; cursor: default; }
.lv-bloc { margin-bottom: 1rem; }
.lv-pad { width: 100%; height: 180px; background: #fff; border: 2px dashed var(--line-strong); border-radius: 12px; touch-action: none; display: block; margin-bottom: 0.4rem; cursor: crosshair; }
.lv-photo-apercu { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); display: block; margin-top: 0.5rem; }

/* ---------- Livraisons signées (bureau, W6) ---------- */
.tr-livraisons { grid-template-columns: 110px 90px 1.6fr 1fr 1fr 90px; }
.ls-preuves { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .ls-preuves { grid-template-columns: 1fr; } }
.ls-preuve h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); margin-bottom: 0.4rem; }
.ls-img { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.ls-img img { max-width: 100%; max-height: 320px; border-radius: 6px; }

/* ---------- Assistant IA ---------- */
.sb-item.sb-bottom { margin-top: auto; }
.as-wrap { display: flex; flex-direction: column; height: calc(100vh - 120px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--seb-sh-1); overflow: hidden; }
.as-thread { flex: 1; overflow-y: auto; padding: 1.1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.as-hello { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.7; }
.as-ex { display: block; color: var(--accent); font-weight: 600; cursor: default; }
.as-msg { max-width: 78%; padding: 0.6rem 0.85rem; border-radius: 14px; font-size: 0.92rem; line-height: 1.55; overflow-wrap: break-word; }
.as-msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.as-msg.bot { align-self: flex-start; background: var(--card-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.as-msg.as-err { border-color: var(--err-txt); }
.as-msg.as-outil { color: var(--ink-soft); font-size: 0.82rem; padding: 0.35rem 0.7rem; display: flex; align-items: center; gap: 0.4rem; }
.as-msg.as-confirm { border: 1.5px solid var(--accent); max-width: 88%; }
.as-confirm-t { font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .4px; color: var(--accent); display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.35rem; }
.as-confirm-d { margin-bottom: 0.6rem; }
.as-apercu { margin-top: 0.4rem; padding: 0.5rem 0.6rem; background: var(--card); border: 1px solid var(--line); border-radius: 8px; font-size: 0.82rem; color: var(--ink-soft); white-space: pre-wrap; }
.as-confirm-btns { display: flex; gap: 0.45rem; justify-content: flex-end; }
.as-inputbar { display: flex; gap: 0.5rem; padding: 0.7rem; border-top: 1px solid var(--line); background: var(--card); align-items: flex-end; }
.as-input { flex: 1; resize: none; max-height: 140px; }
.as-inputbar .btn { padding: 0.6rem 0.9rem; }
.as-dots { display: inline-flex; gap: 4px; }
.as-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-soft); animation: as-b 1.2s infinite; }
.as-dots span:nth-child(2) { animation-delay: .2s; }
.as-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes as-b { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---------- Tableau de bord ---------- */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.dash-wide { grid-column: 1 / -1; }
.dash-card { padding: 1rem 1.1rem; }
.dash-card h4 { margin: 0 0 0.6rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); }
.dash-cahead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.4rem; }
.dash-cahead h4 { margin: 0; }
.dash-selects { display: flex; align-items: center; gap: 0.5rem; }
.dash-selects .dash-year { padding: 0.28rem 0.5rem; font-size: 0.82rem; min-width: 92px; }
.dash-vs { font-size: 0.78rem; color: var(--ink-soft); }
.dash-leg { display: inline-flex; align-items: center; gap: 0.35rem; }
.dash-sw { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.dash-sw.serie-a, .dash-bar.serie-a { background: var(--accent); }
.dash-sw.serie-b, .dash-bar.serie-b { background: #14b8a6; }
.dash-chart { display: flex; align-items: flex-end; gap: 0.5rem; height: 200px; padding-top: 0.6rem; }
.dash-mcol { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.dash-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; width: 100%; height: 100%; }
.dash-bar { flex: 1; max-width: 26px; border-radius: 5px 5px 0 0; transition: height .25s; }
.dash-bar-lbl { font-size: 0.68rem; color: var(--ink-soft); margin-top: 0.3rem; white-space: nowrap; }
.dash-evol { font-size: 0.8rem; font-weight: 700; margin-left: 0.3rem; }
.dash-list { display: flex; flex-direction: column; }
.dash-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.42rem 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.dash-row:last-child { border-bottom: none; }
.dash-click { cursor: pointer; border-radius: 6px; }
.dash-click:hover { background: var(--card-2); }
.dash-rank { width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; color: var(--ink-soft); flex-shrink: 0; }
.dash-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-val { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 860px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-bar-val { display: none; }
}

/* ---------- Achats / Fournisseurs ---------- */
.tr-cf { grid-template-columns: 100px 100px 1.6fr 1fr; }
.tr-fourn { grid-template-columns: 1.4fr 1fr 1fr 1.6fr; }
.tr-al { grid-template-columns: 90px 1.8fr 0.7fr 0.8fr 0.9fr 1fr; }
.tr-alines { grid-template-columns: 2fr 0.7fr 1fr 1fr 50px; }
.tr-recep { grid-template-columns: 1.6fr 0.6fr 0.8fr 1fr 1fr; }
.ac-addline { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.ac-addline .input { min-width: 90px; }

/* ---------- Employés (fil d'activité) ---------- */
.em-jour { font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink-soft); padding: 0.8rem 1.1rem 0.35rem; border-bottom: 1px solid var(--line); }
.em-ligne { display: flex; gap: 0.8rem; padding: 0.5rem 1.1rem; font-size: 0.9rem; border-bottom: 1px solid var(--line); align-items: baseline; }
.em-ligne:last-child { border-bottom: none; }
.em-heure { color: var(--ink-soft); font-size: 0.78rem; font-variant-numeric: tabular-nums; flex-shrink: 0; width: 42px; }

/* ---------- Utilisateurs ---------- */
.tr-users { grid-template-columns: 1.1fr 1.4fr 1.2fr 0.7fr 2.1fr; }
.u-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.u-actions .btn { padding: 0.32rem 0.7rem; font-size: 0.78rem; color: var(--ink); }

/* ---------- P1 : permissions par collaborateur ---------- */
.dr-list { display: flex; flex-direction: column; gap: 0.5rem; }
.dr-ligne {
  display: flex; gap: 1rem; align-items: center; justify-content: space-between;
  flex-wrap: wrap; padding: 0.7rem 0.85rem;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.dr-txt { display: flex; flex-direction: column; gap: 0.15rem; min-width: 240px; flex: 1; }
.dr-txt .muted { font-size: 0.8rem; }
.dr-defaut { font-size: 0.74rem; color: var(--ink-soft); }
.dr-choix { display: flex; gap: 0.3rem; flex-shrink: 0; }
.dr-b {
  padding: 0.4rem 0.75rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-soft);
  font-family: inherit; font-size: 0.8rem; font-weight: 700;
}
.dr-b:hover:not(:disabled) { border-color: var(--accent); color: var(--ink); }
.dr-b:disabled { opacity: 0.5; cursor: default; }
.dr-b.on { color: var(--ink); border-color: var(--ink-soft); background: var(--paper); }
.dr-b.on.ok { background: var(--ok-bg); color: var(--ok-txt); border-color: var(--ok-txt); }
.dr-b.on.err { background: var(--err-bg); color: var(--err-txt); border-color: var(--err-txt); }

/* ---------- Formulaire (modale) ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem 1rem; }
.form-grid textarea.input { resize: vertical; font-family: inherit; }
.check-line { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; font-weight: 600; padding: 0.55rem 0; cursor: pointer; }
.check-line input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.2rem; flex-wrap: wrap; }
.form-actions .btn { white-space: nowrap; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Toast ---------- */
#gc-toast { position: fixed; bottom: 1.4rem; left: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 0.65rem 1.1rem; border-radius: var(--seb-r-pill); font-size: 0.88rem; font-weight: 600; box-shadow: var(--seb-sh-pop); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 80; max-width: min(90vw, 480px); text-align: center; }
#gc-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sidebar { width: 64px; padding: 1rem 0.5rem; }
  .sb-brand-t, .sb-item span.lbl, .sb-item .soon, .sb-user { display: none; }
  .sb-item { justify-content: center; padding: 0.6rem 0.4rem; }
  .main { padding: 1rem; }
  .tr-clients { grid-template-columns: 96px 1.5fr 1fr; }
  .tr-clients > :nth-child(3), .tr-clients > :nth-child(4), .tr-clients > :nth-child(6), .tr-clients > :nth-child(7) { display: none; }
}
