/* ═══════════════════════════════════════════════════════════════
   CAMUSAT BF — Stock Magasin — Premium Dark/Light v4 (Refonte)
   Dark  : #000d1a · Rouge #E31E24 · Bleu #003366
   Light : Blanc   · Bleu #003366  · Rouge #E31E24
═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-app:        #000d1a;
  --bg-sidebar:    rgba(0, 7, 18, 0.98);
  --bg-main:       #000f1f;
  --bg-card:       rgba(0, 18, 42, 0.7);
  --bg-card-solid: #001228;
  --bg-header:     rgba(0, 12, 30, 0.9);
  --bg-input:      rgba(0, 18, 48, 0.85);
  --bg-hover:      rgba(255,255,255,.05);
  --bg-row-hover:  rgba(0, 55, 115, 0.18);
  --bg-thead:      rgba(0, 12, 35, 0.95);
  --bg-tbar:       rgba(0, 12, 32, 0.7);
  --bg-pagination: rgba(0, 10, 28, 0.75);
  --bg-select:     #001228;
  --border:        rgba(255,255,255,.08);
  --border-input:  rgba(255,255,255,.14);
  --border-focus:  rgba(0,120,255,.65);
  --text-primary:   #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;
  --text-heading:   #f1f5f9;
  --blue:       #003366;
  --blue-mid:   #0055aa;
  --blue-light: rgba(0,85,170,.15);
  --blue-muted: rgba(0,85,170,.28);
  --red:        #E31E24;
  --red-light:  rgba(227,30,36,.12);
  --red-mid:    rgba(227,30,36,.28);
  --red-dark:   #9B1518;
  --success:     #10b981;
  --success-bg:  rgba(16,185,129,.12);
  --success-bdr: rgba(16,185,129,.3);
  --warning:     #f59e0b;
  --warning-bg:  rgba(245,158,11,.12);
  --warning-bdr: rgba(245,158,11,.3);
  --danger:      #ef4444;
  --danger-bg:   rgba(239,68,68,.12);
  --danger-bdr:  rgba(239,68,68,.3);
  --gray-50:  rgba(255,255,255,.03);
  --gray-100: rgba(255,255,255,.06);
  --gray-200: rgba(255,255,255,.10);
  --gray-300: rgba(255,255,255,.20);
  --gray-400: rgba(255,255,255,.35);
  --gray-500: rgba(255,255,255,.50);
  --gray-600: rgba(255,255,255,.65);
  --gray-700: rgba(255,255,255,.80);
  --shadow:    0 4px 24px rgba(0,0,0,.45);
  --shadow-lg: 0 10px 44px rgba(0,0,0,.55);
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --sb-item-active-bg:    rgba(227,30,36,.13);
  --sb-item-active-color: #ff6b70;
  --sb-text:    rgba(255,255,255,.85);
  --sb-section: rgba(255,255,255,.45);
  --sb-border:  rgba(255,255,255,.07);
}

[data-theme="light"] {
  --bg-app:        #f0f4f8;
  --bg-sidebar:    #001833;
  --bg-main:       #f0f4f8;
  --bg-card:       #ffffff;
  --bg-card-solid: #ffffff;
  --bg-header:     #ffffff;
  --bg-input:      #ffffff;
  --bg-hover:      #f7f9fc;
  --bg-row-hover:  #eef4ff;
  --bg-thead:      #f7f9fc;
  --bg-tbar:       #f7f9fc;
  --bg-pagination: #f7f9fc;
  --bg-select:     #ffffff;
  --border:       #e2e8f0;
  --border-input: #cbd5e1;
  --border-focus: #003366;
  --text-primary:   #1e293b;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --text-heading:   #0f172a;
  --blue-light: #e8eff8;
  --blue-muted: #c5d5e8;
  --red-light:  #fdeaea;
  --red-mid:    #fbbdbd;
  --success-bg:  #e6f4ed;
  --success-bdr: #a8d5bb;
  --warning-bg:  #fff3e0;
  --warning-bdr: #f6c775;
  --danger-bg:   #fdeaea;
  --danger-bdr:  #fbbdbd;
  --gray-50:  #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --shadow:    0 2px 16px rgba(0,51,102,.08);
  --shadow-lg: 0 8px 32px rgba(0,51,102,.14);
  --sb-item-active-bg:    rgba(227,30,36,.15);
  --sb-item-active-color: #cc2222;
  --sb-text:    rgba(0,0,0,.80);
  --sb-section: rgba(0,0,0,.45);
  --sb-border:  rgba(0,0,0,.10);
  --bg-sidebar:    #ffffff;
}

html, body { height: 100%; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg-app); color: var(--text-primary); font-size: 14px; line-height: 1.5; transition: background .3s, color .3s; }

.app  { display: flex; height: 100vh; overflow: hidden; }
.main { flex: 1; display: flex; flex-direction: column; overflow-y: auto; background: var(--bg-main); min-height: 0; transition: background .3s; }

/* SIDEBAR */
.sidebar { width: 235px; min-width: 235px; background: var(--bg-sidebar); display: flex; flex-direction: column; position: relative; overflow: hidden; border-right: 1px solid var(--sb-border); backdrop-filter: blur(24px); transition: background .3s; }
.sidebar::before { content: ''; position: absolute; top: -70px; right: -70px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(227,30,36,.12) 0%, transparent 70%); pointer-events: none; }
.sidebar::after  { content: ''; position: absolute; bottom: 80px; left: -50px; width: 150px; height: 150px; background: radial-gradient(circle, rgba(0,60,140,.1) 0%, transparent 70%); pointer-events: none; }
.sb-logo { padding: 20px 14px 16px; border-bottom: 1px solid var(--sb-border); display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; cursor: pointer; }
.sb-logo img.logo-img { height: 36px; object-fit: contain; filter: brightness(0) invert(1); }
.sb-logo-sub { display: flex; align-items: center; gap: 6px; }
.sb-logo-sub img { height: 13px; border-radius: 2px; border: 1px solid rgba(255,255,255,.22); }
.sb-logo-sub span { color: rgba(255,255,255,.38); font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; font-weight: 600; }
.sb-nav { overflow-y: auto; flex: 1; padding-bottom: 8px; }
.sb-group-toggle { font-family: inherit; font-size: 12.5px; display: flex; align-items: center; gap: 10px; }
.sb-sub { font-size: 12px !important; padding: 7px 10px 7px 28px !important; margin: 0px 8px 0 8px !important; color: rgba(255,255,255,.85); }
.sb-sub:hover { color: rgba(255,255,255,.85); }
.sb-sub.active { color: white; background: rgba(227,30,36,.15) !important; border: 1px solid rgba(227,30,36,.18) !important; }
.sb-badge { margin-left: auto; background: var(--red); color: white; font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 20px; box-shadow: 0 2px 8px rgba(227,30,36,.55); animation: badgePulse 2s infinite; }
@keyframes badgePulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }

