@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* ----- Thème "Little Mamma" (vert sapin + rouge tomate) ----- */
  --primaire: #d8402c;
  --primaire-fonce: #ad2d1a;
  --primaire-clair: #fdeae4;
  --brand-vert-900: #0d241b;
  --brand-vert-700: #163d2c;
  --brand-vert-500: #1f5c3f;
  --vert: #1f7a4d;
  --vert-clair: #eaf7f0;
  --rouge: #dc2626;
  --rouge-clair: #fef2f2;
  --orange: #c2680a;
  --orange-clair: #fff7ed;
  --gris-900: #0f172a;
  --gris-700: #334155;
  --gris-500: #64748b;
  --gris-300: #cbd5e1;
  --gris-100: #f1f5f9;
  --bg: #f6f7fb;
  --carte: #ffffff;
  --bordure: #e6e9f1;
  --texte: #1a2033;
  --radius: 14px;
  --radius-sm: 9px;
  --ombre: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .04);
  --ombre-lg: 0 8px 24px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--texte);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }

/* ===================== Shell applicatif (sidebar + contenu) ===================== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

aside.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(185deg, var(--brand-vert-900) 0%, var(--brand-vert-700) 100%);
  color: #e2e4ef;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 22px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--primaire);
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .25);
}
.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
}

.brand-title { font-size: 14px; font-weight: 700; color: #fff; line-height: 1.3; }
.brand-sub { font-size: 11.5px; color: #9fc5ad; font-weight: 500; }

nav.tabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 0;
  flex: 1;
}

nav.tabs button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: #b7b9d6;
  font-weight: 500;
  text-align: left;
  transition: background .15s, color .15s;
}

nav.tabs button svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }

nav.tabs button:hover { background: rgba(255, 255, 255, .06); color: #fff; }

nav.tabs button.active {
  background: linear-gradient(135deg, #e85b3f, var(--primaire));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(216, 64, 44, .35);
}

.badge-notif {
  margin-left: auto;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--rouge);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .08);
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, .08);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.compte-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
}

.compte-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.compte-chip .compte {
  font-size: 12.5px;
  color: #dcdeef;
  font-weight: 500;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer button.bouton.neutre {
  background: rgba(255, 255, 255, .07);
  color: #e2e4ef;
  width: 100%;
}
.sidebar-footer button.bouton.neutre:hover { background: rgba(255, 255, 255, .13); }

/* ----- Badge "powered by lacaisse.ma" ----- */
.powered-by {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 2px 2px;
  margin-top: 2px;
}
.powered-by-logo {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  background: #fff;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.powered-by-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.powered-by-texte {
  font-size: 10.5px;
  line-height: 1.25;
  color: rgba(255, 255, 255, .45);
}
.powered-by-texte b { color: rgba(255, 255, 255, .78); font-weight: 700; }

.powered-by.clair .powered-by-texte { color: var(--gris-500); }
.powered-by.clair .powered-by-texte b { color: var(--gris-700); }

main {
  flex: 1;
  padding: 28px 36px 60px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

.vue { display: none; }
.vue.active { display: block; animation: apparition .18s ease; }

@keyframes apparition {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-head { margin-bottom: 20px; }
.page-head h1 { font-size: 21px; margin: 0 0 3px; color: var(--gris-900); }
.page-head p { margin: 0; font-size: 13.5px; color: var(--gris-500); }

/* ----- Loader (chargement catalogue, etc.) ----- */
.loader-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 50px 0;
  color: var(--gris-500);
  font-size: 13.5px;
}
.loader-spin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--primaire-clair);
  border-top-color: var(--primaire);
  animation: loader-tourne .7s linear infinite;
}
@keyframes loader-tourne {
  to { transform: rotate(360deg); }
}

/* ----- Spinner inline (bouton en état de chargement) ----- */
.spin-inline {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 7px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  animation: loader-tourne .7s linear infinite;
}
.bouton.en-chargement {
  cursor: wait;
  opacity: .85;
}

/* ----- Loader "joli" (chargement du catalogue fournisseur) ----- */
.loader-wrap-joli {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 70px 0;
  animation: apparition .3s ease;
}
.loader-joli-icone {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primaire-clair), #fff);
  box-shadow: var(--ombre-lg);
}
.loader-joli-spin {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--primaire-clair);
  border-top-color: var(--primaire);
  animation: loader-tourne .9s linear infinite;
}
.loader-joli-svg {
  width: 26px;
  height: 26px;
  color: var(--primaire);
  animation: loader-joli-flotte 1.6s ease-in-out infinite;
}
@keyframes loader-joli-flotte {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
.loader-joli-texte {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--gris-700);
  margin-top: 6px;
}
.loader-joli-sous {
  font-size: 12.5px;
  color: var(--gris-500);
}

