/*
 style.css — Feuille de style principale du CRM
 Version : 3.6.1
*/

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Chakra+Petch:wght@500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

/* ── Variables ── */
:root {
  --ov-bleu:       #0A6CF1;
  --ov-bleu-p:     #0554C4;
  --ov-bleu-c:     #3D9BFF;
  --ov-nuit:       #0D1321;
  --ov-alu:        #6B7485;
  --ov-brume:      #F4F6FA;
  --ov-succes:     #12A150;
  --ov-jaune:      #FBEA32;
  --ov-jaune-f:    #EBD805;
  --ov-jaune-txt:  #A86B00;

  /* Anciens noms conserves : les pages les utilisent encore en ligne. */
  --ed-navy:       #0D1321;
  --ed-navy-2:     #131B2E;
  --ed-navy-3:     #1A2440;
  --ed-blue:       #0554C4;
  --ed-cyan:       #0A6CF1;
  --ed-cyan-2:     #3D9BFF;
  --ed-ice:        #B9D4FB;
  --ed-grad:       linear-gradient(135deg, #0554C4 0%, #0A6CF1 55%, #3D9BFF 100%);
  --ed-grad-h:     linear-gradient(90deg,  #0554C4 0%, #0A6CF1 60%, #3D9BFF 100%);
  --ed-grad-light: linear-gradient(90deg, rgba(10,108,241,.08), rgba(61,155,255,.08));

  --bg-page:    #F4F6FA;
  --bg-white:   #FFFFFF;
  --bg-sidebar: #FFFFFF;

  --text-1: #0D1321;
  --text-2: #3A4457;
  --text-3: #6B7485;
  --text-4: #A3AAB8;
  --text-w: #FFFFFF;
  --text-w2: rgba(255,255,255,.65);
  --text-w3: rgba(255,255,255,.38);

  --border:    #E3E7EE;
  --border-2:  #D0D6E0;
  --bd:        #E3E7EE;

  --green:     #12A150;  --green-bg:  rgba(18,161,80,.10);
  --orange:    #E08600;  --orange-bg: rgba(224,134,0,.10);
  --red:       #B4233A;  --red-bg:    rgba(180,35,58,.10);
  --purple:    #6D4DE3;  --purple-bg: rgba(109,77,227,.10);
  --teal:      #0A6CF1;  --teal-bg:   rgba(10,108,241,.10);
  --jaune:     #FBEA32;  --jaune-bg:  #FFF3CC;

  --sidebar-w: 264px;
  --sidebar-w-compact: 68px;
  --header-h:  64px;
  --r:         14px;
  --r-sm:      9px;
  --r-lg:      18px;
  --sh-sm:     0 1px 2px rgba(13,19,33,.04);
  --sh:        0 4px 14px rgba(13,19,33,.06);
  --sh-md:     0 8px 28px rgba(13,19,33,.08);
  --sh-lg:     0 20px 50px rgba(13,19,33,.10);
  --t:         .18s ease;

  --ff-d: 'Sora', sans-serif;
  --ff-b: 'Manrope', sans-serif;
  --ff-l: 'Chakra Petch', sans-serif;
  --ff-m: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --st-new-bg:           #FFF3CC;  --st-new-fg:           #A86B00;
  --st-en-cours-bg:      #E8F4FD;  --st-en-cours-fg:      #0B6FA4;
  --st-estimation-bg:    #E6F1FF;  --st-estimation-fg:    #0A6CF1;
  --st-offre-bg:         #E8E6FD;  --st-offre-fg:         #4338CA;
  --st-rdv-ag-bg:        #DFF6FB;  --st-rdv-ag-fg:        #0587A8;
  --st-rdv-do-bg:        #DCF5F0;  --st-rdv-do-fg:        #0B7D6B;
  --st-insp-distance-bg: #DDEBFF;  --st-insp-distance-fg: #0554C4;
  --st-inspecte-bg:      #EAF7EF;  --st-inspecte-fg:      #0E7C3E;
  --st-rachete-bg:       #D7F2E2;  --st-rachete-fg:       #0B6B35;
  --st-vendu-bg:         #0D1321;  --st-vendu-fg:         #FFFFFF;
  --st-annule-bg:        #EEF1F5;  --st-annule-fg:        #6B7485;
  --st-refuse-bg:        #FBE7EA;  --st-refuse-fg:        #B4233A;
  --st-insp-comm-bg:     #DDEBFF;  --st-insp-comm-fg:     #0554C4;
  --st-insp-dst-bg:      #F1EDFF;  --st-insp-dst-fg:      #6D4DF0;

  /* Alu brosse (stries horizontales + reflet), barre laterale et en-tete */
  --ov-alu-stries: repeating-linear-gradient(180deg, rgba(255,255,255,.45) 0 1px, rgba(13,19,33,.045) 1px 2px);
  --ov-alu-v: linear-gradient(170deg, #F4F6FA 0%, #E1E6ED 30%, #F5F7FB 52%, #DCE2EA 78%, #EDF0F5 100%);
  --ov-alu-h: linear-gradient(100deg, #F4F6FA 0%, #E1E6ED 30%, #F5F7FB 52%, #DCE2EA 78%, #EDF0F5 100%);
  --ov-alu-border: #CBD3DE;

  /* Anneau de la marque, en decor de fond (dessin vectoriel, aucune image a charger) */
  --ov-anneau: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Ccircle cx='100' cy='100' r='76' fill='none' stroke='%230A6CF1' stroke-width='30'/%3E%3Ccircle cx='156' cy='50' r='21' fill='%230D1321' stroke='%23ffffff' stroke-width='6'/%3E%3C/svg%3E");
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--ff-b); background: var(--bg-page); color: var(--text-1); min-height: 100vh; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--ed-cyan); text-decoration: none; transition: var(--t); }
a:hover { color: var(--ed-blue); }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: var(--ff-b); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ============================================================
 LAYOUT
 ============================================================ */
.crm-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ============================================================
 SIDEBAR (claire)
 ============================================================ */
.sidebar {
  background: var(--bg-sidebar);
  background-image: var(--ov-alu-stries), var(--ov-alu-v);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 200;
  border-right: 1px solid var(--ov-alu-border);
  transition: transform .28s cubic-bezier(.4,0,.2,1),
              width .28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.sidebar-logo {
  padding: 10px 16px;
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-bottom: 1px solid var(--ov-alu-border);
  flex-shrink: 0;
  background: transparent;
}
.sidebar-logo-img {
  max-width: 216px;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.sidebar-logo-compact { display: none; }
.sidebar-logo-full { display: block; }
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: var(--ed-grad);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.sidebar-logo-text {
  font-family: var(--ff-d);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--text-1);
  line-height: 1.2;
  letter-spacing: -.2px;
}
.sidebar-logo-text small {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: .9px;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px 14px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-2); }

.nav-section { margin-bottom: 10px; }
.nav-section-label {
  font-family: var(--ff-l);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  height: 40px;
  border-radius: 10px;
  color: var(--text-1);
  font-size: 14px;
  font-weight: 600;
  transition: var(--t);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.6); color: var(--text-1); }
.nav-item.active {
  background: #FFFFFF;
  color: var(--ed-blue);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(13,19,33,.12);
}
.nav-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; opacity: .85; font-size: 15px; line-height: 1; }
.nav-icon svg { width: 18px; height: 18px; display: block; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  margin-left: auto;
  background: var(--ov-bleu);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  font-family: var(--ff-b);
  padding: 2px 7px;
  border-radius: 11px;
  min-width: 22px;
  height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-badge.orange { background: var(--ov-jaune); color: var(--ov-nuit); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--ov-alu-border);
  flex-shrink: 0;
}
.user-card { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 38px; height: 38px;
  background: var(--ov-bleu);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--ff-d);
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 14px; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--text-3); text-transform: capitalize; letter-spacing: .2px; }
.logout-btn {
  background: none; border: none;
  color: var(--text-3);
  cursor: pointer; font-size: 15px;
  padding: 6px 8px; border-radius: 8px;
  transition: var(--t); flex-shrink: 0;
}
.logout-btn:hover { color: var(--red); background: var(--red-bg); }

