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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #F5EFE6;
  color: #1C2B24;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #1C2B24;
  display: flex;
  flex-direction: column;
  padding: 24px 14px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
}

.sb-brand { padding: 0 12px; margin-bottom: 32px; }
.sb-brand-top { font-size: 16px; font-weight: 700; color: rgba(255,255,255,0.35); display: flex; align-items: center; }
.sb-brand-sep { font-size: 13px; color: rgba(255,255,255,0.2); margin: 0 6px; font-weight: 300; }
.sb-brand-commerce { font-size: 20px; font-weight: 800; color: white; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; letter-spacing: -0.3px; }

.sb-section { font-size: 11px; margin: 20px 0 6px; font-weight: 700; color: rgba(255,255,255,0.2); text-transform: uppercase; letter-spacing: 1px; padding: 0 10px; margin: 16px 0 5px; }

.sb-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-radius: 10px; font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.45); cursor: pointer; margin-bottom: 2px; text-decoration: none; transition: background 0.15s, color 0.15s; }
.sb-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.75); }
.sb-item.active { background: #4A7060; color: white; }
.sb-item.deco { color: rgba(255,100,100,0.65); }
.sb-item.deco:hover { background: rgba(255,100,100,0.08); color: rgba(255,120,120,0.9); }

.sb-spacer { flex: 1; min-height: 20px; }
.sb-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 12px; }

.page-wrapper { margin-left: 260px; flex: 1; min-height: 100vh; }

main { max-width: 960px; margin: 0 auto; padding: 32px 32px; }