/* ===================== Cartes / mise en page générale ===================== */

.carte {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--ombre);
}

.ligne-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.champ label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--gris-700);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table th, table td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--bordure);
}

table th {
  color: var(--gris-500);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: #fafbfd;
}

table tbody tr:last-child td { border-bottom: none; }

tr.cliquable { cursor: pointer; transition: background .12s; }
tr.cliquable:hover { background: var(--primaire-clair); }

input, select, textarea {
  border: 1.5px solid var(--bordure);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
  background: #fff;
  color: var(--texte);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primaire);
  box-shadow: 0 0 0 3px var(--primaire-clair);
}

input[type="number"] { text-align: right; }

button.bouton {
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 17px;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  font-weight: 600;
  transition: transform .08s, box-shadow .15s, opacity .15s, background .15s;
}

button.bouton:active { transform: scale(.97); }

button.primaire { background: linear-gradient(135deg, #e85b3f, var(--primaire)); color: white; box-shadow: 0 3px 10px rgba(216, 64, 44, .3); }
button.primaire:hover { box-shadow: 0 5px 14px rgba(216, 64, 44, .4); }
button.succes { background: var(--vert); color: white; box-shadow: 0 3px 10px rgba(21, 128, 61, .25); }
button.succes:hover { background: #126c33; }
button.danger { background: var(--rouge); color: white; box-shadow: 0 3px 10px rgba(220, 38, 38, .22); }
button.danger:hover { background: #c01e1e; }
button.neutre { background: var(--gris-100); color: var(--texte); }
button.neutre:hover { background: #e7eaf2; }
button.bouton:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .01em;
}

.badge.brouillon, .badge.a_preparer, .badge.emise, .badge.emis { background: var(--gris-100); color: var(--gris-500); }
.badge.envoyee, .badge.envoye { background: var(--orange-clair); color: var(--orange); }
.badge.en_traitement, .badge.en_preparation, .badge.en_cours { background: var(--primaire-clair); color: var(--primaire-fonce); }
.badge.validee, .badge.valide, .badge.receptionnee, .badge.preleve, .badge.clos { background: var(--vert-clair); color: var(--vert); }
.badge.receptionnee_partielle { background: var(--orange-clair); color: var(--orange); }
.badge.refusee, .badge.refuse, .badge.annulee, .badge.annule { background: var(--rouge-clair); color: var(--rouge); }

/* ===================== Catalogue produits ===================== */

.grille-produits {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.produit-carte {
  border: 1px solid var(--bordure);
  border-radius: var(--radius-sm);
  padding: 13px;
  background: #fff;
  transition: box-shadow .15s, border-color .15s;
}

.produit-carte:hover { box-shadow: var(--ombre-lg); border-color: #d9dcf0; }

.produit-carte .nom { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; color: var(--gris-900); }
.produit-carte .prix { color: var(--primaire-fonce); font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.produit-carte .unite { font-size: 11.5px; color: var(--gris-500); margin-bottom: 2px; }
.produit-carte .stock { font-size: 11.5px; color: var(--gris-500); margin-bottom: 10px; }

/* ===================== Catalogue — liste par catégories (accordéon) ===================== */

.recherche-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 2px 0 12px;
}
.recherche-sticky input { font-size: 14px; padding: 11px 14px; }

.accordion-categories { display: flex; flex-direction: column; gap: 10px; }

.cat-section {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  overflow: hidden;
}
.cat-section.hidden-cat { display: none; }

.cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.cat-header-name {
  flex: 1;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primaire-fonce);
}
.cat-header-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--primaire-fonce);
  background: var(--primaire-clair);
  padding: 3px 10px;
  border-radius: 20px;
  flex-shrink: 0;
}
.cat-chevron {
  color: var(--gris-500);
  font-size: 12px;
  transition: transform .18s ease;
  flex-shrink: 0;
}
.cat-section.open .cat-chevron { transform: rotate(180deg); }

.cat-body { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 10px; }
.cat-body.collapsed { display: none; }

.prod-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1.5px solid var(--bordure);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color .15s, background .15s;
}
.prod-row.hidden-row { display: none; }
.prod-row.selectionne { border-color: var(--primaire); background: var(--primaire-clair); }

.prod-img {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--gris-100);
  flex-shrink: 0;
}

.prod-info { flex: 1; min-width: 0; }
.prod-name { font-size: 13.5px; font-weight: 600; color: var(--gris-900); line-height: 1.3; }
.prod-unite { font-size: 11.5px; color: var(--gris-500); margin-top: 2px; }
.prod-prix { font-size: 12.5px; font-weight: 700; color: var(--primaire-fonce); margin-top: 2px; }
.prod-stock { font-size: 11px; color: var(--gris-500); margin-top: 2px; }

.qty-control { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.qty-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--bordure);
  background: var(--gris-100);
  color: var(--gris-700);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.qty-btn:hover { background: var(--primaire-clair); color: var(--primaire-fonce); border-color: #c7cdf5; }
.qty-input {
  width: 50px;
  text-align: center;
  padding: 7px 2px;
  font-weight: 700;
  font-size: 14px;
}

.espace-bottom-bar { height: 96px; }

/* ===================== Barre fixe "passer la commande" ===================== */

.bottom-bar-commande {
  position: fixed;
  left: 248px;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: linear-gradient(to top, var(--bg) 72%, rgba(246, 247, 251, 0));
  padding: 16px 0 calc(16px + env(safe-area-inset-bottom, 0px));
}
.bbc-inner { max-width: 1180px; margin: 0 auto; padding: 0 36px; }
.bbc-note { margin-bottom: 10px; }
.bbc-note textarea { background: #fff; }
.bbc-ligne {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  box-shadow: var(--ombre-lg);
  padding: 12px 16px;
}
.bbc-resume { flex: 1; font-size: 13.5px; font-weight: 700; color: var(--gris-900); }
.bbc-btn-valider { white-space: nowrap; }

/* ===================== Interrupteur (toggle) ===================== */

.interrupteur { position: relative; display: inline-block; width: 42px; height: 24px; }
.interrupteur input { opacity: 0; width: 0; height: 0; }
.interrupteur-piste {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--gris-300); border-radius: 999px;
  transition: background .15s;
}
.interrupteur-piste::before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .15s;
}
.interrupteur input:checked + .interrupteur-piste { background: var(--primaire); }
.interrupteur input:checked + .interrupteur-piste::before { transform: translateX(18px); }

.qte-controle {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qte-controle button {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1.5px solid var(--bordure);
  background: var(--gris-100);
  color: var(--gris-700);
  font-weight: 700;
  cursor: pointer;
  transition: background .12s;
}
.qte-controle button:hover { background: var(--primaire-clair); color: var(--primaire-fonce); border-color: #c7cdf5; }

.qte-controle input { text-align: center; padding: 8px 4px; }

/* ===================== Toast ===================== */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--gris-900);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  z-index: 100;
  box-shadow: var(--ombre-lg);
}

.toast.visible { opacity: 1; transform: translateY(0); }
.toast.succes { background: var(--vert); }
.toast.erreur { background: var(--rouge); }

/* ===================== Login ===================== */

.login-page {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.login-panneau {
  flex: 1.1;
  background: linear-gradient(160deg, var(--brand-vert-900) 0%, var(--brand-vert-700) 55%, var(--brand-vert-500) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 70px;
  position: relative;
  overflow: hidden;
}

.login-panneau::before {
  content: '';
  position: absolute;
  width: 420px; height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  top: -140px; right: -120px;
}

.login-panneau::after {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .05);
  bottom: -100px; left: -60px;
}

.login-panneau .brand-logo { width: 46px; height: 46px; font-size: 17px; margin-bottom: 22px; }
.login-panneau h2 { font-size: 27px; margin: 0 0 10px; letter-spacing: -.01em; position: relative; }
.login-panneau p { font-size: 14.5px; color: #cfd0ef; max-width: 340px; line-height: 1.6; position: relative; }

.login-formulaire {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-width: 0;
}

.login-carte {
  width: 360px;
  max-width: 100%;
}

.login-carte-logo {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: #fff;
  padding: 5px;
  margin-bottom: 16px;
  box-shadow: var(--ombre-lg);
  border: 1px solid var(--bordure);
}
.login-carte-logo img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 8px; }

.login-carte h1 { font-size: 22px; margin-bottom: 4px; color: var(--gris-900); }
.login-carte p.sous-titre { color: var(--gris-500); font-size: 13.5px; margin-top: 0; margin-bottom: 26px; }
.login-carte .champ { margin-bottom: 16px; }
.login-carte label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--gris-700); }
.login-carte button[type="submit"] { padding: 11px 17px; font-size: 14px; margin-top: 4px; }
.login-carte .erreur { color: var(--rouge); font-size: 13px; margin-top: 10px; min-height: 16px; font-weight: 500; }

