/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #CC0000;
  --red-dark: #A00000;
  --red-light: #FF3333;
  --black: #0a0a0a;
  --grey-900: #1a1a1a;
  --grey-700: #444;
  --grey-600: #666;
  --grey-500: #777;
  --grey-400: #999;
  --grey-300: #bbb;
  --grey-200: #ddd;
  --grey-100: #f2f2f2;
  --grey-50: #f8f8f8;
  --white: #ffffff;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 72px;
  --header-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --glass-bg: rgba(255,255,255,0.82);
  --glass-border: rgba(255,255,255,0.5);
  --glass-blur: blur(24px) saturate(180%);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 4px; }

/* ===== LAYOUT ===== */
#app { min-height: 100dvh; display: flex; flex-direction: column; }

.screen {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--nav-h) - env(safe-area-inset-bottom, 0px)); /* hauteur contrainte au viewport visible, sous la barre de nav flottante */
  overflow: hidden;
  background: var(--white);
}

/* ===== HOME SCREEN — LIQUID GLASS ===== */
.home-screen {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(204,0,0,0.18) 0%, transparent 70%),
    linear-gradient(175deg, #1c1c1e 0%, #111111 45%, #0d0508 100%);
  min-height: 100dvh;
  height: auto;      /* ① — annule la contrainte de .screen pour l'accueil */
  overflow-y: auto;
}

.home-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100dvh;
  padding: 0 24px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 24px);
}

.home-logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: clamp(48px, 12vh, 90px);
  padding-bottom: clamp(36px, 8vh, 60px);
}

.home-logo-wrap .logo-img-full {
  width: min(310px, 84vw);
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255,255,255,0.11);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
  padding: 18px;
}

.home-tagline {
  font-size: 11px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
}

/* Glass home cards */
.home-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 20px;
  border-radius: 20px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s, opacity 0.18s;
  text-align: left;
  font-family: var(--font);
  border: none;
}
.home-card:active { transform: scale(0.96); opacity: 0.88; }

.home-card-primary {
  background: linear-gradient(135deg, rgba(204,0,0,0.92) 0%, rgba(150,0,0,0.96) 100%);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 10px 40px rgba(204,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.22);
  border: 1px solid rgba(255,120,120,0.22);
  color: var(--white);
}

.home-card-glass {
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.11);
  color: var(--white);
}

.home-card-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  flex-shrink: 0;
}
.home-card-primary .home-card-icon { background: rgba(255,255,255,0.18); }
.home-card-glass   .home-card-icon { background: rgba(255,255,255,0.08); }
.home-card-icon svg { width: 24px; height: 24px; }

.home-card-body { flex: 1; min-width: 0; }
.home-card-title { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; }
.home-card-sub { font-size: 13px; opacity: 0.62; margin-top: 3px; font-weight: 400; }

.home-card-chevron { opacity: 0.4; display: flex; align-items: center; }
.home-card-chevron svg { width: 18px; height: 18px; transform: rotate(-90deg); }

.home-badge {
  background: rgba(255,255,255,0.2);
  color: var(--white);
  border-radius: 12px;
  padding: 4px 11px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.home-admin-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.55);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 14px 16px;
  margin-top: auto;
  margin-bottom: 8px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
}
.home-admin-btn:active { color: rgba(255,255,255,0.75); }
.home-admin-btn svg { width: 18px; height: 18px; }

/* Legacy splash (fallback) */
.splash-logo { width: min(280px, 80vw); height: auto; }

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 1px 12px rgba(0,0,0,0.06);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.header-logo { height: 32px; flex-shrink: 0; }
.header-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-subtitle { font-size: 12px; color: var(--grey-500); }

.btn-back {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--black);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.btn-back:active { background: var(--grey-100); }

