/* ========================================================
   VARIABLES ET SYSTÈME DE DESIGN MODERNE
======================================================== */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg-app: #0f172a;
  --bg-sidebar: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #273549;
  --bg-input: #0f172a;
  
  --border-color: #334155;
  --border-focus: #38bdf8;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #38bdf8;
  --primary-hover: #0284c7;
  --primary-subtle: rgba(56, 189, 248, 0.12);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  
  --warning: #f59e0b;
  --purple: #a855f7;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}

/* Barres de défilement sombres et discrètes (Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: #334155;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #475569;
}

::-webkit-scrollbar-button {
  display: none;
}

.clickable-product {
  cursor: pointer;
  transition: color 0.15s ease;
}

.clickable-product:hover {
  color: var(--primary) !important;
  text-decoration: underline;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ========================================================
   STRUCTURE PRINCIPALE (LAYOUT)
======================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  font-size: 28px;
  background: rgba(56, 189, 248, 0.15);
  border-radius: var(--radius-md);
  padding: 6px 10px;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.badge-local {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease-in-out;
  width: 100%;
}

.nav-item .icon {
  font-size: 18px;
}

.nav-item:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(14, 165, 233, 0.25));
  color: var(--primary);
  font-weight: 600;
  border-left: 3px solid var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quick-stats-box {
  background: rgba(15, 23, 42, 0.6);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.qs-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

.qs-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.qs-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.system-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--success);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background-color: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.topbar-title p {
  font-size: 13px;
  color: var(--text-muted);
}

.view-section {
  display: none;
  padding: 32px;
}

.view-section.active {
  display: block;
}

/* ========================================================
   COMPOSANTS RÉUTILISABLES (BOUTONS, CARTES, BADGES)
======================================================== */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.card-badge {
  font-size: 11px;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #0f172a;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #fff;
}

.btn-secondary {
  background-color: rgba(56, 189, 248, 0.15);
  color: var(--primary);
  border-color: rgba(56, 189, 248, 0.3);
}

.btn-secondary:hover {
  background-color: rgba(56, 189, 248, 0.25);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-muted);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
}

.btn-danger-outline {
  background-color: transparent;
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-danger-outline:hover {
  background-color: var(--danger-bg);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success);
}

.text-primary { color: var(--primary) !important; }
.text-green { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-right { text-align: right !important; }
.hidden { display: none !important; }

/* ========================================================
   VUE 1 : TABLEAU DE BORD (KPIS & GRAPHIQUES)
======================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.card-blue::before { background: #38bdf8; }
.card-green::before { background: #10b981; }
.card-purple::before { background: #a855f7; }
.card-amber::before { background: #f59e0b; }

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-icon {
  font-size: 20px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.kpi-footer {
  font-size: 12px;
  color: var(--text-dim);
}

/* Grilles Graphiques */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container-flex {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 20px;
  flex-wrap: wrap;
}

.dashboard-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .dashboard-details-grid {
    grid-template-columns: 1fr;
  }
}

/* Liste des catégories & Barres de progression */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cat-bar-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cat-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.cat-name-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.cat-bar-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-app);
  border-radius: 999px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Top Produits */
.top-products-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-prod-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background-color: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.top-prod-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-prod-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  width: 20px;
}

.top-prod-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.top-prod-cat {
  font-size: 11px;
  color: var(--text-dim);
}

.top-prod-spent {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
}

.top-prod-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ========================================================
   VUE 2 : IMPORTATION & DRAG & DROP
======================================================== */
.upload-wrapper {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.upload-dropzone {
  border: 2px dashed #475569;
  border-radius: var(--radius-xl);
  padding: 60px 30px;
  text-align: center;
  background: rgba(30, 41, 59, 0.4);
  transition: all 0.2s ease;
  cursor: pointer;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.05);
}

.file-input-hidden {
  display: none;
}

.drop-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.dropzone-content h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.dropzone-content p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

.upload-hints {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-dim);
}

.upload-progress-card {
  padding: 40px;
  text-align: center;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.progress-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px auto;
}

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

