:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-elevated: #0f141b;
  --surface: #121821;
  --surface-strong: #171f2a;
  --surface-muted: #1b2430;
  --surface-hover: #202b38;
  --text: #eef3f8;
  --text-soft: #c4ced8;
  --muted: #8b98a8;
  --line: #263241;
  --line-strong: #344253;
  --green: #4da778;
  --green-soft: rgba(77, 167, 120, 0.16);
  --blue: #6aa7d8;
  --blue-soft: rgba(106, 167, 216, 0.14);
  --amber: #d8a24d;
  --amber-soft: rgba(216, 162, 77, 0.16);
  --red: #e07171;
  --red-soft: rgba(224, 113, 113, 0.14);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  --radius-control: 6px;
  --field-bg: #0d131a;
  --placeholder: #667384;
  --header-bg: rgba(15, 20, 27, 0.92);
  --sidebar-bg: #0d131a;
  --body-glow: rgba(77, 167, 120, 0.08);
  --toolbar-bg: rgba(18, 24, 33, 0.72);
  --subtle-fill: rgba(255, 255, 255, 0.02);
  --row-fill: rgba(255, 255, 255, 0.018);
  --row-hover: rgba(255, 255, 255, 0.025);
  --active-text: #dceeff;
  --badge-text: #b9dcff;
  --warning-text: #f1c982;
  --primary-text: #b9f0d1;
  --danger-text: #ffb8b8;
  --primary-fill: #4da778;
  --primary-fill-hover: #5cb887;
  --on-primary: #06120c;
}

:root:has(body.light-mode) {
  color-scheme: light;
}

body.light-mode {
  color-scheme: light;
  --bg: #eef2f6;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-strong: #f9fbfd;
  --surface-muted: #f1f5f9;
  --surface-hover: #e8eef5;
  --text: #111827;
  --text-soft: #243244;
  --muted: #5f6f82;
  --line: #d5dde8;
  --line-strong: #b9c5d4;
  --green: #27764e;
  --green-soft: rgba(39, 118, 78, 0.1);
  --blue: #236a9a;
  --blue-soft: rgba(35, 106, 154, 0.1);
  --amber: #96610f;
  --amber-soft: rgba(150, 97, 15, 0.11);
  --red: #b93636;
  --red-soft: rgba(185, 54, 54, 0.09);
  --shadow: 0 12px 30px rgba(20, 32, 48, 0.08);
  --field-bg: #ffffff;
  --placeholder: #8a95a3;
  --header-bg: rgba(255, 255, 255, 0.94);
  --sidebar-bg: #ffffff;
  --body-glow: rgba(35, 106, 154, 0.08);
  --toolbar-bg: rgba(255, 255, 255, 0.78);
  --subtle-fill: rgba(36, 50, 68, 0.035);
  --row-fill: #ffffff;
  --row-hover: rgba(35, 106, 154, 0.055);
  --active-text: #164f78;
  --badge-text: #175b86;
  --warning-text: #83540d;
  --primary-text: #1e6543;
  --danger-text: #9d2c2c;
  --primary-fill: #27764e;
  --primary-fill-hover: #1f6541;
  --on-primary: #ffffff;
}

* {
  box-sizing: border-box;
}

.sr-only {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.skip-link {
  background: var(--surface);
  border: 2px solid var(--blue);
  border-radius: 0 0 var(--radius-control) var(--radius-control);
  color: var(--text);
  font-weight: 500;
  left: 16px;
  padding: 10px 14px;
  position: fixed;
  top: 0;
  transform: translateY(-120%);
  transition: transform 0.16s ease;
  z-index: 200;
}

.skip-link:focus {
  transform: translateY(0);
}

html {
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at top left, var(--body-glow), transparent 30vw),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.persistence-status {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.32rem 0.62rem;
}

.persistence-status[data-state="saved"] {
  background: rgba(36, 143, 89, 0.14);
  color: var(--green);
}

.persistence-status[data-state="saving"] {
  background: rgba(196, 139, 36, 0.14);
  color: var(--amber);
}

.persistence-status[data-state="unsaved"] {
  background: rgba(190, 52, 52, 0.14);
  color: var(--red);
}

.auth-checking #loginScreen,
.auth-checking #appHeader,
.auth-checking #appLayout {
  display: none !important;
}

.auth-loading-screen {
  align-items: center;
  background: var(--bg);
  display: none;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px;
}

.auth-checking .auth-loading-screen {
  display: flex;
}

.auth-loading-card {
  align-items: center;
  color: var(--text-soft);
  display: grid;
  font-size: 13px;
  font-weight: 500;
  gap: 12px;
  justify-items: center;
}

.auth-loading-card img {
  height: 52px;
  object-fit: contain;
}

.toast-stack {
  display: grid;
  gap: 10px;
  max-width: min(420px, calc(100vw - 24px));
  pointer-events: none;
  position: fixed;
  right: 16px;
  top: 92px;
  width: 100%;
  z-index: 80;
}

.toast {
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  pointer-events: auto;
}

.toast strong {
  font-size: 13px;
}

.toast p {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  white-space: pre-line;
}

.toast.success {
  border-left-color: var(--green);
}

.toast.warning {
  border-left-color: var(--amber);
}

.toast.error {
  border-left-color: var(--red);
}

.modal-root {
  align-items: center;
  background: rgba(0, 0, 0, 0.52);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 90;
}

.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-height: min(680px, calc(100vh - 36px));
  max-width: min(520px, 100%);
  overflow: auto;
  padding: 18px;
  width: 100%;
}

.modal-card h3 {
  color: var(--text);
  font-size: 18px;
  margin: 0;
}

.modal-card p {
  color: var(--text-soft);
  line-height: 1.45;
  margin: 0;
  white-space: pre-line;
}

.modal-card label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

button,
select,
input {
  font: inherit;
}

button {
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent);
  outline-offset: 2px;
}

input,
select {
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--text);
  min-height: 34px;
  outline: none;
  padding: 7px 9px;
  width: 100%;
}

input::placeholder {
  color: var(--placeholder);
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(106, 167, 216, 0.12);
}

.login-screen {
  align-items: center;
  background: var(--bg);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  max-width: 380px;
  padding: 28px;
  width: 100%;
}

.login-card img {
  height: 58px;
  justify-self: start;
  object-fit: contain;
}

.login-card h1 {
  font-size: 22px;
  margin: 0;
}

.login-status {
  background: rgba(190, 44, 44, 0.12);
  border: 1px solid rgba(220, 70, 70, 0.45);
  border-radius: var(--radius-control);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  padding: 10px 12px;
}

.login-card label,
.form-grid label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
}

.remember-login {
  align-items: center;
  color: var(--text-soft);
  display: inline-flex;
  font-size: 13px;
  font-weight: 500;
  gap: 8px;
  justify-content: start;
  line-height: 1.25;
}

.remember-login input {
  accent-color: var(--green);
  flex: 0 0 auto;
  height: 18px;
  margin: 0;
  min-height: auto;
  width: 18px;
}

