/*
 * mini-ERP V5.1.16 — couche de finition générale
 *
 * Chargée en dernier par PageAssets. Elle harmonise l'espacement, la
 * typographie et les alignements sans embarquer de règle métier.
 */

:root{
  --erp-font-sans:Inter,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --erp-space-1:4px;
  --erp-space-2:8px;
  --erp-space-3:12px;
  --erp-space-4:16px;
  --erp-space-5:20px;
  --erp-space-6:24px;
  --erp-control-height:42px;
  --erp-control-height-compact:34px;
  --erp-content-max:1920px;
  --erp-reading-width:980px;
  --erp-heading:#14213d;
  --erp-focus:0 0 0 3px rgba(31,95,214,.18);
}

body.erp-app{
  font-family:var(--erp-font-sans);
  font-size:14px;
  line-height:1.48;
  letter-spacing:.002em;
}

body.erp-app .content{
  width:100%;
  max-width:var(--erp-content-max);
  margin-inline:auto;
  padding:clamp(12px,1.7vw,24px);
}

body.erp-app h1,
body.erp-app h2,
body.erp-app h3,
body.erp-app h4{
  color:var(--erp-heading);
  line-height:1.2;
  text-wrap:balance;
}

body.erp-app h1{
  margin:0;
  font-size:clamp(22px,1.6vw,30px);
  letter-spacing:-.025em;
}

body.erp-app h2{
  margin:0 0 var(--erp-space-3);
  font-size:clamp(17px,1.15vw,21px);
  letter-spacing:-.015em;
}

body.erp-app h3{
  margin:0 0 var(--erp-space-2);
  font-size:15px;
}

body.erp-app p{
  max-width:78ch;
}

body.erp-app .page-header,
body.erp-app .section-header,
body.erp-app .toolbar-row:first-child{
  align-items:flex-start;
}

body.erp-app .page-header,
body.erp-app .section-header{
  display:flex;
  justify-content:space-between;
  gap:var(--erp-space-4);
  flex-wrap:wrap;
  margin-bottom:var(--erp-space-4);
}

body.erp-app .page-header > div:first-child,
body.erp-app .section-header > div:first-child{
  min-width:0;
}

body.erp-app .page-header .help-text,
body.erp-app .section-header .help-text,
body.erp-app h1 + .help-text,
body.erp-app h2 + .help-text{
  margin-top:5px;
}

body.erp-app .help-text,
body.erp-app .muted{
  color:#65748b;
  font-size:12.5px;
  line-height:1.45;
}

body.erp-app .box,
body.erp-app .card,
body.erp-app .shopbar{
  border-color:#dce4ef;
  border-radius:14px;
  box-shadow:0 7px 22px rgba(23,32,51,.065);
}

body.erp-app .box,
body.erp-app .card{
  padding:clamp(12px,1.25vw,18px);
}

body.erp-app .box + .box,
body.erp-app .card + .box,
body.erp-app .box + .card{
  margin-top:var(--erp-space-4);
}

body.erp-app .toolbar-row{
  gap:var(--erp-space-2) var(--erp-space-3);
}

body.erp-app .toolbar-row > .button,
body.erp-app .toolbar-row > button,
body.erp-app .toolbar-actions > .button,
body.erp-app .toolbar-actions > button{
  flex:0 0 auto;
}

body.erp-app .toolbar-actions,
body.erp-app .modal-actions,
body.erp-app .sticky-form-actions,
body.erp-app .sticky-actions{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  flex-wrap:wrap;
  gap:var(--erp-space-2);
}

body.erp-app .sticky-actions,
body.erp-app .sticky-form-actions{
  padding:10px 12px;
  border-radius:14px;
  backdrop-filter:blur(12px);
}

/* Formulaires ----------------------------------------------------------- */
body.erp-app form{
  min-width:0;
}

body.erp-app label{
  margin:0 0 5px;
  color:#26354d;
  font-size:12.5px;
  font-weight:750;
  line-height:1.3;
}

body.erp-app :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){
  min-height:var(--erp-control-height);
  padding:8px 11px;
  border-color:#cbd6e5;
  border-radius:9px;
  color:#172033;
  font-size:14px;
  line-height:1.35;
  box-shadow:inset 0 1px 1px rgba(23,32,51,.025);
}

body.erp-app textarea{
  min-height:92px;
  resize:vertical;
}

body.erp-app :is(input,select,textarea):hover:not(:disabled){
  border-color:#aebdd1;
}

body.erp-app :is(input,select,textarea):focus{
  box-shadow:var(--erp-focus);
}