/* Société switcher */
.sb-societe-switcher { position: relative; }
.sb-societe-badge { margin-left: auto; font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: rgba(227,30,36,.18); color: var(--red); border: 1px solid rgba(227,30,36,.3); letter-spacing: .08em; text-transform: uppercase; transition: all .2s; }
.sb-societe-switcher:hover .sb-societe-badge { background: rgba(227,30,36,.3); box-shadow: 0 0 10px rgba(227,30,36,.35); }

/* Sidebar items — hover shimmer */
.sb-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; color: var(--sb-text); font-size: 12.5px; cursor: pointer; transition: background .18s, color .18s, box-shadow .18s, transform .15s; margin: 1px 8px; border-radius: 10px; position: relative; text-decoration: none; overflow: hidden; }
.sb-item::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 60%, rgba(255,255,255,.04) 100%); opacity: 0; transition: opacity .2s; border-radius: 10px; }
.sb-item:hover::after { opacity: 1; }
.sb-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.95); transform: translateX(2px); box-shadow: inset 1px 0 0 rgba(255,255,255,.12); }
.sb-item:active { transform: translateX(1px) scale(.98); }
.sb-item.active { background: var(--sb-item-active-bg); color: var(--sb-item-active-color); font-weight: 600; border: 1px solid rgba(227,30,36,.22); box-shadow: 0 2px 10px rgba(227,30,36,.12); }
.sb-item.active::before { content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%); width: 3px; height: 22px; background: var(--red); border-radius: 0 3px 3px 0; box-shadow: 0 0 12px rgba(227,30,36,.7); }
.sb-item i { font-size: 16px; width: 19px; flex-shrink: 0; transition: color .18s; }
.sb-item:hover i { color: rgba(255,255,255,1); }
.sb-item.active i { color: var(--sb-item-active-color); }

/* Section headers — ligne décorative */
.sb-section { font-size: 9.5px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--sb-section); padding: 14px 16px 5px; display: flex; align-items: center; gap: 8px; }
.sb-section::after { content: ''; flex: 1; height: 1px; background: var(--sb-border); margin-left: 4px; }