.app-header {
  align-items: center;
  backdrop-filter: blur(18px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 74px;
  padding: 14px 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-brand {
  align-items: center;
  display: flex;
  min-width: 0;
}

.app-brand-logo {
  display: block;
  height: 60px;
  max-width: 100%;
  object-fit: cover;
  object-position: center 48%;
  width: min(290px, 30vw);
}

.app-brand-text {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.app-header h1,
.toolbar h2 {
  color: var(--text);
  font-size: 21px;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 2px 0 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin: 0;
  text-transform: uppercase;
}

.role-switcher {
  align-items: center;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.role-switcher label {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  gap: 8px;
}

.role-switcher select {
  width: auto;
}

.header-notification {
  align-items: center;
  background: var(--amber-soft);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  border-radius: 999px;
  color: var(--warning-text);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 5px;
  justify-content: center;
  min-height: 28px;
  min-width: 42px;
  padding: 4px 9px;
}

.header-notification:hover {
  background: color-mix(in srgb, var(--amber) 24%, transparent);
  border-color: color-mix(in srgb, var(--amber) 48%, transparent);
  color: var(--text);
}

.notification-icon {
  align-items: center;
  background: var(--amber);
  border-radius: 50%;
  color: var(--bg);
  display: inline-flex;
  font-size: 10px;
  height: 16px;
  justify-content: center;
  line-height: 1;
  width: 16px;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 74px);
  transition: grid-template-columns 0.16s ease;
}

.sidebar-collapsed .layout {
  grid-template-columns: 70px minmax(0, 1fr);
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 10px;
  position: sticky;
  top: 74px;
  height: calc(100vh - 74px);
  overflow: hidden;
}

.sidebar-controls {
  display: grid;
  flex: 0 0 auto;
}

.mobile-navigation-toggle {
  display: none !important;
}

.sidebar-groups {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.sidebar button {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  color: var(--text-soft);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

/* Une icone par module, en masque CSS comme le bouton loupe : elle prend
   la couleur du texte et suit donc l'etat actif et le theme. */
.sidebar button[data-view]::before {
  background: currentColor;
  content: "";
  flex: 0 0 auto;
  height: 18px;
  margin-right: 10px;
  -webkit-mask: var(--nav-icon) center / contain no-repeat;
  mask: var(--nav-icon) center / contain no-repeat;
  width: 18px;
}

.sidebar button[data-view="globalDashboard"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 11.5a5.5 5.5 0 1 1 11 0'/%3E%3Cpath d='M8 11.5 10.7 7.9'/%3E%3C/svg%3E");
}

.sidebar button[data-view="dashboard"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.2' y='2.2' width='5' height='5' rx='1'/%3E%3Crect x='8.8' y='2.2' width='5' height='5' rx='1'/%3E%3Crect x='2.2' y='8.8' width='5' height='5' rx='1'/%3E%3Crect x='8.8' y='8.8' width='5' height='5' rx='1'/%3E%3C/svg%3E");
}

.sidebar button[data-view="planego"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2.2v7'/%3E%3Cpath d='M5.2 6.5 8 9.3l2.8-2.8'/%3E%3Cpath d='M2.6 11.6v2.2h10.8v-2.2'/%3E%3C/svg%3E");
}

.sidebar button[data-view="receipts"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 1.8 14 5v6L8 14.2 2 11V5z'/%3E%3Cpath d='m5.4 7.7 1.9 1.9 3.5-3.7'/%3E%3C/svg%3E");
}

.sidebar button[data-view="stock"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='1.9' y='2.4' width='5.2' height='5.2' rx='.9'/%3E%3Crect x='8.9' y='2.4' width='5.2' height='5.2' rx='.9'/%3E%3Crect x='1.9' y='8.9' width='5.2' height='5.2' rx='.9'/%3E%3Cpath d='M9.4 11.5h4.2'/%3E%3Cpath d='M11.5 9.4v4.2'/%3E%3C/svg%3E");
}

.sidebar button[data-view="orders"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.4 2.9h1.8l1.5 7.2h6.4'/%3E%3Cpath d='M5 5.3h8.5l-1 4.1'/%3E%3Ccircle cx='6.6' cy='12.6' r='1'/%3E%3Ccircle cx='11.6' cy='12.6' r='1'/%3E%3C/svg%3E");
}

.sidebar button[data-view="portalOrders"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 2.2h10v11.6H3z'/%3E%3Cpath d='M5.4 5.2h5.2M5.4 8h5.2'/%3E%3Cpath d='m5.4 10.8 1.2 1.2 2.2-2.4'/%3E%3C/svg%3E");
}

.portal-review-toolbar,
.portal-review-head,
.portal-review-actions {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.portal-review-toolbar { margin-bottom: 14px; }
.portal-review-toolbar p, .portal-review-head p { margin: 4px 0 0; }
.portal-review-list { display: grid; gap: 16px; }
.portal-review-card { display: grid; gap: 18px; }
.portal-review-head h3 { margin: 8px 0 0; }
.portal-review-head > strong { color: var(--active-text); font-size: 20px; }
.portal-review-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.portal-review-wide { grid-column: 1 / -1; }
.portal-review-lines { border: 1px solid var(--line); border-radius: var(--radius-control); overflow: hidden; }
.portal-review-line { align-items: center; display: grid; gap: 10px; grid-template-columns: minmax(220px, 1fr) 130px 140px 120px auto; padding: 10px 12px; }
.portal-review-line + .portal-review-line { border-top: 1px solid var(--line); }
.portal-review-line-head { background: var(--surface-muted); color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.portal-review-line label { margin: 0; }
.portal-review-line small { color: var(--muted); display: block; margin-top: 3px; }
.portal-review-actions { justify-content: flex-end; }
.portal-review-empty { text-align: center; }

@media (max-width: 900px) {
  .portal-review-details { grid-template-columns: 1fr; }
  .portal-review-line, .portal-review-line-head { grid-template-columns: 1fr 1fr; }
  .portal-review-line-head { display: none; }
  .portal-review-line > span:first-child { grid-column: 1 / -1; }
  .portal-review-actions { align-items: stretch; flex-direction: column-reverse; }
}

.sidebar button[data-view="deliveries"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.8 9.6V5.2h7.5v4.4'/%3E%3Cpath d='M9.3 6.6h2.8l2.1 2.2v.8H9.3'/%3E%3Ccircle cx='4.6' cy='11' r='1.3'/%3E%3Ccircle cx='11.6' cy='11' r='1.3'/%3E%3C/svg%3E");
}

.sidebar button[data-view="transport"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.5 10.8V3.5h8v7.3'/%3E%3Cpath d='M9.5 6h2.6l2.4 2.6v2.2h-1'/%3E%3Cpath d='M1.5 10.8H3m2.8 0h4.5'/%3E%3Ccircle cx='4.4' cy='11.3' r='1.4'/%3E%3Ccircle cx='11.9' cy='11.3' r='1.4'/%3E%3C/svg%3E");
}

.sidebar button[data-view="invoices"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.2 2.2h9.6v11.6l-1.9-1.2-1.9 1.2-1.9-1.2-1.9 1.2-1.9-1.2z'/%3E%3Cpath d='M5.7 5.6h4.6'/%3E%3Cpath d='M5.7 8.4h3.2'/%3E%3C/svg%3E");
}

.sidebar button[data-view="customerCredits"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.2 2.2h9.6v11.6l-1.9-1.2-1.9 1.2-1.9-1.2-1.9 1.2-1.9-1.2z'/%3E%3Cpath d='M5.8 7.5h4.4'/%3E%3C/svg%3E");
}

.sidebar button[data-view="caCasiers"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.2' y='4.2' width='11.6' height='8.6' rx='1.1'/%3E%3Cpath d='M2.2 7.6h11.6'/%3E%3Cpath d='M8 4.2v8.6'/%3E%3C/svg%3E");
}

.sidebar button[data-view="margins"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.2 12.4 6 8l2.6 2.4L13.8 4'/%3E%3Cpath d='M10.6 4h3.2v3.2'/%3E%3C/svg%3E");
}

.sidebar button[data-view="traceability"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6.9' cy='6.9' r='4.4'/%3E%3Cpath d='M10.2 10.2 13.9 13.9'/%3E%3Cpath d='M5.3 6.9h3.2'/%3E%3C/svg%3E");
}

.sidebar button[data-view="transfers"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.4 5.4h9.3'/%3E%3Cpath d='M9.4 3 11.8 5.4 9.4 7.8'/%3E%3Cpath d='M13.6 10.6H4.3'/%3E%3Cpath d='M6.6 8.2 4.2 10.6 6.6 13'/%3E%3C/svg%3E");
}

.sidebar button[data-view="transformations"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.4 2.6h9.2l-3.4 4v4.3l-2.4 2.5V6.6z'/%3E%3C/svg%3E");
}

.sidebar button[data-view="supplierDisputes"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2.4 14.2 13.2H1.8z'/%3E%3Cpath d='M8 6.4v3.1'/%3E%3Cpath d='M8 11.4v.1'/%3E%3C/svg%3E");
}

.sidebar button[data-view="supplierInvoices"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.2 2.2h9.6v11.6l-1.9-1.2-1.9 1.2-1.9-1.2-1.9 1.2-1.9-1.2z'/%3E%3Cpath d='M8 4.8v4.4'/%3E%3Cpath d='M6.2 7.4 8 9.2l1.8-1.8'/%3E%3C/svg%3E");
}

.sidebar button[data-view="planegoInvoiceControls"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.2 2.2h9.6v11.6l-1.9-1.2-1.9 1.2-1.9-1.2-1.9 1.2-1.9-1.2z'/%3E%3Cpath d='m5.8 7.6 1.6 1.6 3-3.2'/%3E%3C/svg%3E");
}

.sidebar button[data-view="items"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 1.8 14 5v6L8 14.2 2 11V5z'/%3E%3Cpath d='M2 5l6 3 6-3'/%3E%3Cpath d='M8 8v6.2'/%3E%3C/svg%3E");
}

.sidebar button[data-view="suppliers"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.4 13.6V4.2h5.2v9.4'/%3E%3Cpath d='M7.6 7h6v6.6'/%3E%3Cpath d='M4.3 6.4h1.3'/%3E%3Cpath d='M4.3 9h1.3'/%3E%3Cpath d='M9.6 9.4h1.8'/%3E%3C/svg%3E");
}

.sidebar button[data-view="clients"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6.2' cy='5.6' r='2.6'/%3E%3Cpath d='M1.8 13.4a4.6 4.6 0 0 1 8.8 0'/%3E%3Cpath d='M10.6 3.4a2.4 2.4 0 0 1 0 4.4'/%3E%3Cpath d='M12 13.4a4 4 0 0 0-1.4-3'/%3E%3C/svg%3E");
}

.sidebar button[data-view="company"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.6 13.6V3.4h7.2v10.2'/%3E%3Cpath d='M9.8 7.2h3.6v6.4'/%3E%3Cpath d='M5 5.8h2.4'/%3E%3Cpath d='M5 8.6h2.4'/%3E%3Cpath d='M5 11.4h2.4'/%3E%3C/svg%3E");
}

.sidebar button[data-view="sites"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 14s4.6-3.8 4.6-7.4A4.6 4.6 0 0 0 3.4 6.6C3.4 10.2 8 14 8 14Z'/%3E%3Ccircle cx='8' cy='6.5' r='1.7'/%3E%3C/svg%3E");
}

.sidebar button[data-view="users"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='5.4' r='2.6'/%3E%3Cpath d='M3 13.4a5 5 0 0 1 10 0'/%3E%3C/svg%3E");
}

.sidebar button[data-view="history"] {
  --nav-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='5.8'/%3E%3Cpath d='M8 4.6V8l2.3 1.5'/%3E%3C/svg%3E");
}
.sidebar-toggle {
  background: var(--surface-muted) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
  font-weight: 600;
  justify-content: center;
  margin-bottom: 8px;
}

.sidebar-collapsed .sidebar button:not(.sidebar-toggle) {
  font-size: 0;
  justify-content: center;
  padding: 8px 4px;
}

.sidebar-collapsed .sidebar button[data-view]::before {
  margin-right: 0;
}

.sidebar-collapsed .sidebar-toggle {
  font-size: 12px;
  padding-inline: 4px;
}

.sidebar button:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.sidebar button.active {
  background: var(--blue-soft);
  border-color: color-mix(in srgb, var(--blue) 26%, transparent);
  color: var(--active-text);
  font-weight: 600;
}

.sidebar button.has-notification::after {
  background: var(--amber);
  border: 2px solid var(--sidebar-bg);
  border-radius: 50%;
  content: "";
  height: 9px;
  margin-left: auto;
  width: 9px;
}

.content {
  min-width: 0;
  padding: 18px;
}

.toolbar {
  align-items: center;
  background: var(--toolbar-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 14px;
}

.view {
  display: none;
  min-width: 0;
}

.active-view {
  display: block;
}

@media (min-width: 901px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-header {
    height: 74px;
    position: relative;
  }

  .layout {
    height: calc(100vh - 74px);
    height: calc(100dvh - 74px);
    min-height: 0;
    overflow: hidden;
  }

  .sidebar {
    height: 100%;
    min-height: 0;
    position: static;
  }

  .content {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .view {
    min-height: 0;
    overflow: hidden;
  }

  .active-view {
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    padding-right: 4px;
    scrollbar-color: color-mix(in srgb, var(--blue) 42%, var(--line)) transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
  }

  .active-view::-webkit-scrollbar {
    height: 10px;
    width: 10px;
  }

  .active-view::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--blue) 42%, var(--line));
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: padding-box;
  }

  .active-view::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--blue) 62%, var(--line));
    background-clip: padding-box;
  }

  .active-view .table-shell {
    max-height: clamp(220px, calc(100dvh - 330px), 680px);
    overscroll-behavior: contain;
    scrollbar-color: color-mix(in srgb, var(--blue) 48%, var(--line)) var(--surface-muted);
    scrollbar-gutter: stable;
  }

  .active-view .table-shell::-webkit-scrollbar {
    height: 12px;
    width: 12px;
  }

  .active-view .table-shell::-webkit-scrollbar-track {
    background: var(--surface-muted);
    border-radius: 999px;
  }

  .active-view .table-shell::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--blue) 48%, var(--line));
    border: 2px solid var(--surface-muted);
    border-radius: 999px;
  }

  .active-view .table-shell::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--blue) 68%, var(--line));
  }

  .active-view .data-table th,
  .active-view .data-table td {
    padding: 5px 8px;
  }

  .active-view .data-table th {
    font-size: 11px;
  }

  .active-view .data-table td {
    color: var(--text);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
  }

  .active-view .data-table tbody tr:nth-child(even) td {
    background: var(--surface-muted);
  }

  .active-view .data-table tbody tr:hover td {
    background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  }

  .active-view .data-table .col-primary {
    color: var(--text);
    font-weight: 500;
  }

  .active-view .data-table .col-code {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
  }

  .active-view .data-table .col-number {
    color: var(--text);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
  }

  #stock .data-table tbody tr:nth-child(even) td {
    background: color-mix(in srgb, var(--blue) 7%, var(--surface));
  }

  #stock .data-table tbody tr:hover td {
    background: color-mix(in srgb, var(--blue) 15%, var(--surface));
  }

  #stock .stock-total-value {
    color: var(--primary-text);
    font-size: 14px;
    font-weight: 600;
  }
}