.result-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background-color: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-md);
}

.mini-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mk-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.mk-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

/* Tableaux */
.table-responsive {
  overflow-x: auto;
}

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

.data-table th {
  padding: 10px 12px;
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  color: var(--text-main);
}

.data-table tbody tr:hover {
  background-color: var(--bg-card-hover);
}

/* ========================================================
   VUE 3 : HISTORIQUE DES TICKETS
======================================================== */
.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  flex: 1;
  min-width: 240px;
}

.search-box input {
  background: transparent;
  border: none;
  color: var(--text-main);
  outline: none;
  font-size: 13px;
  width: 100%;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-group select, .filter-group input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
}

.receipts-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.receipt-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.15s ease;
  cursor: pointer;
}

.receipt-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.rc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  color: #fff;
}

.rc-file-badge {
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(148, 163, 184, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.rc-store-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.rc-date {
  font-size: 12px;
  color: var(--text-muted);
}

.rc-body {
  margin: 14px 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.rc-total {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.rc-discounts {
  font-size: 12px;
  color: var(--success);
  font-weight: 600;
}

.rc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

/* ========================================================
   VUE 4 : COMPARATEUR & VUE 5 : INFLATION
======================================================== */
.intro-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.intro-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.intro-icon {
  font-size: 32px;
  background: rgba(56, 189, 248, 0.12);
  padding: 10px;
  border-radius: var(--radius-md);
}

.comparator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

.comp-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.comp-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
}

.comp-cat {
  font-size: 12px;
  color: var(--text-dim);
}

.comp-advantage-badge {
  font-size: 11px;
  font-weight: 700;
  background-color: var(--success-bg);
  color: var(--success);
  padding: 4px 8px;
  border-radius: 6px;
}

.comp-stores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.comp-stores-table td {
  padding: 8px 0;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
}

/* Inflation */
.inflation-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inflation-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.inf-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.inf-icon {
  font-size: 26px;
}

.inf-title {
  font-size: 15px;
  font-weight: 700;
}

.inf-subtitle {
  font-size: 12px;
  color: var(--text-dim);
}

.inf-prices {
  display: flex;
  align-items: center;
  gap: 24px;
}

.inf-price-box {
  text-align: right;
}

.inf-p-label {
  font-size: 11px;
  color: var(--text-dim);
}

.inf-p-val {
  font-size: 16px;
  font-weight: 700;
}

.inf-change-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  min-width: 70px;
  text-align: center;
}

.pill-up {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.pill-down {
  background-color: var(--success-bg);
  color: var(--success);
}

.pill-same {
  background-color: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
}

/* ========================================================
   MODAL DÉTAILS
======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-store-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: #0284c7;
  color: #fff;
  display: inline-block;
  margin-bottom: 4px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.modal-date {
  font-size: 13px;
  color: var(--text-muted);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-dim);
  cursor: pointer;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-kpis-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
  background-color: rgba(15, 23, 42, 0.4);
  padding: 14px;
  border-radius: var(--radius-md);
}

.mk-box {
  display: flex;
  flex-direction: column;
}

.mk-title {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.mk-value {
  font-size: 18px;
  font-weight: 700;
}

.modal-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.modal-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.modal-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.modal-tab-content {
  display: none;
}

.modal-tab-content.active {
  display: block;
}

.file-viewer-wrapper {
  min-height: 400px;
  background-color: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-viewer-wrapper iframe, .file-viewer-wrapper img {
  width: 100%;
  height: 500px;
  border: none;
  object-fit: contain;
}

.raw-text-box {
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 12px;
  color: #cbd5e1;
  white-space: pre-wrap;
  max-height: 450px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  background-color: rgba(30, 41, 59, 0.4);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  transition: opacity 0.3s ease;
}

/* ========================================================
   BUDGET & ALERTES
======================================================== */
.budget-card {
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-color);
}

.budget-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.budget-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.budget-tag.ok {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.budget-tag.warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.budget-tag.exceeded {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

.budget-track {
  width: 100%;
  height: 12px;
  background-color: var(--bg-app);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.budget-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease, background-color 0.3s ease;
}

.budget-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ========================================================
   DOUBLONS & ALERTES
======================================================== */
.duplicate-alert-card {
  border-left: 4px solid var(--warning);
  background-color: rgba(245, 158, 11, 0.08);
}

.duplicate-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.dup-icon {
  font-size: 28px;
}

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

/* ========================================================
   OPTIMISEUR DE PANIER
======================================================== */
.basket-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .basket-layout {
    grid-template-columns: 1fr;
  }
}

.basket-products-list {
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 6px;
}

.basket-prod-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background-color: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.15s ease;
}

.basket-prod-item:hover {
  border-color: var(--primary);
}

.basket-prod-item.checked {
  background-color: rgba(56, 189, 248, 0.12);
  border-color: var(--primary);
}

.basket-prod-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.basket-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.basket-store-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
}

.basket-best-badge {
  background: var(--success-bg);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}

/* ========================================================
   FUSION & ALIAS PRODUITS
======================================================== */
.merge-tool-card {
  background-color: var(--bg-card);
}

.merge-form-grid {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 220px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  outline: none;
  width: 100%;
}

.merge-arrow {
  font-size: 20px;
  color: var(--primary);
  padding-top: 18px;
}

/* ========================================================
   IMPORTATION MULTIPLE (FILE D'ATTENTE)
======================================================== */
.batch-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 460px;
  overflow-y: auto;
}