.sb-footer { margin-top: auto; padding: 12px 14px; border-top: 1px solid var(--sb-border); display: flex; align-items: center; gap: 9px; background: rgba(0,0,0,.2); }
.sb-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--red), #b5171c); display: flex; align-items: center; justify-content: center; color: white; font-size: 11px; font-weight: 700; flex-shrink: 0; box-shadow: 0 2px 12px rgba(227,30,36,.4); }
.sb-user-name { color: #e2e8f0; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { color: rgba(255,255,255,.32); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Light mode sidebar — fond dégradé au lieu de blanc plat */
[data-theme="light"] .sidebar { background: linear-gradient(180deg, #f8faff 0%, #ffffff 60%, #f4f7fe 100%); border-right: 1px solid #e2e8f0; box-shadow: 2px 0 16px rgba(0,51,102,.06); }
[data-theme="light"] .sidebar::before { background: radial-gradient(circle, rgba(227,30,36,.06) 0%, transparent 70%); }
[data-theme="light"] .sidebar::after  { background: radial-gradient(circle, rgba(0,60,140,.05) 0%, transparent 70%); }
[data-theme="light"] .sb-item { color: #334155; }
[data-theme="light"] .sb-item:hover { background: rgba(0,51,102,.06); color: #003366; transform: translateX(2px); box-shadow: inset 1px 0 0 rgba(0,51,102,.15); }
[data-theme="light"] .sb-item:hover::after { background: linear-gradient(90deg, transparent 60%, rgba(0,51,102,.04) 100%); }
[data-theme="light"] .sb-item i { color: #64748b; }
[data-theme="light"] .sb-item:hover i { color: #003366; }
[data-theme="light"] .sb-item.active { background: rgba(227,30,36,.08); color: #cc1f24; border-color: rgba(227,30,36,.18); }
[data-theme="light"] .sb-item.active i { color: #cc1f24; }
[data-theme="light"] .sb-section { color: #94a3b8; }
[data-theme="light"] .sb-section::after { background: #e2e8f0; }
[data-theme="light"] .sb-footer { background: rgba(0,51,102,.03); border-top: 1px solid #e2e8f0; }
[data-theme="light"] .sb-user-name { color: #1e293b; }
[data-theme="light"] .sb-user-role { color: #94a3b8; }
[data-theme="light"] .sb-logo-sub span { color: rgba(0,0,0,.35); }
[data-theme="light"] .sb-societe-badge { background: rgba(227,30,36,.1); color: #cc1f24; border-color: rgba(227,30,36,.25); }

.stripe { height: 3px; background: linear-gradient(90deg, #001e66, #0044cc 45%, var(--red) 100%); flex-shrink: 0; }

/* TOPBAR */
.topbar { background: var(--bg-header); border-bottom: 1px solid var(--border); padding: 0 24px; height: 62px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; backdrop-filter: blur(14px); transition: background .3s, border-color .3s; }
.topbar-title { font-size: 15.5px; font-weight: 800; color: var(--text-heading); letter-spacing: -.2px; }
.topbar-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.topbar-sub::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 7px rgba(16,185,129,.55); display: inline-block; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.theme-toggle { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--bg-hover); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .2s; font-size: 16px; }
.theme-toggle:hover { border-color: var(--red); color: var(--red); }

/* TABS */
.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--bg-header); padding: 0 24px; flex-shrink: 0; backdrop-filter: blur(12px); transition: background .3s; }
.tab { padding: 13px 17px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; display: flex; align-items: center; gap: 7px; transition: all .15s; font-weight: 500; text-decoration: none; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--red); border-bottom-color: var(--red); font-weight: 700; }
.tab i { font-size: 14px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 17px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: all .2s; border: 1px solid transparent; font-family: inherit; text-decoration: none; white-space: nowrap; }
.btn i { font-size: 14px; }
.btn-sm  { padding: 6px 13px; font-size: 12px; }
.btn-xs  { padding: 4px 10px; font-size: 11px; border-radius: 7px; }
.btn-ghost { background: var(--bg-card); color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }
.btn-blue  { background: linear-gradient(135deg, #0047bb, #003388); color: white; box-shadow: 0 4px 14px rgba(0,68,187,.3); }
.btn-blue:hover  { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,68,187,.45); }
.btn-red   { background: linear-gradient(135deg, var(--red), #c01519); color: white; box-shadow: 0 4px 14px rgba(227,30,36,.3); }
.btn-red:hover   { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(227,30,36,.45); }
.btn-green { background: linear-gradient(135deg, #059669, #047857); color: white; box-shadow: 0 4px 14px rgba(5,150,105,.3); }
.btn-green:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(5,150,105,.4); }
.btn-icon { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--bg-hover); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .2s; position: relative; }
.btn-icon i { font-size: 17px; color: var(--text-secondary); }
.btn-icon:hover { border-color: var(--red); }
.btn-icon:hover i { color: var(--red); }
.notif-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 2px solid var(--bg-header); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.35);opacity:.7} }

/* CONTENT */
.content { flex: 1; padding: 20px 24px 44px; display: flex; flex-direction: column; gap: 16px; }

/* KPI CARDS */
.kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.kpi { background: var(--bg-card); border-radius: var(--radius); padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--border); backdrop-filter: blur(14px); transition: transform .2s, box-shadow .2s, background .3s; position: relative; overflow: hidden; }
.kpi::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; border-radius: var(--radius) var(--radius) 0 0; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.kpi-icon { width: 48px; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon i { font-size: 21px; }
.kpi-icon.blue   { background: rgba(0,85,170,.16); color: #60a5fa; border: 1px solid rgba(0,85,170,.28); }
.kpi-icon.green  { background: rgba(16,185,129,.13); color: #34d399; border: 1px solid rgba(16,185,129,.22); }
.kpi-icon.red    { background: rgba(227,30,36,.13); color: #f87171; border: 1px solid rgba(227,30,36,.22); }
.kpi-icon.orange { background: rgba(245,158,11,.13); color: #fbbf24; border: 1px solid rgba(245,158,11,.22); }
[data-theme="light"] .kpi-icon.blue   { background: #e8eff8; color: #003366; border-color: #c5d5e8; }
[data-theme="light"] .kpi-icon.green  { background: #e6f4ed; color: #1a7a45; border-color: #a8d5bb; }
[data-theme="light"] .kpi-icon.red    { background: #fdeaea; color: #e31e24; border-color: #fbbdbd; }
[data-theme="light"] .kpi-icon.orange { background: #fff3e0; color: #955800; border-color: #f6c775; }
.kpi-val   { font-size: 27px; font-weight: 800; color: var(--text-heading); line-height: 1.1; }
.kpi-lbl   { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-weight: 500; }
.kpi-trend { font-size: 11px; margin-top: 7px; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.kpi-trend i { font-size: 12px; }
.trend-up   { color: var(--success); }
.trend-down { color: #f87171; }
.trend-flat { color: var(--text-muted); }
.kpi:nth-child(1)::after { background: linear-gradient(90deg,#0055aa,#60a5fa); }
.kpi:nth-child(2)::after { background: linear-gradient(90deg,#10b981,#34d399); }
.kpi:nth-child(3)::after { background: linear-gradient(90deg,var(--red),#f87171); }
.kpi:nth-child(4)::after { background: linear-gradient(90deg,#f59e0b,#fbbf24); }

/* CARD */
.card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); backdrop-filter: blur(14px); overflow: hidden; transition: background .3s, border-color .3s; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { font-size: 13.5px; font-weight: 700; color: var(--text-heading); display: flex; align-items: center; gap: 8px; }
.card-head h3 i { font-size: 15px; color: var(--red); }
.card-link { font-size: 11px; color: var(--text-secondary); font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 3px; transition: color .15s; text-decoration: none; }
.card-link:hover { color: var(--red); }
.card-body { padding: 16px 20px; }

/* CHART */
.chart-legend { display: flex; gap: 16px; padding: 14px 20px 8px; }
.cl { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-secondary); font-weight: 500; }
.cl-dot { width: 10px; height: 10px; border-radius: 3px; }
.cl-dot.in  { background: #60a5fa; }
.cl-dot.out { background: #f87171; }
.bar-chart   { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding: 0 20px; }
.bar-group   { flex: 1; display: flex; gap: 3px; align-items: flex-end; }
.bar { flex: 1; border-radius: 5px 5px 0 0; transition: opacity .2s, transform .2s; cursor: pointer; }
.bar:hover   { opacity: .8; transform: scaleY(1.05); transform-origin: bottom; }
.bar.in  { background: linear-gradient(180deg,#3b82f6 0%,#1d4ed8 100%); }
.bar.out { background: linear-gradient(180deg,#ef4444 0%,#b91c1c 100%); opacity: .82; }
.bar-months { display: flex; gap: 8px; padding: 6px 20px 14px; }
.bm { flex: 1; text-align: center; font-size: 9.5px; color: var(--text-muted); font-weight: 500; }

/* ALERTS */
.alert-list {}
.alert-row { display: flex; align-items: center; gap: 11px; padding: 10px 20px; border-bottom: 1px solid var(--border); transition: background .15s; cursor: pointer; }
.alert-row:hover { background: var(--bg-hover); }
.alert-row:last-child { border-bottom: none; }
.al-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.al-dot.danger  { background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,.55); }
.al-dot.warning { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,.55); }
.al-info { flex: 1; }
.al-name { font-size: 12.5px; font-weight: 600; color: var(--text-heading); }
.al-sub  { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }
.al-qty  { font-size: 16px; font-weight: 800; }
.al-qty.danger  { color: #f87171; }
.al-qty.warning { color: #fbbf24; }
.reorder-note { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); padding: 10px 14px; border-top: 1px solid var(--border); background: var(--bg-hover); }
.reorder-note i { font-size: 13px; color: var(--warning); }
.alert-banner { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-radius: var(--radius-sm); background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.28); color: #fbbf24; font-size: 13px; font-weight: 500; }
.alert-banner i { font-size: 18px; flex-shrink: 0; }
[data-theme="light"] .alert-banner { background: #fff3e0; border-color: #f6c775; color: #955800; }

/* TABLE */
.tbl-toolbar { padding: 10px 20px; display: flex; gap: 8px; background: var(--bg-tbar); border-bottom: 1px solid var(--border); transition: background .3s; flex-wrap: wrap; }
.tbl-search { flex: 1; min-width: 160px; padding: 8px 12px 8px 36px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); font-size: 12.5px; background: var(--bg-input) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E") no-repeat 10px center; color: var(--text-primary); outline: none; transition: all .2s; font-family: inherit; }
.tbl-search:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(227,30,36,.1); }
.tbl-search::placeholder { color: var(--text-muted); }
.tbl-select { padding: 8px 12px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); font-size: 12.5px; background: var(--bg-select); color: var(--text-secondary); outline: none; font-family: inherit; cursor: pointer; transition: all .2s; }
.tbl-select:focus { border-color: var(--red); }
table { width: 100%; border-collapse: collapse; }
thead th { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-muted); font-weight: 700; padding: 10px 18px; text-align: left; background: var(--bg-thead); border-bottom: 1px solid var(--border); white-space: nowrap; transition: background .3s; }
tbody td { padding: 11px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-primary); transition: background .15s; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-row-hover); }
.ref-num  { font-size: 11px; color: #60a5fa; font-weight: 700; letter-spacing: .3px; font-family: monospace; background: rgba(0,85,170,.15); padding: 2px 8px; border-radius: 5px; display: inline-block; border: 1px solid rgba(0,85,170,.25); }
[data-theme="light"] .ref-num { color: var(--blue); background: var(--blue-light); border-color: var(--blue-muted); }
.ref-date  { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.prod-name { font-size: 13px; font-weight: 600; color: var(--text-heading); }
.prod-ref  { font-size: 10px; color: var(--text-muted); font-family: monospace; background: var(--bg-hover); display: inline-block; padding: 1px 6px; border-radius: 4px; margin-top: 2px; border: 1px solid var(--border); }
.dest-main { font-size: 12px; color: var(--text-secondary); }
.dest-sub  { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.qty-in    { font-size: 14px; font-weight: 800; color: #34d399; }
.qty-out   { font-size: 14px; font-weight: 800; color: #f87171; }
[data-theme="light"] .qty-in  { color: #1a7a45; }
[data-theme="light"] .qty-out { color: var(--red); }
.person-cell  { display: flex; align-items: center; gap: 8px; }
.person-name  { font-size: 12.5px; color: var(--text-primary); }
.person-role  { font-size: 10.5px; color: var(--text-muted); }
.av        { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; border: 1px solid var(--border); }
.av-blue   { background: rgba(0,85,170,.2); color: #60a5fa; }
.av-red    { background: rgba(227,30,36,.15); color: #f87171; }
.av-green  { background: rgba(16,185,129,.15); color: #34d399; }
.av-orange { background: rgba(245,158,11,.15); color: #fbbf24; }
[data-theme="light"] .av-blue   { background: #e8eff8; color: var(--blue); }
[data-theme="light"] .av-red    { background: #fdeaea; color: var(--red); }
[data-theme="light"] .av-green  { background: #e6f4ed; color: #1a7a45; }
[data-theme="light"] .av-orange { background: #fff3e0; color: #955800; }

/* 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; border: 1px solid; }
.badge i { font-size: 10px; }
.badge-entree  { background: rgba(16,185,129,.12); color: #34d399; border-color: rgba(16,185,129,.28); }
.badge-sortie  { background: rgba(227,30,36,.12); color: #f87171; border-color: rgba(227,30,36,.28); }
.badge-valide  { background: rgba(16,185,129,.12); color: #34d399; border-color: rgba(16,185,129,.28); }
.badge-attente { background: rgba(245,158,11,.12); color: #fbbf24; border-color: rgba(245,158,11,.28); }
.badge-annule  { background: rgba(148,163,184,.1); color: #94a3b8; border-color: rgba(148,163,184,.22); }
.badge-ok      { background: rgba(0,85,170,.12); color: #60a5fa; border-color: rgba(0,85,170,.28); }
.badge-danger  { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.28); }
[data-theme="light"] .badge-entree,[data-theme="light"] .badge-valide { background: #e6f4ed; color: #1a7a45; border-color: #a8d5bb; }
[data-theme="light"] .badge-sortie  { background: #fdeaea; color: var(--red); border-color: #fbbdbd; }
[data-theme="light"] .badge-attente { background: #fff3e0; color: #955800; border-color: #f6c775; }
[data-theme="light"] .badge-ok      { background: #e8eff8; color: var(--blue); border-color: #c5d5e8; }
[data-theme="light"] .badge-annule  { background: #eef0f4; color: #64748b; border-color: #dde1e9; }

.stock-bar-wrap   { width: 100px; }
.stock-bar-labels { display: flex; justify-content: space-between; font-size: 10px; margin-bottom: 4px; font-weight: 700; }
.stock-bar-track  { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.stock-bar-fill   { height: 100%; border-radius: 2px; transition: width .6s; }
.stock-bar-fill.ok    { background: linear-gradient(90deg,#10b981,#34d399); }
.stock-bar-fill.low   { background: linear-gradient(90deg,#f59e0b,#fbbf24); }
.stock-bar-fill.empty { background: linear-gradient(90deg,#ef4444,#f87171); }

/* PAGINATION */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg-pagination); transition: background .3s; }
.pagination-info { font-size: 11.5px; color: var(--text-muted); }
.pagination-info span { color: var(--text-primary); font-weight: 700; }
.pagination-btns { display: flex; gap: 4px; }
.page-btn { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--bg-hover); color: var(--text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; font-family: inherit; }
.page-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); background: var(--red-light); }
.page-btn.active { background: var(--red); color: white; border-color: var(--red); box-shadow: 0 2px 8px rgba(227,30,36,.4); }
.page-btn:disabled { opacity: .3; cursor: not-allowed; }

/* FORMS */
.form-group    { display: flex; flex-direction: column; gap: 6px; }
.form-row      { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3    { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-label    { font-size: 10.5px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; }
.form-label span { color: var(--red); }
.form-hint     { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.form-input, .form-select, .form-textarea { padding: 10px 14px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); font-size: 13px; outline: none; transition: all .2s; font-family: inherit; color: var(--text-primary); background: var(--bg-input); width: 100%; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(227,30,36,.1); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 84px; resize: vertical; }
.form-input[readonly] { opacity: .6; cursor: not-allowed; background: var(--gray-50); }

/* FORM CARD */
.form-card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); backdrop-filter: blur(14px); overflow: hidden; transition: background .3s; }
.form-head,.form-card-head { padding: 18px 22px; background: linear-gradient(135deg, rgba(0,28,70,.92), rgba(0,16,48,.97)); border-bottom: 1px solid var(--border); }
.form-head h2,.form-card-head h2 { color: #f1f5f9; font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.form-head h2 i,.form-card-head h2 i { font-size: 18px; }
.form-head p,.form-card-head p { color: rgba(255,255,255,.38); font-size: 11.5px; margin-top: 4px; }
.form-body,.form-card-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.form-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--bg-tbar); display: flex; gap: 10px; justify-content: flex-end; }

/* PRODUCT PREVIEW */
.product-preview { display: none; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: rgba(0,55,130,.14); border: 1px solid rgba(0,85,170,.22); transition: all .2s; }
.product-preview.show { display: flex; animation: fadeIn .25s ease; }
.pp-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: rgba(0,85,170,.25); border: 1px solid rgba(0,85,170,.35); }
.pp-icon i { font-size: 21px; color: #60a5fa; }
.pp-ref   { font-size: 10.5px; font-family: monospace; color: #60a5fa; margin-bottom: 1px; }
.pp-name  { font-size: 14px; font-weight: 700; color: var(--text-heading); }
.pp-stock { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.product-preview.success { background: var(--success-bg); border-color: var(--success-bdr); }
.product-preview.success .pp-icon { background: rgba(16,185,129,.2); border-color: var(--success-bdr); }
.product-preview.success .pp-icon i { color: var(--success); }
.product-preview.success .pp-ref { color: var(--success); }
.product-preview.success .pp-name { color: #34d399; }
[data-theme="light"] .product-preview { background: #e8eff8; border-color: #c5d5e8; }
[data-theme="light"] .product-preview .pp-icon { background: var(--blue); border-color: var(--blue); }
[data-theme="light"] .product-preview .pp-icon i { color: white; }
[data-theme="light"] .product-preview .pp-ref { color: var(--blue); }

/* UPLOAD ZONE */
.upload-zone { border: 2px dashed var(--border-input); border-radius: var(--radius-sm); padding: 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: var(--gray-50); }
.upload-zone:hover { border-color: var(--red); background: var(--red-light); }
.upload-zone i { font-size: 24px; color: var(--text-muted); display: block; margin-bottom: 7px; }
.upload-zone-text { font-size: 13px; color: var(--text-secondary); }
.upload-zone-text span { color: var(--red); font-weight: 600; }
.upload-zone-name { margin-top: 8px; font-size: 12px; color: var(--success); font-weight: 500; }

/* TOP LIST */
.top-list { display: flex; flex-direction: column; gap: 12px; }
.top-row  { display: flex; align-items: center; gap: 10px; }
.top-rank { width: 22px; height: 22px; border-radius: 50%; background: var(--red-light); border: 1px solid var(--red-mid); color: var(--red); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.top-row:first-child .top-rank { background: rgba(251,191,36,.15); border-color: rgba(251,191,36,.3); color: #fbbf24; }
.top-name     { font-size: 12.5px; font-weight: 600; color: var(--text-heading); }
.top-sub      { font-size: 10px; color: var(--text-muted); font-family: monospace; }
.top-bar-wrap { flex: 1; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.top-bar-fill { height: 100%; background: linear-gradient(90deg, var(--red), #f87171); border-radius: 2px; }
.top-qty      { font-size: 13px; font-weight: 800; color: var(--text-heading); min-width: 28px; text-align: right; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(7px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; pointer-events: none; transition: opacity .3s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-card-solid); border: 1px solid var(--border); border-radius: var(--radius); width: 520px; max-width: 96vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 28px 64px rgba(0,0,0,.55); transform: translateY(24px) scale(.96); transition: all .3s cubic-bezier(.34,1.56,.64,1); backdrop-filter: blur(22px); }
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-head { padding: 18px 22px; background: linear-gradient(135deg, rgba(0,28,70,.96), rgba(0,14,40,.99)); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { color: white; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal-head h3 i { font-size: 18px; color: #60a5fa; }
.modal-close { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.1); color: rgba(255,255,255,.6); width: 28px; height: 28px; border-radius: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 17px; transition: all .2s; }
.modal-close:hover { background: rgba(227,30,36,.2); color: #f87171; border-color: rgba(227,30,36,.3); }
.modal-body   { padding: 22px; display: flex; flex-direction: column; gap: 15px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--bg-tbar); }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; pointer-events: none; }
.toast { padding: 13px 18px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 32px rgba(0,0,0,.45); transform: translateX(120%); transition: transform .35s cubic-bezier(.34,1.56,.64,1); pointer-events: all; min-width: 265px; max-width: 380px; border: 1px solid; backdrop-filter: blur(14px); }
.toast.show    { transform: translateX(0); }
.toast i       { font-size: 20px; flex-shrink: 0; }
.toast.success { background: rgba(16,185,129,.92); color: white; border-color: rgba(16,185,129,.55); }
.toast.error   { background: rgba(239,68,68,.92);  color: white; border-color: rgba(239,68,68,.55); }
.toast.warning { background: rgba(245,158,11,.92); color: white; border-color: rgba(245,158,11,.55); }

/* EMPTY STATE */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 50px 20px; color: var(--text-muted); text-align: center; }
.empty-state i { font-size: 48px; margin-bottom: 14px; opacity: .3; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }
.no-results { text-align: center; padding: 32px; color: var(--text-muted); font-size: 13px; }
.no-results i { font-size: 24px; display: block; margin-bottom: 8px; opacity: .4; }

/* LOGIN */
.login-page { min-height: 100vh; background: linear-gradient(145deg, #000d1a 0%, #001330 55%, #000a15 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; }
.login-page::before { content: ''; position: absolute; top: -120px; left: -120px; width: 550px; height: 550px; background: radial-gradient(circle, rgba(0,55,140,.22) 0%, transparent 70%); }
.login-page::after  { content: ''; position: absolute; bottom: -120px; right: -120px; width: 480px; height: 480px; background: radial-gradient(circle, rgba(227,30,36,.12) 0%, transparent 70%); }
.login-header { text-align: center; margin-bottom: 30px; z-index: 1; }
.login-header img { height: 56px; object-fit: contain; margin-bottom: 14px; filter: brightness(0) invert(1); }
.login-header h1  { color: white; font-size: 26px; font-weight: 800; letter-spacing: -.3px; }
.login-header p   { color: rgba(255,255,255,.35); font-size: 12.5px; margin-top: 5px; }
.login-card { background: rgba(0,18,48,.72); border: 1px solid rgba(255,255,255,.09); border-radius: 20px; padding: 34px; width: 100%; max-width: 420px; box-shadow: 0 30px 80px rgba(0,0,0,.55); z-index: 1; backdrop-filter: blur(22px); }
.login-card h2   { font-size: 20px; font-weight: 800; color: white; margin-bottom: 4px; }
.login-card .sub { font-size: 13px; color: rgba(255,255,255,.38); margin-bottom: 26px; }
.login-input-wrap { position: relative; }
.login-input-wrap i.icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--text-muted); pointer-events: none; }
.login-input-wrap .form-input { padding-left: 42px; background: rgba(0,20,55,.85); border-color: rgba(255,255,255,.13); color: white; }
.login-input-wrap .form-input::placeholder { color: rgba(255,255,255,.25); }
.login-input-wrap .form-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(227,30,36,.15); }
.toggle-pw { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--text-muted); cursor: pointer; background: none; border: none; display: flex; align-items: center; }
.login-footer { text-align: center; margin-top: 22px; color: rgba(255,255,255,.2); font-size: 11px; z-index: 1; }
.login-error { display: none; background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #f87171; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.login-error.show { display: flex; align-items: center; gap: 8px; }

/* BANNERS */
.banner { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; border: 1px solid; }
.banner i { font-size: 17px; flex-shrink: 0; }
.banner-warn  { background: rgba(245,158,11,.1);  border-color: rgba(245,158,11,.28); color: #fbbf24; }
.banner-error { background: rgba(239,68,68,.1);   border-color: rgba(239,68,68,.28); color: #f87171; }
.banner-info  { background: rgba(0,85,170,.1);    border-color: rgba(0,85,170,.28); color: #60a5fa; }
.banner-ok    { background: rgba(16,185,129,.1);  border-color: rgba(16,185,129,.28); color: #34d399; }
[data-theme="light"] .banner-warn  { background: #fff3e0; border-color: #f6c775; color: #955800; }
[data-theme="light"] .banner-error { background: #fdeaea; border-color: #fbbdbd; color: var(--red); }
[data-theme="light"] .banner-info  { background: #e8eff8; border-color: #c5d5e8; color: var(--blue); }
[data-theme="light"] .banner-ok    { background: #e6f4ed; border-color: #a8d5bb; color: #1a7a45; }

/* PROGRESS */
.progress-bar { display: flex; gap: 4px; margin-top: 5px; }
.progress-step { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.progress-step.done   { background: var(--success); }
.progress-step.active { background: var(--warning); }
.progress-step.failed { background: var(--red); opacity: .4; }

/* WORKFLOW STEPS */
.workflow { display: flex; align-items: flex-start; }
.wf-step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.wf-step:not(:last-child)::after { content: ''; position: absolute; top: 14px; left: calc(50% + 14px); width: calc(100% - 28px); height: 2px; background: var(--border); }
.wf-step.done:not(:last-child)::after   { background: var(--success); }
.wf-step.active:not(:last-child)::after { background: var(--warning); }
.wf-dot { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; z-index: 1; border: 2px solid var(--border); background: var(--bg-card); color: var(--text-muted); }
.wf-step.done   .wf-dot { background: var(--success); border-color: var(--success); color: white; }
.wf-step.active .wf-dot { background: var(--warning); border-color: var(--warning); color: white; }
.wf-step.failed .wf-dot { background: var(--danger); border-color: var(--danger); color: white; }
.wf-label { font-size: 10px; color: var(--text-muted); margin-top: 5px; text-align: center; font-weight: 500; }
.wf-step.done   .wf-label { color: var(--success); }
.wf-step.active .wf-label { color: var(--warning); }

/* PAGE HEADER */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; }
.page-header h2 { font-size: 19px; font-weight: 800; color: var(--text-heading); }
.page-header p  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.row2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }

/* INFO SECTION */
.info-row { display: flex; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.info-value { font-size: 13px; color: var(--text-heading); font-weight: 500; text-align: right; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--border); }

/* ANIMATIONS */
@keyframes fadeIn  { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }
@keyframes spin    { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
.fade-in  { animation: fadeIn .3s ease forwards; }
.spinning { animation: spin 1s linear infinite; }

/* RESPONSIVE */
@media (max-width: 1100px) { .kpi-row { grid-template-columns: repeat(2,1fr); } .row2 { grid-template-columns: 1fr; } }
@media (max-width: 768px)  { .sidebar { display: none; } .kpi-row { grid-template-columns: 1fr 1fr; } .form-row,.form-row-3 { grid-template-columns: 1fr; } .content { padding: 14px 16px 32px; } .topbar { padding: 0 16px; } }