/* ============================================================
 HEADER
 ============================================================ */
.crm-header {
  height: var(--header-h);
  background: var(--bg-white);
  background-image: var(--ov-alu-stries), var(--ov-alu-h);
  border-bottom: 1px solid var(--ov-alu-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  margin-left: var(--sidebar-w);
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}

.header-title {
  font-family: var(--ff-d);
  font-size: 19px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -.2px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-title small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 8px; font-family: var(--ff-b); }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: nowrap; max-width: 70%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.header-actions::-webkit-scrollbar { display: none; }
.header-actions .btn { flex-shrink: 0; }
.header-actions svg { width: 15px; height: 15px; flex-shrink: 0; }
.header-date { display: none !important; }

/* ============================================================
 OVERLAY MOBILE
 ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(13,19,33,.45);
  z-index: 150;
  backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

/* ============================================================
 MAIN
 ============================================================ */
.crm-main {
  padding: 28px;
  margin-left: var(--sidebar-w);
  min-height: calc(100vh - var(--header-h));
  position: relative;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}
/* Anneau en filigrane, bas droite, derriere le contenu */
.crm-main::before {
  content: '';
  position: fixed;
  right: -120px; bottom: -140px;
  width: 520px; height: 520px;
  background: var(--ov-anneau) no-repeat center / contain;
  opacity: .05;
  pointer-events: none;
  z-index: 0;
}
.crm-main > * { position: relative; z-index: 1; }

/* ============================================================
 SIDEBAR MODE COMPACT
 ============================================================ */
.sidebar-collapse-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 10px; right: 10px;
  width: 26px; height: 26px;
  margin: 0;
  padding: 0;
  background: rgba(255,255,255,.5);
  border: 1px solid var(--ov-alu-border);
  border-radius: 8px;
  color: var(--text-3);
  font-family: var(--ff-d);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: var(--t);
}
.sidebar-collapse-toggle:hover {
  background: #EAF2FE;
  color: var(--ed-blue);
  border-color: #B9D4FB;
}
.sidebar-collapse-toggle .collapse-arrow { display: block; font-weight: 600; }