.batch-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background-color: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.batch-item-row.status-success {
  border-left: 3px solid var(--success);
}

.batch-item-row.status-duplicate {
  border-left: 3px solid var(--warning);
  background-color: rgba(245, 158, 11, 0.06);
}

.batch-item-row.status-error {
  border-left: 3px solid var(--danger);
  background-color: rgba(239, 68, 68, 0.06);
}

.batch-item-row.status-processing {
  border-left: 3px solid var(--primary);
}

.batch-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.batch-item-name {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-item-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.batch-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mini-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(56, 189, 248, 0.25);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ========================================================
   BADGE NAVIGATION, FUZZY MATCHING & TVA / ALIMENTAIRE
======================================================== */
.nav-badge {
  margin-left: auto;
  background-color: var(--primary);
  color: #0f172a;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
}

.fuzzy-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fuzzy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background-color: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.fuzzy-row-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 260px;
}

.fuzzy-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fuzzy-score-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--primary);
}

.fuzzy-cross-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: var(--success);
}

.fuzzy-pair {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.fuzzy-prod-box {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.fuzzy-prod-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.fuzzy-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Alimentaire vs Non-Alimentaire */
.food-stacked-bar {
  display: flex;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  overflow: hidden;
  background-color: var(--bg-app);
  margin-bottom: 16px;
}

.food-bar-seg {
  height: 100%;
  transition: width 0.4s ease;
}

.food-split-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.food-mini-card {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--border-color);
}

.vat-row-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.vat-totals-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

/* ========================================================
   AUTHENTIFICATION SAAS & PROFIL UTILISATEUR
======================================================== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 70%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  font-size: 42px;
  margin-bottom: 8px;
}

.auth-header h1 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-app);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.auth-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.auth-tab.active {
  background: var(--bg-card-hover);
  color: var(--primary);
}

.auth-alert {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}

.auth-footer-note {
  margin-top: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
}

.user-profile-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.up-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.up-email {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.up-plan-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--primary);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ========================================================
   COACH ÉCONOMIES & BUDGETS PAR RAYON
======================================================== */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
}

.insight-card.opportunity { border-left-color: var(--success); }
.insight-card.warning { border-left-color: var(--warning); }
.insight-card.danger { border-left-color: var(--danger); }

.insight-icon { font-size: 22px; flex-shrink: 0; }
.insight-title { font-size: 13px; font-weight: 700; color: var(--text-main); margin-bottom: 2px; }
.insight-desc { font-size: 12px; color: var(--text-muted); }