@media (max-width: 860px) {
  .login-panneau { display: none; }
}

/* ===================== Connexion Lacaisse : mode toggle / caissiers / PIN ===================== */

.auth-mode-toggle {
  display: flex; gap: 6px;
  background: var(--gris-100);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}
.auth-mode-btn {
  flex: 1; border: none; background: transparent;
  padding: 9px; border-radius: 9px;
  font-size: 13.5px; font-weight: 700;
  color: var(--gris-500); cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-mode-btn.active { background: #fff; color: var(--primaire); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

.caissier-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding: 2px;
}
.caissier-card {
  background: var(--gris-100);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 16px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.caissier-card:hover { background: var(--primaire-clair); border-color: #c7cdf5; }
.caissier-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primaire-clair); color: var(--primaire-fonce);
  font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.caissier-nom { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.25; color: var(--gris-900); }

.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 8px 0 6px; }
.pin-dots .dot {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--primaire);
  background: transparent;
  transition: background .1s;
}
.pin-dots .dot.filled { background: var(--primaire); }

#ecran-pin.shake { animation: secoue .35s; }
@keyframes secoue {
  10%, 90% { transform: translateX(-6px); }
  20%, 80% { transform: translateX(8px); }
  30%, 50%, 70% { transform: translateX(-10px); }
  40%, 60% { transform: translateX(10px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.keypad button {
  width: 100%; aspect-ratio: 1;
  border-radius: 50%; border: none;
  background: var(--gris-100);
  font-size: 22px; font-weight: 700; color: var(--gris-900);
  cursor: pointer;
  transition: background .12s;
}
.keypad button:hover { background: var(--primaire-clair); color: var(--primaire-fonce); }
.keypad .key-empty { background: transparent; cursor: default; }
.keypad .key-empty:hover { background: transparent; }
.keypad .key-del { font-size: 18px; background: transparent; color: var(--gris-500); }
.keypad .key-del:hover { background: transparent; color: var(--rouge); }

/* ===================== Vide / KPI ===================== */

.vide { color: var(--gris-500); text-align: center; padding: 36px 0; font-size: 13.5px; }

.kpi-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--carte);
  border: 1px solid var(--bordure);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--ombre);
  border-left: 3px solid var(--primaire);
}