.metric-grid,
.panel-grid {
  display: grid;
  gap: 12px;
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin-bottom: 12px;
}

.panel-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
}

.metric,
.panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 118px;
  padding: 18px;
}

.metric span {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 8px;
  font-weight: 500;
  text-transform: uppercase;
}

.trend-legend .cost {
  background: var(--blue-soft);
  border-color: color-mix(in srgb, var(--blue) 24%, transparent);
  color: var(--badge-text);
}

.trend-legend .margin {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 24%, transparent);
  color: var(--warning-text);
}

.trend-legend .revenue {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 24%, transparent);
  color: var(--primary-text);
}

.metric strong {
  color: var(--text);
  display: block;
  font-size: 32px;
  line-height: 1.15;
  margin-top: 11px;
}

.metric-trend {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-top: 9px;
}

.metric-trend.up {
  color: var(--primary-text);
}

.metric-trend.down {
  color: var(--danger-text);
}

.metric-trend.flat {
  color: var(--muted);
}

.panel {
  padding: 14px;
}

.dashboard-trend-panel {
  margin-bottom: 12px;
  padding: 16px;
}

.dashboard-trend-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.trend-legend span {
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 8px;
}

.trend-chart {
  display: block;
  height: 190px;
  margin-top: 8px;
  width: 100%;
}

.trend-grid line {
  stroke: var(--line);
  stroke-dasharray: 4 5;
}

.trend-grid .trend-baseline {
  stroke: var(--line-strong);
  stroke-dasharray: none;
}

.trend-axis text {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 500;
  text-anchor: end;
}

.trend-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.trend-line.revenue {
  stroke: var(--green);
}

.trend-line.cost {
  stroke: var(--blue);
}

.trend-line.margin {
  stroke: var(--amber);
}

.trend-hotspot {
  cursor: help;
  fill: color-mix(in srgb, var(--text) 8%, transparent);
  stroke: color-mix(in srgb, var(--text) 22%, transparent);
  stroke-width: 1;
}

.trend-hotspot:hover {
  fill: color-mix(in srgb, var(--green) 24%, transparent);
  stroke: var(--green);
}

.trend-labels text {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-anchor: middle;
}

.panel h3,
.form-panel h3 {
  color: var(--text);
  font-size: 15px;
  margin: 0 0 10px;
}

