/* ============================================================
   style.css — Yère-S Management App
   Noir · Blanc · Gris — Classique & Sobre
   ============================================================ */

/* Fonts are now imported in HTML for better performance */

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Palette noir / blanc / gris */
  --black:       #050505;
  --gray-900:    #111111;
  --gray-800:    #222222;
  --gray-700:    #333333;
  --gray-600:    #555555;
  --gray-500:    #777777;
  --gray-400:    #999999;
  --gray-300:    #BBBBBB;
  --gray-200:    #DDDDDD;
  --gray-150:    #E8E8E8;
  --gray-100:    #F2F2F2;
  --gray-50:     #F8F8F8;
  --white:       #FFFFFF;

  /* Sémantique */
  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted:     var(--gray-400);
  --border:         rgba(0,0,0,0.12);
  --border-strong:  rgba(0,0,0,0.25);
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.07);
  --shadow:         0 2px 12px rgba(0,0,0,0.09);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
  --shadow-xl:      0 20px 60px rgba(0,0,0,0.14);

  /* Statuts (couleurs fonctionnelles uniquement) */
  --s-attente-bg:    #F5F5F5;  --s-attente-txt:  #444444;  --s-attente-bd:  #CCCCCC;
  --s-encours-bg:    #FFF8E6;  --s-encours-txt:  #7A5800;  --s-encours-bd:  #F0D080;
  --s-pret-bg:       #F0FAF4;  --s-pret-txt:     #1A6035;  --s-pret-bd:     #80C8A0;
  --s-livre-bg:      #E8F5EE;  --s-livre-txt:    #0D4020;  --s-livre-bd:    #50A070;
  --s-annule-bg:     #FFF0F0;  --s-annule-txt:   #8B0000;  --s-annule-bd:   #FFAAAA;
  --s-pris-bg:       #F0F4FF;  --s-pris-txt:     #1A3080;  --s-pris-bd:     #90A8E8;

  /* Layout */
  --sidebar-width:     240px;
  --sidebar-collapsed: 64px;
  --header-height:     64px;
  --radius-sm:         6px;
  --radius:            10px;
  --radius-lg:         14px;
  --radius-xl:         20px;

  /* Typo */
  --font-display: 'Bebas Neue', system-ui, sans-serif;
  --font-body:    'Outfit', system-ui, sans-serif;

  /* Transitions */
  --t:    all 0.2s ease;
  --t-lg: all 0.32s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  height: 100dvh;
}
body {
  font-family: var(--font-body);
  background: var(--white);
  color: var(--text-primary);
  height: 100%;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* Couleur de fond qui couvre la safe-area selon la page */
body.page-app   { background: var(--gray-50); }
body.page-login {
  background:
    linear-gradient(135deg, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.45) 50%, rgba(0,0,0,0.68) 100%),
    url('../assets/background_yere\'s.jpg') center center / cover no-repeat fixed;
}
button {
  cursor: pointer;
  font-family: var(--font-body);
  border: none;
  background: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
input, select, textarea {
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}
a {
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
img { display: block; max-width: 100%; -webkit-user-drag: none; }
ul, ol { list-style: none; }

/* ── Utilities ────────────────────────────────────────────── */
.hidden { display: none !important; }
.glass  { background: var(--white); border: 1px solid var(--border); box-shadow: var(--shadow); }
.glass-strong { background: var(--white); border: 1px solid var(--border-strong); box-shadow: var(--shadow-xl); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ══════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════ */
.login-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  /* Le background est porté par body.page-login pour couvrir aussi la safe-area */
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 59px,
      rgba(255,255,255,0.025) 59px,
      rgba(255,255,255,0.025) 60px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 59px,
      rgba(255,255,255,0.025) 59px,
      rgba(255,255,255,0.025) 60px
    );
  pointer-events: none;
}

.login-container::after {
  content: 'YËREDESIGN';
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: clamp(60px, 10vw, 160px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: rgba(255,255,255,0.18);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  line-height: 1;
  bottom: -0.14em;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 4px 20px rgba(0,0,0,0.3);
  animation: fadeInUp 0.4s ease;
  position: relative;
  z-index: 1;
}

.login-logo { text-align: center; margin-bottom: 40px; }
.login-logo .logo-text {
  display: block;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--black);
  letter-spacing: 0.14em;
  line-height: 1;
}
.login-logo .logo-line {
  display: block;
  width: 32px; height: 1px;
  background: var(--gray-300);
  margin: 14px auto;
}
.login-logo .logo-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 7px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--text-primary);
  transition: var(--t);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  background: var(--white);
  border-color: var(--gray-700);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}
