/* =====================================================
   KEUR HÉLÈNE - ERP Boutique Halieutique & Volaille
   CSS Principal
   ===================================================== */

:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: #e0f2fe;
  --secondary: #f97316;
  --secondary-light: #fff7ed;
  --success: #22c55e;
  --success-light: #f0fdf4;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --info: #6366f1;
  --info-light: #eef2ff;
  
  --bg: #f0f9ff;
  --bg-card: #ffffff;
  --bg-sidebar: #0c2a3b;
  --bg-sidebar-hover: #1a4a62;
  --bg-sidebar-active: #0ea5e9;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-light: #cbd5e1;
  --text-white: #ffffff;
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --sidebar-width: 260px;
  --header-height: 64px;
  --transition: all 0.2s ease;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* =====================================================
   SIDEBAR
   ===================================================== */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.sidebar-logo-text h1 {
  font-size: 14px; font-weight: 700;
  color: #fff; line-height: 1.2;
  letter-spacing: 0.5px;
}
.sidebar-logo-text p {
  font-size: 10px; color: rgba(255,255,255,0.5);
  font-weight: 400; margin-top: 2px;
}

.sidebar-section {
  padding: 16px 12px 8px;
}
.sidebar-section-title {
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 0 8px 8px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 13.5px; font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
  white-space: nowrap;
}
.sidebar-item:hover { background: var(--bg-sidebar-hover); color: #fff; }
.sidebar-item.active { background: var(--primary); color: #fff; }
.sidebar-item i { width: 18px; font-size: 15px; flex-shrink: 0; }
.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px; text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7);
  font-size: 13px;
}
.sidebar-user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

/* =====================================================
   MAIN CONTENT
   ===================================================== */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* HEADER */
#top-header {
  height: var(--header-height);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.header-left { display: flex; align-items: center; gap: 16px; }
.header-page-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.header-breadcrumb { font-size: 12px; color: var(--text-muted); }

.header-right { display: flex; align-items: center; gap: 12px; }
.header-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
  cursor: pointer;
}
.header-btn:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }
.header-btn .badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  width: 16px; height: 16px;
  border-radius: 50%; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
}
.header-date {
  font-size: 12px; color: var(--text-muted);
  padding: 6px 12px; background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* PAGE CONTENT */
#page-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}
.page-section { display: none; }
.page-section.active { display: block; }

/* =====================================================
   CARDS & KPIs
   ===================================================== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header-title { font-size: 22px; font-weight: 800; color: var(--text-primary); }
.page-header-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-icon.blue { background: var(--primary-light); color: var(--primary); }
.kpi-icon.orange { background: var(--secondary-light); color: var(--secondary); }
.kpi-icon.green { background: var(--success-light); color: var(--success); }
.kpi-icon.red { background: var(--danger-light); color: var(--danger); }
.kpi-icon.purple { background: var(--info-light); color: var(--info); }
.kpi-icon.yellow { background: var(--warning-light); color: var(--warning); }
.kpi-info { flex: 1; min-width: 0; }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.kpi-value { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.kpi-change { font-size: 11px; margin-top: 4px; font-weight: 500; }
.kpi-change.up { color: var(--success); }
.kpi-change.down { color: var(--danger); }
.kpi-change.neutral { color: var(--text-muted); }

/* =====================================================
   CARDS
   ===================================================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* GRID */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* =====================================================
   TABLES
   ===================================================== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead tr { background: var(--bg); }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border-light); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg); }
tbody td { padding: 12px 16px; color: var(--text-primary); vertical-align: middle; }
.td-light { color: var(--text-muted); font-size: 12px; }

