/* ============================================================
   DESIGN SYSTEM — Fidélité App
   Style: Light & Airy — Tablet-first (iPad landscape), touch-optimized
   ============================================================ */

/* ─── Variables ─────────────────────────────────────────── */
:root {
  /* Couleurs primaires */
  --primary:        #6366F1;
  --primary-dark:   #4F46E5;
  --primary-light:  #EEF2FF;
  --primary-mid:    #C7D2FE;

  /* Sidebar — Light theme */
  --sidebar-bg:     #FFFFFF;
  --sidebar-border: #E5E7EB;
  --sidebar-hover:  #F8FAFC;
  --sidebar-active: #EEF2FF;
  --sidebar-text:   #6B7280;
  --sidebar-text-active: #4F46E5;
  --sidebar-width:  240px;

  /* Sémantique */
  --success:        #10B981;
  --success-light:  #D1FAE5;
  --danger:         #EF4444;
  --danger-light:   #FEE2E2;
  --warning:        #F59E0B;
  --warning-light:  #FEF3C7;
  --info:           #3B82F6;
  --info-light:     #DBEAFE;

  /* Texte */
  --text-primary:   #111827;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;
  --text-inverse:   #FFFFFF;

  /* Surfaces */
  --bg-app:         #F9FAFB;
  --bg-card:        #FFFFFF;
  --bg-input:       #FFFFFF;
  --border:         #E5E7EB;
  --border-light:   #F3F4F6;

  /* Ombres */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);

  /* Rayon */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 150ms ease;

  /* Topbar */
  --topbar-h: 64px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout principal ───────────────────────────────────── */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.app-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Logo icon via emoji in HTML now */

.nav-links {
  list-style: none;
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 15px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  white-space: nowrap;
  min-height: 56px;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--primary);
  text-decoration: none;
}

.nav-link.active,
.nav-link[data-page].active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
}

.nav-icon {
  font-size: 17px;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label { flex: 1; }

.nav-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 8px 0;
}

.nav-logout .nav-link,
li.nav-logout > a {
  color: #DC2626;
}
.nav-logout .nav-link:hover,
li.nav-logout > a:hover {
  background: var(--danger-light);
  color: #DC2626;
}

/* ─── Main content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -.2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shop-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-app);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

/* ─── Content wrapper ────────────────────────────────────── */
.content-wrapper {
  flex: 1;
  padding: 32px;
  max-width: 1400px;
  width: 100%;
}

