/* =====================================================
   KEUR HÉLÈNE SUPERETTE
   CSS Principal — Charte graphique officielle
   Couleurs : Vert foncé #1a3a1f, Vert olive #4a7c3f, 
              Orange/Doré #f5a623, Crème #fdf9f0
   ===================================================== */

:root {
  /* ---- Charte KEUR HÉLÈNE ---- */
  --kh-vert-fonce:    #1a3a1f;
  --kh-vert-olive:    #4a7c3f;
  --kh-vert-sauge:    #6b9b5e;
  --kh-vert-light:    #e8f5e3;
  --kh-orange:        #f5a623;
  --kh-orange-fonce:  #e08a0a;
  --kh-orange-light:  #fef6e4;
  --kh-creme:         #fdf9f0;
  --kh-blanc:         #ffffff;

  /* ---- Palette fonctionnelle ---- */
  --primary:          var(--kh-vert-olive);
  --primary-dark:     var(--kh-vert-fonce);
  --primary-light:    var(--kh-vert-light);
  --secondary:        var(--kh-orange);
  --secondary-dark:   var(--kh-orange-fonce);
  --secondary-light:  var(--kh-orange-light);

  --success:          #22c55e;
  --success-light:    #f0fdf4;
  --warning:          #f59e0b;
  --warning-light:    #fffbeb;
  --danger:           #ef4444;
  --danger-light:     #fef2f2;
  --info:             #6366f1;
  --info-light:       #eef2ff;

  /* ---- Layout ---- */
  --bg:               var(--kh-creme);
  --bg-card:          var(--kh-blanc);
  --bg-sidebar:       var(--kh-vert-fonce);
  --bg-sidebar-hover: #2d5a35;
  --bg-sidebar-active:var(--kh-orange);

  --text-primary:     #1a2e1c;
  --text-secondary:   #3d5e42;
  --text-muted:       #7a9a7e;
  --text-light:       #b0c8b4;
  --text-white:       #ffffff;

  --border:           #dce8d6;
  --border-light:     #eef5ea;
  --shadow-sm:        0 1px 4px rgba(26,58,31,0.07);
  --shadow:           0 4px 16px rgba(26,58,31,0.1);
  --shadow-lg:        0 8px 32px rgba(26,58,31,0.14);

  --radius:           12px;
  --radius-sm:        8px;
  --radius-lg:        16px;
  --radius-xl:        24px;

  --sidebar-width:    270px;
  --header-height:    68px;
  --transition:       all 0.22s 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.15); border-radius: 2px; }

/* Logo zone */
.sidebar-logo {
  padding: 20px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 100%);
}
.sidebar-logo-img {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--kh-orange);
  box-shadow: 0 0 0 4px rgba(245,166,35,0.2), var(--shadow);
  margin-bottom: 8px;
  background: #fff;
}
.sidebar-logo-text {
  text-align: center;
}
.sidebar-logo-text h1 {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.2;
}
.sidebar-logo-text .sub {
  font-size: 10px;
  color: var(--kh-orange);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.sidebar-logo-text .address {
  font-size: 9.5px;
  color: rgba(255,255,255,0.45);
  margin-top: 3px;
  line-height: 1.4;
  text-align: center;
}

/* Nav sections */
.sidebar-section { padding: 14px 12px 6px; }
.sidebar-section-title {
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(255,255,255,0.3);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 0 8px 7px;
}
.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: 13px;
  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: linear-gradient(135deg, var(--kh-orange), var(--kh-orange-fonce));
  color: #fff;
  box-shadow: 0 4px 12px rgba(245,166,35,0.35);
  font-weight: 700;
}
.sidebar-item i { width: 18px; font-size: 14px; flex-shrink: 0; text-align: center; }
.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;
}

/* Footer sidebar */
.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-tel {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-align: center;
  line-height: 1.6;
}
.sidebar-tel .tel-num {
  color: var(--kh-orange);
  font-weight: 700;
  font-size: 12px;
}

