/* =========================================================
   BARAKA GESTION — Interface
   ========================================================= */
:root {
  --green-950: #08261c;
  --green-900: #0f3d2e;
  --green-800: #145238;
  --green-700: #17663f;
  --green-600: #1b8a4d;
  --green-500: #22a55b;
  --green-100: #dcf3e4;
  --green-50: #eef9f1;
  --orange-600: #e2560f;
  --orange-500: #f26b1d;
  --orange-400: #ff8a3d;
  --orange-100: #ffe8d6;
  --amber-100: #fef3c7;
  --amber-700: #b45309;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --blue-600: #2563eb;
  --blue-100: #dbeafe;
  --violet-600: #7c3aed;
  --violet-100: #ede9fe;

  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #f8faf7;
  --border: #e3e8e2;
  --border-strong: #cfd8ce;
  --text: #15241c;
  --text-2: #4a5a50;
  --muted: #7b8a80;
  --primary: var(--green-700);
  --primary-strong: var(--green-900);
  --accent: var(--orange-500);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 40, 28, .06);
  --shadow: 0 1px 2px rgba(16, 40, 28, .05), 0 6px 20px -8px rgba(16, 40, 28, .12);
  --shadow-lg: 0 20px 50px -12px rgba(8, 38, 28, .35);
  --sidebar-w: 256px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: .9em; }