.muted-text {
  color: var(--muted);
  margin: 0 0 10px;
}

.traceability-timeline,
.traceability-details {
  margin-top: 14px;
}

.traceability-timeline-header {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
}

.traceability-timeline-header > div {
  flex: 1 1 320px;
}

.traceability-timeline-header > label {
  flex: 0 1 210px;
}

.traceability-overview {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 8px 0 22px;
}

.traceability-overview > div {
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.traceability-overview dt,
.traceability-day h4 > span,
.traceability-time-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.traceability-overview dd {
  font-size: 22px;
  font-weight: 600;
  margin: 5px 0 0;
}

.traceability-day + .traceability-day {
  margin-top: 22px;
}

.traceability-day h4 {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  font-size: 14px;
  gap: 10px;
  margin: 0 0 12px;
}

.traceability-events {
  border-left: 2px solid var(--line-strong);
  list-style: none;
  margin: 0 0 0 7px;
  padding: 0 0 0 20px;
}

.traceability-event {
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  padding: 12px 14px;
  position: relative;
}

.traceability-event::before {
  background: var(--blue);
  border: 3px solid var(--surface);
  border-radius: 50%;
  content: "";
  height: 12px;
  left: -28px;
  position: absolute;
  top: 17px;
  width: 12px;
}

.traceability-event + .traceability-event {
  margin-top: 10px;
}

.traceability-event-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.traceability-event-type {
  background: var(--blue-soft);
  border-radius: 4px;
  color: var(--badge-text);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
}

.traceability-event-heading strong,
.traceability-event p {
  overflow-wrap: anywhere;
}

.traceability-event-heading time,
.traceability-time-note {
  margin-left: auto;
}

.traceability-event p {
  color: var(--text-soft);
  line-height: 1.6;
  margin: 10px 0 0;
  white-space: pre-line;
}

.traceability-detail-panels {
  min-width: 0;
  padding: 12px;
}

.traceability-detail-panels > .panel + .panel {
  margin-top: 12px;
}

@media (max-width: 640px) {
  .traceability-overview > div {
    padding: 10px 8px;
  }

  .traceability-timeline-header > label {
    flex-basis: 100%;
  }

  .traceability-event-heading time,
  .traceability-time-note {
    margin-left: 0;
  }
}

.empty-dashboard-state {
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--text-soft);
  font-weight: 500;
  margin: 0;
  padding: 10px 12px;
}

.stock-detail-panel {
  margin-top: 12px;
}

body.modal-open {
  overflow: hidden;
}

.stock-total-value {
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

.stock-detail-modal {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: min(760px, calc(100vh - 36px));
  max-width: min(980px, 100%);
  overflow: hidden;
}

.selection-modal {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.stock-detail-modal-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.stock-detail-modal-header .eyebrow {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.modal-close-button {
  align-items: center;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 38px;
  font-size: 24px;
  height: 38px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 38px;
}

.stock-detail-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(180px, 1.4fr) minmax(180px, 1fr) minmax(130px, 0.7fr) minmax(90px, 0.5fr);
  margin: 0;
}

.stock-detail-summary div {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  min-width: 0;
  padding: 10px 12px;
}

.stock-detail-summary dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.stock-detail-summary dd {
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.stock-detail-modal-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.stock-detail-modal-body .table-shell {
  margin: 0;
}

.stock-detail-modal-body .data-table {
  min-width: 700px;
}

.stock-detail-empty {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 18px;
}

.modal-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  margin: 0;
}

.modal-details div {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.5fr);
  padding: 9px 11px;
}

.modal-details div + div {
  border-top: 1px solid var(--line);
}

.modal-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.modal-details dd {
  color: var(--text);
  margin: 0;
  overflow-wrap: anywhere;
}

.planego-tabs-panel {
  margin-bottom: 12px;
}

.planego-control-tabs button {
  min-width: 170px;
}

.planego-missing-price,
.stock-equivalent-warning {
  color: var(--danger-text);
  font-weight: 500;
}

.planego-support-editor {
  min-width: 240px;
  display: grid;
  gap: 4px;
}

.planego-support-code {
  width: 76px;
  min-width: 76px;
}

.planego-chep-support {
  background: var(--blue-soft);
  border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent);
  border-radius: 6px;
  color: var(--badge-text);
  display: inline-block;
  font-weight: 600;
  padding: 4px 6px;
}

.form-panel {
  margin-bottom: 12px;
  padding: 14px;
}

.dashboard-filter-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  padding: 12px;
}

.edit-panel {
  border-color: rgba(77, 167, 120, 0.55);
  box-shadow: 0 0 0 1px rgba(77, 167, 120, 0.08), var(--shadow);
}

.form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  min-width: 0;
}

.client-form-sections,
.supplier-form-sections,
.article-form-sections {
  display: grid;
  gap: 12px;
}

.client-form-section,
.supplier-form-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0;
  min-width: 0;
  padding: 12px;
}

.client-form-section legend,
.supplier-form-section legend {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 0 6px;
}

.form-section-disclosure {
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
  padding: 0;
}

.form-section-disclosure > summary {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-size: 13px;
  font-weight: 600;
  justify-content: space-between;
  list-style: none;
  min-height: 44px;
  padding: 10px 12px;
}

.form-section-disclosure > summary::-webkit-details-marker {
  display: none;
}

.form-section-disclosure > summary::after {
  color: var(--blue);
  content: "+";
  font-size: 20px;
  line-height: 1;
}

.form-section-disclosure[open] > summary {
  border-bottom: 1px solid var(--line);
}

.form-section-disclosure[open] > summary::after {
  content: "−";
}

.form-section-disclosure > .form-grid,
.form-section-disclosure > p {
  margin: 12px;
}

.client-form > .form-actions,
.supplier-form > .form-actions {
  margin-top: 12px;
}

.siret-lookup-field {
  align-content: start;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.siret-lookup-field label {
  min-width: 0;
}

.compact-action {
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

.dashboard-filter-main {
  align-items: center;
  display: grid;
  gap: 9px;
  grid-template-columns: auto minmax(180px, 1.2fr) minmax(170px, 1fr) minmax(120px, 0.7fr) auto;
  min-width: 0;
}

.global-dashboard-filter-main {
  grid-template-columns: auto minmax(170px, 1fr) minmax(120px, 0.7fr) auto;
}

.dashboard-filter-main label,
.dashboard-custom-dates label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 500;
  gap: 5px;
  min-width: 0;
}

.dashboard-filter-main button {
  align-self: end;
  min-height: 34px;
}

.site-pill {
  align-self: end;
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  min-height: 34px;
  padding: 8px 12px;
  white-space: nowrap;
}

.dashboard-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.dashboard-quick-actions button {
  min-height: 30px;
  padding: 6px 9px;
}

.dashboard-custom-dates {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  margin-top: 9px;
}

.filter-check-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-right: 2px;
}

.filter-check-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.filter-check-grid.weeks {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.search-field {
  display: block;
  position: relative;
}

.search-field input {
  padding-right: 46px;
  width: 100%;
}

.search-icon-button {
  align-items: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 14%, var(--surface)), color-mix(in srgb, var(--blue) 7%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--blue) 38%, var(--line));
  border-radius: var(--radius-control);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.14), inset 0 1px rgba(255, 255, 255, 0.08);
  color: var(--blue);
  cursor: pointer;
  display: inline-flex;
  font-size: 0;
  height: calc(100% - 6px);
  justify-content: center;
  min-height: 30px;
  position: absolute;
  right: 3px;
  top: 3px;
  width: 36px;
}

.search-icon-button:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 23%, var(--surface)), color-mix(in srgb, var(--blue) 13%, var(--surface)));
  border-color: color-mix(in srgb, var(--blue) 62%, var(--line));
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18), inset 0 1px rgba(255, 255, 255, 0.12);
}

.search-icon-button::before {
  background: currentColor;
  content: "";
  height: 17px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
  width: 17px;
}

.search-icon-button:active {
  background: color-mix(in srgb, var(--blue) 18%, var(--surface));
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  transform: translateY(1px);
}

.search-icon-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 30%, transparent);
  outline-offset: 2px;
}

.stock-filter-feedback {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  margin: 8px 0 0;
}

