/* =========================================================
   KLÉNÉA DESIGN SYSTEM — COMPONENTS
   v0.3 — May 2026 (.card a maintenant padding par défaut sp-5)
   ========================================================= */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--k-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- TYPOGRAPHY ---------- */
.h-display { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); line-height: var(--lh-tight); letter-spacing: -0.01em; }
.h-page    { font-size: var(--fs-xl);  font-weight: var(--fw-semibold); line-height: var(--lh-tight); letter-spacing: -0.005em; }
.h-section { font-size: var(--fs-lg);  font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.h-card    { font-size: var(--fs-md);  font-weight: var(--fw-semibold); line-height: var(--lh-snug); }
.t-body    { font-size: var(--fs-base); }
.t-sm      { font-size: var(--fs-sm); }
.t-xs      { font-size: var(--fs-xs); letter-spacing: 0.02em; }
.t-mono    { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.t-num     { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.t-muted   { color: var(--text-2); }
.t-faded   { color: var(--text-3); }
.t-label   { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }

/* ---------- BUTTON ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--ctrl-h); padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: var(--fw-medium); font-size: var(--fs-base);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn:hover { background: var(--n-50); border-color: var(--n-300); }
.btn:focus-visible { outline: none; box-shadow: var(--sh-focus); border-color: var(--k-primary); }
.btn:active { background: var(--n-75); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--k-primary); border-color: var(--k-primary); color: var(--text-on-primary); }
.btn-primary:hover { background: var(--k-primary-hover); border-color: var(--k-primary-hover); }
.btn-primary:active { background: var(--k-primary-active); border-color: var(--k-primary-active); }

.btn-soft { background: var(--k-primary-soft); border-color: var(--k-brand-100); color: var(--k-brand-700); }
.btn-soft:hover { background: var(--k-brand-100); }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--n-75); border-color: transparent; }

.btn-danger { background: var(--surface); border-color: var(--danger-200); color: var(--danger-700); }
.btn-danger:hover { background: var(--danger-50); border-color: var(--danger-500); }

.btn-warn { background: var(--warn-50); border-color: var(--warn-200); color: var(--warn-700); }
.btn-warn:hover { background: var(--warn-100); }

.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg { height: var(--tap-h); padding: 0 18px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn-icon { width: var(--ctrl-h); padding: 0; }

/* ---------- BADGE / PILL ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  background: var(--n-75); color: var(--n-700);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.b-ok      { background: var(--ok-50);     color: var(--ok-700); }
.badge.b-warn    { background: var(--warn-50);   color: var(--warn-700); }
.badge.b-danger  { background: var(--danger-50); color: var(--danger-700); }
.badge.b-info    { background: var(--info-50);   color: var(--info-700); }
.badge.b-neg     { background: #f3e8ff;          color: #7c3aed; }
.badge.b-nc      { background: var(--n-100);     color: var(--n-600); }
.badge.b-brand   { background: var(--k-primary-soft); color: var(--k-brand-700); }

.badge-dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

/* movement pills */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
}
.pill-in  { background: var(--ok-50);   color: var(--ok-700); }
.pill-out { background: var(--danger-50); color: var(--danger-700); }
.pill-adj { background: var(--info-50); color: var(--info-700); }

/* ---------- CARD ----------
   .card a un padding par défaut de var(--sp-5) (20px) depuis v0.3.
   Couvre 95% des cas (formulaires, sections, contenus textuels).
   Pour les cas où on veut bord-à-bord (tableau dense scrollable, etc.) :
   utiliser .card-flush qui annule le padding.
*/
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  padding: var(--sp-5);
}
.card-flush { padding: 0; }                /* override pour bord-à-bord */
.card-pad { padding: var(--sp-5); }        /* legacy : redondant avec le défaut, conservé pour compat */
.card-pad-sm { padding: var(--sp-4); }     /* variante : padding plus serré (16px) */
.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.card-body { padding: var(--sp-5); }
.card-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-soft);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* metric card */
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.metric.is-clickable { cursor: pointer; }
.metric.is-clickable:hover { border-color: var(--border-strong); box-shadow: var(--sh-sm); }
.metric-label { font-size: var(--fs-xs); font-weight: var(--fw-semibold); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.metric-value { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-trend { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: 4px; }
.metric.is-warn .metric-value  { color: var(--warn-700); }
.metric.is-danger .metric-value { color: var(--danger-700); }
.metric.is-ok .metric-value    { color: var(--ok-700); }

/* ---------- ALERT ---------- */
.alert {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-base);
}
.alert-ok      { background: var(--ok-50);     border-color: #a7f3d0; color: var(--ok-700); }
.alert-warn    { background: var(--warn-50);   border-color: var(--warn-200); color: var(--warn-700); }
.alert-danger  { background: var(--danger-50); border-color: var(--danger-200); color: var(--danger-700); }
.alert-info    { background: var(--info-50);   border-color: #bfdbfe; color: var(--info-700); }
.alert-icon { flex-shrink: 0; margin-top: 2px; }
.alert-body { flex: 1; }
.alert-title { font-weight: var(--fw-semibold); }

/* staging banner — full-width, fixed top */
.staging-banner {
  background: var(--warn-500);
  color: var(--n-900);
  font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  height: 32px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}

/* ---------- FORM ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-row { display: grid; gap: var(--sp-3); }
.field-row.f1 { grid-template-columns: 1fr; }
.field-row.f2 { grid-template-columns: 1fr 1fr; }
.field-row.f3 { grid-template-columns: 1fr 1fr 1fr; }
.field-row.f4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.label {
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--n-700);
}
.label .req { color: var(--danger-500); margin-left: 2px; }
.help { font-size: var(--fs-xs); color: var(--text-3); }

.input, .select, .textarea {
  height: var(--ctrl-h);
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
}
.textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--n-300); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--k-primary); box-shadow: var(--sh-focus);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input.is-error { border-color: var(--danger-500); }
.input.is-error:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.input-search {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238c95a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 36px;
}

.checkbox, .radio {
  width: 16px; height: 16px;
  accent-color: var(--k-primary);
  cursor: pointer;
}

/* segmented control */
.segmented {
  display: inline-flex;
  background: var(--n-75);
  border-radius: var(--r-md);
  padding: 2px;
  gap: 2px;
}
.segmented button {
  appearance: none; border: none; background: transparent;
  height: 28px; padding: 0 12px;
  border-radius: var(--r-sm);
  font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-2); cursor: pointer;
}
.segmented button.is-active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--sh-xs);
}