/* ===== BOTTOM NAV ===== */
/* ===== LIQUID GLASS NAV (FEAT 7) ===== */
.bottom-nav {
  position: fixed;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  left: 14px;
  right: 14px;
  height: 60px;
  border-radius: 26px;
  z-index: 200;

  /* FEAT 7 — Vrai effet Liquid Glass */
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);

  /* Bordure haut lumineuse + périmètre subtil */
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.15);

  /* Ombres : profondeur + reflet interne */
  box-shadow:
    0 -4px 24px rgba(0, 0, 0, 0.25),
    0 10px 40px rgba(0, 0, 0, 0.18),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0  rgba(0, 0, 0, 0.04);

  display: flex;
  align-items: stretch;
  padding: 4px 6px;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 20px;
  -webkit-tap-highlight-color: transparent;
  /* FEAT 7 — Couleurs adaptées au glass sombre/clair */
  color: rgba(60, 60, 67, 0.75);
  font-size: 10px;
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.18s ease, background 0.18s ease, transform 0.1s ease;
}

.nav-btn.active {
  color: var(--red);
  background: rgba(204, 0, 0, 0.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.nav-btn svg { width: 22px; height: 22px; }

.nav-btn:active {
  opacity: 0.75;
  transform: scale(0.91);
}

/* ===== STEP INDICATOR ===== */
.steps {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 0;
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  overflow: hidden;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
  flex: 1;
}

.step::after {
  content: '';
  position: absolute;
  top: 12px;
  left: calc(50% + 14px);
  right: calc(-50% + 14px);
  height: 2px;
  background: var(--grey-200);
}

.step:last-child::after { display: none; }

.step.done::after { background: var(--red); }

.step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--grey-200);
  color: var(--grey-500);
  z-index: 1;
}

.step.active .step-circle { background: var(--red); color: var(--white); }
.step.done .step-circle { background: var(--red); color: var(--white); }

.step-label {
  font-size: 10px;
  color: var(--grey-500);
  font-weight: 500;
  white-space: nowrap;
}

.step.active .step-label { color: var(--red); font-weight: 700; }
.step.done .step-label { color: var(--grey-700); }

/* ===== CONTENT AREA ===== */
.content {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px; /* ① — plus besoin de compenser nav + bouton fixe */
}

.content-padded { padding: 16px; }

/* ===== BUTTONS ===== */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 20px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: -0.2px;
}

.btn:active { opacity: 0.85; transform: scale(0.98); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

/* C1/C2 — État de sauvegarde en cours (shimmer rouge) */
@keyframes btnSaveShimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}
.btn.btn-saving {
  background: linear-gradient(90deg, #8B0000, #CC0000, #8B0000) !important;
  background-size: 200% 200% !important;
  animation: btnSaveShimmer 1.2s linear infinite !important;
  pointer-events: none !important;
  opacity: 1 !important;
  box-shadow: 0 4px 16px rgba(139,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15) !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(204,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-secondary { background: var(--black); color: var(--white); }
.btn-outline {
  background: var(--white);
  color: var(--black);
  border: 1.5px solid var(--grey-200);
}
.btn-ghost {
  background: transparent;
  color: var(--grey-700);
  border: none;
}
.btn-sm {
  padding: 10px 16px;
  font-size: 14px;
  border-radius: var(--radius-sm);
}

/* ===== BOTTOM ACTION (flux normal, plus de position:fixed) ===== */
.bottom-action {
  flex-shrink: 0;
  padding: 12px 16px;
  background: linear-gradient(to top, rgba(255,255,255,0.96) 55%, rgba(255,255,255,0));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  background: var(--grey-100);
  border-radius: 10px;
  padding: 3px;
  margin: 12px 16px;
}

.tab {
  flex: 1;
  padding: 9px 8px;
  border: none;
  background: none;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-600);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.tab.active {
  background: var(--white);
  color: var(--red);
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* ===== SECTION TITLE ===== */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--grey-500);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 16px 16px 8px;
}

/* ===== CARDS ===== */
.card {
  background: var(--white);
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.card + .card { margin-top: 10px; }

/* ===== CLIENT CARD ===== */
.client-info-card {
  margin: 12px 16px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-info-name {
  font-size: 18px;
  font-weight: 700;
}

.client-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--grey-700);
}

.client-info-row svg { flex-shrink: 0; color: var(--grey-400); }

/* ===== FORM ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-700);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 14px 14px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 16px;
  color: var(--black);
  background: var(--white);
  -webkit-appearance: none;
  transition: border-color 0.2s;
  outline: none;
}

.form-input:focus { border-color: var(--red); }
input[type="search"].form-input { color: var(--black); -webkit-text-fill-color: var(--black); }
input[type="search"].form-input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ===== MANDANT GRID ===== */
.mandant-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 16px;
}

.mandant-card {
  border: 2px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 16px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: var(--white);
  position: relative;
}

.mandant-card.selected {
  border-color: var(--red);
  background: #FFF0F0;
}

.mandant-card:active { transform: scale(0.97); }

.mandant-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--grey-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--white);
}