/* =====================================================
   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: 2px 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: 14px; }
.header-page-title { font-size: 17px; font-weight: 800; color: var(--text-primary); }
.header-breadcrumb { font-size: 11px; color: var(--text-muted); }
.header-right { display: flex; align-items: center; gap: 10px; }

.header-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  border: 1.5px 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(--primary-light); border-color: var(--primary); color: var(--primary); }
.header-btn .badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--danger); color: #fff;
  width: 17px; height: 17px;
  border-radius: 50%;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.header-date {
  font-size: 12px; color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
}

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

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

/* =====================================================
   KPI CARDS
   ===================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; gap: 14px;
  transition: var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--kh-vert-sauge); }
.kpi-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.kpi-icon.green  { background: var(--kh-vert-light); color: var(--kh-vert-olive); }
.kpi-icon.orange { background: var(--kh-orange-light); color: var(--kh-orange-fonce); }
.kpi-icon.blue   { background: #e0f2fe; color: #0284c7; }
.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-icon.dark   { background: rgba(26,58,31,0.1); color: var(--kh-vert-fonce); }
.kpi-info { flex: 1; min-width: 0; }
.kpi-label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.kpi-value { font-size: 21px; font-weight: 900; 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: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: linear-gradient(to right, rgba(232,245,227,0.4), transparent);
}
.card-title {
  font-size: 14px; font-weight: 700; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }

/* GRIDS */
.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: linear-gradient(to right, var(--kh-vert-light), #f4fdf0); }
thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 10.5px; font-weight: 800;
  color: var(--kh-vert-fonce);
  text-transform: uppercase; letter-spacing: 0.7px;
  border-bottom: 2px 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: 11px 16px; color: var(--text-primary); vertical-align: middle; }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.badge-green  { background: var(--kh-vert-light); color: var(--kh-vert-fonce); }
.badge-orange { background: var(--kh-orange-light); color: #8a5200; }
.badge-blue   { background: #e0f2fe; color: #0369a1; }
.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: #f1f5f0; color: #4a5568; }

/* =====================================================
   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: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--kh-vert-olive), var(--kh-vert-fonce));
  color: #fff; border-color: var(--kh-vert-olive);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary {
  background: linear-gradient(135deg, var(--kh-orange), var(--kh-orange-fonce));
  color: #fff; border-color: var(--kh-orange);
}
.btn-secondary:hover { opacity: 0.9; transform: translateY(-1px); }
.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); }
.btn-ghost:hover   { background: var(--bg); color: var(--text-primary); }
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 13px 26px; 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: 700;
  color: var(--text-primary); margin-bottom: 6px;
}
.form-label span.req { color: var(--danger); }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px 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(--kh-vert-olive); box-shadow: 0 0 0 3px rgba(74,124,63,0.12); }
.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 { display: flex; align-items: center; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-addon {
  padding: 10px 14px;
  background: var(--kh-vert-light);
  border: 1.5px solid var(--border); border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13px; color: var(--kh-vert-fonce); font-weight: 700;
  white-space: nowrap;
}

/* =====================================================
   MODALS
   ===================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,58,31,0.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px) scale(0.98);
  transition: transform 0.22s ease;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 2px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 1;
  background: linear-gradient(to right, var(--kh-vert-light), #fff);
}
.modal-title { font-size: 16px; font-weight: 800; color: var(--kh-vert-fonce); }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg); border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; 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: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: #fff;
}

/* =====================================================
   TOASTS
   ===================================================== */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 300; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--kh-vert-fonce); 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: 260px; 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(--kh-orange); }
@keyframes slideInRight {
  from { transform: translateX(110%); 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(--kh-orange); }

/* =====================================================
   ALERTS
   ===================================================== */
.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(--kh-vert-light); border: 1.5px solid #a7d5a0; color: var(--kh-vert-fonce); }
.alert-danger  { background: var(--danger-light);  border: 1.5px solid #fecaca; color: #dc2626; }
.alert-warning { background: var(--warning-light); border: 1.5px solid #fde68a; color: #d97706; }
.alert-info    { background: var(--kh-orange-light); border: 1.5px solid #fcd78a; color: #8a5200; }

/* =====================================================
   SEARCH
   ===================================================== */
.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: 13px; }
.search-input-wrapper input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1.5px 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(--kh-vert-olive); box-shadow: 0 0 0 3px rgba(74,124,63,0.1); }

/* =====================================================
   CATEGORY PILLS
   ===================================================== */
.cat-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.cat-pill {
  padding: 7px 16px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: #fff; color: var(--text-secondary);
  transition: var(--transition);
}
.cat-pill:hover { border-color: var(--kh-vert-olive); color: var(--kh-vert-olive); }
.cat-pill.active { background: var(--kh-vert-olive); border-color: var(--kh-vert-olive); color: #fff; }
.cat-pill.halieutique.active { background: #0369a1; border-color: #0369a1; }
.cat-pill.volaille.active    { background: var(--kh-orange); border-color: var(--kh-orange); color: #fff; }
.cat-pill.boucherie.active   { background: #6b4c3b; border-color: #6b4c3b; }

/* =====================================================
   PRODUCT CARDS (POS)
   ===================================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.product-card {
  background: #fff; border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 16px 14px;
  cursor: pointer; transition: var(--transition);
  position: relative;
  text-align: center;
}
.product-card:hover { border-color: var(--kh-vert-olive); box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card.selected { border-color: var(--kh-orange); background: var(--kh-orange-light); box-shadow: 0 4px 12px rgba(245,166,35,0.3); }
.product-cat-badge { position: absolute; top: 10px; right: 10px; }
.product-icon { font-size: 34px; margin-bottom: 10px; }
.product-name { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; line-height: 1.3; }
.product-price { font-size: 15px; font-weight: 900; color: var(--kh-vert-olive); }
.product-price span { font-size: 11px; font-weight: 500; color: var(--text-muted); }
.product-stock { font-size: 11px; color: var(--text-muted); margin-top: 5px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.product-stock.low { color: var(--danger); }

/* =====================================================
   POS LAYOUT
   ===================================================== */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  min-height: calc(100vh - var(--header-height) - 130px);
}
.pos-products { overflow-y: auto; }
.pos-cart {
  display: flex; flex-direction: column;
  background: #fff; border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden; position: sticky; top: 10px;
  max-height: calc(100vh - var(--header-height) - 80px);
}
.pos-cart-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--kh-vert-fonce), #2d5a35);
  color: #fff;
}
.pos-cart-header h3 { font-size: 15px; font-weight: 700; }
.pos-cart-items { flex: 1; overflow-y: auto; padding: 10px; }
.cart-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; background: var(--bg);
  border-radius: var(--radius-sm); margin-bottom: 7px;
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 12.5px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.cart-item-price { font-size: 11px; color: var(--text-muted); }
.cart-qty-control { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px 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); flex-shrink: 0;
}
.qty-btn:hover { border-color: var(--kh-vert-olive); background: var(--kh-vert-olive); color: #fff; }
.qty-btn.minus:hover { border-color: var(--danger); background: var(--danger); }
.cart-item-qty-input {
  width: 44px; padding: 3px 4px;
  border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 13px; font-weight: 700;
  text-align: center; outline: none;
}
.cart-item-qty-input:focus { border-color: var(--kh-vert-olive); }
.cart-item-total { font-size: 13px; font-weight: 800; color: var(--kh-vert-olive); min-width: 68px; text-align: right; flex-shrink: 0; }
.cart-remove { color: var(--text-muted); cursor: pointer; transition: var(--transition); padding: 3px; flex-shrink: 0; }
.cart-remove:hover { color: var(--danger); }

.pos-cart-summary {
  padding: 14px 16px; border-top: 2px solid var(--border);
}
.cart-total-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.cart-total-label { font-size: 12.5px; color: var(--text-muted); }
.cart-total-value { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.cart-total-row.grand { margin-top: 10px; padding-top: 10px; border-top: 2px dashed var(--border); }
.cart-total-row.grand .cart-total-label { font-size: 14px; font-weight: 800; color: var(--kh-vert-fonce); }
.cart-total-row.grand .cart-total-value { font-size: 22px; font-weight: 900; color: var(--kh-orange-fonce); }

.pos-cart-actions { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.btn-validate { width: 100%; padding: 13px; font-size: 15px; font-weight: 800; border-radius: var(--radius); }

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

/* =====================================================
   INVOICE
   ===================================================== */
.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: 28px; }
.invoice-logo-img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 3px solid var(--kh-orange); }
.invoice-shop { margin-top: 8px; }
.invoice-shop-name { font-size: 18px; font-weight: 900; color: var(--kh-vert-fonce); }
.invoice-shop-sub { font-size: 11px; color: var(--kh-orange-fonce); font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.invoice-shop-addr { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.invoice-number { font-size: 26px; font-weight: 900; color: var(--text-primary); }
.invoice-meta { color: var(--text-muted); font-size: 12px; margin-top: 3px; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 24px; }
.invoice-party-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted); margin-bottom: 6px; }
.invoice-party-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.invoice-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; }
.invoice-table th { background: var(--kh-vert-fonce); color: #fff; padding: 10px 14px; font-size: 11px; font-weight: 700; 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; font-size: 13px; }
.invoice-total-row.final { border-top: 2px solid var(--kh-vert-fonce); margin-top: 8px; padding-top: 12px; font-weight: 900; font-size: 16px; color: var(--kh-vert-fonce); }

/* =====================================================
   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: 3px solid transparent; margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--kh-vert-olive); border-bottom-color: var(--kh-vert-olive); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =====================================================
   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(--kh-vert-olive); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* =====================================================
   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(--kh-vert-fonce); color: #fff;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 5px;
  letter-spacing: 0.5px;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1100px) { .pos-layout { grid-template-columns: 1fr 330px; } }
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  #sidebar { transform: translateX(-270px); width: 270px; }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  .pos-layout { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  #page-content { padding: 16px; }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* 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(--kh-vert-sauge); }

/* PRINT */
@media print {
  #sidebar, #top-header, .no-print, .modal-footer, .modal-header .modal-close { display: none !important; }
  #main-content { margin-left: 0 !important; }
  body { background: #fff !important; }
  .invoice-preview { box-shadow: none !important; border: none !important; }
}