/* =====================================================
   BADGES & TAGS
   ===================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.badge-orange { background: var(--secondary-light); color: #c2410c; }
.badge-green { background: var(--success-light); color: #15803d; }
.badge-red { background: var(--danger-light); color: #dc2626; }
.badge-yellow { background: var(--warning-light); color: #d97706; }
.badge-purple { background: var(--info-light); color: #4f46e5; }
.badge-gray { background: #f1f5f9; color: var(--text-secondary); }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-secondary:hover { background: #ea6709; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; }
.btn-icon.btn-sm { width: 30px; height: 30px; }

/* =====================================================
   FORMS
   ===================================================== */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-label span.req { color: var(--danger); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-primary);
  background: #fff;
  transition: var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.1); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-full { grid-column: 1 / -1; }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .form-control { padding-left: 42px; }
.input-group-icon { position: absolute; left: 14px; color: var(--text-muted); font-size: 14px; z-index: 1; }
.input-addon {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px; color: var(--text-secondary); font-weight: 600;
  white-space: nowrap;
}
.input-addon-left {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: 13px; color: var(--text-secondary); font-weight: 600;
}
.input-group .form-control.with-addon-left { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group .form-control.with-addon-right { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

/* =====================================================
   MODALS
   ===================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform 0.2s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg); border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: #fff;
}

/* =====================================================
   ALERTS & TOASTS
   ===================================================== */
.alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
}
.alert-success { background: var(--success-light); border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger { background: var(--danger-light); border: 1px solid #fecaca; color: #dc2626; }
.alert-warning { background: var(--warning-light); border: 1px solid #fde68a; color: #d97706; }
.alert-info { background: var(--primary-light); border: 1px solid #bae6fd; color: var(--primary-dark); }

#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 300;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: #1e293b; color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 10px;
  min-width: 250px; max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--success);
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--primary); }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-icon { font-size: 16px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--primary); }

/* =====================================================
   SEARCH & FILTERS
   ===================================================== */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.search-input-wrapper {
  position: relative;
  flex: 1; min-width: 200px;
}
.search-input-wrapper i {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 14px;
}
.search-input-wrapper input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; outline: none;
  background: #fff; color: var(--text-primary);
  transition: var(--transition);
}
.search-input-wrapper input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,165,233,0.1); }

/* =====================================================
   PRODUITS CARDS
   ===================================================== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.product-card {
  background: #fff; border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 20px;
  cursor: pointer; transition: var(--transition);
  position: relative;
}
.product-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card.selected { border-color: var(--primary); background: var(--primary-light); }
.product-cat-badge {
  position: absolute; top: 12px; right: 12px;
}
.product-icon { font-size: 36px; margin-bottom: 12px; }
.product-name { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.product-price { font-size: 18px; font-weight: 800; color: var(--primary); }
.product-price span { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.product-stock { font-size: 12px; color: var(--text-muted); margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.product-stock.low { color: var(--danger); }

/* =====================================================
   POS (CAISSE)
   ===================================================== */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 20px; height: calc(100vh - var(--header-height) - 48px - 80px); }