.mandant-nom {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.mandant-pays {
  font-size: 12px;
  color: var(--grey-500);
}

.mandant-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mandant-check svg { width: 12px; height: 12px; color: var(--white); }

/* ===== CATALOG ===== */
.catalog-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  /* ① — hauteur gérée par flexbox, plus de calc() hardcodé */
}

.series-sidebar {
  width: 120px;
  flex-shrink: 0;
  border-right: 1px solid var(--grey-200);
  overflow-y: auto;
  background: var(--grey-50);
  padding: 8px 0;
}

.serie-btn {
  width: 100%;
  padding: 12px 10px;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--grey-700);
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  border-left: 3px solid transparent;
  -webkit-tap-highlight-color: transparent;
}

.serie-btn.active {
  color: var(--red);
  font-weight: 700;
  border-left-color: var(--red);
  background: var(--white);
}

.serie-btn:active { opacity: 0.7; }

/* ① Recherche / création de série à la volée */
.serie-search-input {
  width: calc(100% - 12px);
  margin: 0 6px 6px;
  padding: 8px;
  font-size: 12px;
}

.serie-btn-create {
  color: var(--red);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.serie-btn-create svg { width: 14px; height: 14px; flex-shrink: 0; }

.products-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px; /* ① — plus besoin de padding excessif, bouton en flux normal */
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
}

.product-item.in-cart {
  border-color: var(--red);
  background: #FFF8F8;
}

.product-item:active { transform: scale(0.98); }

.product-info { flex: 1; min-width: 0; }
.product-nom { font-size: 14px; font-weight: 600; line-height: 1.2; }
.product-ref { font-size: 11px; color: var(--grey-500); margin-top: 2px; }
.product-meta { font-size: 12px; color: var(--grey-600); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.qty-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.qty-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.1s;
}

.qty-btn:active { opacity: 0.7; }
.qty-btn.plus { background: var(--red); color: var(--white); }
.qty-btn.minus { background: var(--grey-100); color: var(--grey-700); }

.qty-value {
  min-width: 20px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}

/* ===== MANDANT SWITCHER ===== */
.mandant-switcher {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--grey-200);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.mandant-switcher::-webkit-scrollbar { display: none; }

.mandant-pill {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--grey-200);
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mandant-pill.active {
  border-color: var(--red);
  background: var(--red);
  color: var(--white);
}

.pill-badge {
  background: rgba(255,255,255,0.3);
  color: var(--white);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.mandant-pill:not(.active) .pill-badge {
  background: var(--red);
  color: var(--white);
}

/* ===== CART ===== */
.cart-section {
  margin: 0 0 16px;
}

.cart-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--grey-50);
  border-bottom: 1px solid var(--grey-200);
  border-top: 1px solid var(--grey-200);
}

.cart-mandant-name {
  font-size: 15px;
  font-weight: 700;
  flex: 1;
}

.cart-mandant-country { font-size: 13px; color: var(--grey-500); }

.cart-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--grey-100);
}

.cart-item-info { flex: 1; min-width: 0; }
.cart-item-nom { font-size: 14px; font-weight: 600; }
.cart-item-ref { font-size: 12px; color: var(--grey-500); }
.cart-item-meta { font-size: 12px; color: var(--grey-600); }

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-qty-badge {
  background: var(--red);
  color: var(--white);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.cart-item-delete {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--grey-400);
  -webkit-tap-highlight-color: transparent;
}

/* ===== SEND OPTIONS ===== */
.send-card {
  margin: 10px 16px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.send-card-header {
  padding: 14px 16px;
  background: var(--grey-50);
  border-bottom: 1px solid var(--grey-200);
}

.send-card-title { font-size: 15px; font-weight: 700; }
.send-card-email { font-size: 13px; color: var(--grey-500); margin-top: 2px; }

.send-card-body { padding: 14px 16px; }

.copy-client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--grey-100);
}

