/* SAV YouShop — design propre au SAV (différent de la caisse) :
   barre latérale sombre sur grand écran, navigation basse sur mobile,
   accent orange, badges de statut colorés. */

:root {
  --fond: #eef1f6;
  --carte: #ffffff;
  --encre: #1b2437;
  --gris: #66708a;
  --trait: #e3e7ef;
  --accent: #ff6a00;
  --accent-fonce: #e55e00;
  --accent-pale: #fff1e6;
  --lat-fond: #141b2d;
  --lat-fond-2: #1d2740;
  --lat-encre: #9aa5c4;
  --ok: #15803d;
  --err: #b91c1c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font: 16px/1.5 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--fond);
  color: var(--encre);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
p a, .mini a, td a { color: #1d4ed8; }
button { font: inherit; }

.cache { display: none !important; }
.centre { text-align: center; }
.mini { font-size: 13.5px; color: var(--gris); }
.mini b { color: var(--encre); }
small { color: var(--gris); font-size: 12.5px; display: block; }
code { background: #f1f3f8; padding: 1px 6px; border-radius: 6px; font-size: 14px; }
.neg { color: var(--err); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------- barre latérale */
.lat {
  position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 40;
  background: var(--lat-fond); color: var(--lat-encre);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.lat-logo {
  font-size: 20px; color: #fff; padding: 4px 10px 18px;
  display: flex; align-items: center; gap: 8px;
}
.lat-logo b { color: var(--accent); }
.lat-nav { display: flex; flex-direction: column; gap: 2px; }
.lat-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; font-size: 15.5px;
  border-left: 3px solid transparent;
}
.lat-nav a i { font-style: normal; width: 22px; text-align: center; }
.lat-nav a:hover { background: var(--lat-fond-2); color: #fff; }
.lat-nav a.actif { background: var(--lat-fond-2); color: #fff; border-left-color: var(--accent); }
.lat-nav a.lat-cta { color: #ffb27a; }
.lat-nav a.lat-cta.actif, .lat-nav a.lat-cta:hover { color: #fff; }
.lat-bas { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 6px 0; }
.lat-app {
  text-align: center; padding: 9px 10px; border-radius: 10px;
  border: 1px solid #2c3a55; font-size: 14px;
}
.lat-app:hover { background: var(--lat-fond-2); color: #fff; }
.lat-user { line-height: 1.25; padding: 4px 6px; }
.lat-user span { color: #fff; font-weight: 600; display: block; }
.lat-user small { color: var(--lat-encre); }
.lat-deco { font-size: 13.5px; padding: 4px 6px; }
.lat-deco:hover { color: #fff; }

/* ------------------------------------------------- haut mobile + nav basse */
.haut-mobile {
  display: none; position: sticky; top: 0; z-index: 30;
  background: var(--lat-fond); color: #fff;
  padding: 12px 16px; align-items: center; justify-content: space-between;
}
.hm-logo b { color: var(--accent); }
.hm-deco { font-size: 20px; color: var(--lat-encre); }

.nav-bas {
  display: none; position: fixed; inset: auto 0 0 0; z-index: 40;
  background: var(--carte); border-top: 1px solid var(--trait);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around; align-items: flex-end;
}
.nav-bas a {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 11.5px; color: var(--gris); padding: 4px 8px; min-width: 58px;
}
.nav-bas a i { font-style: normal; font-size: 21px; }
.nav-bas a.nb-plus i {
  font-size: 24px; background: var(--accent); color: #fff;
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-top: -22px; box-shadow: 0 4px 14px rgba(255, 106, 0, .45);
}

/* -------------------------------------------------------------------- page */
.page { margin-left: 232px; padding: 26px 28px 60px; max-width: 1240px; }
body.sans-nav .page { margin-left: 0; }

.entete-page {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.titre-page { font-size: 24px; font-weight: 700; }
.titre-page small { font-weight: 400; }

.colonnes-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.rangee { display: flex; gap: 12px; }
.rangee > * { flex: 1; }

/* ------------------------------------------------------------------ cartes */
.carte {
  background: var(--carte); border-radius: 14px; padding: 18px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .07);
  margin-bottom: 16px;
}
.carte-titre {
  font-weight: 700; font-size: 16.5px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.carte-danger { background: transparent; box-shadow: none; padding: 4px; }
.carte-corbeille { border: 1.5px solid #f3c8c8; background: #fef6f6; }

/* ------------------------------------------------------------------ tuiles */
.tuiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.tuile {
  background: var(--carte); border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .07);
  border-top: 4px solid #2563eb;
  display: flex; flex-direction: column; gap: 2px;
}
.tuile:hover { transform: translateY(-2px); transition: transform .12s; }
.tuile-n { font-size: 32px; font-weight: 800; line-height: 1.1; }
.tuile-l { color: var(--gris); font-size: 14px; }
.tuile.t-ambre { border-top-color: #b45309; }
.tuile.t-orange { border-top-color: #ea580c; }
.tuile.t-vert { border-top-color: #15803d; }

/* --------------------------------------------------------------- formulaires */
.champ {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--trait);
  border-radius: 10px; font-size: 16px; background: #fbfcfe; color: var(--encre);
}
.champ:focus { outline: none; border-color: var(--accent); background: #fff; }
textarea.champ { resize: vertical; }
label.mini { display: block; margin: 10px 0 4px; }
label.mini:first-child { margin-top: 0; }
select.champ { appearance: auto; }

.case-cocher {
  display: flex; align-items: center; gap: 8px; margin: 10px 0;
  font-size: 14.5px; color: var(--gris); cursor: pointer;
}
.case-cocher input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ------------------------------------------------------------------ boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: #fff; color: var(--encre);
  border: 1.5px solid var(--trait); border-radius: 10px;
  padding: 9px 16px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: #c6cddc; }
.btn.primaire { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primaire:hover { background: var(--accent-fonce); }
.btn.primaire:disabled { background: #f3b98f; border-color: #f3b98f; cursor: not-allowed; }
.btn.danger { color: var(--err); border-color: #f3c8c8; }
.btn.danger:hover { background: #fee2e2; }
.btn.fantome { background: transparent; }
.btn.mini { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.btn.grand { padding: 12px 22px; font-size: 16.5px; }
.btn.bloc { width: 100%; }

/* -------------------------------------------------------------------- puces */
.puces { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.puce {
  border: 1.5px solid var(--trait); background: #fff; color: var(--encre);
  border-radius: 999px; padding: 7px 14px; font-size: 14.5px; cursor: pointer;
}
.puce:hover { border-color: #c6cddc; }
.puce.active { background: var(--encre); border-color: var(--encre); color: #fff; }
.puce .compteur {
  background: #eef1f6; color: var(--gris); border-radius: 999px;
  padding: 0 7px; font-size: 12.5px; margin-left: 4px;
}
.puce.active .compteur { background: rgba(255, 255, 255, .22); color: #fff; }

/* Puces de statut (fiche ticket) : la couleur du statut quand sélectionnée */
.puce-st.courant { opacity: .45; cursor: default; text-decoration: underline; }
.puce-st.active.st-recu    { background: #2563eb; border-color: #2563eb; color: #fff; }
.puce-st.active.st-diag    { background: #7c3aed; border-color: #7c3aed; color: #fff; }
.puce-st.active.st-attente { background: #b45309; border-color: #b45309; color: #fff; }
.puce-st.active.st-atelier { background: #ea580c; border-color: #ea580c; color: #fff; }
.puce-st.active.st-pret    { background: #15803d; border-color: #15803d; color: #fff; }
.puce-st.active.st-restitue{ background: #475569; border-color: #475569; color: #fff; }
.puce-st.active.st-irrep   { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.puce-st.active.st-annule  { background: #64748b; border-color: #64748b; color: #fff; }
.puce-atelier.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ------------------------------------------------------------ badges statut */
.badge-st {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 700;
  white-space: nowrap;
}
.badge-st.grand { font-size: 15px; padding: 5px 14px; vertical-align: middle; }
.st-recu     { background: #e8efff; color: #1d4ed8; }
.st-diag     { background: #f1eaff; color: #6d28d9; }
.st-attente  { background: #fef3c7; color: #92400e; }
.st-atelier  { background: #ffedd5; color: #c2410c; }
.st-pret     { background: #dcfce7; color: #166534; }
.st-restitue { background: #e2e8f0; color: #334155; }
.st-irrep    { background: #fee2e2; color: #991b1b; }
.st-annule   { background: #eef1f6; color: #64748b; }

.badge-gar {
  background: #dcfce7; color: #166534; border-radius: 999px;
  padding: 2px 10px; font-size: 12.5px; font-weight: 700;
}
.badge-retard {
  background: #fee2e2; color: #991b1b; border-radius: 999px;
  padding: 3px 11px; font-size: 13px; font-weight: 700; white-space: nowrap;
}
.badge-spec {
  background: var(--accent-pale); color: var(--accent-fonce);
  border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600;
}

/* ----------------------------------------------------------------- alertes */
.alerte {
  border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-size: 15px;
  border: 1px solid transparent;
}
.alerte.ok   { background: #dcfce7; color: #14532d; border-color: #bbe7c8; }
.alerte.err  { background: #fee2e2; color: #7f1d1d; border-color: #f5c2c2; }
.alerte.info { background: #e8efff; color: #1e3a8a; border-color: #c9d9fb; }

/* --------------------------------------------------------- listes / lignes */
.ligne-dossier {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 8px; border-radius: 10px; border-bottom: 1px solid var(--trait);
}
.ligne-dossier:last-child { border-bottom: 0; }
.ligne-dossier:hover { background: #f6f8fb; }
.ligne-dossier small { margin-top: 1px; }

.ligne-activite {
  display: flex; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--trait);
  font-size: 14.5px; align-items: flex-start;
}
.ligne-activite:last-child { border-bottom: 0; }
.la-ico { width: 26px; text-align: center; flex: none; }

/* ------------------------------------------------------------- cartes ticket */
.carte-ticket {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; margin-bottom: 8px; cursor: pointer;
}
.carte-ticket:hover { box-shadow: 0 3px 10px rgba(16, 24, 40, .12); }
.ct-gauche { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ct-ref { font-size: 15.5px; letter-spacing: .3px; }
.ct-produit { font-size: 15px; }
.ct-droite { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }

.carte-filtres { padding: 14px 16px; }
.champ-recherche { margin-bottom: 4px; }

/* --------------------------------------------------------------- chronologie */
.chronologie { border-left: 2px solid var(--trait); margin-left: 12px; padding-left: 0; }
.chrono-item {
  position: relative; padding: 6px 0 10px 30px; font-size: 14.5px;
}
.chrono-point {
  position: absolute; left: -13px; top: 5px;
  background: #fff; border: 2px solid var(--trait); border-radius: 50%;
  width: 26px; height: 26px; font-size: 12.5px;
  display: flex; align-items: center; justify-content: center;
}
.chrono-public .chrono-point { border-color: var(--accent); }
.chrono-item small { margin-top: 1px; }

/* -------------------------------------------------------------------- photos */
.galerie { display: flex; flex-wrap: wrap; gap: 10px; }
.vignette { width: 108px; position: relative; }
.vignette img {
  width: 108px; height: 108px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--trait); display: block;
}
.vignette form { position: absolute; top: 4px; right: 4px; }
.vignette .btn { background: rgba(255, 255, 255, .92); }
.apercus { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.apercu {
  width: 84px; height: 84px; object-fit: cover;
  border-radius: 10px; border: 2px solid var(--accent);
}
.zone-photos { width: 100%; border-style: dashed; padding: 14px; }

/* ------------------------------------------------------------------- tableaux */
.defile { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tableau th {
  text-align: left; color: var(--gris); font-weight: 600; font-size: 13px;
  padding: 7px 8px; border-bottom: 2px solid var(--trait); white-space: nowrap;
}
.tableau th.num { text-align: right; }
.tableau td { padding: 8px; border-bottom: 1px solid var(--trait); vertical-align: top; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tr.total td { background: #f6f8fb; border-top: 2px solid var(--trait); }
.ligne-inactive td { opacity: .55; }
.actions-cellule { white-space: nowrap; }

.infos { width: 100%; border-collapse: collapse; font-size: 15px; }
.infos td { padding: 6px 8px 6px 0; vertical-align: top; }
.infos td:first-child { color: var(--gris); width: 34%; font-size: 13.5px; padding-top: 8px; }

/* --------------------------------------------------------------- ateliers */
.grille-ateliers { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.carte-atelier.inactif { opacity: .6; }
.ca-haut { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ca-haut b { font-size: 17px; }
.ca-chiffres { display: flex; gap: 10px; margin: 12px 0 10px; flex-wrap: wrap; }
.chiffre {
  background: #f6f8fb; border-radius: 10px; padding: 8px 14px;
  display: flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.chiffre b { font-size: 18px; }
.chiffre span { font-size: 12px; color: var(--gris); }

/* --------------------------------------------------------- divers formulaires */
.form-recherche-rapide { display: flex; gap: 8px; }
.form-recherche-rapide .champ { flex: 1; }
.form-recherche-rapide .btn { flex: none; }
.lien-suivi { display: flex; gap: 8px; }
.lien-suivi .champ { flex: 1; font-size: 13.5px; }
.lien-suivi .btn { flex: none; }
.rangee-travail { display: flex; gap: 8px; margin-top: 10px; }
.rangee-travail .champ { flex: 1; }
.rangee-travail .champ-montant { flex: none; width: 120px; }
.rangee-travail .btn { flex: none; padding: 9px 14px; }

/* ---------------------------------------------------------------- connexion */
.connexion { min-height: 82vh; display: flex; align-items: center; justify-content: center; }
.carte-connexion { max-width: 380px; width: 100%; padding: 30px 28px; }
.logo-connexion { font-size: 44px; text-align: center; }
.titre-connexion { font-size: 24px; text-align: center; margin: 4px 0 4px; }
.titre-connexion b { color: var(--accent); }
.sous-titre { text-align: center; color: var(--gris); font-size: 14px; margin-bottom: 18px; }

/* ------------------------------------------------------------- pages publiques */
body.corps-public { background: linear-gradient(160deg, #141b2d 0%, #1d2740 55%, #2a3860 100%); }
.public-page { max-width: 560px; margin: 0 auto; padding: 34px 16px 20px; }
.public-entete { text-align: center; color: #9aa5c4; margin-bottom: 20px; }
.public-logo { font-size: 30px; color: #fff; }
.public-logo b { color: var(--accent); }
.carte-publique { padding: 24px 22px; }
.public-produit { font-size: 21px; margin: 4px 0 14px; }
.public-statut {
  display: flex; gap: 14px; align-items: flex-start;
  border-radius: 12px; padding: 16px; margin-bottom: 18px; font-size: 16px;
}
.public-statut p { font-size: 14.5px; margin-top: 6px; font-weight: 400; }
.ps-emoji { font-size: 30px; line-height: 1; }
.chronologie-publique { margin-top: 6px; }
.zone-decharge {
  background: #f6f8fb; border: 1px dashed #c6cddc; border-radius: 12px;
  padding: 14px; margin-bottom: 18px;
}
.rangee-decharge { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.form-decharge { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.form-decharge .champ { flex: 1; min-width: 160px; }
.form-decharge .btn { flex: none; }
.etat-dech { margin-bottom: 10px; }
.champ-motif { width: 150px; display: inline-block; padding: 5px 8px; font-size: 13px; }
.btn.ok { color: var(--ok); border-color: #bbe7c8; }
.btn.ok:hover { background: #dcfce7; }
.public-pied { text-align: center; color: #9aa5c4; font-size: 13px; padding: 18px 0; }
.public-pied a { color: #c8d0e6; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .tuiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 920px) {
  .lat { display: none; }
  .haut-mobile { display: flex; }
  body.avec-nav .nav-bas { display: flex; }
  .page { margin-left: 0; padding: 16px 14px 96px; }
  .colonnes-2 { grid-template-columns: 1fr; }
  .entete-page { flex-direction: column; align-items: stretch; }
  .rangee { flex-direction: column; gap: 0; }
  .rangee-travail { flex-direction: row; gap: 8px; }
  .lien-suivi { flex-direction: row; }
  .form-recherche-rapide { flex-direction: row; }
  .carte-ticket { flex-direction: row; }
  .titre-page { font-size: 21px; }
}
@media (max-width: 460px) {
  .tuiles { gap: 10px; }
  .tuile-n { font-size: 26px; }
  .vignette, .vignette img { width: 90px; }
  .vignette img { height: 90px; }
}
