/* ============================================================
   Marcel — Outil de chiffrage
   style.css — Design SaaS corporate
   ============================================================ */

:root {
  --primary:        #2563eb;
  --primary-dark:   #1d4ed8;
  --primary-light:  #eff6ff;
  --secondary:      #3b82f6;
  --accent:         #f59e0b;
  --success:        #059669;
  --success-light:  #ecfdf5;
  --warning:        #d97706;
  --warning-light:  #fffbeb;
  --danger:         #dc2626;
  --danger-light:   #fef2f2;
  --purple:         #7c3aed;
  --purple-light:   #f5f3ff;
  --info:           #0ea5e9;

  --bg:             #f7f9fc;
  --bg-dark:        #f1f5f9;
  --sidebar-bg:     #131929;
  --sidebar-hover:  #1e2d47;
  --sidebar-active-bg: rgba(37,99,235,.15);
  --sidebar-active-border: #2563eb;
  --white:          #ffffff;

  --text:           #0f172a;
  --text-light:     #64748b;
  --text-muted:     #94a3b8;
  --border:         #e5e7eb;
  --border-light:   #f1f5f9;

  --sidebar-w:      224px;
  --sidebar-w-collapsed: 64px;
  --header-h:       60px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:  0 10px 32px rgba(0,0,0,.12);

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 14px;

  --t:    all .15s ease;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html, body {
  height: 100%; font-family: var(--font); font-size: 14px;
  color: var(--text); background: var(--bg); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-x: none;
}

/* ============================================================
   LAYOUT
   ============================================================ */

#app { display: flex; height: 100vh; overflow: hidden; }

/* ---- SIDEBAR ---- */

#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(255,255,255,.04);
  z-index: 10;
  transition: width .18s ease;
}

/* Logo zone */
.sidebar-logo {
  position: relative;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-mark {
  width: 36px;
  height: 36px;
  background: rgba(37,99,235,.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  flex-shrink: 0;
}
.logo-text { display: flex; flex-direction: column; gap: 1px; }
.logo-main {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.logo-sub {
  font-size: 11px;
  color: #60a5fa;
  font-weight: 500;
  line-height: 1.2;
}
.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  margin-left: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-md);
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--t);
  flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
  background: var(--sidebar-hover);
  color: #fff;
}
.sidebar-collapse-icon {
  transition: transform .18s ease;
}

/* Nav items */
.sidebar-nav { flex: 1; padding: 10px 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: rgba(255,255,255,.55);
  cursor: pointer;
  transition: var(--t);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 1px;
  border-left: 2px solid transparent;
  user-select: none;
  white-space: nowrap;
}
.nav-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,.85); }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--sidebar-active-border);
}
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.nav-label { flex: 1; }

body.sidebar-collapsed #sidebar {
  width: var(--sidebar-w-collapsed);
}
body.sidebar-collapsed .sidebar-logo {
  justify-content: center;
  padding: 16px 8px;
}
body.sidebar-collapsed .logo-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .profile-info,
body.sidebar-collapsed .profile-logout-icon {
  display: none;
}
body.sidebar-collapsed .sidebar-collapse-btn {
  margin-left: 0;
  position: absolute;
  left: 46px;
  top: 16px;
  width: 24px;
  height: 24px;
  background: #1e2d47;
  box-shadow: var(--shadow-sm);
}
body.sidebar-collapsed .sidebar-collapse-icon {
  transform: rotate(180deg);
}
body.sidebar-collapsed .nav-item,
body.sidebar-collapsed .sidebar-profile {
  justify-content: center;
  padding-left: 10px;
  padding-right: 10px;
}
body.sidebar-collapsed .nav-icon {
  width: 22px;
}
body.sidebar-collapsed .sidebar-profile {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Sidebar bottom */
.sidebar-bottom {
  padding: 8px 8px 12px;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* Profile */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 4px;
  cursor: pointer;
  border-radius: var(--r-md);
  transition: var(--t);
}
.sidebar-profile:hover { background: var(--sidebar-hover); }
.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(37,99,235,.3);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.profile-info { display: flex; flex-direction: column; min-width: 0; }
.profile-name { font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,.85); }
.profile-role { font-size: 11px; color: rgba(255,255,255,.35); }

/* ---- MAIN AREA ---- */

#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

#main-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  flex-shrink: 0;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.crumb-sep     { color: var(--border); font-size: 14px; font-weight: 400; }
.crumb-current { color: var(--text); font-weight: 700; }
.header-breadcrumb span[onclick]:hover { color: var(--primary); cursor: pointer; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.header-icons {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}
.header-icon-btn {
  width: 34px; height: 34px;
  background: transparent; border: none;
  border-radius: var(--r-md);
  color: var(--text-light);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--t);
}
.header-icon-btn:hover { background: var(--bg); color: var(--text); }

#content { flex: 1; overflow-y: auto; padding: 28px; }

#main-footer {
  padding: 10px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--white);
  flex-shrink: 0;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title    { font-size: 14px; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--text-light); margin-top: 1px; }
.card-body     { padding: 20px; }
.card-footer   {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ============================================================
   DASHBOARD — QUICK ACTIONS
   ============================================================ */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.quick-action-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--t);
  text-decoration: none;
}
.quick-action-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}
.quick-action-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.quick-action-content { flex: 1; min-width: 0; }
.quick-action-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.3; }
.quick-action-desc  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }
.quick-action-arrow { color: var(--text-muted); flex-shrink: 0; display: flex; align-items: center; }

/* ============================================================
   DASHBOARD — STATS KPI
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--r-xl);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.stat-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.stat-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  white-space: nowrap;
}
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-delta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.stat-delta.positive { color: var(--success); }
.stat-delta.negative { color: var(--danger); }
.stat-icon-wrap {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-blue   { background: var(--primary-light); color: var(--primary); }
.kpi-green  { background: var(--success-light);  color: var(--success); }
.kpi-purple { background: var(--purple-light);   color: var(--purple); }
.kpi-amber  { background: var(--warning-light);  color: var(--warning); }

/* ============================================================
   DASHBOARD — LOWER GRID (2 cols)
   ============================================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}
.dashboard-col { display: flex; flex-direction: column; gap: 20px; }

/* ============================================================
   CARD SECTION HEADER (with link)
   ============================================================ */