/* ---------- DATA GRID ---------- */
.grid-toolbar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  flex-wrap: wrap;
}
.grid-toolbar > .input-search { flex: 1 1 240px; max-width: 360px; }
.grid-toolbar > .spacer { flex: 1; }

.dg {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
  background: var(--surface);
}
.dg thead th {
  position: sticky; top: 0;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
  z-index: 1;
}
.dg thead th.num { text-align: right; }
.dg thead th.sortable { cursor: pointer; user-select: none; }
.dg thead th.sortable:hover { color: var(--text); background: var(--n-75); }

.dg tbody td {
  padding: var(--row-pad);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  height: var(--row-h);
}
.dg tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dg tbody td.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dg tbody tr:hover td { background: var(--n-25); }
.dg tbody tr.is-selected td { background: var(--k-primary-soft); }
.dg tbody tr.row-warn   td { background: var(--warn-50); }
.dg tbody tr.row-warn:hover td { background: #fef0d0; }
.dg tbody tr.row-danger td { background: var(--danger-50); }
.dg tbody tr.row-danger:hover td { background: #fde0e0; }
.dg tbody tr.row-neg    td { background: #faf2ff; }

.dg .product-name { font-weight: var(--fw-semibold); color: var(--text); }
.dg .product-sub  { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

.dg-footer {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--border-soft);
  background: var(--surface);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-size: var(--fs-sm); color: var(--text-2);
}
.pager { display: inline-flex; gap: 4px; }
.pager .btn { height: 28px; min-width: 28px; padding: 0 8px; font-size: var(--fs-sm); }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 248px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: var(--sp-3) var(--sidebar-pad-x);
  display: flex; align-items: center; gap: var(--sp-3);
  border-bottom: 1px solid var(--border-soft);
}
.sidebar-brand .logo {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: linear-gradient(135deg, #c9a8d6, #e8d5e8);
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.sidebar-brand .name { font-weight: var(--fw-semibold); font-size: var(--fs-md); line-height: 1.2; }
.sidebar-brand .sub  { font-size: var(--fs-xs); color: var(--text-2); }

.sidebar-section {
  padding: var(--sp-4) var(--sidebar-pad-x) var(--sp-1);
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2);
}
.sidebar-section .mod-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--k-primary);
}
.sidebar-section.mod-stock .mod-dot { background: var(--k-mod-stock); }
.sidebar-section.mod-menu  .mod-dot { background: var(--k-mod-menu); }
.sidebar-section.mod-diet  .mod-dot { background: var(--k-mod-diet); }
.sidebar-section.mod-vente .mod-dot { background: var(--k-mod-vente); }
.sidebar-section.mod-rh    .mod-dot { background: var(--k-mod-rh); }
.sidebar-section.mod-admin .mod-dot { background: var(--k-mod-admin); }

/* Nav-group : conteneur de nav-items, sans padding propre — l'alignement est piloté par .nav-item lui-même via --sidebar-pad-x */
.nav-group { padding: 0; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sidebar-pad-x);
  border-radius: var(--r-sm);
  color: var(--n-700);
  font-size: var(--fs-base); font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background var(--t-fast);
  position: relative;
}
.nav-item:hover { background: rgba(var(--k-primary-rgb), 0.04); }
.nav-item.is-active {
  background: var(--k-primary-soft);
  color: var(--k-brand-700);
  font-weight: var(--fw-semibold);
}
.nav-item.is-active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 var(--r-xs) var(--r-xs) 0; background: var(--k-primary);
}
.nav-item .nav-badge {
  margin-left: auto;
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  background: var(--n-100); color: var(--n-700);
  padding: 1px 7px; border-radius: var(--r-pill);
}
.nav-item.is-active .nav-badge { background: var(--k-primary); color: white; }
/* Nav-sub : conteneur de sub-items, sans padding propre. L'indentation est faite par .nav-item.sub directement */
.nav-sub { padding: 0; display: flex; flex-direction: column; gap: 1px; }
.nav-sub .nav-item, .nav-item.sub {
  padding-left: var(--sidebar-sub-indent);
  padding-right: var(--sidebar-pad-x);
  font-size: var(--fs-sm);
}

