/* ============================================================
   IMMOSAAS GABON — Design System Premium
   Police: DM Sans (moderne, lisible) + DM Serif Display (titres)
   Palette: Bleu nuit #0F1B2D, Bleu accent #2563EB, Or/Amber #F59E0B
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Serif+Display:ital@0;1&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  /* Couleurs primaires */
  --primary:        #2563EB;
  --primary-dark:   #1D4ED8;
  --primary-light:  #EFF6FF;
  --primary-muted:  #BFDBFE;

  /* Backgrounds */
  --bg-app:         #F0F4F8;
  --bg-sidebar:     #0F1B2D;
  --bg-sidebar-sec: #162236;
  --bg-card:        #FFFFFF;
  --bg-hover:       #F8FAFC;

  /* Texte */
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;
  --text-sidebar:   #CBD5E1;
  --text-sidebar-active: #FFFFFF;

  /* Accents fonctionnels */
  --success:        #10B981;
  --success-bg:     #ECFDF5;
  --warning:        #F59E0B;
  --warning-bg:     #FFFBEB;
  --danger:         #EF4444;
  --danger-bg:      #FEF2F2;
  --info:           #3B82F6;
  --info-bg:        #EFF6FF;

  /* Ombres */
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 16px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --shadow-lg:      0 10px 40px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);
  --shadow-card:    0 2px 8px rgba(15,27,45,.06);

  /* Géométrie */
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      20px;

  /* Sidebar */
  --sidebar-w:      260px;
  --topbar-h:       64px;

  /* Transitions */
  --transition:     all .18s ease;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

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

