/* ============================================================
   IgoShop — Feuille de styles principale
   Charte : bleu #1a3ccc / rouge #cc1a1a / blanc #fff
   ============================================================ */

/* ---- Variables ---- */
:root {
  --blue:        #1a3ccc;
  --blue-dark:   #0f2490;
  --blue-light:  #e8eeff;
  --red:         #cc1a1a;
  --red-light:   #ffeaea;
  --green:       #10b981;
  --green-light: #d1fae5;
  --orange:      #f59e0b;
  --orange-light:#fef3c7;
  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-200:    #e2e8f0;
  --gray-400:    #94a3b8;
  --gray-600:    #475569;
  --gray-800:    #1e293b;
  --white:       #ffffff;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 25px rgba(0,0,0,.1), 0 4px 10px rgba(0,0,0,.06);
  --radius:      10px;
  --radius-sm:   6px;
  --sidebar-w:   240px;
  --navbar-h:    58px;
  --transition:  .2s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ---- Navbar ---- */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--navbar-h);
  background: var(--blue);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem;
  z-index: 1000;
  box-shadow: var(--shadow);
}
.navbar-toggle {
  background: transparent; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 5px; padding: .4rem;
}
.navbar-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--white); border-radius: 2px;
  transition: var(--transition);
}
.navbar-brand {
  display: flex; align-items: center; gap: .5rem; color: var(--white);
  text-decoration: none; flex: 1; min-width: 0; overflow: hidden;
}
.navbar-brand img {
  height: 36px; width: auto; max-width: 140px;
  object-fit: contain; flex-shrink: 0; display: block;
}
.navbar-brand:hover { text-decoration: none; }
.brand-text { font-size: 1.2rem; font-weight: 700; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navbar-right { display: flex; align-items: center; gap: .75rem; }
.navbar-user   { display: flex; align-items: center; gap: .4rem; color: rgba(255,255,255,.9); font-size: .875rem; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-dark); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .875rem; border: 2px solid rgba(255,255,255,.3);
}
/* ---- Badges de rôle ---- */
.role-pill {
  display: inline-block; padding: .1rem .45rem; border-radius: 20px;
  font-size: .68rem; font-weight: 700; letter-spacing: .3px; line-height: 1.6;
  vertical-align: middle;
}
.role-admin     { background: rgba(204,26,26,.25); color: #ffd5d5; }
.role-vendeur   { background: rgba(16,185,129,.25); color: #d1fae5; }
.role-comptable { background: rgba(245,158,11,.25); color: #fef3c7; }
/* Dans la sidebar (fond sombre) : mêmes couleurs */
.sidebar-footer .role-pill { font-size: .7rem; }
/* Dans les tableaux (fond clair) */
table .role-admin     { background: #ffeaea; color: #7f1d1d; }
table .role-vendeur   { background: #d1fae5; color: #065f46; }
table .role-comptable { background: #fef3c7; color: #78350f; }

/* Badges génériques */
.badge-admin     { background: #ffeaea; color: #7f1d1d; }
.badge-vendeur   { background: #d1fae5; color: #065f46; }
.badge-comptable { background: #fef3c7; color: #78350f; }

.btn-logout {
  color: rgba(255,255,255,.8); font-size: 1.1rem; padding: .3rem .5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,.15); color: var(--white); text-decoration: none; }

/* ---- Sidebar ---- */
.sidebar {
  position: fixed; top: var(--navbar-h); left: 0;
  width: var(--sidebar-w); height: calc(100vh - var(--navbar-h));
  background: var(--gray-800);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  transition: transform var(--transition);
  z-index: 900;
}
.sidebar-logo {
  display: none; align-items: center; gap: .5rem;
  padding: 1rem 1.25rem .75rem;
  color: var(--white); font-weight: 700; font-size: 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo img { height: 28px; width: auto; max-width: 120px; object-fit: contain; flex-shrink: 0; display: block; }
.sidebar-nav { flex: 1; padding: .75rem 0; }
.nav-group-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--gray-400); padding: 1rem 1.25rem .35rem;
}
.nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem 1.25rem; color: rgba(255,255,255,.75);
  font-size: .875rem; transition: var(--transition);
  text-decoration: none;
}
.nav-link:hover  { background: rgba(255,255,255,.06); color: var(--white); text-decoration: none; }
.nav-link.active { background: var(--blue); color: var(--white); }
.nav-icon { font-size: 1rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.sidebar-footer {
  padding: 1rem 1.25rem; color: var(--gray-400); font-size: .75rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 850;
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--navbar-h);
  min-height: calc(100vh - var(--navbar-h));
  padding: 1.5rem;
  transition: margin-left var(--transition);
}
.page-header {
  margin-bottom: 1.25rem;
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: .5rem;
}
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-800); }
.breadcrumb-nav {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; color: var(--gray-600); margin-top: .2rem;
}
.breadcrumb-nav a { color: var(--blue); }
.breadcrumb-nav span { color: var(--gray-400); }

/* ---- Cards ---- */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.25rem;
  border: 1px solid var(--gray-200);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--gray-200);
}
.card-title { font-size: 1rem; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 0; }

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
  display: flex; align-items: center; gap: 1rem;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.blue   { background: var(--blue-light); }
.stat-icon.red    { background: var(--red-light); }
.stat-icon.green  { background: var(--green-light); }
.stat-icon.orange { background: var(--orange-light); }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: .78rem; color: var(--gray-600); }
.stat-trend { font-size: .75rem; margin-top: .15rem; }
.trend-up   { color: var(--green); }
.trend-down { color: var(--red); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:active { transform: scale(.98); }
.btn-sm   { padding: .3rem .7rem; font-size: .8rem; }
.btn-xs   { padding: .18rem .5rem; font-size: .72rem; border-radius: 4px; }
.btn-lg   { padding: .7rem 1.4rem; font-size: 1rem; }
.btn-icon { padding: .45rem; border-radius: var(--radius-sm); }

.btn-primary   { background: var(--blue);  color: var(--white); border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-danger    { background: var(--red);   color: var(--white); border-color: var(--red); }
.btn-success   { background: var(--green); color: var(--white); border-color: var(--green); }
.btn-warning   { background: var(--orange); color: var(--white); border-color: var(--orange); }
.btn-secondary { background: var(--gray-600); color: var(--white); border-color: var(--gray-600); }
.btn-outline   { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-outline:hover { background: var(--blue-light); }
.btn-light     { background: var(--gray-100); color: var(--gray-800); border-color: var(--gray-200); }
.btn-light:hover { background: var(--gray-200); }
.btn-whatsapp  { background: #25d366; color: var(--white); border-color: #25d366; }
.btn-print     { background: var(--gray-600); color: var(--white); border-color: var(--gray-600); }

/* ---- Forms ---- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--gray-800); }
.form-label.required::after { content: ' *'; color: var(--red); }
.form-control {
  width: 100%; padding: .5rem .75rem;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  background: var(--white); color: var(--gray-800);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-size: .9rem;
}
.form-control:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,60,204,.12);
}
.form-control.is-invalid { border-color: var(--red); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-text { font-size: .78rem; color: var(--gray-600); margin-top: .25rem; }
.invalid-feedback { font-size: .8rem; color: var(--red); margin-top: .25rem; }
.form-row { display: grid; gap: 1rem; }
.form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
.table {
  width: 100%; border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  background: var(--gray-50); color: var(--gray-600);
  font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
  padding: .7rem 1rem; text-align: left; border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }
.table-striped tbody tr:nth-child(even) { background: var(--gray-50); }
.table-actions { display: flex; gap: .3rem; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: .25rem .6rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.badge-primary { background: var(--blue-light);   color: var(--blue); }
.badge-success { background: var(--green-light);  color: var(--green); }
.badge-danger  { background: var(--red-light);    color: var(--red); }
.badge-warning { background: var(--orange-light); color: #92400e; }
.badge-gray    { background: var(--gray-200);     color: var(--gray-600); }

/* ---- Alerts ---- */
.alert {
  padding: .8rem 1rem; border-radius: var(--radius-sm);
  margin-bottom: 1rem; font-size: .875rem;
  display: flex; align-items: flex-start; gap: .5rem;
  border-left: 4px solid transparent;
}
.alert-success { background: var(--green-light);  border-color: var(--green); color: #065f46; }
.alert-danger  { background: var(--red-light);    border-color: var(--red);   color: #7f1d1d; }
.alert-warning { background: var(--orange-light); border-color: var(--orange);color: #78350f; }
.alert-info    { background: var(--blue-light);   border-color: var(--blue);  color: var(--blue-dark); }
.alert-dismissible { position: relative; }
.btn-close {
  background: none; border: none; cursor: pointer;
  margin-left: auto; font-size: 1.1rem; line-height: 1; opacity: .6;
  flex-shrink: 0;
}
.btn-close:hover { opacity: 1; }

/* ---- Modal ---- */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1050;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.96) translateY(-10px); } to { opacity:1; transform:none; } }
.modal-lg { max-width: 800px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200);
}
.modal-title { font-weight: 600; font-size: 1rem; }
.modal-body  { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: .85rem 1.25rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: .5rem; }

/* ---- POS / Panier ---- */
.pos-layout { display: grid; grid-template-columns: 1fr 360px; gap: 1.25rem; }
.pos-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.pos-product-card {
  background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: .75rem; text-align: center; cursor: pointer;
  transition: var(--transition);
}
.pos-product-card:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.pos-product-card.out-of-stock { opacity: .5; cursor: not-allowed; }
.pos-product-name  { font-size: .8rem; font-weight: 600; margin-top: .4rem; }
.pos-product-price { font-size: .9rem; color: var(--blue); font-weight: 700; }
.pos-product-stock { font-size: .72rem; color: var(--gray-600); }
.cart-panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200); display: flex; flex-direction: column; height: fit-content; position: sticky; top: calc(var(--navbar-h) + 1.5rem); }
.cart-header  { padding: .85rem 1rem; border-bottom: 1px solid var(--gray-200); font-weight: 600; font-size: .95rem; }
.cart-items   { flex: 1; overflow-y: auto; max-height: 380px; padding: .5rem; }
.cart-item    { display: flex; align-items: center; gap: .5rem; padding: .5rem; border-radius: var(--radius-sm); transition: var(--transition); }
.cart-item:hover { background: var(--gray-50); }
.cart-item-name  { flex: 1; font-size: .82rem; font-weight: 500; }
.cart-item-qty   { display: flex; align-items: center; gap: .25rem; }
.qty-btn { background: var(--gray-100); border: none; width: 24px; height: 24px; border-radius: 4px; cursor: pointer; font-size: .9rem; display: flex; align-items: center; justify-content: center; }
.qty-btn:hover { background: var(--gray-200); }
.qty-input { width: 40px; text-align: center; border: 1px solid var(--gray-200); border-radius: 4px; padding: .1rem; font-size: .82rem; }
.cart-item-total { font-size: .82rem; font-weight: 600; color: var(--blue); min-width: 60px; text-align: right; }
.cart-remove { background: none; border: none; cursor: pointer; color: var(--red); font-size: .9rem; }
.cart-footer { padding: .75rem 1rem; border-top: 1px solid var(--gray-200); }
.cart-summary-row { display: flex; justify-content: space-between; font-size: .875rem; margin-bottom: .3rem; }
.cart-summary-row.total { font-weight: 700; font-size: 1rem; color: var(--blue); margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--gray-200); }
.cart-empty { text-align: center; color: var(--gray-400); padding: 2rem 1rem; font-size: .875rem; }

/* ---- Document Preview (facture/devis) ---- */
.document-toolbar {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem;
  align-items: center;
}
.document-paper {
  background: var(--white); max-width: 800px; margin: 0 auto;
  box-shadow: var(--shadow-lg); border-radius: 4px;
  padding: 2.5rem; font-size: .875rem; color: #333;
}
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; border-bottom: 3px solid var(--blue); padding-bottom: 1rem; }
.doc-company-logo img { max-height: 70px; max-width: 180px; width: auto; height: auto; object-fit: contain; display: block; }
.doc-company-info { font-size: .78rem; color: #555; line-height: 1.6; }
.doc-title-block { text-align: right; }
.doc-type { font-size: 1.4rem; font-weight: 800; color: var(--blue); text-transform: uppercase; letter-spacing: 1px; }
.doc-numero { font-size: 1rem; color: var(--red); font-weight: 700; margin-top: .25rem; }
.doc-date   { font-size: .8rem; color: #555; margin-top: .2rem; }
.doc-client-block {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-left: 4px solid var(--blue); border-radius: var(--radius-sm);
  padding: .85rem 1rem; margin-bottom: 1.5rem;
}
.doc-client-label { font-size: .7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-600); margin-bottom: .3rem; }
.doc-client-nom   { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.doc-client-info  { font-size: .8rem; color: #555; margin-top: .2rem; line-height: 1.5; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; font-size: .85rem; }
.doc-table th { background: var(--blue); color: var(--white); padding: .6rem .75rem; text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; }
.doc-table th:last-child, .doc-table td:last-child { text-align: right; }
.doc-table td { padding: .55rem .75rem; border-bottom: 1px solid var(--gray-100); }
.doc-table tr:last-child td { border-bottom: none; }
.doc-table tr:nth-child(even) td { background: var(--gray-50); }
.doc-totals { display: flex; justify-content: flex-end; margin-bottom: 1.5rem; }
.doc-totals-table { width: 260px; font-size: .875rem; }
.doc-totals-table tr td { padding: .35rem .5rem; }
.doc-totals-table tr td:last-child { text-align: right; font-weight: 600; }
.doc-total-final td { border-top: 2px solid var(--blue); font-weight: 800; font-size: 1rem; color: var(--blue); padding-top: .5rem; }
.doc-arretes { background: var(--blue-light); border: 1px solid rgba(26,60,204,.2); border-radius: var(--radius-sm); padding: .6rem .85rem; margin-bottom: 1.25rem; font-size: .82rem; font-style: italic; color: var(--blue-dark); }
.doc-conditions { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1.5rem; margin-bottom: 1.5rem; padding: .85rem 1rem; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); font-size: .8rem; }
.doc-cond-item label { color: var(--gray-600); font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; }
.doc-cond-item value { display: block; font-weight: 600; color: var(--gray-800); }
.doc-footer { display: flex; justify-content: flex-end; margin-top: 1.5rem; border-top: 1px solid var(--gray-200); padding-top: 1rem; }
.doc-signature { text-align: center; }
.doc-signature-label { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-600); }
.doc-signature-box { border: 1px solid var(--gray-200); border-radius: var(--radius-sm); width: 180px; height: 70px; margin: .5rem auto; }
.doc-signature-name  { font-weight: 700; font-size: .875rem; }

/* ---- Charts ---- */
.charts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.chart-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.chart-title { font-size: .9rem; font-weight: 600; color: var(--gray-800); margin-bottom: 1rem; }
.chart-wrap  { position: relative; height: 220px; }

/* ---- Search bar ---- */
.search-bar {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  background: var(--white); padding: .75rem 1rem;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  margin-bottom: 1rem;
}
.search-bar .form-control { flex: 1; min-width: 180px; }

/* ---- Grid helpers ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.gap-sm { gap: .5rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: .5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mt-1 { margin-top: .5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.p-0  { padding: 0 !important; }
.text-right   { text-align: right !important; }
.text-center  { text-align: center !important; }
.text-muted   { color: var(--gray-600) !important; }
.text-primary { color: var(--blue) !important; }
.text-danger  { color: var(--red) !important; }
.text-success { color: var(--green) !important; }
.font-bold    { font-weight: 700 !important; }
.d-flex   { display: flex !important; }
.d-none   { display: none !important; }
.flex-1   { flex: 1 !important; }
.flex-wrap{ flex-wrap: wrap !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-1 { gap: .5rem !important; }
.gap-2 { gap: 1rem !important; }
.w-100 { width: 100% !important; }
.d-none-sm { /* hidden on small screens, set below */ }