.unit-checks {
  align-items: center;
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 9px;
}

.unit-checks strong {
  color: var(--text-soft);
  font-size: 12px;
}

.article-deposits {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.article-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.article-tabs [aria-selected="true"] {
  background: var(--primary-fill);
  color: var(--on-primary);
}

.article-tabs > button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.article-tabs > button[aria-selected="false"] {
  background: var(--surface);
  color: var(--text);
}

.article-deposit-editor {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.article-deposits > p {
  margin: 0;
}

.article-deposit-row {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  min-height: 44px;
  padding-top: 10px;
}

.article-deposit-type {
  min-width: 0;
  max-width: 380px;
}

.article-deposit-type[hidden] {
  display: none;
}

.unit-checks label,
.inline-check {
  align-items: center;
  color: var(--text-soft);
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
  line-height: 1.25;
}

.unit-checks input,
.inline-check input {
  accent-color: var(--green);
  flex: 0 0 auto;
  height: 16px;
  margin: 0;
  min-height: auto;
  width: 16px;
}

.bulk-check {
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  min-height: 34px;
  padding: 7px 10px;
}

.form-actions {
  align-items: end;
  display: flex;
}

#receiptForm .form-actions {
  grid-column: -2 / -1;
}

.list {
  display: grid;
  gap: 8px;
}

.list-row {
  align-items: center;
  background: var(--row-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 9px 10px;
}

.badge {
  background: var(--blue-soft);
  border: 1px solid color-mix(in srgb, var(--blue) 22%, transparent);
  border-radius: 999px;
  color: var(--badge-text);
  display: inline-flex;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  padding: 4px 7px;
}

.badge.warning {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 24%, transparent);
  color: var(--warning-text);
}

[hidden] {
  display: none !important;
}

.badge.success {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 24%, transparent);
  color: var(--primary-text);
}

.email-status-cell {
  display: grid;
  gap: 4px;
  min-width: 130px;
  white-space: normal;
}

.data-table {
  background: var(--surface);
  border: 1px solid var(--line);
  border-collapse: separate;
  border-radius: var(--radius);
  border-spacing: 0;
  box-shadow: var(--shadow);
  min-width: min(760px, 100%);
  width: 100%;
}

.table-shell {
  border-radius: var(--radius);
  margin-bottom: 12px;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
  white-space: nowrap;
}

.data-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 1;
}

.data-table td {
  color: var(--text-soft);
  font-size: 13px;
}

.data-table .col-number {
  text-align: right;
}

.data-table .col-actions {
  min-width: 140px;
}

.order-lines-summary {
  display: grid;
  gap: 6px;
  min-width: 360px;
}

.compact-document-lines {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 220px;
}

.compact-document-lines .order-lines-summary {
  flex: 1 1 100%;
  margin-top: 2px;
}

.single-article-label {
  color: var(--text-soft);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.order-line-summary {
  align-items: center;
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(190px, 1fr) minmax(132px, auto) minmax(116px, auto) minmax(72px, auto);
  padding: 7px 8px;
}

.table-tools {
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-bottom: 10px;
  padding: 10px;
}

.table-tools > label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
}

.table-pagination {
  align-items: center;
  display: flex;
  gap: 8px;
}

.table-pagination [data-table-page-status] {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  min-width: 135px;
  text-align: center;
}

.table-tools [data-table-filter-empty] {
  grid-column: 1 / -1;
}

.order-line-article {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.order-line-article strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
  white-space: normal;
}

.order-line-article span {
  color: var(--muted);
  font-size: 11px;
}

.order-line-detail,
.order-line-quantity,
.order-line-prices {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: normal;
}

.order-line-prices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.order-line-prices span {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  padding: 3px 7px;
}

.order-line-quantity {
  text-align: right;
}

.data-table tr:hover td {
  background: var(--row-hover);
  color: var(--text);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table tr[hidden] {
  display: none !important;
}

.data-table input,
.data-table select {
  min-height: 30px;
}

.action-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* Dans une grille de formulaire, ces boutons partagent la ligne des champs :
   ils s'alignent sur le bas des saisies, pas sur le milieu de la cellule. */
.form-actions.action-row {
  align-items: end;
}

.primary-action,
.secondary-action,
.danger {
  border-radius: var(--radius-control);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  min-height: 34px;
  padding: 7px 11px;
}

.primary-action {
  background: var(--primary-fill);
  border: 1px solid var(--primary-fill);
  color: var(--on-primary);
  font-weight: 600;
}

.primary-action:hover {
  background: var(--primary-fill-hover);
  border-color: var(--primary-fill-hover);
}

.danger {
  background: var(--red-soft);
  border: 1px solid color-mix(in srgb, var(--red) 28%, transparent);
  color: var(--danger-text);
}

.secondary-action {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--text-soft);
}

.secondary-action:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

.danger:hover {
  background: color-mix(in srgb, var(--red) 16%, transparent);
  border-color: color-mix(in srgb, var(--red) 46%, transparent);
}

.primary-action:disabled,
.secondary-action:disabled,
.danger:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

/* Gabarit reduit pour un bouton pose dans une cellule de tableau. */
.compact-detail-button {
  min-height: 28px;
  padding: 5px 9px;
}

/* Une action de ligne se repete a chaque enregistrement : elle repasse en
   contour pour qu'il ne reste qu'un seul bouton plein par ecran. */
.data-table .primary-action,
#addOrderLineButton {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text-soft);
  font-weight: 500;
}

.data-table .primary-action:hover,
#addOrderLineButton:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--text);
}

/* Effacer, vider et se deconnecter gardent la teinte rouge. Les boutons
   d'annulation, qui ne detruisent rien, passent en neutre. */
#cancelArticleEdit,
#cancelClientEdit,
#cancelSupplierEdit,
#cancelUserEdit,
#cancelDeliveryPreparation {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-soft);
}

#cancelArticleEdit:hover,
#cancelClientEdit:hover,
#cancelSupplierEdit:hover,
#cancelUserEdit:hover,
#cancelDeliveryPreparation:hover {
  background: var(--surface-hover);
  border-color: var(--line);
  color: var(--text);
}

body.light-mode .danger {
  border-color: rgba(191, 66, 66, 0.24);
  color: #a83232;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .dashboard-filter-main {
    grid-template-columns: auto repeat(3, minmax(150px, 1fr)) auto;
  }
}