html.layout--compact .sidebar { width: var(--sidebar-w-compact); }
html.layout--compact .crm-layout { grid-template-columns: var(--sidebar-w-compact) 1fr; }
html.layout--compact .crm-header { margin-left: var(--sidebar-w-compact); }
html.layout--compact .crm-main   { margin-left: var(--sidebar-w-compact); }

html.layout--compact .sidebar .nav-label,
html.layout--compact .sidebar .nav-section-label,
html.layout--compact .sidebar .nav-badge,
html.layout--compact .sidebar .user-info {
  display: none;
}
html.layout--compact .sidebar .nav-item {
  justify-content: center;
  padding: 0;
  gap: 0;
}
html.layout--compact .sidebar .nav-icon { width: auto; opacity: 1; }
html.layout--compact .sidebar .nav-icon svg { width: 20px; height: 20px; }

html.layout--compact .sidebar .sidebar-logo-img { max-width: 40px; }
html.layout--compact .sidebar .sidebar-logo {
  padding: 12px 8px;
  justify-content: center;
  background: transparent;
  min-height: auto;
}
html.layout--compact .sidebar .sidebar-logo-full { display: none; }
html.layout--compact .sidebar .sidebar-logo-compact { display: block; }
html.layout--compact .sidebar-collapse-toggle {
  position: static;
  width: calc(100% - 12px);
  height: 26px;
  margin: 6px 6px 2px;
}
html.layout--compact .sidebar .sidebar-logo { height: auto; }
html.layout--compact .sidebar .nav-section { margin-bottom: 8px; }
html.layout--compact .sidebar .user-card { justify-content: center; }
html.layout--compact .sidebar .sidebar-footer { padding: 10px 8px; }

/* ============================================================
 KPI CARDS
 ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--bg-white);
  border-radius: var(--r);
  padding: 18px 20px;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
  transition: var(--t);
  position: relative; overflow: hidden;
  min-height: 112px;
}
.kpi-card::after {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: transparent;
}
.kpi-card.blue::after,
.kpi-card.bleu::after   { background: var(--ov-bleu); }
.kpi-card.green::after  { background: var(--ov-succes); }
.kpi-card.orange::after,
.kpi-card.jaune::after,
.kpi-card.yellow::after { background: var(--ov-jaune); }
.kpi-card.red::after    { background: var(--red); }
.kpi-card.purple::after { background: var(--purple); }
.kpi-card.teal::after,
.kpi-card.ciel::after   { background: var(--ov-bleu-c); }
.kpi-card:hover { border-color: var(--ov-bleu); box-shadow: var(--sh); }
.kpi-label { font-family: var(--ff-l); font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-3); }
.kpi-value { font-family: var(--ff-d); font-size: 34px; font-weight: 700; color: var(--text-1); line-height: 1; letter-spacing: -.8px; }
.kpi-value.blue, .kpi-value.bleu { color: var(--ov-bleu-p); }
.kpi-value.green  { color: #0E7F3F; }
.kpi-value.orange, .kpi-value.jaune, .kpi-value.yellow { color: var(--ov-jaune-txt); }
.kpi-value.red    { color: var(--red); }
.kpi-value.purple { color: var(--purple); }
.kpi-value.teal, .kpi-value.ciel { color: var(--ov-bleu); }
.kpi-sub { font-size: 13px; color: var(--text-3); font-weight: 500; }
.kpi-arrow {
  position: absolute; right: 16px; top: 16px;
  color: var(--text-4); font-size: 14px; font-weight: 700;
  transition: var(--t);
}
.kpi-card:hover .kpi-arrow { color: var(--ov-bleu); transform: translateX(2px); }

/* ============================================================
 CARDS
 ============================================================ */