.card-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-section-title { font-size: 14px; font-weight: 700; color: var(--text); }
.card-section-link {
  font-size: 12px; font-weight: 600; color: var(--primary);
  text-decoration: none; cursor: pointer;
  transition: var(--t);
}
.card-section-link:hover { color: var(--primary-dark); text-decoration: underline; }

/* ============================================================
   DASHBOARD — PANNEAU DE PERSONNALISATION DES WIDGETS
   ============================================================ */

.wc-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.35);
  z-index: 1100;
  opacity: 0;
  transition: opacity .25s;
}
#dashboard-config-panel.open .wc-overlay { opacity: 1; }

.wc-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 320px;
  background: var(--white);
  box-shadow: -4px 0 24px rgba(0,0,0,.12);
  z-index: 1101;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
#dashboard-config-panel.open .wc-drawer { transform: translateX(0); }

.wc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.wc-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.wc-body {
  flex: 1; overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 20px;
}
.wc-desc { font-size: 12.5px; color: var(--text-muted); margin: 0 0 4px; line-height: 1.5; }

.wc-group-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text-muted);
  margin-bottom: 8px;
}
.wc-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
}
.wc-item:last-child { border-bottom: none; }
.wc-label { font-size: 13px; color: var(--text); font-weight: 500; }

/* Toggle switch */
.wc-toggle {
  position: relative; display: inline-block;
  width: 38px; height: 22px; flex-shrink: 0;
}
.wc-toggle input { opacity: 0; width: 0; height: 0; }
.wc-slider {
  position: absolute; inset: 0;
  background: #cbd5e1;
  border-radius: 22px;
  cursor: pointer;
  transition: background .2s;
}
.wc-slider::after {
  content: '';
  position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.wc-toggle input:checked + .wc-slider { background: var(--primary); }
.wc-toggle input:checked + .wc-slider::after { transform: translateX(16px); }

.wc-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
   TABLEAU DE BORD — TABLEAUX
   ============================================================ */

.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  background: var(--bg);
  padding: 9px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
.td-actions { text-align: right; white-space: nowrap; }
.td-name { font-weight: 600; color: var(--text); }
.td-sub  { font-size: 12px; color: var(--text-light); }

/* Row dot indicator */
.row-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.dot-blue   { background: #2563eb; }
.dot-purple { background: #7c3aed; }
.dot-green  { background: #059669; }
.dot-amber  { background: #d97706; }
.dot-red    { background: #dc2626; }
.dot-gray   { background: #94a3b8; }

/* ============================================================
   ACTIVITE RECENTE
   ============================================================ */

.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: var(--t);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: #f8fafc; }
.activity-icon {
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.activity-icon.blue   { background: var(--primary-light); color: var(--primary); }
.activity-icon.green  { background: var(--success-light);  color: var(--success); }
.activity-icon.amber  { background: var(--warning-light);  color: var(--warning); }
.activity-icon.purple { background: var(--purple-light);   color: var(--purple); }
.activity-body { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 600; color: var(--text); }
.activity-sub   { font-size: 12px; color: var(--text-light); margin-top: 1px; }
.activity-time  { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ============================================================
   OFFRES A RELANCER
   ============================================================ */

.relance-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
}
.relance-row:last-child { border-bottom: none; }
.relance-row:hover { background: #f8fafc; }
.relance-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--warning-light);
  color: var(--warning);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.relance-info { flex: 1; min-width: 0; }
.relance-name   { font-size: 13px; font-weight: 600; color: var(--text); }
.relance-client { font-size: 12px; color: var(--text-light); }
.relance-date   { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.relance-montant { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; margin-right: 8px; }

/* ============================================================
   DONUT CHART
   ============================================================ */

.donut-section {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
}
.donut-chart { flex-shrink: 0; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.legend-label { display: flex; align-items: center; gap: 8px; color: var(--text-light); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.legend-pct { font-weight: 700; color: var(--text); font-size: 13px; }
.donut-total { font-size: 11.5px; color: var(--text-muted); padding: 12px 20px; border-top: 1px solid var(--border); }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}

/* Statut chiffrage */
.badge-brouillon { background: #f1f5f9; color: #64748b; }
.badge-envoye    { background: var(--primary-light); color: var(--primary); }
.badge-accepte   { background: var(--success-light); color: var(--success); }
.badge-refuse    { background: var(--danger-light); color: var(--danger); }

/* Type */
.badge-residence   { background: var(--primary-light); color: var(--primary); }
.badge-bureaux     { background: var(--purple-light); color: var(--purple); }
.badge-base_de_vie { background: var(--warning-light); color: var(--warning); }
.badge-ponctuel    { background: #fef5ec; color: #ea580c; }

/* Étape workflow */
.badge-etape-visite    { background: var(--warning-light); color: var(--warning); border-radius: var(--r-sm); }
.badge-etape-chiffrage { background: var(--primary-light); color: var(--primary); border-radius: var(--r-sm); }
.badge-etape-scenarios { background: var(--purple-light); color: var(--purple); border-radius: var(--r-sm); }
.badge-etape-offre     { background: var(--success-light); color: var(--success); border-radius: var(--r-sm); }
.badge-etape-acceptee  { background: var(--success-light); color: var(--success); border-radius: var(--r-sm); }
.badge-etape-refusee   { background: var(--danger-light); color: var(--danger); border-radius: var(--r-sm); }

/* ============================================================
   BOUTONS
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r-md);
  border: 1.5px solid transparent; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--t); white-space: nowrap;
  text-decoration: none; font-family: var(--font);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled)  { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(37,99,235,.3); }

.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-secondary:hover:not(:disabled) { background: var(--primary); box-shadow: var(--shadow-md); }

.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #047857; }

.btn-danger   { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled)  { background: #b91c1c; }

.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--bg); border-color: #94a3b8; }

.btn-ghost    { background: transparent; color: var(--text-light); border-color: transparent; }
.btn-ghost:hover:not(:disabled)   { background: var(--bg); color: var(--text); }

.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 11px 24px; font-size: 14px; font-weight: 600; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

/* ============================================================
   FORMULAIRES
   ============================================================ */

.form-grid   { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.full-width  { grid-column: 1 / -1; }

label {
  font-size: 11.5px; font-weight: 600; color: var(--text-light);
  text-transform: uppercase; letter-spacing: .4px;
}
label .required { color: var(--danger); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="url"],
select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-size: 13.5px; color: var(--text); background: var(--white);
  transition: var(--t); font-family: var(--font); outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 72px; }

/* ============================================================
   ASSISTANT TRANSCRIPTION DE VISITE — NOUVEAU CHIFFRAGE
   ============================================================ */

.client-demand-assistant {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #f8fafc;
}
.client-demand-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.client-demand-sub {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.4;
}
.client-demand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.client-demand-preview {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--r-md);
  color: var(--text-muted);
  background: var(--white);
  font-size: 12.5px;
  line-height: 1.45;
}
.client-demand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.client-demand-grid div {
  display: grid;
  gap: 2px;
  padding: 8px 9px;
  border-radius: var(--r-md);
  background: #eef6ff;
}
.client-demand-grid span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.client-demand-grid strong {
  color: var(--text);
  font-size: 12.5px;
}
.client-demand-insights {
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  border: 1px solid #dbeafe;
  background: #f8fbff;
}
.client-demand-insights.warning {
  border-color: #fde68a;
  background: #fffbeb;
}
.client-demand-insights.missing {
  border-color: #fecaca;
  background: #fff7f7;
}
.client-demand-insights.coefficient {
  border-color: #ddd6fe;
  background: #f5f3ff;
}
.client-demand-insights-title {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.client-demand-insights ul {
  margin: 0;
  padding-left: 17px;
}
.client-demand-insights li {
  margin: 2px 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}
.client-demand-status {
  min-height: 18px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}
.client-demand-status.success { color: var(--success); }
.client-demand-status.warning { color: var(--warning); }

@media (max-width: 760px) {
  .client-demand-head {
    display: grid;
  }
  .client-demand-actions {
    justify-content: stretch;
  }
  .client-demand-actions .btn {
    flex: 1 1 auto;
  }
}

/* ============================================================
   ASSISTANT IA OFFRES
   ============================================================ */

.ai-offer-panel {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #fbfdff;
  overflow: hidden;
}
.ai-offer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}
.ai-offer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.ai-offer-subtitle {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}
.ai-offer-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}
.ai-offer-action {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  transition: var(--t);
  text-align: center;
}
.ai-offer-action:hover {
  border-color: #bfdbfe;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.ai-offer-status {
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 7px;
}
.ai-offer-preview {
  margin: 0 16px 14px;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: var(--r-md);
  background: var(--white);
}
.ai-preview-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.ai-preview-summary {
  font-size: 12.5px;
  color: var(--text-light);
  margin-bottom: 12px;
}
.ai-preview-block {
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 0;
  margin-bottom: 12px;
}
.ai-preview-block label,
.ai-preview-grid label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}
.ai-preview-block p {
  white-space: pre-wrap;
  font-size: 13px;
  color: var(--text);
  margin: 0;
}
.ai-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  font-size: 12.5px;
  color: var(--text-light);
}
.ai-preview-grid ul {
  margin: 0 0 0 18px;
  padding: 0;
}
.ai-offer-footer {
  display: flex;
  justify-content: flex-end;
  padding: 0 16px 16px;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-hint { font-size: 11.5px; color: var(--text-muted); }

/* Champ requis manquant */
.form-group.has-error label { color: var(--danger); }
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--danger) !important;
  background-color: #fff5f5;
}
.form-group.has-error input:focus,
.form-group.has-error select:focus,
.form-group.has-error textarea:focus {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.form-error-msg {
  font-size: 11.5px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
}
.required-star { color: var(--danger); margin-left: 2px; font-weight: 700; }

/* Avertissement champ */
.form-group.has-warning label { color: var(--warning); }
.form-group.has-warning input,
.form-group.has-warning select,
.form-group.has-warning textarea {
  border-color: var(--warning) !important;
  background-color: #fffbf0;
}
.form-group.has-warning input:focus,
.form-group.has-warning select:focus,
.form-group.has-warning textarea:focus {
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 3px rgba(217,119,6,.12);
}
.form-group.has-warning .form-error-msg { color: var(--warning); }

.input-addon { display: flex; align-items: stretch; }
.input-addon input { border-radius: var(--r-md) 0 0 var(--r-md); flex: 1; }
.input-addon .addon {
  background: var(--bg-dark); border: 1.5px solid var(--border);
  border-left: none; border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 0 11px; display: flex; align-items: center;
  font-size: 12.5px; color: var(--text-light); white-space: nowrap;
}

.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--secondary); }

/* ---- Autocomplete adresse ---- */
.fd-autocomplete {
  position: fixed; z-index: 9999;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  overflow: hidden; min-width: 280px; max-width: 480px;
}
.fd-autocomplete-item {
  padding: 10px 14px; cursor: pointer;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
  transition: background .12s;
}
.fd-autocomplete-item:last-child { border-bottom: none; }
.fd-autocomplete-item:hover, .fd-autocomplete-item.fd-ac-focus { background: var(--primary-light); }
.fd-autocomplete-item-main { font-size: 13px; color: var(--text); font-weight: 500; }
.fd-autocomplete-item-sub  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   WIZARD
   ============================================================ */

.wizard { display: flex; flex-direction: column; gap: 18px; }
.wizard-steps { display: flex; align-items: flex-start; overflow-x: auto; padding: 4px 0; }

.wizard-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 90px; position: relative; flex: 1;
}
.wizard-step:not(:last-child)::after {
  content: ''; position: absolute;
  top: 16px; left: calc(50% + 18px); right: calc(-50% + 18px);
  height: 2px; background: var(--border); z-index: 0;
}
.wizard-step.done:not(:last-child)::after { background: var(--secondary); }

.step-circle {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  position: relative; z-index: 1; transition: var(--t);
}
.wizard-step.done   .step-circle { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.wizard-step.active .step-circle {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 0 0 5px rgba(37,99,235,.15);
}
.step-label { font-size: 11px; color: var(--text-muted); text-align: center; line-height: 1.3; }
.wizard-step.active .step-label { color: var(--primary); font-weight: 700; }
.wizard-step.done   .step-label { color: var(--secondary); }

.wizard-content { min-height: 380px; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; }
.wizard-nav-info { font-size: 12px; color: var(--text-muted); }
.scenario-detail-row { grid-template-columns: minmax(0,1fr) 120px auto; }

/* ============================================================
   TYPE SELECTION CARDS
   ============================================================ */

.type-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; max-width: 580px; margin: 0 auto;
}
.type-card {
  background: var(--white); border: 2px solid var(--border);
  border-radius: var(--r-xl); padding: 24px 20px;
  cursor: pointer; transition: var(--t); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.type-card:hover    { border-color: var(--secondary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.type-card.selected { border-color: var(--primary); background: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.type-icon {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.type-card.selected .type-icon { background: rgba(37,99,235,.15); }
.type-name { font-size: 14px; font-weight: 700; color: var(--text); }
.type-desc { font-size: 12px; color: var(--text-light); line-height: 1.4; }

/* ============================================================
   SCÉNARIOS
   ============================================================ */

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

.scenario-card {
  background: var(--white); border: 2px solid var(--border);
  border-radius: var(--r-xl); overflow: hidden;
  transition: var(--t); position: relative;
}
.scenario-card.recommended { border-color: var(--secondary); }
.scenario-badge {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  background: var(--secondary); color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 3px 12px; border-radius: 0 0 8px 8px; letter-spacing: .5px;
}
.scenario-header { padding: 22px 16px 14px; border-bottom: 1px solid var(--border); text-align: center; }
.scenario-name   { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.scenario-description { font-size: 12px; color: var(--text-light); }
.scenario-price  { padding: 16px; text-align: center; background: var(--bg); }
.scenario-price-ht  { font-size: 24px; font-weight: 800; color: var(--text); }
.scenario-price-ttc { font-size: 12.5px; color: var(--text-light); margin-top: 3px; }
.scenario-margin-control {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--white);
  font-size: 11.5px;
  color: var(--text-muted);
}
.scenario-margin-control input[type="range"] { width: 100%; accent-color: var(--secondary); }
.scenario-details { padding: 14px 16px; }
.scenario-footer  { padding: 12px 16px; border-top: 1px solid var(--border); }

.prest-sort-row[draggable="true"] { cursor: grab; }
.prest-sort-row[draggable="true"]:active { cursor: grabbing; }
.prest-sort-row.prest-sort-dragging {
  opacity: .45;
  background: var(--primary-light);
}
.prest-sort-row.prest-sort-over {
  outline: 2px solid var(--secondary);
  outline-offset: -2px;
  background: #f8fbff;
}
.prest-drag-handle {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: var(--white);
}
.prest-drag-handle:hover {
  color: var(--text);
  border-color: var(--secondary);
}

/* ============================================================
   HEADINGS
   ============================================================ */

.page-title    { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.page-subtitle { font-size: 13px; color: var(--text-light); margin-bottom: 22px; }
.section-title {
  font-size: 13.5px; font-weight: 700; color: var(--text);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.divider { height: 1px; background: var(--border); margin: 22px 0; }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px;
  color: var(--text-muted); text-align: center; gap: 12px;
}
.empty-state-icon { font-size: 52px; opacity: .35; }
.empty-state h3   { font-size: 16px; color: var(--text-light); }
.empty-state p    { font-size: 13px; max-width: 320px; }

/* ============================================================
   ALERTES
   ============================================================ */

.alert {
  padding: 12px 16px; border-radius: var(--r-md);
  font-size: 13px; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-info    { background: var(--primary-light); color: #1d4ed8; border-left: 4px solid var(--secondary); }
.alert-success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.alert-warning { background: var(--warning-light); color: #92400e; border-left: 4px solid var(--warning); }

/* ============================================================
   MODULE PLACEHOLDER
   ============================================================ */

.module-placeholder {
  background: var(--white); border: 2px dashed var(--border);
  border-radius: var(--r-xl); padding: 48px 40px; text-align: center;
  color: var(--text-muted); margin-bottom: 24px;
}
.module-placeholder h3 { font-size: 17px; margin-bottom: 8px; color: var(--text-light); }
.module-placeholder p  { font-size: 13px; line-height: 1.7; }

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text); color: #fff;
  padding: 12px 18px; border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  opacity: 0; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
  z-index: 9999; max-width: 380px;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--success); }
.toast-warning { background: var(--warning); color: #fff; }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--primary); }

/* ============================================================
   PRINT
   ============================================================ */

@media print {
  #sidebar, #main-header, .wizard-nav, .header-actions, .btn, #main-footer { display: none !important; }
  #main { width: 100%; }
  #content { padding: 0; overflow: visible; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}

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

@media (max-width: 1300px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .quick-actions  { grid-template-columns: repeat(2, 1fr); }
  .stats-grid     { grid-template-columns: repeat(2, 1fr); }
  .ai-offer-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  :root { --sidebar-w: 64px; }
  .logo-text, .nav-label, .profile-info { display: none; }
  .sidebar-logo { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 10px; }
  .sidebar-profile { justify-content: center; }
  .ai-preview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  #sidebar             { display: none; }
  .scenarios-grid      { grid-template-columns: 1fr; }
  .type-grid           { grid-template-columns: 1fr; }
  .form-grid-2,
  .form-grid-3         { grid-template-columns: 1fr; }
  .stats-grid          { grid-template-columns: 1fr 1fr; }
  .quick-actions       { grid-template-columns: 1fr 1fr; }
  #content             { padding: 16px; }
  .ai-offer-actions    { grid-template-columns: 1fr; }
  .wizard-nav          { align-items: flex-start; gap: 10px; flex-direction: column; }
  .wizard-nav > div    { width: 100%; justify-content: space-between !important; }
  .scenario-detail-row { grid-template-columns: minmax(0,1fr) 104px auto !important; }
  .scenario-detail-row input { font-size: 11px !important; }
}

/* ============================================================
   PAGE CHIFFRAGES — Bibliothèque & gestion des devis
   ============================================================ */

/* Grille 8 cartes stats (4 × 2) */
.chiff-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.chiff-stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
  box-shadow: var(--shadow-sm);
  transition: var(--t);
}
.chiff-stat-card:hover { box-shadow: var(--shadow-md); }

.chiff-stat-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Couleurs icônes stats */
.cs-blue   { background: var(--primary-light); color: var(--primary); }
.cs-purple { background: var(--purple-light);  color: var(--purple);  }
.cs-amber  { background: var(--warning-light); color: var(--warning); }
.cs-orange { background: #fff7ed;              color: #ea580c;        }
.cs-green  { background: var(--success-light); color: var(--success); }

.chiff-stat-body { flex: 1; min-width: 0; }
.chiff-stat-value {
  font-size: 19px; font-weight: 800; color: var(--text);
  line-height: 1.2; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.chiff-stat-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Zone filtres */
.chiff-filters-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

/* Barre de recherche */
.chiff-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.chiff-search-icon {
  position: absolute; left: 12px;
  color: var(--text-muted);
  display: flex; align-items: center;
  pointer-events: none; z-index: 1;
}
.chiff-search-input {
  width: 100%;
  padding: 9px 38px 9px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13.5px; color: var(--text);
  background: var(--bg); transition: var(--t);
  font-family: var(--font); outline: none;
}
.chiff-search-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  background: var(--white);
}
.chiff-search-clear {
  position: absolute; right: 10px;
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center;
  padding: 4px; border-radius: var(--r-sm);
}
.chiff-search-clear:hover { color: var(--text); background: var(--bg); }

/* Ligne filtres avancés */
.chiff-filter-row {
  display: flex; gap: 8px;
  flex-wrap: wrap; align-items: center;
}
.chiff-filter-select {
  flex: 1; min-width: 150px; max-width: 215px;
  padding: 7px 28px 7px 10px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-size: 12.5px; color: var(--text);
  background-color: var(--bg); font-family: var(--font);
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: var(--t);
}
.chiff-filter-select:focus { outline: none; border-color: var(--secondary); }

.chiff-filter-input {
  flex: 1; min-width: 120px; max-width: 150px;
  padding: 7px 10px;
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  font-size: 12.5px; color: var(--text);
  background: var(--bg); font-family: var(--font);
  transition: var(--t);
}
.chiff-filter-input:focus { outline: none; border-color: var(--secondary); }

.chiff-filter-active {
  background-color: var(--primary-light) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

/* Entête tableau */
.chiff-table-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.chiff-table-count {
  font-size: 12px; color: var(--text-muted); font-weight: 500;
}

/* La card du tableau n'utilise pas overflow:hidden pour que le menu soit visible */
.chiff-table-card { overflow: visible; }

/* En-têtes triables */
.chiff-th-sort {
  cursor: pointer; user-select: none; transition: color .1s;
}
.chiff-th-sort:hover { color: var(--text); }

/* Menu actions par ligne */
.chiff-menu-wrap {
  position: relative; display: inline-block;
}
.chiff-menu-dropdown {
  display: none;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 185px;
  z-index: 1000;
  padding: 5px;
}
.chiff-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--text);
  cursor: pointer; border-radius: var(--r-sm); transition: var(--t);
  white-space: nowrap;
}
.chiff-menu-item:hover { background: var(--bg); }
.chiff-menu-item-danger { color: var(--danger); }
.chiff-menu-item-danger:hover { background: var(--danger-light); }
.chiff-menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* Statut commercial de l'offre : le badge seul n'est pas cliquable, c'est ce
   bouton qui ouvre le menu de changement de statut. */
.chiff-td-offer { white-space: nowrap; }
.chiff-offer-status-btn {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 4px 2px 2px;
  background: none; border: 1px solid transparent; border-radius: var(--r-sm);
  color: var(--text-light); cursor: pointer; transition: var(--t);
}
.chiff-offer-status-btn:hover { border-color: var(--border); background: var(--bg); }
.chiff-offer-status-btn:focus-visible { outline: 2px solid var(--secondary); outline-offset: 1px; }

/* Chargement progressif */
.chiff-load-more {
  display: flex; justify-content: center; padding: 20px 0 4px;
}

/* Colonne cases à cocher */
.chiff-th-cb, .chiff-td-cb {
  width: 36px; min-width: 36px; padding: 0 8px; text-align: center;
}
.chiff-cb {
  width: 15px; height: 15px;
  accent-color: var(--secondary);
  cursor: pointer;
  vertical-align: middle;
}
.chiff-row-selected { background: var(--primary-light) !important; }

/* Barre d'actions groupées (flottante en bas) */
.chiff-bulk-bar {
  position: fixed;
  bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 10px 18px;
  display: flex; align-items: center; gap: 16px;
  border-radius: 40px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.28);
  z-index: 990;
  white-space: nowrap;
  animation: chiffBulkIn 0.18s ease;
}
@keyframes chiffBulkIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.chiff-bulk-count {
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.chiff-bulk-hint {
  color: rgba(255,255,255,0.65);
  font-size: 12px;
}
.chiff-bulk-actions { display: flex; gap: 8px; }
.chiff-bulk-btn-cancel {
  color: rgba(255,255,255,0.75);
  border-color: rgba(255,255,255,0.25);
  background: transparent;
}
.chiff-bulk-btn-cancel:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.4);
}

/* Badges statuts — page Chiffrages */
.badge-st-brouillon  { background: #f1f5f9;             color: #64748b; }
.badge-st-visite     { background: var(--warning-light); color: var(--warning); }
.badge-st-redaction  { background: #eff6ff;              color: #2563eb; }
.badge-st-offre-gen  { background: var(--purple-light);  color: var(--purple); }

/* ---- Gestion des accès : console permissions ---- */
.ga-permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.ga-permission-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.ga-permission-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
}

.ga-permission-item:has(input:disabled) {
  opacity: .65;
  cursor: default;
}
.badge-st-envoye     { background: var(--primary-light); color: var(--primary); }
.badge-st-relance    { background: #fff7ed;              color: #ea580c; }
.badge-st-signe      { background: var(--success-light); color: var(--success); }
.badge-st-refuse     { background: var(--danger-light);  color: var(--danger); }
.badge-st-archive    { background: #f1f5f9;              color: #94a3b8; }

/* Badge type "Autre" */
.badge-type-autre { background: #f0fdf4; color: #16a34a; }

/* ---- Paramètres — accordion ---- */
.params-acc-header {
  cursor: pointer;
  user-select: none;
  border-bottom: none;
  transition: background 0.15s;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.params-acc-header:hover {
  background: var(--bg);
}
.params-acc-chevron {
  color: var(--text-light);
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
/* quand la section est ouverte, remettre la ligne séparatrice */
.params-acc-header + .card-body {
  border-top: 1px solid var(--border);
}

/* ============================================================
   MODULE AIDE
   ============================================================ */

.help-toolbar {
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.help-search {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--text-muted);
}
.help-search input {
  border: 0;
  box-shadow: none;
  padding-left: 0;
}
.help-search input:focus {
  box-shadow: none;
  border-color: transparent;
}
.help-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.help-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 20px;
  align-items: start;
}
.help-main,
.help-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.help-topic-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.help-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.75;
}
.help-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.help-list p,
.help-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-light);
}
.help-list strong { color: var(--text); }
.help-alert-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.help-code {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  background: var(--bg);
}
.help-code span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 8px;
}
.help-code p {
  margin: 0;
  color: var(--text-light);
  font-size: 12.5px;
  line-height: 1.55;
}
.help-checks {
  margin: 0;
  padding-left: 18px;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1.8;
}
.help-mini {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.help-mini:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.help-mini strong { color: var(--text); }
.help-mini span {
  color: var(--text-light);
  line-height: 1.45;
}

/* Responsive */
@media (max-width: 1200px) {
  .chiff-stats-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 960px) {
  .chiff-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .chiff-filter-select { max-width: none; }
  .help-layout { grid-template-columns: 1fr; }
  .help-alert-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .chiff-stats-grid { grid-template-columns: 1fr 1fr; }
  .chiff-filter-input { max-width: none; }
  .help-toolbar { align-items: stretch; flex-direction: column; }
  .help-toolbar-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; }
  .help-toolbar-actions .btn { justify-content: center; padding-left: 8px; padding-right: 8px; }
  .help-mini { grid-template-columns: 1fr; }
}

/* ============================================================
   AUTHENTIFICATION — Overlay de connexion
   ============================================================ */

#auth-overlay {
  display: none; /* géré par auth.js */
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
}

#auth-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
}

.auth-logo-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-logo-mark {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.auth-brand-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.auth-brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.auth-heading {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
  transition: var(--t);
  outline: none;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.auth-error-msg {
  font-size: 13px;
  color: var(--danger);
  background: var(--danger-light);
  border: 1px solid #fecaca;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
}

.auth-submit-btn {
  display: block;
  width: 100%;
  height: 42px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--t);
  margin-top: 8px;
}

.auth-submit-btn:hover:not(:disabled) { background: var(--primary-dark); }
.auth-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

.auth-switch-text {
  font-size: 13px;
  color: var(--text-light);
  text-align: center;
  margin-top: 16px;
}

.auth-switch-text a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.auth-switch-text a:hover { text-decoration: underline; }

.auth-invite-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
}

.auth-invite-note a {
  color: var(--text-light);
  text-decoration: none;
}

.auth-invite-note a:hover { text-decoration: underline; }

.auth-setup-note {
  font-size: 12px;
  color: var(--text-light);
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.auth-config-error {
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.7;
}

.auth-config-error code {
  background: var(--bg-dark);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* Profil sidebar — bouton déconnexion */
.sidebar-profile-btn {
  cursor: pointer;
  transition: var(--t);
}

.sidebar-profile-btn:hover {
  background: var(--sidebar-hover);
  border-radius: var(--r-md);
}

.profile-logout-icon {
  margin-left: auto;
  opacity: 0;
  transition: opacity .15s;
  color: rgba(255,255,255,.6);
  flex-shrink: 0;
}

.sidebar-profile-btn:hover .profile-logout-icon {
  opacity: 1;
}

/* ============================================================
   GESTION DES ACCÈS — Modal & identifiants
   ============================================================ */

.ga-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1000;
}

.ga-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  z-index: 1001;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ga-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.ga-modal-title { font-size: 15px; font-weight: 700; color: var(--text); }

.ga-modal-close {
  width: 28px; height: 28px;
  background: none; border: none;
  font-size: 20px; line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
}
.ga-modal-close:hover { background: var(--bg); color: var(--text); }

.ga-modal-body {
  padding: 20px;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
}
.ga-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
  max-height: 34vh;
  overflow-y: auto;
  background: var(--white);
}
.ga-modal-footer > .btn { white-space: nowrap; }
.ga-modal-footer > .btn:first-child { margin-right: auto; }

@media (max-width: 640px) {
  .ga-modal {
    max-height: calc(100vh - 20px);
    width: calc(100% - 20px) !important;
  }
  .ga-modal-header,
  .ga-modal-body,
  .ga-modal-footer {
    padding-left: 14px;
    padding-right: 14px;
  }
  .ga-modal-footer {
    justify-content: stretch;
    max-height: 42vh;
  }
  .ga-modal-footer > .btn {
    flex: 1 1 auto;
  }
  .ga-modal-footer > .btn:first-child {
    margin-right: 0;
  }
}

.ga-credentials-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}

.ga-cred-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}
.ga-cred-row:last-child { border-bottom: none; }

.ga-cred-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  width: 80px;
  flex-shrink: 0;
}

.ga-cred-value {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  word-break: break-all;
}

/* ============================================================
   Ajustements client — interface client / tablette (page publique)
   ============================================================ */

#client-view-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  overflow-y: auto;
  background: var(--bg);
}

.cv-page { min-height: 100%; display: flex; flex-direction: column; }

.cv-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  gap: 10px;
  color: var(--text-light);
}

.cv-center h2 { color: var(--text); font-size: 20px; }
.cv-center p  { max-width: 420px; font-size: 14px; }

.cv-state-icon { color: var(--text-muted); margin-bottom: 6px; }
.cv-state-icon-success { color: var(--success); }

.cv-header {
  background: var(--sidebar-bg);
  color: white;
  padding: 28px 24px 24px;
  text-align: center;
}

.cv-brand {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  font-size: 12px; color: var(--secondary); margin-bottom: 10px;
}

.cv-header-title { font-size: 21px; font-weight: 700; }
.cv-header-sub   { font-size: 13px; color: rgba(255,255,255,.65); margin-top: 6px; }

.cv-body {
  flex: 1;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 20px 100px;
}

.cv-section { margin-bottom: 26px; }

.cv-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 700; color: var(--text);
  margin-bottom: 12px;
}

.cv-section-body { background: white; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }

.cv-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cv-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }

.cv-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.cv-field label { font-size: 12px; font-weight: 600; color: var(--text-light); }
.cv-field:last-child { margin-bottom: 0; }

.cv-muted { color: var(--text-muted); font-size: 13px; }

.cv-niveau-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.cv-niveau-card {
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--t);
}
.cv-niveau-card:hover { border-color: var(--secondary); }
.cv-niveau-card.cv-selected { border-color: var(--primary); background: var(--primary-light); }
.cv-niveau-label { font-weight: 700; font-size: 13.5px; color: var(--text); margin-bottom: 4px; }
.cv-niveau-desc  { font-size: 12px; color: var(--text-light); line-height: 1.4; }

.cv-presta-row { padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.cv-presta-row:last-child { border-bottom: none; }
.cv-presta-label { font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 8px; }
.cv-presta-pills { display: flex; flex-wrap: wrap; gap: 6px; }

.cv-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px; border: 1.5px solid var(--border);
  background: white; font-size: 12px; font-weight: 600; color: var(--text-light);
  cursor: pointer; transition: var(--t);
}
.cv-pill:hover { border-color: var(--secondary); }
.cv-pill.cv-selected {
  border-color: var(--pill-color, var(--primary));
  color: var(--pill-color, var(--primary));
  background: color-mix(in srgb, var(--pill-color, var(--primary)) 12%, white);
}

.cv-grid-4 input {
  font-size: 12px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
}

.cv-options-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.cv-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--border);
  background: white; font-size: 12.5px; font-weight: 600; color: var(--text-light);
  cursor: pointer; transition: var(--t);
}
.cv-chip:hover { border-color: var(--secondary); }
.cv-chip.cv-selected { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.cv-custom-row {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr auto;
  gap: 8px; margin-bottom: 8px; align-items: center;
}
.cv-custom-row input { font-size: 12.5px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; }
.cv-remove {
  width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border);
  background: white; color: var(--text-light); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cv-remove:hover { background: var(--danger-light); color: var(--danger); border-color: var(--danger); }

.cv-footer {
  position: sticky; bottom: 0;
  background: white; border-top: 1px solid var(--border);
  padding: 14px 20px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; box-shadow: var(--shadow-md);
}

.cv-save-state { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 5px; }

/* ---- Bandeau budget / prix en direct ---- */

.cv-budget-bar {
  position: sticky; top: 0; z-index: 5;
  background: white; border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 18px; margin-bottom: 26px; box-shadow: var(--shadow-sm);
}

.cv-budget-row { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }

.cv-budget-live { text-align: right; min-width: 180px; }
.cv-budget-live-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.cv-budget-live-value { font-size: 21px; font-weight: 800; color: var(--text); transition: opacity .15s ease; }
.cv-budget-live-heures { font-size: 13px; font-weight: 600; color: var(--text-light); }

.cv-gauge { margin-top: 12px; height: 8px; border-radius: 999px; background: var(--border-light); overflow: hidden; }
.cv-gauge-bar { height: 100%; border-radius: 999px; transition: width .25s ease, background .25s ease; }
.cv-gauge-label { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--text-light); }