.cat-budgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.cat-budget-pill {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover {
  color: #7dd3fc;
}

.delta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  font-size: 13px;
}

.delta-badge-up {
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.delta-badge-down {
  background: var(--success-bg);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.delta-badge-flat {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

/* ========================================================
   RESPONSIVE MOBILE & MENU TIROIR (DRAWER)
======================================================== */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-menu-btn,
.sidebar-close-btn {
  display: none;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-size: 20px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-close-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  font-size: 16px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(2px);
  z-index: 50;
}

@media (max-width: 900px) {
  .mobile-menu-btn,
  .sidebar-close-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 270px;
    max-width: 82vw;
    height: 100vh;
    z-index: 60;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .topbar {
    padding: 12px 16px;
    gap: 10px;
  }

  .topbar-title h2 {
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-title p {
    display: none;
  }

  .topbar-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
  }

  .topbar-actions .btn {
    padding: 7px 10px;
    font-size: 12px;
  }

  .view-section {
    padding: 16px;
  }

  .intro-card,
  .budget-header,
  .inflation-card,
  .filter-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .inf-prices {
    justify-content: space-between;
    width: 100%;
    gap: 10px;
  }

  .result-summary-grid,
  .modal-kpis-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .receipts-list-grid,
  .comparator-grid {
    grid-template-columns: 1fr;
  }

  .upload-dropzone {
    padding: 36px 16px;
  }

  .upload-hints {
    flex-direction: column;
    gap: 6px;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 14px 16px;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .kpi-card {
    padding: 14px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .food-split-cards {
    grid-template-columns: 1fr;
  }

  .topbar-actions .btn-outline {
    display: none;
  }

  .merge-arrow {
    display: none;
  }

  .batch-item-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .batch-item-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ========================================================
   CAPTURE CAMÉRA MULTI-PHOTOS (TICKETS LONGS)
======================================================== */
.camera-thumbs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.camera-thumb-card {
  position: relative;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.camera-thumb-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.camera-thumb-label {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 6px;
  color: var(--text-muted);
}

.camera-thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.85);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-thumb-remove:hover {
  background: var(--danger);
}

/* ========================================================
   TOP POIDS LOURDS DU BUDGET
======================================================== */
.heavyweights-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hw-row {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.hw-row.clickable:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  cursor: pointer;
}

.hw-rank {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.12);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hw-rank.top-3 {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

.hw-main {
  min-width: 0;
}

.hw-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hw-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.hw-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.hw-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(148, 163, 184, 0.14);
  border-radius: 999px;
  margin-top: 8px;
  overflow: hidden;
}

.hw-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #818cf8);
}

.hw-amounts {
  text-align: right;
  white-space: nowrap;
}

.hw-total {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

.hw-share {
  font-size: 11px;
  color: var(--primary);
  font-weight: 700;
}

.hw-annual {
  font-size: 11px;
  color: var(--warning);
  font-weight: 600;
  margin-top: 2px;
}

/* ========================================================
   ÉDITION DES ARTICLES & SAISIE MANUELLE
======================================================== */
.edit-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.edit-item-row {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr 70px 92px auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.edit-item-row input,
.edit-item-row select {
  padding: 7px 8px;
  font-size: 13px;
}

.edit-item-actions {
  display: flex;
  gap: 4px;
}

.edit-item-add-box {
  padding: 12px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.06);
  border: 1px dashed rgba(56, 189, 248, 0.35);
}

.edit-item-grid {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr 70px 92px auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 768px) {
  .hw-row {
    grid-template-columns: 28px 1fr;
  }
  .hw-amounts {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    text-align: left;
    padding-top: 6px;
    border-top: 1px solid rgba(148, 163, 184, 0.12);
  }
  .edit-item-row,
  .edit-item-grid {
    grid-template-columns: 1fr 1fr;
  }
  .edit-item-row input:first-child,
  .edit-item-grid input:first-child {
    grid-column: 1 / -1;
  }
  .edit-item-actions,
  .edit-item-grid button {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}