/* ---- Status badges ---- */
.status-payee      { background: var(--green-light);  color: #065f46; }
.status-partielle  { background: var(--orange-light); color: #78350f; }
.status-impayee    { background: var(--red-light);    color: #7f1d1d; }
.status-annulee    { background: var(--gray-200);     color: var(--gray-600); }
.status-brouillon  { background: var(--gray-200);     color: var(--gray-600); }
.status-envoyee,
.status-envoye     { background: var(--blue-light);   color: var(--blue-dark); }
.status-accepte    { background: var(--green-light);  color: #065f46; }
.status-refuse     { background: var(--red-light);    color: #7f1d1d; }
.status-expire     { background: var(--orange-light); color: #78350f; }

/* ---- Stock indicator ---- */
.stock-ok     { color: var(--green); }
.stock-low    { color: var(--orange); }
.stock-empty  { color: var(--red); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--gray-600); }
.empty-state-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--gray-800); margin-bottom: .5rem; }

/* ---- Dropdown ---- */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: 100%;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  min-width: 160px; z-index: 500; padding: .3rem 0;
}
.dropdown.open .dropdown-menu { display: block; animation: fadeIn .15s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.dropdown-item {
  display: block; padding: .45rem 1rem; font-size: .875rem;
  color: var(--gray-800); transition: var(--transition);
}
.dropdown-item:hover { background: var(--gray-50); text-decoration: none; }
.dropdown-divider { border-top: 1px solid var(--gray-200); margin: .3rem 0; }

/* ---- Loading spinner ---- */
.spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--gray-200); border-top-color: var(--blue);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Autocomplete ---- */
.autocomplete-wrapper { position: relative; }
.autocomplete-list {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  max-height: 220px; overflow-y: auto; z-index: 600; display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  padding: .45rem .75rem; cursor: pointer; font-size: .875rem;
  transition: var(--transition);
}
.autocomplete-item:hover, .autocomplete-item.focused { background: var(--blue-light); }

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .pos-layout { grid-template-columns: 1fr; }
  .cart-panel { position: static; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; padding: 1rem; }
  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4,
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .doc-header { flex-direction: column; gap: .75rem; }
  .doc-title-block { text-align: left; }
  .doc-conditions { grid-template-columns: 1fr; }
  .doc-totals { justify-content: stretch; }
  .doc-totals-table { width: 100%; }
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid  { grid-template-columns: repeat(2,1fr); }
  .document-paper { padding: 1.25rem; }
  .d-none-sm { display: none !important; }
  .page-title { font-size: 1.2rem; }
  .table th, .table td { padding: .5rem .6rem; font-size: .8rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .pos-products { grid-template-columns: repeat(2,1fr); }
  .document-toolbar { flex-direction: column; align-items: stretch; }
  .document-toolbar .btn { justify-content: center; }
}

/* ---- Login page ---- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 50%, #3451d1 100%);
  padding: 1rem;
}
.login-card {
  background: var(--white); border-radius: calc(var(--radius)*1.5);
  box-shadow: var(--shadow-lg); padding: 2.5rem 2rem;
  width: 100%; max-width: 420px;
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo img { max-height: 90px; }
.login-logo-text { font-size: 1.8rem; font-weight: 800; color: var(--blue); margin-top: .5rem; }
.login-logo-sub  { font-size: .8rem; color: var(--gray-600); font-style: italic; }
.login-title { font-size: 1.2rem; font-weight: 700; text-align: center; margin-bottom: 1.5rem; color: var(--gray-800); }