.form-group input::placeholder { color: var(--gray-400); }
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ── Login responsive ─────────────────────────────────────── */
@media (max-width: 480px) {
  .login-container {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    align-items: flex-start;
    padding-top: max(140px, calc(60px + env(safe-area-inset-top)));
  }
  .login-card {
    padding: 36px 24px;
    border-radius: var(--radius-lg);
  }
  /* Empêche le zoom iOS sur les inputs de connexion */
  .login-card input,
  .login-card select {
    font-size: 16px;
  }
  .login-logo { margin-bottom: 28px; }
  .login-logo .logo-text { font-size: 1.7rem; }
  .login-container::after {
    font-size: 13vw;
    bottom: -0.14em;
    right: 0;
  }
}

@media (max-width: 360px) {
  .login-container { padding-top: 70px; }
  .login-card { padding: 28px 18px; }
  .login-logo .logo-text { font-size: 1.45rem; }
  .login-container::after { font-size: 11vw; bottom: -0.14em; right: 0; }
}

@media (min-width: 992px) {
  .login-container {
    padding: 0;
    justify-content: flex-end;
  }
  .login-card {
    max-width: 50%;
    width: 50%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border: none;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 80px;
    box-shadow: -10px 0 40px rgba(0,0,0,0.15);
  }
  .login-container::after {
    left: 20px;
    right: auto;
    bottom: 20px;
    font-size: 80px;
    color: rgba(255,255,255,0.4);
  }
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--t);
  cursor: pointer;
  border: none;
  white-space: nowrap;
  letter-spacing: 0.02em;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.97) !important; }
.btn-primary {
  background: var(--black);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.btn-primary:hover {
  background: var(--gray-800);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.24);
}
.btn-secondary {
  background: var(--white);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover {
  background: var(--gray-50);
  transform: translateY(-1px);
  border-color: var(--gray-400);
}
.btn-danger {
  background: #FFF0F0;
  color: #8B0000;
  border: 1px solid #FFAAAA;
}
.btn-danger:hover {
  background: #FFE0E0;
  transform: translateY(-1px);
}
.btn-full   { width: 100%; justify-content: center; }

/* ── AUTH PRIORITY (Google) ─────────────────────────────── */
.auth-priority-zone { margin-bottom: 24px; padding-bottom: 4px; }
.btn-google-priority {
  width: 100%; height: 48px; border-radius: var(--radius-md);
  background: var(--white); border: 1px solid var(--border-strong);
  color: var(--black); font-size: .95rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  cursor: pointer; transition: var(--t);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-google-priority:hover { background: var(--gray-50); border-color: var(--black); transform: translateY(-1px); }
.btn-google-priority:active { transform: translateY(0); }

.auth-separator {
  position: relative; text-align: center; margin: 24px 0 12px;
}
.auth-separator::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0;
  height: 1px; background: var(--border); z-index: 1;
}
.auth-separator span {
  position: relative; z-index: 2; background: var(--white);
  padding: 0 12px; font-size: .75rem; font-weight: 700;
  color: var(--text-muted); letter-spacing: 1px;
}
.glass .auth-separator span { background: rgba(255,255,255,0.01); backdrop-filter: blur(20px); }
/* Specific fix for glass background overlap if needed */
.login-card.glass .auth-separator span { background: #fff; } 
.btn-sm     { padding: 6px 13px; font-size: 0.8rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ── Password toggle ─────────────────────────────────────── */
.input-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-password-wrap input {
  width: 100%;
  padding-right: 44px;
}
.toggle-password-btn {
  position: absolute;
  right: 12px;
  color: var(--gray-400);
  font-size: 0.9rem;
  padding: 4px;
  border-radius: 4px;
  transition: var(--t);
  flex-shrink: 0;
}
.toggle-password-btn:hover { color: var(--gray-700); }

.login-version {
  text-align: center;
  margin-top: 24px;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-400);
}

/* ── Error msg ────────────────────────────────────────────── */
.error-msg {
  background: #FFF0F0;
  border: 1px solid #FFAAAA;
  color: #8B0000;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

/* ── Auth loader ──────────────────────────────────────────── */
.auth-loader {
  position: fixed;
  inset: 0;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.auth-loader.hidden { display: none; }
.auth-loader-inner  { text-align: center; }
.auth-loader-spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--gray-800);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   APP LAYOUT
   ══════════════════════════════════════════════════════════ */
.app-container {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--black);
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: var(--t-lg);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  min-height: var(--header-height);
  flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; overflow: hidden; min-width: 0; }
.logo-icon {
  width: 32px; height: 32px;
  background: var(--white);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--black);
  flex-shrink: 0;
  letter-spacing: 0;
}
.logo-full {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.12em;
  white-space: nowrap;
  transition: var(--t);
}
.sidebar.collapsed .logo-full { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-logo { width: 0; overflow: hidden; margin: 0; padding: 0; }
.sidebar.collapsed .sidebar-header { justify-content: center; }

.sidebar-toggle-btn {
  color: rgba(255,255,255,0.45);
  padding: 6px;
  border-radius: 6px;
  transition: var(--t);
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.08); color: var(--white); }

/* ── Nav ──────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.50);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--t);
  width: 100%;
  white-space: nowrap;
  position: relative;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-item i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item span { transition: var(--t); overflow: hidden; }
.sidebar.collapsed .nav-item span { opacity: 0; width: 0; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.nav-item.active {
  background: rgba(255,255,255,0.11);
  color: var(--white);
  border-left: 2px solid var(--white);
  padding-left: 10px; /* 12px - 2px border to keep content aligned */
}
.sidebar.collapsed .nav-item.active {
  border-left: none;
  padding-left: 12px;
}