/* ─── Flash messages ─────────────────────────────────────── */
.flash-messages {
  padding: 12px 32px 0;
}

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.alert-success { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }
.alert-error   { background: var(--danger-light);  color: #991B1B; border-color: #FECACA; }
.alert-warning { background: var(--warning-light); color: #92400E; border-color: #FDE68A; }
.alert-info    { background: var(--info-light);    color: #1E40AF; border-color: #BFDBFE; }

.alert-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: inherit; opacity: .6; padding: 0 4px;
  transition: opacity var(--transition);
  min-height: 48px;
  min-width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.alert-close:hover { opacity: 1; }

/* ─── Notifications toast ────────────────────────────────── */
#notification-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.notification {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  animation: slideIn .2s ease;
  border-left: 4px solid transparent;
  background: white;
  color: var(--text-primary);
}

@keyframes slideIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

.notification.success { border-color: var(--success); }
.notification.success::before { content: '✓'; color: var(--success); font-weight: 700; }
.notification.error   { border-color: var(--danger); }
.notification.error::before   { content: '✕'; color: var(--danger); font-weight: 700; }
.notification.warning { border-color: var(--warning); }
.notification.warning::before { content: '!'; color: var(--warning); font-weight: 700; }
.notification.info    { border-color: var(--info); }
.notification.info::before    { content: 'i'; color: var(--info); font-weight: 700; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 32px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
  letter-spacing: -.1px;
}

.subsection-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ─── Stat cards ─────────────────────────────────────────── */
.stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 32px;
  transition: box-shadow var(--transition), transform var(--transition);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 28px;
  width: 64px; height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.stat-content { flex: 1; min-width: 0; }

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.5px;
  line-height: 1;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  font-family: var(--font);
  min-height: 48px;
}

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-app); border-color: #D1D5DB; text-decoration: none; color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
}
.btn-danger:hover { background: #DC2626; border-color: #DC2626; text-decoration: none; color: #fff; }

.btn-success {
  background: var(--success);
  color: #FFFFFF;
  border-color: var(--success);
}
.btn-success:hover { background: #059669; border-color: #059669; text-decoration: none; color: #fff; }

.btn-sm {
  padding: 8px 14px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  min-height: auto;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn-block { width: 100%; }

.btn-icon {
  padding: 12px;
  border-radius: var(--radius-sm);
  min-height: 48px;
  min-width: 48px;
}

/* ─── Forms ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 16px;
  color: var(--text-primary);
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  min-height: 48px;
}

.form-control:hover { border-color: #D1D5DB; }

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 120px; }

.form-hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.form-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

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

.table thead tr {
  background: var(--bg-app);
  border-bottom: 1px solid var(--border);
}

.table th {
  padding: 14px 18px;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
  min-height: 52px;
}

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

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover { background: #FAFAFA; }

.table tbody tr[style*="cursor:pointer"]:hover { background: var(--primary-light); }

.text-center { text-align: center; }
.text-right  { text-align: right; }

.empty-state {
  padding: 48px !important;
  color: var(--text-muted);
  font-style: italic;
  font-size: 14px;
}

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
}

.badge-success { background: var(--success-light); color: #065F46; }
.badge-danger  { background: var(--danger-light);  color: #991B1B; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-info    { background: var(--info-light);    color: #1E40AF; }
.badge-neutral { background: var(--bg-app); color: var(--text-secondary); border: 1px solid var(--border); }

.text-success { color: var(--success); font-weight: 600; }
.text-danger  { color: var(--danger);  font-weight: 600; }
.text-muted   { color: var(--text-muted); }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 20px;
}

.pagination-info {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ─── Dashboard ──────────────────────────────────────────── */
.dashboard-container { display: flex; flex-direction: column; gap: 24px; }
.dashboard-section   { }

.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ─── Scanner / Caisse ───────────────────────────────────── */
.scanner-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
}

.scanner-input-section {
  grid-column: 1 / -1;
}

.barcode-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
}

.barcode-input-wrapper .form-control {
  font-size: 17px;
  font-family: monospace;
  letter-spacing: 1px;
}

.customer-info-card {
  display: none;
}
.customer-info-card.visible {
  display: block;
}

.customer-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.customer-avatar {
  width: 56px; height: 56px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
}

.customer-meta h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.2px;
}

.customer-meta p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.points-big {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
  line-height: 1;
  text-align: center;
  padding: 16px 0;
}

.points-label {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 4px;
}

.quick-add-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.quick-add-btn {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid var(--primary-mid);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  text-align: center;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-add-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.quick-add-btn:active {
  transform: scale(0.95);
  box-shadow: none;
}

/* ─── Search Results (Caisse) ───────────────────────────── */
.search-results-list {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  width: 100%;
  cursor: pointer;
  font-family: var(--font);
  font-size: 16px;
  text-align: left;
  transition: background var(--transition);
  min-height: 64px;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--primary-light); }
.search-result-item:active { background: var(--primary-mid); }

.search-result-avatar {
  width: 48px; height: 48px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-info strong {
  font-size: 16px;
  color: var(--text-primary);
}

.search-result-info span {
  font-size: 14px;
  color: var(--text-secondary);
}

.search-result-points {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.search-result-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 15px;
}

/* ─── Customer Profile Touch (Caisse) ───────────────────── */
.customer-profile-touch .customer-header {
  gap: 20px;
  margin-bottom: 16px;
  padding-bottom: 16px;
}

.customer-profile-touch .customer-avatar {
  width: 64px; height: 64px;
  font-size: 26px;
}

.customer-points-badge {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--primary-light);
  border: 2px solid var(--primary-mid);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  min-width: 100px;
}

.points-number {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.points-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 2px;
}