/* ── Layout Principal ───────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar sidebar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

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

.sidebar-logo-icon {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(37,99,235,.4);
}

.sidebar-logo-icon svg {
  width: 22px; height: 22px;
  fill: white;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar-logo-title {
  font-weight: 700;
  font-size: .95rem;
  color: #fff;
  letter-spacing: .01em;
}

.sidebar-logo-sub {
  font-size: .72rem;
  color: var(--text-sidebar);
  opacity: .7;
  font-weight: 400;
}

/* Agence badge */
.agency-badge {
  margin: 14px 16px 0;
  background: rgba(37,99,235,.15);
  border: 1px solid rgba(37,99,235,.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.agency-badge-name {
  font-size: .78rem;
  font-weight: 600;
  color: var(--primary-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agency-badge-role {
  font-size: .70rem;
  color: rgba(255,255,255,.35);
  margin-top: 2px;
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-group {
  margin-bottom: 4px;
}

.nav-group-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-sidebar);
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
}

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(37,99,235,.2);
  color: #fff;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
  margin-left: -8px;
}

.nav-item-icon {
  width: 18px; height: 18px;
  opacity: .7;
  flex-shrink: 0;
  transition: var(--transition);
}

.nav-item.active .nav-item-icon,
.nav-item:hover .nav-item-icon {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-user:hover { background: rgba(255,255,255,.06); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  letter-spacing: .02em;
}

.user-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: .8rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: .7rem;
  color: rgba(255,255,255,.4);
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  color: var(--text-muted);
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { opacity: .5; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Barre de recherche globale */
.search-global {
  position: relative;
  display: flex;
  align-items: center;
}

.search-global input {
  width: 260px;
  height: 38px;
  padding: 0 12px 0 38px;
  border: 1.5px solid rgba(0,0,0,.1);
  border-radius: var(--radius);
  font-size: .85rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-app);
  transition: var(--transition);
  outline: none;
}

.search-global input:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  width: 320px;
}

.search-global .search-icon {
  position: absolute;
  left: 10px;
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* Bouton icône topbar */
.topbar-btn {
  width: 38px; height: 38px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.topbar-btn svg { width: 20px; height: 20px; }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
}

/* Menu dropdown topbar */
.dropdown { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0,0,0,.08);
  min-width: 220px;
  padding: 6px;
  z-index: 200;
  animation: dropIn .15s ease;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: .85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.dropdown-divider { height: 1px; background: rgba(0,0,0,.06); margin: 4px 0; }

/* ── PAGE CONTENT ────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
}

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,.05);
}

.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}

.card-body { padding: 24px; }

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: rgba(0,0,0,.015);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── KPI CARDS ───────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,.05);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60px; height: 60px;
  background: radial-gradient(circle, var(--kpi-color, var(--primary)) 0%, transparent 70%);
  opacity: .06;
  pointer-events: none;
}

.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--kpi-bg, var(--primary-light));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg { width: 24px; height: 24px; color: var(--kpi-color, var(--primary)); }

.kpi-content { flex: 1; min-width: 0; }

.kpi-label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -.02em;
}

.kpi-value small { font-size: .9rem; font-weight: 500; }

.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  font-weight: 600;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 20px;
}

.kpi-change.up   { color: var(--success); background: var(--success-bg); }
.kpi-change.down { color: var(--danger);  background: var(--danger-bg); }
.kpi-change.flat { color: var(--text-muted); background: var(--bg-hover); }

/* ── TABLES ───────────────────────────────────────────────── */
.table-container {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: rgba(0,0,0,.02);
  border-bottom: 1px solid rgba(0,0,0,.07);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

thead th:hover { color: var(--text-secondary); }

tbody tr {
  border-bottom: 1px solid rgba(0,0,0,.04);
  transition: background .12s ease;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

tbody td {
  padding: 13px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td strong { color: var(--text-primary); font-weight: 600; }

.td-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  white-space: nowrap;
}

.badge-success   { background: var(--success-bg);    color: #059669; }
.badge-warning   { background: var(--warning-bg);    color: #D97706; }
.badge-danger    { background: var(--danger-bg);     color: #DC2626; }
.badge-primary   { background: var(--primary-light); color: var(--primary-dark); }
.badge-info      { background: #EFF6FF;              color: #1D4ED8; }
.badge-secondary { background: #F1F5F9;              color: #475569; }

/* ── BOUTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: .01em;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
  transform: translateY(-1px);
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; color: white; transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; color: white; transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; color: white; transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid rgba(0,0,0,.15);
}
.btn-outline:hover {
  background: var(--bg-hover);
  border-color: rgba(0,0,0,.25);
  color: var(--text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 6px 13px; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-icon.btn-sm { width: 30px; height: 30px; padding: 5px; }

.btn-icon-primary {
  background: var(--primary-light);
  color: var(--primary);
}
.btn-icon-primary:hover { background: var(--primary); color: white; }

.btn-icon-danger { background: var(--danger-bg); color: var(--danger); }
.btn-icon-danger:hover { background: var(--danger); color: white; }

/* ── FORMULAIRES ─────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1.5px solid rgba(0,0,0,.12);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .875rem;
  color: var(--text-primary);
  background: white;
  transition: var(--transition);
  outline: none;
}

textarea.form-control {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 90px;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-control:disabled {
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: not-allowed;
}

select.form-control { cursor: pointer; }

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.1); }

.form-hint {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-check {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-section {
  margin-bottom: 28px;
}

.form-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

/* Input avec icône */
.input-group { position: relative; }
.input-group .input-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}
.input-group .form-control { padding-left: 40px; }

/* ── ALERTES ──────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  margin-bottom: 20px;
  animation: slideIn .25s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: #059669; border: 1px solid rgba(16,185,129,.2); }
.alert-error   { background: var(--danger-bg);  color: #DC2626; border: 1px solid rgba(239,68,68,.2); }
.alert-warning { background: var(--warning-bg); color: #D97706; border: 1px solid rgba(245,158,11,.2); }
.alert-info    { background: var(--info-bg);    color: var(--primary); border: 1px solid rgba(59,130,246,.2); }

/* ── PAGINATION ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 16px 24px;
  justify-content: flex-end;
  border-top: 1px solid rgba(0,0,0,.06);
}

.pagination-info {
  font-size: .8rem;
  color: var(--text-muted);
  margin-right: auto;
}

.page-btn {
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  background: transparent;
  font-family: inherit;
  text-decoration: none;
}

.page-btn:hover   { background: var(--bg-hover); color: var(--text-primary); border-color: rgba(0,0,0,.1); }
.page-btn.active  { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
  backdrop-filter: blur(2px);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .25s cubic-bezier(.34,1.56,.64,1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.modal-body  { padding: 24px; }
.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid rgba(0,0,0,.07);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid rgba(0,0,0,.08);
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 18px;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover  { color: var(--text-secondary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── STATISTIQUES MINI ───────────────────────────────────── */
.stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 30px;
  padding: 8px 16px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.stat-pill span { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-xl);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-icon svg { width: 32px; height: 32px; color: var(--text-muted); }
.empty-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.empty-text  { font-size: .875rem; color: var(--text-muted); max-width: 300px; margin-bottom: 20px; }

/* ── PROGRESS BAR ────────────────────────────────────────── */
.progress {
  height: 8px;
  background: rgba(0,0,0,.07);
  border-radius: 20px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 20px;
  background: var(--primary);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger  { background: var(--danger); }

/* ── TOOLTIPS ────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: rgba(15,23,42,.9);
  color: white;
  font-size: .72rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── FILTRES BAR ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: rgba(0,0,0,.015);
}

.filter-bar .form-control {
  height: 36px;
  font-size: .825rem;
  width: auto;
  min-width: 150px;
}

.filter-search {
  position: relative;
  flex: 1;
  max-width: 340px;
}

.filter-search svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-search input {
  padding-left: 36px;
  height: 36px;
}

/* ── QUITTANCE IMPRESSION ────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
}

/* ── SCROLLBAR GLOBALE ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.2); }

/* ── UTILITIES ───────────────────────────────────────────── */
.text-primary   { color: var(--primary) !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: var(--danger) !important; }
.text-warning   { color: var(--warning) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-sm        { font-size: .8rem; }
.text-xs        { font-size: .72rem; }
.fw-600         { font-weight: 600; }
.fw-700         { font-weight: 700; }
.d-flex         { display: flex; }
.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-8          { gap: 8px; }
.gap-12         { gap: 12px; }
.gap-16         { gap: 16px; }
.mt-4           { margin-top: 4px; }
.mt-8           { margin-top: 8px; }
.mt-16          { margin-top: 16px; }
.mb-16          { margin-bottom: 16px; }
.mb-24          { margin-bottom: 24px; }
.p-0            { padding: 0 !important; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .form-row.cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }

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

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

  .page-content { padding: 16px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; }

  .form-row { grid-template-columns: 1fr; }
  .form-row.cols-3 { grid-template-columns: 1fr; }

  .search-global { display: none; }

  .filter-bar { padding: 12px 16px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
}

/* ── LOADING SPINNER ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(37,99,235,.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── CHART CONTAINER ─────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* ── PROPERTY CARD (grid view) ───────────────────────────── */
.property-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,.05);
  transition: var(--transition);
}

.property-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.property-card-img {
  height: 180px;
  background: linear-gradient(135deg, #e0e7ef 0%, #c8d6e8 100%);
  position: relative;
  overflow: hidden;
}

.property-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.property-card-status {
  position: absolute;
  top: 12px; right: 12px;
}

.property-card-body { padding: 16px; }

.property-card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.property-card-ref {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.property-card-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.property-card-features {
  display: flex;
  gap: 12px;
  font-size: .75rem;
  color: var(--text-muted);
}

.property-card-features span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── TENANT AVATAR ───────────────────────────────────────── */
.tenant-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-sm {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── RECEIPT ─────────────────────────────────────────────── */
.receipt-doc {
  max-width: 680px;
  margin: 0 auto;
  background: white;
  padding: 48px;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 3px double rgba(0,0,0,.15);
}

.receipt-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.8rem;
  color: var(--primary);
  letter-spacing: -.02em;
}

/* ── DASHBOARD GRID ──────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
}

@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Notification panel ──────────────────────────────────── */
.notif-list { display: flex; flex-direction: column; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(0,0,0,.05);
  transition: var(--transition);
}

.notif-item:hover { background: var(--bg-hover); }

.notif-dot-indicator {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}

.notif-content { flex: 1; }
.notif-content strong { font-size: .85rem; font-weight: 600; display: block; margin-bottom: 2px; }
.notif-content p { font-size: .8rem; color: var(--text-muted); }
.notif-time { font-size: .72rem; color: var(--text-muted); white-space: nowrap; }