.copy-label { font-size: 14px; font-weight: 500; }
.copy-sub { font-size: 12px; color: var(--grey-500); }

/* Toggle switch */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--grey-300);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle-slider { background: var(--red); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ===== HISTORY ===== */
.history-item {
  margin: 0 16px 10px;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.history-item-header {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.history-client { font-size: 16px; font-weight: 700; }
.history-date { font-size: 12px; color: var(--grey-500); margin-top: 2px; }
.history-mandants { font-size: 13px; color: var(--grey-700); margin-top: 4px; }

.history-badge {
  background: var(--grey-100);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--grey-700);
  white-space: nowrap;
  flex-shrink: 0;
}

.history-detail {
  border-top: 1px solid var(--grey-100);
  padding: 12px 16px;
  background: var(--grey-50);
  display: none;
}

.history-detail.open { display: block; }

.history-detail-item {
  font-size: 13px;
  color: var(--grey-700);
  padding: 2px 0;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--grey-500);
}

.empty-state svg { color: var(--grey-300); }
.empty-state-title { font-size: 17px; font-weight: 700; color: var(--grey-700); }
.empty-state-text { font-size: 14px; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 80px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  right: 16px;
  z-index: 300;
  background: var(--grey-900);
  color: var(--white);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #1a7a1a; }
.toast.error { background: var(--red-dark); }

/* ===== BADGE ===== */
.badge {
  background: var(--red);
  color: var(--white);
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* ===== CONFIRM SCREEN ===== */
.confirm-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 20px;
  padding: 32px 24px;
  text-align: center;
}

.confirm-icon {
  width: 72px;
  height: 72px;
  background: #F0FFF0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm-title { font-size: 22px; font-weight: 800; }
.confirm-text { font-size: 15px; color: var(--grey-600); line-height: 1.5; }

/* ===== MISC ===== */
.divider {
  height: 1px;
  background: var(--grey-200);
  margin: 0;
}

.alert {
  margin: 12px 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-info { background: #EEF4FF; color: #1A3A8B; }
.alert-warning { background: #FFF8E6; color: #7A4A00; }
.alert-success { background: #EDFFF0; color: #1A5C2A; }
.alert svg { flex-shrink: 0; margin-top: 1px; width: 16px; height: 16px; }

/* ===== GEOLOCATION ===== */
.geo-status {
  margin: 16px;
  padding: 20px;
  border: 1.5px dashed var(--grey-300);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.geo-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--grey-200);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== GEO CLIENT LIST ===== */
.geo-client-list {
  overflow-y: auto;
  flex: 1;
}
.geo-client-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--grey-100);
  cursor: pointer;
  transition: background 0.15s;
}
.geo-client-row:active { background: var(--grey-50); }
.geo-client-info { flex: 1; min-width: 0; }
.geo-client-nom { font-size: 14px; font-weight: 600; }
.geo-client-addr {
  font-size: 12px;
  color: var(--grey-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}
.geo-client-addr svg { width: 11px; height: 11px; flex-shrink: 0; }
.geo-client-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  background: #edfff0;
  color: #1a5c2a;
  border: 1px solid #b6e8bf;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
}
.geo-selected-card {
  background: var(--grey-50);
  border: 1.5px solid #b6e8bf;
  border-radius: var(--radius);
  padding: 14px;
}
.geo-selected-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.geo-selected-nom {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}
.geo-selected-detail {
  font-size: 13px;
  color: var(--grey-600);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}
.geo-selected-detail svg { width: 13px; height: 13px; flex-shrink: 0; }

.geo-maps-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e8f0fe;
  color: #1a73e8;
  flex-shrink: 0;
  text-decoration: none;
}
.geo-maps-btn svg { width: 16px; height: 16px; }

/* ===== ANIMATIONS ===== */
.fade-in {
  animation: fadeIn 0.2s ease-out;
}

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

/* ===== LOGO IMAGE ===== */
.logo-img { display: block; object-fit: contain; }
.logo-img-full { width: min(260px, 78vw); height: auto; }
.logo-img-small { height: 36px; width: auto; }

/* ===== ADMIN ===== */
.admin-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--grey-100);
  cursor: pointer;
  background: var(--white);
  transition: background 0.15s;
}
.admin-card:active { background: var(--grey-100); }
.admin-card-icon { color: var(--red); flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; }
.admin-card-icon svg { width: 24px; height: 24px; }
.admin-card-body { flex: 1; min-width: 0; }
.admin-card-label { font-size: 16px; font-weight: 600; }
.admin-card-sub { font-size: 13px; color: var(--grey-500); margin-top: 2px; }
.admin-card-arrow { color: var(--grey-400); transform: rotate(-90deg); }

.admin-list { display: flex; flex-direction: column; }
.admin-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--grey-100);
  background: var(--white);
}
.admin-item-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-item-sub { font-size: 12px; color: var(--grey-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ② Séparateur de lettre (annuaire) */
.alpha-separator {
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--grey-500);
  background: var(--grey-50);
  position: sticky;
  top: 0;
  z-index: 1;
}

.client-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grey-200); color: var(--grey-600);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}