/* ─── Discount Progress Bar ─────────────────────────────── */
.discount-progress-section {
  margin-top: 8px;
}

.discount-progress-bar {
  width: 100%;
  height: 10px;
  background: var(--bg-app);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border);
}

.discount-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--success) 100%);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.discount-bar-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
}

/* ─── Custom Amount Row ─────────────────────────────────── */
.custom-amount-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
}

.custom-amount-row .form-control {
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}

/* ─── Discount Available Banner ─────────────────────────── */
.discount-available-banner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.discount-icon {
  font-size: 36px;
  flex-shrink: 0;
}

.discount-text {
  flex: 1;
}

.discount-text strong {
  font-size: 17px;
  color: var(--success);
  display: block;
}

.discount-text p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Caisse Bottom Actions ─────────────────────────────── */
.caisse-bottom-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.caisse-bottom-actions .btn {
  min-height: 56px;
  font-size: 16px;
}

/* ─── Clients ────────────────────────────────────────────── */
.table tbody tr.eligible-discount {
  background: linear-gradient(90deg, #D1FAE5 0%, #ECFDF5 100%);
  border-left: 4px solid var(--success);
}
.table tbody tr.eligible-discount:hover {
  background: linear-gradient(90deg, #A7F3D0 0%, #D1FAE5 100%);
}
.table tbody tr.eligible-discount td:first-child {
  padding-left: 12px;
}

.customers-container { display: flex; flex-direction: column; gap: 24px; }

.customers-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 480px;
}

.search-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
}

.search-wrapper .form-control {
  padding-left: 44px;
}

/* ─── Detail client ──────────────────────────────────────── */
.customer-detail-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 28px;
  align-items: start;
}

.customer-profile-card {
  position: sticky;
  top: calc(var(--topbar-h) + 32px);
}

.profile-avatar-lg {
  width: 84px; height: 84px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: var(--primary);
  margin: 0 auto 18px;
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -.3px;
}

.profile-barcode {
  text-align: center;
  font-family: monospace;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--bg-app);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin: 10px auto;
}

.profile-points {
  text-align: center;
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
  line-height: 1;
  margin: 18px 0 6px;
}

.profile-points-label {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 18px;
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}

.profile-info-row:last-child { border-bottom: none; }
.profile-info-label { color: var(--text-muted); font-size: 13px; }
.profile-info-value { font-weight: 600; }

.profile-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

/* ─── Add customer ───────────────────────────────────────── */
.add-customer-container {
  max-width: 600px;
}

.success-card {
  text-align: center;
  padding: 48px 40px;
}

.success-icon {
  font-size: 64px;
  margin-bottom: 18px;
}

.success-barcode-display {
  font-family: monospace;
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  padding: 14px 28px;
  border-radius: var(--radius-md);
  letter-spacing: 2px;
  margin: 18px 0;
  display: inline-block;
  border: 2px dashed var(--primary-mid);
}

/* ─── Settings ───────────────────────────────────────────── */
.settings-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.settings-section { }

.settings-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}

/* ─── Reports ────────────────────────────────────────────── */
.reports-container { display: flex; flex-direction: column; gap: 24px; }
.reports-section { }
.distribution-container, .activity-container { }

/* ─── SMS Campaign ───────────────────────────────────────── */
.sms-container { display: flex; flex-direction: column; gap: 24px; }

.sms-info-row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.recipients-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.info-text {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
  margin-left: auto;
}

.recipients-summary {
  margin-bottom: 16px;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 15px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--primary-mid);
}

.sms-send-section {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 18px 22px;
  gap: 12px;
}

.result-detail {
  font-size: 14px;
  line-height: 1.8;
}

.result-detail p { margin-bottom: 8px; }
.error-text { color: var(--danger); }

/* ─── Login page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #E0E7FF 0%, #F0F4FF 50%, #EEF2FF 100%);
  padding: 20px;
}

.login-card {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  font-size: 32px;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px rgba(99,102,241,.3);
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.3px;
}

.login-logo p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 6px;
}

.login-form .form-group { margin-bottom: 18px; }

.login-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  margin-top: 10px;
  min-height: 52px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Offline page ───────────────────────────────────────── */
