@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Barlow:wght@500;600;700&display=swap');

:root{
  /* Layout */
  --gda-sidebar-w: 280px;
  --gda-topbar-h: 64px;
  --gda-gap: 16px;

  /* Typography */
  --font-title: 'Barlow', 'Inter', Arial, sans-serif;
  --font-body: 'Inter', Arial, sans-serif;

  /* Brand and neutral palette */
  --color-bg: #f4f5f8;
  --color-panel: #ffffff;
  --color-panel-2: #f8f9fb;
  --color-panel-3: #eef0f4;

  --color-text: #25272d;
  --color-text-muted: #6f7581;
  --color-text-soft: #9298a3;

  --color-border: #e1e4e9;
  --color-border-strong: #d2d6dd;

  --color-primary: #7b82f6;
  --color-primary-2: #646ce2;
  --color-primary-rgb: 123,130,246;

  --color-success: #198754;
  --color-success-rgb: 25,135,84;

  --color-danger: #dc3545;
  --color-danger-rgb: 220,53,69;

  --color-warning: #d97706;
  --color-warning-rgb: 217,119,6;

  --color-info: #4f77c8;
  --color-info-rgb: 79,119,200;

  /* Surfaces */
  --surface-overlay: rgba(24,25,29,.42);
  --surface-modal: #ffffff;
  --surface-input: #ffffff;
  --surface-hover: #f1f2f6;
  --surface-soft: #f8f9fb;

  /* Radius */
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --gda-radius: 10px;
  --gda-border: 1px solid var(--color-border);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;

  /* Shadows */
  --shadow-panel: 0 4px 16px rgba(24,27,35,.07);
  --shadow-panel-strong: 0 14px 38px rgba(24,27,35,.14);
  --shadow-glow: 0 0 0 3px rgba(var(--color-primary-rgb),.10);
  --shadow-glow-strong: 0 0 0 4px rgba(var(--color-primary-rgb),.14);
  --gda-shadow: var(--shadow-panel);

  /* Components */
  --btn-height: 42px;
  --btn-height-sm: 34px;
  --btn-height-lg: 48px;
  --input-height: 44px;
  --table-cell-py: 14px;
  --table-cell-px: 16px;

  /* Transitions */
  --transition-fast: .16s ease;
  --transition-base: .20s ease;
  --transition-slow: .28s ease;

  /* Stacking */
  --z-topbar: 900;
  --z-sidebar: 1100;
  --z-modal: 2000;
  --z-overlay: 3998;
  --z-offcanvas: 3999;
  --z-toast: 5000;
}

*,
*::before,
*::after{
  box-sizing:border-box;
}

html{
  font-size:16px;
}

body{
  margin:0;
  min-width:320px;
  min-height:100vh;
  font-family:var(--font-body);
  line-height:1.45;
  background:var(--color-bg);
  color:var(--color-text);
}

img{
  max-width:100%;
  height:auto;
  display:block;
}

a{
  text-decoration:none;
  color:inherit;
}

button,
input,
select,
textarea{
  font:inherit;
}

button{
  cursor:pointer;
}

ul,
ol{
  margin:0;
  padding:0;
}

table{
  border-collapse:collapse;
  width:100%;
}

/* =========================
   LAYOUT
========================= */
.app-shell{
  display:flex;
  min-height:100vh;
}

.sidebar{
  width:var(--gda-sidebar-w);
  min-width:var(--gda-sidebar-w);
  position:fixed;
  top:0;
  left:0;
  bottom:0;
  overflow-y:auto;
  z-index:1100;
}

.app-main{
  flex:1;
  min-width:0;
  margin-left:var(--gda-sidebar-w);
  display:flex;
  flex-direction:column;
}

.topbar{
  min-height:var(--gda-topbar-h);
  position:sticky;
  top:0;
  z-index:900;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 20px;
}

.page-wrap{
  padding:20px;
}

.content-section{
  margin-top:30px;
  margin-bottom:24px;
}

/* =========================
   CONTAINERS
========================= */
.container,
.container-fluid{
  width:100%;
  padding-left:12px;
  padding-right:12px;
  margin-left:auto;
  margin-right:auto;
}

.container{
  max-width:1320px;
}

/* =========================
   GRID
========================= */
.row{
  display:flex;
  flex-wrap:wrap;
  margin-left:-12px;
  margin-right:-12px;
}

.row > *{
  padding-left:12px;
  padding-right:12px;
  width:100%;
  max-width:100%;
}

.col{ flex:1 0 0%; }