body.erp-app :is(input,select,textarea):disabled,
body.erp-app :is(input,select,textarea)[readonly]{
  color:#59677b;
  background:#f2f5f8;
  cursor:not-allowed;
}

body.erp-app input::placeholder,
body.erp-app textarea::placeholder{
  color:#8995a8;
  opacity:1;
}

body.erp-app input[type="checkbox"],
body.erp-app input[type="radio"]{
  width:18px;
  height:18px;
  min-height:0;
  margin:0;
  accent-color:var(--erp-primary,#1f5fd6);
}

body.erp-app .field,
body.erp-app .form-field,
body.erp-app .grid2 > div,
body.erp-app .grid-2 > div,
body.erp-app .grid-3 > div{
  min-width:0;
}

body.erp-app .field > :is(input,select,textarea),
body.erp-app .form-field > :is(input,select,textarea){
  width:100%;
}

body.erp-app .grid2,
body.erp-app .grid-2,
body.erp-app .grid-3{
  gap:var(--erp-space-3) var(--erp-space-4);
}

body.erp-app fieldset{
  min-width:0;
  margin:0;
  padding:var(--erp-space-4);
  border:1px solid #dce4ef;
  border-radius:12px;
}

body.erp-app legend{
  padding-inline:6px;
  color:#2e405d;
  font-size:13px;
  font-weight:800;
}

body.erp-app .checkbox-row{
  min-height:32px;
  margin:0;
}

body.erp-app .checkbox-row label,
body.erp-app label.checkbox-row{
  margin:0;
}

/* Boutons --------------------------------------------------------------- */
body.erp-app :is(.button,button,.btn,.btn-primary,.btn-danger){
  min-height:var(--erp-control-height);
  margin:0;
  padding:8px 13px;
  border-radius:9px;
  font-size:12.5px;
  font-weight:780;
  line-height:1.15;
  letter-spacing:.005em;
  box-shadow:0 5px 14px rgba(31,95,214,.14);
  transition:transform .13s ease,box-shadow .13s ease,filter .13s ease,background-color .13s ease;
}

body.erp-app :is(.button,button,.btn,.btn-primary,.btn-danger):hover:not(:disabled){
  transform:translateY(-1px);
}

body.erp-app :is(.button,button,.btn,.btn-primary,.btn-danger):active:not(:disabled){
  transform:translateY(0);
  box-shadow:none;
}

body.erp-app :is(.button,button,.btn,.btn-primary,.btn-danger):disabled{
  opacity:.55;
  cursor:not-allowed;
  box-shadow:none;
}

body.erp-app .button-light{
  border-color:#c9d5e5 !important;
  background:#f5f8fc !important;
  color:#25436c !important;
}

body.erp-app .button-danger,
body.erp-app .btn-danger{
  box-shadow:0 5px 14px rgba(197,48,48,.13);
}

body.erp-app .btn-sm,
body.erp-app .button-small,
body.erp-app .button-icon,
body.erp-app .table-actions :is(.button,button){
  min-height:var(--erp-control-height-compact) !important;
  padding:6px 9px !important;
  font-size:11.5px !important;
}

body.erp-app .button-icon{
  min-width:var(--erp-control-height-compact);
}

/* Tableaux et listes ---------------------------------------------------- */
body.erp-app :is(.table-scroll,.erp-table-scroll,.table-responsive,.table-wrap){
  width:100%;
  max-width:100%;
  overflow:auto;
  border:1px solid #dce4ef;
  border-radius:12px;
  background:#fff;
  scrollbar-gutter:stable;
}

body.erp-app :is(.table-scroll,.erp-table-scroll,.table-responsive,.table-wrap) table{
  border:0;
  border-radius:0;
  box-shadow:none;
}

body.erp-app table{
  border:1px solid #dce4ef;
  border-radius:12px;
  box-shadow:none;
}

body.erp-app thead th{
  height:36px;
  padding:7px 9px;
  border-bottom:1px solid #ced9e8;
  background:#eef3f9;
  color:#33445f;
  font-size:10.5px;
  font-weight:850;
  letter-spacing:.035em;
  vertical-align:middle;
}

body.erp-app tbody td{
  padding:8px 9px;
  border-bottom-color:#e8edf4;
  vertical-align:middle;
}

body.erp-app tbody tr:last-child td{
  border-bottom:0;
}

body.erp-app tbody tr:nth-child(even) td{
  background:#fbfcfe;
}

body.erp-app tbody tr:hover td{
  background:#f3f7fd;
}

body.erp-app td :is(.button,button) + :is(.button,button),
body.erp-app td form + form{
  margin-left:0;
}

body.erp-app .table-actions{
  align-items:center;
  gap:5px;
}

body.erp-app .table-empty,
body.erp-app .empty-state{
  padding:28px 16px;
  color:#65748b;
  text-align:center;
}

body.erp-app .entity-link{
  color:#174fae;
  text-decoration-thickness:1px;
  text-underline-offset:2px;
}

body.erp-app .entity-link:hover{
  color:#103a80;
}

/* Panneaux repliables --------------------------------------------------- */
body.erp-app details{
  min-width:0;
}

body.erp-app details > summary{
  border-radius:9px;
}

body.erp-app details > summary::marker{
  color:#56708f;
}

body.erp-app details[open] > summary{
  margin-bottom:var(--erp-space-3);
}

body.erp-app .product-panel > summary,
body.erp-app .settings-section > summary,
body.erp-app .audit-section > summary{
  min-height:44px;
  padding:9px 12px;
  align-items:center;
}

/* Alertes, badges et textes d'état ------------------------------------- */
body.erp-app .alert{
  padding:10px 12px;
  border-radius:10px;
  font-size:13px;
  line-height:1.45;
}

body.erp-app :is(.badge,.inline-chip,.status-chip,.kpi-chip){
  min-height:24px;
  padding:4px 8px;
  border-radius:999px;
  line-height:1.15;
  white-space:nowrap;
}

body.erp-app .field-static{
  min-height:var(--erp-control-height);
  padding:9px 11px;
  border-color:#d4deea;
  border-radius:9px;
}

/* Fenêtres et superpositions ------------------------------------------- */
body.erp-app :is(.modal-panel,.popup-panel,.document-modal-panel){
  border-radius:16px;
  box-shadow:0 24px 70px rgba(13,25,48,.25);
}

body.erp-app :is(.modal-header,.popup-header,.document-modal-header){
  gap:var(--erp-space-3);
}

body.erp-app .modal-close{
  min-width:38px;
  width:38px;
  height:38px;
  min-height:38px;
  padding:0;
  border-radius:10px;
  box-shadow:none;
}

/* Topbar et navigation -------------------------------------------------- */
body.erp-app .topbar a{
  margin-left:0;
}

body.erp-app .topbar-nav-panel,
body.erp-app .topbar-quick-results{
  border:1px solid #d7e0ec;
  box-shadow:0 18px 45px rgba(12,26,52,.18);
}

body.erp-app .sidebar a{
  margin:3px 9px;
  padding:10px 12px;
  border-radius:10px;
  font-size:13px;
}

body.erp-app .sidebar-section{
  margin:16px 16px 5px;
}

/* Écrans denses : garder la lecture sans rallonger inutilement ---------- */
body.erp-page-product-edit .product-editor-layout,
body.erp-page-documents .document-workspace,
body.erp-page-customers .customer-workspace{
  align-items:start;
}

body.erp-page-product-edit .product-panel,
body.erp-page-documents .document-section{
  scroll-margin-top:92px;
}

/* Utilitaires de présentation pour remplacer les styles inline ---------- */
body.erp-app .u-hidden{display:none !important}
body.erp-app .u-w-full{width:100% !important}
body.erp-app .u-m-0{margin:0 !important}
body.erp-app .u-mt-1{margin-top:var(--erp-space-1) !important}
body.erp-app .u-mt-2{margin-top:var(--erp-space-2) !important}
body.erp-app .u-mt-3{margin-top:var(--erp-space-3) !important}
body.erp-app .u-mt-4{margin-top:var(--erp-space-4) !important}
body.erp-app .u-mb-0{margin-bottom:0 !important}
body.erp-app .u-mb-2{margin-bottom:var(--erp-space-2) !important}
body.erp-app .u-mb-3{margin-bottom:var(--erp-space-3) !important}
body.erp-app .u-mb-4{margin-bottom:var(--erp-space-4) !important}
body.erp-app .u-inline-grid{display:inline-grid !important;gap:6px}
body.erp-app .u-grid-label{display:grid !important;gap:6px}
body.erp-app .u-align-end{align-items:flex-end !important}
body.erp-app .u-justify-between{justify-content:space-between !important}

@media (max-width:1100px){
  body.erp-app .content{
    padding:12px;
  }

  body.erp-app .grid-3{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  body.erp-app :is(.button,button,.btn,.btn-primary,.btn-danger){
    min-height:40px;
  }
}

@media (max-width:720px){
  body.erp-app{
    font-size:14px;
  }

  body.erp-app .content{
    padding:9px;
  }

  body.erp-app .box,
  body.erp-app .card{
    padding:11px;
    border-radius:12px;
  }

  body.erp-app .grid2,
  body.erp-app .grid-2,
  body.erp-app .grid-3{
    grid-template-columns:1fr;
    gap:10px;
  }

  body.erp-app .span-2,
  body.erp-app .full{
    grid-column:1;
  }

  body.erp-app .toolbar-actions,
  body.erp-app .modal-actions,
  body.erp-app .sticky-form-actions,
  body.erp-app .sticky-actions{
    align-items:stretch;
  }

  body.erp-app .toolbar-actions > :is(.button,button),
  body.erp-app .modal-actions > :is(.button,button),
  body.erp-app .sticky-form-actions > :is(.button,button),
  body.erp-app .sticky-actions > :is(.button,button){
    flex:1 1 145px;
  }

  body.erp-app thead th,
  body.erp-app tbody td{
    padding-inline:7px;
  }
}

/* Exceptions de composants volontairement neutres ---------------------- */
body.erp-page-customer-merge .customer-merge-result,
body.erp-page-customer-merge .customer-merge-result:hover,
body.erp-page-customer-merge .customer-merge-result:active{
  transform:none;
  box-shadow:none;
}

/* ========================================================================== */
/* V5.1.18 — nettoyage global des espaces de travail                         */
/* ========================================================================== */

body.erp-app .page-title-compact{
  min-height:0;
  margin:0 0 10px;
  padding:0;
  gap:10px;
  align-items:center;
}
body.erp-app .page-title-compact h1{font-size:clamp(1.35rem,2vw,1.75rem);margin:0}
body.erp-app .page-title-compact .help-text{margin:2px 0 0;max-width:820px}

/* Le choix de boutique reste disponible, mais ne mange plus le haut de page. */
body.erp-app details.shopbar-compact{
  display:block;
  margin:0 0 10px;
  padding:0;
  border-radius:12px;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(216,225,239,.9);
  box-shadow:0 5px 16px rgba(15,35,66,.06);
}
body.erp-app .shopbar-compact > summary{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-height:36px;
  padding:7px 11px;
  cursor:pointer;
  list-style:none;
  color:var(--text);
}
body.erp-app .shopbar-compact > summary::-webkit-details-marker{display:none}
body.erp-app .shopbar-compact > summary small{color:var(--primary);font-weight:800}
body.erp-app .shopbar-compact-panel{
  display:grid;
  gap:8px;
  padding:10px 11px 11px;
  border-top:1px solid var(--line);
}
body.erp-app .shopbar-compact .shop-pills{gap:6px}
body.erp-app .shopbar-compact .shop-pill{min-height:32px;padding:6px 10px;font-size:12px}
body.erp-app .shopbar-compact .shopbar-note{margin:0;font-size:11px}

/* Menus d'actions réutilisables dans les listes et les en-têtes. */
body.erp-app .compact-actions-menu{position:relative;display:inline-block;text-align:left}
body.erp-app .compact-actions-menu > summary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:7px 12px;
  border:1px solid #cbd8ea;
  border-radius:10px;
  background:#fff;
  color:#24405f;
  font-weight:800;
  cursor:pointer;
  list-style:none;
  white-space:nowrap;
  box-shadow:none;
}
body.erp-app .compact-actions-menu > summary::-webkit-details-marker{display:none}
body.erp-app .compact-actions-menu > summary::after{content:'⌄';margin-left:7px;font-size:11px}
body.erp-app .compact-actions-menu[open] > summary::after{content:'⌃'}
body.erp-app .compact-actions-menu[open]{z-index:700}
body.erp-app .compact-actions-dropdown{
  position:absolute;
  z-index:710;
  right:0;
  top:calc(100% + 6px);
  display:grid;
  width:max-content;
  min-width:220px;
  max-width:min(320px,calc(100vw - 24px));
  padding:6px;
  border:1px solid #d4deeb;
  border-radius:12px;
  background:#fff;
  box-shadow:0 18px 46px rgba(15,35,66,.22);
}
body.erp-app .compact-actions-dropdown :is(a,button){
  display:flex;
  width:100%;
  min-height:34px;
  align-items:center;
  justify-content:flex-start;
  margin:0;
  padding:8px 10px;
  border:0;
  border-radius:8px;
  background:transparent;
  color:#203c5b;
  box-shadow:none;
  text-decoration:none;
  font:inherit;
  font-weight:700;
  text-align:left;
  cursor:pointer;
}
body.erp-app .compact-actions-dropdown :is(a,button):hover{background:#edf4ff;color:#123f83;transform:none}
body.erp-app .compact-actions-dropdown form{display:block;margin:0}
body.erp-app .compact-actions-dropdown .is-danger{color:#b42318}
body.erp-app .compact-actions-dropdown .is-danger:hover{background:#fff0ef;color:#941b12}
body.erp-app .compact-actions-menu--page .compact-actions-dropdown{min-width:245px}
body.erp-app .table-scroll:has(.compact-actions-menu[open]),
body.erp-app .responsive-table-wrap:has(.compact-actions-menu[open]){overflow:visible;position:relative;z-index:300}
body.erp-app table:has(.compact-actions-menu[open]){position:relative;z-index:301}

body.erp-app .compact-kpi-strip{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:6px;
  margin:8px 0 10px;
}
body.erp-app .compact-kpi-strip .kpi-chip{
  display:inline-flex;
  align-items:center;
  gap:5px;
  min-height:30px;
  padding:5px 9px;
  border:1px solid #d7e1ee;
  border-radius:999px;
  background:#f7faff;
  color:#52657b;
  font-size:12px;
  white-space:nowrap;
}
body.erp-app .compact-kpi-strip .kpi-chip strong{color:#17395f;font-size:13px}
body.erp-app .compact-kpi-strip .kpi-chip--strong{background:#eaf3ff;border-color:#bdd5f2;color:#174e8c}
body.erp-app .compact-kpi-strip .kpi-chip--warning{background:#fff4df;border-color:#f2cf8c;color:#805211}

/* Clients : la liste devient l'élément principal. */
body.erp-page-customers .customer-sync-note{margin:0 0 8px}
body.erp-page-customers .customer-list-table .col-customer-actions{width:1%;white-space:nowrap}
body.erp-page-customers .customer-list-table-dense td{padding-top:7px;padding-bottom:7px}

/* Parc : le gros formulaire est replié tant qu'il n'est pas demandé. */
body.erp-page-assets .park-detail-section.box{margin:10px 0 12px;padding:0;border:1px solid var(--line);border-radius:14px;background:#fbfdff}
body.erp-page-assets .park-detail-section.box > .box-head{margin:0;padding:10px 12px}
body.erp-page-assets .park-detail-section .box-collapsible__body{padding:0 12px 12px}
body.erp-page-assets .park-detail-section .park-asset-form{margin-top:0}

/* Agenda : sans création/modification, la semaine utilise toute la largeur. */
body.erp-page-schedule .schedule-layout--full{grid-template-columns:minmax(0,1fr)}
body.erp-page-schedule .schedule-toolbar-actions{display:flex;align-items:flex-start;justify-content:flex-end;gap:10px;flex-wrap:wrap}
body.erp-page-schedule .schedule-toolbar-actions .compact-kpi-strip{margin:0}
body.erp-page-schedule .schedule-week-nav{gap:5px}
body.erp-page-schedule .schedule-week-nav .button:first-child,
body.erp-page-schedule .schedule-week-nav .button:last-child{min-width:42px;padding-inline:10px}

/* Fournisseurs et compta : indicateurs sur une ligne plutôt que grosses tuiles. */
body.erp-page-suppliers .supplier-compact-summary,
body.erp-page-suppliers .supplier-treasury-strip,
body.erp-page-accounting .accounting-kpi-strip{margin:0 0 10px}
body.erp-page-suppliers .supplier-module-status{display:none}

body.erp-app .compact-info-panel{padding:0;overflow:visible}
body.erp-app .compact-info-panel > summary{padding:12px 14px;cursor:pointer;font-weight:850;list-style:none}
body.erp-app .compact-info-panel > summary::-webkit-details-marker{display:none}
body.erp-app .compact-info-panel > summary::after{content:'⌄';float:right}
body.erp-app .compact-info-panel[open] > summary::after{content:'⌃'}
body.erp-app .compact-info-panel > :not(summary){margin-left:14px;margin-right:14px}
body.erp-app .compact-info-panel > :last-child{margin-bottom:14px}

@media(max-width:820px){
  body.erp-app .page-title-compact{align-items:flex-start}
  body.erp-app .compact-actions-menu--page .compact-actions-dropdown{position:fixed;top:auto;right:10px;left:10px;bottom:12px;max-width:none;width:auto;z-index:1600}
  body.erp-app .compact-actions-menu--row .compact-actions-dropdown{right:0;min-width:210px}
  body.erp-page-schedule .schedule-toolbar-actions{width:100%;justify-content:flex-start}
  body.erp-page-schedule .schedule-week-nav{width:100%;display:grid;grid-template-columns:auto 1fr auto}
  body.erp-page-schedule .schedule-week-nav .button{width:100%}
}