.pos-products { overflow-y: auto; }
.pos-cart {
  display: flex; flex-direction: column;
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
}
.pos-cart-header { padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--bg-sidebar); color: #fff; }
.pos-cart-header h3 { font-size: 16px; font-weight: 700; }
.pos-cart-items { flex: 1; overflow-y: auto; padding: 12px; }
.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: var(--transition);
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cart-item-price { font-size: 12px; color: var(--text-muted); }
.cart-qty-control { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: var(--text-primary);
  cursor: pointer; transition: var(--transition);
}
.qty-btn:hover { border-color: var(--primary); background: var(--primary); color: #fff; }
.qty-btn.minus:hover { border-color: var(--danger); background: var(--danger); }
.cart-qty { font-size: 15px; font-weight: 700; min-width: 28px; text-align: center; }
.cart-item-total { font-size: 14px; font-weight: 700; color: var(--primary); min-width: 70px; text-align: right; }
.cart-remove { color: var(--text-muted); cursor: pointer; transition: var(--transition); padding: 4px; }
.cart-remove:hover { color: var(--danger); }

.cart-item-qty-input {
  width: 48px; padding: 4px 6px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-weight: 700;
  text-align: center; outline: none;
}
.cart-item-qty-input:focus { border-color: var(--primary); }

.pos-cart-summary {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.cart-total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.cart-total-label { font-size: 13px; color: var(--text-muted); }
.cart-total-value { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.cart-total-row.grand { margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--border); }
.cart-total-row.grand .cart-total-label { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.cart-total-row.grand .cart-total-value { font-size: 22px; font-weight: 800; color: var(--primary); }
.pos-cart-actions { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.btn-validate { width: 100%; padding: 14px; font-size: 15px; font-weight: 700; border-radius: var(--radius); }

/* =====================================================
   STOCK PROGRESS
   ===================================================== */
.stock-bar { background: var(--border); border-radius: 4px; height: 6px; overflow: hidden; margin-top: 6px; }
.stock-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.stock-bar-fill.ok { background: var(--success); }
.stock-bar-fill.mid { background: var(--warning); }
.stock-bar-fill.low { background: var(--danger); }

/* =====================================================
   FACTURE PREVIEW
   ===================================================== */
.invoice-preview {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  font-size: 13px;
}
.invoice-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 32px; }
.invoice-logo { font-size: 22px; font-weight: 900; color: var(--bg-sidebar); }
.invoice-logo span { color: var(--primary); }
.invoice-number { font-size: 28px; font-weight: 900; color: var(--text-primary); }
.invoice-meta { color: var(--text-muted); font-size: 12px; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-bottom: 28px; }
.invoice-party-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 8px; }
.invoice-party-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.invoice-table th { background: var(--bg-sidebar); color: #fff; padding: 10px 14px; font-size: 11px; text-align: left; }
.invoice-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.invoice-table tr:last-child td { border-bottom: none; }
.invoice-totals { margin-left: auto; width: 280px; }
.invoice-total-row { display: flex; justify-content: space-between; padding: 6px 0; }
.invoice-total-row.final { border-top: 2px solid var(--bg-sidebar); margin-top: 8px; padding-top: 12px; font-weight: 800; font-size: 16px; color: var(--bg-sidebar); }

/* =====================================================
   CHARTS CONTAINERS
   ===================================================== */
.chart-container { position: relative; }
.chart-container canvas { max-width: 100% !important; }

/* =====================================================
   TABS
   ===================================================== */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px;
  font-size: 13.5px; font-weight: 600;
  color: var(--text-muted);
  border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =====================================================
   CATEGORY FILTER PILLS
   ===================================================== */
.cat-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-pill {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  border: 2px solid var(--border);
  background: #fff; color: var(--text-secondary);
  transition: var(--transition);
}
.cat-pill:hover { border-color: var(--primary); color: var(--primary); }
.cat-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.cat-pill.halieutique.active { background: var(--primary); border-color: var(--primary); }
.cat-pill.volaille.active { background: var(--secondary); border-color: var(--secondary); }
.cat-pill.boucherie.active { background: #64748b; border-color: #64748b; }
.cat-pill.boucherie { }

/* =====================================================
   EMPTY STATES
   ===================================================== */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-text { font-size: 13.5px; }

/* =====================================================
   LOADING
   ===================================================== */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  gap: 12px;
}
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1100px) {
  .pos-layout { grid-template-columns: 1fr 320px; }
}
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  #sidebar { transform: translateX(-260px); width: 260px; }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  #page-content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .modal { margin: 8px; }
}

/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* =====================================================
   MISC UTILITIES
   ===================================================== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.separator { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.number-chip {
  display: inline-block;
  background: var(--bg-sidebar); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  letter-spacing: 0.5px;
}

/* PRINT */
@media print {
  #sidebar, #top-header, .no-print { display: none !important; }
  #main-content { margin-left: 0 !important; }
  #page-content { padding: 0 !important; }
}