/* Tooltips collapsed */
.sidebar.collapsed .nav-item[data-view]::after,
.sidebar.collapsed .logout-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--gray-900);
  color: var(--white);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: var(--t);
  z-index: 150;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow);
}
.sidebar.collapsed .nav-item[data-view]:hover::after,
.sidebar.collapsed .logout-item:hover::after { opacity: 1; }

/* ── Sidebar Footer ───────────────────────────────────────── */
.sidebar-footer { padding: 10px 10px 18px; border-top: 1px solid rgba(255,255,255,0.07); }
.logout-item { color: rgba(255,120,100,0.7) !important; }
.logout-item:hover { background: rgba(255,80,60,0.10) !important; color: rgba(255,140,120,1) !important; }

/* ── Overlay mobile ───────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  transition: var(--t-lg);
  background: var(--gray-50);
  -webkit-overflow-scrolling: touch;
}
.sidebar.collapsed ~ .main-content,
body.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }

/* ── Header ───────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.mobile-menu-btn {
  display: none;
  color: var(--gray-700);
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
}
.mobile-menu-btn:hover { background: var(--gray-100); }
#view-title, #user-view-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 5px 12px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 20px;
  white-space: nowrap;
  overflow: hidden;
  max-width: 220px;
}
.user-badge span { overflow: hidden; text-overflow: ellipsis; }

/* ── Views ────────────────────────────────────────────────── */
.view { padding: 28px; padding-bottom: 180px; flex: 1; animation: fadeIn 0.25s ease; }
.view.hidden { display: none; }