.icon-btn {
  background: none; border: none; padding: 6px; cursor: pointer;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--grey-600); transition: background 0.15s;
}
.icon-btn:active { background: var(--grey-100); }

.color-swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; transition: border-color 0.15s;
}
.color-swatch.selected { border-color: var(--black); }

/* ===== FREE ARTICLE ===== */
.cart-item-free { background: #fffbf0; border-left: 3px solid #e8a000; }
.serie-btn-free {
  margin-top: auto;
  border-top: 1px dashed var(--grey-200);
  color: var(--grey-500);
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.serie-btn-free.active { color: var(--red); border-left-color: var(--red); background: #fff5f5; }
.serie-btn-free svg { width: 14px; height: 14px; }

.free-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 8px;
  height: 100%;
  overflow-y: auto;
}
.free-panel-form {
  background: #fffbf0;
  border: 1px dashed #e8a000;
  border-radius: var(--radius);
  padding: 12px;
}

.free-item-form {
  padding: 12px 16px;
  background: var(--grey-50, #f8f8f8);
  border-top: 1px solid var(--grey-100);
  border-bottom: 1px solid var(--grey-100);
}

/* ===== PHOTO LIGHTBOX ===== */
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.photo-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-modal-close svg { width: 20px; height: 20px; }
.photo-modal-img {
  max-width: 100%;
  max-height: 80dvh;
  border-radius: 10px;
  object-fit: contain;
}

/* ===== PRODUCT THUMBNAILS ===== */
.product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  flex-shrink: 0;
}
.admin-product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
}
.admin-product-thumb-placeholder {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

/* ===== PHOTO UPLOAD (admin product edit) ===== */
.photo-upload-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--primary);
  font-size: 14px;
  padding: 8px 0;
}
.photo-upload-label svg { width: 18px; height: 18px; }
.photo-upload-preview {
  position: relative;
  display: inline-block;
  margin-top: 8px;
}
.photo-upload-preview img {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--grey-200);
  display: block;
}
.photo-upload-del {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

/* ===== MERCHANDISING LINK ===== */
.merch-link-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(204,0,0,0.25);
  background: rgba(204,0,0,0.05);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.merch-link-btn:active { opacity: 0.7; }
.merch-link-btn svg { flex-shrink: 0; }

/* ===== FEAT 5 — HISTORIQUE : SWIPE & STATUTS ===== */
.history-all-done {
  /* Griser les commandes entièrement traitées */
  filter: grayscale(0.3);
}

.history-swipeable {
  user-select: none;
  touch-action: pan-y;
}

.history-item-inner {
  background: white;
  position: relative;
  z-index: 1;
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.history-statuts {
  border-top: 1px solid var(--grey-100);
  background: var(--grey-50);
}

.history-statut-label {
  font-size: 13px;
  color: var(--grey-600);
  cursor: pointer;
  user-select: none;
}

.history-statut-label input[type="checkbox"] {
  accent-color: var(--red);
  width: 16px;
  height: 16px;
}

/* ===== FEAT 3 — MANDANT AVATAR LOGO ===== */
.mandant-avatar {
  overflow: hidden; /* assure que le logo img ne déborde pas */
}

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .mandant-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-color-scheme: dark) {
  /* keep light for branding consistency */
}
