/* ══════════════════════════════════════════════════════════
   Gestion de Patrimoine — Design System v2
   ══════════════════════════════════════════════════════════ */

:root {
  /* ── Palette Patrimoine360 — Rouge & Ardoise ── */
  --primary:        #DC2626;   /* rouge Patrimoine360 */
  --primary-light:  #FEF2F2;
  --primary-dark:   #991B1B;
  --primary-rgb:    220,38,38;

  --accent:         #F59E0B;   /* ambre doré */
  --accent-light:   #FFFBEB;
  --accent-dark:    #D97706;

  --success:        #10B981;
  --success-light:  #ECFDF5;
  --warning:        #F59E0B;
  --warning-light:  #FFFBEB;
  --danger:         #EF4444;
  --danger-light:   #FEF2F2;
  --purple:         #8B5CF6;
  --purple-light:   #F5F3FF;
  --teal:           #EA580C;
  --teal-light:     #FFF7ED;
  --indigo:         #6366F1;
  --indigo-light:   #EEF2FF;

  --text-dark:      #0F172A;
  --text-body:      #1E293B;
  --text-muted:     #64748B;
  --text-light:     #94A3B8;

  --border:         #E2E8F0;
  --border-strong:  #CBD5E1;
  --bg:             #F8FAFC;
  --bg-hover:       #F1F5F9;
  --white:          #FFFFFF;

  /* Sidebar Claire */
  --sidebar-bg:     #FFFFFF;
  --sidebar-w:      260px;
  --sidebar-text:   #475569;
  --sidebar-active: rgba(220,38,38,.08);
  --topbar-h:       62px;

  --radius-xs:  4px;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --shadow-xs:  0 1px 2px rgba(15,23,42,.06);
  --shadow-sm:  0 2px 6px rgba(15,23,42,.08);
  --shadow-md:  0 4px 16px rgba(15,23,42,.10);
  --shadow-lg:  0 8px 30px rgba(15,23,42,.12);

  --font:  'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono:  'Cascadia Code', 'Consolas', monospace;

  /* ── Écrasement variables Bootstrap ── */
  --bs-primary:              #DC2626;
  --bs-primary-rgb:          220,38,38;
  --bs-link-color:           #DC2626;
  --bs-link-color-rgb:       220,38,38;
  --bs-link-hover-color:     #991B1B;
  --bs-link-hover-color-rgb: 153,27,27;
  --bs-focus-ring-color:     rgba(220,38,38,.25);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: .9375rem;
  color: var(--text-body);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
a:hover { color: inherit; }
.btn-link { color: var(--primary); }
.btn-link:hover { color: var(--primary-dark); text-decoration: none; }
img { max-width: 100%; }

/* ══════════════════════════════════════════════════════════
   AUTH
   ══════════════════════════════════════════════════════════ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.25rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 2.25rem;
  text-align: center;
  width: 100%;
}
.auth-brand-icon {
  width: 44px; height: 44px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 1.3rem; flex-shrink: 0;
}
.auth-brand-name { font-size: 1.05rem; font-weight: 800; color: var(--text-dark); line-height: 1.2; }
.auth-brand-sub  { font-size: .72rem; color: var(--text-muted); font-weight: 400; }

.auth-title    { font-size: 1.35rem; font-weight: 800; color: var(--text-dark); margin-bottom: .3rem; text-align: center; }
.auth-subtitle { font-size: .85rem; color: var(--text-muted); text-align: center; margin-bottom: 2rem; }
.auth-divider  { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */

.form-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: .4rem;
  display: block;
}
.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .575rem .85rem;
  font-size: .9rem;
  color: var(--text-dark);
  background: var(--white);
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  font-family: var(--font);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.12);
  outline: none;
}
.form-control::placeholder { color: var(--text-light); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: .78rem; color: var(--danger); margin-top: .3rem; display: block; }