.cv-plancher-msg {
  margin-top: 10px; display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px; background: var(--warning-light); color: var(--warning);
  font-size: 12px; font-weight: 600;
}

.cv-minimum-msg {
  margin-top: 10px; display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px; background: var(--primary-light); color: var(--primary);
  font-size: 12px; font-weight: 600;
}

.cv-sim-error { margin-top: 8px; font-size: 12px; color: var(--danger); }

/* ---- Configurateur en direct (résidence) ---- */

.cv-zone-row {
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.cv-zone-row:last-child { border-bottom: none; }
.cv-zone-row.cv-zone-inactive { opacity: .5; }

.cv-zone-main {
  display: grid; grid-template-columns: 1fr 160px 90px; align-items: center; gap: 10px;
}

.cv-zone-toggle { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.cv-zone-toggle input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

.cv-zone-main select { font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }

.cv-zone-temps { font-size: 12px; font-weight: 700; color: var(--secondary); text-align: right; white-space: nowrap; }

.cv-zone-taches { margin-top: 8px; }
.cv-zone-taches summary {
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--secondary);
  list-style: none;
}
.cv-zone-taches summary::-webkit-details-marker { display: none; }
.cv-zone-taches summary::before { content: '▸ '; }
.cv-zone-taches[open] summary::before { content: '▾ '; }

.cv-tache-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px;
  margin-top: 8px; padding: 10px 12px; background: var(--bg); border-radius: 8px;
}
.cv-tache-item { display: flex; align-items: flex-start; gap: 7px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.cv-tache-item input { width: 15px; height: 15px; margin-top: 1px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.cv-tache-item em { color: var(--text-muted); font-style: normal; font-size: 11px; }

@media (max-width: 640px) {
  .cv-grid-2, .cv-grid-4, .cv-niveau-grid { grid-template-columns: 1fr; }
  .cv-custom-row { grid-template-columns: 1fr; }
  .cv-footer { flex-direction: column; align-items: stretch; }
  .cv-budget-row { align-items: stretch; }
  .cv-budget-live { text-align: left; }
  .cv-zone-main { grid-template-columns: 1fr; gap: 6px; }
  .cv-tache-list { grid-template-columns: 1fr; }
}

/* ---- Consultation + signature d'offre (offre-signature-public.js) ---- */

.os-wide-body { max-width: 900px; }

.os-iframe-toolbar { display: flex; justify-content: flex-end; margin-bottom: 8px; }

.os-iframe-wrap {
  border: 1px solid var(--border); border-radius: var(--r-md); overflow: auto;
  height: 82vh; min-height: 560px; background: var(--bg);
}
.os-iframe { width: 100%; height: 100%; min-width: 800px; border: none; display: block; }

.os-sig-canvas-wrap {
  position: relative; height: 160px;
  border: 1.5px dashed var(--border); border-radius: var(--r-md);
  background: white; touch-action: none; overflow: hidden;
}
.os-sig-canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.os-sig-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px; pointer-events: none;
}
.os-sig-actions { margin-top: 8px; display: flex; justify-content: flex-end; }

.os-consent {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 14px;
  font-size: 13px; color: var(--text); cursor: pointer;
}
.os-consent input { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }

.os-error { margin-top: 12px; font-size: 12.5px; color: var(--danger); font-weight: 600; }

@media (max-width: 640px) {
  .os-iframe-wrap { height: 46vh; }
}
/* CRM local — première intégration en lecture seule des chiffrages Marcel */
.crm-nav-badge{margin-left:auto;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#dc4c4c;color:#fff;font-size:10px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}.crm-shell{color:#243b53}.crm-tabs{display:flex;gap:24px;border-bottom:1px solid var(--border);margin-bottom:22px;overflow-x:auto}.crm-tab{border:0;background:none;padding:10px 2px 13px;color:#718096;font-size:13px;white-space:nowrap}.crm-tab.active{color:#1a3a5c;border-bottom:2px solid #1a3a5c;font-weight:700}.crm-tab-count{background:#e7edf4;border-radius:10px;padding:2px 6px;margin-left:4px;font-size:10px}.crm-view{display:none}.crm-view.active{display:block}.crm-hero{display:flex;justify-content:space-between;align-items:center;padding:23px 27px;border-radius:11px;background:linear-gradient(115deg,#173c5d,#245d87);color:#fff;box-shadow:0 7px 20px rgba(24,59,91,.13)}.crm-hero-label{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:#c7deef}.crm-hero h2{margin:7px 0 5px;font-size:23px}.crm-hero p{margin:0;color:#d6e7f3;font-size:12px}.crm-hero-stat{text-align:right;font-size:26px;font-weight:800}.crm-hero-stat small{display:block;font-size:11px;font-weight:500;color:#c7deef}.crm-toolbar{display:flex;gap:7px;align-items:center;margin:18px 0}.crm-filter{border:1px solid #d6e0ea;background:#fff;border-radius:16px;padding:6px 11px;color:#617286;font-size:12px}.crm-filter.active{background:#e3edf7;border-color:#bfd0e1;color:#1a3a5c;font-weight:650}.crm-search{margin-left:auto;border:1px solid #d6e0ea;border-radius:7px;padding:7px 10px;width:210px}.crm-section-title{display:flex;align-items:center;gap:8px;margin:19px 0 9px}.crm-section-title h3{font-size:14px;color:#1a3a5c;margin:0}.crm-section-title span{font-size:11px;color:#8795a5}.crm-task-list{display:grid;gap:8px}.crm-task{display:grid;grid-template-columns:5px 42px minmax(210px,1.4fr) minmax(180px,1fr) auto;align-items:center;gap:13px;background:#fff;border:1px solid #d3dee9;border-radius:9px;padding:13px 14px 13px 0}.crm-task-priority{width:5px;height:100%;border-radius:3px;background:#e3a126}.crm-task.urgent .crm-task-priority{background:#dc4545}.crm-task-icon{display:grid;place-items:center;width:40px;height:40px;border-radius:8px;background:#e7eff7;color:#1a3a5c}.crm-task h4{font-size:13.5px;color:#1a3a5c;margin:0 0 4px}.crm-task p,.crm-task small{margin:0;color:#77879a;font-size:11.5px}.crm-task-reason b{display:block;font-size:12px;color:#3f566d;margin-bottom:3px}.crm-task-actions{display:flex;gap:6px}.crm-task-actions button{border:1px solid #d3dee9;background:#fff;color:#486178;border-radius:6px;padding:7px 9px;font-size:11.5px}.crm-task-actions .primary{background:#1a3a5c;color:#fff;border-color:#1a3a5c}.crm-panel-head{display:flex;justify-content:space-between;align-items:end;margin-bottom:16px}.crm-panel-head h2{margin:0 0 4px;color:#1a3a5c}.crm-panel-head p{margin:0;color:#718096;font-size:12px}.crm-grid{display:grid;grid-template-columns:repeat(3,minmax(220px,1fr));gap:13px}.crm-card{background:#fff;border:1px solid #d3dee9;border-radius:9px;padding:16px;cursor:pointer}.crm-card:hover{border-color:#8eabc5;box-shadow:0 4px 12px rgba(26,58,92,.08)}.crm-card h3{font-size:14px;color:#1a3a5c;margin:0 0 4px}.crm-card p{font-size:11.5px;color:#718096;margin:4px 0}.crm-card-top{display:flex;justify-content:space-between;gap:8px}.crm-status{height:fit-content;background:#e8f2fc;color:#2563a5;border-radius:10px;padding:3px 8px;font-size:10px}.crm-card-foot{border-top:1px solid #edf1f5;margin-top:13px;padding-top:11px;display:flex;justify-content:space-between;color:#385772;font-size:12px}.crm-kanban{display:grid;grid-template-columns:repeat(4,minmax(210px,1fr));gap:11px;overflow-x:auto}.crm-column{background:#e8edf3;border-radius:9px;padding:10px;min-height:340px}.crm-column-title{display:flex;justify-content:space-between;margin:2px 3px 10px;color:#4d647a;font-size:11.5px;font-weight:700}.crm-deal{background:#fff;border:1px solid #d3dee9;border-radius:7px;padding:12px;margin-bottom:8px;cursor:pointer}.crm-deal h4{font-size:12.5px;color:#1a3a5c;margin:0 0 5px}.crm-deal p{font-size:10.5px;color:#718096;margin:3px 0}.crm-deal strong{display:block;margin-top:9px;color:#244f74;font-size:12px}.crm-empty{text-align:center;background:#fff;border:1px solid #d3dee9;border-radius:10px;padding:65px 20px;color:#718096}.crm-empty h2{color:#1a3a5c}.crm-readonly-note{display:flex;align-items:center;gap:7px;background:#fff8e6;border:1px solid #f0d99b;border-radius:7px;padding:9px 12px;color:#7a5a12;font-size:11px;margin-bottom:16px}@media(max-width:1000px){.crm-task{grid-template-columns:5px 40px 1fr auto}.crm-task-reason{display:none}.crm-grid{grid-template-columns:1fr 1fr}}@media(max-width:700px){.crm-hero{align-items:flex-start}.crm-hero-stat{display:none}.crm-task{grid-template-columns:5px 35px 1fr}.crm-task-actions{grid-column:3;flex-wrap:wrap}.crm-grid{grid-template-columns:1fr}.crm-kanban{grid-template-columns:repeat(4,220px)}.crm-search{display:none}}