@media (max-width: 900px) {
  .app-header,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar-collapsed .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    display: block;
    height: auto !important;
    min-height: 64px;
    max-height: none;
    overflow: visible;
    padding: 10px 12px;
    position: static;
  }

  .sidebar-controls {
    display: block;
  }

  .mobile-navigation-toggle {
    display: flex !important;
    justify-content: space-between;
    min-height: 44px;
    width: 100% !important;
  }

  .mobile-navigation-toggle::after {
    content: "+";
    font-size: 20px;
    line-height: 1;
  }

  .mobile-navigation-open .mobile-navigation-toggle::after {
    content: "−";
  }

  .sidebar-groups {
    display: none;
    gap: 3px;
    margin-top: 10px;
    max-height: min(62vh, 560px);
    overflow: auto;
    padding: 2px 2px 10px;
  }

  .mobile-navigation-open .sidebar-groups {
    display: grid;
  }

  .sidebar button[data-view] {
    font-size: inherit;
    height: auto;
    max-height: none;
    min-height: 44px;
    padding: 8px 12px;
    text-align: left;
    white-space: normal;
    width: 100%;
  }

  .sidebar-toggle {
    display: none !important;
  }

  .sidebar-collapsed .sidebar button:not(.sidebar-toggle) {
    font-size: inherit;
    padding: 8px 12px;
  }

  .content {
    padding: 12px;
  }

  .form-grid,
  .dashboard-filter-main,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .filter-check-grid,
  .filter-check-grid.compact,
  .filter-check-grid.weeks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-pill,
  .dashboard-filter-main button {
    justify-self: stretch;
    text-align: center;
  }

  .role-switcher {
    justify-content: flex-start;
    width: 100%;
  }

  .role-switcher label {
    flex: 1 1 190px;
  }

  .role-switcher select {
    min-width: 120px;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .toast-stack {
    left: 12px;
    max-width: calc(100vw - 24px);
    right: 12px;
    top: 12px;
  }

  .modal-root {
    align-items: end;
    padding: 10px;
  }

  .modal-card {
    max-height: calc(100vh - 20px);
    padding: 16px;
  }

  body {
    background: var(--bg);
  }

  .login-screen {
    padding: 14px;
  }

  .login-card {
    border-radius: var(--radius);
    padding: 20px;
  }

  .app-header {
    padding: 12px;
  }

  .app-brand-logo {
    height: 44px;
    width: min(210px, 48vw);
  }

  .app-header h1,
  .toolbar h2 {
    font-size: 18px;
  }

  .toolbar,
  .form-panel,
  .panel,
  .metric {
    padding: 12px;
  }

  input,
  select,
  .primary-action,
  .secondary-action,
  .danger {
    min-height: 42px;
  }

  input,
  select {
    font-size: 16px;
  }

  .form-actions,
  .action-row,
  .import-actions {
    align-items: stretch;
    width: 100%;
  }

  .form-actions > button,
  .action-row > button,
  .import-actions > button {
    flex: 1 1 140px;
  }

  .import-actions > .bulk-check {
    flex: 1 1 180px;
    min-height: 42px;
  }

  .list-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .table-shell {
    overflow: visible;
  }

  .data-table {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 10px;
    overflow: hidden;
  }

  .data-table td {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    min-height: 38px;
    padding: 9px 10px;
    text-align: left;
    white-space: normal;
  }

  .data-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    text-transform: uppercase;
  }

  .data-table td.col-actions {
    display: block;
    min-width: 0;
  }

  .data-table td.col-actions::before {
    display: block;
    margin-bottom: 7px;
  }

  .data-table .col-number {
    text-align: left;
  }

  .order-lines-summary {
    min-width: 0;
  }

  .compact-document-lines {
    min-width: 0;
  }

  .order-line-summary {
    gap: 6px;
    grid-template-columns: 1fr;
  }

  .order-line-quantity {
    text-align: left;
  }

  .table-tools {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .table-pagination {
    display: grid;
    grid-template-columns: 1fr;
  }

  .table-pagination [data-table-page-status] {
    grid-row: 1;
    min-width: 0;
  }

  .stock-detail-modal {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: calc(100vh - 20px);
    max-width: 100%;
  }

  .stock-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-detail-modal-body .table-shell {
    overflow: auto;
  }

  .stock-detail-modal-body .data-table {
    background: var(--surface);
    border: 1px solid var(--line);
    border-collapse: separate;
    display: table;
    min-width: 700px;
  }

  .stock-detail-modal-body .data-table thead {
    display: table-header-group;
  }

  .stock-detail-modal-body .data-table tbody {
    display: table-row-group;
  }

  .stock-detail-modal-body .data-table tr {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: table-row;
    margin: 0;
  }

  .stock-detail-modal-body .data-table th,
  .stock-detail-modal-body .data-table td {
    display: table-cell;
    min-height: 0;
    padding: 8px 10px;
    text-align: left;
    white-space: nowrap;
    width: auto;
  }

  .stock-detail-modal-body .data-table td::before {
    display: none;
  }

  .modal-details div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .data-table tr:last-child td {
    border-bottom: 1px solid var(--line);
  }

  .data-table tr td:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 460px) {
  .content {
    padding: 10px;
  }

  .sidebar {
    padding-inline: 10px;
  }

  .role-switcher > label {
    flex: 1 1 100%;
  }

  .role-switcher > button:not(.header-notification) {
    flex: 1 1 calc(50% - 6px);
  }

  .role-switcher > span {
    flex: 0 1 auto;
  }

  .data-table td {
    grid-template-columns: 1fr;
  }

  .data-table td::before {
    margin-bottom: -2px;
  }

}

.transformation-output-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 1rem 0 0.65rem;
}

.transformation-output-header h4 {
  margin: 0;
}

.transformation-availability-note {
  color: var(--warning-text);
  font-weight: 500;
  margin: 0.65rem 0;
}

.transformation-output {
  border: 1px solid var(--line);
  margin: 0 0 0.8rem;
  min-width: 0;
  padding: 1rem;
}

.transformation-output legend {
  font-weight: 500;
  padding: 0 0.4rem;
}

.transformation-output-remove {
  margin-top: 0.75rem;
}

.compact-list {
  margin: 0;
  min-width: 18rem;
  padding-left: 1.1rem;
}

/* Une restriction de role est la meme sur toutes les lignes : elle reste lue
   par les lecteurs d'ecran et disponible au survol, sans occuper une ligne. */
.action-disabled-reason {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
.document-legal-summary {
  display: grid;
  gap: 0.2rem;
  min-width: 12rem;
  font-size: 0.82rem;
}

.document-legal-summary span {
  color: var(--muted-text, #52647a);
}

.invoice-adjustment-source-summary {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--border, #d7e1ee);
  border-radius: 6px;
  background: var(--surface-soft, #f7faff);
}

.document-actions,
.invoice-fiscal-heading,
.invoice-fiscal-footer,
.electronic-invoice-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-fiscal-heading,
.invoice-fiscal-footer,
.electronic-invoice-heading {
  justify-content: space-between;
}

.invoice-fiscal-heading h3,
.invoice-fiscal-heading .muted-text {
  margin-bottom: 4px;
}

.invoice-adjustment-grid {
  grid-template-columns: minmax(220px, 1.4fr) minmax(190px, 0.8fr) minmax(220px, 1.3fr) auto;
}

.invoice-fiscal-terms {
  margin-bottom: 12px;
}

.invoice-fiscal-lines input {
  min-width: 92px;
  width: 100%;
}

.invoice-financial-summary {
  display: grid;
  font-size: 12px;
  gap: 3px;
  min-width: 150px;
}

.invoice-financial-summary strong {
  color: var(--text);
}

.invoice-financial-summary span {
  color: var(--muted);
}

.button-link {
  align-items: center;
  background: var(--subtle-fill);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  color: var(--text);
  display: inline-flex;
  font-weight: 500;
  min-height: 36px;
  padding: 7px 10px;
  text-decoration: none;
}

.electronic-compliance-summary {
  display: grid;
  gap: 6px;
  min-width: 170px;
}

.electronic-compliance-summary details {
  font-size: 12px;
  max-width: 320px;
}

.electronic-compliance-summary ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.electronic-status-draft {
  background: var(--subtle-fill);
}

.electronic-status-correction {
  background: var(--red-soft);
  color: var(--danger-text);
}

.electronic-status-ready {
  background: var(--blue-soft);
  color: var(--badge-text);
}

.electronic-status-local {
  background: var(--amber-soft);
  color: var(--warning-text);
}

.electronic-status-exported {
  background: var(--green-soft);
  color: var(--primary-text);
}

@media (max-width: 900px) {
  .invoice-adjustment-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .invoice-adjustment-grid {
    grid-template-columns: 1fr;
  }

  .invoice-fiscal-footer .primary-action,
  .invoice-fiscal-heading > button {
    width: 100%;
  }
}
.invoice-adjustment-lines-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 10px;
}

.invoice-adjustment-lines-heading p {
  margin: 4px 0 0;
}

.invoice-adjustment-lines-table input[type="number"] {
  min-width: 110px;
  width: 100%;
}

.invoice-adjustment-lines-table td:nth-child(2) small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

@media (max-width: 760px) {
  .invoice-adjustment-lines-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
/* Transport preparation keeps the two pallet formats side by side on desktop. */
.transport-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.transport-fieldset > legend { font-weight: 700; margin-bottom: 1rem; }
.transport-formats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; margin-block: 1rem; }
.transport-formats fieldset { min-width: 0; border: 1px solid var(--border, #d7dfdb); border-radius: 8px; padding: 1rem; }
.transport-formats legend { font-weight: 600; }
.transport-formats summary { min-height: 24px; padding: .5rem 0; cursor: pointer; }
#transport textarea { width: 100%; box-sizing: border-box; font: inherit; padding: .6rem; border: 1px solid var(--border, #d7dfdb); border-radius: 6px; background: var(--surface, white); color: inherit; }
.transport-tabs, .global-dashboard-tabs { display: grid; gap: .75rem; margin-bottom: 1rem; }
.transport-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.global-dashboard-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.transport-tab, .global-dashboard-tab { min-height: 72px; padding: .8rem 1rem; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.transport-tab strong, .transport-tab span, .global-dashboard-tab strong, .global-dashboard-tab span { display: block; }
.transport-tab strong, .global-dashboard-tab strong { margin-bottom: .2rem; font-size: 1rem; }
.transport-tab span, .global-dashboard-tab span { color: var(--muted); font-size: .78rem; font-weight: 500; line-height: 1.3; }
.transport-tab { min-height: 52px; text-align: center; }
.transport-tab strong { margin-bottom: 0; }
.transport-tab.is-active, .global-dashboard-tab.is-active { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); box-shadow: inset 0 0 0 1px var(--primary); }
.transport-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: .35rem 0 1rem; }
.transport-section-heading h3 { margin: .15rem 0 .35rem; font-size: 1.35rem; }
.transport-section-heading p { margin: 0; color: var(--muted); }
.transport-management-grid { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); align-items: start; gap: 1rem; }
.transport-editor, .transport-directory { min-width: 0; }
.transport-editor > fieldset > legend { color: var(--text); font-size: 1.05rem; font-weight: 700; padding-inline: .35rem; }
#transportPickupLocationForm .form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.transport-email-editor { display: grid; gap: .65rem; margin-top: 1rem; }
.transport-field-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.transport-email-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .6rem; }
.transport-email-row label { margin: 0; }
.transport-email-summary { margin: 0; padding-left: 1.15rem; }
.transport-email-summary li + li { margin-top: .2rem; }
.transport-model-note { display: grid; gap: .2rem; margin-top: 1rem; padding: .85rem; border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px); background: color-mix(in srgb, var(--surface) 88%, var(--primary) 12%); }
.transport-model-note span { font-weight: 600; }
.transport-model-note small { color: var(--muted); }
.transport-history-actions { align-items: center; flex-wrap: nowrap; }
.transport-request-detail, .transport-detail-section, .transport-detail-shipments, .transport-detail-shipment { display: grid; gap: .85rem; }
.transport-detail-section h4, .transport-detail-shipment h5 { margin: 0; }
.transport-detail-shipment { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.transport-detail-observations { white-space: pre-wrap; }
@media (max-width: 1300px) {
  .transport-management-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .transport-tabs, .global-dashboard-tabs { grid-template-columns: 1fr; gap: .5rem; }
  .transport-tab, .global-dashboard-tab { min-height: 58px; }
  .transport-tab { min-height: 48px; }
  .transport-section-heading { flex-direction: column; }
  .transport-email-row { grid-template-columns: 1fr; }
  .transport-field-heading { align-items: flex-start; flex-direction: column; }
  .transport-history-actions { align-items: stretch; flex-direction: column; }
}

/* Garder les indicateurs, le graphique et les sites visibles sur un portable. */
@media (min-width: 901px) {
  .content:has(#globalDashboard.active-view) {
    padding: 8px 12px;
  }

  .content:has(#globalDashboard.active-view) > .toolbar {
    margin-bottom: 8px;
    padding: 8px 12px;
  }

  .content:has(#globalDashboard.active-view) > .toolbar > div {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  #globalDashboard.active-view {
    display: flex;
    flex-direction: column;
  }

  #globalDashboard .global-dashboard-tabs {
    flex: 0 0 auto;
    gap: 8px;
    margin-bottom: 8px;
  }

  #globalDashboard .global-dashboard-tab {
    min-height: 34px;
    padding: 6px 10px;
  }

  #globalDashboard .global-dashboard-tab strong {
    font-size: 13px;
    margin: 0;
  }

  #globalDashboard .global-dashboard-tab span {
    display: none;
  }

  #globalDashboardOverview:not([hidden]) {
    display: grid;
    flex: 1 0 auto;
    gap: 6px;
    grid-template-rows: auto auto minmax(140px, 1fr) auto;
    min-height: 0;
  }

  #globalDashboard:has(#globalDashboardOverview:not([hidden])) {
    overflow: auto;
  }

  #globalDashboardOverview .dashboard-filter-panel {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 0;
    padding: 6px 8px;
  }

  #globalDashboardOverview .global-dashboard-filter-main {
    flex: 1 1 500px;
    gap: 6px;
    grid-template-columns: auto minmax(180px, 1fr) minmax(100px, 0.5fr) auto;
  }

  #globalDashboardOverview .dashboard-filter-main label {
    align-items: center;
    display: flex;
    gap: 6px;
  }

  #globalDashboardOverview .dashboard-filter-main :is(select, button),
  #globalDashboardOverview .site-pill {
    min-height: 30px;
    padding: 5px 8px;
  }

  #globalDashboardOverview .dashboard-quick-actions {
    gap: 4px;
    margin: 0;
  }

  #globalDashboardOverview .dashboard-quick-actions button {
    font-size: 11px;
    min-height: 28px;
    padding: 4px 7px;
  }

  #globalDashboardOverview .dashboard-custom-dates {
    flex: 1 0 100%;
    margin: 0;
  }

  #globalMetrics {
    gap: 8px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0;
  }

  #globalMetrics .metric {
    min-height: 0;
    padding: 4px 10px;
  }

  #globalMetrics .metric span {
    font-size: 11px;
  }

  #globalMetrics .metric strong {
    font-size: clamp(18px, 1.65vw, 24px);
    margin-top: 3px;
  }

  #globalMetrics .metric-trend {
    font-size: 11px;
    margin-top: 3px;
  }

  #globalDashboardTrend {
    min-height: 140px;
  }

  #globalDashboardOverview .panel {
    padding: 6px 8px;
  }

  #globalDashboardOverview .panel h3 {
    font-size: 13px;
    margin-bottom: 6px;
  }

  #globalDashboardTrend .dashboard-trend-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
  }

  #globalDashboardTrend .dashboard-trend-header {
    align-items: center;
    flex: 0 0 auto;
  }

  #globalDashboardTrend .dashboard-trend-header > div:first-child {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  #globalDashboardTrend .dashboard-trend-header :is(h3, p) {
    margin: 0;
  }

  #globalDashboardTrend .muted-text {
    font-size: 12px;
  }

  #globalDashboardTrend .trend-chart {
    flex: 1 1 0;
    height: 0;
    margin-top: 4px;
    min-height: 96px;
  }

  #globalDashboardOverview > .panel-grid {
    gap: 8px;
    grid-template-columns: minmax(0, 1.7fr) minmax(180px, 0.7fr);
  }

  #globalSitesTable .table-shell {
    margin: 0;
  }

  #globalSitesTable .data-table :is(th, td) {
    font-size: 11px;
    line-height: 1.2;
    padding: 2px 6px;
  }

  #globalSitesTable .badge {
    line-height: 1;
    padding: 2px 5px;
  }
}

@media (min-width: 901px) and (max-height: 700px) {
  body:has(#globalDashboard.active-view) .app-header {
    height: 60px;
    min-height: 60px;
    padding-block: 6px;
  }

  body:has(#globalDashboard.active-view) .app-brand-logo {
    height: 44px;
    object-fit: contain;
  }

  body:has(#globalDashboard.active-view) .layout {
    height: calc(100dvh - 60px);
  }

  .content:has(#globalDashboard.active-view) .toolbar h2 {
    font-size: 18px;
  }

  #globalDashboard .global-dashboard-tab {
    min-height: 32px;
  }

  #globalDashboardOverview:not([hidden]) {
    gap: 5px;
  }

  #globalMetrics .metric strong {
    font-size: clamp(18px, 1.6vw, 22px);
  }
}

/* Article deposits: catalog, editor and family selectors. */
.deposit-icon { width: 19px; height: 19px; flex: 0 0 auto; }
.article-tabs {
  display: inline-flex;
  padding: 5px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.article-tabs > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-color: transparent;
  min-height: 40px;
  padding: 9px 15px;
}
.article-tabs > button[aria-selected="false"] { background: transparent; color: var(--text-soft); }
.article-tabs > button[aria-selected="false"]:hover { background: var(--surface-hover); }
.article-tabs > button:focus-visible,
.deposit-usage summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.deposit-workspace { display: grid; gap: 22px; }
.deposit-heading { display: flex; align-items: center; gap: 14px; padding: 8px 2px 0; }
.deposit-heading-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--green) 25%, var(--line));
  border-radius: 14px;
  color: var(--primary-text);
  background: var(--green-soft);
}
.deposit-heading-icon .deposit-icon { width: 27px; height: 27px; }
.deposit-heading .deposit-eyebrow { color: var(--primary-text); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 5px; }
.deposit-heading h3 { margin: 0; color: var(--text); font-size: 22px; font-weight: 650; letter-spacing: -.025em; }
.deposit-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.deposit-summary { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; }
.deposit-summary > span { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; color: var(--text-soft); font-size: 12px; white-space: nowrap; }
.deposit-summary strong { font-weight: 700; color: var(--text); margin-right: 3px; }
.deposit-management-grid { display: grid; grid-template-columns: minmax(250px, 280px) minmax(0, 1fr); gap: 20px; align-items: start; }
.deposit-management-grid > * { min-width: 0; }
.deposit-editor-panel.form-panel { padding: 20px; border-radius: 12px; margin: 0; box-shadow: none; }
.deposit-editor-heading { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.deposit-editor-heading h4 { margin: 0; color: var(--text); font-size: 14px; font-weight: 650; }
.deposit-editor-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.deposit-step { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-strong); color: var(--primary-text); font-size: 22px; }
.deposit-editor-panel .article-deposit-editor { border: 0; padding: 0; }
.deposit-editor-panel legend { padding: 0; margin-bottom: 14px; color: var(--text); font-size: 13px; font-weight: 600; }
.deposit-editor-panel .deposit-editor-fields { grid-template-columns: 1fr; gap: 16px; }
.deposit-editor-panel label { color: var(--text-soft); font-size: 12px; }
.deposit-editor-panel input,
.deposit-editor-panel select { margin-top: 3px; min-height: 42px; border-radius: 8px; }
.deposit-editor-panel .form-actions { margin-top: 20px; display: grid; grid-template-columns: 1fr; gap: 8px; }
.deposit-editor-panel .form-actions button { min-height: 40px; }
.deposit-editor-panel .form-actions [type="reset"] { border-color: transparent; }
.deposit-editor-note { display: flex; align-items: start; gap: 9px; margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.deposit-editor-note .deposit-icon { width: 16px; height: 16px; margin-top: 2px; }
.deposit-directory { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.deposit-directory-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 18px 0; }
.deposit-directory-heading h4 { margin: 0; color: var(--text); font-size: 14px; font-weight: 650; }
.deposit-directory-heading > span { font-size: 11px; color: var(--muted); }
.deposit-directory .table-tools { grid-template-columns: 1fr; background: transparent; border: 0; padding: 16px 18px; margin: 0; gap: 12px; }
.deposit-directory .table-tools input { min-height: 40px; border-radius: 8px; }
.deposit-directory .table-pagination { display: flex; justify-content: space-between; gap: 6px; }
.deposit-directory .table-pagination button { min-height: 30px; padding: 4px 8px; font-size: 11px; }
.deposit-directory .table-pagination [data-table-page-status] { min-width: 0; font-size: 11px; }
.deposit-directory .table-shell { margin: 0; border-radius: 0; }
#articleDepositTypesTable { min-width: 590px; border: 0; border-radius: 0; box-shadow: none; }
#articleDepositTypesTable th { background: var(--surface-strong); border-top: 1px solid var(--line); padding: 11px 14px; font-size: 10px; }
#articleDepositTypesTable td { padding: 14px; }
#articleDepositTypesTable .action-row { flex-wrap: nowrap; gap: 6px; }
#articleDepositTypesTable .action-row button { font-size: 11px; min-height: 32px; padding: 6px 9px; }
.deposit-type-name { color: var(--text); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
[data-deposit-family] { --deposit-accent: var(--blue); --deposit-fill: var(--blue-soft); --deposit-ink: var(--badge-text); }
[data-deposit-family="ifco"] { --deposit-accent: var(--green); --deposit-fill: var(--green-soft); --deposit-ink: var(--primary-text); }
[data-deposit-family="pool"] { --deposit-accent: var(--amber); --deposit-fill: var(--amber-soft); --deposit-ink: var(--warning-text); }
.deposit-family-badge { display: inline-flex; align-items: center; gap: 7px; border: 1px solid color-mix(in srgb, var(--deposit-accent) 22%, transparent); border-radius: 999px; background: var(--deposit-fill); color: var(--deposit-ink); padding: 5px 9px; font-size: 11px; font-weight: 650; }
.deposit-family-dot { width: 6px; height: 6px; background: var(--deposit-accent); border-radius: 50%; }
.deposit-unused { color: var(--muted); font-size: 12px; }
.deposit-usage summary { width: fit-content; cursor: pointer; color: var(--badge-text); font-size: 12px; padding: 5px 0; }
.deposit-usage ul { list-style: none; padding: 0; margin: 7px 0 0; display: grid; gap: 8px; white-space: normal; min-width: 150px; }
.deposit-usage li { display: grid; gap: 3px; color: var(--text-soft); font-size: 12px; line-height: 1.4; }
.deposit-usage li > span { color: var(--muted); font-size: 10px; }
.article-deposits { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px; gap: 12px; }
.article-deposits > p { grid-column: 1 / -1; color: var(--muted); font-size: 12px; line-height: 1.5; margin-bottom: 2px; }
.article-deposit-row { grid-template-columns: 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-height: 64px; transition: border-color .15s, background .15s; }
.article-deposit-row:has(input:checked) { border-color: color-mix(in srgb, var(--deposit-accent) 60%, var(--line)); background: color-mix(in srgb, var(--deposit-fill) 35%, var(--surface)); }
.article-deposit-row > .inline-check { gap: 10px; font-size: 13px; font-weight: 650; color: var(--text); min-height: 32px; cursor: pointer; }
.deposit-family-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--deposit-fill); color: var(--deposit-ink); }
.article-deposit-type { max-width: none; }
.article-deposit-type label { font-size: 12px; }
.article-deposit-type input { min-height: 40px; }

@media (max-width: 1200px) {
  .deposit-management-grid { grid-template-columns: 1fr; }
  .deposit-editor-panel .deposit-editor-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deposit-editor-panel .form-actions { display: flex; }
  .deposit-editor-panel .form-actions button { flex: 0 1 auto; }
}
@media (max-width: 640px) {
  .article-tabs { display: flex; width: 100%; flex-wrap: nowrap; }
  .article-tabs > button { padding: 9px 10px; flex: 1 1 auto; font-size: 12px; gap: 6px; }
  .deposit-heading { flex-wrap: wrap; gap: 12px; }
  .deposit-heading-icon { width: 42px; height: 42px; border-radius: 12px; }
  .deposit-heading > div:nth-child(2) { flex: 1; }
  .deposit-heading h3 { font-size: 19px; }
  .deposit-heading p { font-size: 12px; }
  .deposit-summary { margin: 0; width: 100%; justify-content: start; }
  .deposit-workspace { gap: 18px; }
  .deposit-editor-panel.form-panel { padding: 16px; }
  .deposit-editor-panel .deposit-editor-fields { grid-template-columns: 1fr; gap: 14px; }
  .deposit-editor-panel .form-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .deposit-editor-panel .form-actions button { min-height: 44px; }
  .deposit-directory-heading { padding: 16px 14px 0; }
  .deposit-directory .table-tools { padding: 14px; }
  .deposit-directory .table-pagination button { min-height: 36px; }
  .deposit-directory .table-shell { padding: 0 12px 2px; }
  #articleDepositTypesTable { min-width: 0; background: transparent; }
  #articleDepositTypesTable tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); box-shadow: none; margin-bottom: 10px; }
  #articleDepositTypesTable td { width: auto; display: flex; flex-direction: column; gap: 7px; padding: 12px; min-width: 0; white-space: normal; }
  #articleDepositTypesTable td:nth-child(3),
  #articleDepositTypesTable td:nth-child(4),
  #articleDepositTypesTable [data-table-empty-row] td { grid-column: 1 / -1; }
  #articleDepositTypesTable td:nth-child(3) { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
  #articleDepositTypesTable td.col-actions::before { display: none; }
  #articleDepositTypesTable .action-row { width: 100%; }
  #articleDepositTypesTable .action-row button { flex: 1 1 0; font-size: 12px; min-height: 40px; }
  .article-deposits { grid-template-columns: 1fr; padding: 12px; }
}