/* ══════════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════════ */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center; /* Centrage horizontal demandé */
  gap: 14px;
  transition: var(--t);
  box-shadow: var(--shadow-sm);
}
.stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.stat-card.wide { grid-column: span 2; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--gray-600);
  flex-shrink: 0;
}
.stat-icon.accent { background: var(--gray-900); color: var(--white); border-color: var(--gray-900); }
.stat-icon.green  { background: #E8F5EE; color: #0D4020; border-color: #50A070; }

.stat-info { min-width: 0; }
.stat-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

/* ── Charts ───────────────────────────────────────────────── */
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.chart-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.chart-card.wide { grid-column: span 2; }
.chart-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.chart-card canvas { max-height: 220px; }
.chart-card.wide canvas { max-height: 240px; }

/* ── Activity ─────────────────────────────────────────────── */
.recent-activity {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.section-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}
.activity-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gray-400);
  flex-shrink: 0;
}
.activity-dot.vente      { background: var(--gray-800); }
.activity-dot.rafistollage { background: #3A8058; }
.activity-text { flex: 1; color: var(--text-primary); }
.activity-time { color: var(--text-muted); font-size: 0.76rem; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   TOOLBAR / SEARCH / FILTERS (floating bottom-right)
   ══════════════════════════════════════════════════════════ */
.view-toolbar {
  position: fixed;
  bottom: calc(100px + env(safe-area-inset-bottom));
  right: calc(30px + env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  z-index: 55;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 120px);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  min-width: 160px;
  max-width: 220px;
  transition: var(--t);
}
.search-box:focus-within { border-color: var(--gray-600); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.search-box i { color: var(--gray-400); font-size: 0.88rem; }
.search-box input {
  border: none;
  background: transparent;
  font-size: 0.88rem;
  color: var(--text-primary);
  width: 100%;
  outline: none;
  padding: 0;
}
.search-box input::placeholder { color: var(--gray-400); }
.filter-group { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-select {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 30px 9px 11px;
  font-size: 0.84rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--t);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  box-shadow: var(--shadow-sm);
}
.filter-select:focus { outline: none; border-color: var(--gray-600); box-shadow: 0 0 0 3px rgba(0,0,0,0.05); }
.client-count { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 14px; font-weight: 500; }

/* ══════════════════════════════════════════════════════════
   CLIENT CARDS
   ══════════════════════════════════════════════════════════ */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px,1fr));
  gap: 14px;
}
.client-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: var(--t);
  display: flex;
  flex-direction: column;
  gap: 13px;
  box-shadow: var(--shadow-sm);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.client-card:active { transform: scale(0.98); box-shadow: var(--shadow-sm); }