.col-1{ width:8.333333%; }
.col-2{ width:16.666667%; }
.col-3{ width:25%; }
.col-4{ width:33.333333%; }
.col-5{ width:41.666667%; }
.col-6{ width:50%; }
.col-7{ width:58.333333%; }
.col-8{ width:66.666667%; }
.col-9{ width:75%; }
.col-10{ width:83.333333%; }
.col-11{ width:91.666667%; }
.col-12{ width:100%; }

@media (min-width:576px){
  .col-sm-1{ width:8.333333%; }
  .col-sm-2{ width:16.666667%; }
  .col-sm-3{ width:25%; }
  .col-sm-4{ width:33.333333%; }
  .col-sm-5{ width:41.666667%; }
  .col-sm-6{ width:50%; }
  .col-sm-7{ width:58.333333%; }
  .col-sm-8{ width:66.666667%; }
  .col-sm-9{ width:75%; }
  .col-sm-10{ width:83.333333%; }
  .col-sm-11{ width:91.666667%; }
  .col-sm-12{ width:100%; }
}

@media (min-width:768px){
  .col-md-1{ width:8.333333%; }
  .col-md-2{ width:16.666667%; }
  .col-md-3{ width:25%; }
  .col-md-4{ width:33.333333%; }
  .col-md-5{ width:41.666667%; }
  .col-md-6{ width:50%; }
  .col-md-7{ width:58.333333%; }
  .col-md-8{ width:66.666667%; }
  .col-md-9{ width:75%; }
  .col-md-10{ width:83.333333%; }
  .col-md-11{ width:91.666667%; }
  .col-md-12{ width:100%; }
}

@media (min-width:992px){
  .col-lg-1{ width:8.333333%; }
  .col-lg-2{ width:16.666667%; }
  .col-lg-3{ width:25%; }
  .col-lg-4{ width:33.333333%; }
  .col-lg-5{ width:41.666667%; }
  .col-lg-6{ width:50%; }
  .col-lg-7{ width:58.333333%; }
  .col-lg-8{ width:66.666667%; }
  .col-lg-9{ width:75%; }
  .col-lg-10{ width:83.333333%; }
  .col-lg-11{ width:91.666667%; }
  .col-lg-12{ width:100%; }
}

@media (min-width:1200px){
  .col-xl-1{ width:8.333333%; }
  .col-xl-2{ width:16.666667%; }
  .col-xl-3{ width:25%; }
  .col-xl-4{ width:33.333333%; }
  .col-xl-5{ width:41.666667%; }
  .col-xl-6{ width:50%; }
  .col-xl-7{ width:58.333333%; }
  .col-xl-8{ width:66.666667%; }
  .col-xl-9{ width:75%; }
  .col-xl-10{ width:83.333333%; }
  .col-xl-11{ width:91.666667%; }
  .col-xl-12{ width:100%; }
}

/* =========================
   DISPLAY / FLEX
========================= */
.d-none{ display:none !important; }
.d-block{ display:block !important; }
.d-inline-block{ display:inline-block !important; }
.d-flex{ display:flex !important; }
.flex-column{ flex-direction:column !important; }
.flex-wrap{ flex-wrap:wrap !important; }
.justify-content-between{ justify-content:space-between !important; }
.justify-content-center{ justify-content:center !important; }
.justify-content-end{ justify-content:flex-end !important; }
.align-items-center{ align-items:center !important; }
.align-items-start{ align-items:flex-start !important; }
.align-items-end{ align-items:flex-end !important; }
.gap-1{ gap:.25rem !important; }
.gap-2{ gap:.5rem !important; }
.gap-3{ gap:1rem !important; }
.gap-4{ gap:1.5rem !important; }

/* =========================
   TEXT
========================= */
.text-start{ text-align:left !important; }
.text-center{ text-align:center !important; }
.text-end{ text-align:right !important; }
.fw-bold{ font-weight:700 !important; }
.small{ font-size:.875rem !important; }

/* =========================
   WIDTH / HEIGHT
========================= */
.w-100{ width:100% !important; }
.h-100{ height:100% !important; }

/* =========================
   SPACING
========================= */
.m-0{ margin:0 !important; }
.m-1{ margin:.25rem !important; }
.m-2{ margin:.5rem !important; }
.m-3{ margin:1rem !important; }
.m-4{ margin:1.5rem !important; }
.m-5{ margin:3rem !important; }

.mt-0{ margin-top:0 !important; }
.mt-1{ margin-top:.25rem !important; }
.mt-2{ margin-top:.5rem !important; }
.mt-3{ margin-top:1rem !important; }
.mt-4{ margin-top:1.5rem !important; }
.mt-5{ margin-top:3rem !important; }