.page-wrapper > main,
.page-wrapper main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 32px;
}

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 800; color: #1C2B24; }
.page-header-sub { font-size: 13px; color: #94a3b8; margin-top: 3px; }
.page-header-date { font-size: 12px; color: #94a3b8; background: white; border: 1px solid #E0EAE4; border-radius: 8px; padding: 6px 14px; }

.scanner-box { background: white; border: 1px solid #E0EAE4; border-radius: 16px; padding: 24px; margin-bottom: 20px; }
.scanner-box h2 { font-size: 15px; font-weight: 700; color: #1C2B24; margin-bottom: 14px; }

.scanner-dark { background: #1C2B24; border-radius: 14px; padding: 16px 20px; margin-bottom: 20px; display: flex; align-items: center; gap: 14px; }
.scanner-dark-label { font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.scanner-dark-sep { width: 1px; height: 24px; background: rgba(255,255,255,0.1); flex-shrink: 0; }

.scanner-form { display: flex; gap: 12px; flex: 1; }
.scanner-form input { flex: 1; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; padding: 10px 14px; font-size: 14px; color: white; outline: none; font-family: inherit; }
.scanner-form input::placeholder { color: rgba(255,255,255,0.25); }
.scanner-form input:focus { border-color: rgba(165,180,252,0.4); }
.scanner-form button { background: #4A7060; color: white; border: none; border-radius: 8px; padding: 10px 18px; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; font-family: inherit; transition: opacity 0.2s; }
.scanner-form button:hover { opacity: 0.88; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-card { background: white; border: 1px solid #E0EAE4; border-radius: 14px; padding: 18px 16px; }
.stat-card.accent { background: #4A7060; border-color: #4A7060; }
.stat-label { font-size: 10px; font-weight: 700; color: #5A8A78; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.stat-card.accent .stat-label { color: rgba(255,255,255,0.55); }
.stat-value { font-size: 32px; font-weight: 800; color: #1C2B24; letter-spacing: -1px; }
.stat-card.accent .stat-value { color: white; }
.stat-sub { font-size: 11px; color: #94a3b8; margin-top: 3px; }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi-card { background: white; border: 1px solid #E0EAE4; border-radius: 14px; padding: 18px; }
.kpi-title { font-size: 10px; font-weight: 700; color: #5A8A78; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }

.section-title { font-size: 16px; font-weight: 700; color: #1C2B24; margin-bottom: 14px; }

nav { display: none; }

table { width: 100%; background: white; border: 1px solid #E0EAE4; border-radius: 16px; border-collapse: separate; border-spacing: 0; }
th:first-child { border-top-left-radius: 15px; }
th:last-child { border-top-right-radius: 15px; }
thead { background: #F5EFE6; }
th { padding: 12px 18px; text-align: left; font-size: 11px; font-weight: 700; color: #5A8A78; text-transform: uppercase; letter-spacing: 0.6px; border-bottom: 1px solid #E0EAE4; }
td { padding: 14px 18px; font-size: 14px; color: #1C2B24; border-bottom: 1px solid #EDF3EF; }
tr:last-child td { border-bottom: none; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 16px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge.actif { background: #d1fae5; color: #065f46; }
.badge.proche { background: #fef3c7; color: #92400e; }
.badge.inactif { background: #f1f5f9; color: #64748b; }
.badge.recompense { background: #EDF3EF; color: #4A7060; }

.result-success { margin-top: 14px; padding: 12px 16px; background: #d1fae5; color: #065f46; border-radius: 10px; font-weight: 600; font-size: 14px; }
.result-error { margin-top: 14px; padding: 12px 16px; background: #fee2e2; color: #991b1b; border-radius: 10px; font-weight: 600; font-size: 14px; }

.btn-valider { background: #059669; color: white; border: none; border-radius: 8px; padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-suspendre { background: #dc2626; color: white; border: none; border-radius: 8px; padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer; }
.btn-reactiver { background: #d97706; color: white; border: none; border-radius: 8px; padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer; }

.nouveau-client-box { background: white; border: 1px solid #E0EAE4; border-radius: 16px; padding: 24px; margin-bottom: 20px; }
.nouveau-client-form { display: flex; gap: 12px; }
.nouveau-client-form input { flex: 1; background: #F5EFE6; border: 1px solid #E0EAE4; border-radius: 10px; padding: 12px 16px; font-size: 14px; color: #1C2B24; outline: none; font-family: inherit; }
.nouveau-client-form input:focus { border-color: #4A7060; }
.nouveau-client-form button { background: #059669; color: white; border: none; border-radius: 10px; padding: 12px 20px; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; font-family: inherit; }

.drawer-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 998; }

.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #1C2B24;
  z-index: 997;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.mobile-header-brand {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-header-logo {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255,255,255,0.35);
}

.mobile-header-sep {
  font-size: 13px;
  color: rgba(255,255,255,0.2);
}

.mobile-header-commerce {
  font-size: 15px;
  font-weight: 800;
  color: white;
}

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .burger-btn { display: none !important; }
  .admin-layout .burger-btn { display: flex !important; }
}
.drawer-overlay.open { display: block; }

.burger-btn { display: none; flex-direction: column; gap: 5px; cursor: pointer; background: #1C2B24; border: none; border-radius: 10px; padding: 10px 12px; position: fixed; top: 16px; right: 16px; z-index: 101; }
.burger-btn span { display: block; width: 20px; height: 2px; background: rgba(255,255,255,0.85); border-radius: 2px; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .page-wrapper { margin-left: 0; width: 100%; overflow-x: hidden; padding-top: 56px; }
  main { padding: 16px 16px 20px; max-width: 100% !important; }
  .burger-btn { display: flex; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 24px; }
  .kpi-grid { grid-template-columns: 1fr; }

  /* Scanner */
  .scanner-dark { flex-direction: column; align-items: stretch; gap: 10px; }
  .scanner-dark-sep { display: none; }
  .scanner-form { flex-direction: column; }
  .scanner-form input { width: 100%; }
  .scanner-form button { width: 100%; padding: 12px; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-header-date { display: none; }
  .page-header h1 { font-size: 20px; }

  /* Cards et grilles */
  .scanner-box { padding: 16px; }
  .kpi-card { padding: 14px; }
  .nouveau-client-form { flex-direction: column; }
  .nouveau-client-form button { width: 100%; }

  /* Tables */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; }
  th, td { padding: 10px 12px; font-size: 13px; }

  /* Grilles inline */
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
  }

  /* Heatmap traffic */
  .heatmap-wrap { overflow-x: auto; }
  .heatmap-grid { min-width: 500px; }

  /* Onglets clients */
  .onglets { gap: 6px; }
  .onglet { padding: 8px 12px; font-size: 13px; }

  /* Boutons */
  .btn-hero { width: 100%; text-align: center; }

  /* Body overflow fix */
  body { overflow-x: hidden; }
}


.admin-layout .page-wrapper > *,
.admin-layout .page-wrapper main,
.admin-layout .admin-content {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
}

.admin-layout { display: flex !important; }
body:has(.admin-layout) { display: block !important; }

/* ADMIN RESPONSIVE AVANCE */
@media (max-width: 768px) {
  /* Masquer colonnes secondaires sur mobile */
  .admin-col-hide { display:none !important; }

  /* Topbar admin mobile */
  .admin-topbar { padding:10px 16px !important; }
  .admin-topbar-title { font-size:14px !important; }
  #recherche-globale { width:140px !important; font-size:12px !important; padding:6px 10px !important; }

  /* Cards stats en 2 colonnes */
  .stats-grid-6, .wallet-stats { grid-template-columns:1fr 1fr !important; }
  .abo-grid { grid-template-columns:1fr 1fr !important; }

  /* Tables scrollables */
  .admin-card { overflow-x:auto; }
  table { min-width:600px; }
  th, td { padding:10px 12px !important; font-size:12px !important; }

  /* Actions compactes */
  .btn-sm { padding:4px 8px !important; font-size:11px !important; }

  /* Wallet grid 1 colonne */
  .wallet-grid { grid-template-columns:1fr !important; }
  .wallet-filters { flex-direction:column !important; }
  .search-input { min-width:100% !important; }

  /* Form row vertical */
  .form-row { flex-direction:column !important; }

  /* Modal plein ecran sur mobile */
  .modal-box { width:95% !important; padding:20px !important; border-radius:16px !important; }
}