.client-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.client-card-header { display: flex; align-items: center; gap: 11px; }
.client-avatar {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--gray-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.client-name { font-weight: 600; font-size: 0.92rem; color: var(--text-primary); line-height: 1.2; }
.client-tel  { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.client-card-body { display: flex; flex-direction: column; gap: 7px; }
.client-articles-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.article-tag {
  padding: 2px 9px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.client-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.client-date  { font-size: 0.75rem; color: var(--text-muted); }
.client-total { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }

/* ── Status Badges ────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border: 1px solid;
}
.status-badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status-en_attente  { background:var(--s-attente-bg); color:var(--s-attente-txt); border-color:var(--s-attente-bd); }
.status-en_cours    { background:var(--s-encours-bg); color:var(--s-encours-txt); border-color:var(--s-encours-bd); }
.status-pret        { background:var(--s-pret-bg);    color:var(--s-pret-txt);    border-color:var(--s-pret-bd); }
.status-livre       { background:var(--s-livre-bg);   color:var(--s-livre-txt);   border-color:var(--s-livre-bd); }
.status-annule      { background:var(--s-annule-bg);  color:var(--s-annule-txt);  border-color:var(--s-annule-bd); }
.status-pris_en_charge { background:var(--s-pris-bg); color:var(--s-pris-txt);    border-color:var(--s-pris-bd); }
.status-termine     { background:var(--s-livre-bg);   color:var(--s-livre-txt);   border-color:var(--s-livre-bd); }

/* ── Loading / Empty ──────────────────────────────────────── */
.loading-state    { grid-column:1/-1; text-align:center; padding:60px 20px; color:var(--text-muted); }
.empty-state      { text-align:center; padding:40px 20px; color:var(--text-muted); font-style:italic; font-size:0.88rem; }
.empty-state-full { grid-column:1/-1; display:flex; flex-direction:column; align-items:center; gap:12px; padding:60px 20px; color:var(--text-muted); }
.empty-state-full i { font-size:2.2rem; opacity:0.3; }
.empty-state-full p { font-size:0.9rem; }

/* ══════════════════════════════════════════════════════════
   FAB
   ══════════════════════════════════════════════════════════ */
.fab {
  position: fixed;
  bottom: calc(30px + env(safe-area-inset-bottom));
  right: calc(30px + env(safe-area-inset-right));
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.28);
  transition: var(--t);
  z-index: 60;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.fab:hover  { transform: translateY(-3px) scale(1.04); box-shadow: 0 8px 28px rgba(0,0,0,0.36); }
.fab:active { transform: scale(0.95); box-shadow: 0 2px 10px rgba(0,0,0,0.28); }

/* ══════════════════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal-overlay.hidden { display: none; }

.modal-stepper {
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: var(--radius-xl);
  padding: 32px;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: slideInUp 0.28s ease;
}
.modal-detail {
  width: 100%; max-width: 620px;
  max-height: 90vh; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: var(--radius-xl);
  padding: 32px;
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  position: relative;
  animation: slideInUp 0.28s ease;
}
.modal-close-btn {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  transition: var(--t);
  z-index: 10;
}
.modal-close-btn:hover { background: #FFE0E0; color: #8B0000; }

/* ══════════════════════════════════════════════════════════
   STEPPER
   ══════════════════════════════════════════════════════════ */
.stepper-header { margin-bottom: 28px; }
.stepper-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 22px;
  padding-right: 36px;
}
.stepper-progress { display: flex; align-items: center; gap: 0; }
.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
  position: relative;
}
.step-circle {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  border: 2px solid var(--gray-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gray-400);
  transition: var(--t);
  position: relative;
  z-index: 1;
}
.step-circle.active {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.08);
}
.step-circle.done {
  background: #1A6035;
  border-color: #1A6035;
  color: var(--white);
}
.step-circle.done::after { content: '✓'; font-size: 0.82rem; }
.step-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}
.step-indicator.active .step-label { color: var(--text-primary); }
.step-indicator.done   .step-label { color: #1A6035; }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--gray-200);
  margin-bottom: 20px;
  transition: var(--t);
  max-width: 60px;
}
.step-line.done { background: #1A6035; }

/* ── Step content ─────────────────────────────────────────── */
.step-content { animation: fadeIn 0.22s ease; }
.step-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 18px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.article-item {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}
.article-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.article-item-num {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.btn-remove-article { color: rgba(180,0,0,0.55); font-size: 0.88rem; padding: 3px 7px; border-radius: 4px; transition: var(--t); }
.btn-remove-article:hover { background: #FFE0E0; color: #8B0000; }
.btn-add-article {
  width: 100%;
  padding: 9px;
  background: var(--gray-50);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  transition: var(--t);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
}
.btn-add-article:hover { background: var(--gray-100); border-color: var(--gray-400); border-style: solid; }

/* Summary */
.summary-section {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 5px 0;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--text-muted); font-weight: 500; min-width: 80px; }
.summary-value { color: var(--text-primary); font-weight: 600; text-align: right; }
.summary-total { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }

/* Stepper nav */
.stepper-nav { display: flex; gap: 10px; margin-top: 24px; justify-content: space-between; align-items: center; }
.stepper-nav-right { display: flex; gap: 10px; margin-left: auto; }
.step-validation-error {
  font-size: 0.8rem;
  color: #8B0000;
  padding: 7px 12px;
  background: #FFF0F0;
  border: 1px solid #FFAAAA;
  border-radius: var(--radius-sm);
  margin-top: 7px;
}

/* ══════════════════════════════════════════════════════════
   MODAL DETAIL
   ══════════════════════════════════════════════════════════ */
.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-right: 36px;
}
.detail-avatar {
  width: 52px; height: 52px;
  border-radius: 10px;
  background: var(--gray-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}
.detail-name    { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.detail-contact { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.detail-meta    { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.detail-section { margin-bottom: 18px; }
.detail-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 9px;
}
.detail-article {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-bottom: 7px;
}
.detail-article-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.detail-article-type { font-weight: 600; font-size: 0.86rem; color: var(--text-primary); }
.detail-article-prix { font-weight: 700; color: var(--text-primary); }
.detail-article-desc { font-size: 0.8rem; color: var(--text-muted); }
.detail-notes {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  font-style: italic;
  min-height: 56px;
}
.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.status-select-inline {
  background: var(--gray-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 30px 7px 11px;
  font-size: 0.86rem;
  color: var(--text-primary);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
  transition: var(--t);
}
.status-select-inline:focus { outline: none; border-color: var(--gray-600); }
.article-etat-row { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.article-etat-label { font-size: 0.74rem; color: var(--text-muted); font-weight: 500; white-space: nowrap; }

/* ══════════════════════════════════════════════════════════
   TOASTS
   ══════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  align-items: center;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--white);
  max-width: 360px;
  width: max-content; /* S'adapte au contenu, jusqu'à max-width */
  box-shadow: 0 4px 20px rgba(0,0,0,0.22);
  animation: toastIn 0.25s ease;
  pointer-events: all;
  white-space: normal; /* Permet au texte long de passer à la ligne */
  word-wrap: break-word;
  line-height: 1.4;
}
.toast.success { background: #1A6035; }
.toast.error   { background: #8B0000; }
.toast.info    { background: var(--gray-900); }
.toast.exit    { animation: toastOut 0.25s ease forwards; }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes fadeIn    { from { opacity:0; } to { opacity:1; } }
@keyframes fadeInUp  { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideInUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastIn   { from { opacity:0; transform:translateY(8px) scale(0.96); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes toastOut  { from { opacity:1; transform:translateY(0) scale(1); } to { opacity:0; transform:translateY(8px) scale(0.96); } }
@keyframes spin      { to { transform:rotate(360deg); } }
.fa-spin { animation: spin 1s linear infinite; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .dashboard-stats-grid { grid-template-columns: repeat(2,1fr); }
  .stat-card.wide { grid-column: span 1; }
  .dashboard-charts-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: span 1; }
  
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .logo-full, 
  .sidebar .nav-item span { opacity: 0; width: 0; display: none; }
  
  .main-content { margin-left: var(--sidebar-collapsed); }
  
  .sidebar.mobile-open { width: var(--sidebar-width) !important; box-shadow: 4px 0 24px rgba(0,0,0,0.2); }
  .sidebar.mobile-open .logo-full,
  .sidebar.mobile-open .nav-item span { opacity: 1; width: auto; display: block; }
  
  .view { padding: 20px 20px 180px; }
  .app-header { padding: 0 20px; }
}

@media (max-width: 767px) {
  .main-content { margin-left: 0 !important; }
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; box-shadow: none; }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,0.3); }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  :root { --header-height: 56px; }
  .toast-container { bottom: 80px; }

  /* ── Safe area — header collé sous la barre de statut iOS ── */
  .app-header {
    padding: 0 16px;
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
  }

  /* ── Vue principale — espace pour indicateur home ─────── */
  .view {
    padding: 16px 16px calc(180px + env(safe-area-inset-bottom));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
  }

  /* ── Sidebar ───────────────────────────────────────────── */
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; box-shadow: none; }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.25); }
  .sidebar.mobile-open .logo-full,
  .sidebar.mobile-open .nav-item span { opacity: 1; width: auto; }
  .main-content { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .sidebar-toggle-btn { display: none; }

  /* ── Fix App Header Overflow ───────────────────────────── */
  #user-email-display { display: none; }
  .user-badge { padding: 8px; }
  .header-actions .btn { padding: 6px 10px; font-size: 0.8rem; }

  /* ── Dashboard ─────────────────────────────────────────── */
  .dashboard-stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-card.wide { grid-column: span 2; }
  .stat-icon { width: 36px; height: 36px; font-size: 0.9rem; flex-shrink: 0; }
  .stat-label { font-size: 0.65rem; }
  .stat-value { font-size: 1.3rem; }
  .dashboard-charts-grid { grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
  .chart-card { padding: 14px; }
  .chart-card.wide { grid-column: span 1; }
  .chart-card canvas { max-height: 180px; }
  .chart-card.wide canvas { max-height: 200px; }
  .recent-activity { padding: 14px; }
  .activity-item { flex-wrap: wrap; gap: 7px; padding: 8px 10px; }
  .activity-text { min-width: 0; font-size: 0.8rem; }
  .activity-time { width: 100%; font-size: 0.72rem; text-align: right; padding-top: 2px; }

  /* ── Grille clients ────────────────────────────────────── */
  .clients-grid { grid-template-columns: 1fr; }

  /* ── Toolbar flottante ─────────────────────────────────── */
  .view-toolbar {
    bottom: calc(82px + env(safe-area-inset-bottom));
    right: calc(18px + env(safe-area-inset-right));
    left: calc(18px + env(safe-area-inset-left));
    max-width: none;
    flex-direction: column;
    gap: 6px;
  }
  .search-box { min-width: 0; max-width: none; width: 100%; }
  .filter-group { width: 100%; flex-wrap: wrap; gap: 6px; }
  .filter-select {
    flex: 1; min-width: 0;
    font-size: 16px; /* Empêche le zoom iOS */
    padding: 10px 24px 10px 8px;
  }

  /* ── FAB ───────────────────────────────────────────────── */
  .fab {
    bottom: calc(18px + env(safe-area-inset-bottom));
    right: calc(18px + env(safe-area-inset-right));
    width: 52px; height: 52px;
    border-radius: 50%;
  }

  /* ── Modal — bottom sheet natif ───────────────────────── */
  .modal-stepper, .modal-detail {
    padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
    max-height: 95dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    margin: 0; max-width: 100%;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .stepper-progress { gap: 0; }
  .step-label { font-size: 0.63rem; }
  .step-line { max-width: 28px; }

  /* ── Inputs — CRITIQUE : empêche le zoom iOS (font-size < 16px) ── */
  .form-group input,
  .form-group select,
  .form-group textarea,
  .search-box input {
    font-size: 16px;
  }

  /* ── Misc ──────────────────────────────────────────────── */
  .user-badge span { display: none; }
  .detail-actions { flex-direction: column; }
  .form-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
   MODE STANDALONE (ajouté à l'écran d'accueil iOS/Android)
   ══════════════════════════════════════════════════════════ */
@media (display-mode: standalone) {

  /* ── html + body occupent exactement l'écran, sans overflow ── */
  html {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }
  body {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    /* Le fond couvre la safe-area en bas — défini par page-app / page-login */
  }

  /* ── App — conteneur plein écran scrollable ─────────────── */
  .app-container {
    height: 100%;
    height: 100dvh;
    overflow: hidden;
  }
  .main-content {
    /* Prend toute la hauteur restante, scroll uniquement ici */
    height: 100%;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
  }

  /* ── Header — pousse sous la barre de statut iOS ───────── */
  .app-header {
    height: calc(var(--header-height) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
  }

  /* ── Sidebar — commence sous la barre de statut ────────── */
  .sidebar {
    padding-top: env(safe-area-inset-top);
  }

  /* ── Vue — espace pour l'indicateur home en bas ─────────── */
  .view {
    padding-bottom: calc(180px + env(safe-area-inset-bottom));
  }

  /* ── FAB ────────────────────────────────────────────────── */
  .fab {
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
  }

  /* ── Toolbar ─────────────────────────────────────────────── */
  .view-toolbar {
    bottom: calc(94px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
  }

  /* ── Modal bottom sheet ──────────────────────────────────── */
  .modal-stepper,
  .modal-detail {
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
  }

  /* ── Login ───────────────────────────────────────────────── */
  .login-container {
    height: 100%;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: max(80px, calc(env(safe-area-inset-top) + 40px));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
}

/* ══════════════════════════════════════════════════════════
   ADMIN TABLES (Users, etc.)
   ══════════════════════════════════════════════════════════ */
.admin-table-wrapper { width: 100%; overflow-x: auto; background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.admin-table th { text-align: left; padding: 14px 20px; font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--gray-50); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 14px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table-row:hover { background: var(--gray-50); }
.admin-table-row.clickable { cursor: pointer; }

.row-user-info { display: flex; align-items: center; gap: 12px; }
.row-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gray-900); color: var(--white); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 600; }
.row-name { font-weight: 600; color: var(--text-primary); font-size: 0.92rem; }
.row-contact { display: flex; flex-direction: column; gap: 2px; }
.contact-line { font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.contact-line i { width: 12px; opacity: 0.6; }
.row-location { font-size: 0.85rem; color: var(--text-primary); }

/* ══════════════════════════════════════════════════════════
   CATEGORY MANAGEMENT (Rows)
   ══════════════════════════════════════════════════════════ */
.cat-manage-list { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.cat-row-container { padding: 0; overflow: hidden; border-radius: var(--radius-lg); }
.cat-row-header { padding: 16px 24px; background: var(--gray-50); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cat-row-name { font-size: 1.1rem; font-weight: 700; color: var(--black); }
.cat-row-id { font-size: 0.72rem; color: var(--text-muted); margin-left: 8px; font-family: monospace; }
.cat-row-types { display: flex; flex-wrap: wrap; }
.cat-type-column { flex: 1; min-width: 300px; padding: 20px 24px; border-right: 1px solid var(--border); }
.cat-type-column:last-child { border-right: none; }

.cat-type-title { display: inline-block; padding: 4px 12px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; margin-bottom: 16px; }
.sous-cat-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.sous-cat-item { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 8px 12px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 0.88rem; }
.sous-cat-item > span:first-child { flex: 1; min-width: 0; }
.sous-cat-actions { display: flex; gap: 4px; flex-shrink: 0; }
.text-muted-strikethrough { color: var(--text-muted); text-decoration: line-through; opacity: 0.6; }

/* Badge prix sous-catégorie (admin) */
.sous-cat-prix { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.prix-badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; background: rgba(0,120,60,0.1); color: #1A6035; white-space: nowrap; }
.prix-badge-empty { background: rgba(0,0,0,0.05); color: var(--text-muted); }
.sous-cat-prix-edit-input { width: 70px; padding: 3px 6px; font-size: 0.82rem; border: 1px solid var(--border); border-radius: var(--radius-sm); outline: none; }

.sous-cat-add-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sous-cat-input-inline { flex: 1; min-width: 120px; padding: 8px 12px; font-size: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-md); outline: none; transition: var(--t); }
.sous-cat-input-inline:focus { border-color: var(--gray-900); }
.sous-cat-prix-inline { width: 80px; padding: 8px 10px; font-size: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius-md); outline: none; transition: var(--t); }
.sous-cat-prix-inline:focus { border-color: var(--gray-900); }
.btn-plus-cat { width: 34px; height: 34px; border-radius: var(--radius-md); background: var(--gray-900); color: var(--white); display: flex; align-items: center; justify-content: center; transition: var(--t); }
.btn-plus-cat:hover { transform: scale(1.05); }

.btn-icon { width: 30px; height: 30px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; border: none; background: transparent; cursor: pointer; transition: var(--t); }
.btn-danger-soft { color: #8B0000; background: rgba(139,0,0,0.05); }
.btn-danger-soft:hover { background: rgba(139,0,0,0.1); }
.sous-cat-toggle.visible { color: var(--gray-900); }
.sous-cat-toggle.hidden-cat { color: var(--text-muted); }

/* Misc */
.clickable { cursor: pointer; }
.no-wrap { white-space: nowrap; }

/* Responsive specifics */
@media (max-width: 900px) {
  .cat-row-types { flex-direction: column; }
  .cat-type-column { border-right: none; border-bottom: 1px solid var(--border); min-width: 0; padding: 16px; }
  .cat-type-column:last-child { border-bottom: none; }
}

/* ── RESPONSIVE — SMALL MOBILE (≤ 480px) ─────────────────── */
@media (max-width: 480px) {
  /* Toast — prevent horizontal overflow */
  .toast {
    white-space: normal;
    max-width: calc(100vw - 40px);
    text-align: center;
  }

  /* View title — smaller */
  #view-title { font-size: 1.1rem; }

  /* Toolbar — compact filter selects */
  .filter-select {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  /* Category management — compact add row */
  .sous-cat-add-inline { flex-direction: column; gap: 6px; }
  .sous-cat-input-inline { min-width: 0; width: 100%; }
  .sous-cat-prix-inline { width: 100%; }

  /* Stepper & Detail Modal compact */
  .stepper-title { font-size: 1.1rem; }
  .step-circle { width: 28px; height: 28px; font-size: 0.72rem; }
  .modal-detail { padding: 24px 16px; border-radius: 20px 20px 0 0; }
  .detail-header { flex-direction: column; gap: 12px; }
  .detail-section { margin-bottom: 20px; }
  .detail-notes { font-size: .85rem; }
}

/* ── RESPONSIVE — VERY SMALL (≤ 360px) ───────────────────── */
@media (max-width: 360px) {
  /* Stat cards — compact */
  .stat-value { font-size: 1.15rem; }
  .stat-label { font-size: 0.62rem; letter-spacing: 0.04em; }
  .stat-card { padding: 10px; gap: 8px; }
  .stat-icon { width: 32px; height: 32px; font-size: 0.82rem; }

  /* View padding — tighter */
  .view {
    padding: 12px 12px calc(160px + env(safe-area-inset-bottom));
  }

  /* Header — smaller */
  .app-header { padding: 0 12px; }
  #view-title, #user-view-title { font-size: 1rem; }

  /* Toolbar — tighter */
  .view-toolbar { padding: 8px 10px; }
  .filter-select { font-size: 14px; padding: 8px 22px 8px 6px; }

  /* Summary in stepper */
  .summary-row { font-size: 0.8rem; }
  .summary-label { min-width: 60px; }
}

/* ── Misc ─────────────────────────────────────────────────── */
.divider    { height: 1px; background: var(--border); margin: 14px 0; }
.text-muted { color: var(--text-muted); font-size: 0.84rem; }
.text-center{ text-align: center; }
.mt-auto    { margin-top: auto; }
.flex       { display: flex; }
.flex-center{ display: flex; align-items: center; justify-content: center; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }
