:root {
  --navy: #0d2f68;
  --navy2: #071d42;
  --blue: #4fb555;
  --sky: #ecf8ee;
  --green: #4fb555;
  --orange: #e69124;
  --red: #d64545;
  --ink: #1d2633;
  --muted: #6b7687;
  --line: #dfe5ec;
  --bg: #f4f6f9;
  --white: #fff;
  --shadow: 0 10px 30px rgba(13, 47, 104, 0.08);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  font-size: 15px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
}
a {
  color: var(--blue);
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
.app-shell {
  min-height: 100vh;
}
.sidebar {
  width: 255px;
  background: linear-gradient(180deg, var(--navy2), var(--navy));
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-size: 20px;
  padding: 0 10px 22px;
}
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: linear-gradient(135deg, #2a7ce5, #65b0ff);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 30px;
  box-shadow: 0 12px 30px rgba(42, 124, 229, 0.35);
}
.brand-mark.small {
  width: 35px;
  height: 35px;
  border-radius: 10px;
  font-size: 19px;
}
.sidebar nav {
  display: grid;
  gap: 3px;
}
.nav-item {
  display: flex;
  gap: 11px;
  align-items: center;
  color: #bdc9d9;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 14px;
}
.nav-item span {
  font-size: 18px;
  width: 23px;
  text-align: center;
}
.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.nav-item.active {
  box-shadow: inset 3px 0 #64a9ff;
}
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 15px 10px 0;
}
.user-chip {
  display: flex;
  flex-direction: column;
}
.user-chip small {
  color: #aebbd0;
  text-transform: capitalize;
}
.link-button {
  border: 0;
  background: transparent;
  color: #aebbd0;
  padding: 8px 0;
  cursor: pointer;
}
.main {
  margin-left: 255px;
  min-height: 100vh;
}
.topbar {
  height: 72px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.menu-toggle {
  display: none;
}
.global-search {
  position: relative;
  flex: 1;
  max-width: 640px;
}
.global-search input {
  width: 100%;
  border: 1px solid var(--line);
  background: #f7f9fb;
  border-radius: 10px;
  padding: 11px 14px;
}
.global-search #searchResults {
  display: none;
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 360px;
  overflow: auto;
}
.global-search #searchResults.open {
  display: block;
}
.search-result {
  display: block;
  padding: 10px 13px;
  border-bottom: 1px solid #edf0f4;
  color: var(--ink);
}
.search-result small {
  display: block;
  color: var(--muted);
}
.content {
  padding: 28px;
  max-width: 1620px;
  margin: auto;
}
.page-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}
.page-title h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.4px;
}
.page-title p {
  color: var(--muted);
  margin: 5px 0 0;
}
.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #ccd5df;
  border-radius: 9px;
  padding: 9px 13px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}
.btn:hover {
  border-color: #aab8c8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn.outlook {
  background: #eef5ff;
  color: #0757b3;
  border-color: #c7daf3;
}
.btn.full,
.full {
  width: 100%;
}
.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 14px;
}
.card h2,
.card-head h2 {
  margin: 0 0 14px;
  font-size: 18px;
}
.card-head h2 {
  margin: 0;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 260px));
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 19px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.kpi span {
  color: var(--muted);
  font-size: 13px;
}
.kpi strong {
  font-size: 25px;
  margin: 7px 0;
}
.kpi small {
  color: #8b95a3;
}
.kpi.warn {
  border-left: 4px solid var(--orange);
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(280px, 0.8fr);
  gap: 20px;
}
.stats-card {
  text-align: center;
}
.donut {
  --value: 0;
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 20px auto;
  background: conic-gradient(var(--blue) calc(var(--value) * 1%), #e8edf3 0);
  position: relative;
  display: grid;
  place-items: center;
}
.donut:before {
  content: "";
  position: absolute;
  width: 118px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
}
.donut span {
  position: relative;
  display: flex;
  flex-direction: column;
}
.donut b {
  font-size: 30px;
}
.donut small {
  color: var(--muted);
}
.legend {
  display: grid;
  gap: 7px;
  text-align: left;
}
.legend div {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}
.legend b {
  margin-left: auto;
  color: var(--ink);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #adb6c2;
}
.warning-block {
  display: flex;
  flex-direction: column;
  text-align: left;
  background: #fff6e9;
  border: 1px solid #f5d9af;
  padding: 12px;
  border-radius: 9px;
  margin-top: 16px;
  color: #8b5310;
}
.table-wrap {
  overflow: auto;
}
.table-wrap.card {
  padding: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th {
  text-align: left;
  color: #667181;
  background: #f7f9fb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.035em;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 11px 13px;
  border-bottom: 1px solid #edf0f4;
  vertical-align: middle;
}
tbody tr:hover {
  background: #fafcff;
}
.num {
  text-align: right;
  white-space: nowrap;
}
.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #edf1f5;
  color: #5d6876;
}
.field-inline { display: flex; gap: 8px; align-items: center; }
.field-inline input { min-width: 0; flex: 1; }
.product-image-import { margin-top: 10px; cursor: pointer; }
.margin-preview {
  border: 1px solid #dbe5ee;
  border-radius: 12px;
  background: #f7fafc;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}
.margin-preview span, .margin-preview small { color: #667483; }
.margin-preview strong { color: #0d2f68; font-size: 18px; }
.weight-result { margin-top: 14px; }
@media (max-width: 640px) {
  .field-inline { align-items: stretch; flex-direction: column; }
  .field-inline .btn { width: 100%; }
}
.status-sent,
.status-prepared,
.status-confirmed {
  background: #e8f1ff;
  color: #2264b6;
}
.status-accepted,
.status-paid,
.status-delivered,
.status-received {
  background: #e5f7ef;
  color: #18825a;
}
.status-refused,
.status-cancelled,
.status-expired {
  background: #feecec;
  color: #bd3838;
}
.status-part_paid,
.status-reserved,
.status-part_received {
  background: #fff4dd;
  color: #9a650d;
}
.status-draft {
  background: #edf1f5;
  color: #5d6876;
}
.filterbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.filterbar input {
  flex: 1;
}
.filterbar input,
.filterbar select,
input,
select,
textarea {
  border: 1px solid #ccd5df;
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(25, 103, 210, 0.15);
  border-color: var(--blue);
}
select:not([multiple]) { appearance:none; padding-right:34px; background-image:linear-gradient(45deg,transparent 50%,var(--navy) 50%),linear-gradient(135deg,var(--navy) 50%,transparent 50%); background-position:calc(100% - 16px) 50%,calc(100% - 11px) 50%; background-size:5px 5px,5px 5px; background-repeat:no-repeat; cursor:pointer; }
textarea {
  min-height: 82px;
  resize: vertical;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #596576;
}
.form-grid .span-2 {
  grid-column: span 2;
}
.checkbox {
  flex-direction: row !important;
  align-items: center !important;
}
.checkbox input {
  width: auto;
}
.document-head {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.document-head .span-2 {
  grid-column: span 2;
}
.line-table input {
  width: 100%;
  min-width: 75px;
}
.line-table th:nth-child(2),
.line-table td:nth-child(2) {
  min-width: 290px;
}
.line-table td {
  padding: 7px;
}
.icon-btn {
  border: 0;
  background: #f1f3f6;
  border-radius: 7px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 20px;
}
.document-totals {
  margin-left: auto;
  width: min(400px, 100%);
  padding: 15px;
  display: grid;
  gap: 8px;
}
.document-totals div {
  display: flex;
  justify-content: space-between;
}
.document-totals .grand {
  font-size: 20px;
  border-top: 2px solid var(--ink);
  padding-top: 10px;
}
.action-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.65fr) minmax(0, 1.35fr);
  gap: 20px;
}
.button-stack {
  display: grid;
  gap: 9px;
}
.timeline {
  border-left: 2px solid #dce4ed;
  padding-left: 16px;
  margin-top: 18px;
}
.timeline > div {
  margin-bottom: 17px;
}
.timeline p {
  margin: 5px 0;
  color: #515d6d;
}
.inline-form {
  display: flex;
  gap: 5px;
}
.inline-form input {
  max-width: 110px;
  padding: 6px;
}
.danger-text {
  color: var(--red) !important;
  font-weight: 700;
}
.notice {
  background: #eef5ff;
  border: 1px solid #cfe0f5;
  color: #315271;
  border-radius: 10px;
  padding: 13px 15px;
  margin-bottom: 20px;
}
.alert {
  padding: 12px 14px;
  border-radius: 9px;
  margin-bottom: 16px;
  background: #e8f1ff;
  color: #24588f;
}
.alert.success {
  background: #e5f7ef;
  color: #176e4f;
}
.alert.error {
  background: #feecec;
  color: #a32e2e;
}
.campaign-preview {
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 8px;
  margin: 14px 0;
  white-space: pre-wrap;
}
.bar-chart {
  height: 240px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 20px 10px 0;
}
.bar-chart > div {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.bar-chart span {
  width: 100%;
  max-width: 56px;
  background: linear-gradient(180deg, #4b91ed, #1b63c3);
  border-radius: 6px 6px 2px 2px;
  min-height: 3px;
}
.bar-chart small {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.install {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 25px;
  background: radial-gradient(circle at top left, #eaf3ff, var(--bg) 45%);
}
.install-card {
  width: min(680px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px;
  box-shadow: 0 20px 70px rgba(20, 42, 70, 0.14);
}
.install-card > .brand-mark {
  margin: auto;
}
.install-card h1 {
  text-align: center;
  margin-bottom: 5px;
}
.install-card > p {
  text-align: center;
  color: var(--muted);
}
.login-card {
  max-width: 430px;
}
.login-card form {
  display: grid;
  gap: 15px;
}
.login-card label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #596576;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.print-page {
  background: #d7dde5;
  color: #111;
}
.print-actions {
  position: fixed;
  right: 20px;
  top: 20px;
}
.print-actions button {
  background: #1967d2;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
}
.paper {
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  margin: 20px auto;
  padding: 18mm;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.18);
  position: relative;
}
.paper-head {
  display: flex;
  justify-content: space-between;
  border-bottom: 3px solid #18375d;
  padding-bottom: 15px;
}
.paper-head h1 {
  color: #18375d;
  margin: 0;
}
.paper-head p {
  line-height: 1.6;
  font-size: 12px;
}
.paper-title {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.paper-title h2 {
  font-size: 27px;
  margin: 0;
  color: #18375d;
}
.address-box {
  width: 48%;
  margin: 24px 0 20px auto;
  border: 1px solid #ccd5df;
  padding: 15px;
  min-height: 110px;
}
.address-box small {
  color: #6e7784;
}
.address-box h3 {
  margin: 8px 0;
}
.print-table {
  font-size: 12px;
}
.print-table th {
  background: #18375d;
  color: #fff;
}
.print-totals {
  width: 310px;
  margin: 18px 0 18px auto;
}
.print-totals p {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 7px 10px;
  border-bottom: 1px solid #d7dde5;
}
.print-totals .grand {
  background: #18375d;
  color: #fff;
  font-size: 16px;
}
.paper-notes {
  border-top: 1px solid #ccd5df;
  padding-top: 12px;
}
.signature {
  display: flex;
  justify-content: space-between;
  margin-top: 70px;
}
.paper footer {
  position: absolute;
  bottom: 12mm;
  left: 18mm;
  right: 18mm;
  text-align: center;
  color: #7b8490;
  font-size: 10px;
  border-top: 1px solid #d7dde5;
  padding-top: 7px;
}
@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }
  .document-head {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 780px) {
  .sidebar {
    transform: translateX(-100%);
    transition: 0.2s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .menu-toggle {
    display: block;
    border: 0;
    background: transparent;
    font-size: 22px;
  }
  .topbar {
    padding: 0 15px;
  }
  .topbar > .btn {
    display: none;
  }
  .content {
    padding: 18px 12px;
  }
  .page-title {
    flex-direction: column;
  }
  .kpi-grid,
  .kpi-grid.compact,
  .form-grid,
  .document-head {
    grid-template-columns: 1fr;
  }
  .form-grid .span-2,
  .document-head .span-2 {
    grid-column: span 1;
  }
  .filterbar {
    flex-wrap: wrap;
  }
  .filterbar input {
    min-width: 100%;
  }
  .paper {
    width: 100%;
    margin: 0;
    padding: 12mm;
  }
  .print-actions {
    display: none;
  }
}
@media print {
  .print-actions {
    display: none;
  }
  .print-page {
    background: #fff;
  }
  .paper {
    margin: 0;
    box-shadow: none;
    width: 100%;
    min-height: auto;
    padding: 12mm;
  }
  @page {
    size: A4;
    margin: 0;
  }
}
.sidebar .sidebar-logo {
  display: block;
  width: 128px !important;
  height: 63px !important;
  max-width: 128px !important;
  max-height: 63px !important;
  object-fit: contain !important;
  object-position: left center;
  filter: none !important;
}
.brand {
  justify-content: space-between;
  padding: 0 9px 20px;
}
.brand > span {
  font-size: 15px;
  color: #dce8f8;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 4px 7px;
  border-radius: 6px;
}
.install-card .login-logo {
  display: block;
  width: 220px !important;
  height: auto !important;
  max-width: 70% !important;
  max-height: 110px !important;
  object-fit: contain !important;
  margin: 0 auto 12px;
}
.print-logo {
  display: block;
  width: 150px !important;
  height: auto !important;
  max-height: 75px !important;
  object-fit: contain !important;
  margin-bottom: 8px;
}
.nav-item.active {
  box-shadow: inset 3px 0 #4fb555;
}
.btn.outlook {
  background: #eef4ff;
  color: #0d2f68;
  border-color: #bfd0e7;
}
.btn.disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.bar-chart span {
  background: linear-gradient(180deg, #76cf7b, #4fb555);
}
.print-actions button {
  background: #4fb555;
}
.paper-head {
  border-bottom-color: #0d2f68;
}
.paper-title h2,
.paper-head h1 {
  color: #0d2f68;
}
.print-table th,
.print-totals .grand {
  background: #0d2f68;
}
.address-box small {
  color: #4fb555;
  font-weight: 700;
}
.sidebar nav {
  overflow-y: auto;
  padding-right: 3px;
  flex: 1;
  min-height: 0;
}
.nav-section {
  display: block;
  color: #8298b9;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 15px 12px 5px;
}
.planning-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.7fr);
  gap: 16px;
}
.three-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.agenda {
  display: grid;
  gap: 10px;
}
.agenda-item,
.opportunity-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}
.agenda-item h3,
.opportunity-card h3 {
  margin: 0 0 5px;
  font-size: 15px;
}
.agenda-item p,
.opportunity-card p {
  margin: 4px 0;
  color: var(--muted);
}
.opportunity-card {
  display: grid;
  gap: 5px;
  color: var(--ink);
  margin-bottom: 8px;
}
.opportunity-card span,
.opportunity-card small {
  color: var(--muted);
}
.pipeline-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
  overflow: auto;
}
.pipeline-board > section {
  background: #edf2f7;
  border-radius: 12px;
  padding: 12px;
  min-height: 180px;
}
.pipeline-board > section > h3 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--navy);
}
.compact-list {
  display: grid;
  gap: 8px;
}
.compact-list > div {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.backup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.backup-actions form {
  display: grid;
  gap: 10px;
  align-content: start;
}
@media (max-width: 1000px) {
  .planning-layout,
  .three-columns,
  .pipeline-board {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 780px) {
  .backup-actions,
  .planning-layout,
  .three-columns,
  .pipeline-board {
    grid-template-columns: 1fr;
  }
}
.inline-form {
  flex-wrap: wrap;
}
.period-filter,
.analysis-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
}
.period-filter label,
.analysis-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.period-filter select,
.analysis-controls select {
  min-width: 170px;
}
.dashboard-kpis .kpi,
.analysis-kpis .kpi {
  position: relative;
  overflow: hidden;
  border: 0;
  color: #fff;
}
.dashboard-kpis .kpi:after,
.analysis-kpis .kpi:after {
  content: "";
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  right: -28px;
  top: -34px;
}
.dashboard-kpis .kpi span,
.dashboard-kpis .kpi small,
.analysis-kpis .kpi span,
.analysis-kpis .kpi small {
  color: rgba(255, 255, 255, 0.86);
}
.kpi-quote {
  background: linear-gradient(135deg, #0d2f68, #22589a) !important;
}
.kpi-invoice {
  background: linear-gradient(135deg, #4fb555, #2f8e3a) !important;
}
.kpi-revenue {
  background: linear-gradient(135deg, #7253c6, #9a73e5) !important;
}
.kpi-unpaid {
  background: linear-gradient(135deg, #e38628, #efaa4f) !important;
}
.kpi-purchase {
  background: linear-gradient(135deg, #167e91, #24a6b9) !important;
}
.kpi-stock {
  border-left: 5px solid #0d2f68;
}
.kpi-reserved {
  border-left: 5px solid #e38628;
}
.kpi-available {
  border-left: 5px solid #4fb555;
}
.kpi-ordered {
  border-left: 5px solid #7253c6;
}
.locked-field {
  background: #eef2f6 !important;
  color: #536171 !important;
  cursor: not-allowed;
}
.quick-create summary,
.planning-create summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
}
.quick-create[open] summary,
.planning-create[open] summary {
  margin-bottom: 18px;
}
.selection-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px;
}
.btn.danger {
  background: #fff1f1;
  border-color: #edb7b7;
  color: #b52f2f;
}
.btn.danger:hover {
  background: #b52f2f;
  color: #fff;
}
.followup-composer {
  border-top: 5px solid var(--green);
}
.week-planner {
  display: grid;
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  gap: 10px;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 10px;
}
.planner-day {
  background: #eef2f7;
  border: 1px solid #dbe3ec;
  border-radius: 13px;
  min-height: 480px;
  min-width: 0;
  overflow: hidden;
}
.planner-day.today {
  border: 2px solid var(--green);
  background: #f2fbf3;
}
.planner-day > header {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid #dbe3ec;
  color: var(--navy);
}
.planner-events {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 9px;
  min-width: 0;
}
.planner-event {
  display: grid;
  gap: 4px;
  background: #fff;
  border-left: 4px solid var(--navy);
  border-radius: 9px;
  padding: 9px;
  box-shadow: 0 3px 10px rgba(13, 47, 104, 0.08);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.planner-event > b,
.planner-event > small {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.planner-event.delivery {
  border-left-color: var(--green);
}
.planner-event time {
  font-weight: 900;
  color: var(--navy);
}
.planner-event small {
  color: var(--muted);
}
.planner-event select {
  padding: 5px;
  font-size: 11px;
}
.planner-empty {
  color: #94a0ae;
  font-size: 12px;
  text-align: center;
  padding: 28px 5px;
}
.purchase-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 0.65fr);
  gap: 18px;
}
.horizontal-chart {
  display: grid;
  gap: 12px;
}
.hbar-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(180px, 3fr) 110px;
  gap: 12px;
  align-items: center;
}
.hbar-row > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hbar-row > div {
  height: 18px;
  background: #edf1f5;
  border-radius: 999px;
  overflow: hidden;
}
.hbar-row i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--green));
  border-radius: 999px;
}
.hbar-row b {
  text-align: right;
}
.insight {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.insight span {
  color: var(--muted);
}
.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 28px !important;
}
.quote-lines th:nth-child(2),
.quote-lines td:nth-child(2) {
  min-width: 260px;
}
@media (max-width: 1100px) {
  .week-planner {
    grid-template-columns: repeat(7, 190px);
  }
  .analysis-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 780px) {
  .period-filter,
  .analysis-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .period-filter .btn,
  .analysis-controls .btn {
    grid-column: span 2;
  }
  .hbar-row {
    grid-template-columns: 100px minmax(100px, 1fr);
  }
  .hbar-row b {
    grid-column: 2;
  }
  .selection-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* v1.4 — navigation, documents, relances et analyse */
.sidebar nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.38) transparent;
  scrollbar-gutter: stable;
}
.sidebar nav::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.sidebar nav::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar nav::-webkit-scrollbar-thumb {
  border:1px solid transparent;
  border-radius:999px;
  background:rgba(255,255,255,.34);
  background-clip:padding-box;
}
.sidebar nav::-webkit-scrollbar-thumb:hover {
  background:rgba(255,255,255,.58);
  background-clip:padding-box;
}
.document-tabs {
  display: flex;
  gap: 10px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}
.document-tabs a {
  min-width: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(13, 47, 104, 0.05);
}
.document-tabs a b {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 12px;
}
.document-tabs a.active {
  color: #fff;
  border-color: var(--navy);
  background: linear-gradient(135deg, var(--navy), #22589a);
}
.document-tabs a.active b {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}
.followup-tabs a {
  min-width: auto;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}
.row-actions form {
  margin: 0;
}
.document-savebar {
  display: flex;
  justify-content: flex-end;
  margin: -5px 0 22px;
}
.document-savebar .btn {
  min-width: 230px;
  padding: 12px 18px;
}
.followup-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 18px;
}
.followup-state-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.followup-state-form input {
  flex: 1;
}
.followup-stopped {
  padding: 18px;
  border-radius: 10px;
  background: #fff5f5;
  border: 1px solid #f0c8c8;
  color: #823636;
}
.followup-stopped p {
  margin: 7px 0 0;
}
.followup-history .timeline {
  max-height: 620px;
  overflow: auto;
  padding-right: 8px;
}
.history-entry {
  padding: 0 0 16px;
}
.history-entry header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.history-entry time {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.history-entry p {
  font-size: 13px;
  line-height: 1.5;
  max-height: 150px;
  overflow: auto;
}
.history-entry small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
.history-entry.stopped b {
  color: #b52f2f;
}
.history-entry.resumed b {
  color: #2f8e3a;
}
.analysis-empty {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.analysis-empty span {
  font-size: 13px;
}
.card-head small {
  color: var(--muted);
}
@media (max-width: 1050px) {
  .followup-detail-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 780px) {
  .document-tabs a {
    flex: 1;
    min-width: 120px;
  }
  .row-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .followup-state-form {
    align-items: stretch;
    flex-direction: column;
  }
  .document-savebar .btn {
    width: 100%;
  }
  .history-entry header {
    flex-direction: column;
    gap: 4px;
  }
}

/* v1.5 — Microsoft 365 */
.outlook-sync-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-left: 5px solid #1877c9;
}
.outlook-sync-notice span {
  color: var(--muted);
  font-size: 13px;
}
.outlook-pickup-option {
  padding: 14px;
  border: 1px solid #b9d8f2;
  border-radius: 10px;
  background: #f2f8fd;
}
.outlook-pickup-option span {
  display: grid;
  gap: 4px;
}
.outlook-pickup-option small {
  font-weight: 400;
  color: var(--muted);
}
.planning-legend {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.planning-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.planning-legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}
.legend-erp {
  background: var(--green);
}
.legend-outlook {
  background: #1877c9;
}
.planner-event.outlook-event {
  border-left-color: #1877c9;
  background: #f4f9fe;
}
.outlook-event-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.outlook-event-head span {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #1264a6;
  background: #dceefc;
  border-radius: 999px;
  padding: 3px 6px;
}
.microsoft-settings {
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.microsoft-settings .card-head p {
  margin: 5px 0 0;
  color: var(--muted);
}
.connection-status {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  background: #edf1f5;
  color: #667181;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.connection-status.connected {
  background: #e5f7ef;
  color: #18825a;
}
.microsoft-account {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid #cfe1ef;
  border-radius: 11px;
  background: #f5faff;
}
.microsoft-account > div {
  display: grid;
  gap: 4px;
}
.microsoft-account span {
  color: var(--muted);
}
.microsoft-connect {
  margin-top: 16px;
}
.microsoft-help {
  margin: 14px 0 0;
  font-size: 12px;
}
@media (max-width: 780px) {
  .outlook-sync-notice,
  .microsoft-account {
    align-items: flex-start;
    flex-direction: column;
  }
  .planning-legend {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}
.address-autocomplete {
  position: relative;
}
.address-results {
  display: none;
  position: absolute;
  z-index: 60;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid #dce4ea;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(13, 47, 104, 0.16);
  max-height: 280px;
  overflow: auto;
}
.address-results.open {
  display: block;
}
.address-results button {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid #edf1f4;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.address-results button:hover {
  background: #f1faf2;
}
.address-results small {
  color: #667085;
}
.discount-table th,
.discount-table td {
  white-space: nowrap;
}
.discount-table td:nth-child(2) {
  white-space: normal;
  min-width: 260px;
}
.discount-table td:nth-child(2) small {
  display: block;
  color: #667085;
}
.discount-table input {
  width: 82px;
  text-align: right;
}
.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 14px 0;
}
.sequence-field {
  border: 1px solid #dce4ea;
  border-radius: 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sequence-field legend {
  font-weight: 700;
  color: #0d2f68;
  padding: 0 5px;
}
.sequence-field small {
  grid-column: 1/-1;
  color: #667085;
}
.product-image img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  margin: auto;
  object-fit: contain;
}
.positive-text {
  color: #25843b;
  font-weight: 700;
}
.planning-delete-form {
  position: absolute;
  right: 7px;
  top: 7px;
}
.planner-event {
  position: relative;
}
.planning-delete-form .icon-btn {
  width: 25px;
  height: 25px;
  line-height: 20px;
}
.stock-entry summary {
  font-weight: 700;
  color: #0d2f68;
  cursor: pointer;
}
.connection-status.connected {
  background: #e8f7eb;
  color: #237a36;
}
.row-actions form {
  display: inline-flex;
}
.row-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* v1.7 — ergonomie clients, devis, price list et journal de stock */
html,
body,
input,
select,
textarea,
button {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
.uppercase-field {
  text-transform: uppercase;
}
.address-autocomplete small {
  font-weight: 500;
  color: var(--muted);
}
.product-editor {
  padding: 0;
  overflow: hidden;
}
.product-form-section {
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.product-form-section h2 {
  margin: 0 0 18px;
  font-size: 17px;
  color: var(--navy);
}
.product-calculator {
  background: linear-gradient(135deg, #f5fbf6, #f8fbff);
}
.product-save {
  margin: 20px 24px 24px;
  width: calc(100% - 48px);
  padding: 13px;
}
.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.document-lines-card {
  padding: 0;
  overflow: hidden;
}
.document-lines-card > .card-head {
  padding: 18px 20px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.quote-lines {
  font-size: 12px;
  min-width: 1620px;
}
.quote-lines th {
  padding: 10px 8px;
}
.quote-lines td {
  padding: 7px 6px;
}
.quote-lines th:nth-child(2),
.quote-lines td:nth-child(2) {
  min-width: 250px;
}
.quote-lines input {
  min-width: 82px;
  padding: 8px;
}
.quote-lines .line-code {
  min-width: 110px;
}
.quote-lines .line-designation {
  min-width: 240px;
}
.quote-lines .line-margin {
  font-weight: 800;
  color: #247b35;
}
.special-lines {
  margin: 18px 20px;
  border: 1px solid #dfe7ef;
  border-radius: 12px;
  overflow: hidden;
}
.special-lines h3 {
  margin: 0;
  padding: 13px 15px;
  background: #f5f8fb;
  font-size: 14px;
  color: var(--navy);
}
.special-line {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 210px 130px;
  gap: 12px;
  align-items: end;
  padding: 12px 15px;
  border-top: 1px solid #edf1f5;
}
.special-line label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.special-total {
  text-align: right;
  padding: 10px;
  font-weight: 800;
}
.deposit-line {
  background: #fffaf2;
}
.deposit-line .special-total {
  color: #b25b16;
}
.document-lines-card .document-totals {
  padding: 5px 20px 20px;
}
.stock-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.55fr);
  gap: 18px;
  margin-bottom: 18px;
}
.stock-current {
  padding: 0;
  overflow: hidden;
}
.stock-current > .card-head,
.stock-movement-form {
  padding: 20px;
}
.stock-summary-table {
  max-height: 520px;
}
.stock-summary-table thead {
  position: sticky;
  top: 0;
  z-index: 3;
}
.stock-movement-form .form-grid {
  grid-template-columns: 1fr 1fr;
}
.stock-filter {
  display: flex;
  align-items: end;
  gap: 12px;
}
.stock-filter label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.stock-filter label:nth-child(3) {
  flex: 1;
}
.stock-ledger {
  max-height: 680px;
}
.stock-ledger thead {
  position: sticky;
  top: 0;
  z-index: 4;
}
.stock-ledger th:first-child,
.stock-ledger td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  min-width: 135px;
}
.stock-ledger th:nth-child(2),
.stock-ledger td:nth-child(2) {
  position: sticky;
  left: 135px;
  z-index: 2;
  background: #fff;
  min-width: 230px;
}
.stock-ledger th:first-child,
.stock-ledger th:nth-child(2) {
  background: #f7f9fb;
  z-index: 5;
}
.category-editor {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
  counter-reset:category-order;
}
.category-editor > div {
  display: flex;
  gap: 7px;
}
.category-editor-row { align-items:center; padding:7px; border:1px solid #e2e8ed; border-radius:11px; background:#f9fbfc; }
.category-editor-row:not([hidden])::before { counter-increment:category-order; content:counter(category-order); display:grid; place-items:center; width:28px; height:28px; flex:0 0 28px; border-radius:8px; color:#fff; background:var(--navy); font-size:10px; font-weight:850; }
.category-drag-handle { color:#9aa8b5; font-weight:800; letter-spacing:-3px; padding:0 4px 0 1px; }
.category-order-actions { display:flex; gap:4px; flex:0 0 auto; }
.category-order-actions .icon-btn { width:32px; height:32px; min-width:32px; }
.category-order-actions .icon-btn:disabled { opacity:.3; cursor:not-allowed; }
.category-editor input[name="category_names[]"] {
  flex: 1;
}
@media (max-width: 1050px) {
  .stock-workspace {
    grid-template-columns: 1fr;
  }
  .category-editor {
    grid-template-columns: 1fr;
  }
  .special-line {
    grid-template-columns: 1fr 140px 180px 110px;
  }
}
@media (max-width: 900px) {
  .topbar:before {
    display: none;
  }
}
@media (max-width: 780px) {
  .product-form-section {
    padding: 18px 15px;
  }
  .product-save {
    margin: 16px 15px;
    width: calc(100% - 30px);
  }
  .special-line {
    grid-template-columns: 1fr 1fr;
  }
  .special-line strong,
  .special-total {
    grid-column: 1/-1;
  }
  .special-total {
    text-align: left;
  }
  .stock-filter {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .stock-filter label:nth-child(3),
  .stock-filter button {
    grid-column: 1/-1;
  }
  .category-editor {
    grid-template-columns: 1fr;
  }
}

/* v1.7.1 — identification client, devis compact et indicateurs produits */
.customer-preview {
  display: grid;
  grid-template-columns: 0.6fr 1.25fr 1.6fr 1.2fr 1.2fr;
  gap: 1px;
  margin: -4px 0 18px;
  border: 1px solid #dce5ed;
  border-radius: 13px;
  overflow: hidden;
  background: #dce5ed;
  box-shadow: 0 7px 22px rgba(13, 47, 104, 0.06);
}
.customer-preview > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px;
  background: #fff;
}
.customer-preview span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  font-weight: 800;
  color: #788596;
}
.customer-preview b,
.customer-preview small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.customer-preview b {
  font-size: 13px;
  color: var(--navy);
}
.customer-preview small {
  color: var(--muted);
}
.customer-preview-empty {
  grid-column: 1/-1 !important;
  color: var(--muted);
  text-align: center;
}
.customer-number-field input {
  font-weight: 900;
  color: var(--navy);
}
.quote-lines th:first-child,
.quote-lines td:first-child {
  width: 92px;
  min-width: 92px;
  max-width: 92px;
}
.quote-lines .line-code {
  width: 84px;
  min-width: 84px;
}
.quote-lines th:nth-child(2),
.quote-lines td:nth-child(2) {
  width: 330px;
  min-width: 330px;
}
.quote-lines .line-designation {
  width: 320px;
  min-width: 320px;
}
.quote-lines th:nth-child(3),
.quote-lines td:nth-child(3) {
  width: 72px;
  min-width: 72px;
  max-width: 72px;
}
.quote-lines .line-qty {
  width: 62px;
  min-width: 62px;
}
.quote-lines .line-margin {
  color: #277b39;
}
.special-lines-card {
  width: min(880px, 100%);
  margin: 0 0 18px auto;
  padding: 0;
  overflow: hidden;
}
.special-lines-card .special-lines {
  margin: 0;
  border: 0;
  border-radius: 0;
}
.special-lines-card .special-line {
  grid-template-columns: minmax(190px, 1fr) 120px 175px 115px;
  padding: 9px 14px;
}
.special-lines-card .special-line input {
  padding: 8px;
}
.special-lines-card .document-totals {
  padding: 12px 16px 16px;
}
.product-kpis {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}
.product-kpis .kpi {
  border-top: 4px solid var(--navy);
}
.product-kpis .product-margin-kpi {
  border-top-color: var(--green);
  background: linear-gradient(135deg, #f2fbf3, #fff);
}
.product-kpis .product-sale-kpi {
  border-top-color: #1976b9;
}
.product-kpis .product-purchase-kpi {
  border-top-color: #e38628;
}
.product-kpis .product-weight-kpi {
  border-top-color: #667085;
}
.product-kpis .kpi strong {
  color: var(--navy);
}
@media (max-width: 1150px) {
  .customer-preview {
    grid-template-columns: repeat(3, 1fr);
  }
  .product-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 780px) {
  .customer-preview {
    grid-template-columns: 1fr;
  }
  .product-kpis {
    grid-template-columns: 1fr 1fr;
  }
  .special-lines-card .special-line {
    grid-template-columns: 1fr 1fr;
  }
  .special-lines-card .special-line strong,
  .special-lines-card .special-total {
    grid-column: 1/-1;
  }
}

/* v1.7.1 — vue matricielle de l’inventaire */
.stock-matrix-filter {
  display: flex;
  align-items: end;
  gap: 12px;
}
.stock-matrix-filter label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.stock-matrix-filter .matrix-search {
  flex: 1;
}
.stock-matrix-card {
  padding: 0;
  overflow: hidden;
}
.stock-matrix-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.stock-matrix-help > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stock-matrix-help span {
  font-size: 12px;
  color: var(--muted);
}
.stock-matrix-wrap {
  overflow: auto;
  max-height: 720px;
}
.stock-matrix {
  min-width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}
.stock-matrix th,
.stock-matrix td {
  border-right: 1px solid #d7e0e8;
  border-bottom: 1px solid #dfe6ed;
  padding: 7px 8px;
}
.stock-matrix thead th {
  position: sticky;
  z-index: 5;
  background: #dcebc7;
  color: #142315;
  text-transform: none;
  letter-spacing: 0;
}
.stock-matrix thead tr:first-child th {
  top: 0;
}
.stock-matrix thead tr:nth-child(2) th {
  top: 40px;
}
.stock-matrix thead tr:nth-child(3) th {
  top: 107px;
}
.stock-matrix th:first-child,
.stock-matrix td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  min-width: 225px;
  max-width: 225px;
  background: #fff;
  text-align: left;
}
.stock-matrix th:nth-child(2),
.stock-matrix td:nth-child(2) {
  position: sticky;
  left: 225px;
  z-index: 4;
  min-width: 86px;
  max-width: 86px;
  background: #fff;
}
.stock-matrix thead th:first-child,
.stock-matrix thead th:nth-child(2) {
  z-index: 8;
  background: #cfe3b2;
}
.stock-matrix .matrix-product-code {
  min-width: 112px;
  max-width: 112px;
  height: 40px;
  text-align: center;
  font-size: 15px;
}
.stock-matrix .matrix-product-code a {
  color: #0d2f68;
  font-weight: 900;
}
.stock-matrix .matrix-designation {
  min-width: 112px;
  max-width: 112px;
  height: 67px;
  white-space: normal;
  text-align: center;
  line-height: 1.15;
  font-size: 9px;
}
.stock-matrix .matrix-unit {
  text-align: center;
  height: 30px;
}
.stock-matrix .matrix-code-title {
  font-size: 17px;
  font-weight: 900;
}
.stock-matrix .matrix-stock-row th,
.stock-matrix .matrix-stock-row td {
  background: #fff7a8;
  font-weight: 900;
}
.stock-matrix .matrix-stock-row td {
  font-size: 20px;
  text-align: center;
  color: #0d2f68;
}
.stock-matrix .matrix-safety-row th,
.stock-matrix .matrix-safety-row td {
  background: #dff4df;
}
.stock-matrix .matrix-value-row th,
.stock-matrix .matrix-value-row td {
  background: #f5f8fb;
  font-weight: 700;
}
.stock-matrix .matrix-movement-row:hover th,
.stock-matrix .matrix-movement-row:hover td {
  background: #f4f8fc;
}
.stock-matrix .matrix-entry {
  background: #e4f7e7 !important;
  color: #247b39;
  font-weight: 900;
}
.stock-matrix .matrix-exit {
  background: #fff0ee !important;
  color: #bd3838;
  font-weight: 900;
}
.stock-matrix .empty-state {
  position: static !important;
}
.stock-view-tabs {
  margin-bottom: 14px;
}
@media (max-width: 780px) {
  .stock-matrix-filter {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .stock-matrix-filter .matrix-search,
  .stock-matrix-filter button {
    grid-column: 1/-1;
  }
  .stock-matrix-help {
    align-items: flex-start;
    flex-direction: column;
  }
  .stock-matrix th:first-child,
  .stock-matrix td:first-child {
    min-width: 175px;
    max-width: 175px;
  }
  .stock-matrix th:nth-child(2),
  .stock-matrix td:nth-child(2) {
    left: 175px;
  }
}

/* v1.7.2 — devis pleine largeur, Price list illustrée et stocks modernisés */
.document-lines-card .table-wrap {
  overflow: visible;
}
.quote-lines {
  width: 100%;
  min-width: 0 !important;
  table-layout: fixed;
  font-size: 10.5px;
}
.quote-lines th,
.quote-lines td {
  min-width: 0 !important;
  max-width: none !important;
  width: auto;
  padding: 7px 4px;
}
.quote-lines th {
  white-space: normal;
  line-height: 1.15;
  text-align: center;
  letter-spacing: 0;
}
.quote-lines td {
  vertical-align: middle;
}
.quote-lines input,
.quote-lines .line-code,
.quote-lines .line-designation,
.quote-lines .line-qty {
  width: 100% !important;
  min-width: 0 !important;
  padding: 7px 5px;
  font-size: 11px;
}
.quote-lines th:nth-child(1),
.quote-lines td:nth-child(1) {
  width: 7%;
}
.quote-lines th:nth-child(2),
.quote-lines td:nth-child(2) {
  width: 20%;
}
.quote-lines th:nth-child(3),
.quote-lines td:nth-child(3) {
  width: 5.5%;
}
.quote-lines th:nth-child(4),
.quote-lines td:nth-child(4) {
  width: 7%;
}
.quote-lines th:nth-child(5),
.quote-lines td:nth-child(5) {
  width: 6%;
}
.quote-lines th:nth-child(6),
.quote-lines td:nth-child(6) {
  width: 8%;
}
.quote-lines th:nth-child(7),
.quote-lines td:nth-child(7) {
  width: 5%;
}
.quote-lines th:nth-child(8),
.quote-lines td:nth-child(8) {
  width: 7.5%;
}
.quote-lines th:nth-child(9),
.quote-lines td:nth-child(9),
.quote-lines th:nth-child(10),
.quote-lines td:nth-child(10) {
  width: 8%;
}
.quote-lines th:nth-child(11),
.quote-lines td:nth-child(11) {
  width: 7.5%;
}
.quote-lines th:nth-child(12),
.quote-lines td:nth-child(12) {
  width: 7%;
}
.quote-lines th:nth-child(13),
.quote-lines td:nth-child(13) {
  width: 3.5%;
  text-align: center;
}
.quote-lines .num {
  white-space: normal;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.quote-lines .icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
}
.special-lines-card {
  width: 100%;
  margin: 0 0 18px;
  padding: 0;
  overflow: hidden;
  border-top: 4px solid var(--navy);
}
.special-lines-head {
  display: flex;
  justify-content: space-between;
  padding: 19px 20px 15px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #f8fafc, #fff);
}
.special-lines-head h3 {
  margin: 3px 0 4px;
  color: var(--navy);
  font-size: 18px;
}
.special-lines-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.section-kicker {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--green);
}
.special-lines-card .special-lines {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  background: #f6f8fb;
}
.special-lines-card .special-line {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
  padding: 15px;
  border: 1px solid #dce4ed;
  border-top: 3px solid var(--navy);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(13, 47, 104, 0.05);
}
.special-lines-card .special-packaging {
  border-top-color: var(--green);
}
.special-lines-card .special-deposit {
  border-top-color: #e38628;
  background: #fffdf9;
}
.special-line-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.special-line-title i {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #edf3fb;
  color: var(--navy);
  font-style: normal;
  font-size: 18px;
  font-weight: 900;
}
.special-packaging .special-line-title i {
  background: #eaf7eb;
  color: #2f8b39;
}
.special-deposit .special-line-title i {
  background: #fff2e2;
  color: #ba661b;
}
.special-line-title span {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.special-line-title strong {
  font-size: 13px;
  color: var(--navy);
}
.special-line-title small {
  font-size: 10px;
  color: var(--muted);
  white-space: normal;
}
.special-line-fields {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 9px;
}
.special-line-fields label {
  display: grid;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.special-lines-card .special-line input {
  width: 100%;
  padding: 9px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.special-line-result {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 11px;
  border-top: 1px dashed #d7dfe8;
}
.special-line-result > span {
  font-size: 10px;
  color: var(--muted);
}
.special-line-result .special-total {
  padding: 0;
  color: var(--navy);
  font-size: 17px;
}
.special-deposit .special-total {
  color: #b25b16;
}
.special-summary {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 25px;
  padding: 14px 19px 17px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.special-summary > span {
  padding-top: 5px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
}
.special-lines-card .document-totals {
  width: min(390px, 100%);
  padding: 0;
  margin: 0;
}
.special-lines-card .document-totals .grand {
  color: var(--navy);
  border-color: var(--navy);
}
.price-list-table tbody tr {
  height: 76px;
}
.price-list-table td {
  padding-top: 8px;
  padding-bottom: 8px;
}
.product-thumb-cell {
  width: 76px;
}
.product-thumb-cell a {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid #dfe6ed;
  border-radius: 10px;
  background: #f7f9fb;
  overflow: hidden;
}
.product-thumb-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.product-thumb-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding:4px;
  font-size:8px;
  font-weight:800;
  line-height:1.2;
  text-align:center;
  text-transform:uppercase;
  color: #a5b0bd;
  background: linear-gradient(135deg, #f1f4f7, #fafbfc);
}
.product-name-link {
  color: var(--ink);
  font-weight: 600;
}
.product-name-link:hover {
  color: var(--navy);
}
.stock-view-tabs {
  padding: 5px;
  background: #e9eef4;
  border-radius: 14px;
  width: max-content;
}
.stock-view-tabs a {
  margin: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}
.stock-view-tabs a.active {
  box-shadow: 0 5px 15px rgba(13, 47, 104, 0.16);
}
.stock-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stock-overview > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--navy);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(13, 47, 104, 0.05);
}
.stock-overview > div:nth-child(2) {
  border-top-color: var(--green);
}
.stock-overview > div:nth-child(4) {
  border-top-color: #1976b9;
}
.stock-overview .stock-alert {
  border-top-color: #d64545;
  background: #fffafa;
}
.stock-overview span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.stock-overview strong {
  margin: 5px 0 2px;
  font-size: 22px;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stock-overview small {
  font-size: 10px;
  color: #8a95a3;
}
.stock-matrix-filter {
  padding: 15px 17px;
}
.stock-matrix-card {
  border-radius: 14px;
}
.stock-matrix-help {
  background: #fbfcfd;
}
.stock-matrix-legend {
  display: flex !important;
  flex-direction: row !important;
  gap: 13px !important;
}
.stock-matrix-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}
.stock-matrix-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.legend-entry {
  background: #d7f0dc;
}
.legend-exit {
  background: #ffe0dd;
}
.stock-matrix-wrap {
  max-height: 680px;
  background: #fff;
}
.stock-matrix {
  font-size: 10.5px;
}
.stock-matrix thead tr:first-child th {
  top: 0;
}
.stock-matrix thead th {
  height: 132px;
  padding: 8px;
  background: #f5f8fb;
  color: var(--navy);
  border-bottom: 2px solid #cfd9e4;
}
.stock-matrix th:first-child,
.stock-matrix td:first-child {
  min-width: 235px;
  max-width: 235px;
}
.stock-matrix th:nth-child(2),
.stock-matrix td:nth-child(2) {
  left: 235px;
  min-width: 92px;
  max-width: 92px;
}
.stock-matrix thead th:first-child,
.stock-matrix thead th:nth-child(2) {
  background: #eaf0f6;
}
.stock-matrix .matrix-left-label,
.stock-matrix .matrix-date-label {
  vertical-align: bottom;
  font-size: 11px;
}
.matrix-product-head {
  min-width: 126px;
  max-width: 126px;
  text-align: center;
}
.matrix-product-head a {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  color: var(--navy);
}
.matrix-product-head img {
  width: 48px;
  height: 45px;
  object-fit: contain;
  border-radius: 7px;
  background: #fff;
  border: 1px solid #dde5ed;
}
.matrix-product-head b {
  font-size: 14px;
}
.matrix-product-head span {
  display: -webkit-box;
  min-height: 24px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 9px;
  line-height: 1.25;
  color: #34465e;
}
.matrix-product-head small {
  padding: 2px 6px;
  border-radius: 999px;
  background: #e6edf5;
  color: #66778b;
  font-size: 8px;
  font-weight: 800;
}
.stock-matrix .matrix-stock-row th,
.stock-matrix .matrix-stock-row td {
  background: #fff8da;
}
.stock-matrix .matrix-stock-row td {
  font-size: 17px;
  color: var(--navy);
}
.stock-matrix .matrix-safety-row th,
.stock-matrix .matrix-safety-row td {
  background: #eef8ef;
}
.stock-matrix .matrix-value-row th,
.stock-matrix .matrix-value-row td {
  background: #f5f8fb;
}
.stock-matrix .matrix-movement-row th,
.stock-matrix .matrix-movement-row td {
  height: 38px;
}
.stock-matrix .matrix-movement-row:nth-child(even) th,
.stock-matrix .matrix-movement-row:nth-child(even) td {
  background: #fbfcfe;
}
@media (max-width: 1100px) {
  .special-lines-card .special-lines {
    grid-template-columns: 1fr;
  }
  .stock-overview {
    grid-template-columns: 1fr 1fr;
  }
  .quote-lines,
  .quote-lines tbody,
  .quote-lines tr {
    display: block;
  }
  .quote-lines thead {
    display: none;
  }
  .quote-lines tbody {
    padding: 10px;
  }
  .quote-lines tbody tr {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
  }
  .quote-lines td {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: auto !important;
    padding: 0;
    border: 0;
    text-align: left !important;
  }
  .quote-lines td:before {
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--muted);
  }
  .quote-lines td:nth-child(1):before {
    content: "Code";
  }
  .quote-lines td:nth-child(2):before {
    content: "Désignation";
  }
  .quote-lines td:nth-child(3):before {
    content: "Quantité";
  }
  .quote-lines td:nth-child(4):before {
    content: "PU HT";
  }
  .quote-lines td:nth-child(5):before {
    content: "Remise";
  }
  .quote-lines td:nth-child(6):before {
    content: "PU remisé";
  }
  .quote-lines td:nth-child(7):before {
    content: "TVA";
  }
  .quote-lines td:nth-child(8):before {
    content: "Montant TVA";
  }
  .quote-lines td:nth-child(9):before {
    content: "Total HT";
  }
  .quote-lines td:nth-child(10):before {
    content: "Total TTC";
  }
  .quote-lines td:nth-child(11):before {
    content: "Stock";
  }
  .quote-lines td:nth-child(12):before {
    content: "Marge nette";
  }
  .quote-lines td:nth-child(13) {
    justify-content: flex-end;
  }
  .quote-lines .num {
    justify-content: center;
    padding: 8px;
    border-radius: 7px;
    background: #f6f8fa;
  }
}
@media (max-width: 780px) {
  .quote-lines tbody tr {
    grid-template-columns: 1fr 1fr;
  }
  .quote-lines td:nth-child(2) {
    grid-column: 1/-1;
    grid-row: 2;
  }
  .special-summary {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }
  .special-summary > span {
    padding: 0;
  }
  .stock-overview {
    grid-template-columns: 1fr;
  }
  .stock-view-tabs {
    display: flex;
    width: 100%;
  }
  .stock-view-tabs a {
    min-width: 0;
    flex: 1;
  }
  .stock-matrix th:first-child,
  .stock-matrix td:first-child {
    min-width: 180px;
    max-width: 180px;
  }
  .stock-matrix th:nth-child(2),
  .stock-matrix td:nth-child(2) {
    left: 180px;
  }
  .price-list-table {
    font-size: 12px;
  }
  .product-thumb-cell {
    width: 62px;
  }
  .product-thumb-cell a {
    width: 48px;
    height: 48px;
  }
}

/* v1.7.3 — marges de devis, quantités entières et cohérence visuelle */
.customer-preview {
  grid-template-columns: 0.65fr 1.25fr 1.65fr 1.25fr;
}
.quote-lines th:nth-child(1),
.quote-lines td:nth-child(1) {
  width: 6%;
}
.quote-lines th:nth-child(2),
.quote-lines td:nth-child(2) {
  width: 26%;
}
.quote-lines th:nth-child(3),
.quote-lines td:nth-child(3) {
  width: 4.5%;
}
.quote-lines th:nth-child(4),
.quote-lines td:nth-child(4) {
  width: 6%;
}
.quote-lines th:nth-child(5),
.quote-lines td:nth-child(5) {
  width: 5%;
}
.quote-lines th:nth-child(6),
.quote-lines td:nth-child(6) {
  width: 7%;
}
.quote-lines th:nth-child(7),
.quote-lines td:nth-child(7) {
  width: 4.5%;
}
.quote-lines th:nth-child(8),
.quote-lines td:nth-child(8) {
  width: 7%;
}
.quote-lines th:nth-child(9),
.quote-lines td:nth-child(9),
.quote-lines th:nth-child(10),
.quote-lines td:nth-child(10) {
  width: 7%;
}
.quote-lines th:nth-child(11),
.quote-lines td:nth-child(11) {
  width: 6.5%;
}
.quote-lines th:nth-child(12),
.quote-lines td:nth-child(12) {
  width: 6.5%;
}
.quote-lines th:nth-child(13),
.quote-lines td:nth-child(13) {
  width: 3%;
}
.quote-lines .line-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  min-height: 34px;
  padding: 7px 6px;
  border: 1px solid #ccd5df;
  border-radius: 8px;
  background: #f5f7fa;
  color: #35445a;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.quote-lines .editable-line-value {
  width: 100%;
  min-width: 0 !important;
  padding: 7px 5px;
  text-align: right;
  background: #fff;
  border-color: #aebdce;
  box-shadow: inset 0 0 0 1px rgba(79, 181, 85, 0.08);
}
.quote-lines .editable-line-value:focus {
  border-color: var(--green);
  outline: 2px solid rgba(79, 181, 85, 0.15);
}
.quote-lines .line-stock .line-value {
  justify-content: center;
  font-weight: 800;
  color: var(--navy);
}
.quote-lines .line-margin .line-value {
  font-weight: 800;
  color: #277b39;
}
.quote-lines th:nth-child(2),
.quote-lines td:nth-child(2) { width: 21%; }
.quote-lines th:nth-child(6),
.quote-lines td:nth-child(6),
.quote-lines th:nth-child(8),
.quote-lines td:nth-child(8) { width: 6%; }
.quote-lines td:nth-child(6) .input-suffix input,
.quote-lines td:nth-child(8) .input-suffix input {
  padding-left: 5px !important;
  padding-right: 5px !important;
  min-width: 72px;
  text-align: center;
}
.quote-lines td:nth-child(6) .input-suffix span,
.quote-lines td:nth-child(8) .input-suffix span {
  display: block !important;
  position: static;
  flex: 0 0 14px;
  transform: none;
  font-size: 11px;
  line-height: 1;
}
.quote-lines td:nth-child(6) .input-suffix,
.quote-lines td:nth-child(8) .input-suffix {
  display: flex;
  align-items: center;
  gap: 2px;
}
.quote-lines td:nth-child(6) .input-suffix input,
.quote-lines td:nth-child(8) .input-suffix input {
  width: calc(100% - 16px) !important;
  min-width: 58px;
}
.quote-lines .line-vat-rate .line-value {
  justify-content: center;
}
.special-lines-card .special-lines {
  align-items: stretch;
}
.special-lines-card .special-line {
  align-items: stretch;
  width: 100%;
  height: 100%;
}
.special-line-title,
.special-line-fields,
.special-line-result {
  width: 100%;
}
.special-line-fields {
  grid-template-columns: 1fr 1fr;
}
.special-line-title span {
  flex: 1;
}
.special-line-result {
  margin-top: auto;
}
.special-line-result .special-total {
  margin-left: auto;
}
.margin-analysis-card {
  padding: 0;
  overflow: hidden;
  border-top: 4px solid var(--green);
}
.margin-analysis-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #f3faf4, #fff);
}
.margin-analysis-head h3 {
  margin: 3px 0 4px;
  font-size: 18px;
  color: var(--navy);
}
.margin-analysis-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.margin-analysis-head label {
  display: grid;
  gap: 5px;
  min-width: 190px;
  font-size: 11px;
  font-weight: 800;
  color: var(--navy);
}
.margin-analysis-head input {
  text-align: right;
  font-size: 16px;
  font-weight: 900;
  color: var(--navy);
  border-color: #9bcfa0;
}
.margin-analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px;
  background: #f7f9fb;
}
.margin-analysis-grid > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  border: 1px solid #dce4ed;
  border-radius: 11px;
  background: #fff;
}
.margin-analysis-grid span {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.margin-analysis-grid strong {
  margin: 7px 0 4px;
  font-size: 23px;
  color: var(--navy);
}
.margin-analysis-grid small {
  font-size: 10px;
  color: var(--muted);
}
.margin-analysis-grid .adjusted-margin {
  border-top: 3px solid var(--green);
  background: #f8fcf8;
}
.margin-analysis-grid .margin-cost {
  border-top: 3px solid var(--navy);
}
.margin-analysis-grid span b {
  color: var(--green);
}
.stock-matrix {
  font-size: 10.5px;
  color: #334155;
}
.stock-matrix th,
.stock-matrix td {
  padding: 8px;
  font-size: 10.5px;
  line-height: 1.25;
}
.stock-matrix thead th {
  height: 112px;
  background: #f3f6fa;
  color: #33465d;
  border-bottom: 2px solid #cdd8e4;
}
.stock-matrix thead th:first-child,
.stock-matrix thead th:nth-child(2) {
  background: #e9eff5;
  color: var(--navy);
}
.matrix-product-head a {
  gap: 3px;
}
.matrix-product-head img {
  width: 42px;
  height: 38px;
}
.matrix-product-head b {
  font-size: 12px;
  line-height: 1.1;
}
.matrix-product-head span {
  min-height: 23px;
  font-size: 9px;
  line-height: 1.25;
  font-weight: 500;
}
.matrix-product-head small {
  font-size: 8px;
}
.stock-matrix .matrix-left-label,
.stock-matrix .matrix-date-label {
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.3;
}
.stock-matrix .matrix-stock-row th,
.stock-matrix .matrix-stock-row td,
.stock-matrix .matrix-safety-row th,
.stock-matrix .matrix-safety-row td,
.stock-matrix .matrix-value-row th,
.stock-matrix .matrix-value-row td {
  font-size: 10.5px;
  line-height: 1.25;
}
.stock-matrix .matrix-stock-row td {
  font-size: 12px;
  font-weight: 900;
}
.stock-matrix .matrix-stock-row th {
  border-left: 4px solid #e7bd35;
}
.stock-matrix .matrix-safety-row th {
  border-left: 4px solid var(--green);
}
.stock-matrix .matrix-value-row th {
  border-left: 4px solid var(--navy);
}
.stock-matrix .matrix-movement-row th,
.stock-matrix .matrix-movement-row td {
  height: 36px;
  font-size: 10.5px;
}
.stock-matrix .matrix-movement-row th {
  font-weight: 600;
}
.stock-matrix .matrix-movement-row th:nth-child(2) {
  font-weight: 500;
  color: #657386;
}
@media (max-width: 1100px) {
  .quote-lines td.num {
    padding: 0;
    background: transparent;
  }
  .quote-lines .line-value {
    justify-content: flex-start;
  }
  .margin-analysis-grid {
    grid-template-columns: 1fr;
  }
  .margin-analysis-head {
    align-items: stretch;
    flex-direction: column;
  }
  .margin-analysis-head label {
    min-width: 0;
  }
  .special-line-fields {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 780px) {
  .customer-preview {
    grid-template-columns: 1fr;
  }
  .special-line-fields {
    grid-template-columns: 1fr;
  }
  .margin-analysis-grid {
    padding: 12px;
  }
}

/* v1.8.0 — devis, transport, achats et pilotage */
.quick-create-compact {
  padding: 0;
  overflow: hidden;
}
.quick-create-compact summary {
  padding: 13px 18px;
  font-size: 13px;
}
.quick-create-compact .form-grid {
  gap: 10px;
  padding: 14px 18px;
}
.quick-create-compact label {
  gap: 4px;
  font-size: 10px;
}
.quick-create-compact input,
.quick-create-compact select {
  padding: 8px 10px;
}
.document-head .margin-coefficient {
  border-color: #8bc890;
  background: #f7fcf7;
  text-align: center;
  font-weight: 900;
  color: var(--navy);
}
.quote-lines td:not(:nth-child(2)) {
  text-align: center;
}
.quote-lines .centered-input {
  text-align: center;
}
.input-suffix {
  position: relative;
  width: 100%;
}
.input-suffix input {
  padding-right: 28px !important;
  min-width: 70px;
}
.input-suffix span {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 900;
  color: #627087;
  pointer-events: none;
}
.quote-lines .line-value {
  justify-content: center;
}
.quote-lines .line-vat-amount .line-value {
  color: var(--navy);
  font-weight: 700;
}
.special-lines-head {
  align-items: center;
}
.transport-open {
  white-space: nowrap;
}
.margin-analysis-compact {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 13px 17px;
  border-top: 3px solid var(--green);
}
.margin-analysis-compact > span {
  font-size: 12px;
  font-weight: 800;
  color: var(--navy);
}
.margin-analysis-compact > strong {
  font-size: 20px;
  color: var(--navy);
}
.margin-analysis-compact > b {
  padding: 6px 9px;
  border-radius: 8px;
  background: #eaf7eb;
  color: #287c35;
}
.margin-analysis-compact > small {
  grid-column: 1/-1;
  color: var(--muted);
  font-size: 10px;
}
.transport-dialog {
  width: min(760px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(13, 47, 104, 0.25);
}
.transport-dialog::backdrop {
  background: rgba(13, 31, 58, 0.55);
  backdrop-filter: blur(2px);
}
.transport-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.transport-dialog-head h3 {
  margin: 3px 0 0;
  color: var(--navy);
}
.transport-tabs {
  display: flex;
  padding: 14px 20px 0;
  gap: 8px;
}
.transport-tabs button {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--navy);
  font-weight: 800;
}
.transport-tabs button.active {
  border-color: var(--green);
  background: #eef8ef;
  color: #287a32;
}
.transport-dialog section {
  padding: 14px 20px;
}
.transport-map-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}
.transport-map-actions small {
  flex-basis: 100%;
  color: var(--muted);
}
.transport-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
}
.transport-dialog-actions strong {
  font-size: 19px;
  color: var(--navy);
}
.schedule-document summary {
  font-weight: 900;
  color: var(--navy);
}
.discount-category-manager {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(420px, 1.2fr);
  gap: 20px;
  align-items: start;
  border-top: 4px solid var(--green);
}
.discount-category-manager h2 {
  margin: 4px 0;
}
.discount-category-manager p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.discount-category-manager form {
  display: grid;
  grid-template-columns: 0.7fr 1fr auto;
  gap: 9px;
  align-items: end;
}
.discount-category-manager form label {
  display: grid;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.discount-category-chips {
  grid-column: 1/-1;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.discount-category-chips span {
  display: flex;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #dce5ed;
  border-radius: 999px;
  background: #f8fafc;
  font-size: 11px;
}
.discount-category-chips b {
  color: var(--green);
}
.code-analysis-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(135px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}
.code-analysis-filter label {
  display: grid;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.code-groups {
  display: grid;
  gap: 18px;
}
.code-group {
  padding: 0;
  overflow: hidden;
}
.code-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 17px;
  background: #4fb555;
  color: #fff;
}
.code-color-2 .code-group-head {
  background: #e8db00;
  color: #253344;
}
.code-color-3 .code-group-head {
  background: #0ea8d8;
}
.code-group-head span {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  opacity: 0.8;
}
.code-group-head h2 {
  margin: 2px 0 0;
  font-size: 17px;
}
.code-matrix {
  font-size: 11px;
}
.code-matrix th,
.code-matrix td {
  padding: 8px 7px;
}
.code-matrix thead th {
  background: #f2f6f3;
  color: var(--navy);
}
.code-matrix .ratio-pill {
  display: inline-block;
  min-width: 55px;
  padding: 4px 6px;
  border-radius: 6px;
  background: #e9f6ea;
  color: #23752e;
  font-weight: 900;
}
.code-matrix .stock-cell {
  font-weight: 900;
  background: #fffbdc;
}
.code-matrix tfoot th {
  background: #eef3f7;
  color: var(--navy);
}
.supplier-editor {
  border-top: 4px solid var(--green);
}
.purchase-editor {
  display: grid;
  gap: 18px;
}
.purchase-lines-card {
  padding: 0;
  overflow: hidden;
}
.purchase-lines-card > .card-head {
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
}
.purchase-lines {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  font-size: 9.5px;
}
.purchase-lines th {
  text-align: center;
  line-height: 1.2;
  padding: 8px 4px;
}
.purchase-lines input {
  width: 100%;
  min-width: 0;
  padding: 7px 5px;
  font-size: 9.5px;
}
.purchase-lines th:nth-child(1) { width: 5%; }
.purchase-lines th:nth-child(2) { width: 15%; }
.purchase-lines th:nth-child(3) { width: 15%; }
.purchase-lines th:nth-child(4) { width: 4.5%; }
.purchase-lines th:nth-child(5) { width: 7%; }
.purchase-lines th:nth-child(6) { width: 7.5%; }
.purchase-lines th:nth-child(7) { width: 10%; }
.purchase-lines th:nth-child(8) { width: 6%; }
.purchase-lines th:nth-child(9) { width: 7%; }
.purchase-lines th:nth-child(10) { width: 7.5%; }
.purchase-lines th:nth-child(11) { width: 6.5%; }
.purchase-lines th:nth-child(12) { width: 3.5%; }
.purchase-lines td { padding: 5px 3px; }
.purchase-lines .num {
  text-align: center;
  font-weight: 700;
}
.po-computed-field {
  display:flex;
  width:100%;
  min-height:0;
  align-items:center;
  justify-content:center;
  padding:7px 5px;
  border:1px solid #d8e0e8;
  border-radius:8px;
  background:#eef2f5;
  color:var(--navy);
  font-size:9.5px;
  font-weight:700;
  white-space:nowrap;
}
.purchase-lines .po-computed-field { box-sizing:border-box; line-height:normal; }
.po-complements {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.po-complements > div {
  display: grid;
  grid-template-columns: 1.35fr 0.5fr 0.7fr 0.55fr;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
}
.po-complements h3 {
  grid-column: 1/-1;
  margin: 0;
  color: var(--navy);
}
.po-complements label {
  display: grid;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.po-totals {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}
.po-totals label,
.po-totals > div {
  display: grid;
  gap: 5px;
}
.po-totals span,
.po-totals label {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.po-totals strong {
  font-size: 16px;
  color: var(--navy);
}
.po-summary-card { min-height:76px; padding:11px 12px; border:1px solid #dce5ed; border-top:3px solid var(--navy); border-radius:11px; background:#f8fafc; align-content:center; }
.po-summary-card.converted { border-top-color:var(--green); background:#f2faf3; }
.po-totals .po-vat-rate { align-content:stretch; }
.po-totals .grand {
  padding: 10px;
  border-radius: 9px;
  background: var(--navy);
}
.po-totals .grand span,
.po-totals .grand strong {
  color: #fff;
}
.carrier-manager {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.carrier-add {
  display: grid;
  grid-template-columns: 1fr 0.7fr 0.6fr auto;
  gap: 9px;
  align-items: end;
}
.carrier-add label {
  display: grid;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
}
.carrier-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}
.carrier-list > div {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.carrier-list span {
  display: grid;
}
.carrier-list small {
  color: var(--muted);
}
@media (max-width: 1100px) {
  .discount-category-manager {
    grid-template-columns: 1fr;
  }
  .discount-category-manager form {
    grid-template-columns: 1fr 1fr;
  }
  .discount-category-manager form .btn {
    grid-column: 1/-1;
  }
  .code-analysis-filter {
    grid-template-columns: 1fr 1fr;
  }
  .code-analysis-filter .btn {
    grid-column: 1/-1;
  }
  .po-complements {
    grid-template-columns: 1fr;
  }
  .po-totals {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 700px) {
  .margin-analysis-compact {
    grid-template-columns: 1fr auto;
  }
  .margin-analysis-compact > strong {
    grid-column: 1;
  }
  .transport-dialog section .form-grid,
  .carrier-add,
  .po-complements > div,
  .po-totals {
    grid-template-columns: 1fr;
  }
  .sample-ready-notice,
  .sample-history-list article {
    align-items: stretch;
    flex-direction: column;
  }
  .code-analysis-filter {
    grid-template-columns: 1fr;
  }
  .discount-category-manager form {
    grid-template-columns: 1fr;
  }
  .transport-open {
    margin-top: 8px;
  }
  .special-lines-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Connexion ERP JTLM — interface opérationnelle inspirée du portail Optimize Digital. */
.erp-login-page { min-height:100vh; margin:0; background:#061a38; color:var(--navy); font-family:Inter,system-ui,sans-serif; }
.erp-login-shell { position:relative; isolation:isolate; min-height:100vh; display:grid; grid-template-columns:minmax(420px,1.08fr) minmax(430px,.92fr); overflow:hidden; background:radial-gradient(circle at 12% 12%,rgba(79,181,85,.18),transparent 31%),radial-gradient(circle at 88% 12%,rgba(46,117,184,.18),transparent 30%),linear-gradient(135deg,#123e69 0%,#0d2f68 46%,#08234d 72%,#061a38 100%); }
.erp-login-shell::after { content:""; position:absolute; z-index:-1; width:540px; height:540px; left:36%; bottom:-270px; border:86px solid rgba(79,181,85,.075); border-radius:50%; }
.erp-login-brand { position:relative; z-index:1; display:flex; flex-direction:column; justify-content:space-between; min-height:100vh; padding:clamp(42px,6vw,92px); color:#fff; background:transparent; }
.erp-login-brand::after { content:none; }
.erp-login-brand-content { position:relative; z-index:1; max-width:760px; margin:auto 0; }
.erp-login-kicker { display:inline-flex; padding:7px 10px; border:1px solid rgba(255,255,255,.22); border-radius:999px; color:#bde5c1; font-size:11px; font-weight:850; letter-spacing:.14em; }
.erp-login-brand h1 { max-width:760px; margin:24px 0 20px; color:#fff; font-size:clamp(42px,5.4vw,78px); line-height:1.01; letter-spacing:-.055em; }
.erp-login-brand p { max-width:610px; margin:0; color:#cbd8e7; font-size:clamp(16px,1.4vw,20px); line-height:1.65; }
.erp-login-features { display:flex; flex-wrap:wrap; gap:9px; margin-top:34px; }
.erp-login-features span { padding:9px 13px; border:1px solid rgba(255,255,255,.14); border-radius:9px; background:rgba(255,255,255,.07); color:#f1f6fb; font-size:12px; font-weight:750; }
.erp-login-brand > small { position:relative; z-index:1; color:#91a7c1; font-size:11px; }
.erp-login-panel { position:relative; z-index:1; display:grid; place-items:center; min-height:100vh; padding:36px; background:transparent; }
.erp-login-card { width:min(450px,100%); padding:42px; border:1px solid #dce5ed; border-radius:22px; background:#fff; box-shadow:0 28px 75px rgba(13,47,104,.14); }
.erp-login-card .login-logo { display:block; width:220px; max-width:72%; height:auto; margin:0 0 30px; }
.erp-login-card h2 { margin:6px 0 5px; color:var(--navy); font-size:30px; letter-spacing:-.03em; }
.erp-login-card > p { margin:0 0 24px; color:var(--muted); }
.erp-login-card form { display:grid; gap:16px; }
.erp-login-card label { display:grid; gap:7px; color:#43566d; font-size:12px; font-weight:800; }
.erp-login-card input { width:100%; min-height:48px; padding:11px 13px; border:1px solid #cfdae5; border-radius:10px; background:#fff; color:var(--navy); font-size:14px; }
.erp-login-card input:focus { border-color:#4f8fc8; outline:3px solid rgba(46,117,184,.13); }
.erp-login-password { position:relative; display:block; }
.erp-login-password input { padding-right:50px; }
.erp-login-password button { position:absolute; top:50%; right:7px; display:grid; width:36px; height:36px; padding:0; place-items:center; border:0; border-radius:8px; background:transparent; color:#60758d; transform:translateY(-50%); }
.erp-login-password button:hover,.erp-login-password button.is-visible { background:#eef5f0; color:#2d8738; }
.erp-login-password svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.erp-login-submit { min-height:49px; margin-top:5px; font-size:14px; box-shadow:0 10px 24px rgba(79,181,85,.22); }
.erp-login-submit span { margin-left:auto; font-size:18px; }
.erp-two-factor-code { text-align:center; font-size:24px !important; font-weight:850; letter-spacing:.18em; }
.erp-two-factor-secondary { display:flex; justify-content:space-between; gap:12px; margin-top:15px; }
.erp-two-factor-secondary form { display:block; }
.erp-two-factor-secondary button { padding:0; border:0; background:transparent; color:#315f91; font:inherit; font-size:11px; font-weight:800; cursor:pointer; }
.erp-two-factor-secondary button:hover { color:#267737; text-decoration:underline; }
.erp-two-factor-help { display:block; margin-top:18px; color:#6a7b8f; font-size:10.5px; line-height:1.5; text-align:center; }
@media (max-width:900px) { .erp-login-shell { grid-template-columns:1fr; } .erp-login-brand { display:none; } .erp-login-panel { padding:24px; } }
@media (max-width:520px) { .erp-login-panel { padding:14px; } .erp-login-card { padding:28px 22px; border-radius:17px; } .erp-login-card .login-logo { margin-bottom:24px; } }

/* Éditeur complet des bons de livraison. */
.delivery-editor { display:grid; gap:18px; }
.delivery-pallet-fields { grid-column:1/-1; display:grid; grid-template-columns:repeat(2,minmax(0,220px)); gap:12px; padding:14px; border:1px solid #cfe1d2; border-radius:12px; background:#f2faf3; }
.delivery-pallet-fields small { grid-column:1/-1; color:#587061; font-size:11px; }
.delivery-lines-card { padding:0; overflow:hidden; }
.delivery-lines-card > .card-head { padding:18px 20px; margin:0; border-bottom:1px solid var(--line); }
.delivery-lines-card > .card-head p { margin:3px 0 0; color:var(--muted); }
.delivery-lines-table { min-width:820px; }
.delivery-lines-table th:nth-child(1) { width:145px; }
.delivery-lines-table th:nth-child(3) { width:120px; text-align:center; }
.delivery-lines-table th:nth-child(4) { width:100px; }
.delivery-lines-table th:last-child { width:52px; }
.delivery-lines-table input { min-width:0; width:100%; }
.delivery-lines-table .delivery-line-quantity { text-align:center; }
.delivery-save-bar { position:sticky; bottom:14px; z-index:10; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:13px 15px 13px 18px; border-radius:13px; background:rgba(13,47,104,.96); color:#fff; box-shadow:0 12px 32px rgba(13,47,104,.24); }
.delivery-save-bar span { color:#cbd8e7; font-size:12px; }
.paper-pallet { margin:16px 0; padding:10px 12px; border:1px solid #cfd9e5; }
@media (max-width:700px) { .delivery-pallet-fields { grid-template-columns:1fr; } .delivery-pallet-fields small { grid-column:auto; } .delivery-save-bar span { display:none; } .delivery-save-bar .btn { width:100%; } }

/* Filtres directs par colonne de la Price list. */
.price-list-column-filters th { position:sticky; top:43px; z-index:3; padding:6px 4px; background:#edf3f7; border-top:1px solid #d9e3eb; }
.price-list-column-filters input { width:100%; min-width:64px; height:32px; padding:5px 7px; border:1px solid #cbd8e3; border-radius:7px; background:#fff; color:#243f61; font-size:10px; font-weight:650; text-align:left; text-transform:none; letter-spacing:0; }
.price-list-column-filters input:focus { border-color:#4f8fc8; outline:2px solid rgba(46,117,184,.13); }
.price-list-table tbody tr[hidden] { display:none; }

/* ERP 2.2 */
.coefficient-titlebar {
  align-items: center;
}
.coefficient-preview-input {
  width: 88px !important;
  padding: 7px 9px !important;
  border: 1px solid #b7d9bd !important;
  border-radius: 9px !important;
  background: #fff !important;
  color: var(--green) !important;
  font-weight: 900;
  text-align: center;
}
.quote-total-weight {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding: 9px 12px;
  border-radius: 10px;
  background: #eef8f0;
  color: #245c2e;
  font-size: 12px;
  white-space: nowrap;
}
.quote-total-weight b {
  font-size: 14px;
}
.quote-lines .line-weight {
  min-width: 92px;
  font-weight: 700;
  color: #0d2f68;
}
.transport-breakdown {
  display: grid;
  gap: 6px;
  margin: 14px 20px;
  padding: 14px;
  border: 1px solid #d8e5ed;
  border-radius: 12px;
  background: #f7fafc;
  color: #45566a;
  font-size: 12px;
}
.transport-breakdown b {
  color: #0d2f68;
}
.transport-breakdown span {
  display: block;
}
.transport-dialog-head .icon-btn {
  cursor: pointer;
  position: relative;
  z-index: 3;
}
.live-filter {
  transition: opacity 0.15s;
}
.discount-form + .sticky-save,
.discount-table-wrap + .sticky-save {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 20px;
  padding: 0;
  background: transparent;
  border: 0;
  position: static;
}
.product-identification-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.product-identification-grid label:nth-of-type(4),
.product-identification-grid label:nth-of-type(5) {
  grid-column: span 1;
}
.product-dimensions-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.product-kpis-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.product-kpis-summary .kpi-stock { border-left: 1px solid var(--line); }
.price-list-comment { min-width: 180px; white-space: normal; line-height: 1.35; }
.customer-search-heading { display:block; }
.customer-search-control { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:stretch; }
.customer-search-control input { min-width:0; }
.customer-create-button { min-height:42px; align-self:stretch; padding-inline:13px; white-space:nowrap; }
.quick-customer-dialog { width:min(820px,calc(100vw - 28px)); padding:0; border:0; border-radius:18px; box-shadow:0 24px 70px rgba(15,37,67,.28); }
.quick-customer-dialog .dialog-body { padding:20px 22px; }
.erp-suggestion-menu { position:fixed; z-index:1200; max-height:min(380px,48vh); overflow-y:auto; overscroll-behavior:contain; scrollbar-gutter:stable; padding:6px; border:1px solid #d9e3ec; border-radius:14px; background:#fff; box-shadow:0 18px 50px rgba(13,47,104,.20); }
.erp-suggestion-menu[hidden] { display:none !important; }
.erp-suggestion-option { display:grid; width:100%; min-height:54px; gap:3px; padding:10px 13px; border:0; border-bottom:1px solid #edf1f5; border-radius:9px; background:#fff; color:#24364d; text-align:left; cursor:pointer; }
.erp-suggestion-option:last-child { border-bottom:0; }
.erp-suggestion-option:hover,.erp-suggestion-option:focus { outline:0; background:#f1f8f2; box-shadow:inset 3px 0 var(--green); }
.erp-suggestion-option b { color:var(--navy); font-size:13px; }
.erp-suggestion-option small { color:var(--muted); font-size:11px; }
.finance-closed-notice { margin-bottom:14px; }
.finance-closed-card { display:flex; align-items:flex-start; flex-direction:column; gap:10px; border-top:4px solid var(--green); }
.finance-closed-card h2,.finance-closed-card p { margin:0; }
.commercial-followup-navigation { display:flex; align-items:stretch; justify-content:space-between; gap:16px; margin-bottom:18px; }
.commercial-followup-navigation .followup-tabs { flex:1; margin-bottom:0; }
.sample-module-option { display:grid; min-width:230px; align-content:center; gap:2px; padding:9px 16px; border:1px solid rgba(79,181,85,.38); border-radius:12px; background:#f3fbf4; color:var(--navy); box-shadow:0 4px 14px rgba(13,47,104,.05); }
.sample-module-option span { color:var(--green); font-size:9px; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
.sample-module-option b { font-size:13px; }
.sample-module-option:hover,.sample-module-option.active { border-color:var(--green); background:var(--green); color:#fff; }
.sample-module-option:hover span,.sample-module-option.active span { color:#fff; opacity:.86; }
.commercial-sample-card { border-top:4px solid var(--green); }
.commercial-sample-layout { display:grid; grid-template-columns:minmax(360px,.85fr) minmax(440px,1.15fr); gap:18px; align-items:start; }
.commercial-sample-history-card { border-top:4px solid var(--navy); }
.commercial-sample-search { margin:14px 0; }
.sample-history-global { max-height:680px; overflow:auto; padding-right:4px; }
.sample-history-global small { color:var(--muted); font-size:11px; line-height:1.35; }
.commercial-sample-form { margin-top:14px; }
.commercial-sample-form label > small { color:var(--muted); font-weight:500; }
.sample-ready-notice { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:12px 0; }
.sample-history-list { display:grid; gap:8px; margin-top:16px; padding-top:14px; border-top:1px solid var(--line); }
.sample-history-list article { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 12px; border:1px solid var(--line); border-radius:10px; background:#f8fafc; }
.sample-history-list article > div { display:grid; gap:3px; }
.sample-history-list span { color:var(--muted); font-size:11px; }
.sample-history-global .sample-history-entry { align-items:stretch; padding:14px; }
.sample-history-main { min-width:0; gap:10px !important; }
.sample-history-heading { display:flex !important; align-items:flex-start; justify-content:space-between; gap:12px; }
.sample-history-heading > span { display:grid; gap:3px; }
.sample-history-heading em { padding:4px 7px; border-radius:7px; background:#e8eef7; color:var(--navy); font-size:9px; font-style:normal; font-weight:800; white-space:nowrap; }
.sample-contact-details { display:grid !important; grid-template-columns:1fr 1.2fr 1fr; gap:12px; padding:10px; border-radius:9px; background:#fff; color:var(--muted); font-size:11px; line-height:1.45; }
.sample-contact-details strong { color:var(--navy); }
.sample-contact-details a { font-weight:700; }
.sample-history-main p { margin:0; color:var(--muted); font-size:11px; }
.sample-history-actions { display:flex !important; flex-direction:column; justify-content:center; gap:6px !important; min-width:78px; }
.trace-sample { border-color:rgba(79,181,85,.42) !important; background:#f3fbf4 !important; }
.event-sample { border-left-color:var(--green) !important; }
@media (max-width:760px) {
  .commercial-followup-navigation { flex-direction:column; }
  .commercial-followup-navigation .followup-tabs { width:100%; overflow-x:auto; }
  .sample-module-option { min-width:0; width:100%; }
  .sample-contact-details { grid-template-columns:1fr; }
  .sample-history-global .sample-history-entry { flex-direction:column; }
  .sample-history-actions { flex-direction:row; flex-wrap:wrap; }
}
.product-margin-structured {
  border-top: 4px solid #0d2f68;
}
.special-order-tools-compact {
  display: block;
}
.special-order-import {
  display: grid !important;
  grid-template-columns: minmax(210px, 1.3fr) minmax(230px, 1fr) 170px auto;
  gap: 12px;
  align-items: end;
  padding: 16px 18px;
}
.special-order-import h2 {
  margin: 3px 0;
  font-size: 17px;
}
.special-order-import label {
  margin: 0;
}
.special-order-manual {
  margin-top: 10px;
}
.special-order-manual summary {
  cursor: pointer;
  font-weight: 800;
  color: #0d2f68;
}
.special-order-manual form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.special-note-form {
  display: flex;
  min-width: 210px;
}
.special-note-form input[name="notes"] {
  min-width: 160px;
}
.purchase-special-reminder {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  border-left: 5px solid #f59e0b;
  background: #fff8e8;
}
.purchase-special-reminder > div {
  display: grid;
}
.purchase-special-reminder details {
  grid-column: 1/-1;
}
.purchase-special-reminder summary {
  cursor: pointer;
  font-weight: 700;
}
.purchase-special-reminder table {
  margin-top: 10px;
}
.stock-matrix-head img,
.matrix-product-head img {
  display: block;
  width: 54px;
  height: 42px;
  object-fit: contain;
  margin: 0 auto 6px;
  border-radius: 6px;
  background: #fff;
}
.stock-matrix .matrix-event.matrix-reservation {
  background: #fff5d9;
}
.stock-matrix .matrix-event.matrix-reservation th:first-child {
  border-left: 5px solid #f59e0b;
}
.stock-matrix .matrix-event.matrix-purchase {
  background: #eaf3ff;
}
.stock-matrix .matrix-event.matrix-purchase th:first-child {
  border-left: 5px solid #3182ce;
}
.stock-matrix .matrix-event.matrix-invoice {
  background: #eaf8ed;
}
.stock-matrix .matrix-event.matrix-invoice th:first-child {
  border-left: 5px solid #4fb555;
}
.stock-matrix .matrix-event.matrix-movement {
  background: #f6f7f8;
}
.legend-purchase {
  background: #3182ce !important;
}
.legend-invoice {
  background: #4fb555 !important;
}
.stock-journal-editable tr.matrix-invoice > td {
  background: #eaf8ed;
}
.stock-journal-editable tr.matrix-invoice > td:first-child {
  border-left: 5px solid #4fb555;
}
.matrix-reservation-delete {
  display: inline-flex;
  margin-left: 8px;
  vertical-align: middle;
}
.stock-matrix-help {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.product-bulk-toolbar input[name="value"] {
  min-width: 190px;
}
@media (max-width: 1150px) {
  .product-kpis-summary {
    grid-template-columns: repeat(3, 1fr);
  }
  .special-order-import {
    grid-template-columns: 1fr 1fr;
  }
  .special-order-import > div,
  .special-order-import .btn {
    grid-column: span 2;
  }
}
@media (max-width: 750px) {
  .product-identification-grid,
  .product-dimensions-grid,
  .product-kpis-summary,
  .special-order-import,
  .special-order-manual form {
    grid-template-columns: 1fr;
  }
  .special-order-import > div,
  .special-order-import .btn {
    grid-column: auto;
  }
  .quote-total-weight {
    width: 100%;
    justify-content: center;
  }
  .purchase-special-reminder {
    grid-template-columns: 1fr;
  }
  .purchase-special-reminder details {
    grid-column: auto;
  }
}

/* v1.9 — ratios, commandes spécifiques et lisibilité longue */
.coefficient-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid #d7e1ec;
  border-radius: 9px;
  background: #fff;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.coefficient-titlebar input {
  width: 82px;
  padding: 7px;
  text-align: center;
  font-weight: 900;
  color: var(--navy);
}
.document-logistics-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.document-margin-total {
  grid-column: 1/-1;
  display: grid !important;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid #dfe7ef;
}
.document-margin-total small {
  grid-column: 1/-1;
  color: var(--muted);
}
.full-designation,
.product-name-link,
.stock-matrix .matrix-product-head span,
.code-analysis-table td:first-of-type {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  line-height: 1.35;
  word-break: normal;
}
.stock-matrix .matrix-product-head {
  min-width: 190px;
}
.stock-matrix .matrix-product-head span {
  font-size: 10px;
  font-weight: 600;
}
.discount-categories-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}
.discount-category-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1px solid #dde6ee;
  border-radius: 10px;
  background: #f8fafc;
}
.discount-category-row.new {
  border-style: dashed;
}
.discount-table {
  min-width: 980px;
  table-layout: fixed;
}
.discount-table th:first-child {
  width: 90px;
}
.discount-table th:nth-child(2) {
  width: 410px;
}
.discount-table th:not(:nth-child(-n + 2)) {
  width: 105px;
  text-align: center;
}
.discount-table td {
  vertical-align: middle;
}
.discount-margin-preview {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.discount-table .full-designation {
  font-size: 11px;
}
.percent-cell {
  position: relative;
}
.percent-cell input {
  width: 100%;
  padding-right: 22px;
  text-align: center;
}
.percent-cell span {
  position: absolute;
  right: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--muted);
}
.special-order-tools {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 14px;
}
.compact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.compact-form h2 {
  grid-column: 1/-1;
  margin: 0 0 3px;
}
.compact-form label {
  display: grid;
  gap: 5px;
}
.special-orders-table td:first-child small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
.special-orders-table .full-designation {
  min-width: 340px;
  font-size: 11px;
}
.ratio-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}
.ratio-filter label {
  display: grid;
  gap: 5px;
}
.ratio-table {
  min-width: 1450px;
}
.ratio-table .full-designation {
  min-width: 390px;
  font-size: 11px;
}
.ratio-family th {
  position: sticky;
  left: 0;
  background: linear-gradient(90deg, var(--navy), #174b86);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ratio-recommend {
  width: 90px;
  text-align: center;
  font-weight: 800;
}
.ratio-create-po {
  position: sticky;
  left: 0;
  display: flex;
  justify-content: flex-end;
  align-items: end;
  gap: 10px;
  padding: 14px;
  background: #f7faf8;
  border-top: 1px solid var(--line);
}
.ratio-create-po label {
  display: grid;
  gap: 5px;
  min-width: 280px;
}
@media (max-width: 900px) {
  .commercial-sample-layout { grid-template-columns:1fr; }
  .special-order-tools,
  .ratio-filter {
    grid-template-columns: 1fr;
  }
  .compact-form {
    grid-template-columns: 1fr;
  }
  .coefficient-titlebar {
    width: 100%;
    justify-content: space-between;
  }
  .document-margin-total {
    grid-template-columns: 1fr auto;
  }
  .document-margin-total b {
    grid-column: 2;
  }
  .ratio-create-po {
    align-items: stretch;
    flex-direction: column;
  }
  .ratio-create-po label {
    min-width: 0;
  }
}

/* ERP 2.1 — devis, produits, réservations et tableaux plus compacts */
.discount-page,
.discount-filter,
.discount-table-wrap {
  font-size: 12px;
}
.discount-page h2 {
  font-size: 16px;
}
.discount-categories-edit input,
.discount-filter input,
.discount-filter select,
.discount-table input {
  font-size: 11px;
  padding: 7px 8px;
}
.discount-table th {
  font-size: 10px;
  padding: 8px 6px;
}
.discount-table td {
  padding: 7px 6px;
}
.discount-table .full-designation {
  font-size: 10px;
  line-height: 1.25;
}
.coefficient-titlebar {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 2px 9px;
  padding: 7px 11px;
  border: 1px solid #cfe2d0;
  border-radius: 10px;
  background: #f2faf3;
  color: var(--navy);
  font-size: 11px;
}
.coefficient-titlebar b {
  font-size: 16px;
  color: #287c35;
}
.coefficient-titlebar small {
  grid-column: 1/-1;
  color: var(--muted);
  font-size: 9px;
}
.transport-dialog,
.schedule-dialog {
  width: min(780px, calc(100vw - 28px));
  max-height: calc(100vh - 34px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(13, 47, 104, 0.32);
}
.transport-dialog::backdrop,
.schedule-dialog::backdrop {
  background: rgba(8, 22, 42, 0.62);
  backdrop-filter: blur(3px);
}
.transport-dialog-head,
.schedule-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px;
  background: linear-gradient(135deg, #0d2f68, #174a91);
  color: #fff;
}
.transport-dialog-head h3,
.schedule-dialog-head h3 {
  margin: 4px 0 0;
  color: #fff;
  font-size: 22px;
}
.schedule-dialog-head p {
  margin: 5px 0 0;
  color: #d8e7fb;
  font-size: 12px;
}
.transport-dialog-head .section-kicker,
.schedule-dialog-head .section-kicker {
  color: #9ed0ff;
}
.transport-dialog-head .icon-btn,
.schedule-dialog-head .icon-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.transport-tabs {
  background: #f4f7fb;
  padding: 14px 20px;
}
.transport-tabs button {
  flex: 1;
}
.transport-dialog section {
  margin: 16px 20px;
  padding: 18px;
  border: 1px solid #e1e8ef;
  border-radius: 13px;
  background: #fff;
}
.transport-map-actions {
  padding: 16px 20px;
}
.transport-dialog-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 16px 20px;
}
.schedule-dialog > form {
  padding: 22px 24px;
}
.schedule-dialog > form .btn.primary {
  margin-top: 6px;
}
.product-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #cfe0f5;
  border-radius: 12px;
  background: #f3f8ff;
}
.product-bulk-toolbar b {
  margin-right: auto;
  color: var(--navy);
}
.product-bulk-toolbar select,
.product-bulk-toolbar input {
  width: auto;
  min-width: 145px;
  padding: 8px;
}
.supplier-designation-cell {
  min-width: 210px;
  color: #596576;
}
.margin-rate {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 700;
}
.danger-zone {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 22px;
}
.product-selection-form .price-list-table {
  min-width: 1500px;
}
.product-kpis .kpi strong {
  font-size: 21px;
}
.reservation-log {
  border-top: 4px solid #e69124;
}
.reservation-count {
  padding: 6px 9px;
  border-radius: 999px;
  background: #fff2dc;
  color: #8f5a11;
  font-size: 11px;
  font-weight: 800;
}
.matrix-reserved-row th,
.matrix-reserved-row td {
  background: #fff8ec !important;
  color: #875819;
}
.matrix-physical-row th,
.matrix-physical-row td {
  background: #f4f7fb !important;
}
.matrix-reservation-row th {
  background: #fff6e7 !important;
  color: #875819;
}
.matrix-reservation {
  background: #fff0d2 !important;
  color: #a05f00 !important;
  font-weight: 900;
}
.matrix-reservation td.num,
.matrix-reservation input.num,
.matrix-reserved-row td.num {
  font-weight: 400 !important;
}
.legend-reservation {
  background: #e69124 !important;
}
@media (max-width: 900px) {
  .product-bulk-toolbar {
    align-items: stretch;
  }
  .product-bulk-toolbar b {
    width: 100%;
  }
  .product-bulk-toolbar select,
  .product-bulk-toolbar input,
  .product-bulk-toolbar .btn {
    width: 100%;
  }
  .schedule-dialog > form {
    grid-template-columns: 1fr;
  }
  .schedule-dialog > form .span-2 {
    grid-column: 1;
  }
}

/* ERP 2.2 final overrides */
.special-order-tools.special-order-tools-compact {
  display: block;
}
.special-order-tools-compact .special-order-import {
  display: grid !important;
  grid-template-columns: minmax(210px, 1.3fr) minmax(230px, 1fr) 170px auto !important;
}
.coefficient-titlebar .coefficient-preview-input {
  width: 88px !important;
  background: #fff !important;
  color: #287c35 !important;
}
.product-kpis.product-kpis-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.stock-matrix .matrix-event.matrix-reservation {
  background: #fff5d9 !important;
}
.stock-matrix .matrix-event.matrix-purchase {
  background: #eaf3ff !important;
}
.stock-matrix .matrix-event.matrix-invoice {
  background: #eaf8ed !important;
}
@media (max-width: 1150px) {
  .special-order-tools-compact .special-order-import {
    grid-template-columns: 1fr 1fr !important;
  }
  .special-order-import > div,
  .special-order-import .btn {
    grid-column: span 2;
  }
  .product-kpis.product-kpis-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 750px) {
  .special-order-tools-compact .special-order-import,
  .product-kpis.product-kpis-summary {
    grid-template-columns: 1fr !important;
  }
  .special-order-import > div,
  .special-order-import .btn {
    grid-column: auto;
  }
}

/* ERP 2.3 */
.quote-line-tools {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}
.quote-line-tools .quote-total-weight {
  margin-left: 0;
}
.quote-lines th:nth-child(1),
.quote-lines td:nth-child(1) {
  width: 6%;
}
.quote-lines th:nth-child(2),
.quote-lines td:nth-child(2) {
  width: 24%;
}
.quote-lines th:nth-child(3),
.quote-lines td:nth-child(3) {
  width: 4.5%;
}
.quote-lines th:nth-child(4),
.quote-lines td:nth-child(4) {
  width: 6%;
}
.quote-lines th:nth-child(5),
.quote-lines td:nth-child(5) {
  width: 6%;
}
.quote-lines th:nth-child(6),
.quote-lines td:nth-child(6) {
  width: 4%;
}
.quote-lines th:nth-child(7),
.quote-lines td:nth-child(7) {
  width: 7%;
}
.quote-lines th:nth-child(8),
.quote-lines td:nth-child(8) {
  width: 4.5%;
}
.quote-lines th:nth-child(9),
.quote-lines td:nth-child(9) {
  width: 7%;
}
.quote-lines th:nth-child(10),
.quote-lines td:nth-child(10),
.quote-lines th:nth-child(11),
.quote-lines td:nth-child(11) {
  width: 7%;
}
.quote-lines th:nth-child(12),
.quote-lines td:nth-child(12) {
  width: 6%;
}
.quote-lines th:nth-child(13),
.quote-lines td:nth-child(13) {
  width: 7.5%;
}
.quote-lines th:nth-child(14),
.quote-lines td:nth-child(14) {
  width: 3%;
}
.quote-lines .line-margin .line-value {
  white-space: nowrap;
  font-size: 10px;
  padding-inline: 3px;
}
.top-document-convert {
  display: inline-flex;
}
.top-document-convert .btn {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.document-followup-preview {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.document-followup-preview article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fafc;
}
.document-followup-preview time,
.document-followup-preview small {
  font-size: 10px;
  color: var(--muted);
}
.document-followup-preview p {
  grid-column: 1/-1;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}
.review-btn {
  background: #fff8df;
  border-color: #f1cd57;
  color: #765400;
}
.review-already {
  display: grid;
  gap: 2px;
  padding: 10px;
  border-radius: 9px;
  background: #eef8f0;
  color: #2d6b37;
}
.review-already small {
  font-size: 10px;
}
.deposit-document-notice {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  border-left: 5px solid var(--green);
  background: #eef9f0;
}
.stock-reserved-notice { border-left: 5px solid #e69124; background: #fff7e8; }
.deposit-badge {
  background: #eee8ff;
  color: #6542a8;
}
.finance-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.8fr 1.05fr;
  gap: 18px;
}
.stock-reservation-card {
  border-top: 4px solid #e69124;
}
.reservation-form {
  display: grid;
  gap: 12px;
}
.reservation-form label {
  display: grid;
  gap: 6px;
}
.reservation-release {
  margin-top: 12px;
}
.deposit-invoice-card {
  border-top: 4px solid var(--navy);
}
.deposit-create-form {
  display: grid;
  gap: 10px;
}
.deposit-create-form label {
  display: grid;
  gap: 5px;
}
.deposit-create-form label[hidden] {
  display: none !important;
}
.deposit-mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border: 1px solid #d8e0e8;
  border-radius: 12px;
  background: #f3f6f8;
}
.deposit-mode-toggle button {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #586775;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
.deposit-mode-toggle button.active {
  background: #267c37;
  color: #fff;
  box-shadow: 0 3px 10px rgba(38, 124, 55, 0.22);
}
.invoice-status-form {
  display: flex;
  align-items: end;
  gap: 10px;
  margin: 14px 0 10px;
}
.invoice-status-form label {
  display: grid;
  gap: 5px;
  min-width: 170px;
}
.newsletter-kpis {
  margin-bottom: 18px;
}
.newsletter-directory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 18px;
  margin: 18px 0;
}
.newsletter-create {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
  padding: 12px;
}
.newsletter-create > summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 850;
}
.newsletter-create[open] > summary { margin-bottom: 12px; }
.newsletter-search {
  display: grid;
  gap: 5px;
  margin: 12px 0 8px;
}
.newsletter-contact-list,
.newsletter-list-cards {
  display: grid;
  gap: 7px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}
.newsletter-contact-list article,
.newsletter-list-cards article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.newsletter-contact-list article[hidden],
.newsletter-member-picker label[hidden] {
  display: none !important;
}
.newsletter-contact-list article > span:first-child,
.newsletter-list-cards article > span:first-child {
  display: grid;
  min-width: 0;
}
.newsletter-contact-list article.is-unsubscribed {
  background: #f8fafc;
  opacity: .78;
}
.newsletter-contact-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}
.newsletter-status {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 10px;
  font-weight: 850;
  cursor: pointer;
}
.newsletter-status.is-active { background:#e6f6eb; border-color:#b9dfc3; color:#267c37; }
.newsletter-status.is-inactive { background:#eef1f4; border-color:#d9dfe5; color:#66717d; }
.newsletter-contact-actions span.newsletter-status { cursor: default; }
.newsletter-consent { display:flex !important; grid-template-columns:auto 1fr; align-items:center; gap:8px; }
.newsletter-consent input { width:auto; }
.newsletter-contact-list small,
.newsletter-list-cards small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.source-chip {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eaf5ec;
  color: #267c37;
  font-size: 10px;
  font-weight: 850;
}
.source-chip.is-brevo {
  background: #eaf1ff;
  color: #0d2f68;
  font-style: normal;
}
.newsletter-list-cards b .source-chip {
  display: inline-flex;
  margin-left: 5px;
  vertical-align: middle;
}
.brevo-newsletter-dialog { width: min(720px, calc(100vw - 28px)); }
.brevo-newsletter-dialog .dialog-body { display: grid; gap: 15px; padding: 20px 22px 22px; }
.brevo-sync-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid #dce4ed;
  border-radius: 12px;
  background: #f8fafc;
}
.brevo-sync-status > div { display: grid; gap: 2px; }
.brevo-sync-status small { color: var(--muted); }
.brevo-status-dot { width: 12px; height: 12px; border-radius: 50%; background: #9aa6b2; box-shadow: 0 0 0 5px rgba(154,166,178,.14); }
.brevo-sync-status.is-connected { border-color: #bde1c2; background: #f1faf2; }
.brevo-sync-status.is-connected .brevo-status-dot { background: var(--green); box-shadow: 0 0 0 5px rgba(79,181,85,.14); }
.brevo-sync-status.is-error { border-color: #efc7c7; background: #fff6f6; }
.brevo-sync-status.is-error .brevo-status-dot { background: #c43b3b; box-shadow: 0 0 0 5px rgba(196,59,59,.12); }
.brevo-sync-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.brevo-sync-summary span { display: grid; gap: 2px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; text-align: center; background: #fff; }
.brevo-sync-summary b { color: var(--navy); font-size: 20px; }
.brevo-sync-summary small { color: var(--muted); }
.brevo-settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.brevo-settings-form > label:not(.newsletter-consent) { display: grid; gap: 5px; }
.brevo-settings-form .field-help { margin: 0; color: var(--muted); line-height: 1.5; }
.brevo-settings-form .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 0 0; border-top: 1px solid var(--line); }
.brevo-sync-now-form { padding-top: 2px; }
.newsletter-list-form { display: grid; gap: 10px; }
.newsletter-import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px 12px;
}
.newsletter-import-form > small {
  grid-column: 1 / -1;
  color: var(--muted);
}
.newsletter-member-picker {
  display: grid;
  gap: 6px;
  max-height: 330px;
  overflow: auto;
  padding: 2px;
}
.newsletter-member-picker > label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}
.newsletter-member-picker > label > span { display: grid; }
.campaign-list-choice[hidden] { display: none; }
.review-status-form {
  display: grid;
  grid-template-columns: 150px minmax(170px, 1fr) auto;
  gap: 7px;
}
.review-pending {
  background: #fff4dd;
  color: #91610d;
}
.review-reviewed {
  background: #e5f7ef;
  color: #18825a;
}
.review-declined {
  background: #edf1f5;
  color: #5d6876;
}
.campaign-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.55fr);
  gap: 18px;
}
.campaign-html-preview {
  white-space: normal;
  overflow: auto;
  max-height: 680px;
}
.campaign-actions {
  align-self: start;
  position: sticky;
  top: 92px;
}
.campaign-actions form {
  margin-top: 14px;
}
.campaign-recipient-list {
  display: grid;
  gap: 5px;
  max-height: 260px;
  overflow: auto;
  margin-top: 10px;
  font-size: 11px;
}
.campaign-builder {
  display: grid;
  gap: 18px;
}
.campaign-customer-picker[hidden] {
  display: none;
}
.campaign-check-all {
  display: flex;
  align-items: center;
  gap: 6px;
}
@media (max-width: 980px) {
  .newsletter-directory-layout { grid-template-columns: 1fr; }
}
.customer-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: 430px;
  overflow: auto;
}
.customer-check-grid label {
  display: flex;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.customer-check-grid span {
  display: grid;
}
.customer-check-grid small {
  color: var(--muted);
  font-size: 10px;
}
.campaign-submit {
  justify-self: end;
  min-width: 230px;
}
.review-template-selected textarea {
  background: #f4f6f8;
}
.special-order-import {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(240px, 1fr) 170px auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
}
.special-order-import h2 {
  margin: 2px 0;
}
.special-order-cards {
  display: grid;
  gap: 12px;
}
.special-order-card > header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}
.special-order-card > header div {
  display: grid;
  gap: 4px;
}
.special-order-card > header span {
  color: var(--muted);
  font-size: 12px;
}
.special-order-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 12px 0;
  padding: 9px 0;
  border-block: 1px solid var(--line);
  font-size: 12px;
}
.special-order-meta form {
  margin-left: auto;
}
.comment-thread summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
}
.comment-thread > div {
  display: grid;
  gap: 7px;
  margin: 10px 0;
}
.comment-thread article {
  padding: 10px;
  border-left: 3px solid var(--green);
  background: #f7faf8;
}
.comment-thread article header {
  display: flex;
  justify-content: space-between;
}
.comment-thread article time {
  color: var(--muted);
  font-size: 10px;
}
.comment-thread article p {
  margin: 6px 0 0;
}
.comment-thread > form {
  display: grid;
  gap: 8px;
}
.planner-event-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 5px;
  width: 100%;
}
.planner-event-actions form {
  margin: 0;
  min-width: 0;
}
.planner-event-actions .btn {
  width: 100%;
  min-width: 0;
  padding-inline: 5px;
  box-sizing: border-box;
  font-size: 10px;
}
.planning-edit {
  border-top: 5px solid var(--green);
}
.user-admin-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
}
.user-create-form {
  display: grid;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
}
.user-create-form label {
  display: grid;
  gap: 5px;
}
.user-list {
  display: grid;
  gap: 8px;
}
.user-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 150px 1fr auto auto;
  gap: 7px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.user-row small {
  grid-column: 1/-1;
  color: var(--muted);
}
@media (max-width: 1100px) {
  .finance-grid,
  .campaign-layout,
  .user-admin-grid {
    grid-template-columns: 1fr;
  }
  .campaign-actions {
    position: static;
  }
  .customer-check-grid {
    grid-template-columns: 1fr 1fr;
  }
  .special-order-import {
    grid-template-columns: 1fr 1fr;
  }
  .special-order-import > div,
  .special-order-import .btn {
    grid-column: 1/-1;
  }
  .user-row {
    grid-template-columns: 1fr 1fr;
  }
  .quote-line-tools {
    margin-left: 0;
  }
}
@media (max-width: 700px) {
  .quote-line-tools,
  .special-order-meta {
    align-items: stretch;
    flex-direction: column;
  }
  .customer-check-grid,
  .special-order-import,
  .review-status-form {
    grid-template-columns: 1fr;
  }
  .special-order-import > div,
  .special-order-import .btn {
    grid-column: auto;
  }
  .user-row {
    grid-template-columns: 1fr;
  }
  .campaign-submit {
    width: 100%;
  }
}
.document-readonly-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 18px;
  margin-bottom: 18px;
}
.document-address {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 16px 0;
}
.document-address b {
  font-size: 1.08rem;
  color: var(--navy);
}
.document-readonly-totals {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.document-readonly-totals span {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}
.document-readonly-totals .total {
  font-size: 1.12rem;
  color: var(--navy);
  border-bottom: 0;
}
.document-readonly-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
}
.special-order-tools-detailed {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  gap: 16px;
  align-items: start;
}
.special-order-tools-detailed .special-order-import {
  margin: 0;
}
.special-order-comments summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--navy);
}
.special-order-comments form {
  margin-top: 16px;
}
.special-order-initial-note {
  padding: 10px 12px;
  background: #f7f9fb;
  border-radius: 8px;
  font-size: 0.9rem;
}
.special-order-meta form {
  margin: 0;
}
@media (max-width: 900px) {
  .document-readonly-grid,
  .special-order-tools-detailed {
    grid-template-columns: 1fr;
  }
  .document-readonly-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .document-readonly-actions form,
  .document-readonly-actions .btn {
    width: 100%;
  }
}
/* ERP final — confirmations et tableaux éditables */
.erp-confirm-dialog {
  width: min(430px, calc(100vw - 28px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 25px 70px #0f172a55;
}
.erp-confirm-dialog::backdrop {
  background: #0f172a80;
  backdrop-filter: blur(2px);
}
.erp-confirm-dialog form {
  padding: 26px;
  text-align: center;
}
.erp-confirm-dialog .confirm-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #fff1f2;
  color: #be123c;
  font-size: 24px;
  font-weight: 900;
}
.erp-confirm-dialog.is-info .confirm-icon {
  background: #eaf7eb;
  color: #287c35;
}
.erp-confirm-dialog h2 {
  margin: 0 0 8px;
}
.erp-confirm-dialog p {
  margin: 0;
  color: #475569;
  line-height: 1.5;
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.stock-matrix-editable input {
  min-width: 86px;
  width: 100%;
  padding: 6px 7px;
  font-size: 12px;
  box-sizing: border-box;
}
.stock-matrix-editable th:first-child {
  min-width: 220px;
  max-width: 300px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.stock-matrix-editable th:nth-child(2) {
  min-width: 178px;
  max-width: 178px;
}
.stock-matrix-editable th:nth-child(2) input {
  min-width: 0;
  width: 100%;
  font-size: 11px;
}
.stock-matrix-editable .matrix-product-head {
  min-width: 128px;
  max-width: 150px;
}
.stock-matrix-editable .matrix-product-head span {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.stock-matrix-editable .icon-btn {
  margin-top: 4px;
}
.stock-matrix {
  table-layout: fixed;
}
.stock-matrix .matrix-description-col {
  width: 260px;
}
.stock-matrix .matrix-date-col {
  width: 220px;
}
.stock-matrix .matrix-product-col {
  width: 150px;
}
.stock-matrix th,
.stock-matrix td {
  height: auto;
  vertical-align: middle;
  box-sizing: border-box;
}
.stock-matrix thead th {
  height: 170px !important;
}
.stock-matrix .matrix-product-head {
  height: 170px !important;
  width: 150px !important;
  min-width: 150px !important;
  max-width: 150px !important;
  padding: 8px;
}
.stock-matrix .matrix-product-head a {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
}
.stock-matrix .matrix-product-head span {
  display: block !important;
  width: 100%;
  max-height: 70px !important;
  overflow: hidden !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.stock-matrix th:first-child,
.stock-matrix td:first-child {
  width: 260px !important;
  min-width: 260px !important;
  max-width: 260px !important;
}
.stock-matrix th:nth-child(2),
.stock-matrix td:nth-child(2) {
  left: 260px !important;
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
}
.stock-matrix .matrix-row-description {
  display: block;
  color: var(--navy);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}
.stock-matrix .matrix-date-edit {
  display: grid;
  grid-template-columns: 165px 34px;
  align-items: center;
  gap: 5px;
  width: 204px;
  min-width: 204px;
  max-width: 204px;
}
.stock-matrix .matrix-date-edit input {
  display: block;
  width: 165px !important;
  min-width: 165px !important;
  max-width: 165px !important;
  font-size: 10px;
  padding: 5px 4px;
}
.stock-matrix .matrix-date-edit .icon-btn {
  margin: 0;
}
.stock-matrix td input {
  min-width: 78px;
}
.stock-matrix .matrix-event {
  height: 48px !important;
}
.stock-matrix .matrix-event th,
.stock-matrix .matrix-event td {
  height: 48px !important;
  min-height: 0 !important;
  padding-top: 4px;
  padding-bottom: 4px;
}
.stock-matrix-header-wrap {
  overflow: hidden;
  background: #fff;
  border-bottom: 2px solid #cfd9e4;
}
.stock-matrix-header {
  border-bottom: 0;
}
.stock-matrix-header thead th {
  position: relative !important;
  top: auto !important;
  border-bottom: 0;
}
.stock-matrix-header thead th:first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 8;
}
.stock-matrix-header thead th:nth-child(2) {
  position: sticky !important;
  left: 260px !important;
  z-index: 8;
}
.stock-matrix-body-wrap {
  height: calc(100vh - 315px);
  min-height: 560px;
  max-height: 820px !important;
}

.stock-matrix .matrix-date-edit {
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  min-width: 0;
  max-width: none;
}
.stock-matrix .matrix-date-edit input {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}
.quote-lines tr.stock-insufficient td {
  background: #fff0f0 !important;
  border-color: #efb5b5;
}
.quote-lines tr.stock-insufficient .line-qty,
.quote-lines tr.stock-insufficient .line-stock {
  color: #b42318;
  font-weight: 900;
}
.competition-dialog { width: min(820px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 24px 70px rgba(15, 37, 67, .28); }
.competition-dialog::backdrop { background: rgba(10, 28, 52, .55); backdrop-filter: blur(3px); }
.competition-dialog .dialog-head { padding: 20px 22px; color: white; background: linear-gradient(135deg, var(--navy), #183f75); }
.competition-dialog .dialog-head h2 { margin: 3px 0; color: white; }
.competition-dialog .dialog-head p { margin: 0; color: #dce9f8; font-weight: 700; }
.competition-dialog .dialog-head .icon-btn { color: white; border-color: rgba(255,255,255,.3); }
.competition-dialog .dialog-body { padding: 22px; }
.competition-help { margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: #eef7f0; color: #315c3a; }
.competition-overview { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: center; margin: 0 0 20px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.competition-overview label { margin: 0; }
.competition-pie { --value: 0; width: 118px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--value) * 1%), #dfe7ef 0); position: relative; }
.competition-pie::after { content: ""; position: absolute; inset: 14px; border-radius: 50%; background: white; }
.competition-pie span { position: relative; z-index: 1; display: grid; text-align: center; color: var(--navy); }
.competition-pie b { font-size: 20px; }
.competition-pie small { font-size: 10px; color: var(--muted); }
.form-status { min-height: 20px; margin: 10px 0 0; color: var(--navy); font-weight: 700; }
.clearance-alert-dialog { width: min(620px, calc(100vw - 32px)); }
.dashboard-filter { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
.discount-table th:first-child, .discount-table td:first-child { width: 42px; min-width: 42px; max-width: 42px; }
.discount-table th:nth-child(2), .discount-table td:nth-child(2) { width: 105px; min-width: 105px; max-width: 105px; }
@media (max-width: 760px) { .competition-overview { grid-template-columns: 1fr; } .dashboard-filter { grid-template-columns: 1fr 1fr; } }

/* ERP 3.8 - utilisateurs, signature e-mail et analyses */
.quick-create-compact[open] { position: relative; z-index: 80; overflow: visible; }
.quick-create-compact[open] .form-grid { position: relative; z-index: 81; background: white; border-radius: 0 0 14px 14px; }
.quick-create-compact .address-results { z-index: 120; min-width: min(360px, calc(100vw - 48px)); max-height: 320px; }
.competition-documents-panel { min-width: 0; }
.competition-document-list { display: grid; gap: 7px; max-height: 310px; margin-top: 9px; overflow: auto; padding-right: 4px; }
.competition-document-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 11px; border: 1px solid #dfe7ef; border-radius: 10px; background: white; color: var(--navy); text-decoration: none; }
.competition-document-row:hover { border-color: var(--green); background: #f3faf4; }
.competition-document-row span { display: grid; min-width: 0; }
.competition-document-row small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.competition-document-row strong { flex: 0 0 auto; }
.discount-table th:first-child, .discount-table td:first-child { width: 36px; min-width: 36px; max-width: 36px; }
.discount-table th:nth-child(2), .discount-table td:nth-child(2) { width: 72px; min-width: 72px; max-width: 72px; }
.discount-table th:nth-child(3), .discount-table td:nth-child(3) { width: 360px; min-width: 360px; }
.purchase-actions-card { align-items: center; padding: 14px 16px; }
.purchase-actions-card form { margin: 0; }
.purchase-actions-card .btn { min-height: 40px; }
.purchase-reminder-list { grid-column: 1 / -1; display: grid; gap: 8px; margin-top: 6px; }
.purchase-reminder-list article { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 12px; border: 1px solid #f0d38b; border-radius: 11px; background: white; }
.purchase-reminder-list article > div { display: grid; }
@media (max-width: 760px) { .purchase-reminder-list article { align-items: stretch; flex-direction: column; } }
.department-conversion-list { display: grid; gap: 10px; }
.department-conversion-row { display: grid; grid-template-columns: 70px minmax(180px, 1fr) 75px 170px; gap: 12px; align-items: center; }
.department-conversion-row > div { height: 11px; overflow: hidden; border-radius: 999px; background: #e7edf3; }
.department-conversion-row i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--navy), var(--green)); }
.department-conversion-row strong { text-align: right; color: var(--navy); }
.department-conversion-row small { color: var(--muted); }
@media (max-width: 760px) { .department-conversion-row { grid-template-columns: 48px 1fr 65px; } .department-conversion-row small { grid-column: 2 / -1; } }

/* ERP 3.8 - comptes nominatifs et permissions */
.user-management { display: grid; gap: 20px; overflow: hidden; }
.user-create-panel { border: 1px dashed #9fb3c8; border-radius: 12px; background: #f8fbfe; }
.user-create-panel > summary, .permission-details > summary { cursor: pointer; padding: 13px 15px; color: var(--navy); font-weight: 900; }
.user-editor { display: grid; gap: 18px; padding: 18px; }
.user-list-detailed { display: grid; gap: 14px; }
.user-account-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 5px 18px rgba(13,47,104,.06); }
.user-account-card > header,.user-account-card .user-editor > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.user-account-card > header div,.user-account-card .user-editor > header > div:first-child { display: grid; }
.user-account-card > header b,.user-account-card .user-editor > header b { color: var(--navy); font-size: 16px; }
.user-account-card > header small,.user-account-card .user-editor > header small { color: var(--muted); }
.user-identity-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 18px; align-items: end; }
.user-identity-grid > label { min-width: 0; margin: 0; }
.user-identity-grid > label > input,
.user-identity-grid > label > select { width: 100%; min-width: 0; }
.user-identity-grid > .checkbox { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 10px 12px; border: 1px solid #dce5ed; border-radius: 10px; background: #f8fafc; }
.user-identity-grid > .checkbox input { width: auto; }
.permission-fieldset, .permission-details { border: 1px solid #dce5ed; border-radius: 12px; background: #fbfcfd; }
.permission-fieldset { padding: 13px; }
.permission-fieldset legend { padding: 0 7px; color: var(--navy); font-weight: 900; }
.permission-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 12px 14px; }
.permission-grid label { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; border: 1px solid #e0e7ee; border-radius: 9px; background: white; font-size: 12px; font-weight: 700; }
.permission-grid input { width: auto; }
.user-editor-actions { display: flex; justify-content: flex-end; gap: 10px; }
.connection-security { display:grid; gap:16px; }
.connection-security-form { display:grid; grid-template-columns:minmax(260px,1fr) minmax(180px,.45fr) auto; gap:12px; align-items:end; }
.connection-security-form label { display:grid; gap:6px; min-width:0; }
.connection-security-form input { width:100%; }
.connection-security-form small { color:var(--muted); font-size:10px; }
.connection-security-note { margin:0; }
.recovery-codes-card { display:grid; grid-template-columns:minmax(240px,.8fr) minmax(300px,1.2fr) auto; gap:18px; align-items:center; border-color:#efca72; background:#fffaf0; }
.recovery-codes-card h2 { margin:4px 0; }
.recovery-codes-card p { margin:0; color:var(--muted); }
.recovery-code-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.recovery-code-grid code { padding:8px 10px; border:1px solid #ead9ae; border-radius:8px; background:#fff; color:var(--navy); font-weight:850; text-align:center; }
.user-status-stack { display:flex !important; flex-direction:row; flex-wrap:wrap; justify-content:flex-end; gap:6px; }
.security-toggle { border-color:#cce3d0 !important; background:#f1faf3 !important; }
.user-security-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 18px; border-top:1px solid var(--line); background:#f8fafc; }
.user-security-actions > span { color:#607085; font-size:11px; }
.user-security-actions form { display:flex; flex-wrap:wrap; gap:8px; }
.delivery-information-card { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; }
.delivery-information-card .card-head { margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.document-reference-chip { padding: 7px 11px; border-radius: 999px; background: #eef7f0; color: #286934; font-size: 12px; font-weight: 900; white-space: nowrap; }
@media (max-width: 900px) { .permission-grid { grid-template-columns: 1fr 1fr; } .connection-security-form,.recovery-codes-card { grid-template-columns:1fr; } }
@media (max-width: 620px) { .user-identity-grid, .permission-grid, .delivery-information-card { grid-template-columns: 1fr; } .delivery-information-card .span-2 { grid-column: auto; } .delivery-information-card .card-head { align-items: flex-start; } .user-editor-actions,.user-security-actions,.user-security-actions form { align-items: stretch; flex-direction: column; } .recovery-code-grid { grid-template-columns:1fr; } }
@media print { body:has(.recovery-codes-card) .sidebar,body:has(.recovery-codes-card) .topbar,body:has(.recovery-codes-card) .content > :not(.recovery-codes-card) { display:none !important; } body:has(.recovery-codes-card) .recovery-codes-card { box-shadow:none; border:1px solid #999; } }
.email-signature-settings { display: grid; grid-template-columns: minmax(280px,.8fr) minmax(420px,1.2fr); gap: 20px; align-items: start; }
.signature-preview { overflow: auto; padding: 18px; border: 1px solid #dce5ed; border-radius: 12px; background: white; font: 15px/1.52 Calibri,Arial,sans-serif; }
.signature-preview > span { display: block; margin-bottom: 15px; color: var(--muted); font: 700 11px Inter,Arial,sans-serif; text-transform: uppercase; }
@media (max-width: 900px) { .email-signature-settings { grid-template-columns: 1fr; } }
.clearance-stock-alert { margin: 0 18px 18px; }
.code-matrix .inline-form { margin: 0; }
.code-list-dialog { width: min(900px, calc(100vw - 32px)); max-height: 86vh; padding: 0; border: 0; border-radius: 18px; box-shadow: 0 24px 70px rgba(15,37,67,.28); }
.code-list-dialog::backdrop { background: rgba(10,28,52,.55); backdrop-filter: blur(3px); }
.code-list-dialog .dialog-head { padding: 20px 22px; color: white; background: linear-gradient(135deg, var(--navy), #183f75); }
.code-list-dialog .dialog-head h3 { margin: 3px 0; color: white; font-size: 22px; }
.code-list-dialog .dialog-head p { margin: 0; color: #dce9f8; }
.code-list-dialog .dialog-head .icon-btn { color: white; border-color: rgba(255,255,255,.3); }
.code-list-dialog .dialog-body { padding: 20px 22px; }
.code-dialog-check-all { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; font-weight: 800; }
.code-dialog-search { width: 100%; margin-bottom: 12px; }
.code-dialog-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; max-height: 48vh; overflow: auto; padding: 3px; }
.code-dialog-grid label { display: flex; align-items: flex-start; gap: 10px; padding: 11px; border: 1px solid #dbe4ee; border-radius: 10px; background: #f8fafc; cursor: pointer; }
.code-dialog-grid label > input[type="checkbox"],
.code-dialog-check-all > input[type="checkbox"] { width: 16px; min-width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 16px; appearance: auto; }
.code-dialog-grid label[hidden] { display: none !important; }
.code-dialog-grid label:has(input:checked) { border-color: var(--green); background: #eef9f0; }
.code-dialog-grid span, .code-dialog-grid small { display: block; }
.code-dialog-grid small { margin-top: 3px; color: #64748b; }
.code-list-selection > .selection-toolbar { justify-content: flex-end; margin: 0 0 12px; }
.special-order-document-card { overflow: hidden; }
.special-order-lines-table { width: 100%; border-collapse: collapse; }
.special-order-lines-table th,
.special-order-lines-table td { padding: 10px 12px; border-bottom: 1px solid #e4eaf1; text-align: left; vertical-align: top; }
.special-order-lines-table th { background: #f6f8fb; color: #526174; font-size: 11px; text-transform: uppercase; }
.special-order-lines-table .num { text-align: right; }
.special-order-import-grouped { display: grid; grid-template-columns: 1.2fr 2fr 1fr auto; gap: 14px; align-items: end; }
.quote-lines th:nth-child(2),
.quote-lines td:nth-child(2) { width: 21% !important; }
.quote-lines th:nth-child(6),
.quote-lines td:nth-child(6),
.quote-lines th:nth-child(8),
.quote-lines td:nth-child(8) { width: 6% !important; min-width: 82px; }
.special-order-document-link { color: var(--navy); text-decoration: none; }
.special-order-document-link:hover { color: var(--green-dark); text-decoration: underline; }
.replacement-code-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; max-height: 260px; overflow: auto; margin-top: 8px; padding: 3px; }
.replacement-code-grid label { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid #dbe4ee; border-radius: 10px; background: #f8fafc; cursor: pointer; }
.replacement-code-grid label:has(input:checked) { border-color: var(--green); background: #eef9f0; }
.replacement-code-grid span, .replacement-code-grid small { display: block; }
.replacement-code-grid small { margin-top: 2px; color: #64748b; }
@media (max-width: 720px) { .replacement-code-grid, .code-dialog-grid { grid-template-columns: 1fr; } }
.product-editor-visual { display: grid; place-items: center; min-height: 170px; margin-bottom: 18px; padding: 14px; border: 1px solid #dbe4ee; border-radius: 14px; background: linear-gradient(145deg,#f8fafc,#eef3f8); }
.product-editor-visual > span { justify-self: start; color: #64748b; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.product-editor-visual img { display: block; max-width: min(100%,420px); max-height: 190px; object-fit: contain; border-radius: 10px; }
.product-editor-visual small { color: #8190a2; font-weight: 700; }
.nav-parent-group { min-width: 0; }
.nav-parent-line { display: grid; grid-template-columns: minmax(0,1fr) 30px; align-items: center; }
.nav-parent-line .nav-item { min-width: 0; }
.nav-expand { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #9fb1c9; cursor: pointer; transition: transform .18s ease, background .18s ease; }
.nav-expand:hover { color: white; background: rgba(255,255,255,.1); }
.nav-parent-group.open .nav-expand { transform: rotate(180deg); }
.nav-children { display: none; margin: 2px 0 5px 18px; padding-left: 8px; border-left: 1px solid rgba(255,255,255,.13); }
.nav-parent-group.open .nav-children { display: grid; gap: 2px; }
.nav-children .nav-item { padding: 8px 10px; font-size: 12px; }
.nav-children .nav-item span { font-size: 14px; width: 18px; }
.transport-dialog-head p { margin: 5px 0 0; color: #d8e7fb; font-size: 12px; }
.discount-selection-toolbar { justify-content: flex-end; margin: 12px 0; }
.stock-matrix-body tr:first-child th,
.stock-matrix-body tr:first-child td {
  border-top: 0;
}
.stock-journal-editable {
  table-layout: fixed;
  min-width: 920px;
}
.stock-journal-editable th:first-child,
.stock-journal-editable td:first-child {
  width: 190px;
}
.stock-journal-editable th:nth-child(2),
.stock-journal-editable td:nth-child(2) {
  width: 31%;
}
.stock-journal-editable th:nth-child(3),
.stock-journal-editable td:nth-child(3) {
  width: 28%;
  overflow-wrap: anywhere;
}
.stock-journal-editable input {
  min-width: 0;
  width: 100%;
  padding: 7px;
  box-sizing: border-box;
}
.stock-journal-editable td small,
.special-orders-table td small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  white-space: normal;
  overflow-wrap: anywhere;
}
.discount-product-selector details > summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  color: var(--navy);
}
.discount-product-selector details > summary span {
  color: #64748b;
  font-weight: 600;
}
.discount-product-selector form {
  margin-top: 16px;
}
.discount-product-picker-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.discount-product-picker-head input[type="search"] {
  flex: 1;
}
.discount-product-picker-head label {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.discount-product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  max-height: 430px;
  overflow: auto;
  padding: 4px;
}
.discount-product-grid > label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.discount-product-grid > label[hidden] {
  display: none;
}
.discount-product-grid span {
  display: grid;
  min-width: 0;
}
.discount-product-grid small {
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.discount-selector-actions,
.discount-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.discount-rates-form {
  margin-bottom: 18px;
}
.document-lines-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.credit-balance-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.credit-balance-summary > div {
  display: grid;
  gap: 5px;
  padding: 13px 15px;
  border: 1px solid #d9e3ec;
  border-radius: 10px;
  background: #f8fafc;
}
.credit-balance-summary span,
.credit-balance-summary small { color: #64748b; }
.credit-balance-summary strong { color: #0d2f68; font-size: 18px; }
.credit-balance-summary .credit-balance-remaining {
  border-color: #a9d9ad;
  background: #eff9f0;
}
.credit-balance-summary .credit-balance-remaining strong { color: #2f8e3c; }
@media (max-width: 850px) {
  .credit-balance-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-lines-actions { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .credit-balance-summary { grid-template-columns: 1fr; }
}
.special-order-tools-single {
  grid-template-columns: minmax(0, 1fr);
}
.discount-code-dialog {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 25px 70px #0f172a55;
}
.discount-code-dialog::backdrop {
  background: #0f172a80;
  backdrop-filter: blur(2px);
}
.discount-code-dialog > form {
  padding: 22px;
}
@media (max-width: 850px) {
  .discount-product-grid {
    grid-template-columns: 1fr;
  }
  .discount-product-picker-head {
    align-items: stretch;
    flex-direction: column;
  }
}
.compact-comments {
  min-width: 220px;
}
.compact-comments summary {
  cursor: pointer;
  color: #0d2f68;
  font-weight: 700;
}
.compact-comments p {
  margin: 7px 0;
  padding: 7px 9px;
  background: #f8fafc;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.35;
}
.compact-comments textarea {
  width: 100%;
  min-height: 54px;
  margin-top: 7px;
}
.compact-comments .btn {
  margin-top: 5px;
}
.special-orders-table .status-paid {
  display: inline-flex;
  margin-top: 5px;
}
.purchase-special-reminder details {
  flex-basis: 100%;
}
.purchase-special-reminder table .btn {
  white-space: nowrap;
}
.invoice-source-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-left: 4px solid #1f6feb;
  background: #eef6ff;
  margin-bottom: 18px;
}
.invoice-source-notice a {
  color: #1557a8;
}
.invoice-source-notice span {
  color: #425466;
}
.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 20px;
}
.import-main,
.import-help {
  margin: 0;
}
.import-main > p {
  color: #5d6b7c;
  line-height: 1.65;
}
.import-form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}
.file-drop {
  border: 2px dashed #b8c7d9;
  border-radius: 14px;
  padding: 28px;
  background: #f8fbff;
  display: grid;
  gap: 10px;
}
.file-drop span {
  font-weight: 800;
}
.file-drop input {
  padding: 12px;
  background: #fff;
  border: 1px solid #d8e1ec;
  border-radius: 9px;
}
.file-drop small {
  color: #6d7888;
}
.import-help ol {
  padding-left: 22px;
  display: grid;
  gap: 12px;
  line-height: 1.45;
}
.import-help .notice {
  margin-top: 22px;
}
.import-result {
  margin-bottom: 20px;
}
.import-result .kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}
.import-result .kpi strong {
  font-size: 1.55rem;
}
@media (max-width: 900px) {
  .import-layout {
    grid-template-columns: 1fr;
  }
  .invoice-source-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}
.danger-zone {
  border: 1px solid #efb0b0;
  background: #fffafa;
}
.danger-zone h2 {
  color: #a61b1b;
}
.purge-data-form {
  display: flex;
  align-items: end;
  gap: 14px;
  max-width: 760px;
}
.purge-data-form label {
  flex: 1;
}
.purge-data-form input {
  border-color: #dc8f8f;
}
@media (max-width: 700px) {
  .purge-data-form {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Dossier privé du devis : photos, plans et documents. */
.quote-attachments {
  margin-top: 22px;
  overflow: hidden;
}
.attachment-heading {
  align-items: flex-start;
  margin-bottom: 18px;
}
.attachment-heading h2 {
  margin: 3px 0 2px;
}
.attachment-upload-form {
  display: grid;
  grid-template-columns: minmax(300px, 1.5fr) minmax(240px, 1.2fr) auto;
  align-items: end;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dce5ef;
  border-radius: 12px;
  background: #f7f9fc;
}
.attachment-file-field input[type="file"] {
  padding: 8px;
  background: #fff;
}
.attachment-file-field small {
  display: block;
  margin-top: 5px;
  color: #68778a;
  font-size: 0.72rem;
  font-weight: 500;
}
.attachment-submit {
  min-height: 42px;
  white-space: nowrap;
}
.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.attachment-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  min-height: 150px;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 12px;
  background: #fff;
}
.attachment-preview {
  display: grid;
  min-height: 150px;
  place-items: center;
  background: linear-gradient(145deg, #edf2f8, #f8fafc);
  color: #274a78;
  text-decoration: none;
}
.attachment-preview.is-image {
  background: #e8eef5;
}
.attachment-preview img {
  width: 100%;
  height: 100%;
  min-height: 150px;
  object-fit: cover;
}
.attachment-file-icon {
  display: grid;
  width: 58px;
  height: 70px;
  place-items: center;
  border-radius: 7px 7px 12px 7px;
  background: #fff;
  box-shadow: 0 6px 18px rgb(36 66 101 / 12%);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}
.attachment-details {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  padding: 13px;
}
.attachment-details > b {
  overflow: hidden;
  color: #102b4e;
  font-size: 0.87rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-details > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #58697c;
  font-size: 0.78rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.attachment-details > small {
  color: #7a8795;
  font-size: 0.7rem;
}
.attachment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.attachment-category {
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7eff9;
  color: #214f83;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}
.attachment-category.category-photo {
  background: #e7f5ee;
  color: #216849;
}
.attachment-category.category-plan {
  background: #fff2d9;
  color: #85580a;
}
.attachment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.attachment-actions form {
  display: inline-flex;
}
.attachment-empty {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed #c4d2e2;
  border-radius: 12px;
  color: #607188;
  background: #fbfcfe;
}
.attachment-empty > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #e9f0f8;
  color: #24588f;
  font-size: 1.3rem;
}
.attachment-empty div {
  display: grid;
  gap: 3px;
}
.attachment-empty b {
  color: #213b5d;
}
.attachment-empty small {
  line-height: 1.4;
}
@media (max-width: 1100px) {
  .attachment-upload-form {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 650px) {
  .attachment-upload-form {
    grid-template-columns: 1fr;
  }
  .attachment-card {
    grid-template-columns: 88px minmax(0, 1fr);
  }
}

/* ===== JTLM ERP 4.1 — consolidation finale ===== */
.notification-button{position:relative;display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;border:1px solid #dbe3ef;border-radius:12px;background:#fff;color:#0d2f68;text-decoration:none;font-size:21px;flex:0 0 auto;box-shadow:0 2px 9px rgba(13,47,104,.06)}
.notification-button svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.notification-button:hover{border-color:#4fb555;background:#f6fff7}.notification-button b{position:absolute;right:-5px;top:-6px;min-width:20px;height:20px;padding:0 5px;border-radius:10px;background:#d83b3b;color:#fff;font-size:11px;display:flex;align-items:center;justify-content:center;border:2px solid #fff}
.notification-summary{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-bottom:16px}.mini-kpi{background:#fff;border:1px solid #e4e9f1;border-radius:14px;padding:15px 16px;display:flex;justify-content:space-between;align-items:center;box-shadow:0 2px 12px rgba(13,47,104,.04)}.mini-kpi span{font-size:12px;color:#667085;font-weight:700}.mini-kpi b{font-size:22px;color:#0d2f68}
.notification-center{padding:0;overflow:hidden}.notification-row{display:grid;grid-template-columns:12px 1fr auto;gap:13px;align-items:center;padding:15px 18px;border-bottom:1px solid #eef1f5;text-decoration:none;color:inherit}.notification-row:last-child{border-bottom:0}.notification-row:hover{background:#f9fbfd}.notification-row div{display:flex;flex-direction:column;gap:4px}.notification-row small{color:#667085}.notification-dot{width:9px;height:9px;border-radius:50%;background:#7f8c9f}.level-danger .notification-dot{background:#d83b3b}.level-warning .notification-dot{background:#e59a16}.level-info .notification-dot{background:#0d2f68}.notification-open{font-size:12px;color:#0d2f68;font-weight:800}
.procurement-filter{display:flex;align-items:end;gap:12px}.procurement-filter label{flex:1}.procurement-help{margin-bottom:16px}.procurement-group{margin-bottom:16px}.procurement-actions{display:flex;justify-content:flex-end;padding-top:14px}.procurement-qty{width:90px!important;min-width:76px;text-align:right}.procurement-table .row-danger{background:#fff5f5}.procurement-table td,.procurement-table th{white-space:nowrap}.procurement-table td:nth-child(3){white-space:normal;min-width:240px}
.floating-case-trace{margin:0 0 14px auto;width:max-content;display:flex}.trace-flow{display:flex;align-items:stretch;gap:10px;overflow-x:auto;padding:4px 2px 12px}.trace-flow>i{align-self:center;color:#9ba7b7;font-style:normal;font-size:20px}.trace-node{min-width:170px;border:1px solid #dfe6ef;border-radius:14px;padding:14px;background:#fff;text-decoration:none;color:inherit;display:flex;flex-direction:column;gap:5px;box-shadow:0 2px 9px rgba(13,47,104,.04)}a.trace-node:hover{border-color:#4fb555;transform:translateY(-1px)}.trace-node span{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#667085;font-weight:800}.trace-node b{color:#0d2f68;font-size:15px}.trace-node small{color:#667085}.trace-stock{background:#f6fff7;border-color:#bfe6c2}.trace-payment{background:#f4f8ff;border-color:#cbdaf1}.trace-details-grid{display:grid;grid-template-columns:1.3fr 1fr;gap:16px;margin-top:16px}
.global-search{max-width:720px;flex:1}.global-search #searchResults{max-height:min(520px,70vh);overflow:auto}.search-result{grid-template-columns:30px 1fr auto!important;align-items:center}.search-result-icon{width:28px;height:28px;border-radius:8px;background:#f0f4f8;color:#0d2f68;display:flex;align-items:center;justify-content:center;font-weight:900}.search-result em{font-style:normal;font-size:10px;font-weight:800;text-transform:uppercase;color:#8993a4}.search-loading,.search-empty{padding:15px;color:#667085;font-size:13px}
@media(max-width:1100px){.notification-summary{grid-template-columns:repeat(3,1fr)}.trace-details-grid{grid-template-columns:1fr}.topbar-new-document{white-space:nowrap}}
@media(max-width:760px){.topbar{gap:8px;flex-wrap:wrap}.global-search{order:3;flex-basis:100%;max-width:none}.global-search input{width:100%}.topbar-new-document{font-size:0;padding:0;width:42px;height:42px}.topbar-new-document:after{content:'+';font-size:24px}.notification-summary{grid-template-columns:repeat(2,1fr)}.notification-row{grid-template-columns:10px 1fr}.notification-open{display:none}.procurement-filter{align-items:stretch;flex-direction:column}.procurement-filter .btn{width:100%}.trace-flow{scroll-snap-type:x proximity}.trace-node{scroll-snap-align:start;min-width:155px}.page-title{align-items:flex-start}.page-actions{width:100%;display:flex;overflow-x:auto;padding-bottom:3px}.page-actions .btn{white-space:nowrap}.floating-case-trace{width:100%;justify-content:center}.content{padding-left:12px!important;padding-right:12px!important}}
@media(max-width:480px){.notification-summary{grid-template-columns:1fr 1fr;gap:8px}.mini-kpi{padding:11px 12px}.mini-kpi b{font-size:18px}.notification-row{padding:13px 12px}.notification-button{width:40px;height:40px}.menu-toggle{width:40px;height:40px}}

/* ERP 4.1.1 — consolidation responsive + notifications déroulantes */
*, *::before, *::after { box-sizing: border-box; }
img, svg { max-width: 100%; }
input, select, textarea, button { max-width: 100%; }
.form-grid > *, .card-head > *, .page-title > *, .page-actions > *, .dashboard-grid > *, .special-order-import > * { min-width: 0; }

/* Notifications façon réseau social : la cloche ouvre un panneau, sans page dédiée. */
.notification-popover { position: relative; flex: 0 0 auto; }
.notification-button { cursor: pointer; }
.notification-button[aria-expanded="true"] { border-color: var(--green); background: #f4fbf5; box-shadow: 0 0 0 3px rgba(79,181,85,.12); }
.notification-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(410px, calc(100vw - 28px));
  max-height: min(610px, calc(100vh - 96px));
  overflow: hidden;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(13,47,104,.20);
  z-index: 80;
}
.notification-panel[hidden] { display: none !important; }
.notification-panel-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:15px 16px; border-bottom:1px solid #e8edf3; background:#fff; }
.notification-panel-head > div { display:grid; gap:2px; min-width:0; }
.notification-panel-head strong { font-size:17px; color:var(--navy); }
.notification-panel-head small { color:var(--muted); font-size:11px; }
.notification-close { width:34px; height:34px; border:0; border-radius:9px; background:#f1f4f7; color:var(--navy); font-size:22px; line-height:1; cursor:pointer; }
.notification-panel-list { max-height:min(525px, calc(100vh - 170px)); overflow-y:auto; overscroll-behavior:contain; }
.notification-item { display:grid; grid-template-columns:10px minmax(0,1fr) auto; gap:11px; align-items:center; padding:13px 15px; color:inherit; text-decoration:none; border-bottom:1px solid #eef2f5; }
.notification-item:last-child { border-bottom:0; }
.notification-item:hover { background:#f8fafc; }
.notification-item > span:nth-child(2) { display:grid; gap:3px; min-width:0; }
.notification-item b { font-size:13px; color:var(--ink); line-height:1.3; }
.notification-item small { color:var(--muted); font-size:11px; line-height:1.35; white-space:normal; overflow-wrap:anywhere; }
.notification-item i { font-style:normal; color:#93a0b1; font-size:22px; }
.notification-empty { display:grid; gap:4px; padding:28px 18px; text-align:center; }
.notification-empty b { color:var(--navy); }
.notification-empty span { color:var(--muted); font-size:12px; }

/* Les tableaux denses restent des tableaux et se parcourent horizontalement sur tablette/mobile. */
.table-wrap { max-width:100%; overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch; scrollbar-gutter:stable; }
.dashboard-grid .table-wrap table { min-width:720px; }
.product-selection-form .table-wrap { border-radius:0 0 14px 14px; }

/* Lignes produits de devis : même logique que les BC, pas de cartes éclatées en responsive. */
@media (max-width: 1100px) {
  .document-lines-card .table-wrap { margin-inline:0; padding-bottom:4px; }
  .quote-lines { display:table !important; width:100% !important; min-width:1450px !important; table-layout:auto; }
  .quote-lines thead { display:table-header-group !important; }
  .quote-lines tbody { display:table-row-group !important; padding:0 !important; }
  .quote-lines tbody tr { display:table-row !important; margin:0 !important; padding:0 !important; border:0 !important; border-radius:0 !important; background:transparent !important; }
  .quote-lines td { display:table-cell !important; width:auto; padding:8px 6px !important; border-bottom:1px solid var(--line) !important; text-align:inherit !important; vertical-align:middle; }
  .quote-lines td::before { display:none !important; content:none !important; }
  .quote-lines td:nth-child(2) { min-width:230px; }
  .quote-lines td:nth-child(13), .quote-lines td:nth-child(14) { width:auto !important; }
  .quote-lines .num { padding:8px 6px !important; border-radius:0 !important; background:transparent !important; }
}

/* Mobile / tablette : aucune largeur fantôme et des actions cohérentes. */
@media (max-width: 780px) {
  .topbar { height:auto; min-height:72px; padding:10px 12px; gap:8px; flex-wrap:wrap; }
  .menu-toggle { flex:0 0 42px; height:42px; border:1px solid #dbe3ef; border-radius:10px; background:#fff; }
  .notification-popover { margin-left:auto; }
  .global-search { order:3; flex:1 0 100%; width:100%; max-width:none; }
  .global-search #searchResults { top:48px; max-height:55vh; }
  .content { width:100%; max-width:100%; padding:16px 10px !important; overflow-x:hidden; }
  .card { padding:15px; border-radius:13px; margin-bottom:14px; }
  .page-title { gap:12px; margin-bottom:16px; }
  .page-title h1 { font-size:26px; line-height:1.04; overflow-wrap:anywhere; }
  .page-actions { display:grid !important; grid-template-columns:repeat(2,minmax(0,1fr)); width:100%; gap:8px; overflow:visible !important; }
  .page-actions > .btn, .page-actions > form, .page-actions > form .btn { width:100%; min-height:42px; white-space:normal !important; text-align:center; }
  .page-actions .coefficient-titlebar { width:100%; min-height:42px; }
  .page-actions .case-trace-action { grid-column:1/-1; }
  .card-head { align-items:flex-start; flex-wrap:wrap; }
  .card-head > a, .card-head > .btn { flex:0 0 auto; }
  .card-head h2 { line-height:1.2; }
  .dashboard-grid .card-head a { white-space:nowrap; font-size:12px; }
  .dashboard-grid .card { overflow:hidden; }
  .dashboard-grid .table-wrap { margin-inline:-15px; padding-inline:15px; }
  .document-lines-card { overflow:hidden; }
  .document-lines-card .card-head { align-items:center; }
  .document-lines-card .card-head > div { flex:1 1 220px; }
  .quote-line-tools { width:100%; display:grid; grid-template-columns:1fr auto; gap:8px; align-items:stretch; }
  .quote-total-weight { width:auto !important; margin:0 !important; justify-content:center; }
  .special-order-import, .special-order-import-grouped { width:100%; min-width:0; }
  .special-order-import select, .special-order-import input, .special-order-import .btn { width:100% !important; min-width:0 !important; }
  .special-order-tools, .special-order-tools-compact, .special-order-tools-detailed { min-width:0; max-width:100%; overflow:hidden; }
  .stock-view-tabs, .special-order-tabs, .tabs { max-width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .stock-view-tabs a, .special-order-tabs a, .tabs a, .tabs button { flex:0 0 auto; white-space:nowrap; }
  .product-bulk-toolbar { display:grid; grid-template-columns:1fr; }
  .product-bulk-toolbar b, .product-bulk-toolbar select, .product-bulk-toolbar input, .product-bulk-toolbar .btn { width:100% !important; min-width:0 !important; margin:0; }
}

@media (max-width: 520px) {
  .page-actions { grid-template-columns:1fr 1fr; }
  .page-actions .coefficient-titlebar, .page-actions .case-trace-action { grid-column:1/-1; }
  .btn { min-height:40px; }
  .notification-panel { position:fixed; top:66px; left:10px; right:10px; width:auto; max-height:calc(100vh - 78px); border-radius:14px; }
  .notification-panel-list { max-height:calc(100vh - 145px); }
  .dashboard-kpis { gap:10px; }
  .dashboard-kpis .kpi { min-height:104px; padding:14px; }
  .dashboard-kpis .kpi strong { font-size:25px; }
  .document-lines-card .card-head > .btn { width:100%; }
  .quote-line-tools { grid-template-columns:1fr; }
  .quote-line-tools .btn, .quote-total-weight { width:100% !important; }
}

/* ========================================================================== 
   JTLM ERP 4.1.2 — responsive transversal final
   Référence UX : lignes des bons de commande.
   ========================================================================== */

/* Devis / factures : toujours conserver un vrai tableau transversal.
   On neutralise les anciennes règles qui comprimaient ou transformaient les lignes. */
.document-lines-card {
  overflow: hidden;
}
.document-lines-card .table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: 4px;
}
.quote-lines,
.document-lines-card .quote-lines {
  display: table !important;
  width: 100% !important;
  min-width: 1450px !important;
  table-layout: auto !important;
  font-size: 11px;
}
.quote-lines thead { display: table-header-group !important; }
.quote-lines tbody { display: table-row-group !important; padding: 0 !important; }
.quote-lines tr,
.quote-lines tbody tr {
  display: table-row !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}
.quote-lines th,
.quote-lines td {
  display: table-cell !important;
  width: auto !important;
  min-width: 92px !important;
  max-width: none !important;
  padding: 8px 6px !important;
  vertical-align: middle !important;
  border-bottom: 1px solid var(--line) !important;
  text-align: center !important;
}
.quote-lines th { white-space: normal !important; line-height: 1.2; }
.quote-lines td::before { display: none !important; content: none !important; }
.quote-lines th:nth-child(1), .quote-lines td:nth-child(1) { min-width: 105px !important; }
.quote-lines th:nth-child(2), .quote-lines td:nth-child(2) { min-width: 245px !important; text-align:left !important; }
.quote-lines th:nth-child(3), .quote-lines td:nth-child(3) { min-width: 90px !important; }
.quote-lines th:nth-child(4), .quote-lines td:nth-child(4) { min-width: 105px !important; }
.quote-lines th:nth-child(5), .quote-lines td:nth-child(5) { min-width: 95px !important; }
.quote-lines th:nth-child(6), .quote-lines td:nth-child(6) { min-width: 110px !important; }
.quote-lines th:nth-child(7), .quote-lines td:nth-child(7) { min-width: 90px !important; }
.quote-lines th:nth-child(8), .quote-lines td:nth-child(8) { min-width: 110px !important; }
.quote-lines th:nth-child(9), .quote-lines td:nth-child(9),
.quote-lines th:nth-child(10), .quote-lines td:nth-child(10) { min-width: 110px !important; }
.quote-lines th:nth-child(11), .quote-lines td:nth-child(11) { min-width: 115px !important; }
.quote-lines th:nth-child(12), .quote-lines td:nth-child(12) { min-width: 105px !important; }
.quote-lines th:nth-child(13), .quote-lines td:nth-child(13) { min-width: 50px !important; width: 50px !important; }
.quote-lines input,
.quote-lines .line-code,
.quote-lines .line-designation,
.quote-lines .line-qty {
  display: block;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}
.quote-lines .num {
  display: table-cell !important;
  white-space: nowrap !important;
  background: transparent !important;
  border-radius: 0 !important;
}

/* Gestion des stocks : comportement transversal identique aux BC.
   Les colonnes Description et Date ne sont plus figées : elles défilent avec le reste. */
.stock-matrix-header-wrap,
.stock-matrix-body-wrap,
.stock-matrix-wrap {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.stock-matrix-header-wrap { overflow-x: hidden !important; }
.stock-matrix-body-wrap { overflow-x: auto !important; }
.stock-matrix th:first-child,
.stock-matrix td:first-child,
.stock-matrix th:nth-child(2),
.stock-matrix td:nth-child(2),
.stock-matrix-header thead th:first-child,
.stock-matrix-header thead th:nth-child(2) {
  position: static !important;
  left: auto !important;
  right: auto !important;
  z-index: auto !important;
}
/* La matrice garde ses vraies largeurs au lieu de se comprimer sur tablette. */
.stock-matrix { table-layout: fixed !important; }
.stock-matrix .matrix-description-col { width: 260px !important; }
.stock-matrix .matrix-date-col { width: 220px !important; }
.stock-matrix .matrix-product-col { width: 150px !important; }
.stock-matrix th:first-child,
.stock-matrix td:first-child { width:260px !important; min-width:260px !important; max-width:260px !important; }
.stock-matrix th:nth-child(2),
.stock-matrix td:nth-child(2) { width:220px !important; min-width:220px !important; max-width:220px !important; }

/* Pièces jointes : aucune colonne ne doit sortir de la carte sur tablette. */
.attachment-upload-form > * { min-width: 0 !important; max-width: 100% !important; }
.attachment-upload-form input,
.attachment-upload-form textarea,
.attachment-upload-form select,
.attachment-upload-form .btn { width: 100% !important; min-width: 0 !important; max-width: 100% !important; }
@media (max-width: 960px) {
  .attachment-upload-form { grid-template-columns: 1fr !important; align-items: stretch !important; }
  .attachment-submit { width:100% !important; }
}

/* Notifications : panneau réellement au-dessus de l'ERP sur tablette/mobile,
   sans être masqué ou décalé par la sidebar. */
.notification-panel { z-index: 2000 !important; }
@media (max-width: 900px) {
  .notification-panel {
    position: fixed !important;
    top: 72px !important;
    right: 12px !important;
    left: auto !important;
    width: min(420px, calc(100vw - 24px)) !important;
    max-height: calc(100vh - 84px) !important;
    border-radius: 15px !important;
  }
  .notification-panel-list { max-height: calc(100vh - 150px) !important; }
}
@media (max-width: 560px) {
  .notification-panel {
    top: 68px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-height: calc(100vh - 76px) !important;
  }
}

/* ========================================================================== 
   JTLM ERP 4.2.0 — responsive tablette / téléphone
   Desktop > 1180 px : aucune modification de la mise en page existante.
   Tablette 641–1180 px : largeur utile complète + navigation hors-canvas.
   Téléphone <= 640 px : empilement progressif sans casser les tableaux denses.
   ========================================================================== */

/* ---------- TABLETTE : coque générale et navigation ---------- */
@media (max-width: 1180px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  .sidebar {
    width: min(290px, 86vw);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 18px 0 50px rgba(7,29,66,.24);
    z-index: 1200;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    border: 0;
    padding: 0;
    background: rgba(7,29,66,.38);
    backdrop-filter: blur(1.5px);
    z-index: 1190;
  }
  body.sidebar-open {
    overflow: hidden;
  }
  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .main {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }
  .menu-toggle {
    display: inline-grid;
    place-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
  }
  .topbar {
    width: 100%;
    min-width: 0;
    padding-inline: 18px;
    gap: 12px;
  }
  .global-search {
    min-width: 0;
    max-width: none;
  }
  .content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 22px 18px;
  }

  /* Chaque enfant de grille/flex doit pouvoir réellement rétrécir. */
  .content > *,
  .card,
  .card > *,
  .form-grid > *,
  .document-head > *,
  .dashboard-grid > *,
  .analysis-grid > *,
  .planning-layout > *,
  .stock-workspace > *,
  .page-title > *,
  .card-head > * {
    min-width: 0;
    max-width: 100%;
  }

  /* Les grands tableaux gardent leur vraie largeur et se déplacent au doigt. */
  .table-wrap,
  .document-lines-card .table-wrap,
  .purchase-lines-card .table-wrap,
  .stock-matrix-body-wrap,
  .stock-matrix-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
  }
  .table-wrap > table,
  .document-lines-card table,
  .purchase-lines-card table,
  .stock-matrix-body-wrap table {
    max-width: none;
  }
  .quote-lines { min-width: 1450px !important; }
  .purchase-lines { min-width: 1250px !important; }
  .price-list-table { min-width: 1500px !important; }
  .ratio-table { min-width: 1450px !important; }
  .stock-journal-editable { min-width: 920px !important; }

  /* Filtres : ils se recomposent au lieu de déborder. */
  .stock-matrix-filter,
  .ratio-filter {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
  }
  .stock-matrix-filter label,
  .ratio-filter label,
  .period-filter label,
  .analysis-controls label {
    min-width: 0;
  }
  .stock-matrix-filter input,
  .stock-matrix-filter select,
  .ratio-filter input,
  .ratio-filter select {
    width: 100%;
    min-width: 0;
  }

  .stock-matrix-help {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .stock-matrix-legend {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .stock-matrix-legend span {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .stock-matrix-header-wrap,
  .stock-matrix-body-wrap {
    width: 100%;
    max-width: 100%;
  }

  /* Zones d'actions : retour à la ligne propre sans largeur fantôme. */
  .page-actions,
  .purchase-actions,
  .document-logistics-actions,
  .row-actions,
  .selection-toolbar {
    max-width: 100%;
  }
  .page-actions .btn,
  .page-actions form,
  .page-actions form .btn {
    min-width: 0;
  }

  /* Les formulaires longs ne peuvent jamais agrandir la page. */
  input,
  select,
  textarea,
  button,
  .btn {
    max-width: 100%;
  }
  .special-order-import-grouped,
  .special-order-tools,
  .special-order-tools-compact,
  .special-order-tools-detailed {
    min-width: 0;
    max-width: 100%;
  }

  /* Dialogues adaptés à la hauteur réelle de l'écran tablette. */
  .transport-dialog,
  .schedule-dialog,
  .competition-dialog,
  .code-list-dialog,
  .discount-code-dialog,
  .erp-confirm-dialog {
    max-width: calc(100vw - 28px);
    max-height: calc(100dvh - 28px);
  }
}

/* ---------- TABLETTE PORTRAIT / PETIT PAYSAGE ---------- */
@media (max-width: 1024px) {
  .page-title {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-actions {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    width: 100%;
    gap: 8px;
    overflow: visible !important;
  }
  .page-actions > .btn,
  .page-actions > form,
  .page-actions > form .btn,
  .page-actions .coefficient-titlebar {
    width: 100%;
    min-height: 42px;
  }

  .filterbar,
  .stock-filter,
  .period-filter,
  .analysis-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
  }
  .filterbar > *,
  .stock-filter > *,
  .period-filter > *,
  .analysis-controls > * {
    width: 100%;
    min-width: 0 !important;
  }
  .filterbar input {
    min-width: 0;
  }
  .period-filter .btn,
  .analysis-controls .btn {
    grid-column: auto;
  }

  .special-order-import-grouped {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .special-order-import-grouped > .btn,
  .special-order-import-grouped > div:last-child {
    min-width: 0;
  }

  .po-complements,
  .backup-actions {
    grid-template-columns: 1fr;
  }

  .invoice-source-notice,
  .outlook-sync-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* iPad / tablette : conserver deux vraies colonnes tant que la place existe.
   Ces règles neutralisent l'ancien basculement prématuré à 780 px. */
@media (min-width: 641px) and (max-width: 1180px) {
  .form-grid,
  .document-head {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .form-grid .span-2,
  .document-head .span-2 {
    grid-column: 1 / -1 !important;
  }
  .kpi-grid,
  .kpi-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .customer-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .three-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- BARRE SUPÉRIEURE TABLETTE ---------- */
@media (max-width: 900px) {
  .topbar {
    height: auto;
    min-height: 72px;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .notification-popover {
    margin-left: auto;
  }
  .topbar-new-document {
    display: inline-flex !important;
    flex: 0 0 auto;
  }
  .global-search {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
  }
  .global-search input {
    width: 100%;
  }
  .global-search #searchResults {
    top: 48px;
    max-height: 55dvh;
  }

  .notification-panel {
    top: 68px !important;
  }

  .stock-matrix-filter,
  .ratio-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .card-head > div:first-child {
    flex: 1 1 260px;
  }

  .dashboard-grid .table-wrap {
    margin-inline: 0;
    padding-inline: 0;
  }

  .discount-categories-edit,
  .discount-category-row {
    max-width: 100%;
  }
}

/* ---------- TÉLÉPHONE ---------- */
@media (max-width: 640px) {
  .content {
    padding: 14px 9px !important;
  }
  .card {
    padding: 14px;
    margin-bottom: 12px;
    border-radius: 12px;
  }
  .page-title h1 {
    font-size: 24px;
    line-height: 1.08;
  }
  .page-title p {
    line-height: 1.4;
  }

  .topbar-new-document {
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 0;
  }
  .topbar-new-document::after {
    content: "+";
    font-size: 24px;
    line-height: 1;
  }

  .form-grid,
  .document-head,
  .kpi-grid,
  .kpi-grid.compact,
  .three-columns,
  .backup-actions,
  .po-complements,
  .special-order-import-grouped,
  .stock-matrix-filter,
  .ratio-filter,
  .filterbar,
  .stock-filter,
  .period-filter,
  .analysis-controls {
    grid-template-columns: 1fr !important;
  }
  .form-grid .span-2,
  .document-head .span-2,
  .period-filter .btn,
  .analysis-controls .btn,
  .stock-filter label:nth-child(3),
  .stock-filter button {
    grid-column: auto !important;
  }

  .page-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-actions .coefficient-titlebar,
  .page-actions .case-trace-action,
  .page-actions .top-document-convert {
    grid-column: 1 / -1;
  }
  .page-actions > .btn,
  .page-actions > form .btn {
    white-space: normal !important;
    text-align: center;
  }

  .card-head > .btn,
  .card-head > a.btn,
  .document-logistics-actions,
  .document-logistics-actions .btn,
  .purchase-actions .btn,
  .selection-toolbar .btn {
    width: 100%;
  }
  .document-logistics-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stock-matrix-help {
    padding: 12px;
  }
  .stock-matrix-legend {
    width: 100%;
  }
  .stock-matrix .matrix-description-col,
  .stock-matrix th:first-child,
  .stock-matrix td:first-child {
    width: 220px !important;
    min-width: 220px !important;
    max-width: 220px !important;
  }
  .stock-matrix .matrix-date-col,
  .stock-matrix th:nth-child(2),
  .stock-matrix td:nth-child(2) {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
  }

  .transport-dialog,
  .schedule-dialog,
  .competition-dialog,
  .code-list-dialog,
  .discount-code-dialog {
    width: calc(100vw - 12px) !important;
    max-width: calc(100vw - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
    border-radius: 14px;
  }
  .transport-dialog-head,
  .schedule-dialog-head,
  .code-list-dialog .dialog-head {
    padding: 16px;
  }
  .transport-dialog section,
  .transport-map-actions,
  .transport-dialog-actions,
  .schedule-dialog > form,
  .code-list-dialog .dialog-body {
    margin-inline: 10px;
    padding-inline: 12px;
  }

  .attachment-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .attachment-preview {
    min-width: 0;
  }

  .trace-flow,
  .tabs,
  .document-tabs,
  .stock-view-tabs,
  .special-order-tabs {
    scrollbar-width: thin;
  }
}

/* Très petit téléphone : les actions passent sur une seule colonne. */
@media (max-width: 430px) {
  .page-actions {
    grid-template-columns: 1fr;
  }
  .page-actions .coefficient-titlebar,
  .page-actions .case-trace-action,
  .page-actions .top-document-convert {
    grid-column: auto;
  }
  .notification-panel {
    left: 6px !important;
    right: 6px !important;
  }
}

/* ========================================================================== 
   JTLM ERP 4.2.1 — ajustements responsive + stock + export analyses
   ========================================================================== */

/* Nouveau devis : aligner le sélecteur de fichier et le commentaire sur PC/tablette. */
.attachment-upload-form {
  align-items: start;
}
.attachment-file-field,
.attachment-note-field {
  align-self: start;
}
.attachment-submit {
  align-self: start;
  margin-top: 22px;
}
@media (max-width: 960px) {
  .attachment-submit { margin-top: 0; }
}

/* Journal détaillé : le titre du bloc État du stock ne colle plus au bord. */
.stock-current > h2 {
  margin: 0;
  padding: 20px 20px 14px;
}

/* Réservations éditables et actions de ligne de la matrice de stock. */
.matrix-row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.matrix-row-heading .matrix-row-description {
  flex: 1 1 auto;
  min-width: 0;
}
.matrix-row-delete {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  margin: 0 !important;
}
.reservation-quantity-edit {
  display: grid;
  grid-template-columns: auto minmax(70px, 1fr);
  align-items: center;
  gap: 4px;
  width: 100%;
}
.reservation-quantity-edit > b {
  color: #a05f00;
  font-size: 15px;
}
.stock-journal-editable .reservation-quantity-edit {
  min-width: 110px;
}

/* Export analyses. */
.analysis-export-form {
  display: inline-flex;
  margin: 0;
}
.analysis-export-form .btn {
  width: auto;
}
.analysis-export-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 16px;
  padding: 11px 14px;
  border: 1px solid #d9e5f2;
  border-radius: 11px;
  background: #f7faff;
  color: #526276;
  font-size: 12px;
}
.analysis-export-note b {
  flex: 0 0 auto;
  color: var(--navy);
}

/* Tablette : les 4 KPI du tableau de bord restent sur une seule ligne. */
@media (min-width: 641px) and (max-width: 1180px) {
  .dashboard-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .dashboard-kpis .kpi {
    min-width: 0;
    padding: 12px 10px;
  }
  .dashboard-kpis .kpi span,
  .dashboard-kpis .kpi small {
    font-size: 10px;
    line-height: 1.25;
  }
  .dashboard-kpis .kpi strong {
    font-size: clamp(18px, 2.4vw, 25px);
    line-height: 1.1;
    white-space: nowrap;
  }
}

/* PC uniquement : garder la colonne Description visible pendant le scroll horizontal.
   La tablette et le téléphone restent totalement transversaux comme demandé. */
@media (min-width: 1181px) {
  .stock-matrix-header thead th:first-child,
  .stock-matrix-body th:first-child,
  .stock-matrix-body td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 9 !important;
    box-shadow: 2px 0 5px rgba(13, 47, 104, .08);
  }
  .stock-matrix-header thead th:first-child {
    background: #e9eff5 !important;
    z-index: 12 !important;
  }
  .stock-matrix-body .matrix-physical-row > :first-child { background: #f4f7fb !important; }
  .stock-matrix-body .matrix-reserved-row > :first-child { background: #fff8ec !important; }
  .stock-matrix-body .matrix-stock-row > :first-child { background: #fff8da !important; }
  .stock-matrix-body .matrix-reservation > :first-child { background: #fff5d9 !important; }
  .stock-matrix-body .matrix-purchase > :first-child { background: #eaf3ff !important; }
  .stock-matrix-body .matrix-invoice > :first-child { background: #eaf8ed !important; }
  .stock-matrix-body .matrix-movement > :first-child { background: #f6f7f8 !important; }
}

@media (max-width: 640px) {
  .analysis-export-note {
    align-items: flex-start;
    flex-direction: column;
  }
  .analysis-export-form,
  .analysis-export-form .btn {
    width: 100%;
  }
}


/* ==========================================================================
   JTLM ERP 4.2.2 — correctifs pièces jointes, stock et export Excel
   ========================================================================== */

/* Pièces jointes : le bouton est aligné exactement sur la ligne des champs. */
.attachment-file-field,
.attachment-note-field,
.attachment-submit-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: normal;
  color: #596576;
}
.attachment-submit-field {
  align-self: start;
}
.attachment-action-label {
  visibility: hidden;
  font: inherit;
  line-height: inherit;
}
.attachment-submit {
  align-self: stretch;
  margin-top: 0 !important;
}

/* Stock > Journal détaillé : le tableau État du stock peut défiler verticalement. */
.stock-summary-table {
  max-height: 520px;
  overflow-x: auto !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
}

@media (max-width: 640px) {
  .attachment-action-label { display: none; }
  .attachment-submit-field { width: 100%; }
}

/* ==========================================================================
   JTLM ERP 4.2.3 — réglages commerciaux et éditeur d'e-mails
   ========================================================================== */

/* Entête : la marque est déjà présente dans la barre latérale. */
.topbar::before { content: none !important; display: none !important; }

/* Paramètres > observations enregistrées. */
.observation-settings-form {
  display: grid;
  gap: 16px;
}
.observation-setting-list {
  display: grid;
  gap: 10px;
}
.observation-setting-row {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(360px, 1.7fr) 38px;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #f8fafc;
}
.observation-setting-row label {
  display: grid;
  gap: 6px;
}
.observation-setting-row textarea {
  min-height: 78px;
  resize: vertical;
}
.observation-setting-row .observation-remove {
  margin-top: 24px;
}
.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* Paramètres > modèles d'e-mails. */
.email-template-list {
  display: grid;
  gap: 12px;
}
.email-template-card {
  overflow: hidden;
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  background: #fff;
}
.email-template-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  background: #f8fafc;
  color: var(--navy);
}
.email-template-card > summary::-webkit-details-marker { display: none; }
.email-template-card > summary span {
  display: grid;
  gap: 3px;
}
.email-template-card > summary small {
  color: var(--muted);
  font-weight: 500;
}
.email-template-card > summary i {
  font-style: normal;
  font-size: 22px;
  transition: transform .18s ease;
}
.email-template-card[open] > summary i { transform: rotate(90deg); }
.email-template-editor-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}
.email-template-editor-body > label {
  display: grid;
  gap: 6px;
}
.rich-mail-editor {
  overflow: hidden;
  border: 1px solid #cfd9e6;
  border-radius: 11px;
  background: #fff;
}
.rich-mail-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px;
  border-bottom: 1px solid #dbe4ef;
  background: #f6f8fb;
}
.rich-mail-toolbar > button,
.rich-color-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #d6dfeb;
  border-radius: 7px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.rich-mail-toolbar > button:hover,
.rich-color-control:hover { border-color: #9fb2c9; background: #f9fbfd; }
.rich-color-control {
  position: relative;
  gap: 5px;
  overflow: hidden;
}
.rich-color-control input[type="color"] {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.rich-mail-surface {
  min-height: 260px;
  padding: 18px;
  outline: 0;
  overflow: auto;
  color: #202124;
  font-family: Calibri, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.52;
  background: #fff;
}
.rich-mail-surface:focus {
  box-shadow: inset 0 0 0 2px rgb(79 181 85 / 18%);
}
.rich-mail-surface p:first-child { margin-top: 0; }
.rich-mail-surface p:last-child { margin-bottom: 0; }
.email-template-tokens {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.email-template-tokens > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.email-template-tokens button {
  border: 1px solid #d8e2ee;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f7faff;
  color: #315b89;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.email-template-settings .settings-actions { margin-top: 14px; }

/* Pièces jointes : labels et bouton sur une même ligne de saisie. */
.attachment-upload-form { align-items: start !important; }
.attachment-field-label,
.attachment-action-label {
  display: flex;
  align-items: center;
  min-height: 18px;
  line-height: 18px !important;
}
.attachment-action-label { visibility: hidden; }
.attachment-submit-field { align-self: start !important; }

@media (max-width: 900px) {
  .observation-setting-row {
    grid-template-columns: minmax(180px, .8fr) minmax(260px, 1.5fr) 38px;
  }
}
@media (max-width: 640px) {
  .observation-setting-row { grid-template-columns: 1fr 38px; }
  .observation-setting-row label:first-child,
  .observation-setting-row label:nth-child(2) { grid-column: 1; }
  .observation-setting-row .observation-remove { grid-column: 2; grid-row: 1; margin-top: 24px; }
  .settings-actions,
  .settings-actions .btn { width: 100%; }
  .settings-actions { display: grid; }
  .rich-mail-surface { min-height: 220px; padding: 14px; }
}

/* Pièces jointes : sur tablette, les 3 contrôles restent sur la même rangée. */
@media (min-width: 641px) and (max-width: 1180px) {
  .attachment-upload-form {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) auto !important;
    gap: 10px;
  }
  .attachment-upload-form > * { min-width: 0; }
  .attachment-submit { min-width: 132px; }
}

/* ========================================================================== 
   JTLM ERP 4.2.4 — entête PC, e-mails et signature
   ========================================================================== */

/* Sur PC, la recherche prend tout l'espace disponible entre le menu et les actions. */
@media (min-width: 1181px) {
  .topbar .global-search {
    flex: 1 1 auto;
    width: auto;
    max-width: none !important;
  }
  .topbar .notification-popover,
  .topbar .topbar-new-document {
    flex: 0 0 auto;
  }
}

/* L'ancienne signature texte a été retirée : un seul aperçu, sans colonne parasite. */
.email-signature-settings-preview-only {
  grid-template-columns: minmax(0, 1fr) !important;
  max-width: 780px;
}
.email-signature-settings-preview-only .signature-preview {
  width: 100%;
  box-sizing: border-box;
}
.signature-account-note {
  margin: 0;
}

/* Liens visibles dans l'éditeur comme dans Outlook. */
.rich-mail-surface a {
  color: #005bbb;
  text-decoration: underline;
}
.rich-mail-toolbar .rich-link-button {
  min-width: 70px;
}

/* ========================================================================== 
   JTLM ERP 4.2.5 — éditeur mails, paramètres compacts et responsive
   ========================================================================== */

/* Editeur riche : listes, retraits / tabulations et paragraphes automatiques. */
.rich-mail-toolbar > button[data-rich-command="insertUnorderedList"],
.rich-mail-toolbar > button[data-rich-command="insertOrderedList"] {
  min-width: 70px;
}
.rich-mail-toolbar > button[data-rich-command="indent"],
.rich-mail-toolbar > button[data-rich-command="outdent"] {
  min-width: 38px;
  font-size: 18px;
}
.rich-mail-surface ul,
.rich-mail-surface ol,
.followup-history-message ul,
.followup-history-message ol {
  margin: 8px 0 8px 25px;
  padding-left: 18px;
}
.rich-mail-surface li,
.followup-history-message li { margin: 4px 0; }
.rich-mail-surface blockquote,
.followup-history-message blockquote {
  margin: 8px 0 8px 30px;
  padding-left: 12px;
  border-left: 3px solid #d7e0eb;
}
.rich-mail-surface-compact { min-height: 120px; }
.email-special-paragraphs {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e1e7ef;
}
.email-special-heading { grid-column: 1/-1; }
.email-special-heading h3 { margin: 0 0 5px; color: var(--navy); }
.email-special-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.email-special-card {
  min-width: 0;
  border: 1px solid #dce4ee;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.email-special-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  background: #f7f9fc;
  border-bottom: 1px solid #e2e8f0;
}
.email-special-card-head b { color: var(--navy); }
.email-special-card-head code {
  font-size: 10px;
  color: #315b89;
  background: #eaf1f9;
  padding: 4px 7px;
  border-radius: 999px;
}
.followup-rich-field { display: grid; gap: 7px; }
.followup-rich-field > span { font-weight: 700; font-size: 12px; color: #344054; }
.followup-rich-surface { min-height: 270px; }
.followup-history-message {
  color: #3b4655;
  font-size: 13px;
  line-height: 1.5;
}
.followup-history-message p { margin: 6px 0; }

/* Signature : réglage direct des liens cliquables des réseaux sociaux. */
.signature-social-form {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr)) auto;
  gap: 10px;
  align-items: end;
  width: 100%;
}
.signature-social-form label { display: grid; gap: 5px; min-width: 0; }
.signature-social-form input { width: 100%; min-width: 0; }
.signature-social-form .btn { min-height: 42px; white-space: nowrap; }

/* Paramètres : chaque gros bloc devient un panneau compact ouvrable au clic. */
.settings-accordion { min-width: 0; }
.settings-finder {
  position: sticky;
  top: 72px;
  z-index: 35;
  display: grid;
  gap: 9px;
  margin: 0 0 14px;
  padding: 11px;
  border: 1px solid #dce4ee;
  border-radius: 13px;
  background: rgba(247,249,252,.97);
  box-shadow: 0 7px 22px rgba(13,47,104,.07);
  backdrop-filter: blur(7px);
}
.settings-finder-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.settings-finder-search > span { font-size: 20px; color: var(--navy); }
.settings-finder-search input {
  width: 100%;
  min-width: 0;
  height: 40px;
  border: 1px solid #d4ddea;
  border-radius: 9px;
  padding: 0 12px;
  background: #fff;
}
.settings-jumpbar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.settings-jumpbar button {
  flex: 0 0 auto;
  border: 1px solid #d8e2ee;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  color: #315b89;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.settings-jumpbar button:hover { border-color: var(--green); color: var(--navy); }
.settings-accordion > .settings-panel {
  padding: 0 !important;
  overflow: hidden;
  scroll-margin-top: 180px;
}
.settings-accordion > .settings-panel:not(.is-open) > :not(.settings-collapse-toggle) {
  display: none !important;
}
.settings-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 66px;
  padding: 13px 16px;
  border: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.settings-collapse-toggle:hover { background: #f8fafc; }
.settings-collapse-toggle > span { display: grid; gap: 3px; min-width: 0; }
.settings-collapse-toggle b { color: var(--navy); font-size: 15px; }
.settings-collapse-toggle small { color: var(--muted); font-size: 11px; }
.settings-collapse-toggle i {
  font-style: normal;
  color: #7890ad;
  font-size: 24px;
  transition: transform .18s ease;
}
.settings-panel.is-open > .settings-collapse-toggle {
  border-bottom: 1px solid #e3e9f0;
  background: #fbfcfe;
}
.settings-panel.is-open > .settings-collapse-toggle i { transform: rotate(90deg); }
.settings-panel.is-open > :not(.settings-collapse-toggle) {
  margin-left: 16px;
  margin-right: 16px;
}
.settings-panel.is-open > :last-child { margin-bottom: 16px; }
.settings-panel.is-open > .card-head,
.settings-panel.is-open > h2:first-of-type { margin-top: 16px; }
.settings-panel[hidden] { display: none !important; }

/* Tablette : les quatre KPI de la page Analyse restent sur une seule ligne. */
@media (min-width: 641px) and (max-width: 1180px) {
  .analysis-kpis {
    grid-template-columns: repeat(4,minmax(0,1fr)) !important;
    gap: 9px !important;
  }
  .analysis-kpis .kpi { padding: 13px 12px; min-width: 0; }
  .analysis-kpis .kpi strong { font-size: clamp(17px,2.3vw,25px); white-space: nowrap; }
  .analysis-kpis .kpi span { font-size: 11px; line-height: 1.25; }
  .analysis-kpis .kpi small { font-size: 10px; line-height: 1.25; }
}

@media (max-width: 900px) {
  .email-special-paragraphs { grid-template-columns: 1fr; }
  .signature-social-form { grid-template-columns: 1fr 1fr; }
  .signature-social-form .btn { width: 100%; }
  .settings-finder { top: 64px; }
}

/* Téléphone : menu, recherche, notifications et nouveau document sur UNE ligne. */
@media (max-width: 640px) {
  .topbar {
    min-height: 58px !important;
    height: 58px !important;
    flex-wrap: nowrap !important;
    padding: 8px !important;
    gap: 6px !important;
    align-items: center;
  }
  .topbar .menu-toggle {
    order: 1;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
  }
  .topbar .global-search {
    order: 2 !important;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }
  .topbar .global-search input {
    width: 100% !important;
    min-width: 0 !important;
    height: 38px;
    padding: 0 9px;
    font-size: 12px;
    text-overflow: ellipsis;
  }
  .topbar .global-search #searchResults { top: 43px; }
  .topbar .notification-popover {
    order: 3;
    margin-left: 0 !important;
    flex: 0 0 38px;
  }
  .topbar .notification-button {
    width: 38px;
    height: 38px;
  }
  .topbar .topbar-new-document {
    order: 4;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
  }
  .notification-panel { top: 59px !important; }
  .settings-finder { top: 58px; margin-inline: -3px; }
  .settings-collapse-toggle { min-height: 58px; padding: 10px 12px; }
  .settings-panel.is-open > :not(.settings-collapse-toggle) { margin-left: 12px; margin-right: 12px; }
  .signature-social-form { grid-template-columns: 1fr; }
  .email-special-card-head { align-items: flex-start; flex-direction: column; }
  .rich-mail-toolbar { gap: 4px; padding: 6px; }
  .rich-mail-toolbar > button,
  .rich-color-control { min-width: 33px; height: 32px; padding-inline: 7px; font-size: 11px; }
  .rich-mail-toolbar > button[data-rich-command="insertUnorderedList"],
  .rich-mail-toolbar > button[data-rich-command="insertOrderedList"] { min-width: 62px; }
}
.settings-panel.form-grid > .settings-collapse-toggle { grid-column: 1 / -1; }
.settings-panel.form-grid.is-open { padding: 0 16px 16px !important; }
.settings-panel.form-grid.is-open > :not(.settings-collapse-toggle) { margin-left: 0; margin-right: 0; }

/* ========================================================================== 
   JTLM ERP 4.2.6 — mails à interligne naturel + détection des doublons clients
   ========================================================================== */

/* 1 Entrée = simple saut de ligne (<br>) ; les paragraphes existants gardent un écart léger. */
.rich-mail-surface p,
.followup-history-message p {
  margin: 0 0 10px;
}
.rich-mail-surface p:last-child,
.followup-history-message p:last-child {
  margin-bottom: 0;
}

.customer-duplicate-zone {
  border: 1px solid #e5c85b;
  border-radius: 12px;
  padding: 12px;
  background: #fff9df;
}
.customer-duplicate-zone.is-confirmed {
  border-color: #9acfa0;
  background: #effaf0;
}
.customer-duplicate-head,
.customer-duplicate-confirmed {
  display: grid;
  gap: 3px;
}
.customer-duplicate-head strong { color: #7a5800; }
.customer-duplicate-confirmed strong { color: #23712b; }
.customer-duplicate-head span,
.customer-duplicate-confirmed span { font-size: 13px; }
.customer-duplicate-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.customer-duplicate-match {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid rgb(13 47 104 / 12%);
  border-radius: 9px;
  background: #fff;
}
.customer-duplicate-match > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}
.customer-duplicate-match small {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.customer-duplicate-force { margin-top: 10px; }

@media (max-width: 640px) {
  .customer-duplicate-match {
    align-items: stretch;
    flex-direction: column;
  }
  .customer-duplicate-match .btn,
  .customer-duplicate-force { width: 100%; }
}

/* JTLM ERP 4.2.7 — valorisation PMP */
.matrix-pmp-row th,
.matrix-pmp-row td {
    font-weight: 700;
}
.matrix-stock-value-row th,
.matrix-stock-value-row td {
    font-size: .92em;
}
.stock-journal-editable input[readonly] {
    opacity: .72;
    cursor: default;
}

/* Version finale : tableaux de stock lisibles et synthèse d'inventaire persistante. */
.stock-journal-editable { min-width: 1210px !important; }
.stock-journal-editable th { white-space: normal; line-height: 1.25; vertical-align: middle; }
.stock-journal-editable th:nth-child(1), .stock-journal-editable td:nth-child(1) { width: 180px !important; }
.stock-journal-editable th:nth-child(2), .stock-journal-editable td:nth-child(2) { width: 260px !important; }
.stock-journal-editable th:nth-child(3), .stock-journal-editable td:nth-child(3) { width: 245px !important; }
.stock-journal-editable th:nth-child(4), .stock-journal-editable td:nth-child(4) { width: 180px !important; text-align: center; }
.stock-journal-editable th:nth-child(5), .stock-journal-editable td:nth-child(5),
.stock-journal-editable th:nth-child(6), .stock-journal-editable td:nth-child(6) { width: 135px !important; text-align: center; }
.stock-journal-editable th:nth-child(7), .stock-journal-editable td:nth-child(7) { width: 75px !important; }
.stock-journal-editable tr.matrix-invoice > td { background: #eaf8ed !important; }
.stock-journal-editable tr.matrix-purchase > td { background: #eaf3ff !important; }
.stock-journal-editable tr.matrix-reservation > td { background: #fff5d9 !important; color: inherit !important; }
.stock-journal-editable tr.matrix-movement > td { background: #fff !important; }

@media (min-width: 1181px) {
  .stock-matrix-header thead th:first-child,
  .stock-matrix-body th:first-child,
  .stock-matrix-body td:first-child { box-shadow: none !important; }
}
.stock-matrix-body .matrix-physical-row > *,
.stock-matrix-body .matrix-reserved-row > *,
.stock-matrix-body .matrix-stock-row > *,
.stock-matrix-body .matrix-pmp-row > *,
.stock-matrix-body .matrix-stock-value-row > * {
  position: sticky !important;
  z-index: 7;
  height: 42px !important;
  min-height: 42px !important;
}
.stock-matrix-body .matrix-physical-row > td,
.stock-matrix-body .matrix-reserved-row > td,
.stock-matrix-body .matrix-stock-row > td,
.stock-matrix-body .matrix-pmp-row > td,
.stock-matrix-body .matrix-stock-value-row > td { text-align: center !important; }
.stock-matrix-body .matrix-physical-row > * { top: 0; }
.stock-matrix-body .matrix-reserved-row > * { top: 42px; }
.stock-matrix-body .matrix-stock-row > * { top: 84px; }
.stock-matrix-body .matrix-pmp-row > * { top: 126px; background: #f2f6fb !important; }
.stock-matrix-body .matrix-stock-value-row > * { top: 168px; background: #eef3f7 !important; }
.stock-matrix-body .matrix-physical-row > :first-child,
.stock-matrix-body .matrix-reserved-row > :first-child,
.stock-matrix-body .matrix-stock-row > :first-child,
.stock-matrix-body .matrix-pmp-row > :first-child,
.stock-matrix-body .matrix-stock-value-row > :first-child { z-index: 12 !important; }
.stock-matrix-body-wrap { isolation: isolate; }
.stock-matrix-body .matrix-event { position: relative; z-index: 1; }
.stock-matrix-body .matrix-event .matrix-date-edit,
.stock-matrix-body .matrix-event .matrix-date-edit input { position: relative; z-index: 1; }
.stock-matrix-body .matrix-physical-row > * { z-index: 20 !important; background: #f4f7fb !important; }
.stock-matrix-body .matrix-reserved-row > * { z-index: 20 !important; background: #fff8ec !important; }
.stock-matrix-body .matrix-stock-row > * { z-index: 20 !important; background: #fff8da !important; }
.stock-matrix-body .matrix-pmp-row > *,
.stock-matrix-body .matrix-stock-value-row > * { z-index: 20 !important; }
.stock-matrix-body .matrix-stock-value-row > * { box-shadow: 0 3px 5px rgba(13,47,104,.08); }
.stock-matrix.stock-matrix-body tbody > .matrix-physical-row > :nth-child(2),
.stock-matrix.stock-matrix-body tbody > .matrix-reserved-row > :nth-child(2),
.stock-matrix.stock-matrix-body tbody > .matrix-stock-row > :nth-child(2),
.stock-matrix.stock-matrix-body tbody > .matrix-pmp-row > :nth-child(2),
.stock-matrix.stock-matrix-body tbody > .matrix-stock-value-row > :nth-child(2) {
  position: sticky !important;
  left: auto !important;
  right: auto !important;
  z-index: 22 !important;
}
.stock-matrix.stock-matrix-body tbody > .matrix-physical-row > :nth-child(2) { top: 0 !important; }
.stock-matrix.stock-matrix-body tbody > .matrix-reserved-row > :nth-child(2) { top: 42px !important; }
.stock-matrix.stock-matrix-body tbody > .matrix-stock-row > :nth-child(2) { top: 84px !important; }
.stock-matrix.stock-matrix-body tbody > .matrix-pmp-row > :nth-child(2) { top: 126px !important; }
.stock-matrix.stock-matrix-body tbody > .matrix-stock-value-row > :nth-child(2) { top: 168px !important; }
.stock-matrix-body .matrix-physical-row > :first-child,
.stock-matrix-body .matrix-reserved-row > :first-child,
.stock-matrix-body .matrix-stock-row > :first-child,
.stock-matrix-body .matrix-pmp-row > :first-child,
.stock-matrix-body .matrix-stock-value-row > :first-child { z-index: 24 !important; }

/* BC fournisseur : en-tête compact et champs numériques centrés. */
@media (min-width: 981px) {
  .purchase-head { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px 12px; padding: 14px 16px; }
  .purchase-head label { gap: 5px; font-size: 11px; }
  .purchase-head input, .purchase-head select, .purchase-head textarea { padding: 8px 9px; min-height: 38px; }
  .purchase-head textarea { min-height: 38px; height: 38px; resize: vertical; }
}
.purchase-head .purchase-wide-field { grid-column: 1 / -1; }
.purchase-supplier-control { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: stretch; }
.purchase-supplier-control select { min-width: 0; }
.purchase-supplier-create { min-height: 38px; padding-inline: 12px; white-space: nowrap; }
.quick-supplier-dialog { width: min(860px,calc(100vw - 28px)); padding: 0; border: 0; border-radius: 18px; box-shadow: 0 24px 70px rgba(15,37,67,.28); }
.quick-supplier-dialog .dialog-body { padding: 20px 22px; }
.quick-supplier-dialog .supplier-editor { margin: 0; box-shadow: none; }
.purchase-lines td:nth-child(1), .purchase-lines td:nth-child(4), .purchase-lines td:nth-child(5),
.purchase-lines td:nth-child(8), .purchase-lines td:nth-child(9) { text-align: center; }
.purchase-lines td:nth-child(1) input, .purchase-lines td:nth-child(4) input, .purchase-lines td:nth-child(5) input,
.purchase-lines td:nth-child(8) input, .purchase-lines td:nth-child(9) input { text-align: center; }

.replacement-code-search { display: grid; gap: 5px; margin-top: 10px; color: var(--muted); font-size: 11px; font-weight: 700; }
.replacement-code-search input { width: 100%; }
.replacement-code-grid [hidden] { display: none !important; }

/* Analyse commerciale : carte autonome des départements français. */
.france-conversion-card { overflow: hidden; }
.france-conversion-layout { display: grid; grid-template-columns: minmax(0,1fr) 250px; gap: 24px; align-items: center; }
.france-conversion-map { position: relative; min-height: 540px; display: grid; place-items: center; border: 1px solid #dce5ee; border-radius: 14px; background: #fbfcfe; overflow: hidden; }
.france-conversion-map svg { display: block; width: min(100%, 650px); height: 540px; padding: 14px; }
.france-conversion-map path { stroke: #fff; stroke-width: .75; vector-effect: non-scaling-stroke; cursor: pointer; transition: filter .14s ease, stroke-width .14s ease; }
.france-conversion-map path:hover, .france-conversion-map path:focus { filter: brightness(.86) saturate(1.12); stroke: var(--navy); stroke-width: 1.7; outline: none; }
.france-conversion-map path.is-selected { stroke: var(--navy); stroke-width: 2.5; filter: saturate(1.2); }
.france-map-tooltip { position: absolute; z-index: 5; display: grid; gap: 5px; width: 220px; padding: 12px 14px; border: 1px solid rgba(13,47,104,.2); border-radius: 11px; background: rgba(255,255,255,.98); color: #526172; box-shadow: 0 12px 28px rgba(13,47,104,.18); pointer-events: none; font-size: 11px; }
.france-map-tooltip[hidden] { display: none; }
.france-map-tooltip b { color: var(--navy); font-size: 13px; }
.france-map-tooltip span { display: flex; justify-content: space-between; gap: 12px; }
.france-map-tooltip strong { color: var(--navy); }
.france-map-tooltip small { margin-top: 3px; padding-top: 6px; border-top: 1px solid #e3e9ef; color: var(--green); font-size: 9px; font-weight: 800; }
.france-overseas-insets { position: absolute; left: 12px; bottom: 12px; z-index: 3; display: flex; gap: 5px; padding: 6px; border: 1px solid #dce5ee; border-radius: 9px; background: rgba(255,255,255,.94); }
.france-overseas-insets button { width: 37px; min-height: 29px; padding: 3px; border: 1px solid rgba(13,47,104,.18); border-radius: 6px; color: var(--navy); cursor: pointer; font: 800 8px/1 var(--font); }
.france-overseas-insets button:hover, .france-overseas-insets button:focus { border-color: var(--navy); outline: none; filter: brightness(.9); }
.france-overseas-insets button.is-selected { border: 2px solid var(--navy); box-shadow: 0 0 0 2px rgba(13,47,104,.12); }
.france-conversion-legend { display: grid; gap: 11px; align-content: center; padding: 18px; border-radius: 13px; background: #f5f8fb; color: #5f6e80; }
.france-conversion-legend > b { color: var(--navy); font-size: 14px; }
.france-legend-scale { height: 18px; border-radius: 999px; background: linear-gradient(90deg,#dce9f5,#8eb8d7,#55a6a4,#4fb555); box-shadow: inset 0 0 0 1px rgba(13,47,104,.12); }
.france-conversion-legend > div + div { display: flex; justify-content: space-between; font-size: 9px; font-weight: 800; }
.france-conversion-legend small { line-height: 1.45; }
.france-conversion-legend .map-attribution { padding-top: 8px; border-top: 1px solid #dce5ee; font-size: 8px; }
@media (max-width: 900px) {
  .france-conversion-layout { grid-template-columns: 1fr; }
  .france-conversion-map { min-height: 430px; }
  .france-conversion-map svg { height: 430px; }
}
.department-documents-card { scroll-margin-top: 90px; border-top: 4px solid var(--green); }
.department-documents-card .table-wrap { max-height: 560px; }
.department-conversion-row { padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; color: inherit; text-decoration: none; }
.department-conversion-row:hover { border-color: #d8e4ec; background: #f8fafc; }
.department-conversion-row.is-selected { border-color: rgba(79,181,85,.45); background: #f1faf2; box-shadow: inset 3px 0 var(--green); }

/* ========================================================================== 
   JTLM ERP 4.2.8 — Historique PMP, BC modifiables, suivi commercial
   ========================================================================== */
.pmp-product-selector {
  display:flex;
  align-items:end;
  gap:12px;
}
.pmp-product-selector label { flex:1 1 420px; margin:0; }
.pmp-product-selector label { display:grid; gap:7px; }
.pmp-kpis { margin:14px 0; }
.pmp-correction-card { border-left:4px solid var(--green); }
.pmp-correction-form { grid-template-columns:minmax(180px,.7fr) minmax(320px,1.6fr) auto; align-items:end; }
.pmp-correction-form .span-2 { grid-column:auto; }
.pmp-history-table small { display:block; margin-top:3px; color:var(--muted); }
.pmp-history-correction { background:#fff9e8; }
.pmp-history-correction td:first-child { border-left:3px solid #d6a126; }
.pmp-history-table .btn.small { white-space:nowrap; }
#pmpHistory > .card-head { padding: 18px 18px 12px; }
#pmpCorrection .card-head small,
#pmpHistory .card-head small { display:none; }
.special-order-import label { display:grid; gap:6px; }
.purchase-received-edit-notice {
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
}
.purchase-received-edit-notice b { white-space:nowrap; color:var(--navy); }

.commercial-kpis,
.commercial-file-kpis { margin:14px 0; }
.commercial-file-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
}
.commercial-file-header small { color:var(--muted); text-transform:uppercase; letter-spacing:.06em; font-weight:700; }
.commercial-file-header h2 { margin:3px 0 4px; }
.commercial-file-header p { margin:0; color:var(--muted); }
.commercial-file-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.commercial-dossier-grid {
  display:grid;
  grid-template-columns:minmax(0,1.45fr) minmax(340px,.8fr);
  gap:16px;
  align-items:start;
}
.commercial-dossier-main { display:grid; gap:14px; min-width:0; }
.commercial-history { min-width:0; position:sticky; top:84px; max-height:calc(100vh - 105px); overflow:hidden; }
.commercial-history .commercial-timeline { overflow:auto; max-height:calc(100vh - 185px); padding-right:5px; }
.commercial-profile-form textarea { min-height:92px; }
.commercial-action-card { padding:0; overflow:hidden; }
.commercial-action-card > summary {
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:15px 17px;
  cursor:pointer;
  background:#fff;
}
.commercial-action-card > summary::-webkit-details-marker { display:none; }
.commercial-action-card > summary b { color:var(--navy); }
.commercial-action-card > summary span { color:var(--muted); font-size:12px; }
.commercial-action-card[open] > summary { border-bottom:1px solid #e5ebf2; background:#fbfcfe; }
.commercial-action-card > form { padding:16px; }
.commercial-quick-actions { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.commercial-followup-state form { display:flex; align-items:end; gap:10px; }
.commercial-followup-state label { flex:1 1 auto; margin:0; }
.commercial-event { position:relative; }
.commercial-event.event-email { border-left:3px solid #4f87cf; }
.commercial-event.event-phone { border-left:3px solid #54a85f; }
.commercial-event.event-note { border-left:3px solid #8b77c7; }
.commercial-event.event-document { border-left:3px solid #8090a4; }
.commercial-event.event-planning { border-left:3px solid #d89a3b; }
.commercial-event.event-stop { border-left:3px solid #c65a5a; }
.commercial-event.event-resume { border-left:3px solid #4fb555; }
.commercial-stage,
.commercial-priority {
  display:inline-flex;
  align-items:center;
  min-height:25px;
  padding:4px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
  background:#eef3f8;
  color:#38516d;
}
.commercial-stage.stage-negotiation { background:#fff2cf; color:#7d5d00; }
.commercial-stage.stage-won { background:#e8f7ea; color:#24702d; }
.commercial-stage.stage-lost { background:#fae9e9; color:#8b3434; }
.commercial-priority.priority-high { background:#fff1d9; color:#8b5a00; }
.commercial-priority.priority-urgent { background:#fde8e8; color:#a22f2f; }
.commercial-priority.priority-low { opacity:.72; }
.commercial-list td small { display:block; margin-top:3px; color:var(--muted); }

@media (min-width:641px) and (max-width:1180px) {
  .commercial-kpis,
  .commercial-file-kpis,
  .pmp-kpis { grid-template-columns:repeat(4,minmax(0,1fr)) !important; gap:9px; }
  .commercial-dossier-grid { grid-template-columns:1fr; }
  .commercial-history { position:static; max-height:none; }
  .commercial-history .commercial-timeline { max-height:520px; }
  .pmp-correction-form { grid-template-columns:1fr 1.5fr auto; }
}

@media (max-width:760px) {
  .pmp-product-selector,
  .purchase-received-edit-notice,
  .commercial-file-header,
  .commercial-followup-state form { align-items:stretch; flex-direction:column; }
  .pmp-product-selector label { flex-basis:auto; }
  .pmp-correction-form { grid-template-columns:1fr; }
  .pmp-correction-form .span-2 { grid-column:auto; }
  .commercial-dossier-grid { grid-template-columns:1fr; }
  .commercial-file-actions { justify-content:flex-start; }
  .commercial-quick-actions { grid-template-columns:1fr; }
  .commercial-history { position:static; max-height:none; }
  .commercial-history .commercial-timeline { max-height:none; }
  .commercial-action-card > summary { align-items:flex-start; flex-direction:column; gap:3px; }
}

/* ============================================================
   JTLM ERP 4.2.9 — Suivi commercial restructuré
   ============================================================ */
.commercial-searchbar { margin-bottom: 18px; }
.commercial-file-header-v2 {
  padding: 19px 20px;
  align-items: flex-start;
  border-top: 3px solid var(--navy);
}
.commercial-file-identity { min-width: 0; flex: 1 1 auto; }
.commercial-file-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.commercial-file-eyebrow > span:first-child {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: 11px;
  font-weight: 800;
}
.commercial-file-header-v2 h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(20px, 2vw, 27px);
  line-height: 1.18;
}
.commercial-file-header-v2 h2 span { color: #a6b0bd; font-weight: 500; }
.commercial-contact-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 15px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}
.commercial-contact-line span { position: relative; }
.commercial-contact-line span + span::before {
  content: "•";
  position: absolute;
  left: -10px;
  color: #c2cad4;
}
.commercial-file-header-v2 .commercial-file-actions { padding-top: 2px; }

.commercial-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
.commercial-summary-card {
  min-width: 0;
  padding: 15px 16px;
  border: 1px solid #dfe6ee;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(13,47,104,.045);
}
.commercial-summary-card .commercial-summary-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.commercial-summary-card > strong {
  display: block;
  min-height: 28px;
  color: var(--navy);
  font-size: 21px;
  line-height: 1.2;
}
.commercial-summary-card > small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
}
.commercial-summary-card.summary-next { border-left: 4px solid var(--green); }
.commercial-summary-card.summary-next:is(.is-today, .is-overdue) {
  border-left-color: #c65454;
  background: #fffafa;
}
.commercial-summary-card.summary-next:is(.is-today, .is-overdue) > strong { color: #a33636; }
.commercial-summary-card.summary-stage > strong { padding-top: 1px; }
.commercial-summary-card.summary-stage .commercial-stage { font-size: 12px; min-height: 28px; }

.commercial-dossier-grid-v2 {
  grid-template-columns: minmax(0, 1.6fr) minmax(350px, .76fr);
  gap: 20px;
}
.commercial-dossier-grid-v2 .commercial-dossier-main { gap: 18px; }
.commercial-section-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--green);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.commercial-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}
.commercial-section-head h2,
.commercial-card-title h2,
.commercial-secondary-heading h2,
.commercial-history-head h2 {
  margin: 2px 0 4px;
  color: var(--navy);
}
.commercial-section-head p,
.commercial-secondary-heading p { margin: 0; color: var(--muted); }
.commercial-next-card {
  padding: 18px;
  border-top: 3px solid var(--green);
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
}
.commercial-next-date {
  flex: 0 0 auto;
  min-width: 150px;
  padding: 10px 13px;
  border-radius: 10px;
  background: #edf8ee;
  text-align: right;
}
.commercial-next-date span,
.commercial-next-date small { display: block; color: #52705a; font-size: 10px; font-weight: 700; }
.commercial-next-date strong { display: block; margin: 2px 0; color: #24702d; font-size: 18px; }

.commercial-email-action {
  margin: 0;
  border: 1px solid #dfe6ee;
  border-radius: 11px;
  background: #fff;
  overflow: hidden;
}
.commercial-email-action > summary { padding: 14px 15px; }
.commercial-email-action[open] > summary { background: #f8fbff; }
.commercial-email-action > form { padding: 16px; }
.commercial-email-form { gap: 13px; }
.commercial-outcome-field input { font-weight: 400; }
.commercial-auto-followup-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #cfe5d1;
  border-radius: 9px;
  background: #f4fbf5;
  color: #3f5e46;
  font-size: 12px;
}
.commercial-auto-followup-note b {
  flex: 0 0 auto;
  color: #24702d;
  white-space: nowrap;
}

.commercial-pilot-card { padding: 18px; }
.commercial-card-title { margin-bottom: 14px; }
.commercial-card-title small { color: var(--muted); }
.commercial-profile-form { gap: 13px 14px; }
.commercial-profile-form textarea { min-height: 88px; }
.commercial-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.commercial-secondary-actions {
  display: grid;
  gap: 10px;
}
.commercial-secondary-heading { padding: 0 2px; }
.commercial-secondary-heading h2 { font-size: 18px; }
.commercial-secondary-heading p { font-size: 12px; }
.commercial-quick-actions { gap: 12px; }
.commercial-quick-actions .commercial-action-card {
  border: 1px solid #e1e7ee;
  box-shadow: none;
}
.commercial-action-card > summary {
  min-height: 58px;
  padding: 13px 15px;
}
.commercial-action-card > summary b { font-size: 13px; }
.commercial-action-card > summary span { line-height: 1.3; }
.commercial-action-card > form { padding: 15px; }

.commercial-followup-state {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 17px;
  background: #fbfcfe;
  border-style: dashed;
}
.commercial-followup-state-label { display: grid; gap: 2px; min-width: 220px; }
.commercial-followup-state-label b { color: #475467; font-size: 13px; }
.commercial-followup-state-label small { color: var(--muted); }
.commercial-followup-state form { flex: 1 1 auto; justify-content: flex-end; }
.commercial-followup-state form label { display:grid; gap:7px; max-width:440px; }
.commercial-status-message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 4px solid #8090a4;
}
.commercial-status-message b { color: var(--navy); }
.commercial-status-message span { color: var(--muted); }
.commercial-status-message.is-stopped { border-left-color: #c65a5a; }

.commercial-history-v2 {
  padding: 16px;
  border-top: 3px solid #d8e1ec;
}
.commercial-history-head {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf0f4;
}
.commercial-history-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 29px;
  height: 29px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #516477;
  font-size: 12px;
  font-weight: 800;
}
.commercial-history-v2 .commercial-timeline { padding: 2px 3px 3px 0; }
.commercial-history-v2 .history-entry {
  margin: 0 0 10px;
  padding: 12px 12px 11px 14px;
  border-radius: 9px;
  background: #fff;
  box-shadow: none;
}
.commercial-history-v2 .history-entry header {
  display: grid;
  gap: 3px;
  margin-bottom: 7px;
}
.commercial-history-v2 .history-entry header b { color: #27384c; line-height: 1.3; }
.commercial-history-v2 .history-entry header time { color: var(--muted); font-size: 10px; }
.commercial-history-v2 .history-entry > small {
  display: block;
  margin-top: 5px;
  color: #66778a;
  line-height: 1.4;
}
.commercial-history-v2 .followup-history-message {
  max-height: 160px;
  overflow: auto;
  padding-right: 4px;
  font-size: 12px;
}

.commercial-list-v2 { margin-top: 20px; }
.commercial-list-v2 table { min-width: 1030px; }
.commercial-list-v2 tbody tr { transition: background .12s ease; }
.commercial-list-v2 tbody tr:hover { background: #fafcff; }
.commercial-list-v2 :is(.commercial-row-today, .commercial-row-overdue) { background: #fffafa; }
.commercial-list-v2 :is(.commercial-row-today, .commercial-row-overdue) td:first-child { border-left: 3px solid #c65454; }
.commercial-list-v2 .commercial-due-today { color: inherit; font-weight: 750; }
.commercial-list-v2 td { vertical-align: middle; }

@media (min-width: 1181px) {
  .commercial-history-v2 {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 104px);
  }
  .commercial-history-v2 .commercial-timeline { max-height: calc(100vh - 190px); overflow: auto; }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .commercial-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
  .commercial-summary-card { padding: 13px 12px; }
  .commercial-summary-card > strong { font-size: 17px; }
  .commercial-summary-card > small { font-size: 10px; }
  .commercial-dossier-grid-v2 { grid-template-columns: 1fr; gap: 17px; }
  .commercial-history-v2 { position: static; max-height: none; }
  .commercial-history-v2 .commercial-timeline { max-height: 540px; overflow: auto; }
  .commercial-file-header-v2 { gap: 12px; }
  .commercial-file-header-v2 .commercial-file-actions { max-width: 290px; }
}

@media (max-width: 760px) {
  .commercial-file-header-v2 { padding: 15px; gap: 13px; }
  .commercial-file-header-v2 h2 { font-size: 20px; }
  .commercial-file-header-v2 h2 span { display: none; }
  .commercial-file-header-v2 .commercial-file-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 7px;
  }
  .commercial-file-header-v2 .commercial-file-actions .btn:first-child { grid-column: 1 / -1; }
  .commercial-file-header-v2 .commercial-file-actions .btn { justify-content: center; }
  .commercial-contact-line { display: grid; gap: 3px; }
  .commercial-contact-line span + span::before { display: none; }
  .commercial-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
  .commercial-summary-card { padding: 12px; border-radius: 10px; }
  .commercial-summary-card .commercial-summary-label { font-size: 9px; margin-bottom: 6px; }
  .commercial-summary-card > strong { min-height: 24px; font-size: 16px; }
  .commercial-summary-card > small { font-size: 10px; }
  .commercial-summary-card.summary-stage .commercial-stage { white-space: normal; text-align: center; line-height: 1.2; }
  .commercial-dossier-grid-v2 { grid-template-columns: 1fr; gap: 14px; }
  .commercial-next-card,
  .commercial-pilot-card,
  .commercial-history-v2 { padding: 14px; }
  .commercial-section-head { flex-direction: column; gap: 10px; }
  .commercial-next-date { width: 100%; text-align: left; min-width: 0; }
  .commercial-auto-followup-note { align-items: flex-start; flex-direction: column; gap: 2px; }
  .commercial-profile-form,
  .commercial-email-form,
  .commercial-action-card > form { grid-template-columns: 1fr !important; }
  .commercial-profile-form .span-2,
  .commercial-email-form .span-2,
  .commercial-action-card > form .span-2 { grid-column: auto !important; }
  .commercial-form-actions { justify-content: stretch; }
  .commercial-form-actions .btn { width: 100%; }
  .commercial-quick-actions { grid-template-columns: 1fr; gap: 9px; }
  .commercial-followup-state { align-items: stretch; flex-direction: column; gap: 10px; }
  .commercial-followup-state-label { min-width: 0; }
  .commercial-followup-state form { width: 100%; }
  .commercial-followup-state form label { max-width: none; }
  .commercial-history-v2 { position: static; max-height: none; }
  .commercial-history-v2 .commercial-timeline { max-height: none; overflow: visible; }
  .commercial-history-v2 .followup-history-message { max-height: 140px; }
  .commercial-email-action .rich-mail-toolbar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .commercial-email-action .rich-mail-toolbar > * { flex: 0 0 auto; }
}

/* Correctifs 4.2.60 — tableaux métier, actions BC et visuels produit. */
.sidebar .sidebar-logo {
  filter: brightness(0) invert(1) drop-shadow(0 4px 8px rgba(0, 0, 0, .48)) !important;
  opacity: .98;
}

.line-product-display {
  display: grid;
  grid-template-columns: 42px minmax(145px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 195px;
}
.line-product-photo {
  width: 40px;
  height: 40px;
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 2px 6px rgba(18, 46, 74, .08);
}
.line-product-photo[hidden] { display: none; }
.line-product-photo[hidden] + input { grid-column: 1 / -1; }

.purchase-command-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  margin-top: 14px;
  border: 1px solid #dce5eb;
  background: linear-gradient(135deg, #fff 0%, #f7fafc 100%);
}
.purchase-command-bar form { margin: 0; }
.purchase-command-bar .btn {
  min-height: 43px;
  border-radius: 10px;
  padding-inline: 18px;
  font-weight: 800;
}
.purchase-command-bar .purchase-save-button { min-width: 190px; }
.purchase-command-bar .purchase-receive-button {
  color: #174e2c;
  border-color: #a8d4b4;
  background: #eef9f1;
}
.purchase-command-bar .purchase-delete-form { margin-left: auto; }

/* Sur un écran étroit, la Price List conserve des colonnes lisibles et se
   parcourt horizontalement, au lieu de comprimer/chevaucher son contenu. */
.price-list-wrap { overflow-x: auto !important; overscroll-behavior-inline: contain; }
.price-list-table { table-layout: fixed !important; min-width: 1500px !important; width: 1500px !important; }
@media (min-width: 1760px) {
  .price-list-table { width: 100% !important; min-width: 1450px !important; }
}

/* Le tableau inventaire utilise davantage de hauteur. Les cellules des
   événements restent normales : seules l'entête et les six synthèses sont
   figées pendant le défilement vertical. */
.stock-matrix-scroll {
  height: calc(100dvh - 205px) !important;
  min-height: 680px !important;
  max-height: none !important;
}
.stock-matrix-scroll .stock-matrix .matrix-event > th,
.stock-matrix-scroll .stock-matrix .matrix-event > td,
.stock-matrix-scroll .stock-matrix .matrix-event .matrix-date-edit,
.stock-matrix-scroll .stock-matrix .matrix-event input {
  position: static !important;
  inset: auto !important;
  z-index: 1 !important;
}
.stock-matrix-scroll .stock-matrix .matrix-stock-value-row > * {
  z-index: 45 !important;
  background: #eef3f7 !important;
  box-shadow: none !important;
}
@media (max-width: 1180px) {
  .stock-matrix-scroll { height: calc(100dvh - 175px) !important; min-height: 620px !important; }
  .purchase-command-bar { flex-wrap: wrap; }
  .purchase-command-bar .purchase-delete-form { margin-left: 0; }
}
@media (max-width: 700px) {
  .stock-matrix-scroll { height: calc(100dvh - 145px) !important; min-height: 540px !important; }
  .purchase-command-bar, .purchase-command-bar form, .purchase-command-bar .btn { width: 100%; }
}

@media (max-width: 420px) {
  .commercial-summary-grid { gap: 6px; }
  .commercial-summary-card { padding: 10px; }
  .commercial-summary-card > strong { font-size: 14px; }
  .commercial-summary-card > small { font-size: 9px; }
  .commercial-file-eyebrow { gap: 5px; }
}

/* ============================================================
   JTLM ERP 4.2.10 — Dossier commercial complet
   ============================================================ */
.commercial-dossier-back {
  display:flex;
  justify-content:flex-start;
  margin:0 0 12px;
}
.commercial-stage-editor-card {
  border-left:4px solid var(--navy);
}
.commercial-stage-editor {
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:1px;
}
.commercial-stage-editor select {
  min-width:0;
  width:100%;
  height:38px;
  font-weight:800;
  color:var(--navy);
  background:#f8fafc;
}
.commercial-stage-editor .btn {
  flex:0 0 auto;
  white-space:nowrap;
}

.commercial-case-journey {
  padding:16px 18px 8px;
  margin:0 0 18px;
  border-top:3px solid #d9e2ed;
}
.commercial-case-journey-head {
  margin-bottom:8px;
}
.commercial-case-journey-head h2 {
  margin:2px 0 3px;
  color:var(--navy);
}
.commercial-case-journey-head small { color:var(--muted); }
.commercial-case-flow {
  margin:0 -2px;
  padding:4px 2px 12px;
  scroll-padding-inline:2px;
}
.commercial-case-flow .trace-node {
  min-width:180px;
  flex:0 0 180px;
}
.commercial-case-flow .trace-quote {
  background:#f8fbff;
  border-color:#cbdaf1;
}
.commercial-case-flow .trace-invoice {
  background:#fbfcfe;
  border-color:#d7e0ea;
}
.commercial-case-flow .trace-delivery {
  background:#fffaf2;
  border-color:#ead4ad;
}
.commercial-case-flow .trace-payment {
  background:#f4fbf5;
  border-color:#c9e7cc;
}

.commercial-relance-actions {
  display:grid;
  gap:11px;
}
.commercial-relance-workspace {
  display:grid;
  grid-template-columns:minmax(360px,.92fr) minmax(430px,1.08fr);
  gap:16px;
  align-items:start;
}
.commercial-quote-preview {
  min-width:0;
  overflow:hidden;
  border:1px solid #dfe6ee;
  border-radius:11px;
  background:#f4f6f8;
}
.commercial-quote-preview-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 13px;
  border-bottom:1px solid #dfe6ee;
  background:#fff;
}
.commercial-quote-preview-head > div { display:grid; gap:2px; min-width:0; }
.commercial-quote-preview-head b { color:var(--navy); }
.commercial-quote-preview-head small { color:var(--muted); line-height:1.35; }
.commercial-quote-preview-viewport {
  height:670px;
  overflow:hidden;
  background:#e8ebef;
}
.commercial-quote-preview iframe {
  display:block;
  width:100%;
  height:calc(100% + 20px);
  border:0;
  background:#e8ebef;
}
/* Les lecteurs PDF de bureau injectent une barre sombre dans l'iframe.
   On la place hors du cadre, sans appliquer ce recadrage aux appareils tactiles
   dont le lecteur natif n'utilise pas toujours cette barre. */
@media (hover:hover) and (pointer:fine) {
  .commercial-quote-preview iframe {
    height:calc(100% + 76px);
    transform:translateY(-56px);
  }
}
.commercial-email-action > header,
.commercial-phone-action > header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:13px 15px;
  border-bottom:1px solid #e5ebf2;
  background:#f8fbff;
}
.commercial-email-action > header > div,
.commercial-phone-action > header > div { display:grid; gap:2px; min-width:0; }
.commercial-email-action > header b,
.commercial-phone-action > header b { color:var(--navy); }
.commercial-email-action > header small,
.commercial-phone-action > header small { color:var(--muted); overflow-wrap:anywhere; }
.commercial-email-form textarea,
.commercial-phone-form textarea { min-height:78px; resize:vertical; }
@media (max-width:1180px) {
  .commercial-relance-workspace { grid-template-columns:1fr; }
  .commercial-quote-preview-viewport { height:560px; }
}
@media (max-width:640px) {
  .commercial-quote-preview-head { align-items:stretch; flex-direction:column; }
  .commercial-quote-preview-head .btn { width:100%; justify-content:center; }
  .commercial-quote-preview-viewport { height:460px; }
}
.commercial-phone-action {
  margin:0;
  border:1px solid #dfe6ee;
  border-radius:11px;
  background:#fff;
  overflow:hidden;
}

.commercial-event.event-invoice { border-left:3px solid #4f87cf; }
.commercial-event.event-credit { border-left:3px solid #8b77c7; }
.commercial-event.event-payment { border-left:3px solid #4fb555; background:#fbfefb; }
.commercial-event.event-delivery { border-left:3px solid #d89a3b; }

/* La colonne chronologique occupe réellement la hauteur disponible sur PC.
   Le bas de la frise reste accessible grâce au scroll interne. */
.commercial-history-v2 {
  display:flex;
  flex-direction:column;
  min-height:0;
}
.commercial-history-v2 .commercial-history-head {
  flex:0 0 auto;
}
.commercial-history-v2 .commercial-timeline {
  min-height:0;
  scrollbar-gutter:stable;
  overscroll-behavior:contain;
  padding-bottom:26px;
}

@media (min-width:1181px) {
  .commercial-history-v2 {
    position:sticky;
    top:84px;
    height:calc(100vh - 102px);
    max-height:none;
    overflow:hidden;
  }
  .commercial-history-v2 .commercial-timeline {
    flex:1 1 auto;
    max-height:none;
    overflow-y:auto;
  }
}

@media (min-width:761px) and (max-width:1180px) {
  .commercial-case-flow .trace-node { min-width:168px; flex-basis:168px; }
  .commercial-history-v2 {
    position:static;
    height:auto;
    max-height:none;
  }
  .commercial-history-v2 .commercial-timeline {
    max-height:620px;
    overflow-y:auto;
  }
}

@media (max-width:760px) {
  .commercial-dossier-back { margin-bottom:9px; }
  .commercial-dossier-back .btn { width:100%; justify-content:center; }
  .commercial-stage-editor { align-items:stretch; flex-direction:column; }
  .commercial-stage-editor .btn { width:100%; justify-content:center; }
  .commercial-case-journey { padding:14px 12px 4px; margin-bottom:14px; }
  .commercial-case-journey-head { padding:0 2px; }
  .commercial-case-flow { scroll-snap-type:x proximity; }
  .commercial-case-flow .trace-node { min-width:155px; flex-basis:155px; scroll-snap-align:start; }
  .commercial-phone-form,
  .commercial-note-form { grid-template-columns:1fr !important; }
  .commercial-phone-form .span-2,
  .commercial-note-form .span-2 { grid-column:auto !important; }
  .commercial-note-card { padding:14px; }
  .commercial-history-v2 {
    position:static;
    height:auto;
    max-height:none;
  }
  .commercial-history-v2 .commercial-timeline {
    max-height:none;
    overflow:visible;
    padding-bottom:6px;
  }
}

/* ========================================================================== 
   JTLM ERP 4.2.11 — Analyse marge brute / validation clients
   ========================================================================== */
.analysis-chart-columns,
.hbar-row {
  grid-template-columns: minmax(130px,1fr) minmax(180px,3fr) 118px 156px;
}
.analysis-chart-columns {
  display:grid;
  gap:12px;
  align-items:end;
  padding:0 0 6px;
  border-bottom:1px solid var(--line);
  color:var(--muted);
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.05em;
}
.analysis-chart-columns b { text-align:right; }
.hbar-row {
  padding:3px 0;
}
.hbar-row .hbar-track {
  height:18px;
  background:#edf1f5;
  border-radius:999px;
  overflow:hidden;
}
.hbar-row .hbar-label {
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.hbar-row .hbar-value { text-align:right; }
.hbar-row .hbar-margin {
  display:flex;
  align-items:baseline;
  justify-content:flex-end;
  gap:7px;
  min-width:0;
  overflow:visible;
  white-space:nowrap;
  text-align:right;
}
.hbar-row .hbar-margin b {
  color:var(--navy);
  font-size:12px;
}
.hbar-row .hbar-margin small {
  color:var(--muted);
  font-size:11px;
  font-weight:800;
}
.analysis-quick-card { align-self:start; }
.analysis-conversion-quick {
  display:grid;
  grid-template-columns:112px minmax(0,1fr);
  gap:14px;
  align-items:center;
  padding:8px 0 16px;
  margin-bottom:2px;
  border-bottom:1px solid var(--line);
}
.analysis-conversion-quick .analysis-conversion-pie {
  width:104px;
  height:104px;
  margin:0;
  flex:0 0 auto;
}
.analysis-conversion-quick .analysis-conversion-pie::after {
  inset:13px;
}
.analysis-conversion-quick .analysis-conversion-pie b {
  font-size:22px;
}
.analysis-conversion-quick .analysis-conversion-pie small {
  font-size:10px;
}
.analysis-conversion-quick > div:last-child {
  display:grid;
  gap:5px;
}
.analysis-conversion-quick strong { color:var(--navy); }
.analysis-conversion-quick small { color:var(--muted); line-height:1.35; }
.customer-form input:invalid:not(:placeholder-shown),
.quick-create input:invalid:not(:placeholder-shown) {
  border-color:#d49a45;
}
.customer-form .locked-field { font-weight:800; color:var(--navy) !important; }

@media (min-width:781px) and (max-width:1180px) {
  .analysis-chart-columns,
  .hbar-row {
    grid-template-columns:minmax(115px,1fr) minmax(150px,2.5fr) 105px 145px;
    gap:9px;
  }
}

@media (max-width:780px) {
  .analysis-chart-columns { display:none; }
  .hbar-row {
    grid-template-columns:minmax(0,1fr) auto !important;
    gap:6px 10px !important;
    padding:9px 0 11px;
    border-bottom:1px solid #edf1f5;
  }
  .hbar-row .hbar-label { grid-column:1; grid-row:1; }
  .hbar-row .hbar-value { grid-column:2; grid-row:1; }
  .hbar-row .hbar-track { grid-column:1 / -1; grid-row:2; }
  .hbar-row .hbar-margin {
    grid-column:1 / -1;
    grid-row:3;
    justify-content:flex-end;
  }
  .analysis-conversion-quick {
    grid-template-columns:96px minmax(0,1fr);
    gap:11px;
  }
  .analysis-conversion-quick .analysis-conversion-pie {
    width:88px;
    height:88px;
  }
  .analysis-conversion-quick .analysis-conversion-pie::after {
    inset:11px;
  }
}


/* v4.2.12 — validation client en direct */
.customer-form label:has(.customer-live-field),
.quick-create label:has(.customer-live-field) {
  position:relative;
}
.customer-form input.customer-live-field.is-valid,
.quick-create input.customer-live-field.is-valid {
  border-color:#49a96a !important;
  box-shadow:0 0 0 3px rgba(73,169,106,.10);
}
.customer-form input.customer-live-field.is-invalid,
.quick-create input.customer-live-field.is-invalid {
  border-color:#d65b5b !important;
  box-shadow:0 0 0 3px rgba(214,91,91,.10);
}
.field-validation {
  display:block;
  min-height:16px;
  margin-top:5px;
  font-size:11px;
  line-height:1.25;
  font-weight:700;
}
.field-validation.valid { color:#2f8750; }
.field-validation.invalid { color:#b43e3e; }
.field-validation.neutral { color:var(--muted); }

/* v4.2.13 — statut devis, lignes complémentaires et téléphone international */
.status-info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border: 1px solid #c9d6e4;
  border-radius: 50%;
  background: #f7fafc;
  color: var(--navy);
  font-size: 11px;
  font-weight: 900;
  cursor: help;
  vertical-align: middle;
}
.special-line:not(.deposit-line) .special-line-fields {
  grid-template-columns: .7fr 1.25fr .75fr;
}
.special-line-result {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  row-gap: 5px;
}
.special-line-result strong {
  justify-self: end;
}
.special-line-result .special-total-ttc {
  color: var(--green);
  font-size: 17px;
}
.customer-country-field {
  min-width: 0;
}
@media (max-width: 780px) {
  .special-line:not(.deposit-line) .special-line-fields {
    grid-template-columns: 1fr;
  }
}

/* v4.2.14 — formulaire client compact, actions document et alignements */
.field-label-with-tip {
  display:inline-flex;
  align-items:center;
  gap:5px;
  min-height:20px;
}
.field-label-with-tip .status-info-tip { margin-left:0; flex:0 0 auto; }

.optional-star {
  display:inline;
  color:var(--muted);
  font-weight:800;
  margin-left:2px;
}
.field-validation.is-empty {
  min-height:0;
  margin-top:0;
}

@media (min-width:1181px) {
  .compact-customer-form {
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:10px 12px;
    align-items:start;
  }
  .compact-customer-form .span-3,
  .compact-customer-form .span-4 { grid-column:1 / -1; }
  .compact-customer-form label { gap:4px; }
  .compact-customer-form input,
  .compact-customer-form select { padding:8px 10px; min-height:38px; }
  .compact-customer-form textarea { min-height:58px; }
  .compact-customer-form .field-validation { margin-top:2px; }
}
@media (min-width:641px) and (max-width:1180px) {
  .compact-customer-form .span-3,
  .compact-customer-form .span-4 { grid-column:1 / -1 !important; }
}
@media (max-width:640px) {
  .compact-customer-form .span-3,
  .compact-customer-form .span-4 { grid-column:auto !important; }
}

.special-line .special-line-fields {
  grid-template-columns:.7fr 1.25fr .75fr !important;
}
@media (max-width:780px) {
  .special-line .special-line-fields { grid-template-columns:1fr !important; }
}

.document-bottom-grid {
  display:grid;
  grid-template-columns:minmax(0,1.7fr) minmax(270px,.72fr);
  gap:16px;
  align-items:start;
  margin-bottom:16px;
}
.document-bottom-grid > .card { margin-bottom:0; }
.document-bottom-grid-single { grid-template-columns:minmax(270px,420px); }
.document-actions-card .button-stack { gap:9px; }
.document-actions-card form { margin:0; }
.document-actions-card .btn { min-height:40px; }
@media (max-width:980px) {
  .document-bottom-grid,
  .document-bottom-grid-single { grid-template-columns:1fr; }
}

.analysis-conversion-pie > span { gap:0; }
.analysis-conversion-pie > span > b { line-height:1; }

.inline-action-form { display:inline-flex; margin:0; }
.inline-action-form .btn { margin:0; }

/* v4.2.15 — organisation compacte du formulaire client */
.customer-field-label {
  display:inline-flex;
  align-items:baseline;
  gap:0;
}
.customer-field-label .optional-star {
  margin-left:1px;
}
@media (min-width:1181px) {
  .compact-customer-form .customer-country-cell { grid-column:span 1; }
  .compact-customer-form .customer-phone-cell { grid-column:span 1; }
  .compact-customer-form .customer-email-cell { grid-column:span 2; }
  .compact-customer-form .customer-postal-cell { grid-column:span 1; }
  .compact-customer-form .customer-address-cell { grid-column:span 2; }
  .compact-customer-form .customer-city-cell { grid-column:span 1; }
  .compact-customer-form .customer-siret-cell { grid-column:span 2; }
  .compact-customer-form .customer-vat-cell { grid-column:span 2; }
  .compact-customer-form .customer-notes-cell { grid-column:1 / -1; }
}
@media (min-width:641px) and (max-width:1180px) {
  .compact-customer-form .customer-address-cell,
  .compact-customer-form .customer-notes-cell { grid-column:1 / -1; }
}

/* v4.2.15 — les deux cartes du bas d'un devis commencent et finissent au même niveau. */
.document-bottom-grid { align-items:stretch; }
.document-bottom-grid > .card { height:100%; box-sizing:border-box; }
.document-actions-card,
.quote-attachments { display:flex; flex-direction:column; }
.document-actions-card .button-stack { flex:1; }


/* ==========================================================================
   JTLM ERP 4.2.16 — alignement statut et cartes du dossier devis
   ========================================================================== */

/* Le libellé Statut garde exactement la même hauteur de ligne que les autres champs. */
.field-label-with-tip {
  display:inline-flex !important;
  align-items:center !important;
  gap:4px !important;
  min-height:0 !important;
  line-height:normal !important;
  width:max-content;
}
.field-label-with-tip .status-info-tip {
  width:15px !important;
  height:15px !important;
  margin:0 !important;
  flex:0 0 15px !important;
  font-size:9px !important;
  line-height:1 !important;
  vertical-align:middle !important;
  transform:none !important;
}

/* Les cartes Pièces jointes / Actions commencent sur exactement la même ligne. */
.document-bottom-grid > .quote-attachments {
  margin-top:0 !important;
}
.document-bottom-grid {
  align-items:stretch !important;
}
.document-bottom-grid > .card {
  height:100%;
  box-sizing:border-box;
}

/* Les boutons Actions retrouvent leur présentation compacte d'avant :
   la carte peut avoir la même hauteur que le dossier sans étirer ses boutons. */
.document-actions-card .button-stack {
  flex:0 0 auto !important;
  align-content:start !important;
  grid-auto-rows:auto !important;
  gap:9px !important;
}
.document-actions-card .button-stack > form,
.document-actions-card .button-stack > a {
  align-self:start;
  width:100%;
}
.document-actions-card .btn {
  min-height:40px !important;
  height:auto !important;
  padding:9px 13px !important;
}
.review-request-flag { display:grid; grid-template-columns:30px minmax(0,1fr); gap:10px; align-items:center; padding:11px 12px; border:1px solid #ead9a6; border-radius:11px; background:#fffaf0; color:#745613; }
.review-request-flag > span { display:grid; place-items:center; width:28px; height:28px; border-radius:50%; background:#e6a72c; color:#fff; font-weight:900; }
.review-request-flag > div { display:grid; gap:2px; min-width:0; }
.review-request-flag small,.review-request-help { color:#6d7785; font-size:11px; line-height:1.4; }
.review-request-flag.is-sent { border-color:#bde3c2; background:#f1faf2; color:#276d31; }
.review-request-flag.is-sent > span { background:#4fb555; }
.review-request-button { border-color:#4fb555 !important; color:#276d31 !important; background:#f3fbf4 !important; }
.planner-attendance { display:inline-flex; align-items:center; justify-content:center; min-height:28px; padding:4px 9px; border-radius:999px; background:#eaf7ec; color:#2d7136; font-size:10px; font-weight:850; }

@media (max-width:980px) {
  .document-bottom-grid > .quote-attachments { margin-top:0 !important; }
  .document-bottom-grid > .card { height:auto; }
}

/* v4.2.24 — fiche produit, import visuel et calcul du poids. */
.product-editor-visual {
  place-items: initial;
  grid-template-columns: minmax(220px, 1fr) auto;
  grid-template-areas: "title title" "preview actions";
  align-items: center;
  gap: 12px 20px;
  margin: 20px 24px 0;
  min-height: 0;
  padding: 18px;
  border-color: #d7e2ed;
  background: linear-gradient(135deg, #f7fafc 0%, #edf4fa 100%);
}
.product-editor-visual > span { grid-area: title; }
.product-image-frame {
  grid-area: preview;
  display: grid;
  place-items: center;
  min-height: 130px;
  overflow: hidden;
  border: 1px dashed #b9c9d9;
  border-radius: 12px;
  background: #fff;
}
.product-editor-visual .product-image-frame img {
  width: 100%;
  max-width: 420px;
  height: 150px;
  max-height: 150px;
  object-fit: contain;
  padding: 8px;
}
.product-image-actions {
  grid-area: actions;
  display: grid;
  justify-items: start;
  gap: 8px;
  min-width: 210px;
}
.product-image-actions .product-image-import { margin: 0; }
.product-image-actions .btn { width:100%; }
.product-image-actions small { max-width: 240px; overflow-wrap: anywhere; }
.product-gallery-section .card-head { align-items:flex-start; margin-bottom:16px; }
.product-gallery-section .card-head h2 { margin-bottom:5px; }
.product-gallery-section .card-head p { max-width:760px; margin:0; color:var(--muted); font-size:12px; }
.product-gallery-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:12px; margin-bottom:18px; }
.product-gallery-grid article { overflow:hidden; border:1px solid #d8e2eb; border-radius:12px; background:#f8fafc; }
.product-gallery-grid button { display:grid; place-items:center; width:100%; height:145px; padding:8px; border:0; border-bottom:1px solid #e1e8ef; background:#fff; cursor:zoom-in; }
.product-gallery-grid img { width:100%; height:100%; object-fit:contain; }
.product-gallery-grid label { display:flex; align-items:center; gap:7px; padding:9px 10px; color:#667085; font-size:11px; font-weight:700; }
.product-gallery-add { align-items:start; }
.product-gallery-add input[type="file"] { padding:9px; background:#fff; }
.weight-field .field-inline .btn { border-color: #bdd0e2; background: #eef5fb; color: var(--navy); }
.weight-calculator-dialog { width: min(720px, calc(100vw - 28px)); }
.weight-calculator-dialog .dialog-body { padding: 22px; background: #f5f8fb; }
.weight-calculator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.weight-calculator-grid > label {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #d9e3ed;
  border-radius: 12px;
  background: #fff;
  color: #536276;
  font-size: 12px;
  font-weight: 800;
}
.calculator-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #c9d6e2;
  border-radius: 9px;
  background: #fff;
}
.calculator-input:focus-within { border-color: #2e75b6; box-shadow: 0 0 0 3px rgba(46,117,182,.12); }
.calculator-input input { min-width: 0; border: 0; box-shadow: none !important; }
.calculator-input b { padding: 0 10px; color: #64748b; font-size: 11px; white-space: nowrap; }
.weight-calculator-results {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 12px;
  margin-top: 14px;
}
.weight-calculator-results > div {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid #d9e3ed;
  border-radius: 12px;
  background: #fff;
}
.weight-calculator-results .weight-result { margin: 0; border-top: 4px solid var(--green); background: linear-gradient(135deg, #eff9f1, #fff); }
.weight-calculator-results span,
.weight-calculator-results small { color: #667483; font-size: 12px; }
.weight-calculator-results strong { color: var(--navy); font-size: 22px; }
.product-summary { margin-top: 18px; padding: 20px; }
.product-summary .card-head { margin-bottom: 15px; }
.product-summary .card-head h2 { margin: 3px 0 0; color: var(--navy); font-size: 18px; }
.product-kpis.product-kpis-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.product-kpis.product-kpis-summary .kpi { min-height: 112px; box-shadow: none; }
.product-kpis.product-kpis-summary .kpi:nth-child(4) { border-top-color: #2e75b6; }
.product-kpis.product-kpis-summary .kpi:nth-child(5) { border-top-color: #e69124; }
.product-kpis.product-kpis-summary .kpi:nth-child(6) { border-top-color: #64748b; }
.product-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 18px 0 22px;
  padding: 18px 20px;
  border: 1px solid #f0c4c4;
  border-left: 5px solid #cc3d3d;
  background: #fffafa;
}
.product-danger-zone h2 { margin: 3px 0 4px; color: #8e2525; font-size: 17px; }
.product-danger-zone p { margin: 0; color: #775d5d; font-size: 12px; }
.product-danger-zone .btn { flex: 0 0 auto; }
@media (max-width: 850px) {
  .product-editor-visual { grid-template-columns: 1fr; grid-template-areas: "title" "preview" "actions"; }
  .product-image-actions { min-width: 0; }
  .weight-calculator-grid { grid-template-columns: 1fr; }
  .product-kpis.product-kpis-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .product-editor-visual { margin: 14px 14px 0; }
  .weight-calculator-results,
  .product-kpis.product-kpis-summary { grid-template-columns: 1fr; }
  .product-danger-zone { align-items: stretch; flex-direction: column; }
  .product-danger-zone .btn { width: 100%; }
}

/* Avoir : la seule ligne complémentaire disponible occupe toute la largeur. */
#documentForm[data-kind="credit"] .special-lines .special-line {
  grid-column: 1 / -1;
  width: 100%;
}

/* Analyse historique : une teinte par année et une lecture immédiate des évolutions. */
.analysis-history-controls { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.analysis-history-table th[class*="history-year-"],
.analysis-history-table td[class*="history-year-"] { border-left: 3px solid transparent; }
.analysis-history-table .history-year-1 { background: #eef6ff; border-left-color: #4c8ed9; }
.analysis-history-table .history-year-2 { background: #eef9f0; border-left-color: #4fb555; }
.analysis-history-table .history-year-3 { background: #fff7e8; border-left-color: #e5a52e; }
.analysis-history-table .history-year-4 { background: #f5efff; border-left-color: #8d63c7; }
.analysis-history-table tbody tr:hover td { filter: brightness(.975); }
.analysis-history-table td small { display:block; margin-top:3px; color:var(--muted); }
.analysis-history-table .history-evolution { font-weight:800; background:#f5f7fa; }
.analysis-history-table .history-evolution.is-positive { color:#287a3c; background:#ebf8ee; }
.analysis-history-table .history-evolution.is-negative { color:#b03939; background:#fff0f0; }

/* Liste de codes modulaire. */
.code-builder-filter input[type="search"] { min-width:240px; }
.code-builder { display:grid; gap:18px; }
.code-builder-family { --family-accent:#4fb555; padding:0; overflow:hidden; border-top:4px solid var(--family-accent); }
.code-builder-family:nth-child(3n+2) { --family-accent:#2e75b8; }
.code-builder-family:nth-child(3n+3) { --family-accent:#e39a2d; }
.code-builder-family-head { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:15px 18px; background:linear-gradient(90deg,color-mix(in srgb,var(--family-accent) 12%,white),#fff); border-bottom:1px solid var(--line); }
.code-builder-family.is-collapsed .code-builder-family-head { border-bottom:0; }
.code-builder-family.is-collapsed .code-builder-container-grid { display:none; }
.code-builder-title-form { display:grid; grid-template-columns:minmax(260px,440px); row-gap:4px; align-items:center; justify-content:start; flex:1; min-width:0; }
.code-builder-title-form > span { grid-column:1/-1; color:var(--family-accent); font-size:10px; font-weight:900; letter-spacing:.12em; }
.code-builder-title-form input { border:0; padding:4px 0; background:transparent; color:var(--navy); font-size:21px; font-weight:850; }
.code-builder-head-actions .code-add-block { width:auto; height:34px; min-height:34px; padding:0 13px; border:1px solid #a9d8b0; border-radius:9px; background:#fff; color:#287a36; box-shadow:0 2px 7px rgba(39,122,54,.08); font-size:11px; font-weight:850; white-space:nowrap; }
.code-builder-head-actions .code-add-block:hover { border-color:#63b670; background:#edf8ef; color:#1f672c; box-shadow:0 4px 10px rgba(39,122,54,.12); transform:translateY(-1px); }
.code-builder-title-form [data-code-save-state],.code-container-title-form [data-code-save-state] { margin-left:6px; color:#718096; font-size:9px; font-style:normal; font-weight:750; letter-spacing:0; text-transform:none; }
.code-builder-title-form [data-code-save-state].is-saved,.code-container-title-form [data-code-save-state].is-saved { color:#27813a; }
.code-builder-title-form [data-code-save-state].is-error,.code-container-title-form [data-code-save-state].is-error { color:#b83c3c; }
.code-builder-head-actions,.code-builder-head-actions form,.code-builder-container > header > div,.code-builder-container > header > div form { display:flex; align-items:center; gap:5px; }
.builder-icon-btn { display:inline-grid; width:34px; height:34px; flex:0 0 34px; place-items:center; padding:0; border:1px solid #d3dee8; border-radius:9px; background:#fff; color:#244d78; box-shadow:0 2px 7px rgba(13,47,104,.06); cursor:pointer; transition:border-color .16s ease,background .16s ease,color .16s ease,transform .16s ease,box-shadow .16s ease; }
.builder-icon-btn svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.builder-icon-btn:hover { border-color:#95aec5; background:#f2f7fb; color:#0d2f68; box-shadow:0 4px 10px rgba(13,47,104,.1); transform:translateY(-1px); }
.builder-icon-btn:focus-visible { outline:3px solid rgba(46,117,184,.22); outline-offset:2px; }
.builder-icon-btn.save { border-color:#b9dfc0; background:#eef9f0; color:#267737; }
.builder-icon-btn.save:hover { border-color:#75bd82; background:#e1f5e5; }
.builder-icon-btn.danger { border-color:#efd0d0; background:#fff7f7; color:#ad3e3e; }
.builder-icon-btn.danger:hover { border-color:#db9b9b; background:#fff0f0; color:#8e2525; }
.builder-icon-btn.family-toggle svg { transition:transform .2s ease; }
.code-builder-family.is-collapsed .builder-icon-btn.family-toggle svg { transform:rotate(-90deg); }
.code-builder-container-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; padding:16px; align-items:stretch; }
.code-builder-container { display:flex; min-width:0; overflow:hidden; flex-direction:column; border:1px solid #dce5ed; border-radius:14px; background:#fff; box-shadow:0 8px 22px rgba(13,47,104,.06); }
.code-builder-container > header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px 11px; background:#f5f8fb; border-bottom:1px solid #dce5ed; }
.code-container-title-form { display:flex; align-items:center; gap:5px; min-width:0; flex:1; }
.code-container-title-form input { min-width:0; width:100%; border:0; background:transparent; color:var(--navy); font-size:14px; font-weight:850; }
.code-container-title-form [data-code-save-state] { flex:0 0 auto; }
.code-builder-table-wrap { overflow-x:auto; min-height:110px; flex:1 1 auto; transition:.18s ease; scrollbar-width:thin; }
.code-builder-table-wrap.is-drop-target { background:#eaf8ed; box-shadow:inset 0 0 0 3px #4fb555; }
.code-builder-table { width:100%; min-width:520px; table-layout:fixed; font-size:10.5px; }
.code-builder-table th,.code-builder-table td { padding:7px 5px; vertical-align:middle; }
.code-builder-table th:nth-child(1){width:46px}.code-builder-table th:nth-child(2){width:135px}.code-builder-table th:nth-child(3){width:62px}.code-builder-table th:nth-child(n+4):nth-child(-n+7){width:62px}.code-builder-table th:last-child{width:34px}
.code-builder-table th:nth-child(3),.code-builder-table td:nth-child(3),.code-builder-table th:nth-child(n+4):nth-child(-n+7),.code-builder-table td:nth-child(n+4):nth-child(-n+7) { text-align:center; }
.code-builder-table tbody tr { cursor:grab; }
.code-builder-table tbody tr.is-dragging { opacity:.42; }
.code-builder-table tbody tr.drop-before td { box-shadow:inset 0 3px 0 #39a64b; }
.code-builder-table tbody tr.drop-after td { box-shadow:inset 0 -3px 0 #39a64b; }
.code-builder-table tbody tr.drop-before td:first-child::before,
.code-builder-table tbody tr.drop-after td:first-child::before { content:""; position:absolute; left:1px; width:8px; height:8px; border-radius:50%; background:#39a64b; }
.code-builder-table tbody tr.drop-before td:first-child::before { top:-4px; }
.code-builder-table tbody tr.drop-after td:first-child::before { bottom:-4px; }
.code-builder-table tbody tr.drop-before td:first-child,
.code-builder-table tbody tr.drop-after td:first-child { position:relative; }
.code-builder-image-button { display:block; padding:0; border:0; border-radius:7px; background:transparent; cursor:zoom-in; }
.code-builder-image img,.code-builder-image span { display:block; width:34px; height:34px; object-fit:contain; border-radius:7px; background:#f1f4f7; }
.code-builder-image span { display:grid; place-items:center; color:#789; font-size:18px; }
.code-builder-table td:nth-child(2) b { display:-webkit-box; overflow:hidden; -webkit-line-clamp:2; -webkit-box-orient:vertical; line-height:1.25; }
.code-builder-table .ratio-pill { padding:3px 5px; font-size:9.5px; white-space:nowrap; }
.code-container-empty { height:76px; text-align:center; color:var(--muted); background:#fafcfd; }
.code-container-footer { display:flex; align-items:center; gap:8px; margin-top:auto; padding:10px; }
.code-builder-dialog { width:min(560px,calc(100vw - 30px)); overflow:hidden; border:0; border-radius:18px; box-shadow:0 24px 70px rgba(8,35,70,.25); }
.code-builder-dialog .transport-dialog-head { align-items:flex-start; padding:22px 24px 20px; background:linear-gradient(135deg,#0d2f68,#174a91); border-bottom:0; color:#fff; }
.code-builder-dialog .transport-dialog-head .section-kicker { color:#9ed0ff !important; }
.code-builder-dialog .transport-dialog-head h3 { margin:4px 0 5px; color:#fff !important; font-size:21px; }
.code-builder-dialog .transport-dialog-head p { max-width:410px; margin:0; color:#d8e7fb; line-height:1.45; }
.code-builder-dialog .transport-dialog-head .builder-icon-btn { color:#fff; background:rgba(255,255,255,.13); border-color:rgba(255,255,255,.28); box-shadow:none; }
.code-builder-dialog .transport-dialog-head .builder-icon-btn:hover { background:rgba(255,255,255,.22); border-color:rgba(255,255,255,.5); color:#fff; }
.code-builder-create-form { display:grid; gap:22px; padding:24px; background:#fff; }
.code-builder-create-form label { display:grid; gap:8px; color:#3e5065; font-size:12px; font-weight:850; }
.code-builder-create-form input { width:100%; min-height:47px; padding:11px 13px; border:1px solid #cfdbe6; border-radius:10px; background:#fff; color:var(--navy); font-size:14px; box-shadow:inset 0 1px 2px rgba(13,47,104,.04); }
.code-builder-create-form input:focus { border-color:#4f8fc8; outline:3px solid rgba(46,117,184,.14); }
.code-builder-dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin:0 -24px -24px; padding:16px 24px; border-top:1px solid #e1e8ef; background:#f7f9fc; }
.code-builder-dialog-actions .btn { min-width:118px; min-height:42px; }
.special-order-deposit-panel { position:relative; }
.deposit-save-feedback { position:absolute; z-index:2; right:13px; bottom:2px; display:block; max-width:220px; overflow:hidden; color:#718096; font-size:9px; font-weight:750; line-height:1.2; text-overflow:ellipsis; white-space:nowrap; pointer-events:none; }
.deposit-save-feedback:empty { display:none; }
.deposit-save-feedback.is-saved { color:#27813a; }
.deposit-save-feedback.is-error { color:#b83c3c; }
.code-image-dialog { width:min(920px,calc(100vw - 28px)); }
.code-image-dialog-body { display:grid; place-items:center; min-height:320px; max-height:calc(100vh - 150px); padding:20px; overflow:auto; background:#f4f7fa; }
.code-image-dialog-body img { display:block; max-width:100%; max-height:calc(100vh - 190px); object-fit:contain; border-radius:10px; background:#fff; box-shadow:0 10px 30px rgba(13,47,104,.12); }
@media (max-width:980px) { .analysis-history-controls { grid-template-columns:repeat(2,minmax(0,1fr)); } .code-builder-container-grid { grid-template-columns:1fr; } }
@media (max-width:620px) { .analysis-history-controls { grid-template-columns:1fr; } .code-builder-family-head { align-items:flex-start; flex-direction:column; } .code-builder-title-form { width:100%; grid-template-columns:minmax(0,1fr); } .code-builder-head-actions { align-self:flex-end; flex-wrap:wrap; justify-content:flex-end; } }

/* Paramètres : journal d'activité centralisé. */
.audit-log-settings > .card-head,
.audit-log-settings > .audit-kpis,
.audit-log-settings > .audit-filters,
.audit-log-settings > .audit-result-head,
.audit-log-settings > .audit-pagination,
.audit-log-settings > .audit-retention-note { margin-left: 18px; margin-right: 18px; }
.audit-log-settings > .card-head { margin-top: 18px; }
.audit-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}
.audit-kpis > div {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  border: 1px solid #dce5ee;
  border-radius: 11px;
  background: #f8fafc;
}
.audit-kpis span { color: var(--muted); font-size: 11px; font-weight: 700; }
.audit-kpis strong { color: var(--navy); font-size: 20px; }
.audit-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.8fr) repeat(3, minmax(145px, 1fr)) repeat(2, minmax(125px, .7fr));
  gap: 9px;
  align-items: end;
  padding: 13px;
  border: 1px solid #dce5ee;
  border-radius: 12px;
  background: #f8fafc;
}
.audit-filters label { display: grid; gap: 5px; min-width: 0; color: #526277; font-size: 11px; font-weight: 800; }
.audit-filters input,
.audit-filters select { width: 100%; min-width: 0; height: 40px; }
.audit-filter-actions { display: flex; gap: 7px; grid-column: 1 / -1; justify-content: flex-end; }
.audit-result-head,
.audit-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.audit-result-head { padding: 16px 0 9px; color: #526277; font-size: 12px; }
.audit-result-head b { color: var(--navy); }
.audit-table-wrap { margin: 0 18px; border: 1px solid #dce5ee; border-radius: 11px; }
.audit-table { min-width: 1080px; }
.audit-table th { white-space: nowrap; }
.audit-table td { vertical-align: top; font-size: 12px; }
.audit-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.audit-date { white-space: nowrap; }
.audit-action-badge {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eaf1f8;
  color: #244f7d;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.audit-details { width: 30%; min-width: 230px; overflow-wrap: anywhere; }
.audit-details summary { cursor: pointer; color: #315b89; }
.audit-details pre { max-width: 520px; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: #3f4d5f; }
.audit-ip { white-space: nowrap; color: #607086; }
.audit-pagination { padding: 14px 0 4px; }
.audit-pagination span { color: var(--muted); font-size: 11px; }
.audit-retention-note { margin-top: 12px; margin-bottom: 18px; color: var(--muted); font-size: 11px; }
@media (max-width: 1100px) {
  .audit-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .audit-search { grid-column: span 2; }
}
@media (max-width: 700px) {
  .audit-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-filters { grid-template-columns: 1fr 1fr; }
  .audit-search { grid-column: 1 / -1; }
  .audit-log-settings > .card-head,
  .audit-log-settings > .audit-kpis,
  .audit-log-settings > .audit-filters,
  .audit-log-settings > .audit-result-head,
  .audit-log-settings > .audit-pagination,
  .audit-log-settings > .audit-retention-note { margin-left: 12px; margin-right: 12px; }
  .audit-table-wrap { margin-left: 12px; margin-right: 12px; }
}

/* v4.2.47 — historique CA et typologie de l'inventaire. */
.analysis-history-kpis { margin: 16px 0; }
.analysis-history-kpis .kpi { border-top: 4px solid var(--green); }
.analysis-history-kpis .kpi:nth-child(2) { border-top-color: var(--blue); }
.analysis-history-kpis .kpi:nth-child(3) { border-top-color: #e4a11b; }
.analysis-history-kpis .kpi:nth-child(4) { border-top-color: #6b5fc7; }
.analysis-history-kpis small { display: block; margin-top: 6px; color: var(--muted); }
.analysis-history-table tfoot th { border-top: 2px solid var(--blue); background: #eef4fb; font-weight: 800; }
.analysis-history-table .is-positive { color: #23712b; }
.analysis-history-table .is-negative { color: #b42318; }
.matrix-row.matrix-credit { background: #f3f0ff; }

/* v4.2.48 — valorisation rapide du stock et alerte d'avoir. */
.stock-value-dialog { width:min(560px,calc(100vw - 30px)); border:0; border-radius:18px; box-shadow:0 24px 70px rgba(8,35,70,.28); }
.stock-value-dialog .dialog-body { display:grid; gap:18px; padding:22px; }
.stock-value-dialog .dialog-body > .btn { justify-self:end; min-width:110px; }
.stock-value-result { display:grid; gap:7px; padding:22px; border:1px solid #cfe1d2; border-radius:14px; background:#f2faf3; }
.stock-value-result span { color:#526277; font-size:12px; font-weight:800; }
.stock-value-result strong { color:#23712b; font-size:clamp(30px,5vw,44px); line-height:1; }
.stock-value-result small { margin-top:5px; color:var(--muted); }
.available-credit-notice { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:18px; border-left:4px solid #e39a2d; background:#fff7e8; }
.available-credit-notice > div { display:grid; gap:3px; }
.available-credit-notice span { color:#65512c; }
.available-credit-notice .btn { flex:0 0 auto; }
.credit-allocation-card .form-grid .btn { align-self:end; min-height:40px; height:40px; padding-top:8px; padding-bottom:8px; }
@media (max-width:620px) { .available-credit-notice { align-items:stretch; flex-direction:column; } .available-credit-notice .btn { width:100%; } }

/* v4.2.56 — colonne Stockage réellement compacte et typographie homogène. */
.price-list-table { width:100%; min-width:1180px !important; }
.price-list-table th:nth-child(11), .price-list-table td:nth-child(11) { width:145px; }
.price-list-table th:nth-child(12), .price-list-table td:nth-child(12) { width:90px; }
.price-list-table th:nth-child(13) { width:112px; }
.price-list-table td:nth-child(13) { width:112px; min-width:0 !important; max-width:112px; padding-left:8px; padding-right:8px; white-space:normal !important; overflow-wrap:anywhere; word-break:normal; }
.price-list-table .price-list-column-filters th:nth-child(11) input,
.price-list-table .price-list-column-filters th:nth-child(12) input,
.price-list-table .price-list-column-filters th:nth-child(13) input { width:100%; min-width:0; max-width:none; height:32px; padding:5px 7px; font-size:10px; }
.analysis-history-dialog { width:min(1180px,calc(100vw - 30px)); max-height:92vh; padding:0; overflow:hidden; border:0; border-radius:20px; box-shadow:0 28px 80px rgba(8,35,70,.32); }
.analysis-history-dialog::backdrop { background:rgba(7,25,50,.64); backdrop-filter:blur(4px); }
.analysis-history-dialog .transport-dialog-head { padding:20px 24px; }
.analysis-history-dialog .dialog-body { display:grid; gap:16px; max-height:calc(92vh - 105px); padding:18px 22px 22px; overflow:auto; background:#f5f8fb; }
.analysis-history-modal-controls { display:grid; grid-template-columns:1.25fr repeat(4,minmax(120px,.8fr)) auto; gap:10px; align-items:end; padding:14px; border:1px solid #dbe5ee; border-radius:14px; background:#fff; }
.analysis-history-modal-controls label { display:grid; gap:5px; color:#526277; font-size:10px; font-weight:850; text-transform:uppercase; letter-spacing:.035em; }
.analysis-history-modal-controls input,.analysis-history-modal-controls select { width:100%; min-width:0; height:39px; font-size:12px; }
.analysis-year-donut { display:flex; align-items:center; justify-content:center; gap:7px; min-width:116px; }
.analysis-year-donut svg { width:54px; height:54px; flex:0 0 54px; transform:rotate(-90deg); }
.analysis-year-donut circle { cursor:help; transition:stroke-width .18s ease,opacity .18s ease; }
.analysis-year-donut circle:hover { stroke-width:8; opacity:.88; }
.analysis-year-donut text { fill:var(--navy); font-size:7px; font-weight:900; transform:rotate(90deg); transform-origin:21px 21px; }
.analysis-year-donut > div { display:grid; gap:3px; }
.analysis-year-donut span { display:flex; align-items:center; gap:5px; color:#526277; font-size:9px; font-weight:850; cursor:help; }
.analysis-year-donut span i { width:7px; height:7px; border-radius:2px; }
.analysis-history-modal-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.analysis-history-modal-kpis > div { display:grid; gap:3px; padding:13px 15px; border:1px solid #dce5ed; border-top:4px solid #4fb555; border-radius:12px; background:#fff; }
.analysis-history-modal-kpis > div:nth-child(2) { border-top-color:#2e75b8; }
.analysis-history-modal-kpis > div:nth-child(3) { border-top-color:#e39a2d; }
.analysis-history-modal-kpis > div:nth-child(4) { border-top-color:#8d63c7; }
.analysis-history-modal-kpis span { color:#64748b; font-size:10px; font-weight:850; text-transform:uppercase; }
.analysis-history-modal-kpis b { color:var(--navy); font-size:20px; }
.analysis-history-modal-kpis small { color:var(--muted); }
.analysis-history-modal-kpis .is-positive { color:#27823a; }
.analysis-history-modal-kpis .is-negative { color:#b53a3a; }
.analysis-history-legend { display:flex; flex-wrap:wrap; gap:8px 15px; padding:0 4px; }
.analysis-history-legend span { display:flex; align-items:center; gap:6px; color:#526277; font-size:11px; font-weight:800; }
.analysis-history-legend i { width:10px; height:10px; border-radius:3px; }
.analysis-history-chart { display:grid; gap:10px; }
.analysis-history-chart article { display:grid; grid-template-columns:minmax(135px,210px) minmax(0,1fr); gap:16px; padding:13px 15px; border:1px solid #dce5ed; border-radius:13px; background:#fff; box-shadow:0 3px 12px rgba(13,47,104,.045); }
.analysis-history-chart article > header { display:flex; flex-direction:column; justify-content:center; gap:5px; min-width:0; }
.analysis-history-chart article > header b { overflow:hidden; color:var(--navy); font-size:12px; text-overflow:ellipsis; }
.analysis-history-chart article > header strong { color:#2c7540; font-size:15px; }
.analysis-history-series { display:grid; gap:5px; min-width:0; }
.analysis-history-bar-row { display:grid; grid-template-columns:42px minmax(100px,1fr) 105px; gap:9px; align-items:center; min-width:0; }
.analysis-history-bar-row > span { color:#607086; font-size:10px; font-weight:850; }
.analysis-history-bar-row > b { color:var(--navy); font-size:10px; text-align:right; white-space:nowrap; }
.analysis-history-bar-row > small { grid-column:2/-1; margin-top:-3px; color:var(--muted); font-size:9px; }
.analysis-history-track { height:9px; overflow:hidden; border-radius:999px; background:#e9eff4; }
.analysis-history-track i { display:block; height:100%; border-radius:inherit; box-shadow:inset 0 -1px 0 rgba(0,0,0,.08); }
@media (max-width:900px) { .analysis-history-modal-controls { grid-template-columns:repeat(2,minmax(0,1fr)); } .analysis-history-modal-controls .btn { width:100%; } .analysis-history-modal-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:620px) { .analysis-history-dialog { width:calc(100vw - 16px); } .analysis-history-dialog .dialog-body { padding:12px; } .analysis-history-modal-controls { grid-template-columns:1fr; } .analysis-history-chart article { grid-template-columns:1fr; } .analysis-history-bar-row { grid-template-columns:36px minmax(70px,1fr) 86px; } }

/* ==========================================================================
   JTLM ERP 4.2.57 — facturation, price list et stocks finalisés
   ========================================================================== */

.invoice-status-locked {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  align-items: center;
  margin-top: 16px;
  padding: 13px 14px;
  border: 1px solid #cfe4d3;
  border-radius: 11px;
  background: #f2faf3;
}
.invoice-status-locked > span { color: var(--navy); font-size: 12px; font-weight: 850; }
.invoice-status-locked small { grid-column: 1 / -1; color: #5e6e64; }

/* Sur un écran PC standard, toute la Price List tient dans la zone de travail. */
@media (min-width: 1181px) {
  .price-list-wrap { overflow-x: hidden !important; }
  .price-list-table { width: 100% !important; min-width: 0 !important; table-layout: fixed; }
  .price-list-table th, .price-list-table td { min-width: 0 !important; padding-inline: 6px; }
  .price-list-table th:nth-child(1), .price-list-table td:nth-child(1) { width: 34px; }
  .price-list-table th:nth-child(2), .price-list-table td:nth-child(2) { width: 68px; }
  .price-list-table th:nth-child(3), .price-list-table td:nth-child(3) { width: 72px; }
  .price-list-table th:nth-child(4), .price-list-table td:nth-child(4) { width: 13%; }
  .price-list-table th:nth-child(5), .price-list-table td:nth-child(5) { width: 12%; }
  .price-list-table th:nth-child(6), .price-list-table td:nth-child(6) { width: 8%; }
  .price-list-table th:nth-child(7), .price-list-table td:nth-child(7),
  .price-list-table th:nth-child(8), .price-list-table td:nth-child(8) { width: 7%; }
  .price-list-table th:nth-child(9), .price-list-table td:nth-child(9) { width: 8%; }
  .price-list-table th:nth-child(10), .price-list-table td:nth-child(10) { width: 7%; }
  .price-list-table th:nth-child(11), .price-list-table td:nth-child(11) { width: 9%; }
  .price-list-table th:nth-child(12), .price-list-table td:nth-child(12) { width: 6%; }
  .price-list-table th:nth-child(13), .price-list-table td:nth-child(13) { width: 8%; max-width: none; }
  .price-list-table .full-designation,
  .price-list-table .price-list-comment { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
  .price-list-table .product-thumb-cell a { width: 48px; height: 48px; }
}

/* Inventaire : aucune ombre sous la dernière ligne fixe et aucune barre latérale. */
.stock-matrix-body .matrix-stock-value-row > * { box-shadow: none !important; }
.stock-matrix .matrix-stock-row th { border-left: 0 !important; }

/* La zone verticale commence bien après les six lignes de synthèse. */
@media (max-width: 1180px) {
  .stock-matrix-header-wrap,
  .stock-matrix-body-wrap { contain: paint; }
  .stock-matrix-body .matrix-physical-row > *,
  .stock-matrix-body .matrix-reserved-row > *,
  .stock-matrix-body .matrix-stock-row > *,
  .stock-matrix-body .matrix-pmp-row > *,
  .stock-matrix-body .matrix-stock-value-row > * { box-shadow: none !important; }
  .stock-matrix-body .matrix-event > * { position: relative; z-index: 1; }
}

/* Journal détaillé : tableau de bord compact et registre de mouvements. */
.stock-journal-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  padding: 20px 22px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(125deg, #0d2f68 0%, #174f83 68%, #237044 145%);
  box-shadow: 0 12px 30px rgba(13,47,104,.16);
}
.stock-journal-hero h2 { margin: 4px 0 6px; color: #fff; font-size: 22px; }
.stock-journal-hero p { max-width: 760px; margin: 0; color: rgba(255,255,255,.76); line-height: 1.45; }
.stock-journal-hero .section-kicker { color: #8fe095; }
.stock-journal-hero-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.journal-type { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 850; }
.journal-type.is-purchase { color: #154d7e; background: #eaf3ff; }
.journal-type.is-invoice { color: #28733a; background: #eaf8ed; }
.journal-type.is-reservation { color: #845c14; background: #fff5d9; }
.stock-journal-kpis { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; margin-bottom: 14px; }
.stock-journal-kpis article { display: grid; gap: 5px; padding: 15px 17px; border: 1px solid #dce5ee; border-top: 4px solid var(--green); border-radius: 13px; background: #fff; }
.stock-journal-kpis article:nth-child(2) { border-top-color: var(--navy); }
.stock-journal-kpis article:nth-child(3) { border-top-color: #4d8cc5; }
.stock-journal-kpis article:nth-child(4) { border-top-color: #de7b64; }
.stock-journal-kpis span { color: #64748b; font-size: 10px; font-weight: 850; text-transform: uppercase; }
.stock-journal-kpis strong { color: var(--navy); font-size: 21px; }
.stock-journal-kpis small { color: var(--muted); }
.stock-journal-layout { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 14px; align-items: start; }
.stock-journal-entry { position: sticky; top: 82px; padding: 17px; }
.stock-journal-entry .card-head { margin-bottom: 12px; }
.stock-journal-entry .form-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.stock-journal-entry label { font-size: 11px; }
.stock-journal-main { display: grid; gap: 12px; min-width: 0; }
.stock-journal-filter { display: grid; grid-template-columns: 145px 145px minmax(190px,1fr) minmax(170px,.7fr); gap: 10px; padding: 13px; }
.stock-journal-filter label { min-width: 0; }
.stock-journal-ledger { min-width: 0; padding: 0; overflow: hidden; }
.stock-journal-ledger-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px 12px; }
.stock-journal-ledger-head h2 { margin: 3px 0 0; color: var(--navy); font-size: 16px; }
.stock-journal-ledger-head small { color: var(--muted); }
.stock-journal-ledger .table-wrap { border-top: 1px solid #e2e8ef; border-radius: 0; box-shadow: none; }
.stock-journal-ledger .stock-journal-editable { min-width: 1030px !important; }

/* 4.2.58 — la matrice utilise un seul tableau : en-tête, synthèse et lignes
   partagent désormais exactement le même défilement sur tablette. */
.stock-matrix-scroll {
  width: 100%;
  max-width: 100%;
  height: calc(100vh - 315px);
  min-height: 560px;
  max-height: 820px;
  overflow: auto;
  isolation: isolate;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}
.stock-matrix-scroll .stock-matrix thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  background: #e9eff5 !important;
}
.stock-matrix-scroll .matrix-physical-row > * { top: 170px !important; }
.stock-matrix-scroll .matrix-reserved-row > * { top: 212px !important; }
.stock-matrix-scroll .matrix-stock-row > * { top: 254px !important; }
.stock-matrix-scroll .matrix-pmp-row > * { top: 296px !important; }
.stock-matrix-scroll .matrix-stock-value-row > * {
  top: 338px !important;
  box-shadow: none !important;
}
/* Les anciennes règles responsive forçaient les deux premières cellules en
   position statique. Cette règle plus précise maintient les six lignes de
   synthèse entières, sans détacher Description et Date sur tablette. */
.stock-matrix-scroll .stock-matrix .matrix-physical-row > *,
.stock-matrix-scroll .stock-matrix .matrix-reserved-row > *,
.stock-matrix-scroll .stock-matrix .matrix-stock-row > *,
.stock-matrix-scroll .stock-matrix .matrix-pmp-row > *,
.stock-matrix-scroll .stock-matrix .matrix-stock-value-row > * {
  position: sticky !important;
  left: auto !important;
  right: auto !important;
}
.stock-matrix-scroll .stock-matrix .matrix-physical-row > * { top: 170px !important; }
.stock-matrix-scroll .stock-matrix .matrix-reserved-row > * { top: 212px !important; }
.stock-matrix-scroll .stock-matrix .matrix-stock-row > * { top: 254px !important; }
.stock-matrix-scroll .stock-matrix .matrix-pmp-row > * { top: 296px !important; }
.stock-matrix-scroll .stock-matrix .matrix-stock-value-row > * { top: 338px !important; }
.stock-journal-editable td.row-actions {
  display: table-cell !important;
  height: 100%;
  vertical-align: middle;
  white-space: nowrap;
}
.stock-journal-editable td.row-actions > form { display: inline-block; margin: 0; }

.price-list-main-filters { align-items: start; }
.price-multifilter { position: relative; min-width: 190px; }
.price-multifilter summary {
  min-height: 40px;
  padding: 10px 34px 10px 12px;
  border: 1px solid #cbd8e3;
  border-radius: 9px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}
.price-multifilter summary::-webkit-details-marker { display: none; }
.price-multifilter summary::after { content: "⌄"; position: absolute; top: 9px; right: 12px; }
.price-multifilter > div {
  position: absolute;
  z-index: 40;
  top: calc(100% + 5px);
  left: 0;
  display: grid;
  gap: 3px;
  width: max-content;
  min-width: 230px;
  max-height: 320px;
  padding: 9px;
  overflow: auto;
  border: 1px solid #cbd8e3;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(13,47,104,.16);
}
.price-multifilter label { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px; color: #334a63; font-size: 11px; font-weight: 700; }
.price-multifilter label:hover { background: #f1f6fa; }
.price-multifilter input { width: auto !important; min-width: 0 !important; margin: 0; }
.price-list-column-filters select { width: 100%; min-width: 0; height: 32px; padding: 4px; border: 1px solid #cbd8e3; border-radius: 7px; background: #fff; color: #243f61; font-size: 9px; font-weight: 700; }
.price-list-column-filters span { display: block; color: #708096; font-size: 9px; font-weight: 750; text-align: center; text-transform: none; letter-spacing: 0; }
.price-header-filter { position: relative; width: 100%; color: #243f61; text-align: left; }
.price-header-filter summary {
  position: relative;
  min-height: 32px;
  padding: 7px 20px 6px 7px;
  overflow: hidden;
  border: 1px solid #cbd8e3;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
  list-style: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.price-header-filter summary::-webkit-details-marker { display: none; }
.price-header-filter summary::after { content: "⌄"; position: absolute; top: 6px; right: 7px; }
.price-header-filter > div {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  left: 0;
  display: grid;
  gap: 2px;
  width: max-content;
  min-width: 220px;
  max-width: 320px;
  max-height: 310px;
  padding: 8px;
  overflow: auto;
  border: 1px solid #cbd8e3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(13,47,104,.2);
}
.price-header-filter-storage > div { right: 0; left: auto; }
.price-header-filter label { display: flex; align-items: center; gap: 7px; padding: 6px 7px; border-radius: 6px; color: #334a63; font-size: 10px; font-weight: 700; text-transform: none; letter-spacing: 0; white-space: nowrap; }
.price-header-filter label:hover { background: #f1f6fa; }
.price-header-filter label input { width: auto !important; min-width: 0 !important; margin: 0; }
.price-header-filter .btn { width: 100%; margin-top: 5px; }
.price-list-column-filters th:has(.price-header-filter[open]) { z-index: 25; overflow: visible; }

@media (min-width: 1181px) {
  .stock-matrix-scroll .stock-matrix thead th:first-child,
  .stock-matrix-scroll .stock-matrix tbody th:first-child {
    position: sticky !important;
    left: 0 !important;
  }
  .stock-matrix-scroll .stock-matrix thead th:first-child { z-index: 42 !important; }
  .stock-matrix-scroll .stock-matrix tbody .matrix-physical-row > :first-child,
  .stock-matrix-scroll .stock-matrix tbody .matrix-reserved-row > :first-child,
  .stock-matrix-scroll .stock-matrix tbody .matrix-stock-row > :first-child,
  .stock-matrix-scroll .stock-matrix tbody .matrix-pmp-row > :first-child,
  .stock-matrix-scroll .stock-matrix tbody .matrix-stock-value-row > :first-child { z-index: 41 !important; }
}
@media (max-width: 1180px) {
  .stock-matrix-scroll { min-height: 500px; height: min(720px, calc(100dvh - 245px)); }
  .stock-matrix-scroll .stock-matrix thead th { position: sticky !important; }
  .price-list-main-filters { grid-template-columns: 1fr 1fr; }
  .price-list-main-filters > input:first-of-type { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .price-list-main-filters { grid-template-columns: 1fr; }
  .price-list-main-filters > input:first-of-type { grid-column: auto; }
  .price-multifilter { width: 100%; }
  .price-multifilter > div { position: static; width: 100%; min-width: 0; margin-top: 5px; box-shadow: none; }
}

@media (max-width: 1050px) {
  .stock-journal-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stock-journal-layout { grid-template-columns: 1fr; }
  .stock-journal-entry { position: static; }
  .stock-journal-entry .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stock-journal-filter { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .stock-journal-hero { align-items: flex-start; flex-direction: column; padding: 17px; }
  .stock-journal-hero-legend { justify-content: flex-start; }
  .stock-journal-kpis { grid-template-columns: 1fr; }
  .stock-journal-entry .form-grid,
  .stock-journal-filter { grid-template-columns: 1fr; }
  .stock-journal-ledger-head { align-items: flex-start; flex-direction: column; }
}

/* v4.2.52 — continuité devis/facture, configurateurs et relances. */
.quote-invoiced-notice,
.deposit-deduction-editor-notice,
.configurator-draft-notice { display:flex; align-items:center; justify-content:space-between; gap:18px; margin-bottom:16px; border-left:4px solid var(--green); background:#f2faf3; }
.quote-invoiced-notice > div,
.configurator-draft-notice > div,
.deposit-deduction-editor-notice > div { display:grid; gap:3px; }
.quote-invoiced-notice span,
.configurator-draft-notice span,
.deposit-deduction-editor-notice span { color:#526277; }
.deposit-deduction-editor-notice { border-left-color:#2e75b8; background:#eef5fb; }
.deposit-deduction-editor-notice > strong { flex:0 0 auto; color:var(--navy); font-size:18px; }
.sample-history-actions form { margin:0; }
.commercial-next-dossiers { margin-top:18px; overflow:hidden; }
.commercial-next-dossiers-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:0 0 18px; }
.commercial-next-dossiers-list > a { display:flex; align-items:center; justify-content:space-between; gap:16px; min-width:0; padding:13px 15px; border:1px solid #dce5ed; border-left:4px solid #2e75b8; border-radius:12px; background:#fff; color:inherit; text-decoration:none; transition:border-color .18s ease,box-shadow .18s ease,transform .18s ease; }
.commercial-next-dossiers-list > a:hover { border-color:#9fc0df; box-shadow:0 6px 18px rgba(13,47,104,.09); transform:translateY(-1px); }
.commercial-next-dossiers-list > a.is-due { border-left-color:#d2473f; background:#fff8f7; }
.commercial-next-dossiers-list span { display:grid; gap:3px; min-width:0; }
.commercial-next-dossiers-list span:last-child { flex:0 0 auto; text-align:right; }
.commercial-next-dossiers-list b { overflow:hidden; color:var(--navy); font-size:12px; text-overflow:ellipsis; white-space:nowrap; }
.commercial-next-dossiers-list small { color:var(--muted); font-size:10px; }
.commercial-next-dossiers-list strong { color:var(--navy); font-size:12px; }
.configurator-tabs { margin-bottom:12px; }
.erp-configurator-card { padding:0; overflow:hidden; }
.erp-configurator-card > .card-head { padding:16px 20px; border-bottom:1px solid var(--line); }
.erp-configurator-card > .card-head h2 { margin:2px 0 3px; }
.erp-configurator-frame { display:block; width:100%; min-width:0; height:1400px; min-height:calc(100dvh - 170px); overflow:hidden; border:0; background:#f4f7fa; }
@media (max-width:760px) {
  .quote-invoiced-notice,.deposit-deduction-editor-notice,.configurator-draft-notice { align-items:stretch; flex-direction:column; }
  .quote-invoiced-notice .btn,.configurator-draft-notice .btn { width:100%; }
  .commercial-next-dossiers-list { grid-template-columns:1fr; padding:0 0 12px; }
  .erp-configurator-card > .card-head { align-items:flex-start; flex-direction:column; }
  .erp-configurator-frame { height:1500px; min-height:calc(100dvh - 145px); }
}

/* Priorité finale : neutralise les anciennes règles responsive conservées
   pour compatibilité avec les écrans historiques. */
.sidebar .sidebar-logo { filter:brightness(0) invert(1) drop-shadow(0 4px 8px rgba(0,0,0,.48)) !important; opacity:.98; }
.price-list-wrap { overflow-x:auto !important; overscroll-behavior-inline:contain; }
.price-list-table { table-layout:fixed !important; width:1500px !important; min-width:1500px !important; }
.stock-matrix-scroll { height:calc(100dvh - 205px) !important; min-height:680px !important; max-height:none !important; }
.stock-matrix-scroll .stock-matrix .matrix-event > th,
.stock-matrix-scroll .stock-matrix .matrix-event > td,
.stock-matrix-scroll .stock-matrix .matrix-event .matrix-date-edit,
.stock-matrix-scroll .stock-matrix .matrix-event input { position:static !important; inset:auto !important; z-index:1 !important; }
.stock-matrix-scroll .stock-matrix .matrix-stock-value-row > * { z-index:45 !important; background:#eef3f7 !important; box-shadow:none !important; }
@media (min-width:1760px) { .price-list-table { width:100% !important; min-width:1450px !important; } }
@media (max-width:1180px) { .stock-matrix-scroll { height:calc(100dvh - 175px) !important; min-height:620px !important; } }
@media (max-width:700px) { .stock-matrix-scroll { height:calc(100dvh - 145px) !important; min-height:540px !important; } }
.online-quote-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.online-quote-kpi { display:flex; align-items:center; justify-content:space-between; padding:15px 17px; border:1px solid #dbe5ec; border-radius:13px; background:#fff; color:#516277; text-decoration:none; box-shadow:0 4px 14px rgba(13,47,104,.05); }
.online-quote-kpi strong { color:var(--navy); font-size:24px; }
.online-quote-kpi.active { border-color:#6fbe7a; box-shadow:0 0 0 2px rgba(79,181,85,.12); }
.online-quote-list { display:grid; gap:14px; }
.online-quote-card { padding:0; overflow:hidden; border-left:5px solid #2e75b8; }
.online-quote-card.status-contacted { border-left-color:#e0a129; }
.online-quote-card.status-converted { border-left-color:var(--green); }
.online-quote-card.status-archived { border-left-color:#a9b3bd; }
.online-quote-card > header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; padding:18px 20px 12px; }
.online-quote-card h2 { margin:3px 0; color:var(--navy); }
.online-quote-card header p { margin:0; color:var(--muted); font-size:11px; }
.online-quote-total { display:grid; text-align:right; }
.online-quote-total strong { color:var(--navy); font-size:22px; }
.online-quote-contact { display:flex; flex-wrap:wrap; gap:8px; padding:0 20px 12px; }
.online-quote-observation { margin:0 20px 14px; padding:12px 14px; border-radius:9px; background:#f5f8fb; color:#47596c; font-size:12px; }
.online-quote-card details { margin:0 20px 14px; }
.online-quote-card details summary { cursor:pointer; color:var(--navy); font-size:12px; font-weight:800; }
.online-quote-card details .table-wrap { margin-top:10px; max-height:320px; }
.online-quote-card > footer { display:flex; align-items:center; justify-content:flex-end; gap:10px; padding:12px 20px; border-top:1px solid #e5ebf0; background:#f9fbfc; }
.online-quote-card > footer form { display:flex; gap:8px; margin:0; }
@media (max-width:900px) { .online-quote-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:600px) { .online-quote-kpis { grid-template-columns:1fr; } .online-quote-card > header,.online-quote-card > footer { align-items:stretch; flex-direction:column; } .online-quote-total { text-align:left; } .online-quote-card > footer form,.online-quote-card > footer .btn { width:100%; } }

/* 4.2.61 — correctif final de la matrice d'inventaire. La règle ciblée sur
   la deuxième cellule neutralise l'ancien positionnement spécifique Date. */
.stock-matrix-scroll { height:calc(100dvh - 125px) !important; min-height:780px !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-physical-row > :nth-child(2) { position:sticky !important; top:170px !important; z-index:46 !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-reserved-row > :nth-child(2) { position:sticky !important; top:212px !important; z-index:46 !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-stock-row > :nth-child(2) { position:sticky !important; top:254px !important; z-index:46 !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-pmp-row > :nth-child(2) { position:sticky !important; top:296px !important; z-index:46 !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-stock-value-row > :nth-child(2) { position:sticky !important; top:338px !important; z-index:46 !important; }
@media (max-width:1180px) { .stock-matrix-scroll { height:calc(100dvh - 105px) !important; min-height:700px !important; } }
@media (max-width:700px) { .stock-matrix-scroll { height:calc(100dvh - 85px) !important; min-height:620px !important; } }

/* Logo d'origine conservé : vert visible, bleu éclairci et liseré blanc. */
.sidebar .sidebar-logo {
  filter:brightness(1.32) saturate(.92) drop-shadow(0 0 1px rgba(255,255,255,.95)) drop-shadow(0 3px 7px rgba(0,0,0,.42)) !important;
  opacity:1;
}

.line-product-display { grid-template-columns:42px minmax(175px,1fr); align-items:start; }
.line-product-display .line-designation,
.purchase-lines .line-supplier-designation {
  width:100%;
  min-height:52px;
  height:auto;
  resize:none;
  overflow:hidden;
  field-sizing:content;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  line-height:1.3;
}
.line-product-photo:not([hidden]) { cursor:zoom-in; }
.product-photo-dialog {
  width:min(760px,calc(100vw - 34px));
  max-width:none;
  padding:48px 18px 18px;
  border:0;
  border-radius:16px;
  background:#fff;
  box-shadow:0 26px 80px rgba(4,20,45,.42);
}
.product-photo-dialog::backdrop { background:rgba(4,20,45,.72); backdrop-filter:blur(3px); }
.product-photo-dialog img { display:block; width:100%; max-height:72vh; object-fit:contain; }
.product-photo-dialog button { position:absolute; top:10px; right:12px; width:34px; height:34px; border:0; border-radius:50%; background:#edf2f6; color:var(--navy); font-size:22px; cursor:pointer; }

/* Demandes en ligne plus compactes : le détail reste replié par défaut. */
.online-quote-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.online-quote-card > header { padding:13px 15px 8px; }
.online-quote-card h2 { font-size:16px; }
.online-quote-total strong { font-size:18px; }
.online-quote-contact { gap:6px; padding:0 15px 8px; }
.online-quote-contact .btn { min-height:31px; padding:6px 9px; font-size:10px; }
.online-quote-observation {
  display: block;
  margin: 0 15px 9px;
  padding: 9px 11px;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
  font-size: 10px;
}
.online-quote-card details { margin:0 15px 9px; }
.online-quote-card > footer { gap:7px; padding:9px 15px; }
.online-quote-card > footer .btn { min-height:34px; padding:7px 10px; font-size:10px; }
@media (max-width:1100px) { .online-quote-list { grid-template-columns:1fr; } }

/* 4.2.62 — la première colonne masque proprement Date pendant le glissement
   horizontal. Date continue de défiler mais ne peut plus recouvrir la facture. */
.stock-matrix-scroll .stock-matrix thead > tr > th:first-child,
.stock-matrix-scroll .stock-matrix tbody > tr > th:first-child {
  position:sticky !important;
  left:0 !important;
  background:#fff !important;
}
.stock-matrix-scroll .stock-matrix thead > tr > th:first-child { z-index:60 !important; background:#e9eff5 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-physical-row > :first-child,
.stock-matrix-scroll .stock-matrix tbody > .matrix-reserved-row > :first-child,
.stock-matrix-scroll .stock-matrix tbody > .matrix-stock-row > :first-child,
.stock-matrix-scroll .stock-matrix tbody > .matrix-pmp-row > :first-child,
.stock-matrix-scroll .stock-matrix tbody > .matrix-stock-value-row > :first-child { z-index:55 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-event > th:first-child { z-index:12 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-invoice > th:first-child { background:#eaf8ed !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-purchase > th:first-child { background:#eaf3ff !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-reservation > th:first-child { background:#fff5d9 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-movement > th:first-child { background:#fff !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-event > :nth-child(2) { z-index:1 !important; }

/* Toutes les zones d'une ligne produit prennent la hauteur de sa désignation. */
.purchase-lines tbody tr,
.quote-lines tbody tr { --product-line-height:58px; }
.purchase-lines tbody td,
.quote-lines tbody td { vertical-align:middle !important; }
.purchase-lines tbody td > input,
.purchase-lines tbody td > textarea,
.purchase-lines tbody .line-product-display,
.purchase-lines tbody .po-computed-field,
.quote-lines tbody td > input,
.quote-lines tbody .line-product-display,
.quote-lines tbody .input-suffix,
.quote-lines tbody .line-value {
  min-height:var(--product-line-height) !important;
  height:var(--product-line-height) !important;
}
.purchase-lines tbody .po-computed-field,
.quote-lines tbody .line-value,
.quote-lines tbody .input-suffix {
  display:flex;
  align-items:center;
  justify-content:center;
}
.quote-lines tbody .input-suffix input { height:100% !important; }
.purchase-lines tbody .line-product-display .line-designation,
.quote-lines tbody .line-product-display .line-designation,
.purchase-lines tbody .line-supplier-designation { min-height:100% !important; height:100% !important; }
.purchase-lines tbody .line-product-photo,
.quote-lines tbody .line-product-photo { align-self:center; }

/* Logo monochrome comme le logo SAPAG de référence, sur fond bleu du menu. */
.sidebar .sidebar-logo {
  filter:brightness(0) saturate(100%) invert(59%) sepia(55%) saturate(649%) hue-rotate(73deg) brightness(91%) contrast(91%) drop-shadow(0 3px 5px rgba(0,0,0,.34)) !important;
  opacity:1 !important;
}

/* 4.2.63 — le visuel occupe lui aussi toute la hauteur utile de la ligne. */
.purchase-lines tbody .line-product-display,
.quote-lines tbody .line-product-display {
  grid-template-columns:58px minmax(175px,1fr) !important;
  align-items:stretch !important;
}
.purchase-lines tbody .line-product-photo,
.quote-lines tbody .line-product-photo {
  width:58px !important;
  height:100% !important;
  min-height:var(--product-line-height) !important;
  object-fit:contain !important;
  align-self:stretch !important;
  background:#fff;
}
.line-product-photo[hidden] + textarea { grid-column:1 / -1; }

/* 4.2.65 — version bicolore dédiée : typographie blanche, architecture verte. */
.sidebar .brand::before { display:none !important; }
.sidebar .brand .sidebar-logo {
  display:block !important;
  filter:drop-shadow(0 2px 1px rgba(0,0,0,.18)) drop-shadow(0 5px 9px rgba(0,0,0,.24)) !important;
  opacity:1 !important;
}

/* 4.2.66 — édition produit, formulaires documentaires et responsive BC. */
.product-duplicate-link {
  display:block;
  width:max-content;
  margin-top:5px;
  color:#2f7f42;
  font-size:9px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.quote-lines .input-suffix {
  position:relative !important;
  display:block !important;
  width:100% !important;
}
.quote-lines .input-suffix input {
  width:100% !important;
  padding-right:25px !important;
  box-sizing:border-box !important;
}
.quote-lines .input-suffix > span {
  position:absolute !important;
  right:9px !important;
  top:50% !important;
  transform:translateY(-50%) !important;
  z-index:2;
  pointer-events:none;
  color:#64748b;
  font-weight:800;
}
.outlook-sync-chip {
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:34px;
  padding:0 10px;
  border:1px solid #d6e2dc;
  border-radius:999px;
  background:#f7fbf8;
  color:#315d3b;
  font-size:10px;
  font-weight:800;
  white-space:nowrap;
}
.outlook-sync-chip i { width:8px; height:8px; border-radius:50%; background:#4fb555; box-shadow:0 0 0 3px rgba(79,181,85,.15); }
.outlook-sync-chip.is-error { color:#9c3d3d; border-color:#f0cccc; background:#fff8f8; }
.outlook-sync-chip.is-error i { background:#d95555; box-shadow:0 0 0 3px rgba(217,85,85,.14); }

/* Les six lignes de synthèse conservent leur couleur sur toute la largeur,
   y compris la cellule Date/État lors du défilement. */
.stock-matrix-scroll .stock-matrix tbody > .matrix-physical-row > * { background:#f3f7fb !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-reserved-row > * { background:#fff7e8 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-stock-row > * { background:#eef8f0 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-pmp-row > * { background:#f3f7fb !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-stock-value-row > * { background:#eef3f7 !important; box-shadow:none !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-event.matrix-invoice > * { background:#eaf8ed !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-event.matrix-purchase > * { background:#eaf3ff !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-event.matrix-reservation > * { background:#fff5d9 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-event.matrix-movement > * { background:#fff !important; }

.special-order-progress {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:6px;
  padding:0 15px 12px;
}
.special-order-progress span {
  padding:8px 9px;
  border:1px solid #e1e8ef;
  border-radius:8px;
  background:#f8fafc;
  color:#768496;
  font-size:9px;
  font-weight:800;
  text-align:center;
}
.special-order-progress span.active { border-color:#e9c77b; background:#fff9eb; color:#8a6419; }
.special-order-progress span.done { border-color:#bfe1c5; background:#f0f9f2; color:#28733a; }
.deposit-status-badge { padding:6px 9px; border-radius:999px; background:#f1f4f7; color:#59697a; font-size:9px; font-weight:800; }
.deposit-status-badge.status-requested { background:#fff6df; color:#856219; }
.deposit-status-badge.status-received { background:#eaf8ed; color:#26733a; }
.special-order-mail-actions { display:flex; flex-wrap:wrap; gap:6px; }
@media (max-width:800px) {
  .special-order-progress { grid-template-columns:1fr 1fr; }
  .special-order-mail-actions { width:100%; }
}

/* Champs documentaires finalisés après contrôle sur captures. */
.purchase-lines tbody tr { --product-line-height:64px !important; }
.purchase-lines tbody .line-product-display,
.purchase-lines tbody .line-designation,
.purchase-lines tbody .line-supplier-designation,
.purchase-lines tbody td > input,
.purchase-lines tbody .po-computed-field {
  min-height:64px !important;
  height:64px !important;
  box-sizing:border-box !important;
}
.purchase-lines tbody .line-supplier-designation {
  display:block !important;
  width:100% !important;
  padding:9px !important;
  white-space:pre-wrap !important;
  overflow-wrap:anywhere !important;
}

/* Le cadre complet constitue le champ : € et % sont donc réellement dedans. */
.quote-lines td .input-suffix {
  position:relative !important;
  display:block !important;
  width:100% !important;
  height:var(--product-line-height) !important;
  overflow:hidden !important;
  border:1px solid #d3dce6 !important;
  border-radius:8px !important;
  background:#fff !important;
  box-sizing:border-box !important;
}
.quote-lines td .input-suffix:focus-within {
  border-color:var(--green) !important;
  box-shadow:0 0 0 2px rgba(79,181,85,.13) !important;
}
.quote-lines td .input-suffix > input {
  display:block !important;
  width:100% !important;
  height:100% !important;
  min-width:0 !important;
  padding:8px 27px 8px 7px !important;
  border:0 !important;
  border-radius:0 !important;
  outline:0 !important;
  background:transparent !important;
  box-sizing:border-box !important;
  text-align:center !important;
}
.quote-lines td .input-suffix > span {
  display:block !important;
  position:absolute !important;
  right:9px !important;
  top:50% !important;
  width:auto !important;
  transform:translateY(-50%) !important;
  color:#64748b !important;
  font-size:10px !important;
  font-weight:900 !important;
  line-height:1 !important;
  pointer-events:none !important;
}

/* Le détail des demandes web dispose toujours d'un défilement vertical. */
.online-quote-card details[open] .table-wrap {
  display:block !important;
  max-height:360px !important;
  overflow-x:auto !important;
  overflow-y:scroll !important;
  scrollbar-gutter:stable;
  border:1px solid #dce5ec;
  border-radius:9px;
}
.online-quote-card details[open] table { min-width:720px; margin:0; }
.online-quote-card details[open] thead th { position:sticky; top:0; z-index:2; background:#eef3f7; }

/* Commandes clients : carte dossier plus lisible et bloc acompte structuré. */
.grouped-special-orders { display:grid; gap:16px; }
.special-order-document-card { padding:0 !important; overflow:hidden; border:1px solid #dbe4ec; border-top:4px solid var(--navy); box-shadow:0 8px 24px rgba(13,47,104,.07); }
.special-order-document-card > header { padding:17px 20px !important; background:linear-gradient(135deg,#f7f9fc,#fff); border-bottom:1px solid #e3eaf0; }
.special-order-document-card > header b { color:var(--navy); font-size:16px; }
.special-order-document-card > header strong { padding:7px 11px; border-radius:999px; background:#eaf7ec; color:#28733a; font-size:10px; }
.special-order-progress { padding:15px 20px 12px !important; background:#fff; }
.special-order-meta { display:grid !important; grid-template-columns:auto auto minmax(300px,1fr) auto; align-items:end !important; gap:12px !important; padding:12px 20px 16px !important; background:#f8fafc; border-block:1px solid #e5ebf0; }
.special-order-deposit-form { display:grid; grid-template-columns:120px auto; gap:8px; align-items:end; }
.special-order-deposit-form label { display:grid; gap:4px; color:#55677b; font-size:9px; font-weight:800; text-transform:uppercase; }
.special-order-deposit-form .input-suffix { position:relative; width:120px; }
.special-order-deposit-form .input-suffix input { width:100%; padding-right:27px; }
.special-order-deposit-form .input-suffix span { position:absolute; right:9px; top:50%; transform:translateY(-50%); color:#64748b; font-weight:900; pointer-events:none; }
.special-order-document-card > .table-wrap { margin:0 20px 14px; border:1px solid #e0e7ee; border-radius:10px; }
.special-order-document-card > .comment-thread { margin:0 20px 18px; }
@media (max-width:1050px) {
  .special-order-meta { grid-template-columns:1fr 1fr !important; }
  .special-order-deposit-form { grid-column:1/-1; }
}
@media (max-width:650px) {
  .special-order-meta { grid-template-columns:1fr !important; }
  .special-order-deposit-form { grid-template-columns:1fr; }
}

/* 4.2.68 — règles finales uniques, sans transformation tardive. */
.purchase-lines-card {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  overflow:hidden !important;
}
.purchase-lines-card > .table-wrap {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  overscroll-behavior-x:contain;
  box-sizing:border-box !important;
}

/* Couleurs historiques prolongées sur Description, Date et les produits. */
.stock-matrix-scroll .stock-matrix tbody > .matrix-physical-row > * { background:#f4f7fb !important; color:#41566e !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-reserved-row > * { background:#fff8ec !important; color:#8a6419 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-stock-row > * { background:#fff8da !important; color:#0d2f68 !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-pmp-row > * { background:#f2f6fb !important; color:#41566e !important; }
.stock-matrix-scroll .stock-matrix tbody > .matrix-stock-value-row > * { background:#eef3f7 !important; color:#41566e !important; box-shadow:none !important; }

/* Les caractères sont les icônes finales : aucun remplacement après affichage. */
button.icon-btn,
button.icon-btn.danger,
button.icon-btn.remove-line,
button.icon-btn.remove-delivery-line,
button.icon-btn.observation-remove,
button.icon-btn.remove-category,
button.icon-btn[data-close-dialog],
button.icon-btn[title="Enregistrer"] {
  display:inline-flex !important;
  visibility:visible !important;
  opacity:1 !important;
  align-items:center !important;
  justify-content:center !important;
  width:34px !important;
  min-width:34px !important;
  height:34px !important;
  min-height:34px !important;
  padding:0 !important;
  font-family:Arial,sans-serif !important;
  font-size:20px !important;
  font-weight:700 !important;
  line-height:1 !important;
  text-indent:0 !important;
}
button.icon-btn::before,
button.icon-btn::after { content:none !important; display:none !important; }

/* Bon de commande : le débordement appartient uniquement au tableau. */
.purchase-editor,
.purchase-editor > *,
.purchase-lines-card,
.purchase-lines-card > .table-wrap {
  min-width:0 !important;
  max-width:100% !important;
  box-sizing:border-box !important;
}
.purchase-editor { width:100% !important; }
.purchase-lines-card {
  contain:inline-size;
  overflow:hidden !important;
}
.purchase-lines-card > .table-wrap {
  display:block !important;
  width:100% !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  overscroll-behavior-x:contain;
  scrollbar-gutter:stable;
}
.purchase-lines-card table.purchase-lines {
  width:1500px !important;
  min-width:1500px !important;
  max-width:none !important;
  table-layout:fixed !important;
}
.purchase-lines th:nth-child(1) { width:90px !important; }
.purchase-lines th:nth-child(2) { width:275px !important; }
.purchase-lines th:nth-child(3) { width:275px !important; }
.purchase-lines th:nth-child(4) { width:70px !important; }
.purchase-lines th:nth-child(5) { width:110px !important; }
.purchase-lines th:nth-child(6) { width:100px !important; }
.purchase-lines th:nth-child(7) { width:175px !important; }
.purchase-lines th:nth-child(8) { width:85px !important; }
.purchase-lines th:nth-child(9) { width:100px !important; }
.purchase-lines th:nth-child(10) { width:95px !important; }
.purchase-lines th:nth-child(11) { width:90px !important; }
.purchase-lines th:nth-child(12) { width:50px !important; }

/* Commandes clients : un dossier compact, lisible et proportionné. */
.special-orders-import {
  display:grid;
  grid-template-columns:minmax(220px,300px) minmax(0,1fr);
  gap:24px;
  align-items:center;
  padding:22px !important;
  border-top:4px solid var(--navy);
}
.special-orders-import-title h2 { margin:3px 0 5px; color:var(--navy); font-size:20px; }
.special-orders-import-title p { margin:0; color:#68788a; font-size:11px; }
.special-orders-import-form {
  display:grid;
  grid-template-columns:minmax(280px,1fr) 170px auto;
  gap:12px;
  align-items:end;
  min-width:0;
}
.special-orders-import-form label,
.special-order-deposit-actions label {
  display:grid;
  gap:5px;
  min-width:0;
  color:#53667a;
  font-size:9px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.special-orders-import-form input,
.special-orders-import-form select { width:100%; min-width:0; }
.special-orders-tabs {
  display:flex;
  width:max-content;
  max-width:100%;
  margin:14px 0;
  padding:4px;
  gap:4px;
  overflow-x:auto;
  border:1px solid #dce5ec;
  border-radius:11px;
  background:#eef3f7;
}
.special-orders-tabs a {
  display:flex;
  align-items:center;
  gap:9px;
  min-height:36px;
  padding:0 13px;
  border-radius:8px;
  color:#506174;
  font-size:11px;
  font-weight:800;
  text-decoration:none;
  white-space:nowrap;
}
.special-orders-tabs a b {
  min-width:21px;
  padding:3px 6px;
  border-radius:999px;
  background:#dfe7ee;
  color:#405267;
  text-align:center;
  font-size:9px;
}
.special-orders-tabs a.active { background:#fff; color:var(--navy); box-shadow:0 2px 8px rgba(13,47,104,.1); }
.special-orders-tabs a.active b { background:#e8f6eb; color:#28733a; }
.special-orders-list { display:grid; gap:15px; min-width:0; }
.special-order-dossier {
  min-width:0;
  padding:0 !important;
  overflow:hidden;
  border:1px solid #dbe4ec;
  border-top:4px solid var(--navy);
  box-shadow:0 7px 20px rgba(13,47,104,.06);
}
.special-order-dossier-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:16px 20px;
  border-bottom:1px solid #e5ebf0;
  background:linear-gradient(135deg,#f8fafc,#fff);
}
.special-order-dossier-head a { display:block; margin-top:3px; color:var(--navy); font-size:19px; font-weight:900; text-decoration:none; }
.special-order-dossier-head p { margin:2px 0 0; color:#5e7084; font-size:12px; }
.special-order-dossier-summary { display:flex; align-items:center; gap:13px; }
.special-order-dossier-summary span { padding:6px 9px; border-radius:999px; background:#eef3f7; color:#53667a; font-size:9px; font-weight:800; }
.special-order-dossier-summary strong { color:var(--navy); font-size:17px; white-space:nowrap; }
.special-order-timeline {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  margin:0;
  padding:15px 20px;
  list-style:none;
  background:#fff;
}
.special-order-timeline li { position:relative; z-index:0; display:grid; grid-template-columns:27px minmax(0,1fr); align-items:center; gap:8px; color:#7b8999; font-size:10px; font-weight:800; }
.special-order-timeline li:not(:last-child)::after { content:""; position:absolute; z-index:0; left:27px; right:-12px; top:13px; height:2px; background:#dfe6ec; }
.special-order-timeline li > span { position:relative; z-index:1; width:max-content; max-width:100%; padding:3px 7px 3px 0; background:#fff; }
.special-order-timeline i { position:relative; z-index:2; display:grid; place-items:center; width:27px; height:27px; flex:0 0 27px; border:2px solid #d8e1e8; border-radius:50%; background:#fff; font-style:normal; }
.special-order-timeline .current { color:#8a6419; }
.special-order-timeline .current i { border-color:#e4bc60; background:#fff8e6; }
.special-order-timeline .done { color:#28733a; }
.special-order-timeline .done i { border-color:#4fae61; background:#4fae61; color:#fff; }
.special-order-timeline .done:not(:last-child)::after { background:#8bca97; }
.special-order-control-grid {
  display:grid;
  grid-template-columns:190px minmax(370px,1fr) 180px;
  gap:12px;
  padding:14px 20px;
  border-block:1px solid #e4ebf1;
  background:#f7f9fb;
}
.special-order-info-panel,
.special-order-deposit-panel,
.special-order-status-panel {
  min-width:0;
  padding:13px;
  border:1px solid #dce5ec;
  border-radius:10px;
  background:#fff;
}
.special-order-info-panel,
.special-order-status-panel { display:grid; align-content:center; gap:4px; }
.special-order-info-panel > span,
.special-order-status-panel > span,
.special-order-panel-title span { color:#6b7b8c; font-size:9px; font-weight:900; letter-spacing:.05em; text-transform:uppercase; }
.special-order-info-panel strong { color:var(--navy); font-size:15px; }
.special-order-info-panel small { color:#788696; font-size:9px; }
.special-order-panel-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.special-order-panel-title > div { display:flex; align-items:baseline; gap:10px; }
.special-order-panel-title strong { color:var(--navy); font-size:18px; }
.special-order-panel-title em { font-style:normal; white-space:nowrap; }
.special-order-deposit-actions { display:flex; align-items:end; gap:9px; }
.special-order-deposit-actions form { display:grid; grid-template-columns:130px 110px auto; align-items:end; gap:8px; min-width:0; }
.special-order-deposit-actions select { min-width:0; width:100%; }
.special-order-deposit-actions .input-suffix { position:relative; display:block; width:90px; }
.special-order-deposit-actions .input-suffix input { width:100%; padding-right:25px; }
.special-order-deposit-actions .input-suffix > span { position:absolute; right:9px; top:50%; transform:translateY(-50%); pointer-events:none; color:#64748b; }
.special-order-status-panel select { width:100%; margin-top:5px; }
.special-order-products { margin:15px 20px 12px; border:1px solid #dfe7ed; border-radius:9px; }
.special-order-products table { width:100%; min-width:680px; border-collapse:collapse; }
.special-order-products th,
.special-order-products td { padding:9px 11px; border-bottom:1px solid #e8edf2; text-align:left; vertical-align:top; }
.special-order-products th { background:#f4f7f9; color:#586a7d; font-size:9px; text-transform:uppercase; }
.special-order-products .num { text-align:right; }
.special-order-comment { margin:0 20px 16px; }
.special-order-comment summary { cursor:pointer; color:#53667a; font-size:10px; font-weight:800; }
.special-order-comment form { display:grid; grid-template-columns:1fr auto; gap:9px; align-items:end; margin-top:9px; }
.special-order-comment textarea { width:100%; min-width:0; }

@media (max-width:1100px) {
  .special-orders-import { grid-template-columns:1fr; }
  .special-orders-import-form { grid-template-columns:minmax(250px,1fr) 170px auto; }
  .special-order-control-grid { grid-template-columns:1fr 2fr; }
  .special-order-status-panel { grid-column:1 / -1; }
}
@media (max-width:760px) {
  .special-orders-import-form,
  .special-order-control-grid { grid-template-columns:1fr; }
  .special-orders-import-form .btn { width:100%; }
  .special-order-dossier-head { align-items:flex-start; flex-direction:column; }
  .special-order-dossier-summary { width:100%; justify-content:space-between; }
  .special-order-timeline { grid-template-columns:1fr 1fr; gap:12px; }
  .special-order-timeline li::after { display:none; }
  .special-order-deposit-actions,
  .special-order-deposit-actions form { align-items:stretch; flex-direction:column; }
  .special-order-deposit-actions form { display:grid; grid-template-columns:1fr; }
  .special-order-deposit-actions .input-suffix { width:100%; }
  .special-order-products { margin-inline:12px; }
  .special-order-comment { margin-inline:12px; }
  .special-order-comment form { grid-template-columns:1fr; }
}

/* ========================================================================== 
   JTLM ERP 4.2.69 — finitions BC, stock et commandes clients
   ========================================================================== */

/* Sur un écran 1920 px, le tableau du BC exploite toute la largeur utile.
   En dessous, sa largeur minimale reste confinée à son propre défilement. */
.purchase-lines-card table.purchase-lines {
  width:100% !important;
  min-width:1500px !important;
}

/* Les deux descriptions d'un BC conservent exactement la même largeur. */
.purchase-lines th:nth-child(2),
.purchase-lines td:nth-child(2) { width:250px !important; }
.purchase-lines th:nth-child(3),
.purchase-lines td:nth-child(3) { width:250px !important; }

/* Couleur du dossier suivant son niveau réel d'avancement. */
.special-order-dossier.stage-0, .special-orders-legend .stage-0 { --order-stage-color: 148, 163, 184; }
.special-order-dossier.stage-1, .special-orders-legend .stage-1 { --order-stage-color: 226, 166, 50; }
.special-order-dossier.stage-2, .special-orders-legend .stage-2 { --order-stage-color: 80, 166, 106; }
.special-order-dossier.stage-3, .special-orders-legend .stage-3 { --order-stage-color: 39, 121, 189; }
.special-order-dossier.stage-4, .special-orders-legend .stage-4 { --order-stage-color: 36, 117, 72; }
.special-order-dossier {
  border-top-color:rgb(var(--order-stage-color));
  border-left-color:rgb(var(--order-stage-color));
}
.special-order-dossier > .special-order-dossier-head { background:rgba(var(--order-stage-color), .19); }
.special-orders-legend {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px 18px;
  margin:-2px 0 14px;
  padding:10px 13px;
  border:1px solid #e0e7ed;
  border-radius:10px;
  background:#fafcfd;
  color:#5b6b7d;
  font-size:10px;
  font-weight:750;
}
.special-orders-legend span { display:inline-flex; align-items:center; gap:7px; white-space:nowrap; }
.special-orders-legend i { display:block; width:11px; height:11px; border-radius:3px; background:rgb(var(--order-stage-color)); }

/* Le type de rendez-vous se reconnaît immédiatement dans le planning. */
.planner-event.preparation { border-left-color:#0d2f68; background:#f6f8fc; }
.planner-event.pickup { border-left-color:#e59a27; background:#fff9ee; }
.planner-event.delivery { border-left-color:#4fb555; background:#f3fbf4; }
.legend-preparation { background:#0d2f68; }
.legend-pickup { background:#e59a27; }
.legend-delivery { background:#4fb555; }

/* Les contrôles de date gardent la même hauteur sur Safari iOS et Android. */
/* Le coefficient reste contenu dans la barre d'actions sur tablette. */
@media (max-width:1180px) {
  .page-actions .coefficient-titlebar {
    box-sizing:border-box;
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(72px,88px);
    min-width:0;
    max-width:100%;
  }
  .page-actions .coefficient-titlebar .coefficient-preview-input {
    box-sizing:border-box;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
  }
}
@media (max-width:760px) {
  label, .form-grid > *, .filterbar > * { min-width:0; }
  input[type="date"],input[type="datetime-local"],input[type="time"]{box-sizing:border-box;display:block;width:100%;max-width:100%;height:40px;min-height:40px;line-height:normal;padding-top:0;padding-bottom:0}
  input[type="date"]::-webkit-date-and-time-value,input[type="datetime-local"]::-webkit-date-and-time-value,input[type="time"]::-webkit-date-and-time-value{min-height:1.2em;margin:0;text-align:left}
}

/* Safari iOS attribue une largeur intrinsèque trop grande aux contrôles de
   date. Le correctif couvre iPhone et iPad, tout en restant limité aux écrans
   tactiles Apple afin de ne pas modifier le rendu PC. */
@supports (-webkit-touch-callout:none) {
  @media (max-width:1180px) {
    label:has(input[type="date"]),
    label:has(input[type="datetime-local"]),
    label:has(input[type="time"]) {
      box-sizing:border-box;
      width:100%;
      min-width:0;
      max-width:100%;
      overflow:hidden;
    }
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"] {
      -webkit-appearance:none;
      appearance:none;
      box-sizing:border-box !important;
      inline-size:100% !important;
      min-inline-size:0 !important;
      max-inline-size:100% !important;
      width:100% !important;
      min-width:0 !important;
      max-width:100% !important;
      overflow:hidden;
      padding-inline:10px;
    }
    input[type="date"]::-webkit-date-and-time-value,
    input[type="datetime-local"]::-webkit-date-and-time-value,
    input[type="time"]::-webkit-date-and-time-value {
      display:block;
      width:100%;
      min-width:0;
      overflow:hidden;
      text-overflow:ellipsis;
      white-space:nowrap;
    }
  }
  @media (max-width:600px) {
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"] {
      font-size:16px;
    }
  }
}

/* La hauteur réelle est ajustée par configurators.js après chaque évolution
   du formulaire intégré. Le fallback reste volontairement généreux. */
.erp-configurator-card { min-width:0; }
.erp-configurator-frame.is-content-sized { min-height:900px; }

/* Les cellules fixes Description et Date reprennent strictement la couleur de
   leur ligne de synthèse, malgré les anciennes règles de colonnes figées. */
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-physical-row > :first-child,
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-physical-row > :nth-child(2) { background:#f4f7fb !important; color:#41566e !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-reserved-row > :first-child,
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-reserved-row > :nth-child(2) { background:#fff8ec !important; color:#8a6419 !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-stock-row > :first-child,
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-stock-row > :nth-child(2) { background:#fff8da !important; color:#0d2f68 !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-pmp-row > :first-child,
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-pmp-row > :nth-child(2) { background:#f2f6fb !important; color:#41566e !important; }
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-stock-value-row > :first-child,
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-stock-value-row > :nth-child(2) { background:#eef3f7 !important; color:#41566e !important; box-shadow:none !important; }

/* Le trait d'avancement reste derrière les libellés et ne les traverse plus. */
.special-orders-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.special-orders-toolbar .special-orders-tabs { margin-right:auto; }
.special-order-dossier > summary { list-style:none; cursor:pointer; }
.special-order-dossier > summary::-webkit-details-marker { display:none; }
.special-order-dossier-head a { width:max-content; }
.special-order-dossier-summary > i {
  width:9px;
  height:9px;
  margin-left:3px;
  border-right:2px solid #718096;
  border-bottom:2px solid #718096;
  transform:rotate(45deg) translateY(-2px);
  transition:transform .16s ease;
}
.special-order-dossier:not([open]) .special-order-dossier-summary > i { transform:rotate(-45deg); }
.special-order-dossier-content { min-width:0; }
.special-order-timeline li { z-index:0; }
.special-order-timeline li:not(:last-child)::after { left:27px; right:-14px; z-index:0; }
.special-order-timeline li i { z-index:2; }
.special-order-timeline li span { position:relative; z-index:1; padding:3px 9px 3px 0; background:#fff; }

/* Notes de commande client : saisie immédiate et chronologie datée. */
.special-order-notes {
  margin:0 20px 18px;
  padding:14px;
  border:1px solid #dfe7ed;
  border-radius:10px;
  background:#fbfcfd;
}
.special-order-notes-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.special-order-notes-head h3 { margin:2px 0 0; color:var(--navy); font-size:15px; }
.special-order-notes-head > b { display:grid; place-items:center; min-width:27px; height:27px; padding:0 7px; border-radius:999px; background:#e8eef4; color:#526477; }
.special-order-note-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:9px; align-items:end; }
.special-order-note-form textarea { width:100%; min-width:0; resize:vertical; }
.special-order-note-timeline { display:grid; gap:8px; max-height:260px; margin-top:12px; padding-left:5px; overflow:auto; }
.special-order-note-timeline article { position:relative; display:grid; grid-template-columns:14px minmax(0,1fr); gap:9px; }
.special-order-note-timeline article:not(:last-child)::before { content:""; position:absolute; left:6px; top:14px; bottom:-9px; width:2px; background:#dce4eb; }
.special-order-note-timeline article > i { position:relative; z-index:1; width:13px; height:13px; margin-top:4px; border:3px solid #dff0e2; border-radius:50%; background:var(--green); }
.special-order-note-timeline article > div { padding:9px 11px; border:1px solid #e0e7ed; border-radius:8px; background:#fff; }
.special-order-note-timeline header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.special-order-note-timeline time { color:var(--muted); font-size:9px; }
.special-order-note-timeline p { margin:6px 0 0; color:#45576a; line-height:1.4; }

/* Actions du journal : les icônes restent dans la cellule, côté gauche. */
.stock-journal-editable th:last-child,
.stock-journal-editable td.row-actions { width:88px !important; min-width:88px !important; text-align:left !important; padding-left:8px !important; padding-right:6px !important; }
.stock-journal-editable td.row-actions > button,
.stock-journal-editable td.row-actions > form { vertical-align:middle; margin-right:3px; }

.pmp-selected-designation { display:grid; flex:1 1 360px; gap:7px; min-width:220px; }
.pmp-selected-designation span { color:#64748b; font-size:10px; font-weight:800; text-transform:uppercase; }
.pmp-selected-designation strong { min-height:40px; padding:10px 12px; border:1px solid #d7e0e8; border-radius:8px; background:#f7f9fb; color:#33475b; }

.management-mode-list { display:grid; gap:9px; }
.management-mode-list article { display:grid; grid-template-columns:180px minmax(0,1fr); gap:15px; align-items:center; padding:12px 14px; border:1px solid #dde6ed; border-radius:9px; background:#fafcfd; }
.management-mode-list article b { color:var(--navy); }
.management-mode-list article span { color:#617285; }

@media (max-width:760px) {
  .special-orders-toolbar { align-items:stretch; flex-direction:column; }
  .special-orders-toolbar .special-orders-tabs { width:100%; margin-bottom:0; }
  .special-orders-toolbar > .btn { width:100%; }
  .special-order-note-form { grid-template-columns:1fr; }
  .special-order-notes { margin-inline:12px; }
  .pmp-selected-designation { width:100%; }
  .management-mode-list article { grid-template-columns:1fr; gap:4px; }
}

/* Inventaire annuel : parcours en trois étapes et validation explicite. */
.inventory-steps { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin-bottom:14px; }
.inventory-steps article { display:flex; align-items:flex-start; gap:12px; min-width:0; padding:15px; border:1px solid #dce6ee; border-radius:12px; background:#fff; box-shadow:0 5px 18px #17324d0a; }
.inventory-steps article>b { display:grid; place-items:center; flex:0 0 32px; height:32px; border-radius:9px; background:var(--navy); color:#fff; }
.inventory-steps article div { display:grid; gap:4px; }
.inventory-steps strong { color:var(--navy); font-size:14px; }
.inventory-steps span { color:var(--muted); font-size:11px; line-height:1.45; }
.inventory-import-card { margin-bottom:14px; }
.inventory-import-form { display:grid; grid-template-columns:minmax(190px,.7fr) minmax(280px,1.4fr) auto; gap:14px; align-items:end; }
.inventory-import-form label { display:grid; gap:6px; color:#42566a; font-size:11px; font-weight:800; }
.inventory-import-form select,.inventory-import-form input[type=file] { width:100%; min-height:42px; }
.inventory-file-field input { padding:7px 9px; border:1px solid #ced9e3; border-radius:8px; background:#f8fafc; }
.inventory-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:12px; }
.inventory-kpis article { display:grid; gap:5px; padding:13px 15px; border:1px solid #dce6ee; border-radius:10px; background:#fff; }
.inventory-kpis span { color:var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; }
.inventory-kpis strong { color:var(--navy); font-size:22px; }
.inventory-kpis .has-error { border-color:#efb1b1; background:#fff7f7; }
.inventory-kpis .has-error strong { color:#b02b2b; }
.inventory-errors { margin-bottom:12px; padding:13px 16px; border:1px solid #f0b6b6; border-radius:10px; background:#fff7f7; color:#8f2929; }
.inventory-errors ul { margin:8px 0 0; padding-left:20px; }
.inventory-review-form { padding-bottom:0; overflow:hidden; }
.inventory-review-table { margin-inline:-20px; border-top:1px solid #e1e8ee; }
.inventory-review-table table { min-width:980px; }
.inventory-review-table th:first-child,.inventory-review-table td:first-child { width:42px; text-align:center; }
.inventory-review-table .inventory-match { background:#f8fbf9; }
.inventory-review-table .inventory-difference { background:#fffdf7; }
.inventory-status { display:inline-flex; padding:4px 7px; border-radius:999px; font-size:9px; font-weight:850; white-space:nowrap; }
.inventory-status.ok { background:#e6f5e8; color:#267335; }
.inventory-status.difference { background:#fff0cf; color:#8b5e00; }
.inventory-status.warning { background:#ffe1d5; color:#9b3a18; }
.inventory-review-table td:last-child small { display:block; margin-top:5px; color:var(--muted); }
.inventory-review-actions { display:flex; justify-content:flex-end; gap:10px; margin-inline:-20px; padding:14px 20px; border-top:1px solid #e1e8ee; background:#f8fafc; }

/* Chaque catégorie tarifaire conserve exactement la même largeur. */
.discount-table { width:max-content; min-width:100%; table-layout:fixed; }
.discount-table th:nth-child(n+4),.discount-table td:nth-child(n+4) { width:150px !important; min-width:150px !important; max-width:150px !important; text-align:center; }

@media (max-width:850px) {
  .inventory-steps,.inventory-kpis { grid-template-columns:1fr 1fr; }
  .inventory-import-form { grid-template-columns:1fr; }
}
@media (max-width:560px) {
  .inventory-steps,.inventory-kpis { grid-template-columns:1fr; }
  .inventory-review-actions { align-items:stretch; flex-direction:column; }
}
.management-mode-editor{display:grid;gap:12px}.management-mode-row{display:grid;grid-template-columns:minmax(190px,.75fr) minmax(320px,2.4fr) auto 42px;gap:12px;align-items:center;padding:14px;border:1px solid #dbe5e0;border-radius:14px;background:#f9fbfa}.management-mode-row label{display:block;width:100%;min-width:0;margin:0}.management-mode-row label input{display:block;width:100%;min-width:0}.management-mode-usage{align-self:center;white-space:nowrap;color:#617169;font-size:.85rem;font-weight:700}.management-mode-warning{margin:12px 0 0}.management-mode-settings .settings-actions{margin-top:16px}@media(max-width:850px){.management-mode-row{grid-template-columns:1fr 42px}.management-mode-row label{grid-column:1/-1}.management-mode-usage{grid-column:1}.management-mode-row .icon-btn{grid-column:2;grid-row:3}}
/* Historique des commandes : règles consolidées, sans surcharge contradictoire. */
.purchase-history-filters {
  display:grid;
  grid-template-columns:minmax(250px,1.3fr) minmax(230px,1fr) 190px 190px minmax(190px,.8fr) auto;
  gap:16px;
  align-items:end;
  padding:19px 20px;
}
.purchase-history-filters > label { display:grid; gap:7px; min-width:0; color:#40546a; font-size:10px; font-weight:800; letter-spacing:.02em; }
.purchase-history-filters input,.purchase-history-filters select { width:100%; height:40px; }
.purchase-history-filter-actions { display:flex; align-items:center; gap:10px; }
.purchase-history-filter-actions .btn { min-height:40px; margin:0; }
.purchase-history-kpis { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:14px; margin:16px 0; }
.purchase-history-kpis article { padding:18px; border:1px solid #dce7e2; border-radius:16px; background:linear-gradient(145deg,#fff,#f7faf8); box-shadow:0 7px 22px rgba(25,61,43,.06); }
.purchase-history-kpis span,.purchase-history-kpis small { display:block; color:#66766e; }
.purchase-history-kpis strong { display:block; margin-top:7px; color:#173e2a; font-size:1.35rem; }
.purchase-history-coefficient { border-color:#8bc8a7 !important; background:linear-gradient(145deg,#f4fff8,#e6f7ed) !important; }
.purchase-history-coefficient strong { font-size:1.65rem; }
.purchase-history-table table { min-width:1260px; }
.purchase-history-table td small { display:block; margin-top:4px; color:#7a8781; }
.purchase-history-table tr.is-cancelled { opacity:.55; }
.purchase-history-table tr.is-manual { background:#fffaf0; }
.purchase-history-table tfoot th { border-top:2px solid #87b59d; background:#e8f2ed; color:#173e2a; }
.status-manual { background:#fff0cf; color:#8b5e00; }
@media(max-width:1280px) {
  .purchase-history-filters { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .purchase-history-filter-actions { grid-column:1/-1; justify-content:flex-end; }
}
@media(max-width:1200px) {
  .purchase-history-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media(max-width:700px) {
  .purchase-history-filters,.purchase-history-kpis { grid-template-columns:1fr; }
  .purchase-history-filters { padding:15px; }
  .purchase-history-filter-actions { justify-content:stretch; flex-wrap:wrap; }
  .purchase-history-filter-actions .btn { flex:1; }
}
@media print {
  .purchase-history-filters,.topbar,.sidebar,.titlebar .btn { display:none !important; }
  .purchase-history-kpis { grid-template-columns:repeat(5,1fr); }
  .purchase-history-kpis article { padding:10px; box-shadow:none; }
  .purchase-history-table { overflow:visible !important; }
  .purchase-history-table table { min-width:0; font-size:8pt; }
}

/* Sélecteur de l'historique PMP : lecture claire et contrôles alignés. */
.pmp-product-selector {
  display:grid;
  grid-template-columns:minmax(230px,.72fr) minmax(360px,1.4fr) auto;
  gap:14px;
  align-items:end;
  padding:18px 20px;
  border:1px solid #dce6ee;
  border-left:4px solid var(--green);
  background:linear-gradient(135deg,#fbfdfc,#f5f8fb);
  box-shadow:0 7px 24px rgba(13,47,104,.06);
}
.pmp-product-selector .pmp-product-code { display:grid; gap:7px; min-width:0; margin:0; }
.pmp-product-selector .pmp-product-code > span,
.pmp-selected-designation > span { color:#52667a; font-size:10px; font-weight:850; letter-spacing:.045em; text-transform:uppercase; }
.pmp-product-selector input,
.pmp-selected-designation strong,
.pmp-history-submit { min-height:44px; }
.pmp-product-selector input { width:100%; border-color:#cbd8e3; background:#fff; font-weight:750; }
.pmp-selected-designation { display:grid; gap:7px; min-width:0; }
.pmp-selected-designation strong { display:flex; align-items:center; padding:9px 13px; border:1px solid #d5e0e8; border-radius:8px; background:#fff; color:var(--navy); line-height:1.35; }
.pmp-history-submit { white-space:nowrap; }

/* Reprise d'une ancienne commande dans une vraie fenêtre de saisie. */
.purchase-history-manual-dialog { width:min(720px,calc(100vw - 28px)); overflow:hidden; background:#fff; }
.purchase-history-manual-dialog .dialog-body { padding:22px 24px; }
.purchase-history-manual-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; }
.purchase-history-manual-grid label { display:grid; gap:7px; min-width:0; color:#40546a; font-size:10px; font-weight:800; }
.purchase-history-manual-grid input { width:100%; min-height:42px; }
.purchase-history-manual-dialog .field-help { margin:14px 0 0; padding:10px 12px; border-radius:8px; background:#f4f7fa; color:#607185; }
.purchase-history-manual-dialog .dialog-actions { margin-top:18px; }

@media(max-width:850px){
  .pmp-product-selector { grid-template-columns:1fr; }
  .pmp-history-submit { width:100%; }
}
@media(max-width:620px){
  .purchase-history-manual-grid { grid-template-columns:1fr; }
  .purchase-history-manual-grid .span-2 { grid-column:auto; }
  .purchase-history-manual-dialog .dialog-body { padding:18px; }
}

/* ========================================================================== 
   JTLM ERP 4.2.82 — barres de défilement unifiées
   Une seule signature visuelle pour la page, les tableaux, listes et fenêtres.
   ========================================================================== */
:root {
  --erp-scrollbar-track:#edf2f6;
  --erp-scrollbar-thumb:#9aabba;
  --erp-scrollbar-thumb-hover:#4b9360;
}

/* Firefox applique ces deux propriétés à tous les éléments défilants. */
html,* {
  scrollbar-width:thin;
  scrollbar-color:var(--erp-scrollbar-thumb) var(--erp-scrollbar-track);
}

/* Chrome, Edge et Safari : rail fin, poignée arrondie et aucun bouton natif. */
*::-webkit-scrollbar {
  width:9px;
  height:9px;
}
*::-webkit-scrollbar-track {
  border-radius:999px;
  background:var(--erp-scrollbar-track);
}
*::-webkit-scrollbar-thumb {
  min-width:38px;
  min-height:38px;
  border:2px solid transparent;
  border-radius:999px;
  background:var(--erp-scrollbar-thumb);
  background-clip:padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background:var(--erp-scrollbar-thumb-hover);
  background-clip:padding-box;
}
*::-webkit-scrollbar-button {
  display:none;
  width:0;
  height:0;
}
*::-webkit-scrollbar-corner { background:transparent; }

/* ERP 4.2.87 — largeur et mode de gestion du tableau de remises. */
.discount-table { width:100%; min-width:1120px; }
.discount-table th:first-child,
.discount-table td:first-child { width:36px; min-width:36px; max-width:36px; }
.discount-table th:nth-child(2),
.discount-table td:nth-child(2) { width:82px; min-width:82px; max-width:82px; }
.discount-table th:nth-child(3),
.discount-table td:nth-child(3) { width:300px; min-width:300px; max-width:300px; }
.discount-table th:nth-child(4),
.discount-table td:nth-child(4) { width:150px; min-width:150px; max-width:150px; }
.discount-table th:nth-child(n + 5),
.discount-table td:nth-child(n + 5) { width:112px; min-width:112px; max-width:112px; text-align:center; }
.discount-management-mode { color:#475569; font-size:10px; font-weight:750; line-height:1.3; white-space:normal; }

/* Sur un écran 1920 px, le tableau occupe toute la carte sans bande vide. */
@media (min-width:1500px) {
  .discount-table { min-width:100%; }
  .discount-table th:first-child,
  .discount-table td:first-child { width:3%; min-width:0; max-width:none; }
  .discount-table th:nth-child(2),
  .discount-table td:nth-child(2) { width:7%; min-width:0; max-width:none; }
  .discount-table th:nth-child(3),
  .discount-table td:nth-child(3) { width:25%; min-width:0; max-width:none; }
  .discount-table th:nth-child(4),
  .discount-table td:nth-child(4) { width:13%; min-width:0; max-width:none; }
  .discount-table th:nth-child(n + 5),
  .discount-table td:nth-child(n + 5) { width:auto; min-width:0; max-width:none; }
}

.supplier-delete-panel { display:flex; align-items:center; justify-content:space-between; gap:18px; border-color:#efc7c7; background:#fffafa; }
.supplier-delete-panel > div { display:grid; gap:4px; }
.supplier-delete-panel b { color:#8f2626; }
.supplier-delete-panel small { color:#745b5b; }
@media(max-width:640px){.supplier-delete-panel{align-items:stretch;flex-direction:column}.supplier-delete-panel .btn{width:100%}}

/* ========================================================================== 
   JTLM ERP 4.2.90 — sauvegardes et corrections responsive finales
   Ces règles ciblées restent en fin de feuille afin de neutraliser les
   anciennes variantes sans modifier la direction artistique existante.
   ========================================================================== */

/* Supervision en lecture seule des sauvegardes externes OneDrive / Restic. */
.external-backup-card { overflow:hidden; }
.external-backup-head-actions { display:flex; align-items:center; gap:9px; }
.external-backup-status-grid {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin:16px 0;
}
.external-backup-status {
  display:grid;
  gap:7px;
  min-width:0;
  padding:15px 16px;
  border:1px solid #dce5ed;
  border-top:4px solid #9aaabd;
  border-radius:12px;
  background:#f8fafc;
}
.external-backup-status.is-success { border-top-color:var(--green); background:#f4faf5; }
.external-backup-status.is-failure { border-top-color:#c93f3f; background:#fff7f7; }
.external-backup-status > div { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.external-backup-status span { color:var(--navy); font-size:11px; font-weight:850; }
.external-backup-status b { color:#607185; font-size:10px; white-space:nowrap; }
.external-backup-status.is-success b { color:#2d7540; }
.external-backup-status.is-failure b { color:#a52c2c; }
.external-backup-status p { min-height:32px; margin:0; color:#607185; font-size:10px; line-height:1.5; }
.external-backup-status time,
.external-backup-status small { overflow:hidden; color:#465a70; font-size:10px; font-weight:750; text-overflow:ellipsis; white-space:nowrap; }
.external-backup-location {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:1px;
  overflow:hidden;
  border:1px solid #dce5ed;
  border-radius:12px;
  background:#dce5ed;
}
.external-backup-location > div { display:grid; gap:5px; min-width:0; padding:13px 15px; background:#fff; }
.external-backup-location b { color:var(--navy); font-size:10px; }
.external-backup-location span { color:#607185; font-size:10px; line-height:1.45; }
.external-backup-history { margin-top:14px; }
.external-backup-history > summary { cursor:pointer; color:var(--navy); font-size:11px; font-weight:850; }
.external-backup-history .table-wrap { margin-top:10px; }
.external-backup-history td small { display:block; margin-top:2px; color:#718096; }
.backup-result { display:inline-flex; padding:4px 8px; border-radius:999px; font-size:9px; font-weight:900; }
.backup-result.success { color:#256a38; background:#e9f6ec; }
.backup-result.failure { color:#a52c2c; background:#fdeaea; }
.external-backup-awaiting { margin:14px 0 0; padding:11px 13px; border-radius:9px; color:#53677c; background:#f2f5f8; }
.backup-auto-label { display:flex; align-items:center; justify-content:center; min-height:32px; border:1px solid #d7e2e8; border-radius:8px; color:#53677c !important; background:#fff; }

/* Actions prioritaires compactes, intégrées à l'en-tête du tableau de bord. */
.dashboard-action-compact { display:flex; align-items:center; gap:6px; min-width:0; }
.dashboard-action-pill { display:inline-flex; align-items:center; gap:6px; min-height:34px; padding:5px 9px 5px 6px; border:1px solid #ead8b7; border-radius:9px; color:#5e4a22; background:#fffaf0; white-space:nowrap; }
.dashboard-action-pill strong { display:grid; place-items:center; min-width:23px; height:23px; padding:0 5px; border-radius:7px; color:#fff; background:#c88a1a; font-size:10px; line-height:1; }
.dashboard-action-pill span { font-size:9px; font-weight:850; letter-spacing:.01em; }
.dashboard-action-pill.is-danger { border-color:#efcccc; color:#873434; background:#fff7f7; }
.dashboard-action-pill.is-danger strong { background:#c94747; }
.dashboard-action-pill.is-info { border-color:#cedfed; color:#375d83; background:#f5f9fd; }
.dashboard-action-pill.is-info strong { background:#4c82bd; }
.dashboard-action-pill.is-clear { border-color:#cfe5d4; color:#397045; background:#f4faf5; }
.dashboard-action-pill.is-clear strong { background:#4a9458; }
.dashboard-analysis-button { flex:0 0 auto; }
@media (max-width:1380px) {
  .dashboard-action-compact { max-width:min(62vw,760px); overflow-x:auto; padding-bottom:2px; scrollbar-width:thin; }
}
@media (max-width:1180px) {
  .external-backup-status-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .dashboard-action-compact { flex:1 1 auto; max-width:100%; overflow-x:auto; }
  .page-title .page-actions:has(.dashboard-action-compact) { display:flex !important; flex-wrap:nowrap; align-items:center; width:100%; overflow:visible !important; }
  .page-title .page-actions:has(.dashboard-action-compact) > .dashboard-analysis-button { width:auto; min-width:160px; min-height:34px; white-space:nowrap !important; }
}
@media (max-width:760px) {
  .page-title .page-actions:has(.dashboard-action-compact) { display:grid !important; grid-template-columns:1fr; }
  .dashboard-action-compact { width:100%; overflow-x:auto; flex-wrap:nowrap; }
  .page-title .page-actions:has(.dashboard-action-compact) > .dashboard-analysis-button { width:100%; }
}

/* Date lisible et constante sur iPhone : la saisie native reste cliquable,
   tandis que la valeur visible adopte toujours le format français numérique. */
.ios-date-control { position:relative; display:block; width:100%; min-width:0; max-width:100%; }
.ios-date-control > input[type="date"] { position:relative; z-index:1; width:100% !important; color:transparent !important; -webkit-text-fill-color:transparent !important; background:transparent; }
.ios-date-display { position:absolute; z-index:2; inset:0; display:flex; align-items:center; justify-content:center; min-width:0; padding:0 34px; overflow:hidden; color:var(--ink); font:inherit; font-size:16px; font-weight:600; line-height:1; text-align:center; text-overflow:ellipsis; white-space:nowrap; pointer-events:none; }
.ios-date-display.is-placeholder { color:#98a1ad; font-weight:500; }
@media (min-width:761px) and (max-width:1180px) {
  .ios-date-display { padding-inline:30px; font-size:13px; font-weight:600; }
}

/* Tableau de bord : les deux dates restent côte à côte sur téléphone et la
   grille reste compacte sur tablette. */
@media (min-width:761px) and (max-width:1180px) {
  .period-filter.dashboard-filter {
    grid-template-columns:minmax(150px,1.15fr) repeat(2,minmax(135px,1fr)) minmax(125px,.9fr) auto !important;
    gap:9px !important;
    align-items:end;
  }
  .period-filter.dashboard-filter > label,
  .period-filter.dashboard-filter > button { width:auto !important; min-width:0 !important; }
}
@media (max-width:760px) {
  .period-filter.dashboard-filter {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:9px !important;
  }
  .period-filter.dashboard-filter > label,
  .period-filter.dashboard-filter > button { width:100% !important; min-width:0 !important; }
  .period-filter.dashboard-filter > label:first-of-type { grid-column:1 / -1; }
  .period-filter.dashboard-filter > label:nth-of-type(4) { grid-column:1 / 2; }
  .period-filter.dashboard-filter > button { grid-column:2 / 3; align-self:end; }
}

/* Price List tablette : largeur réellement exploitable, désignations lisibles
   et défilement horizontal contenu dans la carte uniquement. */
@media (max-width:1180px) {
  .price-list-wrap {
    width:100%;
    max-width:100%;
    overflow-x:auto !important;
    overscroll-behavior-inline:contain;
    -webkit-overflow-scrolling:touch;
  }
  .price-list-wrap .price-list-table {
    width:1760px !important;
    min-width:1760px !important;
    table-layout:fixed !important;
  }
  .price-list-table th,
  .price-list-table td { min-width:0 !important; }
  .price-list-table th:nth-child(1), .price-list-table td:nth-child(1) { width:42px !important; }
  .price-list-table th:nth-child(2), .price-list-table td:nth-child(2) { width:82px !important; }
  .price-list-table th:nth-child(3), .price-list-table td:nth-child(3) { width:90px !important; }
  .price-list-table th:nth-child(4), .price-list-table td:nth-child(4) { width:310px !important; }
  .price-list-table th:nth-child(5), .price-list-table td:nth-child(5) { width:250px !important; }
  .price-list-table th:nth-child(6), .price-list-table td:nth-child(6) { width:145px !important; }
  .price-list-table th:nth-child(7), .price-list-table td:nth-child(7),
  .price-list-table th:nth-child(8), .price-list-table td:nth-child(8) { width:105px !important; }
  .price-list-table th:nth-child(9), .price-list-table td:nth-child(9) { width:120px !important; }
  .price-list-table th:nth-child(10), .price-list-table td:nth-child(10) { width:110px !important; }
  .price-list-table th:nth-child(11), .price-list-table td:nth-child(11) { width:130px !important; }
  .price-list-table th:nth-child(12), .price-list-table td:nth-child(12) { width:95px !important; }
  .price-list-table th:nth-child(13), .price-list-table td:nth-child(13) { width:180px !important; max-width:none !important; }
  .price-list-table .full-designation,
  .price-list-table .price-list-comment {
    white-space:normal !important;
    overflow-wrap:break-word !important;
    word-break:normal !important;
    line-height:1.3;
  }
}

/* Configurateurs : le container est conservé, sa hauteur suit tout le contenu
   et seule la page ERP défile. */
.erp-configurator-card {
  min-width:0;
  overflow:visible !important;
  border-radius:14px;
}
.erp-configurator-frame {
  display:block;
  width:100%;
  max-width:100%;
  min-height:920px !important;
  max-height:none !important;
  overflow:hidden !important;
  border:0;
}
@media (max-width:760px) {
  .erp-configurator-frame { min-height:1180px !important; }
  .external-backup-status-grid,
  .external-backup-location { grid-template-columns:1fr; }
  .external-backup-head-actions { align-items:stretch; flex-direction:column; width:100%; }
  .external-backup-head-actions .btn { width:100%; }
}
@media (min-width:761px) and (max-width:1050px) {
  .external-backup-status-grid { grid-template-columns:1fr; }
}

/* ========================================================================== 
   JTLM ERP 4.2.91 — centre de sauvegarde et restauration
   ========================================================================== */
.backup-control-center { overflow:hidden; }

/* Actions de sauvegarde lancées depuis l'ERP : discrètes, explicites et tactiles. */
.external-backup-launch { margin-top:auto; padding-top:12px; }
.external-backup-launch .btn { width:100%; justify-content:center; }
.external-backup-launch .btn:disabled { opacity:.48; cursor:not-allowed; }
.external-backup-action-state { margin-top:14px; padding:13px 15px; border:1px solid #d8e1e8; border-radius:12px; background:#f7f9fb; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.external-backup-action-state div { display:grid; gap:3px; }
.external-backup-action-state span,.external-backup-action-state time { color:#617080; font-size:.82rem; }
.external-backup-action-state.is-pending { border-color:#f2d49b; background:#fff9ed; }
.external-backup-action-state.is-success { border-color:#b9dfc1; background:#f2fbf4; }
.external-backup-action-state.is-failure { border-color:#efb8b8; background:#fff5f5; }
@media (max-width:700px) { .external-backup-action-state { align-items:flex-start; flex-direction:column; gap:7px; } }
.backup-tool-grid {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:13px;
  margin:17px 0 20px;
}
.backup-tool-card {
  display:flex;
  min-width:0;
  min-height:178px;
  flex-direction:column;
  justify-content:space-between;
  gap:18px;
  padding:17px;
  border:1px solid #dbe5ed;
  border-radius:14px;
  background:linear-gradient(145deg,#fff,#f7f9fb);
  box-shadow:0 5px 16px rgba(13,47,104,.045);
}
.backup-tool-card.is-primary { border-color:#b9dcc0; background:linear-gradient(145deg,#f8fcf8,#eef8f0); }
.backup-tool-card > div { display:flex; align-items:flex-start; gap:12px; min-width:0; }
.backup-tool-index {
  display:grid;
  place-items:center;
  flex:0 0 34px;
  width:34px;
  height:34px;
  border-radius:10px;
  color:#476078;
  background:#e8eef4;
  font-size:10px;
  font-weight:900;
}
.backup-tool-card.is-primary .backup-tool-index { color:#28713a; background:#dff1e3; }
.backup-tool-card h3 { margin:1px 0 6px; color:var(--navy); font-size:13px; }
.backup-tool-card p { margin:0; color:#64758a; font-size:10px; line-height:1.5; }
.backup-tool-card form,
.backup-tool-card .btn { width:100%; }

.backup-restore-panel {
  overflow:hidden;
  border:1px solid #d4e0e9;
  border-radius:15px;
  background:#f8fafc;
}
.backup-restore-panel > header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:17px 19px;
  border-bottom:1px solid #dce5ed;
  background:#fff;
}
.backup-restore-panel h3 { margin:3px 0 4px; color:var(--navy); font-size:15px; }
.backup-restore-panel header p { margin:0; color:#65768a; font-size:10px; }
.backup-safety-badge {
  flex:0 0 auto;
  padding:6px 10px;
  border-radius:999px;
  color:#2c6f3d;
  background:#e9f6ec;
  font-size:9px;
  font-weight:900;
}
.backup-restore-source-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; padding:16px; }
.backup-restore-source {
  display:flex;
  min-width:0;
  flex-direction:column;
  gap:13px;
  padding:16px;
  border:1px solid #dce5ed;
  border-radius:12px;
  background:#fff;
}
.backup-source-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.backup-source-heading span { color:var(--navy); font-size:11px; font-weight:900; }
.backup-source-heading small { color:#77879a; font-size:9px; text-align:right; }
.backup-file-picker {
  display:grid;
  place-items:center;
  min-height:86px;
  cursor:pointer;
  padding:13px;
  border:1px dashed #9db0c2;
  border-radius:10px;
  color:var(--navy);
  background:#f7fafc;
  text-align:center;
}
.backup-file-picker:hover { border-color:var(--green); background:#f2faf3; }
.backup-file-picker.has-file { border-style:solid; border-color:#75b982; background:#eef8f0; }
.backup-file-picker.has-file span { color:#286d39; }
.backup-file-picker input { position:absolute; width:1px; height:1px; overflow:hidden; opacity:0; }
.backup-file-picker span { font-size:10px; font-weight:850; }
.backup-file-picker small { margin-top:3px; color:#77879a; font-size:9px; }
.backup-restore-source > .btn,
.backup-restore-source > form:last-child .btn { width:100%; }
.external-restore-request { display:grid; gap:13px; }
.external-restore-request label { display:grid; gap:7px; color:#52667a; font-size:9px; font-weight:850; }
.external-restore-request select { width:100%; }
.external-restore-progress { display:grid; gap:5px; min-height:82px; align-content:center; padding:12px 13px; border:1px solid #dce5ed; border-radius:10px; background:#f6f8fa; }
.external-restore-progress b { color:var(--navy); font-size:10px; }
.external-restore-progress span { overflow:hidden; color:#52667a; font-size:10px; font-weight:750; text-overflow:ellipsis; white-space:nowrap; }
.external-restore-progress small { color:#77879a; font-size:9px; }
.external-restore-progress.is-ready { border-color:#b7ddbf; background:#f0f9f2; }
.external-restore-progress.is-ready b { color:#28713a; }
.external-restore-progress.is-failure { border-color:#edc0c0; background:#fff5f5; }
.external-restore-progress.is-failure b { color:#a52c2c; }
.backup-restore-safety {
  display:flex;
  align-items:flex-start;
  gap:12px;
  margin:0 16px 16px;
  padding:11px 13px;
  border-radius:10px;
  color:#56697d;
  background:#edf3f8;
  font-size:9px;
  line-height:1.45;
}
.backup-restore-safety b { flex:0 0 auto; color:var(--navy); }
#backup-restore-analysis { border-top:4px solid var(--green); }
#backup-restore-analysis .kpi-grid { margin-top:15px !important; }

@media (max-width:1050px) {
  .backup-tool-grid { grid-template-columns:1fr; }
  .backup-tool-card { min-height:0; }
}
@media (max-width:760px) {
  .backup-restore-panel > header,
  .backup-source-heading,
  .backup-restore-safety { align-items:stretch; flex-direction:column; }
  .backup-source-heading small { text-align:left; }
  .backup-restore-source-grid { grid-template-columns:1fr; padding:11px; }
  .backup-restore-safety { margin:0 11px 11px; }
  .backup-safety-badge { width:max-content; }
}

/* Newsletter : indicateurs répartis sur toute la largeur utile. */
.newsletter-kpis.kpi-grid.compact {
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}
@media (max-width: 1100px) {
  .newsletter-kpis.kpi-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}
@media (max-width: 640px) {
  .newsletter-kpis.kpi-grid.compact,
  .newsletter-import-form {
    grid-template-columns: 1fr !important;
  }
  .newsletter-import-form > small {
    grid-column: 1;
  }
  .brevo-sync-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .brevo-settings-form { grid-template-columns: 1fr; }
  .brevo-settings-form .span-2 { grid-column: 1; }
  .brevo-settings-form .dialog-actions { display: grid; grid-template-columns: 1fr; }
}

/* Assistant éditorial LinkedIn */
.linkedin-safety-note{display:flex;align-items:center;gap:12px;margin-bottom:16px;padding:14px 18px;border:1px solid #bde8c0;border-radius:14px;background:#f2fbf3;color:#153f21}.linkedin-safety-note>span{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:#4fb555;color:#fff;font-weight:900}.linkedin-safety-note div{display:flex;flex-direction:column;gap:2px}.linkedin-safety-note small{color:#497052}.linkedin-kpis{margin-bottom:18px}.linkedin-generator{border-top:4px solid #4fb555}.linkedin-generator .card-head{align-items:flex-start}.linkedin-generator-form{margin-top:18px}.linkedin-generate-button{min-height:48px;font-size:15px}.linkedin-generate-button span{font-size:20px;margin-right:6px}.linkedin-manual-subject[hidden]{display:none}.linkedin-post-section{margin-top:28px}.section-heading{display:flex;align-items:center;justify-content:space-between;margin:0 2px 12px}.section-heading h2{margin:3px 0 0}.linkedin-empty{display:flex;flex-direction:column;gap:6px;padding:34px}.linkedin-post-list{display:grid;gap:18px}.linkedin-post-card{padding:0;overflow:hidden;scroll-margin-top:90px}.linkedin-post-card.is-focused{box-shadow:0 0 0 3px rgba(79,181,85,.2),0 14px 34px rgba(13,47,104,.12)}.linkedin-post-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:20px 22px;border-bottom:1px solid #e7edf4;background:#fbfcfe}.linkedin-post-head h3{margin:8px 0 4px;font-size:19px}.linkedin-post-head small,.linkedin-post-date span{color:#667085}.linkedin-status{display:inline-flex;padding:5px 9px;border-radius:999px;background:#e9eef5;color:#344054;font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}.linkedin-status.status-ready{background:#eaf6ff;color:#0d5d91}.linkedin-status.status-planned{background:#fff5dc;color:#8a5b00}.linkedin-status.status-published{background:#e7f7e9;color:#256e2d}.linkedin-post-date{display:flex;flex-direction:column;align-items:flex-end;white-space:nowrap}.linkedin-post-body{display:grid;grid-template-columns:minmax(190px,260px) minmax(0,1fr);gap:22px;padding:22px}.linkedin-post-body:not(:has(.linkedin-post-visual)){grid-template-columns:1fr}.linkedin-post-visual{display:flex;flex-direction:column;gap:10px}.linkedin-post-visual img{display:block;width:100%;max-height:260px;object-fit:contain;border:1px solid #e3e9f0;border-radius:12px;background:#f7f9fc}.linkedin-post-editor{min-width:0}.linkedin-variants{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:14px}.linkedin-variants button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:10px 12px;border:1px solid #d9e1eb;border-radius:10px;background:#fff;color:#17345e;text-align:left;font:inherit;font-size:12px;font-weight:800;cursor:pointer}.linkedin-variants button small{max-width:100%;overflow:hidden;color:#778397;font-weight:500;text-overflow:ellipsis;white-space:nowrap}.linkedin-variants button.active{border-color:#4fb555;background:#f0faf1;box-shadow:0 0 0 1px #4fb555}.linkedin-post-editor form>label{display:block;margin-bottom:12px}.linkedin-post-editor textarea{line-height:1.55;resize:vertical}.linkedin-planning-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}.linkedin-editor-actions{display:flex;flex-wrap:wrap;gap:9px;margin-top:14px}.linkedin-editor-actions .copied{border-color:#4fb555;background:#f0faf1;color:#26722d}.linkedin-open{border-color:#0a66c2!important;color:#0a66c2!important}.linkedin-post-footer{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 22px;border-top:1px solid #e7edf4;background:#fbfcfe}.linkedin-publish-form{display:flex;align-items:center;gap:8px;flex:1}.linkedin-publish-form input{max-width:440px}.linkedin-sources{margin-top:24px}.linkedin-source-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:18px}.linkedin-source-item{display:grid;grid-template-columns:88px 1fr;gap:12px;min-width:0;padding:11px;border:1px solid #e4e9f0;border-radius:12px;background:#fbfcfe}.linkedin-source-item>div{display:grid;place-items:center;overflow:hidden;min-height:76px;border-radius:9px;background:#eef3f7}.linkedin-source-item img{width:100%;height:100%;object-fit:cover}.linkedin-source-placeholder{color:#4fb555;font-weight:900}.linkedin-source-item section{display:flex;min-width:0;flex-direction:column;gap:4px}.linkedin-source-item b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.linkedin-source-item small{color:#697586}.linkedin-source-item em{color:#b42318;font-size:12px}.linkedin-source-item a{margin-top:auto;color:#0d2f68;font-size:12px;font-weight:700}.linkedin-settings{margin-top:24px}.linkedin-settings>summary{display:flex;align-items:center;justify-content:space-between;cursor:pointer;list-style:none}.linkedin-settings>summary::-webkit-details-marker{display:none}.linkedin-settings>summary span:first-child{display:flex;flex-direction:column;gap:3px}.linkedin-settings>summary small{color:#697586;font-weight:400}.linkedin-settings[open]>summary{padding-bottom:18px;border-bottom:1px solid #e7edf4;margin-bottom:18px}
@media(max-width:900px){.linkedin-post-body{grid-template-columns:1fr}.linkedin-post-visual{max-width:340px}.linkedin-source-grid{grid-template-columns:1fr}}
@media(max-width:640px){.linkedin-post-head,.linkedin-post-footer{align-items:stretch;flex-direction:column}.linkedin-post-date{align-items:flex-start}.linkedin-post-body{padding:16px}.linkedin-variants{grid-template-columns:1fr}.linkedin-planning-row{grid-template-columns:1fr}.linkedin-editor-actions{display:grid;grid-template-columns:1fr 1fr}.linkedin-publish-form{align-items:stretch;flex-direction:column}.linkedin-source-item{grid-template-columns:72px 1fr}}

/* Newsletter Brevo — modale isolée des anciens styles de formulaires. */
dialog.brevo-newsletter-dialog {
  width:min(760px,calc(100vw - 28px));
  max-height:calc(100vh - 28px);
  overflow:hidden;
  padding:0;
  border:0;
  border-radius:18px;
  background:#f3f6fa;
  color:#18283b;
  box-shadow:0 30px 90px rgba(8,29,58,.34);
}
.brevo-newsletter-dialog > .transport-dialog-head {
  min-height:112px;
  padding:22px 24px;
  border:0;
  border-radius:18px 18px 0 0;
  background:linear-gradient(135deg,#0d2f68,#19549c);
}
.brevo-newsletter-dialog > .transport-dialog-head h3 { margin:5px 0 4px; color:#fff; font-size:22px; line-height:1.2; }
.brevo-newsletter-dialog > .transport-dialog-head p { margin:0; color:#dce9f8; font-size:12px; line-height:1.45; }
.brevo-newsletter-dialog > .transport-dialog-head .section-kicker { color:#9ed0ff; font-size:10px; letter-spacing:.09em; }
.brevo-newsletter-dialog > .transport-dialog-head .icon-btn { width:36px; height:36px; border-color:rgba(255,255,255,.16); background:rgba(255,255,255,.14); color:#fff; }
.brevo-newsletter-dialog > .dialog-body {
  display:flex;
  max-height:calc(100vh - 140px);
  padding:0;
  flex-direction:column;
  gap:0;
  overflow:hidden;
  background:#f3f6fa;
}
.brevo-newsletter-dialog .brevo-modal-content { display:grid; gap:14px; padding:18px 20px; overflow:auto; }
.brevo-newsletter-dialog .brevo-sync-status {
  display:flex;
  align-items:center;
  gap:13px;
  min-height:64px;
  padding:13px 15px;
  border:1px solid #d7e0ea;
  border-radius:12px;
  background:#fff;
}
.brevo-newsletter-dialog .brevo-sync-status > div { display:grid; gap:3px; min-width:0; }
.brevo-newsletter-dialog .brevo-sync-status b { color:#18355c; font-size:14px; }
.brevo-newsletter-dialog .brevo-sync-status small { color:#66778a; font-size:11px; line-height:1.4; }
.brevo-newsletter-dialog .brevo-status-dot { flex:0 0 12px; width:12px; height:12px; border-radius:50%; background:#9aa6b2; box-shadow:0 0 0 5px rgba(154,166,178,.14); }
.brevo-newsletter-dialog .brevo-sync-status.is-connected { border-color:#bde1c2; background:#f3fbf4; }
.brevo-newsletter-dialog .brevo-sync-status.is-connected .brevo-status-dot { background:var(--green); box-shadow:0 0 0 5px rgba(79,181,85,.14); }
.brevo-newsletter-dialog .brevo-sync-status.is-error { border-color:#efc7c7; background:#fff6f6; }
.brevo-newsletter-dialog .brevo-sync-status.is-error .brevo-status-dot { background:#c43b3b; box-shadow:0 0 0 5px rgba(196,59,59,.12); }
.brevo-newsletter-dialog .brevo-sync-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; }
.brevo-newsletter-dialog .brevo-sync-summary span { display:grid; gap:2px; padding:10px; border:1px solid #dfe6ee; border-radius:11px; text-align:center; background:#fff; }
.brevo-newsletter-dialog .brevo-sync-summary b { color:#0d2f68; font-size:19px; line-height:1.1; }
.brevo-newsletter-dialog .brevo-sync-summary small { color:#718094; font-size:10px; }
.brevo-newsletter-dialog .brevo-panel {
  display:grid;
  gap:14px;
  margin:0;
  padding:17px;
  border:1px solid #dce4ed;
  border-radius:13px;
  background:#fff;
  box-shadow:0 4px 14px rgba(25,52,84,.04);
}
.brevo-newsletter-dialog .brevo-panel-heading { display:flex; align-items:center; gap:12px; }
.brevo-newsletter-dialog .brevo-panel-heading > div { display:grid; gap:2px; }
.brevo-newsletter-dialog .brevo-panel-heading b { color:#17355c; font-size:14px; }
.brevo-newsletter-dialog .brevo-panel-heading small { color:#6b7b8f; font-size:10px; }
.brevo-newsletter-dialog .brevo-direction { flex:0 0 auto; padding:6px 9px; border-radius:999px; background:#eaf1ff; color:#174984; font-size:9px; font-weight:900; letter-spacing:.03em; }
.brevo-newsletter-dialog .brevo-direction.is-outbound { background:#e8f7eb; color:#27743a; }
.brevo-newsletter-dialog .brevo-settings-form { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px; }
.brevo-newsletter-dialog .brevo-settings-form > label:not(.newsletter-consent),
.brevo-newsletter-dialog .brevo-export-form > label { display:grid; gap:6px; min-width:0; color:#42566e; font-size:10px; font-weight:850; }
.brevo-newsletter-dialog input,
.brevo-newsletter-dialog select { width:100%; min-width:0; min-height:40px; font-size:12px; }
.brevo-newsletter-dialog .newsletter-consent { min-height:34px; margin:0; color:#31475f; font-size:11px; font-weight:750; }
.brevo-newsletter-dialog .newsletter-consent input { width:15px; min-height:15px; }
.brevo-newsletter-dialog .field-help { margin:0; color:#6c7b8e; font-size:10px; line-height:1.5; }
.brevo-newsletter-dialog .dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin:0; padding:12px 0 0; border-top:1px solid #e7ebf0; }
.brevo-newsletter-dialog .brevo-export-form { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:10px; }
.brevo-newsletter-dialog .brevo-export-form .btn { min-height:40px; white-space:nowrap; }
.brevo-newsletter-dialog .brevo-last-export { margin:0; padding:8px 10px; border-radius:8px; background:#f2f6fa; color:#617287; font-size:10px; }
.brevo-newsletter-dialog .brevo-modal-footer { display:flex; justify-content:flex-end; gap:9px; padding:14px 20px; border-top:1px solid #dce4ed; background:#fff; box-shadow:0 -6px 18px rgba(19,46,78,.04); }
.brevo-newsletter-dialog .brevo-modal-footer form { margin:0; }
.brevo-newsletter-dialog .btn[disabled] { cursor:not-allowed; opacity:.48; }
@media(max-width:640px){
  dialog.brevo-newsletter-dialog { width:calc(100vw - 16px); max-height:calc(100vh - 16px); }
  .brevo-newsletter-dialog > .transport-dialog-head { min-height:0; padding:18px; }
  .brevo-newsletter-dialog > .dialog-body { max-height:calc(100vh - 112px); }
  .brevo-newsletter-dialog .brevo-modal-content { padding:12px; }
  .brevo-newsletter-dialog .brevo-sync-summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .brevo-newsletter-dialog .brevo-settings-form,
  .brevo-newsletter-dialog .brevo-export-form { grid-template-columns:1fr; }
  .brevo-newsletter-dialog .brevo-settings-form .span-2 { grid-column:1; }
  .brevo-newsletter-dialog .dialog-actions,
  .brevo-newsletter-dialog .brevo-modal-footer { display:grid; grid-template-columns:1fr; }
  .brevo-newsletter-dialog .brevo-modal-footer form,
  .brevo-newsletter-dialog .brevo-modal-footer .btn { width:100%; }
}

/* 4.4.06 — synthèse financière compacte des commandes clients. */
.special-orders-overview {
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin:0 0 14px;
}
.special-order-kpi {
  position:relative;
  display:grid;
  min-width:0;
  gap:5px;
  padding:15px 17px;
  overflow:hidden;
  border:1px solid #dce5ed;
  border-radius:13px;
  background:#fff;
  box-shadow:0 7px 20px rgba(13,47,104,.055);
}
.special-order-kpi::before { content:""; position:absolute; inset:0 auto 0 0; width:4px; background:var(--navy); }
.special-order-kpi.is-deposit::before { background:#e0a331; }
.special-order-kpi.is-remaining::before { background:var(--green); }
.special-order-kpi > span { color:#6c7c8f; font-size:9px; font-weight:900; letter-spacing:.06em; text-transform:uppercase; }
.special-order-kpi > strong { color:var(--navy); font-size:19px; line-height:1.2; }
.special-order-kpi > div { display:grid; grid-template-columns:auto 1fr auto 1fr; align-items:baseline; gap:4px 7px; padding-top:6px; border-top:1px solid #edf1f4; }
.special-order-kpi > div b { color:#344a63; font-size:12px; white-space:nowrap; }
.special-order-kpi > div small { color:#8995a3; font-size:9px; font-weight:800; }
.special-order-dossier-finance { display:grid; min-width:105px; gap:1px; padding-left:12px; border-left:1px solid #dfe6ed; }
.special-order-dossier-finance small { color:#7b8999; font-size:8px; font-weight:900; letter-spacing:.05em; text-transform:uppercase; }
.special-order-dossier-finance strong { color:var(--navy); font-size:12px; line-height:1.25; }
.special-order-dossier-finance.is-deposit strong { color:#986b13; }
.special-order-dossier-finance.is-remaining strong { color:#28733a; }
.product-thumb-cell .product-thumb-zoom {
  display:grid;
  width:58px;
  height:58px;
  place-items:center;
  padding:0;
  overflow:hidden;
  border:1px solid #dfe6ed;
  border-radius:10px;
  background:#f7f9fb;
  cursor:zoom-in;
}
.product-thumb-cell .product-thumb-zoom:hover { box-shadow:0 0 0 2px rgba(13,47,104,.18); }
.product-thumb-cell .product-thumb-zoom img { width:100%; height:100%; object-fit:cover; }
.document-customer-name {
  display:block;
  max-width:100%;
  padding:0;
  overflow:hidden;
  border:0;
  background:transparent;
  color:var(--navy);
  font:inherit;
  font-size:13px;
  font-weight:850;
  text-align:left;
  text-decoration:underline;
  text-decoration-color:rgba(13,47,104,.3);
  text-underline-offset:3px;
  text-overflow:ellipsis;
  white-space:nowrap;
  cursor:pointer;
}
.document-customer-name:hover { color:var(--green); text-decoration-color:var(--green); }
.document-customer-dialog { width:min(860px,calc(100vw - 28px)); max-height:calc(100vh - 28px); padding:0; overflow:hidden; border:0; border-radius:18px; box-shadow:0 28px 80px rgba(13,47,104,.3); }
.document-customer-dialog > .dialog-body { max-height:calc(100vh - 125px); padding:20px 22px; overflow:auto; background:#f7f9fb; }
.document-customer-form { margin:0; padding:0; border:0; box-shadow:none; background:transparent; }
.document-customer-form .dialog-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:4px; padding-top:14px; border-top:1px solid #dfe6ed; }
@media(max-width:640px){
  .document-customer-dialog { width:calc(100vw - 16px); max-height:calc(100vh - 16px); }
  .document-customer-dialog > .dialog-body { padding:14px; }
  .document-customer-form .dialog-actions { display:grid; grid-template-columns:1fr; }
  .special-order-dossier-summary { align-items:flex-start; flex-wrap:wrap; }
  .special-order-dossier-finance { min-width:calc(50% - 8px); padding:7px 0 0; border-top:1px solid #dfe6ed; border-left:0; }
}
@media(max-width:820px){ .special-orders-overview { grid-template-columns:1fr; } }

/* Inventaire — sixième ligne de synthèse : valeur de vente HT du stock
   physique. Elle reste solidaire des cinq lignes existantes sur ordinateur,
   tablette et téléphone pendant les deux axes de défilement. */
.matrix-sale-value-row th,
.matrix-sale-value-row td {
  font-size:.92em;
  font-weight:700;
}
.stock-matrix-scroll .stock-matrix tbody > .matrix-sale-value-row > * {
  position:sticky !important;
  top:380px !important;
  left:auto !important;
  right:auto !important;
  z-index:45 !important;
  height:42px !important;
  min-height:42px !important;
  background:#eaf5ed !important;
  color:#315d3b !important;
  text-align:center !important;
  box-shadow:none !important;
}
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-sale-value-row > :first-child {
  position:sticky !important;
  top:380px !important;
  left:0 !important;
  z-index:55 !important;
  background:#eaf5ed !important;
  color:#315d3b !important;
  text-align:left !important;
}
.stock-matrix-scroll table.stock-matrix.stock-matrix-body tbody > tr.matrix-sale-value-row > :nth-child(2) {
  position:sticky !important;
  top:380px !important;
  left:auto !important;
  right:auto !important;
  z-index:46 !important;
  background:#eaf5ed !important;
  color:#315d3b !important;
  padding-left:14px !important;
  text-align:left !important;
}

/* ERP 4.4.11 — filet responsive commun aux modules historiques. */
.content,.content > *,.card,.card > * { min-width:0; }
.content img,.content video,.content canvas { max-width:100%; height:auto; }
.content pre,.content code { max-width:100%; overflow-wrap:anywhere; }
dialog { max-width:calc(100vw - 24px); max-height:calc(100dvh - 24px); }

@media (max-width:760px) {
  .filterbar { display:grid; grid-template-columns:1fr; align-items:stretch; width:100%; }
  .filterbar > *,.filterbar label,.filterbar input,.filterbar select,.filterbar .btn { width:100%; min-width:0 !important; }
  .row-actions { flex-wrap:wrap; white-space:normal; }
  .row-actions .btn,.row-actions form { flex:1 1 130px; }
  .row-actions form .btn { width:100%; }
  .notice,.alert { max-width:100%; overflow-wrap:anywhere; }
  .button-stack,.button-stack > form,.button-stack > a,.button-stack .btn { width:100%; min-width:0; }
  .week-planner { grid-template-columns:repeat(7,minmax(82vw,320px)); scroll-snap-type:x proximity; }
  .planner-day { min-height:360px; scroll-snap-align:start; }
  .planner-event-actions { flex-wrap:wrap; }
  dialog .dialog-body,dialog form { max-width:100%; overflow-x:hidden; }
}

@media (max-width:480px) {
  .page-actions { grid-template-columns:1fr !important; }
  .page-actions > * { grid-column:1 !important; }
  .card { padding:13px; }
  .week-planner { grid-template-columns:repeat(7,minmax(88vw,280px)); }
}

/* ERP 4.4.12 — cockpit de lecture et de relance des commandes clients. */
.special-orders-workbench {
  display:grid;
  grid-template-columns:minmax(280px,1fr) auto;
  align-items:center;
  gap:12px 18px;
  margin:0 0 14px;
  padding:14px;
  border:1px solid #dce5ec;
  border-radius:12px;
  background:#fff;
  box-shadow:0 5px 18px rgba(13,47,104,.045);
}
.special-orders-search { position:relative; display:block; min-width:0; }
.special-orders-search > span { position:absolute; z-index:1; left:14px; top:50%; transform:translateY(-50%); color:#66788c; font-size:22px; pointer-events:none; }
.special-orders-search input { width:100%; min-height:46px; padding-left:43px; border-color:#cfdbe5; font-size:15px; }
.special-orders-quick-filters { display:flex; align-items:center; flex-wrap:wrap; gap:7px; }
.special-orders-quick-filters button {
  display:flex;
  align-items:center;
  gap:7px;
  min-height:38px;
  padding:7px 10px;
  border:1px solid #d8e2e9;
  border-radius:9px;
  background:#f7f9fb;
  color:#4d6074;
  font:inherit;
  font-size:13px;
  font-weight:750;
  cursor:pointer;
}
.special-orders-quick-filters button:hover,
.special-orders-quick-filters button.active { border-color:#4fb555; background:#edf9ef; color:#195f2c; }
.special-orders-quick-filters b { min-width:23px; padding:2px 6px; border-radius:999px; background:#e3eaf0; color:#3f5368; text-align:center; }
.special-orders-quick-filters button.active b { background:#4fb555; color:#fff; }
.special-orders-workbench > p { grid-column:1 / -1; margin:0; color:#6b7c8f; font-size:13px; font-weight:700; }
.special-order-dossier[hidden] { display:none !important; }

.special-order-dossier-head {
  display:grid;
  grid-template-columns:minmax(145px,.7fr) minmax(220px,1.25fr) minmax(250px,1.5fr) minmax(235px,1fr);
  align-items:stretch;
  gap:0;
  padding:0;
}
.special-order-dossier-head > div { min-width:0; padding:16px 18px; }
.special-order-dossier-head > div + div { border-left:1px solid #e2e9ef; }
.special-order-identity { display:flex; flex-direction:column; justify-content:center; }
.special-order-identity .section-kicker { font-size:12px; }
.special-order-dossier-head .special-order-identity a { margin-top:5px; font-size:20px; line-height:1.15; }
.special-order-dossier-head .special-order-identity p { margin-top:5px; color:#40566e; font-size:15px; font-weight:750; line-height:1.3; }
.special-order-scan-products,
.special-order-latest-note { display:flex; flex-direction:column; justify-content:center; gap:5px; }
.special-order-scan-products > span,
.special-order-latest-note > span { color:#6f7f90; font-size:12px; font-weight:900; letter-spacing:.05em; }
.special-order-scan-products strong { display:block; overflow:hidden; color:#243d59; font-size:14px; line-height:1.35; text-overflow:ellipsis; white-space:nowrap; }
.special-order-scan-products small { color:#66798c; font-size:13px; font-weight:700; }
.special-order-latest-note { background:#f7fafc; }
.special-order-latest-note p {
  display:-webkit-box;
  margin:0;
  overflow:hidden;
  color:#314860;
  font-size:14px;
  line-height:1.4;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:3;
}
.special-order-latest-note small { color:#6f7f90; font-size:12px; }
.special-order-latest-note.is-empty { background:#fffaf0; }
.special-order-latest-note.is-empty p { color:#8a6419; font-style:italic; }
.special-order-dossier-summary { position:relative; display:flex; flex-direction:column; align-items:stretch; justify-content:center; gap:10px; }
.special-order-follow-up-badge {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  min-height:35px;
  padding:7px 10px;
  border:1px solid #d8e1e9;
  border-radius:9px;
  background:#f2f5f7;
  color:#43566b;
  font-style:normal;
}
.special-order-follow-up-badge b { font-size:13px; }
.special-order-follow-up-badge small { font-size:12px; font-weight:800; white-space:nowrap; }
.special-order-follow-up-badge.status-overdue { border-color:#e7aaaa; background:#fff0f0; color:#a22727; }
.special-order-follow-up-badge.status-today { border-color:#e6bd70; background:#fff7e4; color:#8b5e0b; }
.special-order-follow-up-badge.status-upcoming { border-color:#9fc7e7; background:#eef7ff; color:#1e659d; }
.special-order-follow-up-badge.status-waiting { border-color:#d9c18b; background:#fff9e9; color:#79601f; }
.special-order-follow-up-badge.status-confirmed { border-color:#9bd2a6; background:#edf9ef; color:#216d33; }
.special-order-follow-up-badge.status-no_followup { border-color:#cbd5df; background:#f1f4f6; color:#596a7b; }
.special-order-summary-numbers { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.special-order-summary-numbers > span { display:grid; gap:2px; }
.special-order-summary-numbers small { color:#728294; font-size:11px; font-weight:800; text-transform:uppercase; }
.special-order-summary-numbers strong { overflow:hidden; color:var(--navy); font-size:13px; text-overflow:ellipsis; white-space:nowrap; }
.special-order-dossier-summary > i { position:absolute; right:2px; bottom:2px; }

.special-order-follow-up-panel {
  display:grid;
  grid-template-columns:minmax(230px,1fr) auto;
  align-items:center;
  gap:18px;
  padding:16px 20px;
  border-bottom:1px solid #dfe8ef;
  background:linear-gradient(90deg,#eef7ff,#f8fbfd 45%,#fff);
}
.special-order-follow-up-panel h3 { margin:3px 0 4px; color:var(--navy); font-size:18px; }
.special-order-follow-up-panel p { margin:0 0 10px; color:#5d7084; font-size:14px; }
.special-order-follow-up-panel form { display:grid; grid-template-columns:210px 165px minmax(85px,auto); align-items:end; gap:10px; }
.special-order-follow-up-panel form label { display:grid; gap:5px; color:#4f6276; font-size:13px; font-weight:800; }
.special-order-follow-up-panel [data-follow-up-date-field][hidden] { display:none; }
.special-order-follow-up-panel form select,
.special-order-follow-up-panel form input { width:100%; min-height:42px; }
.special-order-follow-up-panel form > small { align-self:center; color:#66788b; font-size:12px; font-weight:750; }
.special-order-follow-up-panel form > small.is-saved { color:#28733a; }
.special-order-follow-up-panel form > small.is-error { color:#a22727; }

@media (max-width:1380px) {
  .special-orders-workbench { grid-template-columns:1fr; }
  .special-order-dossier-head { grid-template-columns:180px minmax(220px,1fr) minmax(250px,1fr); }
  .special-order-dossier-summary { grid-column:1 / -1; display:grid; grid-template-columns:minmax(210px,.7fr) minmax(360px,1.3fr); align-items:center; }
  .special-order-dossier-head > .special-order-dossier-summary { border-top:1px solid #e2e9ef; border-left:0; }
}
@media (max-width:980px) {
  .special-order-dossier-head { grid-template-columns:minmax(150px,.7fr) minmax(230px,1fr); }
  .special-order-latest-note { grid-column:1 / -1; border-top:1px solid #e2e9ef; border-left:0 !important; }
  .special-order-follow-up-panel { grid-template-columns:1fr; }
  .special-order-follow-up-panel form { grid-template-columns:minmax(200px,1fr) minmax(165px,.7fr) auto; }
}
@media (max-width:760px) {
  .special-orders-workbench { padding:11px; }
  .special-orders-quick-filters { display:grid; grid-template-columns:1fr 1fr; }
  .special-orders-quick-filters button { justify-content:space-between; }
  .special-order-dossier-head { display:grid; grid-template-columns:1fr; }
  .special-order-dossier-head > div { padding:14px; }
  .special-order-dossier-head > div + div { border-top:1px solid #e2e9ef; border-left:0; }
  .special-order-scan-products,
  .special-order-latest-note,
  .special-order-dossier-summary { grid-column:1; }
  .special-order-dossier-summary { display:grid; grid-template-columns:1fr; }
  .special-order-summary-numbers { gap:5px; }
  .special-order-follow-up-panel { padding:14px 12px; }
  .special-order-follow-up-panel form { grid-template-columns:1fr; }
}
@media (max-width:460px) {
  .special-orders-quick-filters { grid-template-columns:1fr; }
  .special-order-summary-numbers { grid-template-columns:1fr; }
  .special-order-summary-numbers > span { display:flex; align-items:center; justify-content:space-between; }
}

/* ERP 4.4.13 — grille compacte inspirée du suivi Excel historique. */
.special-orders-list { gap:6px; }
.special-orders-grid-head,
.special-order-dossier-head {
  display:grid;
  grid-template-columns:90px 125px minmax(190px,1fr) minmax(210px,1.15fr) 90px 105px 105px minmax(260px,1.55fr);
}
.special-orders-grid-head {
  align-items:center;
  min-width:0;
  margin-bottom:5px;
  padding:0 3px;
  border-radius:9px 9px 3px 3px;
  background:#0d6ead;
  color:#fff;
  box-shadow:0 3px 9px rgba(13,47,104,.12);
}
.special-orders-grid-head span {
  min-width:0;
  padding:10px 9px;
  border-left:1px solid rgba(255,255,255,.18);
  font-size:12px;
  font-weight:900;
  letter-spacing:.025em;
  text-transform:uppercase;
}
.special-orders-grid-head span:first-child { border-left:0; }
.special-order-dossier {
  border-top-width:1px;
  border-left-width:4px;
  border-radius:6px;
  box-shadow:0 2px 7px rgba(13,47,104,.045);
}
.special-order-dossier-head { align-items:stretch; min-height:66px; padding:0; }
.special-order-dossier-head > div { min-width:0; padding:8px 9px; border-left:1px solid #e0e7ed; }
.special-order-dossier-head > div:first-child { border-left:0; }
.special-order-grid-cell { display:flex; flex-direction:column; justify-content:center; gap:3px; }
.special-order-grid-cell strong { overflow:hidden; color:#173a5d; font-size:13px; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
.special-order-grid-cell small { overflow:hidden; color:#65788c; font-size:11px; line-height:1.25; text-overflow:ellipsis; white-space:nowrap; }
.special-order-dossier-head .special-order-quote-cell a { margin:0; color:#d01919; font-size:15px; font-weight:900; }
.special-order-amount-cell strong,
.special-order-deposit-cell small,
.special-order-balance-cell strong { color:#101820; font-weight:900; }
.special-order-customer-cell strong,
.special-order-material-cell strong { font-size:13px; }
.special-order-customer-cell small { color:#385c78; }
.special-order-date-cell,
.special-order-deposit-cell,
.special-order-balance-cell { text-align:center; }
.special-order-latest-note { gap:2px; background:transparent; }
.special-order-latest-note p {
  display:-webkit-box;
  margin:0;
  overflow:hidden;
  color:#283f55;
  font-size:12px;
  line-height:1.3;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
}
.special-order-latest-note.is-empty { background:transparent; }
.special-order-latest-note.is-empty p { color:#8a6419; }
.special-order-dossier-summary { position:relative; display:flex; align-items:stretch; justify-content:center; gap:4px; }
.special-order-follow-up-badge { display:grid; min-height:0; padding:6px 8px; gap:1px; }
.special-order-follow-up-badge b { font-size:12px; }
.special-order-follow-up-badge small { font-size:10px; }
.special-order-dossier-summary > i { display:none; }
.special-order-dossier.follow-up-overdue > summary { background:#fff0ed !important; }
.special-order-dossier.follow-up-today > summary { background:#fff7df !important; }
.special-order-dossier.follow-up-confirmed > summary { background:#ecf9ef !important; }
.special-order-dossier.follow-up-waiting > summary { background:#fffaf0 !important; }

.special-order-follow-up-panel { padding:11px 14px; }
.special-order-follow-up-panel h3 { font-size:16px; }
.special-order-follow-up-panel p { margin-bottom:7px; font-size:13px; }
.special-order-timeline { padding:10px 14px; }
.special-order-control-grid { padding:10px 14px; }
.special-order-products-disclosure {
  margin:10px 14px;
  overflow:hidden;
  border:1px solid #dbe5ec;
  border-radius:9px;
  background:#fff;
}
.special-order-products-disclosure > summary {
  display:grid;
  grid-template-columns:140px minmax(180px,1fr) auto;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  cursor:pointer;
  list-style:none;
  background:#f3f7fa;
}
.special-order-products-disclosure > summary::-webkit-details-marker { display:none; }
.special-order-products-disclosure > summary span { color:#65778a; font-size:11px; font-weight:900; letter-spacing:.05em; }
.special-order-products-disclosure > summary strong { overflow:hidden; color:var(--navy); font-size:15px; text-overflow:ellipsis; white-space:nowrap; }
.special-order-products-disclosure > summary small { color:#6a7c8e; font-size:12px; }
.special-order-products-disclosure[open] > summary { border-bottom:1px solid #dbe5ec; }
.special-order-products-disclosure .special-order-products { margin:0; border:0; border-radius:0; }
.special-order-notes { margin:10px 14px 14px; }
.special-order-note-timeline header > span { display:flex; align-items:center; gap:7px; }
.special-order-note-timeline header form { margin:0; }
.special-order-note-timeline header .icon-btn { width:25px; height:25px; min-height:25px; padding:0; }

@media (max-width:1450px) {
  .special-orders-grid-head { display:flex; flex-wrap:wrap; }
  .special-order-dossier-head {
    grid-template-columns:90px 125px minmax(200px,1fr) minmax(220px,1.15fr) 95px 110px 110px;
  }
  .special-order-latest-note { grid-column:1 / -1; border-top:1px solid #e0e7ed; border-left:0 !important; }
}
@media (max-width:980px) {
  .special-order-dossier-head { grid-template-columns:110px 130px minmax(190px,1fr); }
  .special-order-material-cell { grid-column:1 / 3; border-top:1px solid #e0e7ed; border-left:0 !important; }
  .special-order-date-cell { border-top:1px solid #e0e7ed; }
  .special-order-deposit-cell,
  .special-order-balance-cell { border-top:1px solid #e0e7ed; }
  .special-order-latest-note { grid-column:1 / -1; border-left:0 !important; }
}
@media (max-width:760px) {
  .special-order-dossier-head { grid-template-columns:1fr 1fr; }
  .special-order-dossier-head > div { padding:9px 10px; }
  .special-order-customer-cell,
  .special-order-material-cell,
  .special-order-latest-note,
  .special-order-dossier-summary { grid-column:1 / -1; border-top:1px solid #e0e7ed; border-left:0 !important; }
  .special-order-date-cell { grid-column:1; }
  .special-order-deposit-cell { grid-column:2; }
  .special-order-balance-cell { grid-column:1 / -1; }
  .special-order-products-disclosure > summary { grid-template-columns:1fr; gap:3px; }
}

/* ERP 4.4.14 — finitions JTLM et informations toujours lisibles en entier. */
.special-orders-grid-head {
  border-bottom:4px solid var(--green);
  background:var(--navy);
  box-shadow:0 4px 12px rgba(13,47,104,.16);
}
.special-order-dossier-head .special-order-quote-cell a { color:var(--navy); }
.special-order-dossier-head .special-order-quote-cell a:hover { color:#2f9141; }
.special-order-grid-cell strong,
.special-order-grid-cell small {
  overflow:visible;
  text-overflow:clip;
  white-space:normal;
  overflow-wrap:anywhere;
}
.special-order-amount-cell strong,
.special-order-amount-cell small,
.special-order-date-cell strong,
.special-order-deposit-cell strong,
.special-order-deposit-cell small,
.special-order-balance-cell strong { white-space:nowrap; }
.special-order-customer-cell { gap:2px; }
.special-order-customer-cell small { line-height:1.2; }
.special-order-latest-note p {
  display:block;
  overflow:visible;
  -webkit-line-clamp:unset;
}
.special-order-products-disclosure > summary strong {
  overflow:visible;
  text-overflow:clip;
  white-space:normal;
  overflow-wrap:anywhere;
}
.special-order-control-grid {
  grid-template-columns:190px minmax(410px,1fr) 180px;
  align-items:stretch;
}

@media (max-width:1380px) {
  .special-order-control-grid { grid-template-columns:minmax(160px,.7fr) minmax(330px,1.3fr); }
  .special-order-status-panel { grid-column:1 / -1; }
}
@media (max-width:760px) {
  .special-order-control-grid { grid-template-columns:1fr; }
  .special-order-deposit-panel,
  .special-order-status-panel { grid-column:1; }
}

/* ERP 4.4.15 — titres de colonnes cliquables et grille sans rupture. */
.special-orders-grid-head {
  margin-bottom:0;
  border-radius:9px 9px 0 0;
}
.special-orders-grid-head button {
  min-width:0;
  min-height:42px;
  padding:9px;
  border:0;
  border-left:1px solid rgba(255,255,255,.18);
  background:transparent;
  color:#fff;
  font:inherit;
  font-size:12px;
  font-weight:900;
  letter-spacing:.025em;
  text-align:left;
  text-transform:uppercase;
  cursor:pointer;
}
.special-orders-grid-head button:first-child { border-left:0; }
.special-orders-grid-head button:hover,
.special-orders-grid-head button.active { background:rgba(79,181,85,.24); color:#fff; }
.special-orders-grid-head button.active { box-shadow:inset 0 -4px 0 var(--green); }
.special-order-dossier { margin-bottom:0; }
.special-orders-list > .special-order-dossier:first-child { border-radius:0 0 6px 6px; }
.special-order-quote-cell,
.special-order-quote-cell a { white-space:nowrap !important; overflow-wrap:normal !important; }

@media (max-width:1450px) {
  .special-orders-grid-head button { flex:1 1 120px; border-bottom:1px solid rgba(255,255,255,.14); }
}

.discount-matrix { min-width:0; }
.discount-matrix-toolbar,
.discount-matrix-footer {
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  align-items:end;
  gap:12px;
}
.discount-matrix-toolbar { padding:12px 16px; margin-bottom:12px; }
.discount-matrix-filters,
.discount-matrix-tools,
.discount-matrix-pagination { display:flex; align-items:end; flex-wrap:wrap; gap:8px; }
.discount-matrix-filters form > label,
.discount-matrix-family-field { display:grid; gap:5px; font-size:12px; }
.discount-matrix-filters input[type="search"] { min-height:36px; font-size:13px; }
.discount-matrix-family-field { min-width:185px; max-width:240px; }
.discount-matrix-family-filter summary { min-height:36px; padding:8px 25px 8px 10px; font-size:13px; }
.discount-matrix-family-filter > div { grid-template-columns:minmax(0, 1fr); }
.discount-matrix-family-filter label { min-height:36px; font-size:13px; white-space:normal; overflow-wrap:anywhere; }
.discount-matrix-family-filter label input { flex:none; }
.discount-matrix-card.card { min-width:0; padding:0; }
.discount-matrix-table-wrap.table-wrap { max-height:min(66vh, 760px); overflow:auto; border-radius:inherit; }
.discount-matrix-table { width:100%; border-collapse:separate; border-spacing:0; }
.discount-matrix-table th,
.discount-matrix-table td { padding:8px 10px; }
.discount-matrix-table th {
  position:sticky;
  inset-block-start:0;
  z-index:1;
  background:#f1f5fa;
  color:var(--navy);
  font-size:11px;
  text-transform:none;
}
.discount-matrix-table th a { color:inherit; display:block; padding:4px 0; }
.discount-matrix-table th a:hover,
.discount-matrix-table th a:focus-visible { text-decoration:underline; }
.discount-matrix-table th a span { color:var(--muted); }
.discount-matrix-table th[aria-sort] { box-shadow:inset 0 -2px 0 var(--green); }
.discount-matrix-table tbody tr:nth-child(even) { background:#f8fafc; }
.discount-matrix-table tbody tr:hover,
.discount-matrix-table tbody tr:focus-within { background:#edf6f0; }
.discount-matrix-table .discount-matrix-check { width:35px; padding-inline:8px; text-align:center; }
.discount-matrix-check input { margin:0; }
.discount-matrix-table .discount-matrix-photo { width:72px; min-width:72px; text-align:center; }
.discount-matrix-photo img,
.discount-matrix-photo span {
  display:grid;
  place-items:center;
  width:52px;
  height:44px;
  border:1px solid var(--line);
  border-radius:6px;
  object-fit:contain;
  background:var(--white);
  color:var(--muted);
}
.discount-matrix-photo-zoom {
  display:inline-block;
  padding:0;
  border:0;
  border-radius:6px;
  background:transparent;
  cursor:zoom-in;
}
.discount-matrix-photo-zoom:hover,
.discount-matrix-photo-zoom:focus-visible { outline:2px solid var(--navy); outline-offset:2px; }
.discount-matrix-code { min-width:76px; }
.discount-matrix-code a { color:var(--navy); font-weight:750; }
.discount-matrix-designation { min-width:180px; overflow-wrap:anywhere; }
.discount-matrix-designation strong { font-size:13px; line-height:1.3; }
.discount-matrix-designation small { display:block; margin-top:3px; color:var(--muted); }
.discount-matrix-mode { min-width:116px; max-width:180px; color:#475569; font-size:12px; overflow-wrap:anywhere; }
.discount-matrix-table .discount-matrix-rate { width:116px; min-width:116px; border-inline-start:1px solid var(--line); text-align:center; }
.discount-matrix-rate .percent-cell { max-width:94px; margin-inline:auto; }
.discount-matrix-rate .percent-cell input { font-size:13px; min-height:33px; padding:5px 23px 5px 6px; }
.discount-matrix-rate [data-discount-margin-euros] { display:block; margin-top:2px; font-size:13px; white-space:nowrap; }
.discount-matrix-rate .discount-margin-preview,
.discount-matrix-rate [data-discount-margin-euros] { font-variant-numeric:tabular-nums; }
.discount-matrix-footer { align-items:center; padding:10px 14px; border-top:1px solid var(--line); }
.discount-matrix-pagination { align-items:center; color:var(--muted); font-size:12px; white-space:nowrap; }
.discount-category-dialog .discount-categories-edit { display:grid; }
.discount-category-dialog .discount-category-row input:not([type="hidden"]) { min-width:0; width:100%; }
.discount-category-dialog .discount-category-row.new { grid-template-columns:minmax(0, 1fr) auto; }

@media (max-width:640px) {
  .discount-matrix-toolbar,
  .discount-matrix-footer { padding:10px; }
  .discount-matrix-toolbar > *,
  .discount-matrix-filters > form,
  .discount-matrix-family-field { flex:1 1 100%; min-width:0; max-width:100%; }
  .discount-matrix-filters input[type="search"],
  .discount-matrix-family-filter > div { width:100%; }
  .discount-matrix-family-filter > div { min-width:0; max-width:none; max-height:45vh; }
}