.mb-0{ margin-bottom:0 !important; }
.mb-1{ margin-bottom:.25rem !important; }
.mb-2{ margin-bottom:.5rem !important; }
.mb-3{ margin-bottom:1rem !important; }
.mb-4{ margin-bottom:1.5rem !important; }
.mb-5{ margin-bottom:3rem !important; }

.ms-0{ margin-left:0 !important; }
.ms-1{ margin-left:.25rem !important; }
.ms-2{ margin-left:.5rem !important; }
.ms-3{ margin-left:1rem !important; }
.ms-4{ margin-left:1.5rem !important; }
.ms-5{ margin-left:3rem !important; }

.me-0{ margin-right:0 !important; }
.me-1{ margin-right:.25rem !important; }
.me-2{ margin-right:.5rem !important; }
.me-3{ margin-right:1rem !important; }
.me-4{ margin-right:1.5rem !important; }
.me-5{ margin-right:3rem !important; }

.mx-auto{
  margin-left:auto !important;
  margin-right:auto !important;
}

.my-0{
  margin-top:0 !important;
  margin-bottom:0 !important;
}

.my-1{
  margin-top:.25rem !important;
  margin-bottom:.25rem !important;
}

.my-2{
  margin-top:.5rem !important;
  margin-bottom:.5rem !important;
}

.my-3{
  margin-top:1rem !important;
  margin-bottom:1rem !important;
}

.my-4{
  margin-top:1.5rem !important;
  margin-bottom:1.5rem !important;
}

.my-5{
  margin-top:3rem !important;
  margin-bottom:3rem !important;
}

.p-0{ padding:0 !important; }
.p-1{ padding:.25rem !important; }
.p-2{ padding:.5rem !important; }
.p-3{ padding:1rem !important; }
.p-4{ padding:1.5rem !important; }
.p-5{ padding:3rem !important; }

.pt-0{ padding-top:0 !important; }
.pt-1{ padding-top:.25rem !important; }
.pt-2{ padding-top:.5rem !important; }
.pt-3{ padding-top:1rem !important; }
.pt-4{ padding-top:1.5rem !important; }
.pt-5{ padding-top:3rem !important; }

.pb-0{ padding-bottom:0 !important; }
.pb-1{ padding-bottom:.25rem !important; }
.pb-2{ padding-bottom:.5rem !important; }
.pb-3{ padding-bottom:1rem !important; }
.pb-4{ padding-bottom:1.5rem !important; }
.pb-5{ padding-bottom:3rem !important; }

.ps-0{ padding-left:0 !important; }
.ps-1{ padding-left:.25rem !important; }
.ps-2{ padding-left:.5rem !important; }
.ps-3{ padding-left:1rem !important; }
.ps-4{ padding-left:1.5rem !important; }
.ps-5{ padding-left:3rem !important; }

.pe-0{ padding-right:0 !important; }
.pe-1{ padding-right:.25rem !important; }
.pe-2{ padding-right:.5rem !important; }
.pe-3{ padding-right:1rem !important; }
.pe-4{ padding-right:1.5rem !important; }
.pe-5{ padding-right:3rem !important; }

/* =========================
   BUTTONS
========================= */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:var(--btn-height);
  padding:10px 16px;
  border-radius:var(--radius-sm);
  border:1px solid transparent;
  background:transparent;
  transition:var(--transition-base);
  text-transform:uppercase;
  letter-spacing:.08em;
  font-family:var(--font-title);
  font-size:.72rem;
  font-weight:700;
}

.btn:hover{
  transform:translateY(-1px);
}

.btn-sm{
  min-height:var(--btn-height-sm);
  padding:7px 12px;
  font-size:.64rem;
}

.btn-lg{
  min-height:var(--btn-height-lg);
  padding:12px 20px;
}

.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-outline{
  border-width:1px;
  border-style:solid;
}

/* =========================
   CARD
========================= */
.card{
  display:flex;
  flex-direction:column;
  min-width:0;
  border-radius:var(--radius-md);
  border:var(--gda-border);
  box-shadow:var(--shadow-panel);
  overflow:hidden;
}

.card-header,
.card-body,
.card-footer{
  padding:18px;
}

.card-header{
  border-bottom:1px solid rgba(255,255,255,.08);
}

.card-footer{
  border-top:1px solid rgba(255,255,255,.08);
}

/* =========================
   BADGES
========================= */
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  min-height:26px;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid transparent;
  font-size:.66rem;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  font-family:var(--font-title);
}