[v-cloak] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; }
.pos { color: var(--green-600); }
.neg { color: var(--red-600); }
.hide-sm { }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 14px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: #b9c6b8; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid rgba(34, 165, 91, .35); outline-offset: 1px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--green-700); border-color: var(--green-700); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 4px 12px -4px rgba(23, 102, 63, .6); }
.btn.primary:hover { background: var(--green-800); border-color: var(--green-800); }
.btn.accent { background: var(--orange-500); border-color: var(--orange-500); color: #fff; box-shadow: 0 4px 12px -4px rgba(242, 107, 29, .6); }
.btn.accent:hover { background: var(--orange-600); border-color: var(--orange-600); }
.btn.danger { color: var(--red-600); border-color: #f3c4c4; }
.btn.danger:hover { background: var(--red-100); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(15, 61, 46, .06); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn.sm svg { width: 15px; height: 15px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Formulaires ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
input, select, textarea {
  font: 500 14.5px var(--font); color: var(--text);
  height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: #fff; width: 100%; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 4px rgba(34, 165, 91, .14); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--green-700); }
input[type=file] { height: auto; padding: 8px; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--text); cursor: pointer; }
.input-sm { height: 34px; font-size: 13.5px; padding: 0 10px; border-radius: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .full, .full { grid-column: 1 / -1; }
.form-grid h3 { font-size: 15px; margin-top: 6px; color: var(--green-900); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.hint { font-weight: 500; font-size: 12px; color: var(--muted); }
.input-group { display: flex; }
.input-group input { border-radius: 10px 0 0 10px; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 10px 10px 0; background: var(--surface-2); font-weight: 600; color: var(--muted); }

/* ---------- Alertes ---------- */
.alert { padding: 12px 14px; border-radius: 10px; font-weight: 500; margin-bottom: 12px; border: 1px solid; }
.alert.err { background: var(--red-100); border-color: #fbc5c5; color: #8a1c1c; }
.alert.ok { background: var(--green-50); border-color: #bfe8cd; color: var(--green-800); }
.alert.warn { background: var(--amber-100); border-color: #fde08a; color: #7a4a06; }
.alert.info { background: var(--blue-100); border-color: #bcd3fb; color: #1e3a8a; }

/* ---------- Authentification ---------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; width: min(1040px, 100%); min-height: 600px; background: var(--surface); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-lg); }
.auth-visual {
  position: relative; color: #e8f5ec; padding: 48px; display: flex; align-items: flex-end;
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 138, 61, .55), transparent 42%),
    radial-gradient(circle at 10% 90%, rgba(34, 165, 91, .45), transparent 45%),
    linear-gradient(160deg, var(--green-900), var(--green-950));
}
.auth-visual::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px); background-size: 22px 22px; pointer-events: none; }
.auth-visual-inner { position: relative; z-index: 1; }
.auth-logo { width: 64px; height: 64px; margin-bottom: 26px; }
.auth-visual h1 { font-size: 36px; color: #fff; margin-bottom: 12px; }
.auth-visual p { font-size: 16px; opacity: .85; max-width: 420px; }
.auth-visual ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-visual li { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); padding: 10px 14px; border-radius: 12px; font-weight: 500; backdrop-filter: blur(4px); }
.auth-card { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; gap: 18px; background: var(--surface); }
.auth-card.wide { width: min(760px, 100%); border-radius: 22px; box-shadow: var(--shadow-lg); }
.auth-card h2 { font-size: 26px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand img { width: 44px; height: 44px; }
.auth-brand strong { display: block; font-size: 16px; color: var(--green-900); }
.auth-brand span { display: block; font-size: 13px; color: var(--muted); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: linear-gradient(185deg, var(--green-900) 0%, var(--green-950) 100%);
  color: #cfe5d7; display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.sidebar-brand img { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 0 0 1px rgba(255,255,255,.1); }
.sidebar-brand img.custom { width: auto; max-width: 150px; height: 46px; object-fit: contain; background: #fff; padding: 4px 8px; }
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: .01em; }
.sidebar-brand span { display: block; font-size: 12px; color: #8fb79e; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px 20px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: #6f9a80; padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: #cfe5d7; font-weight: 600; font-size: 14px; text-decoration: none; position: relative;
}
.nav a svg { width: 19px; height: 19px; opacity: .85; flex: none; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.active { background: rgba(255,255,255,.12); color: #fff; box-shadow: inset 3px 0 0 var(--orange-400); }
.nav a.active svg { color: var(--orange-400); opacity: 1; }
.nav .count { margin-left: auto; background: var(--orange-500); color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; color: #fff; cursor: pointer; }
.user-chip:hover { background: rgba(255,255,255,.07); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: linear-gradient(135deg, var(--orange-400), var(--orange-600)); color: #fff; flex: none; }
.user-chip small { display: block; color: #8fb79e; font-size: 12px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: rgba(244, 246, 243, .85); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 19px; }
.topbar .crumb { color: var(--muted); font-weight: 600; font-size: 13px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }
.content { padding: 24px 28px 60px; max-width: 1480px; width: 100%; }
.backdrop { position: fixed; inset: 0; background: rgba(8, 20, 14, .45); z-index: 35; }

/* ---------- Cartes & grilles ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 15.5px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px 18px; }
.card.pad { padding: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { font-size: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .spacer { flex: 1; }

/* ---------- Statistiques ---------- */
.stat { position: relative; padding: 16px 18px; overflow: hidden; }
.stat .stat-top { display: flex; align-items: center; gap: 10px; }
.stat .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.stat .ico svg { width: 19px; height: 19px; }
.stat .lbl { font-size: 13px; color: var(--text-2); font-weight: 600; }
.stat .val { font-size: 23px; font-weight: 800; margin-top: 10px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 500; }
.tone-green .ico { background: var(--green-100); color: var(--green-700); }
.tone-orange .ico { background: var(--orange-100); color: var(--orange-600); }
.tone-blue .ico { background: var(--blue-100); color: var(--blue-600); }
.tone-red .ico { background: var(--red-100); color: var(--red-600); }
.tone-violet .ico { background: var(--violet-100); color: var(--violet-600); }
.tone-amber .ico { background: var(--amber-100); color: var(--amber-700); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12px; border-radius: 99px; padding: 1px 7px; }
.trend.up { background: var(--green-100); color: var(--green-700); }
.trend.down { background: var(--red-100); color: var(--red-600); }

.hero-card {
  position: relative; overflow: hidden; color: #fff; padding: 22px 24px; border: 0;
  background: radial-gradient(circle at 92% -10%, rgba(255, 138, 61, .65), transparent 40%), linear-gradient(135deg, var(--green-800), var(--green-950));
}
.hero-card h2 { font-size: 22px; color: #fff; }
.hero-card p { margin: 6px 0 0; opacity: .82; }
.hero-card .btn { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: #fff; }
.hero-card .btn:hover { background: rgba(255,255,255,.18); }
.hero-card .btn.accent { background: var(--orange-500); border-color: var(--orange-500); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 11px 12px; border-bottom: 1px solid #edf1ec; vertical-align: middle; }
.table tbody tr:hover td { background: #fafcf9; }
.table tbody tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table.compact td, .table.compact th { padding: 8px 10px; }
.table input, .table select { height: 36px; font-size: 14px; }
.card > .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
.card > .table-wrap:first-child { border-radius: var(--radius); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar input, .toolbar select { height: 38px; width: auto; min-width: 150px; }
.toolbar input[type=checkbox], .toolbar input[type=radio], .toolbar input[type=color] { min-width: 0; flex: none; }
.toolbar input[type=checkbox], .toolbar input[type=radio] { width: 18px; height: 18px; }
.toolbar label.check { flex: none; white-space: nowrap; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search input { width: 100%; padding-left: 38px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #eef1ed; color: var(--text-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.b-green { background: var(--green-100); color: var(--green-700); }
.b-orange { background: var(--orange-100); color: var(--orange-600); }
.b-red { background: var(--red-100); color: var(--red-600); }
.b-blue { background: var(--blue-100); color: var(--blue-600); }
.b-violet { background: var(--violet-100); color: var(--violet-600); }
.b-amber { background: var(--amber-100); color: var(--amber-700); }
.b-gray { background: #eef1ed; color: #5b6b61; }
.b-teal { background: #ccfbf1; color: #0f766e; }

/* ---------- Onglets ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: 700 14px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--green-800); border-bottom-color: var(--orange-500); }
.tabs .count { background: #eef1ed; color: var(--text-2); border-radius: 99px; font-size: 11px; padding: 0 7px; }
.seg { display: inline-flex; background: #e9eee8; padding: 3px; border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: transparent; font: 700 13px var(--font); color: var(--text-2); padding: 6px 12px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.seg button.on { background: #fff; color: var(--green-800); box-shadow: var(--shadow-sm); }
.seg svg { width: 15px; height: 15px; }

/* ---------- Modale ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; background: rgba(8, 20, 14, .5); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 18px; width: min(560px, 100%); box-shadow: var(--shadow-lg); animation: pop .18s ease-out; display: flex; flex-direction: column; max-height: none; }
.modal.lg { width: min(820px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; flex: 1; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 400px; background: var(--green-950); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; display: flex; gap: 10px; align-items: center; animation: pop .2s; }
.toast.err { background: #7f1d1d; }
.toast svg { width: 18px; height: 18px; flex: none; }

/* ---------- Combobox ---------- */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; padding: 4px; }
.combo-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; font-weight: 500; }
.combo-item small { color: var(--muted); }
.combo-item.on, .combo-item:hover { background: var(--green-50); }
.combo-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ---------- Circuit conteneur ---------- */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.pipe-step { position: relative; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: transform .15s, box-shadow .15s; text-decoration: none !important; color: inherit; }
.pipe-step:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pipe-step .n { font-size: 26px; font-weight: 800; color: var(--green-900); }
.pipe-step .l { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.pipe-step .i { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--green-50); color: var(--green-700); }
.pipe-step .i svg { width: 16px; height: 16px; }

.stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 4px 2px 8px; }
.stepper .st { flex: 1; min-width: 100px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; gap: 8px; }
.stepper .st::before { content: ''; position: absolute; top: 17px; left: -50%; right: 50%; height: 3px; background: var(--border); z-index: 0; }
.stepper .st:first-child::before { display: none; }
.stepper .st.done::before, .stepper .st.cur::before { background: var(--green-500); }
.stepper .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2.5px solid var(--border-strong); color: var(--muted); z-index: 1; position: relative; }
.stepper .dot svg { width: 17px; height: 17px; }
.stepper .done .dot { background: var(--green-500); border-color: var(--green-500); color: #fff; }
.stepper .cur .dot { background: var(--orange-500); border-color: var(--orange-500); color: #fff; box-shadow: 0 0 0 6px rgba(242, 107, 29, .18); }
.stepper .lbl { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.stepper .cur .lbl { color: var(--orange-600); }
.stepper .dt { font-size: 11.5px; color: var(--muted); font-weight: 500; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.kcol { background: #eaefe9; border-radius: 14px; padding: 10px; min-height: 200px; }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 800; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.kcol-head .count { margin-left: auto; background: #fff; border-radius: 99px; padding: 0 8px; font-size: 12px; }
.kcard { background: #fff; border-radius: 12px; padding: 12px; border: 1px solid var(--border); margin-bottom: 10px; cursor: pointer; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; }
.kcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kcard .ref { font-weight: 800; color: var(--green-900); }
.kcard .num { font-size: 12px; color: var(--muted); font-weight: 600; font-family: ui-monospace, monospace; }
.kcard .prods { font-size: 12.5px; color: var(--text-2); margin: 8px 0; line-height: 1.4; }
.kcard .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-weight: 600; }

.progress { height: 8px; background: #e7ece6; border-radius: 99px; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; background: var(--green-500); }
.progress > span.o { background: var(--orange-400); }
.progress > span.r { background: #f87171; }
.progress.thin { height: 5px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ''; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--green-500); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--green-500); }
.timeline .t { font-weight: 700; }
.timeline .d { font-size: 12.5px; color: var(--muted); }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #edf1ec; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { font-size: 12.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.empty strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ---------- Produits ---------- */
.pcard { overflow: hidden; display: flex; flex-direction: column; }
.pcard .img { aspect-ratio: 4/3; background: var(--surface-2); display: grid; place-items: center; position: relative; }
.pcard .img img { width: 100%; height: 100%; object-fit: cover; }
.pcard .img .fruit { width: 46%; }
.pcard .img .tags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.pcard .bd { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.pcard .nm { font-weight: 800; font-size: 15px; }
.pcard .ft { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; }
.thumb { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .fruit { width: 70%; }

/* ---------- Vente (saisie) ---------- */
.sale-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.sale-summary { position: sticky; top: 84px; }
.sale-total { font-size: 32px; font-weight: 800; color: var(--green-900); letter-spacing: -.02em; }
.line-card { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 40px; gap: 10px 12px; align-items: end; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); margin-bottom: 10px; }
.line-card > :nth-child(1) { grid-column: 1 / 3; }
.line-card > :nth-child(2) { grid-column: 3 / 5; }
.line-card > :nth-child(3) { grid-column: 1 / 2; grid-row: 2; }
.line-card > :nth-child(4) { grid-column: 2 / 3; grid-row: 2; }
.line-card > :nth-child(5) { grid-column: 3 / 5; grid-row: 2; }
.line-card > :nth-child(6) { grid-column: 5; grid-row: 1; }
.line-card label { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 8px; }
.line-card label > input, .line-card label > select, .line-card label > .combo { flex-basis: 100%; }
.line-card .ltot { font-weight: 800; font-size: 17px; text-align: right; padding-bottom: 8px; font-variant-numeric: tabular-nums; }
.stock-pill { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--green-100); color: var(--green-700); }
.stock-pill.low { background: var(--red-100); color: var(--red-600); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: #fff; border-radius: 99px; padding: 5px 12px; font: 600 13px var(--font); cursor: pointer; color: var(--text-2); }
.chip.on { background: var(--green-700); border-color: var(--green-700); color: #fff; }

.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 220px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; margin-bottom: 10px; font-size: 13.5px; }
.bar-row .bar { height: 10px; background: #edf1ec; border-radius: 99px; overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green-500), var(--green-700)); }
.bar-row .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.loading { display: flex; justify-content: center; padding: 60px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--green-100); border-top-color: var(--green-600); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 200px; z-index: 50; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; background: none; border: 0; font: 600 14px var(--font); color: var(--text); cursor: pointer; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-menu svg { width: 16px; height: 16px; color: var(--muted); }
.sidebar .dropdown-menu { bottom: calc(100% + 6px); top: auto; left: 0; right: 0; }

/* ---------- Responsive ---------- */
/* ---------- Pièces jointes ---------- */
.dropzone { display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px dashed var(--border-strong); border-radius: 12px; background: var(--surface-2); cursor: pointer; font-weight: 500; color: var(--text-2); transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: var(--green-500); background: var(--green-50); }
.dropzone.on { border-style: solid; border-color: var(--green-500); background: var(--green-50); color: var(--green-800); }
.dropzone svg { width: 20px; height: 20px; flex: none; }
.dropzone span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.file-link { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 10px; border-radius: 8px; background: var(--blue-100); color: var(--blue-600); font-weight: 600; font-size: 12.5px; text-decoration: none !important; }
.file-link:hover { background: #c9ddfb; }
.file-link svg { width: 14px; height: 14px; flex: none; }
.file-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 2px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.doc-chip > .small { padding: 0 8px; }
.ccard .kv { gap: 4px 14px; }

@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sale-layout { grid-template-columns: 1fr; }
  .sale-summary { position: static; }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .g-main, .g3 { grid-template-columns: 1fr; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .content { padding: 16px 16px 90px; }
  .topbar { padding: 0 12px; height: 58px; }
  .topbar h1 { font-size: 17px; }
  .g2, .g4 { grid-template-columns: 1fr; }
  .g4.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .form-grid.three, .form-grid.four { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head h2 { font-size: 20px; }
  .stat .val { font-size: 19px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal, .modal.lg, .modal.xl { border-radius: 18px 18px 0 0; max-height: 94vh; overflow-y: auto; }
  .line-card { grid-template-columns: 1fr 1fr 40px; }
  .line-card > :nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
  .line-card > :nth-child(2) { grid-column: 1 / 4; grid-row: 2; }
  .line-card > :nth-child(3) { grid-column: 1 / 2; grid-row: 3; }
  .line-card > :nth-child(4) { grid-column: 2 / 4; grid-row: 3; }
  .line-card > :nth-child(5) { grid-column: 1 / 4; grid-row: 4; text-align: left; padding: 0; }
  .line-card > :nth-child(6) { grid-column: 3; grid-row: 1; }
  .hide-sm { display: none !important; }
  .toolbar input, .toolbar select { min-width: 0; flex: 1 1 140px; }
  .auth-card { padding: 30px 22px; }
  .toasts { left: 16px; right: 16px; bottom: 76px; }
  .bottom-bar { display: flex !important; }
}
.bottom-bar { display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
.bottom-bar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 10px; border-radius: 10px; text-decoration: none; }
.bottom-bar a svg { width: 21px; height: 21px; }
.bottom-bar a.active { color: var(--green-700); }
.bottom-bar a.fab { background: var(--orange-500); color: #fff; border-radius: 14px; padding: 6px 14px; }

@media print {
  .sidebar, .topbar, .bottom-bar, .no-print, .toolbar .btn { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