/* ---------- TOPBAR ---------- */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 var(--sp-5);
  gap: var(--sp-4);
}
.topbar .page-title { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: -0.005em; }
.topbar .page-sub { font-size: var(--fs-sm); color: var(--text-2); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); }
.topbar .timestamp { font-size: var(--fs-sm); color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- MODULE SWITCHER ---------- */
.mod-switcher {
  display: inline-flex;
  background: var(--n-75);
  border-radius: var(--r-md);
  padding: 3px;
}
.mod-switcher button {
  appearance: none; border: none; background: transparent;
  height: 30px; padding: 0 10px;
  border-radius: var(--r-sm);
  font: inherit; font-size: var(--fs-sm); font-weight: var(--fw-medium);
  color: var(--text-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.mod-switcher button .mod-dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.mod-switcher button.is-active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--sh-xs);
}

/* ---------- MODAL ---------- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: grid; place-items: center;
  z-index: var(--z-modal);
  padding: var(--sp-5);
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-modal);
  width: 100%; max-width: 480px;
  max-height: calc(100vh - 80px);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal.is-lg { max-width: 720px; }
.modal-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.modal-body { padding: var(--sp-5); overflow-y: auto; }
.modal-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-soft);
  background: var(--bg-subtle);
  display: flex; gap: var(--sp-2); justify-content: flex-end;
}

/* destructive confirm — explicit, two-step for tablet/glove safety */
.modal.is-destructive .modal-header { background: var(--danger-50); border-bottom-color: var(--danger-200); }
.modal.is-destructive .modal-title { color: var(--danger-700); }

/* ---------- STEPPER ---------- */
.stepper {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
}
.step {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
  color: var(--text-2);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.step .step-num {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--n-75); color: var(--text-2);
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  border: 1px solid var(--border);
}
.step.is-current { color: var(--text); }
.step.is-current .step-num { background: var(--k-primary); color: white; border-color: var(--k-primary); }
.step.is-done { color: var(--ok-700); }
.step.is-done .step-num { background: var(--ok-500); color: white; border-color: var(--ok-500); }
.step-line { flex: 1; height: 1px; background: var(--border); max-width: 40px; }

/* ---------- DROPZONE ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-8) var(--sp-5);
  background: var(--bg-subtle);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  color: var(--text-2);
  transition: border-color var(--t-fast), background var(--t-fast);
  cursor: pointer;
}
.dropzone:hover { border-color: var(--k-primary); background: var(--k-primary-soft); color: var(--k-brand-700); }
.dropzone .dz-title { font-weight: var(--fw-semibold); color: var(--text); font-size: var(--fs-md); }
.dropzone .dz-hint { font-size: var(--fs-xs); }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  bottom: var(--sp-5); right: var(--sp-5);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--k-primary); color: white;
  border: none;
  box-shadow: var(--sh-lg);
  cursor: pointer;
  display: grid; place-items: center;
  z-index: var(--z-fab);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.fab:hover { transform: translateY(-2px); box-shadow: var(--sh-modal); background: var(--k-primary-hover); }

/* ---------- EMPTY STATE ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  padding: var(--sp-12) var(--sp-5);
  text-align: center;
  color: var(--text-2);
}
.empty-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  background: var(--n-75);
  display: grid; place-items: center;
  color: var(--text-3);
}
.empty-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text); }
.empty-body  { font-size: var(--fs-base); max-width: 380px; }
.empty-actions { margin-top: var(--sp-2); display: flex; gap: var(--sp-2); }

/* ---------- SKELETON ---------- */
.skel {
  background: linear-gradient(90deg, var(--n-75), var(--n-100), var(--n-75));
  background-size: 200% 100%;
  animation: skel-pulse 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
  height: 12px;
}
@keyframes skel-pulse {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ---------- TOAST ---------- */
.toast {
  background: var(--n-900); color: white;
  padding: 10px 14px;
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  font-size: var(--fs-sm);
  display: inline-flex; align-items: center; gap: 8px;
}
.toast.is-ok { background: var(--ok-700); }
.toast.is-danger { background: var(--danger-700); }

/* ---------- MERGE-CARD (réconciliation facture↔colis) ---------- */
.merge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.mc-header {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: var(--fw-semibold);
}
.mc-body { display: grid; grid-template-columns: 1fr 1fr; }
.mc-col { padding: var(--sp-4); }
.mc-col + .mc-col { border-left: 1px solid var(--border-soft); }
.mc-col-title {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: var(--sp-3);
}
.mc-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: var(--fs-sm); }
.mc-row .k { color: var(--text-2); }
.mc-row .v { font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.mc-actions {
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-soft);
  display: flex; gap: var(--sp-2); justify-content: flex-end;
}

/* ---------- LAYOUT HELPERS ---------- */
.app { min-height: 100vh; display: flex; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); }
.row  { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.col  { display: flex; flex-direction: column; gap: var(--sp-3); }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border-soft); margin: var(--sp-3) 0; }

/* utility grid for metrics */
.metric-grid {
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

/* tabs */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  appearance: none; border: none; background: transparent;
  padding: 10px 16px;
  font: inherit; font-size: var(--fs-base); font-weight: var(--fw-medium);
  color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--k-primary); border-bottom-color: var(--k-primary);
  font-weight: var(--fw-semibold);
}

/* table-wrap */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.table-wrap.is-scroll { max-height: 540px; overflow-y: auto; }