/* =========================
   FORMS
========================= */
.form-label{
  display:block;
  margin-bottom:8px;
  font-family:var(--font-title);
  font-size:.68rem;
  font-weight:700;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.form-control,
.form-select{
  width:100%;
  min-height:var(--input-height);
  padding:10px 14px;
  border-radius:var(--radius-sm);
  border:1px solid rgba(255,255,255,.1);
  outline:none;
  transition:var(--transition-base);
  background:var(--surface-input);
  color:var(--color-text);
}

textarea.form-control{
  min-height:110px;
  resize:vertical;
}

/* =========================
   TABLE
========================= */
.table-responsive{
  width:100%;
  overflow-x:auto;
  border-radius:16px;
}

.table{
  min-width:760px;
}

.table th,
.table td{
  padding:14px 16px;
  vertical-align:middle;
  text-align:left;
}

.table th{
  white-space:nowrap;
}

/* =========================
   MODAL
========================= */
.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:2000;
}

.modal.show{
  display:flex;
}

.modal-backdrop{
  position:absolute;
  inset:0;
}

.modal-dialog{
  position:relative;
  width:100%;
  max-width:640px;
  z-index:2;
}

.modal-sm .modal-dialog{ max-width:420px; }
.modal-lg .modal-dialog{ max-width:900px; }

.modal-content{
  border-radius:18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 20px 60px rgba(0,0,0,.4);
}

.modal-header,
.modal-body,
.modal-footer{
  padding:18px 20px;
}