.input-group { display: flex; }
.input-group-text {
  background: var(--bg-hover);
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  color: var(--text-muted);
  padding: 0 .75rem;
  font-size: .9rem;
  display: flex; align-items: center;
}
.input-group .form-control {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  border-left: none;
  flex: 1;
}
.input-group .form-control:focus { border-left: none; }

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

.form-section { margin-bottom: 2rem; }
.form-section-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: .5rem;
}
.form-section-title i { font-size: .9rem; color: var(--primary); }

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */

.btn {
  font-size: .875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: .5rem 1rem;
  transition: all .15s;
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
  font-family: var(--font);
  line-height: 1.4;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary {
  --bs-btn-bg: #DC2626;
  --bs-btn-border-color: #DC2626;
  --bs-btn-hover-bg: #991B1B;
  --bs-btn-hover-border-color: #991B1B;
  --bs-btn-active-bg: #7F1D1D;
  --bs-btn-active-border-color: #7F1D1D;
  --bs-btn-focus-shadow-rgb: 220,38,38;
  --bs-btn-disabled-bg: #DC2626;
  --bs-btn-disabled-border-color: #DC2626;
  background: #DC2626 !important; border-color: #DC2626 !important; color: #fff !important;
}
.btn-primary:hover { background: #991B1B !important; border-color: #991B1B !important; color: #fff !important; }
.btn-success    { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #047857; border-color: #047857; color: #fff; }
.btn-danger     { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #B91C1C; border-color: #B91C1C; color: #fff; }
.btn-warning    { background: var(--warning); border-color: var(--warning); color: #fff; }

.btn-outline-primary {
  --bs-btn-color: #DC2626;
  --bs-btn-border-color: #DC2626;
  --bs-btn-hover-bg: #DC2626;
  --bs-btn-hover-border-color: #DC2626;
  --bs-btn-active-bg: #991B1B;
  --bs-btn-active-border-color: #991B1B;
  --bs-btn-focus-shadow-rgb: 220,38,38;
  background: transparent !important; border-color: #DC2626 !important; color: #DC2626 !important;
}
.btn-outline-primary:hover { background: #FEF2F2 !important; color: #991B1B !important; }
.btn-outline-secondary { background: transparent; border-color: var(--border-strong); color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--bg-hover); color: var(--text-dark); border-color: var(--border-strong); }
.btn-outline-danger {
  --bs-btn-color: #EF4444;
  --bs-btn-border-color: #EF4444;
  --bs-btn-hover-bg: #FEF2F2;
  --bs-btn-hover-color: #B91C1C;
  --bs-btn-hover-border-color: #EF4444;
  --bs-btn-active-bg: #EF4444;
  --bs-btn-active-color: #fff;
  background: transparent !important; border-color: #EF4444 !important; color: #EF4444 !important;
}
.btn-outline-danger:hover { background: #FEF2F2 !important; color: #B91C1C !important; border-color: #EF4444 !important; }
.btn-outline-warning   { background: transparent; border-color: var(--warning); color: var(--warning); }
.btn-outline-warning:hover { background: var(--warning-light); }
.btn-outline-success   { background: transparent; border-color: var(--success); color: var(--success); }
.btn-outline-success:hover { background: var(--success-light); }

.btn-light  { background: var(--bg-hover); border-color: var(--border); color: var(--text-body); }
.btn-light:hover { background: var(--border); }

.btn-sm     { padding: .3rem .65rem; font-size: .8rem; border-radius: var(--radius-xs); }
.btn-lg     { padding: .65rem 1.5rem; font-size: .95rem; }
.btn-auth   { width: 100%; justify-content: center; padding: .65rem; font-size: .95rem; }
.btn-icon   { padding: .4rem; border-radius: var(--radius-xs); aspect-ratio: 1; justify-content: center; }

/* ══════════════════════════════════════════════════════════
   ALERTS & FLASH
   ══════════════════════════════════════════════════════════ */

.alert {
  border: none;
  border-left: 4px solid transparent;
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin-bottom: 1rem;
}
.alert-success  { background: var(--success-light); border-color: var(--success); color: #065F46; }
.alert-danger   { background: #FEF2F2;              border-color: #EF4444;        color: #7F1D1D; }
.alert-warning  { background: var(--warning-light); border-color: var(--warning); color: #92400E; }
.alert-info     { background: #EFF6FF;              border-color: #3B82F6;        color: #1E3A5F; }
.alert .btn-close { margin-left: auto; opacity: .5; font-size: .7rem; flex-shrink: 0; }
.alert ul { margin: .4rem 0 0 1rem; padding: 0; }
.alert ul li { margin-bottom: .2rem; }

/* ══════════════════════════════════════════════════════════
   BADGES & STATUS
   ══════════════════════════════════════════════════════════ */

/* Generic badge */
.badge {
  font-size: .7rem;
  font-weight: 600;
  padding: .25em .6em;
  border-radius: 100px;
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  white-space: nowrap;
  letter-spacing: .01em;
}
.badge.bg-success { background: var(--success-light) !important; color: #065F46 !important; }
.badge.bg-warning { background: var(--warning-light) !important; color: #92400E !important; }
.badge.bg-danger  { background: var(--danger-light)  !important; color: #B91C1C !important; }
.badge.bg-primary { background: #DC2626 !important; color: #fff !important; }
.badge.bg-secondary { background: var(--bg-hover) !important; color: var(--text-muted) !important; }
.badge.bg-light   { background: var(--bg-hover) !important; color: var(--text-body) !important; }

/* Pill count */
.pill {
  background: #DC2626;
  color: #fff;
  border-radius: 100px;
  font-size: .7rem;
  font-weight: 700;
  padding: .2em .6em;
  display: inline-block;
}

/* Statut bien */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 600;
  padding: .3em .7em;
  border-radius: 100px;
  white-space: nowrap;
}
.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .6;
  flex-shrink: 0;
}

.status-evaluee,   .status-validee  { background: var(--success-light); color: #065F46; }
.status-en_cours,  .status-soumise  { background: #FFF7ED; color: #9A3412; }
.status-non_evalue,.status-brouillon { background: var(--bg-hover); color: var(--text-muted); }
.status-refusee    { background: var(--danger-light); color: #991B1B; }
.status-actif      { background: var(--success-light); color: #065F46; }
.status-en_vente   { background: #FFF7ED; color: #9A3412; }
.status-vendu      { background: var(--bg-hover); color: var(--text-muted); }
.status-loue       { background: var(--teal-light); color: #EA580C; }
.status-vacant     { background: var(--warning-light); color: #92400E; }
.status-occupe     { background: #F1F5F9; color: #475569; }

/* ══════════════════════════════════════════════════════════
   SIDEBAR LAYOUT
   ══════════════════════════════════════════════════════════ */

.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 300;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .25s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 2px; }

.sidebar-brand {
  padding: 1.2rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-icon {
  width: 38px; height: 38px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-brand-name { font-size: .82rem; font-weight: 700; color: var(--text-dark); line-height: 1.3; }
.sidebar-brand-role { font-size: .67rem; color: var(--text-muted); font-weight: 400; }

.sidebar-nav { padding: 1.25rem .75rem; flex: 1; }

.nav-group-label {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-light);
  padding: .6rem .6rem .25rem;
  font-weight: 700;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  color: #475569 !important;
  font-size: .855rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
  position: relative;
  text-decoration: none !important;
}
.sidebar-link i {
  font-size: 1.05rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: .7;
}
.sidebar-link:hover {
  background: #FEF2F2 !important;
  color: #991B1B !important;
}
.sidebar-link:hover i { opacity: 1; }
.sidebar-link.active {
  background: rgba(220,38,38,.08) !important;
  color: #DC2626 !important;
  font-weight: 600;
}
.sidebar-link.active i { opacity: 1; color: #DC2626 !important; }
.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}
.sidebar-link.danger { color: var(--danger); }
.sidebar-link.danger:hover { background: var(--danger-light); color: var(--primary-dark); }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .65rem;
}

/* ══════════════════════════════════════════════════════════
   SIDEBAR COLLAPSÉE
   ══════════════════════════════════════════════════════════ */

:root { --sidebar-w-collapsed: 64px; }

/* Transition fluide */
.sidebar { transition: width .22s ease, transform .25s ease; }
.main-content { transition: margin-left .22s ease; }

/* Anti-flash : état initial sans transition (avant que le JS s'exécute) */
html[data-sb="c"] .sidebar     { width: var(--sidebar-w-collapsed); transition: none !important; }
html[data-sb="c"] .main-content{ margin-left: var(--sidebar-w-collapsed); transition: none !important; }

/* État réduit */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); overflow: visible; }
.sidebar.collapsed .sidebar-brand { justify-content: center; padding: .9rem .5rem; }
.sidebar.collapsed .sidebar-brand img { max-height: 34px !important; max-width: 50px !important; }
.sidebar.collapsed .sidebar-brand > div { display: none; }
.sidebar.collapsed .sidebar-brand-name,
.sidebar.collapsed .sidebar-brand-role { display: none; }
.sidebar.collapsed .nav-group-label { display: none; }

/* Liens : font-size 0 cache les textes (nœuds texte non wrappables) */
.sidebar.collapsed .sidebar-link { justify-content: center; padding: .55rem 0; font-size: 0; }
.sidebar.collapsed .sidebar-link i { font-size: 1.15rem; width: auto; margin: 0; opacity: .75; }
.sidebar.collapsed .sidebar-link:hover i,
.sidebar.collapsed .sidebar-link.active i { opacity: 1; }

.sidebar.collapsed .sidebar-footer { justify-content: center; padding: .6rem .5rem; gap: .5rem; }
.sidebar.collapsed .sidebar-footer-text { display: none; }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-collapsed); }

/* ── Bouton collapse — onglet sur le bord droit de la sidebar ── */
.sidebar-collapse-btn {
  position: fixed;
  top: 50%;
  left: var(--sidebar-w);
  transform: translate(-50%, -50%) translateX(12px);
  width: 24px; height: 40px;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 8px 8px 0;
  display: none; /* desktop seulement */
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s, color .15s, left .22s ease;
  z-index: 301;
  box-shadow: 2px 0 6px rgba(0,0,0,.08);
}
.sidebar-collapse-btn:hover { background: var(--bg-hover); color: var(--text-dark); }
.sidebar.collapsed .sidebar-collapse-btn { left: var(--sidebar-w-collapsed); }

/* ══════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════ */

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}
.topbar-title { font-size: 1rem; font-weight: 700; color: var(--text-dark); }
.topbar-sub   { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }

.content-area { padding: 1.75rem; flex: 1; }

/* Hamburger toggle (mobile) */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-body);
  font-size: 1.25rem;
  cursor: pointer;
  padding: .25rem;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-hover); }

/* ══════════════════════════════════════════════════════════
   KPI CARDS
   ══════════════════════════════════════════════════════════ */

.kpi-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: transparent;
  transition: background .2s;
}
.kpi-card:hover::after { background: var(--primary); }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.kpi-label {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .25rem;
  font-weight: 500;
}
.kpi-trend {
  display: flex;
  align-items: center;
  gap: .2rem;
  font-size: .72rem;
  font-weight: 600;
  margin-top: .3rem;
}
.kpi-trend.up   { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ══════════════════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════════════════ */

.card {
  background: var(--white);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-xs) !important;
}
.card-header {
  background: var(--white) !important;
  border-bottom: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  padding: 1rem 1.5rem !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}
.card-header-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.card-body { padding: 1.5rem; }

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */

.table { font-size: .875rem; margin: 0; }
.table thead th {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border) !important;
  padding: .7rem 1.25rem;
  background: var(--bg);
  white-space: nowrap;
}
.table tbody td {
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
  vertical-align: middle;
  border-top: none;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr { transition: background .1s; }
.table-hover tbody tr:hover { background: var(--bg); }
.table-hover tbody tr:hover td:first-child { border-left: 2px solid var(--primary); }

/* ══════════════════════════════════════════════════════════
   AVATAR
   ══════════════════════════════════════════════════════════ */

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #DC2626;
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .73rem; font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}
.avatar-sm { width: 28px; height: 28px; font-size: .65rem; }
.avatar-md { width: 44px; height: 44px; font-size: .9rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.1rem; }

/* Avatar colors by role */
.avatar-admin     { background: #DC2626; color: #fff; }
.avatar-client    { background: #F05252; color: #fff; }
.avatar-team      { background: #FFFBEB; color: #D97706; }
.avatar-superadmin{ background: #FDF4FF; color: #9333EA; }

/* ══════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  width: 64px; height: 64px;
  background: var(--bg-hover);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
  color: var(--text-light);
}
.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; opacity: .3; display: block; }
.empty-state h6 { font-weight: 700; color: var(--text-dark); margin-bottom: .3rem; font-size: .95rem; }
.empty-state p  { font-size: .85rem; color: var(--text-muted); margin: 0; max-width: 320px; margin: 0 auto; }

/* ══════════════════════════════════════════════════════════
   INFO ROWS (detail page)
   ══════════════════════════════════════════════════════════ */

.info-row {
  display: flex;
  align-items: baseline;
  padding: .65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.info-row:last-child { border-bottom: none; }
.info-row:nth-child(even) { background: var(--bg); }
.info-label {
  flex: 0 0 170px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.info-value { flex: 1; font-size: .9rem; color: var(--text-body); }

/* ══════════════════════════════════════════════════════════
   PAGE HEADER (breadcrumb + actions)
   ══════════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.page-header-left { display: flex; align-items: center; gap: .65rem; flex-wrap: wrap; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0;
  list-style: none;
  padding: 0;
}
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item a:hover { color: var(--primary); }
.breadcrumb-item.active { color: var(--text-dark); font-weight: 600; }
.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: var(--border-strong);
  margin-right: .4rem;
}

/* ══════════════════════════════════════════════════════════
   BIEN CARD (grid view)
   ══════════════════════════════════════════════════════════ */

.bien-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  box-shadow: var(--shadow-xs);
}
.bien-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.bien-card-img {
  height: 160px;
  background: var(--bg-hover);
  overflow: hidden;
  position: relative;
}
.bien-card-img img { width: 100%; height: 100%; object-fit: cover; }
.bien-card-img .bien-type-badge {
  position: absolute;
  top: .65rem; left: .65rem;
  background: rgba(15,23,42,.7);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  padding: .25em .55em;
  border-radius: 100px;
  backdrop-filter: blur(4px);
}
.bien-card-body { padding: 1rem 1.1rem; }
.bien-card-title { font-size: .9rem; font-weight: 700; color: var(--text-dark); margin-bottom: .3rem; }
.bien-card-meta  {
  display: flex; flex-wrap: wrap; gap: .35rem .75rem;
  font-size: .78rem; color: var(--text-muted); margin-top: .5rem;
}
.bien-card-meta span { display: flex; align-items: center; gap: .25rem; }
.bien-card-value { font-size: 1rem; font-weight: 800; color: var(--primary); margin-top: .6rem; font-variant-numeric: tabular-nums; }

/* Photo thumbnail in table */
.photo-thumb {
  width: 42px; height: 42px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: var(--bg-hover);
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.photo-thumb-placeholder {
  width: 42px; height: 42px;
  border-radius: var(--radius-xs);
  background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light);
  font-size: .85rem;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════
   CLIENT LAYOUT
   ══════════════════════════════════════════════════════════ */

.client-navbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 1.75rem;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  gap: 1rem;
}
.client-brand {
  display: flex; align-items: center; gap: .5rem;
  font-size: .9rem; font-weight: 800; color: var(--text-dark);
  flex-shrink: 0;
}
.client-brand-icon {
  width: 32px; height: 32px;
  background: #DC2626;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: .9rem;
}
.client-body { background: var(--bg); min-height: calc(100vh - var(--topbar-h)); }

/* ══════════════════════════════════════════════════════════
   WEALTH HERO (client dashboard)
   ══════════════════════════════════════════════════════════ */

.wealth-hero {
  background: linear-gradient(135deg, #DC2626 0%, #991B1B 60%, #7F1D1D 100%);
  border-radius: var(--radius-xl);
  padding: 2rem 2rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.wealth-hero::before {
  content: '';
  position: absolute;
  right: -40px; top: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.wealth-hero::after {
  content: '';
  position: absolute;
  right: 60px; bottom: -80px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.wealth-hero-greeting { font-size: .85rem; opacity: .8; margin-bottom: .3rem; }
.wealth-hero-name     { font-size: 1.5rem; font-weight: 800; margin-bottom: 1.25rem; }
.wealth-hero-value    { font-size: 2.5rem; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.wealth-hero-label    { font-size: .8rem; opacity: .75; margin-top: .25rem; }
.wealth-hero-stats    { display: flex; gap: 1.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.wealth-stat          { display: flex; flex-direction: column; }
.wealth-stat-val      { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.wealth-stat-lbl      { font-size: .72rem; opacity: .7; }

/* ══════════════════════════════════════════════════════════
   STAT CARDS (generic)
   ══════════════════════════════════════════════════════════ */

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-xs);
}
.stat-icon-wrap {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; flex-shrink: 0;
}
.stat-icon-blue   { background: #EEF2FF; color: #4F46E5; }
.stat-icon-green  { background: var(--success-light); color: var(--success); }
.stat-icon-purple { background: var(--purple-light);  color: var(--purple); }
.stat-icon-orange { background: var(--warning-light); color: var(--warning); }
.stat-icon-teal   { background: var(--teal-light);    color: var(--teal); }
.stat-value { font-size: 1.65rem; font-weight: 800; color: var(--text-dark); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* ══════════════════════════════════════════════════════════
   CHART CONTAINER
   ══════════════════════════════════════════════════════════ */

.chart-container { position: relative; }
.chart-loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--white); border-radius: var(--radius-lg);
  color: var(--text-light); font-size: .85rem;
}

/* ══════════════════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════════════════ */

.pagination { display: flex; gap: .25rem; margin: 0; padding: 0; list-style: none; }
.page-link {
  min-width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-xs);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1.5px solid transparent;
  transition: all .15s;
  padding: 0 .35rem;
}
.page-link:hover { background: var(--bg-hover); color: var(--text-dark); }
.page-item.active .page-link { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-item.disabled .page-link { opacity: .4; pointer-events: none; }

/* ══════════════════════════════════════════════════════════
   FILTERS BAR
   ══════════════════════════════════════════════════════════ */

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .65rem;
  border-radius: 100px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--white);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .15s;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: #DC2626; border-color: #DC2626; color: #fff; }

/* ══════════════════════════════════════════════════════════
   DROPDOWN
   ══════════════════════════════════════════════════════════ */

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: .4rem;
  font-size: .85rem;
  min-width: 160px;
}
.dropdown-item { border-radius: var(--radius-xs); padding: .45rem .75rem; color: var(--text-body); }
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-dark); }
.dropdown-item.text-danger:hover { background: var(--danger-light); }
.dropdown-divider { border-color: var(--border); margin: .3rem 0; }

/* ══════════════════════════════════════════════════════════
   ACTIVITY FEED
   ══════════════════════════════════════════════════════════ */

.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  gap: .85rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; flex-shrink: 0; margin-top: .1rem;
}
.activity-dot.create { background: var(--success-light); color: var(--success); }
.activity-dot.update { background: #DC2626; color: #fff; }
.activity-dot.delete { background: var(--danger-light);  color: var(--danger); }
.activity-dot.view   { background: var(--bg-hover);      color: var(--text-muted); }
.activity-text { flex: 1; }
.activity-text strong { color: var(--text-dark); font-size: .875rem; }
.activity-text p { font-size: .8rem; color: var(--text-muted); margin: .15rem 0 0; }
.activity-time { font-size: .72rem; color: var(--text-light); white-space: nowrap; margin-top: .15rem; }

/* ══════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════ */

.nav-tabs {
  border-bottom: 2px solid var(--border);
  gap: .25rem;
  display: flex; flex-wrap: wrap;
}
.nav-tabs .nav-link {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: .6rem 1rem;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  transition: color .15s;
  cursor: pointer;
  display: flex; align-items: center; gap: .4rem;
}
.nav-tabs .nav-link:hover { color: var(--text-dark); background: var(--bg-hover); }
.nav-tabs .nav-link.active { color: var(--primary); border-color: var(--primary); background: transparent; }

/* ══════════════════════════════════════════════════════════
   MISC UTILITIES
   ══════════════════════════════════════════════════════════ */

code {
  font-size: .78rem; font-family: var(--mono);
  background: #F1F5F9; color: #1E293B;
  border-radius: var(--radius-xs); padding: .1em .4em;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.text-primary-custom { color: var(--primary) !important; }
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Row action button group */
.row-actions {
  display: flex;
  gap: .3rem;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity .15s;
}
.table-hover tbody tr:hover .row-actions { opacity: 1; }

/* Sortable column header */
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--text-dark); }

/* Search highlight */
mark { background: #FEF9C3; color: var(--text-dark); border-radius: 2px; padding: .05em .2em; }

/* Value display */
.money-value { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.01em; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile sidebar
   ══════════════════════════════════════════════════════════ */

/* Bouton collapse visible uniquement sur desktop */
@media (min-width: 1025px) {
  .sidebar-collapse-btn { display: flex; }
}

@media (max-width: 1024px) {
  .sidebar-collapse-btn { display: none !important; }
  .sidebar-toggle { display: flex; align-items: center; }
  .sidebar { transform: translateX(-100%); overflow: hidden; }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed ~ .main-content { margin-left: 0; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 299;
    backdrop-filter: blur(2px);
  }
  .sidebar-backdrop.show { display: block; }
  .main-content { margin-left: 0; }
}

@media (max-width: 640px) {
  .content-area { padding: 1rem; }
  .kpi-value { font-size: 1.5rem; }
  .wealth-hero-value { font-size: 1.9rem; }
  .card-body { padding: 1rem; }
  .table thead th, .table tbody td { padding: .65rem .75rem; }
  .info-label { flex: 0 0 120px; font-size: .72rem; }
}

@media (min-width: 1024px) {
  .sidebar-backdrop { display: none !important; }
}

/* ── Rendu contenu Quill WYSIWYG ──────────────────────────────────────────── */
.quill-content p { margin-bottom: .5rem; }
.quill-content p:last-child { margin-bottom: 0; }
.quill-content ul, .quill-content ol { padding-left: 1.5rem; margin-bottom: .5rem; }
.quill-content strong { font-weight: 700; }
.quill-content em { font-style: italic; }
.quill-content u { text-decoration: underline; }

/* ── Lightbox — images cliquables ─────────────────────────────────────────── */
.lb-img { cursor: zoom-in; transition: opacity .15s; }
.lb-img:hover { opacity: .85; }