.offline-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 48px;
}

/* ─── Active nav link (JS-driven) ────────────────────────── */
.nav-link.is-active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active) !important;
}

/* ─── Utilities ──────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.gap-4       { gap: 16px; }
.mt-2        { margin-top: 8px; }
.mt-4        { margin-top: 16px; }
.mb-4        { margin-bottom: 16px; }
.w-full      { width: 100%; }
.hidden      { display: none !important; }

/* ─── Scrollbar personnalisée ────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,.08); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.12); }

/* ─── Responsive (tablet) ────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-width: 64px; }

  .nav-label, .app-logo span, .sidebar-header h1 { display: none; }
  .app-logo { justify-content: center; }
  .nav-link { justify-content: center; padding: 14px; }
  .nav-icon { width: auto; font-size: 20px; }
  .sidebar-header { padding: 16px 10px; }

  .scanner-container { grid-template-columns: 1fr; }
  .customer-detail-grid { grid-template-columns: 1fr; }
  .settings-container { grid-template-columns: 1fr; }

  .content-wrapper { padding: 24px 20px; }
  .card { padding: 24px; }
  .stat-card { padding: 24px 28px; }
}

@media (max-width: 640px) {
  .stats-section { grid-template-columns: 1fr 1fr; }
  .quick-add-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Theme Toggle Button ───────────────────────────────── */
.btn-theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 18px;
  flex-shrink: 0;
}
.btn-theme-toggle:hover {
  background: var(--bg-app);
  border-color: var(--primary);
  transform: scale(1.05);
}

/* ─── DARK MODE ─────────────────────────────────────────── */
html[data-theme="dark"] {
  /* Surfaces */
  --bg-app:          #111318;
  --bg-card:         #1A1D24;
  --bg-input:        #22252E;
  --border:          #2E323C;
  --border-light:    #252830;

  /* Texte */
  --text-primary:    #E8EAED;
  --text-secondary:  #9AA0AC;
  --text-muted:      #6B7280;

  /* Primaire */
  --primary:         #748FFC;
  --primary-dark:    #5C7CFA;
  --primary-light:   #1E2235;
  --primary-mid:     #2E3552;

  /* Sémantique */
  --success:         #51CF66;
  --success-light:   #0E2A15;
  --danger:          #FF6B6B;
  --danger-light:    #2A0E0E;
  --warning:         #FCC419;
  --warning-light:   #2A2510;
  --info:            #4DABF7;
  --info-light:      #0E1E2A;

  /* Ombres */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.35), 0 2px 4px -1px rgba(0,0,0,.25);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -2px rgba(0,0,0,.3);
  --shadow-xl:  0 20px 25px -5px rgba(0,0,0,.5), 0 10px 10px -5px rgba(0,0,0,.3);
}

/* Sidebar dark */
html[data-theme="dark"] .sidebar {
  background: #14161C;
  border-right-color: #2E323C;
}

html[data-theme="dark"] .sidebar-header {
  border-bottom-color: #2E323C;
}

html[data-theme="dark"] .app-logo {
  color: #E8EAED;
}

html[data-theme="dark"] .nav-link {
  color: #9AA0AC;
}

html[data-theme="dark"] .nav-link:hover {
  background: #1E2128;
  color: #E8EAED;
}

html[data-theme="dark"] .nav-link.is-active {
  background: var(--primary-light);
  color: var(--primary);
}

html[data-theme="dark"] li.nav-logout > a {
  color: #FF8787;
}

html[data-theme="dark"] li.nav-logout > a:hover {
  background: rgba(255,107,107,.1);
  color: #FFA8A8;
}

/* Topbar dark */
html[data-theme="dark"] .topbar {
  background: #14161C;
  border-bottom-color: #2E323C;
}

html[data-theme="dark"] .shop-name {
  background: #1A1D24;
  border-color: #2E323C;
  color: #9AA0AC;
}