.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.modal-footer{
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

.btn-close{
  width:38px;
  height:38px;
  min-height:38px;
  border-radius:10px;
  padding:0;
  font-size:1rem;
}

/* =========================
   SIDEBAR NAV
========================= */
.sidebar-header{
  padding:20px;
  position:sticky;
  top:0;
  z-index:5;
}

.sidebar-brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.sidebar-brand-logo{
  width:42px;
  height:42px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family:var(--font-title);
  font-weight:900;
}

.sidebar-brand-text{
  min-width:0;
}

.sidebar-brand-title{
  font-family:var(--font-title);
  font-size:.9rem;
  font-weight:900;
  letter-spacing:.14em;
  text-transform:uppercase;
}

.sidebar-brand-sub{
  font-size:.72rem;
  opacity:.8;
}

.sidebar-section-title{
  padding:14px 20px 8px;
  font-family:var(--font-title);
  font-size:.62rem;
  font-weight:700;
  letter-spacing:.18em;
  text-transform:uppercase;
}

.sidebar-nav{
  padding:8px 12px 18px;
}

.sidebar-nav-item{
  display:flex;
  align-items:center;
  gap:12px;
  min-height:48px;
  padding:10px 14px;
  border-radius:12px;
  transition:.2s ease;
  margin-bottom:6px;
}

.sidebar-nav-icon{
  width:20px;
  text-align:center;
  flex-shrink:0;
}

.sidebar-nav-label{
  flex:1;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-family:var(--font-title);
  font-size:.72rem;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.sidebar-nav-badge{
  flex-shrink:0;
}

.sidebar-footer{
  padding:20px;
  font-size:.72rem;
}

/* =========================
   TOPBAR
========================= */
.topbar-left,
.topbar-right{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.topbar-title{
  font-family:var(--font-title);
  font-size:1rem;
  font-weight:800;
  letter-spacing:.1em;
  text-transform:uppercase;
  white-space:nowrap;
}

.topbar-subtitle{
  font-size:.75rem;
  opacity:.82;
}

.sidebar-toggle{
  display:none;
}

/* =========================
   MOBILE SIDEBAR
========================= */
.sidebar-overlay{
  display:none;
}

@media (max-width:991.98px){
  .sidebar{
    transform:translateX(-100%);
    transition:transform .25s ease;
  }

  .app-main{
    margin-left:0;
  }

  body.sidebar-open .sidebar{
    transform:translateX(0);
  }

  .sidebar-toggle{
    display:inline-flex;
  }

  .sidebar-overlay{
    position:fixed;
    inset:0;
    z-index:1050;
    display:none;
  }

  body.sidebar-open .sidebar-overlay{
    display:block;
  }
}

/* =========================
   HELPERS
========================= */
.hr{
  height:1px;
  border:0;
  margin:0;
}

.panel-grid{
  display:grid;
  grid-template-columns:repeat(12, 1fr);
  gap:16px;
}

.panel-col-12{ grid-column:span 12; }
.panel-col-6{ grid-column:span 6; }
.panel-col-4{ grid-column:span 4; }
.panel-col-3{ grid-column:span 3; }

@media (max-width:991.98px){
  .panel-col-6,
  .panel-col-4,
  .panel-col-3{
    grid-column:span 12;
  }
}


/* =========================================================
   PATCH V1 — LAYOUT FULL WIDTH + RESPONSIVE TOPBAR/SIDEBAR
========================================================= */

/* ----- 1) Corrige la largeur réelle du contenu principal ----- */
.app-main{
  flex: 0 0 calc(100% - var(--gda-sidebar-w));
  width: calc(100% - var(--gda-sidebar-w));
  max-width: calc(100% - var(--gda-sidebar-w));
  margin-left: var(--gda-sidebar-w);
  min-width: 0;
  overflow-x: hidden;
}

/* On évite les gros retraits inutiles dans le contenu */
.page-wrap{
  padding: 14px 16px;
}

.page-wrap > .container,
.page-wrap > .container-fluid{
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding-left: 0;
  padding-right: 0;
}

/* Si tu veux vraiment exploiter toute la largeur, garde container-fluid */
.container{
  max-width: none;
}

/* Topbar plus compacte */
.topbar{
  padding: 10px 16px;
  flex-wrap: wrap;
}

.topbar-left,
.topbar-right{
  min-width: 0;
  flex-wrap: wrap;
}

.topbar-right{
  justify-content: flex-end;
}

.topbar-title{
  white-space: normal;
  line-height: 1.2;
}

.topbar-subtitle{
  white-space: normal;
  line-height: 1.25;
}

/* Sidebar : éviter les débordements de texte */
.sidebar-brand{
  min-width: 0;
}

.sidebar-brand-text{
  min-width: 0;
  overflow: hidden;
}

.sidebar-brand-title,
.sidebar-brand-sub,
.sidebar-nav-label{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----- 2) Responsive tablette / mobile ----- */
@media (max-width: 991.98px){
  .app-main{
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
  }

  .page-wrap{
    padding: 12px;
  }

  .topbar{
    padding: 10px 12px;
    gap: 10px;
    align-items: flex-start;
  }

  .topbar-left,
  .topbar-right{
    width: 100%;
  }

  .topbar-right{
    justify-content: flex-start;
  }

  .topbar-title{
    font-size: .9rem;
    letter-spacing: .06em;
  }

  .topbar-subtitle{
    font-size: .72rem;
  }
}

/* ----- 3) Très petit mobile ----- */
@media (max-width: 575.98px){
  .sidebar-header{
    padding: 14px 12px;
  }

  .sidebar-brand{
    gap: 10px;
    align-items: flex-start;
  }

  .sidebar-brand-logo{
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .sidebar-brand-title{
    font-size: .78rem;
    letter-spacing: .06em;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    word-break: break-word;
  }

  .sidebar-brand-sub{
    font-size: .66rem;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    word-break: break-word;
  }

  .sidebar-nav-item{
    min-height: 44px;
    padding: 8px 12px;
  }

  .sidebar-nav-label{
    font-size: .68rem;
    letter-spacing: .05em;
  }

  .topbar{
    padding: 10px;
  }

  .topbar-title{
    font-size: .82rem;
  }

  .topbar-subtitle{
    font-size: .68rem;
  }

  .btn{
    min-height: 38px;
    padding: 8px 12px;
    font-size: .62rem;
  }

  .page-wrap{
    padding: 10px;
  }
}


/* =========================================================
   HOTFIX FINAL — SHELL GRID + SIDEBAR STICKY DESKTOP
   Objectif :
   - plus de grand vide à gauche
   - la zone principale ne passe plus "sous" la nav
   - desktop = sidebar sticky dans la grille
   - mobile = sidebar offcanvas
========================================================= */

html,
body{
  overflow-x:hidden;
}

.app-shell{
  display:grid !important;
  grid-template-columns: var(--gda-sidebar-w) minmax(0, 1fr) !important;
  min-height:100vh;
  align-items:stretch;
}

.sidebar{
  position:sticky !important;
  top:0 !important;
  left:auto !important;
  bottom:auto !important;
  width:var(--gda-sidebar-w) !important;
  min-width:var(--gda-sidebar-w) !important;
  height:100vh !important;
  overflow-y:auto;
  z-index:1100;
}

.app-main{
  position:relative !important;
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:100vh;
  margin-left:0 !important;
  width:auto !important;
  max-width:none !important;
  overflow-x:hidden;
}

.topbar,
.page-wrap{
  width:100%;
  max-width:100%;
  min-width:0;
}

.topbar{
  margin:0 !important;
  padding:10px 16px !important;
  flex-wrap:wrap;
}

.page-wrap{
  margin:0 !important;
  padding:14px 16px !important;
}

.page-wrap > .container,
.page-wrap > .container-fluid{
  width:100%;
  max-width:none !important;
  margin:0 !important;
  padding-left:0 !important;
  padding-right:0 !important;
}

.container{
  max-width:none;
}

.topbar-left,
.topbar-right{
  min-width:0;
  flex-wrap:wrap;
}

.topbar-left{
  flex:1 1 420px;
}

.topbar-right{
  flex:0 1 auto;
  justify-content:flex-end;
}

.topbar-title,
.topbar-subtitle{
  white-space:normal;
  word-break:break-word;
  line-height:1.2;
}

.sidebar-brand,
.sidebar-brand-text,
.sidebar-nav-item,
.sidebar-nav-label{
  min-width:0;
}

@media (max-width:991.98px){
  .app-shell{
    display:block !important;
  }

  .sidebar{
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    bottom:0 !important;
    height:100vh !important;
    transform:translateX(-100%);
    transition:transform .25s ease;
  }

  body.sidebar-open .sidebar{
    transform:translateX(0);
  }

  .app-main{
    margin-left:0 !important;
    width:100% !important;
    max-width:100% !important;
    min-height:100vh;
  }

  .topbar{
    padding:10px 12px !important;
    gap:10px;
    align-items:flex-start;
  }

  .topbar-left,
  .topbar-right{
    width:100%;
    flex:0 0 100%;
  }

  .topbar-right{
    justify-content:flex-start;
  }

  .topbar-title{
    font-size:.92rem;
    letter-spacing:.05em;
  }

  .topbar-subtitle{
    font-size:.72rem;
  }

  .page-wrap{
    padding:12px !important;
  }
}

@media (max-width:575.98px){
  .topbar{
    padding:10px !important;
  }

  .page-wrap{
    padding:10px !important;
  }

  .sidebar-header{
    padding:14px 12px;
  }

  .sidebar-brand{
    gap:10px;
    align-items:flex-start;
  }

  .sidebar-brand-logo{
    width:38px;
    height:38px;
    min-width:38px;
  }

  .sidebar-brand-title{
    font-size:.78rem;
    letter-spacing:.04em;
    white-space:normal;
    overflow:visible;
    text-overflow:initial;
    word-break:break-word;
  }

  .sidebar-brand-sub{
    font-size:.66rem;
    white-space:normal;
    overflow:visible;
    text-overflow:initial;
    word-break:break-word;
  }

  .sidebar-nav-item{
    min-height:44px;
    padding:8px 12px;
  }

  .sidebar-nav-label{
    font-size:.67rem;
    letter-spacing:.04em;
  }

  .topbar-title{
    font-size:.82rem;
  }

  .topbar-subtitle{
    font-size:.67rem;
  }

  .btn{
    min-height:38px;
    padding:8px 12px;
    font-size:.62rem;
  }
}

/* =========================================================
   MOBILE SIDEBAR — NETTE, OPAQUE, SANS FLOU
========================================================= */
@media (max-width: 991.98px){

  /* Fond derrière la sidebar : sombre mais net */
  .sidebar-overlay{
    background: rgba(1, 10, 16, 0.55);
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Sidebar mobile bien opaque */
  .sidebar{
    background: #202126 !important;
    border-right: 1px solid rgba(123,130,246, 0.32) !important;
    box-shadow:
      18px 0 40px rgba(0, 0, 0, 0.55),
      0 0 18px rgba(123,130,246, 0.08);
  }

  body.sidebar-open .sidebar{
    background: #202126 !important;
    border-right: 1px solid rgba(123,130,246, 0.38) !important;
    box-shadow:
      20px 0 46px rgba(0, 0, 0, 0.60),
      0 0 22px rgba(123,130,246, 0.10);
  }

  /* Header sidebar plus lisible */
  .sidebar-header{
    background: #191a1e !important;
    border-bottom: 1px solid rgba(123,130,246, 0.14) !important;
  }

  /* Footer */
  .sidebar-footer{
    background: #191a1e !important;
    border-top: 1px solid rgba(123,130,246, 0.10) !important;
  }
}

/* =========================================================
   HOTFIX MOBILE SIDEBAR — OFFCANVAS PROPRE
========================================================= */
@media (max-width: 991.98px){

  /* Le contenu principal reste derrière */
  .app-main{
    position: relative !important;
    z-index: 1 !important;
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .topbar{
    position: sticky;
    top: 0;
    z-index: 100 !important;
  }

  /* Overlay sombre derrière la sidebar */
  .sidebar-overlay{
    position: fixed !important;
    inset: 0 !important;
    background: rgba(1, 10, 16, 0.62) !important;
    display: block !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 3998 !important;
    transition: opacity .22s ease, visibility .22s ease;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.sidebar-open .sidebar-overlay{
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Vraie sidebar mobile au-dessus de tout */
  .sidebar{
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(86vw, 320px) !important;
    max-width: 320px !important;
    min-width: 0 !important;
    height: 100vh !important;
    transform: translateX(-105%) !important;
    transition: transform .24s ease !important;
    z-index: 3999 !important;

    background: #202126 !important;
    border-right: 1px solid rgba(123,130,246, 0.34) !important;
    box-shadow:
      18px 0 46px rgba(0, 0, 0, 0.60),
      0 0 24px rgba(123,130,246, 0.10) !important;

    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  body.sidebar-open .sidebar{
    transform: translateX(0) !important;
  }

  /* On force les zones internes à être bien lisibles */
  .sidebar-header,
  .sidebar-nav,
  .sidebar-footer{
    position: relative;
    z-index: 1;
    background: transparent;
  }

  .sidebar-header{
    background: #191a1e !important;
    border-bottom: 1px solid rgba(123,130,246, 0.14) !important;
  }

  .sidebar-footer{
    background: #191a1e !important;
    border-top: 1px solid rgba(123,130,246, 0.10) !important;
  }

  /* Empêche les textes de casser bizarrement */
  .sidebar-brand,
  .sidebar-brand-text,
  .sidebar-nav-item,
  .sidebar-nav-label{
    min-width: 0;
  }

}

/* =========================================================
   MOBILE SIDEBAR — version plus claire / moins sombre
========================================================= */
@media (max-width: 991.98px){

  /* Overlay arrière-plan : beaucoup plus léger */
  .sidebar-overlay{
    background: rgba(1, 10, 16, 0.12) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Sidebar plus lisible, un peu plus "pleine" */
  .sidebar{
    background: #191a1e !important;
    border-right: 1px solid rgba(123,130,246, 0.36) !important;
    box-shadow:
      14px 0 34px rgba(0, 0, 0, 0.28),
      0 0 18px rgba(123,130,246, 0.08) !important;
  }

  body.sidebar-open .sidebar{
    background: #191a1e !important;
    border-right: 1px solid rgba(123,130,246, 0.40) !important;
    box-shadow:
      16px 0 38px rgba(0, 0, 0, 0.32),
      0 0 20px rgba(123,130,246, 0.10) !important;
  }

  /* Header / footer un peu différenciés mais pas trop */
  .sidebar-header{
    background: #202126 !important;
    border-bottom: 1px solid rgba(123,130,246, 0.14) !important;
  }

  .sidebar-footer{
    background: #202126 !important;
    border-top: 1px solid rgba(123,130,246, 0.10) !important;
  }
}


/* =========================================================
   VARIABLES THEME ADDONS
========================================================= */
.form-control::placeholder,
textarea.form-control::placeholder{
  color:var(--color-text-soft);
}

.btn-warning{
  background: rgba(var(--color-warning-rgb), .08);
  color: var(--color-warning);
  border-color: rgba(var(--color-warning-rgb), .24);
  box-shadow: 0 0 16px rgba(var(--color-warning-rgb), .10);
}

.btn-warning:hover{
  background: rgba(var(--color-warning-rgb), .12);
}

.btn-info{
  background: rgba(var(--color-info-rgb), .08);
  color: var(--color-info);
  border-color: rgba(var(--color-info-rgb), .24);
  box-shadow: 0 0 16px rgba(var(--color-info-rgb), .10);
}

.btn-info:hover{
  background: rgba(var(--color-info-rgb), .12);
}

.form-check{
  display:flex;
  align-items:flex-start;
  gap:10px;
}

.form-check + .form-check{
  margin-top:10px;
}

.form-check-input{
  appearance:none;
  -webkit-appearance:none;
  width:20px;
  height:20px;
  min-width:20px;
  margin:0;
  border-radius:6px;
  border:1px solid rgba(var(--color-primary-rgb), .24);
  background:rgba(4,19,26,.88);
  position:relative;
  cursor:pointer;
  transition:var(--transition-base);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02);
}

.form-check-input:hover{
  border-color:rgba(var(--color-primary-rgb), .38);
  box-shadow:var(--shadow-glow);
}

.form-check-input:focus{
  outline:none;
  box-shadow:0 0 0 3px rgba(var(--color-primary-rgb), .10), var(--shadow-glow);
}

.form-check-input[type="radio"]{
  border-radius:50%;
}

.form-check-input:checked{
  background:rgba(var(--color-primary-rgb), .12);
  border-color:rgba(var(--color-primary-rgb), .42);
  box-shadow:var(--shadow-glow);
}

.form-check-input:checked::after{
  content:'';
  position:absolute;
  left:6px;
  top:2px;
  width:4px;
  height:9px;
  border:solid var(--color-primary);
  border-width:0 2px 2px 0;
  transform:rotate(45deg);
}

.form-check-input[type="radio"]:checked::after{
  left:5px;
  top:5px;
  width:8px;
  height:8px;
  border:0;
  border-radius:50%;
  background:var(--color-primary);
  transform:none;
  box-shadow:0 0 10px rgba(var(--color-primary-rgb), .45);
}

.form-check-label{
  cursor:pointer;
  color:var(--color-text);
  line-height:1.35;
  user-select:none;
}

.form-switch{
  display:inline-flex;
  align-items:center;
  gap:10px;
}

.form-switch .form-check-input{
  width:44px;
  height:24px;
  min-width:44px;
  border-radius:999px;
}

.form-switch .form-check-input::after{
  content:'';
  position:absolute;
  top:2px;
  left:2px;
  width:18px;
  height:18px;
  border:0;
  border-radius:50%;
  background:var(--color-text-soft);
  transform:none;
  transition:var(--transition-base);
}

.form-switch .form-check-input:checked::after{
  left:22px;
  background:var(--color-primary);
  box-shadow:0 0 12px rgba(var(--color-primary-rgb), .35);
}

.content-section,
.card,
.card-body,
.card-header,
.card-footer,
.page-wrap,
.container,
.container-fluid{
  position:relative;
}

.content-section,
.card,
.card-body{
  overflow:visible !important;
}

.dropdown{
  position:relative;
  display:inline-flex;
  z-index:20;
}

.dropdown.open{
  z-index:80;
}

.dropdown-menu{
  z-index:3100;
  max-height:min(60vh, 420px);
  overflow-y:auto;
}

.table-responsive .dropdown-menu{
  z-index:3200;
}

/* =========================================================
   GUIDE CRM - TOPBAR + PREMIERE OUVERTURE
========================================================= */
.crm-guide-topbar-button{
  white-space:nowrap;
  box-shadow:0 6px 18px rgba(91,96,225,.18);
}

.crm-guide-topbar-button > span{
  display:inline-grid;
  place-items:center;
  width:18px;
  height:18px;
  border-radius:50%;
  border:1px solid currentColor;
  font-size:.7rem;
  line-height:1;
}

body.crm-guide-modal-open{
  overflow:hidden !important;
}

.crm-guide-modal{
  position:fixed;
  inset:0;
  z-index:2600;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
}

.crm-guide-modal.is-open{
  display:flex;
}

.crm-guide-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(18,20,31,.64);
  backdrop-filter:blur(2px);
}

.crm-guide-modal-dialog{
  position:relative;
  z-index:2;
  width:min(100%,690px);
}

.crm-guide-modal-card{
  overflow:hidden;
  border:1px solid #dde1ed;
  border-radius:18px;
  background:#fff;
  box-shadow:0 24px 80px rgba(18,20,31,.28);
}

.crm-guide-modal-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  padding:22px 24px 16px;
  border-bottom:1px solid #eceef5;
}

.crm-guide-modal-kicker{
  display:block;
  margin-bottom:4px;
  color:#666ce8;
  font-size:.68rem;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.crm-guide-modal-header h2{
  margin:0;
  color:#262a35;
  font-size:1.35rem;
  line-height:1.25;
}

.crm-guide-modal-x{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  width:36px;
  height:36px;
  padding:0;
  border:1px solid #dfe2ec;
  border-radius:10px;
  background:#fff;
  color:#555e70;
  font-size:1.3rem;
  cursor:pointer;
}

.crm-guide-modal-x:disabled,
.crm-guide-modal .btn:disabled{
  opacity:.38;
  cursor:not-allowed;
  transform:none !important;
}

.crm-guide-modal-body{
  padding:20px 24px 10px;
  color:#59647b;
  line-height:1.6;
}

.crm-guide-modal-body p{
  margin:0 0 11px;
}

.crm-guide-modal-required{
  padding:11px 13px;
  border:1px solid #f0cfd1;
  border-radius:10px;
  background:#fff7f7;
  color:#9b454d;
  font-weight:700;
}

.crm-guide-modal-footer{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
  padding:16px 24px 22px;
}

@media(max-width:760px){
  .crm-guide-modal{padding:12px;}
  .crm-guide-modal-header{padding:18px 18px 14px;}
  .crm-guide-modal-body{padding:16px 18px 8px;}
  .crm-guide-modal-footer{padding:14px 18px 18px;justify-content:stretch;}
  .crm-guide-modal-footer .btn{flex:1 1 100%;}
  .crm-guide-topbar-button{font-size:.61rem;}
}