.kpi .valeur { font-size: 21px; font-weight: 800; color: var(--gris-900); letter-spacing: -.01em; line-height: 1.3; }
.kpi .libelle { font-size: 12px; color: var(--gris-500); margin-top: 5px; font-weight: 500; }
.kpi .valeur .prix-ttc { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: 0; margin-top: 1px; }

/* ----- Bloc HT / TTC (prix unitaires, montants de lignes et totaux) -----
   La valeur HT porte le poids visuel ; le TTC entre parenthèses reste une
   information secondaire, plus petite et plus discrète. */
.prix-ttc {
  font-size: .82em;
  font-weight: 500;
  color: var(--gris-500);
}

/* ----- Graphique d'évolution (courbe multi-séries, dashboard) ----- */
.graphique-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.graphique-entete h3 { margin: 0; font-size: 15px; color: var(--gris-900); }
.graphique-svg-conteneur { width: 100%; }
.graphique-svg { width: 100%; height: 320px; display: block; overflow: visible; }
.graphique-grille { stroke: var(--bordure); stroke-width: 1; }
.graphique-texte-axe { font-size: 10.5px; fill: var(--gris-500); font-family: inherit; }

.graphique-legende {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--bordure);
}
.legende-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--bordure);
  background: var(--gris-100);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--texte);
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s, background .15s;
}
.legende-item:hover { background: #e7eaf2; }
.legende-item.inactif { opacity: .45; }
.legende-item.inactif .legende-puce { background: #ccc !important; }
.legende-puce {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

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

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  aside.sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; flex-wrap: wrap; }
  nav.tabs { flex-direction: row; flex-wrap: wrap; }
  main { padding: 20px; }

  .bottom-bar-commande { left: 0; }
  .bbc-inner { padding: 0 14px; }
  .bbc-ligne { flex-wrap: wrap; }
  .bbc-resume { width: 100%; order: -1; margin-bottom: 4px; }
  .prod-img { width: 44px; height: 44px; }
}