.card {
  background: var(--bg-white);
  border-radius: var(--r);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  min-height: 56px;
}
.card-title { font-family: var(--ff-d); font-size: 15.5px; font-weight: 600; color: var(--text-1); flex: 1; }
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ============================================================
 TABLEAUX
 ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.data-table th {
  background: var(--bg-white);
  padding: 11px 16px;
  text-align: left;
  font-family: var(--ff-l);
  font-size: 11px; font-weight: 600;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid #EEF1F5; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #F8FAFD; }
.data-table .mono { font-family: var(--ff-b); font-size: 13px; color: var(--ov-bleu); font-weight: 700; }

/* ============================================================
 BADGES
 ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 0 10px; height: 24px; border-radius: 12px;
  font-size: 12px; font-weight: 700;
  white-space: nowrap; letter-spacing: .1px;
}
.badge-new                   { background: var(--st-new-bg);           color: var(--st-new-fg); }
.badge-en-cours              { background: var(--st-en-cours-bg);      color: var(--st-en-cours-fg); }
.badge-estimation            { background: var(--st-estimation-bg);    color: var(--st-estimation-fg); }
.badge-offre                 { background: var(--st-offre-bg);         color: var(--st-offre-fg); }
.badge-rdv-agence            { background: var(--st-rdv-ag-bg);        color: var(--st-rdv-ag-fg); }
.badge-rdv-domicile          { background: var(--st-rdv-do-bg);        color: var(--st-rdv-do-fg); }
.badge-inspection-distance   { background: var(--st-insp-distance-bg); color: var(--st-insp-distance-fg); }
.badge-inspecte              { background: var(--st-inspecte-bg);      color: var(--st-inspecte-fg); }
.badge-rachete               { background: var(--st-rachete-bg);       color: var(--st-rachete-fg); }
.badge-vendu                 { background: var(--st-vendu-bg);         color: var(--st-vendu-fg); }
.badge-annule                { background: var(--st-annule-bg);        color: var(--st-annule-fg); }
.badge-refuse                { background: var(--st-refuse-bg);        color: var(--st-refuse-fg); }

.badge-insp-comm             { background: var(--st-insp-comm-bg);     color: var(--st-insp-comm-fg); }
.badge-insp-dst              { background: var(--st-insp-dst-bg);      color: var(--st-insp-dst-fg); }

.badge-ok                    { background: var(--green-bg); color: var(--green); }

/* ============================================================
 FORMULAIRES
 ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-family: var(--ff-l); font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 7px; }
.form-control {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border-2);
  border-radius: 10px;
  font-size: 14.5px; font-weight: 500; color: var(--text-1);
  background: var(--bg-white);
  transition: var(--t); outline: none;
  -webkit-appearance: none;
}
.form-control:focus { border-color: var(--ov-bleu); box-shadow: 0 0 0 3px rgba(10,108,241,.16); }
.form-control::placeholder { color: var(--text-4); }
select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7485' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px; cursor: pointer;
}
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.search-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--bg-page);
  border-bottom: 1px solid var(--border);
  align-items: flex-end;
}
.search-bar .form-group { margin-bottom: 0; flex: 1; min-width: 130px; }

/* ============================================================
 BOUTONS
 ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: var(--t); text-decoration: none;
  white-space: nowrap; letter-spacing: 0;
  line-height: 1.3;
}
.btn-primary { background: var(--ov-bleu); color: #fff; border-color: var(--ov-bleu); }
.btn-primary:hover { background: var(--ov-bleu-p); border-color: var(--ov-bleu-p); color: #fff; }
.btn-secondary { background: var(--bg-white); color: var(--text-1); border-color: var(--border-2); }
.btn-secondary:hover { background: var(--bg-page); color: var(--text-1); }
.btn-ghost { background: var(--bg-white); color: var(--text-1); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--bg-page); border-color: var(--border-2); color: var(--text-1); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-bg); color: var(--green); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm   { padding: 6px 11px; font-size: 12.5px; }
.btn-lg   { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn.active, .btn-secondary.active { background: #EAF2FE; border-color: #B9D4FB; color: var(--ed-blue); }

/* ============================================================
 ALERTS
 ============================================================ */
.alert {
  padding: 11px 16px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
  border: 1px solid transparent;
}
.alert-success { background: #E3F6EA; color: #0E7F3F; border-color: #BDE8CC; }
.alert-error   { background: #FBE7EA; color: #B4233A; border-color: #F3C6CD; }
.alert-info    { background: #EAF2FE; color: var(--ed-blue); border-color: #B9D4FB; }
.alert-warning { background: #FFF3CC; color: var(--ov-jaune-txt); border-color: #FFE08A; }

/* ============================================================
 FICHE DOSSIER
 ============================================================ */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-block { margin-bottom: 14px; }
.detail-label { font-family: var(--ff-l); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); margin-bottom: 3px; }
.detail-value { font-size: 14px; color: var(--text-1); font-weight: 500; }
.detail-value.mono { font-family: var(--ff-b); color: var(--ov-bleu); font-size: 13.5px; font-weight: 700; }
.detail-value.big { font-family: var(--ff-d); font-size: 22px; font-weight: 700; color: var(--ov-bleu-p); }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 12px; padding: 9px 0; position: relative; }
.timeline-item:not(:last-child)::after { content: ''; position: absolute; left: 12px; top: 30px; bottom: 0; width: 2px; background: var(--border); }
.timeline-dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; background: var(--bg-page); color: var(--text-3); border: 1.5px solid var(--border); z-index: 1; }
.timeline-dot.done { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.timeline-dot.current { background: #EAF2FE; color: var(--ov-bleu); border-color: var(--ov-bleu); box-shadow: 0 0 0 3px rgba(10,108,241,.14); }
.timeline-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.timeline-date  { font-size: 11px; color: var(--text-3); }

.offre-form { background: #EAF2FE; border: 1px solid #B9D4FB; border-radius: var(--r); padding: 18px; }
.prix-input-wrap { display: flex; align-items: center; border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden; background: #fff; }
.prix-input-wrap:focus-within { border-color: var(--ov-bleu); box-shadow: 0 0 0 3px rgba(10,108,241,.16); }
.prix-input-wrap input { flex: 1; border: none; outline: none; padding: 10px 14px; font-size: 20px; font-family: var(--ff-d); font-weight: 700; color: var(--text-1); background: transparent; }
.prix-input-wrap .currency { padding: 0 14px; font-family: var(--ff-d); font-size: 18px; font-weight: 700; color: var(--ov-bleu); background: #EAF2FE; }

/* ============================================================
 LOGIN
 ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-page);
}
.login-brand {
  position: relative; overflow: hidden;
  padding: 64px 80px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  background: linear-gradient(160deg, #FFFFFF 0%, #EEF3FB 100%);
  border-right: 1px solid var(--border);
}
.login-brand::before {
  content: '';
  position: absolute;
  right: -160px; bottom: -180px;
  width: 620px; height: 620px;
  background: var(--ov-anneau) no-repeat center / contain;
  opacity: .07;
  pointer-events: none;
}
.login-brand > * { position: relative; }
.login-brand-logo { width: 240px; height: auto; margin-bottom: 36px; }
.login-kicker { font-family: var(--ff-l); font-size: 12px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--ov-bleu); margin-bottom: 12px; }
.login-headline { font-family: var(--ff-d); font-size: 40px; line-height: 1.12; font-weight: 700; color: var(--text-1); letter-spacing: -.6px; margin-bottom: 14px; }
.login-lead { font-size: 16.5px; line-height: 1.6; color: var(--text-3); font-weight: 500; max-width: 440px; }
.login-points { display: flex; flex-direction: column; gap: 20px; }
.login-point { display: flex; align-items: flex-start; gap: 14px; }
.login-point-ico { width: 40px; height: 40px; border-radius: 10px; background: #fff; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--ov-bleu); flex-shrink: 0; }
.login-point-ico svg { width: 20px; height: 20px; }
.login-point-title { font-size: 15px; font-weight: 700; color: var(--text-1); }
.login-point-sub { font-size: 13.5px; color: var(--text-3); font-weight: 500; }
.login-copyright { font-size: 13px; color: var(--text-3); font-weight: 500; }

.login-form-wrap { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 40px 40px 32px;
  width: 100%; max-width: 440px;
  box-shadow: var(--sh-lg);
  animation: fadeUp .4s ease both;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }

.login-logo { display: none; justify-content: center; margin-bottom: 24px; }
.login-logo-img { height: 40px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.login-title { font-family: var(--ff-d); font-size: 27px; font-weight: 600; color: var(--text-1); margin-bottom: 6px; letter-spacing: -.3px; }
.login-subtitle { font-size: 14px; color: var(--text-3); font-weight: 500; margin-bottom: 26px; }
.login-box .form-group { margin-bottom: 18px; }
.login-box .form-control { height: 48px; }
.login-label-row { display: flex; justify-content: space-between; align-items: baseline; }
.login-label-row a { font-size: 13px; font-weight: 700; }
.login-forgot { display: none; }
.login-btn {
  width: 100%; height: 50px;
  background: var(--ov-bleu); color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700; font-family: var(--ff-b);
  cursor: pointer; transition: var(--t); margin-top: 4px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-btn:hover { background: var(--ov-bleu-p); }
.login-btn svg { width: 18px; height: 18px; }
.login-footer { margin-top: 20px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.login-footer svg { width: 14px; height: 14px; flex-shrink: 0; }
.login-footer a { color: var(--text-3); text-decoration: underline; }
.login-footer a:hover { color: var(--ov-bleu); }

/* ============================================================
 UTILITAIRES
 ============================================================ */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty-state-icon { font-size: 42px; margin-bottom: 12px; opacity: .35; }
.empty-state h3 { font-size: 15px; color: var(--text-2); margin-bottom: 5px; font-family: var(--ff-d); }
.empty-state p { font-size: 13px; }

.pagination { display: flex; align-items: center; gap: 5px; padding: 14px 18px; border-top: 1px solid var(--border); justify-content: center; flex-wrap: wrap; }
.page-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; border: 1px solid var(--border-2); background: var(--bg-white); color: var(--text-2); cursor: pointer; transition: var(--t); text-decoration: none; }
.page-btn:hover { border-color: var(--ov-bleu); color: var(--ov-bleu); }
.page-btn.active { background: var(--ov-bleu); border-color: var(--ov-bleu); color: #fff; font-weight: 700; }

.gradient-text { color: var(--ov-bleu-p); }

/* Helpers */
.text-muted { color: var(--text-3); }
.text-mono  { font-family: var(--ff-m); }
.text-blue  { color: var(--ov-bleu); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-orange{ color: var(--orange); }
.fw-700 { font-weight: 700; } .fw-600 { font-weight: 600; }
.fs-11  { font-size: 11px; }  .fs-12  { font-size: 12px; }  .fs-13  { font-size: 13px; }
.d-flex { display: flex; }    .align-center { align-items: center; }
.gap-8  { gap: 8px; }         .gap-10 { gap: 10px; }  .gap-14 { gap: 14px; }
.mb-0   { margin-bottom: 0; } .mb-20  { margin-bottom: 20px; }
.mt-16  { margin-top: 16px; } .ml-auto{ margin-left: auto; }
.w-100  { width: 100%; }      .text-center { text-align: center; }

/* ── Burger menu ── */
.sidebar-toggle {
  display: none;
  background: var(--bg-white);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
}
.sidebar-toggle:hover { border-color: var(--ov-bleu); }
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-1);
  border-radius: 2px;
  transition: transform .22s ease, opacity .18s ease;
}
.sidebar-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar-toggle.open span:nth-child(2) { opacity: 0; }
.sidebar-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Filtre dates dashboard ── */
.dashboard-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.dashboard-filters label {
  font-family: var(--ff-l);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-right: 4px;
}
.date-input-wrap { display: flex; align-items: center; gap: 8px; }
.date-input-wrap input[type=date] {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  background: var(--bg-white);
  outline: none;
  cursor: pointer;
  transition: var(--t);
}
.date-input-wrap input[type=date]:focus { border-color: var(--ov-bleu); box-shadow: 0 0 0 3px rgba(10,108,241,.14); }
.filter-sep { color: var(--text-3); font-size: 13px; font-weight: 700; }
.dashboard-taux { margin-left: auto; font-size: 13px; color: var(--text-3); font-weight: 500; }
.dashboard-taux strong { color: var(--ov-succes); font-weight: 800; }

/* ── Repartition (dashboard) ── */
.repart-row { margin-bottom: 14px; }
.repart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.repart-bar { background: #EEF1F5; border-radius: 4px; height: 8px; overflow: hidden; }
.repart-bar > div { height: 100%; border-radius: 4px; background: var(--ov-bleu); transition: width .5s; }

/* ============================================================
 RESPONSIVE
 ============================================================ */

@media screen and (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

@media screen and (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-logo { display: flex; }
}

/* ── MOBILE (≤ 768px) ── */
@media screen and (max-width: 768px) {

  .sidebar {
    position: fixed !important;
    top: 0; left: 0;
    width: 264px !important;
    height: 100vh !important;
    height: 100dvh !important;
    transform: translateX(-264px) !important;
    transition: transform .28s ease !important;
    z-index: 300 !important;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 4px 0 24px rgba(13,19,33,.25) !important;
  }

  .crm-header {
    margin-left: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 0 12px !important;
  }
  .crm-main {
    margin-left: 0 !important;
    padding: 14px !important;
  }
  .crm-main::before { width: 320px; height: 320px; right: -110px; bottom: -120px; }

  .sidebar-footer {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  }
  .sidebar-nav {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar-toggle {
    display: flex !important;
    visibility: visible !important;
  }

  .sidebar-collapse-toggle { display: none !important; }
  html.layout--compact .sidebar { width: 264px !important; }
  html.layout--compact .crm-header,
  html.layout--compact .crm-main { margin-left: 0 !important; }
  html.layout--compact .sidebar .nav-label,
  html.layout--compact .sidebar .nav-section-label,
  html.layout--compact .sidebar .nav-badge,
  html.layout--compact .sidebar .user-info {
    display: initial !important;
  }
  html.layout--compact .sidebar .nav-badge { display: inline-flex !important; }
  html.layout--compact .sidebar .nav-item {
    justify-content: flex-start !important;
    padding: 0 12px !important;
    gap: 12px !important;
  }

  .header-title { font-size: 16px !important; min-width: 0; }
  .header-date  { display: none !important; }
  /* Regle commune : sur telephone, les boutons de l'en-tete tiennent sur une
     seule ligne. Ceux qui portent une icone (.btn-label) passent en icone
     seule 40 x 40 ; les autres (ajoutes par une page) restent compacts et la
     rangee defile horizontalement plutot que de deborder. */
  .crm-header { gap: 8px !important; }
  .header-actions { max-width: none; gap: 6px; }
  .header-actions .btn { padding: 0 10px; height: 40px; font-size: 12.5px; }
  .header-actions .btn:has(.btn-label) { width: 40px; padding: 0; justify-content: center; }
  .header-actions .btn .btn-label { display: none; }
  .header-actions .btn svg { width: 18px; height: 18px; }

  .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  .kpi-value { font-size: 26px !important; }
  .kpi-card  { padding: 14px 14px !important; min-height: 0 !important; }
  .kpi-label { font-size: 10px !important; }
  .kpi-sub   { font-size: 11.5px !important; }

  .detail-grid { grid-template-columns: 1fr !important; }
  .form-row    { grid-template-columns: 1fr !important; }
  .form-row-3  { grid-template-columns: 1fr !important; }
  .dash-grid   { grid-template-columns: 1fr !important; }

  .table-wrap,
  .card-body.no-pad {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-width: 100% !important;
  }
  .data-table {
    min-width: 480px !important;
    font-size: 12.5px !important;
    width: auto !important;
  }
  .data-table th,
  .data-table td {
    padding: 8px 10px !important;
    white-space: nowrap !important;
  }

  .col-sm-hide,
  .col-hide-sm { display: none !important; }

  .dashboard-filters {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .dashboard-taux { margin-left: 0; }
  .date-input-wrap { flex-wrap: wrap; gap: 6px; }

  .search-bar { flex-direction: column !important; gap: 8px !important; }
  .search-bar .form-group { min-width: 100% !important; }

  .login-form-wrap { padding: 24px 16px; align-items: flex-start; }
  .login-box { padding: 28px 22px 24px; }
}

/* ── PETIT MOBILE (≤ 480px) ── */
@media screen and (max-width: 480px) {
  .kpi-grid  { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .kpi-value { font-size: 24px !important; }
  .kpi-card  { padding: 12px !important; }
  .crm-main  { padding: 10px !important; }
  .data-table { min-width: 420px !important; }
  .card-header { padding: 10px 12px !important; }
  .card-body   { padding: 12px !important; }
  .page-btn    { width: 28px; height: 28px; font-size: 11px; }
  .col-hide-xs,
  .col-xs-hide { display: none !important; }
}

/* Barre laterale : pastilles visibles en mode retreci, deconnexion en bouton seul */
.logout-btn .logout-label { display: none; }
.sidebar-footer .logout-btn {
  width: 36px; height: 36px; padding: 0;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--ov-alu-border);
  background: #fff;
}
.sidebar-footer .logout-btn svg { width: 17px; height: 17px; }
@media screen and (min-width: 769px) {
  html.layout--compact .sidebar .nav-item { position: relative; }
  html.layout--compact .sidebar .nav-badge {
    display: inline-flex;
    position: absolute; top: 3px; left: 50%;
    margin: 0 0 0 3px;
    min-width: 18px; height: 18px; padding: 0 4px;
    font-size: 10px; border-radius: 9px;
    box-shadow: 0 0 0 2px #F4F6FA;
  }
  html.layout--compact .sidebar .user-avatar { display: none; }
}

/* ============================================================
 FENETRE PAR-DESSUS LA PAGE (composant commun) + CALCULETTE
 ============================================================ */
.btn-favicon { width: 15px; height: 15px; border-radius: 3px; object-fit: contain; flex-shrink: 0; }

.crm-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(13,19,33,.45);
}
.crm-modal[hidden] { display: none; }
.crm-modal-box {
  width: 100%; max-width: 420px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}
.crm-modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px 14px 20px;
  background: var(--bg-white);
  background-image: var(--ov-alu-stries), var(--ov-alu-h);
  border-bottom: 1px solid var(--ov-alu-border);
}
.crm-modal-title { flex: 1; display: flex; align-items: center; gap: 10px; font-family: var(--ff-d); font-size: 16px; font-weight: 600; color: var(--text-1); }
.crm-modal-title svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--ov-bleu); }
.crm-modal-close { font-size: 22px; line-height: 1; }
.crm-modal-body { padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.crm-modal .form-control { font-size: 16px; height: 48px; }
body.crm-modal-open { overflow: hidden; }

.calc-resultat {
  margin-top: 4px; padding: 18px 16px;
  text-align: center;
  background: var(--ov-brume);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.calc-prix {
  margin-top: 6px;
  font-family: var(--ff-d); font-size: 40px; font-weight: 700;
  color: var(--ov-bleu-p); line-height: 1.05; letter-spacing: -1px;
}
.calc-erreur { margin-top: 6px; font-size: 13px; color: var(--red); }
.calc-marge { margin-top: 18px; }
.calc-marge-ligne { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--text-2); }
.calc-marge-ligne strong { font-family: var(--ff-d); font-size: 17px; color: var(--text-1); }
.calc-marge.sous-plancher .calc-marge-ligne strong { color: var(--orange); }
.calc-marge-defaut { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.calc-curseur {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 36px; margin: 8px 0 2px;
  background: transparent; cursor: pointer; touch-action: pan-y;
}
.calc-curseur::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--border-2); }
.calc-curseur::-moz-range-track { height: 6px; border-radius: 3px; background: var(--border-2); }
.calc-curseur::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; margin-top: -11px;
  border-radius: 50%; background: var(--ov-bleu); border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(13,19,33,.3);
}
.calc-curseur::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%; background: var(--ov-bleu); border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(13,19,33,.3);
}
.calc-marge.sous-plancher .calc-curseur::-webkit-slider-thumb { background: var(--orange); }
.calc-marge.sous-plancher .calc-curseur::-moz-range-thumb { background: var(--orange); }
.calc-marge-bornes { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.calc-lien { background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 600; color: var(--ov-bleu); cursor: pointer; }
.calc-lien[hidden] { display: none; }
.calc-alerte {
  margin-top: 10px; padding: 8px 12px;
  font-size: 13px; font-weight: 600;
  color: var(--orange); background: var(--orange-bg);
  border-radius: var(--r-sm);
}
.calc-alerte[hidden] { display: none; }
.calc-info-btn { font-family: var(--ff-d); font-size: 16px; font-weight: 700; font-style: italic; }
.calc-info {
  margin-bottom: 16px; padding: 12px 14px;
  font-size: 13px; line-height: 1.5; color: var(--text-2);
  background: #EAF2FE; border: 1px solid #B9D4FB; border-radius: var(--r-sm);
}
.calc-info[hidden] { display: none; }
.calc-info p { margin: 0 0 8px; }
.calc-info p:last-child { margin-bottom: 0; }
.calc-info ul { margin: 0 0 8px; padding-left: 18px; }
.calc-info li { margin-bottom: 2px; }
.calc-info-titre { font-weight: 700; color: var(--text-1); margin-top: 10px !important; margin-bottom: 4px !important; }

@media screen and (max-width: 768px) {
  .crm-modal { align-items: flex-end; padding: 0; }
  .crm-modal-box {
    max-width: none; max-height: 92vh; max-height: 92dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
  }
  .crm-modal-body { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .header-actions .btn-favicon { width: 18px; height: 18px; }
}