/* Toggle button dark */
html[data-theme="dark"] .btn-theme-toggle {
  border-color: #2E323C;
}
html[data-theme="dark"] .btn-theme-toggle:hover {
  background: #1E2128;
  border-color: var(--primary);
}

/* Tables dark */
html[data-theme="dark"] .table thead tr {
  background: #14161C;
}
html[data-theme="dark"] .table tbody tr:hover {
  background: #1E2128;
}

/* Eligible discount dark */
html[data-theme="dark"] .table tbody tr.eligible-discount {
  background: linear-gradient(90deg, #0E2A15 0%, #142218 100%);
  border-left-color: var(--success);
}
html[data-theme="dark"] .table tbody tr.eligible-discount:hover {
  background: linear-gradient(90deg, #143A1E 0%, #1A2E20 100%);
}

/* Quick add buttons dark */
html[data-theme="dark"] .quick-add-btn {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-mid);
}
html[data-theme="dark"] .quick-add-btn:hover {
  background: var(--primary);
  color: #FFFFFF;
}

/* Notifications dark */
html[data-theme="dark"] .notification {
  background: #1A1D24;
  color: #E8EAED;
  border-left-width: 4px;
}

/* Alerts dark */
html[data-theme="dark"] .alert-success { background: #0E2A15; color: #51CF66; border-color: #1A3A20; }
html[data-theme="dark"] .alert-error   { background: #2A0E0E; color: #FF6B6B; border-color: #3A1A1A; }
html[data-theme="dark"] .alert-warning { background: #2A2510; color: #FCC419; border-color: #3A3218; }
html[data-theme="dark"] .alert-info    { background: #0E1E2A; color: #4DABF7; border-color: #1A2E3A; }

/* Search results dark */
html[data-theme="dark"] .search-result-item {
  background: var(--bg-card);
  border-bottom-color: var(--border);
}
html[data-theme="dark"] .search-result-item:hover {
  background: var(--primary-light);
}
html[data-theme="dark"] .search-result-avatar {
  background: var(--primary-light);
}

/* Customer points badge dark */
html[data-theme="dark"] .customer-points-badge {
  background: var(--primary-light);
  border-color: var(--primary-mid);
}

/* Discount progress bar dark */
html[data-theme="dark"] .discount-progress-bar {
  background: #22252E;
  border-color: #2E323C;
}

/* Buttons secondary dark */
html[data-theme="dark"] .btn-secondary {
  background: #22252E;
  color: #E8EAED;
  border-color: #2E323C;
}
html[data-theme="dark"] .btn-secondary:hover {
  background: #2E323C;
  border-color: #3E424C;
  color: #FFFFFF;
}

/* Login page dark */
html[data-theme="dark"] .login-page {
  background: linear-gradient(135deg, #0D0F14 0%, #14161C 50%, #1A1D24 100%);
}

html[data-theme="dark"] .login-card {
  background: #1A1D24;
  border: 1px solid #2E323C;
}

html[data-theme="dark"] .login-logo h1 { color: #E8EAED; }
html[data-theme="dark"] .login-logo p { color: #6B7280; }
html[data-theme="dark"] .login-footer { color: #6B7280; }

/* Form controls dark focus */
html[data-theme="dark"] .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(116,143,252,.2);
}

/* Scrollbar dark */
html[data-theme="dark"] .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); }

/* Sort headers dark */
html[data-theme="dark"] th[data-sort]:hover { color: var(--primary); }

/* ─── Fullscreen Confirmation Overlay ──────────────────── */
.fullscreen-confirm {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(16, 185, 129, 0.92);
  color: #fff;
  animation: fc-in .25s ease-out;
}
.fullscreen-confirm.fade-out {
  animation: fc-out .4s ease-in forwards;
}
.fullscreen-confirm .fc-check {
  font-size: 72px;
  margin-bottom: 12px;
}
.fullscreen-confirm .fc-amount {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -1px;
}
.fullscreen-confirm .fc-points {
  font-size: 28px;
  font-weight: 500;
  opacity: .9;
  margin-top: 4px;
}
@keyframes fc-in {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes fc-out {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.05); }
}

/* ─── Quick Create Form (Caisse) ───────────────────────── */
.quick-create-form {
  background: var(--bg-card);
  border: 2px dashed var(--primary-mid);
  border-radius: var(--radius);
  padding: 16px;
}
.quick-create-fields {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.quick-create-fields .form-control {
  flex: 1;
  min-width: 0;
}
.quick-create-actions {
  display: flex;
  gap: 10px;
}
.quick-create-actions .btn {
  min-height: 44px;
}

/* ─── Mute / Sound Toggle Button ───────────────────────── */
.btn-sound-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background .15s, border-color .15s;
}
.btn-sound-toggle:hover {
  background: var(--sidebar-hover);
  border-color: var(--primary-mid);
}

/* ─── Dark mode — New components ───────────────────────── */
html[data-theme="dark"] .fullscreen-confirm {
  background: rgba(16, 185, 129, 0.88);
}
html[data-theme="dark"] .quick-create-form {
  background: var(--bg-card);
  border-color: #2E323C;
}
html[data-theme="dark"] .btn-sound-toggle {
  border-color: #2E323C;
}
html[data-theme="dark"] .btn-sound-toggle:hover {
  background: #22252E;
  border-color: #3E424C;
}

/* ─── Daily Stats Bar (Caisse) ─────────────────────────── */
.daily-stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.daily-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.daily-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}
.daily-stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 2px;
}

html[data-theme="dark"] .daily-stat {
  background: var(--bg-card);
  border-color: #2E323C;
}

/* ─── Reports Page ─────────────────────────────────────── */
.reports-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
}
.stat-icon {
  font-size: 32px;
  flex-shrink: 0;
}
.stat-info {
  display: flex;
  flex-direction: column;
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.reports-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.period-selector {
  display: flex;
  gap: 6px;
}
.period-btn {
  padding: 6px 14px !important;
  font-size: 13px !important;
  min-height: 36px !important;
  border-radius: 20px !important;
}
.period-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}
.chart-container {
  position: relative;
  width: 100%;
  min-height: 220px;
}
.reports-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.export-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .reports-columns { grid-template-columns: 1fr; }
  .daily-stats-bar { flex-wrap: wrap; }
  .daily-stat { min-width: calc(50% - 8px); }
}

/* ─── Settings — Sections verrouillées (end-user) ─────── */
.settings-locked {
  opacity: .65;
  pointer-events: none;
  position: relative;
}
.settings-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(0,0,0,.025) 6px,
    rgba(0,0,0,.025) 12px
  );
  pointer-events: none;
}
/* Topbar username pill */
.topbar-user {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  border-radius: 20px;
  padding: 3px 10px;
  letter-spacing: .3px;
}
html[data-theme="dark"] .topbar-user {
  background: var(--primary-light);
  border-color: var(--primary-mid);
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.section-title-row .section-title {
  margin-bottom: 0;
}
.lock-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--warning);
  background: var(--warning-light);
  border: 1px solid #FCD34D;
  border-radius: 20px;
  padding: 2px 10px;
  white-space: nowrap;
}
html[data-theme="dark"] .lock-badge {
  background: rgba(245,158,11,.15);
  border-color: rgba(245,158,11,.3);
}
html[data-theme="dark"] .settings-locked::after {
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(255,255,255,.03) 6px,
    rgba(255,255,255,.03) 12px
  );
}

/* ─── SMS Credits Bar ──────────────────────────────────── */
.sms-credits-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
}
.sms-credits-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}
.credits-icon { font-size: 22px; }
.credits-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}
.credits-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex: 1;
}
.credits-loading {
  font-size: 13px;
  color: var(--text-secondary);
}
.btn-refresh-credits {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .2s;
}
.btn-refresh-credits:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: rotate(180deg);
}

html[data-theme="dark"] .sms-credits-bar {
  background: var(--bg-card);
  border-color: #2E323C;
}
html[data-theme="dark"] .btn-refresh-credits {
  border-color: #2E323C;
  color: #9CA3AF;
}
html[data-theme="dark"] .btn-refresh-credits:hover {
  background: var(--primary-light);
  color: var(--primary);
}
