/* ═══════════════════════════════════════════════════════════════════
   LoyerPro — Design System Complet
   Application PWA de Gestion Locative Premium
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Google Fonts Import ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS & VARIABLES CSS
   ═══════════════════════════════════════════════════════════════════ */
:root {
  /* ── Couleurs Primaires ── */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-200: #bfdbfe;
  --primary-300: #93c5fd;
  --primary-400: #60a5fa;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-800: #1e40af;
  --primary-900: #1e3a8a;

  /* ── Couleurs Accent (Or/Ambre) ── */
  --accent-50: #fffbeb;
  --accent-100: #fef3c7;
  --accent-200: #fde68a;
  --accent-300: #fcd34d;
  --accent-400: #fbbf24;
  --accent-500: #f59e0b;
  --accent-600: #d97706;
  --accent-700: #b45309;

  /* ── Couleurs Sémantiques ── */
  --success-50: #ecfdf5;
  --success-100: #d1fae5;
  --success-400: #34d399;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;

  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-400: #f87171;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;

  --warning-50: #fff7ed;
  --warning-100: #ffedd5;
  --warning-400: #fb923c;
  --warning-500: #f97316;
  --warning-600: #ea580c;

  /* ── Neutres ── */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --slate-950: #020617;

  /* ── Thème Clair (Défaut) ── */
  --bg-app: var(--slate-50);
  --bg-card: #ffffff;
  --bg-card-hover: var(--slate-50);
  --bg-input: #ffffff;
  --bg-modal: #ffffff;
  --bg-nav: rgba(255, 255, 255, 0.92);
  --bg-header: rgba(255, 255, 255, 0.85);
  --bg-skeleton: var(--slate-200);

  --text-primary: var(--slate-900);
  --text-secondary: var(--slate-600);
  --text-tertiary: var(--slate-400);
  --text-inverse: #ffffff;

  --border-color: var(--slate-200);
  --border-focus: var(--primary-500);
  --divider: var(--slate-100);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

  /* ── Typographie ── */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;

  --text-xs: 0.6875rem;    /* 11px */
  --text-sm: 0.8125rem;    /* 13px */
  --text-base: 0.9375rem;  /* 15px */
  --text-lg: 1.0625rem;    /* 17px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */

  /* ── Espacement ── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* ── Border Radius ── */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1.125rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* ── Transitions ── */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* ── Layout ── */
  --header-height: 56px;
  --nav-height: 64px;
  --max-width: 480px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ═══════════════════════════════════════════════════════════════════
   1b. MODE SOMBRE
   ═══════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg-app: var(--slate-950);
  --bg-card: var(--slate-900);
  --bg-card-hover: var(--slate-800);
  --bg-input: var(--slate-800);
  --bg-modal: var(--slate-900);
  --bg-nav: rgba(15, 23, 42, 0.92);
  --bg-header: rgba(15, 23, 42, 0.85);
  --bg-skeleton: var(--slate-800);

  --text-primary: var(--slate-50);
  --text-secondary: var(--slate-400);
  --text-tertiary: var(--slate-500);

  --border-color: var(--slate-700);
  --divider: var(--slate-800);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(59, 130, 246, 0.25);
}

/* ═══════════════════════════════════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100dvh;
  transition: background var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out);
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ═══════════════════════════════════════════════════════════════════
   3. APP SHELL & LAYOUT
   ═══════════════════════════════════════════════════════════════════ */

/* ── Auth Screen ── */
.auth-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: linear-gradient(145deg, var(--slate-900), var(--slate-950));
  position: relative;
  overflow: hidden;
}

.auth-screen::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -30%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12), transparent 70%);
  pointer-events: none;
}

.auth-screen::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -20%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.08), transparent 70%);
  pointer-events: none;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.auth-logo-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-4);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
  animation: floatSlow 6s ease-in-out infinite;
}

.auth-logo h1 {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.auth-logo p {
  color: var(--slate-400);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

.auth-card {
  background: rgba(30, 41, 59, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(100, 116, 139, 0.15);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-xl);
}

.auth-tabs {
  display: flex;
  gap: var(--space-1);
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-lg);
  padding: 3px;
  margin-bottom: var(--space-6);
}

.auth-tab {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  color: var(--slate-400);
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-out);
}

.auth-tab.active {
  background: var(--primary-600);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--slate-500);
  font-size: var(--text-sm);
  margin: var(--space-2) 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--slate-700);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--slate-600);
  border-radius: var(--radius-lg);
  color: var(--slate-300);
  font-weight: 500;
  font-size: var(--text-sm);
  transition: all var(--duration-normal) var(--ease-out);
}

.btn-google:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--slate-500);
}

/* ── App Shell ── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

/* ── App Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-4);
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-header-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  overflow: hidden;
  flex-shrink: 0;
}

.app-header-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Views Container ── */
.views-container {
  flex: 1;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--space-4));
  overflow-y: auto;
}

.tab-view {
  display: none;
  padding: var(--space-4);
  animation: fadeSlideUp 0.35s var(--ease-out);
}

.tab-view.active {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   4. BOTTOM NAVIGATION BAR
   ═══════════════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-nav);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: stretch;
  z-index: 200;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: var(--space-1) 0;
  position: relative;
  transition: color var(--duration-normal) var(--ease-out);
}

.nav-item svg,
.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  transition: transform var(--duration-normal) var(--ease-bounce);
}

.nav-item.active {
  color: var(--primary-500);
}

.nav-item.active svg,
.nav-item.active .nav-icon {
  transform: scale(1.15);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 25%;
  right: 25%;
  height: 2.5px;
  background: var(--primary-500);
  border-radius: 0 0 var(--radius-full) var(--radius-full);
}

.nav-item:active svg {
  transform: scale(0.9);
}

.nav-label {
  font-size: 10px;
  letter-spacing: 0.01em;
}

/* ═══════════════════════════════════════════════════════════════════
   5. CARDS & WIDGETS
   ═══════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:active {
  transform: scale(0.98);
}

/* ── Stat Cards / KPIs ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.stat-card--primary::before { background: linear-gradient(90deg, var(--primary-400), var(--primary-600)); }
.stat-card--success::before { background: linear-gradient(90deg, var(--success-400), var(--success-600)); }
.stat-card--danger::before  { background: linear-gradient(90deg, var(--danger-400), var(--danger-600)); }
.stat-card--accent::before  { background: linear-gradient(90deg, var(--accent-400), var(--accent-600)); }

.stat-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-bottom: var(--space-3);
}

.stat-card--primary .stat-card-icon { background: var(--primary-50); color: var(--primary-600); }
.stat-card--success .stat-card-icon { background: var(--success-50); color: var(--success-600); }
.stat-card--danger .stat-card-icon  { background: var(--danger-50); color: var(--danger-600); }
.stat-card--accent .stat-card-icon  { background: var(--accent-50); color: var(--accent-600); }

[data-theme="dark"] .stat-card--primary .stat-card-icon { background: rgba(59,130,246,0.15); }
[data-theme="dark"] .stat-card--success .stat-card-icon { background: rgba(16,185,129,0.15); }
[data-theme="dark"] .stat-card--danger .stat-card-icon  { background: rgba(239,68,68,0.15); }
[data-theme="dark"] .stat-card--accent .stat-card-icon  { background: rgba(245,158,11,0.15); }

.stat-card-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.stat-card-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--space-1);
  font-weight: 500;
}

/* ── Hero Stat (Full Width) ── */
.hero-stat {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
  border: none;
  color: #fff;
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
  position: relative;
  overflow: hidden;
}

.hero-stat::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

.hero-stat-label {
  font-size: var(--text-sm);
  opacity: 0.8;
  margin-bottom: var(--space-1);
  font-weight: 500;
}

.hero-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero-stat-sub {
  font-size: var(--text-sm);
  opacity: 0.7;
  margin-top: var(--space-2);
}

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: var(--space-3);
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--accent-400), var(--accent-300));
  transition: width 0.8s var(--ease-out);
}

/* ═══════════════════════════════════════════════════════════════════
   6. FILTER BAR
   ═══════════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2) 0;
  margin-bottom: var(--space-4);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

.filter-chip.active {
  background: var(--primary-500);
  color: #fff;
  border-color: var(--primary-500);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.filter-chip:active {
  transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════════════
   7. BUTTONS
   ═══════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: var(--text-sm);
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: #fff;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500), var(--success-700));
  color: #fff;
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-500), var(--danger-700));
  color: #fff;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.3);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent-500), var(--accent-700));
  color: #fff;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
}

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

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--primary-500);
  color: var(--primary-500);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

.btn-block {
  width: 100%;
}

/* ── FAB (Floating Action Button) ── */
.fab-container {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.fab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  border: none;
  border-radius: var(--radius-xl);
  font-weight: 700;
  font-size: var(--text-sm);
  color: #fff;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-lg);
}

.fab:active {
  transform: scale(0.96);
}

.fab--green {
  background: linear-gradient(135deg, var(--success-500), var(--success-700));
}

.fab--red {
  background: linear-gradient(135deg, var(--danger-500), var(--danger-700));
}

.fab-icon {
  font-size: var(--text-xl);
  font-weight: 800;
}

/* ═══════════════════════════════════════════════════════════════════
   8. FORMS
   ═══════════════════════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: all var(--duration-fast) var(--ease-out);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.825a.5.5 0 01-.354-.146l-3.5-3.5a.5.5 0 11.708-.708L6 7.618l3.146-3.147a.5.5 0 11.708.708l-3.5 3.5A.5.5 0 016 8.825z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 12px;
  padding-right: var(--space-10);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger-500);
}

/* ── File Input / Image Upload ── */
.file-upload {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  background: var(--bg-card);
  text-align: center;
}

.file-upload:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
}

[data-theme="dark"] .file-upload:hover {
  background: rgba(59, 130, 246, 0.05);
}

.file-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.file-upload-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
}

.file-preview {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

/* ═══════════════════════════════════════════════════════════════════
   9. BADGES
   ═══════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge--occupied,
.badge--solde {
  background: var(--success-50);
  color: var(--success-700);
  border: 1px solid var(--success-100);
}

.badge--vacant {
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid var(--primary-100);
}

.badge--travaux {
  background: var(--warning-50);
  color: var(--warning-600);
  border: 1px solid var(--warning-100);
}

.badge--acompte,
.badge--partiel {
  background: var(--accent-50);
  color: var(--accent-700);
  border: 1px solid var(--accent-100);
}

.badge--retard,
.badge--impaye {
  background: var(--danger-50);
  color: var(--danger-700);
  border: 1px solid var(--danger-100);
}

.badge--attente {
  background: var(--slate-100);
  color: var(--slate-600);
  border: 1px solid var(--slate-200);
}

[data-theme="dark"] .badge--occupied,
[data-theme="dark"] .badge--solde { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.2); }
[data-theme="dark"] .badge--vacant { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.2); }
[data-theme="dark"] .badge--travaux { background: rgba(249,115,22,0.12); border-color: rgba(249,115,22,0.2); }
[data-theme="dark"] .badge--acompte,
[data-theme="dark"] .badge--partiel { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.2); }
[data-theme="dark"] .badge--retard,
[data-theme="dark"] .badge--impaye { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.2); }
[data-theme="dark"] .badge--attente { background: rgba(100,116,139,0.12); border-color: rgba(100,116,139,0.2); }

/* ═══════════════════════════════════════════════════════════════════
   10. LISTS & LIST ITEMS
   ═══════════════════════════════════════════════════════════════════ */
.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.list-item:hover {
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-sm);
}

.list-item:active {
  transform: scale(0.99);
}

.list-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.list-item-avatar--blue { background: var(--primary-50); color: var(--primary-600); }
.list-item-avatar--green { background: var(--success-50); color: var(--success-600); }
.list-item-avatar--amber { background: var(--accent-50); color: var(--accent-600); }
.list-item-avatar--red { background: var(--danger-50); color: var(--danger-600); }

[data-theme="dark"] .list-item-avatar--blue { background: rgba(59,130,246,0.15); }
[data-theme="dark"] .list-item-avatar--green { background: rgba(16,185,129,0.15); }
[data-theme="dark"] .list-item-avatar--amber { background: rgba(245,158,11,0.15); }
[data-theme="dark"] .list-item-avatar--red { background: rgba(239,68,68,0.15); }

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

.list-item-title {
  font-weight: 600;
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 1px;
}

.list-item-end {
  text-align: right;
  flex-shrink: 0;
}

.list-item-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
}

.list-item-date {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-1);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
}

.section-action {
  font-size: var(--text-xs);
  color: var(--primary-500);
  font-weight: 600;
  cursor: pointer;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-tertiary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--text-sm);
  max-width: 280px;
  margin: 0 auto var(--space-4);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════
   11. MODALES
   ═══════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: var(--max-width);
  max-height: 92dvh;
  background: var(--bg-modal);
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease-out);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--slate-300);
  border-radius: var(--radius-full);
  margin: var(--space-3) auto var(--space-2);
  flex-shrink: 0;
}

[data-theme="dark"] .modal-handle {
  background: var(--slate-600);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4) var(--space-3);
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
}

.modal-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--bg-card-hover);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-lg);
  transition: all var(--duration-fast);
}

.modal-close:hover {
  background: var(--danger-50);
  color: var(--danger-500);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  overscroll-behavior: contain;
}

.modal-body .form-group + .form-group {
  margin-top: var(--space-4);
}

.modal-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--divider);
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

.modal-footer .btn {
  flex: 1;
}

/* ── Confirmation Modal ── */
.confirm-modal .modal {
  max-height: auto;
  border-radius: var(--radius-2xl);
  margin: var(--space-4);
}

.confirm-content {
  text-align: center;
  padding: var(--space-6) var(--space-4);
}

.confirm-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto var(--space-4);
  background: var(--danger-50);
}

.confirm-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.confirm-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════════════
   12. TOASTS / NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - var(--space-8));
  max-width: 400px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--slate-800);
  color: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  animation: toastIn 0.4s var(--ease-out), toastOut 0.3s var(--ease-out) forwards;
  animation-delay: 0s, var(--toast-duration, 3s);
}

.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
}

.toast--success { border-left: 3px solid var(--success-400); }
.toast--error   { border-left: 3px solid var(--danger-400); }
.toast--warning { border-left: 3px solid var(--warning-400); }
.toast--info    { border-left: 3px solid var(--primary-400); }

/* ═══════════════════════════════════════════════════════════════════
   13. GALLERY & PROOF VIEWER
   ═══════════════════════════════════════════════════════════════════ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border-color);
  transition: transform var(--duration-fast);
}

.gallery-item:active {
  transform: scale(0.95);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-1) var(--space-2);
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 9px;
  font-weight: 600;
}

/* ── Fullscreen Viewer ── */
.fullscreen-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal);
}

.fullscreen-viewer.open {
  opacity: 1;
  pointer-events: auto;
}

.fullscreen-viewer img {
  max-width: 95%;
  max-height: 80dvh;
  object-fit: contain;
  border-radius: var(--radius-lg);
}

.fullscreen-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: var(--text-xl);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* ═══════════════════════════════════════════════════════════════════
   14. VOCAL ASSISTANT
   ═══════════════════════════════════════════════════════════════════ */
.vocal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  max-width: 460px;
  margin: 0 auto;
}

.vocal-mic-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.vocal-mic {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.3rem;
  color: #fff;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  transition: all var(--duration-normal);
  cursor: pointer;
  position: relative;
}

.vocal-mic.recording {
  animation: micPulse 1.3s ease-in-out infinite;
  background: linear-gradient(135deg, var(--danger-500), var(--danger-700));
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.5);
}

.vocal-mic:active {
  transform: scale(0.94);
}

.vocal-mic-status {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  min-height: 20px;
}

.vocal-transcript-box {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.vocal-transcript-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.vocal-transcript {
  font-size: var(--text-base);
  color: var(--text-primary);
  font-style: italic;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-word;
}

.vocal-result-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  text-align: left;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.25s ease;
}

.vocal-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-3);
}

.vocal-result-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.vocal-tag--income {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.vocal-tag--expense {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.vocal-result-amount {
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text-primary);
}

.vocal-result-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.vocal-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vocal-detail-label {
  color: var(--text-secondary);
}

.vocal-detail-val {
  color: var(--text-primary);
  text-align: right;
}

.vocal-result-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vocal-examples-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  text-align: left;
}

.vocal-examples-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.vocal-example-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--duration-fast);
  margin-bottom: 2px;
}

.vocal-example-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.vocal-example-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.vocal-manual-test {
  width: 100%;
  padding-bottom: var(--space-8);
}

/* ═══════════════════════════════════════════════════════════════════
   15. PROFILE SCREEN
   ═══════════════════════════════════════════════════════════════════ */
.profile-header {
  text-align: center;
  padding: var(--space-6) var(--space-4);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-400), var(--primary-600));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  font-weight: 700;
  margin: 0 auto var(--space-3);
}

.profile-name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
}

.profile-email {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.profile-menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.profile-menu-item:hover {
  background: var(--bg-card-hover);
}

.profile-menu-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.profile-menu-label {
  flex: 1;
  font-weight: 600;
  font-size: var(--text-sm);
}

.profile-menu-arrow {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* ── Theme Toggle ── */
.theme-toggle {
  width: 52px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--slate-300);
  border: none;
  position: relative;
  cursor: pointer;
  transition: background var(--duration-normal);
}

[data-theme="dark"] .theme-toggle {
  background: var(--primary-600);
}

.theme-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background: #fff;
  transition: transform var(--duration-normal) var(--ease-bounce);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

[data-theme="dark"] .theme-toggle::after {
  transform: translateX(24px);
}

/* ═══════════════════════════════════════════════════════════════════
   16. QUITTANCE PDF TEMPLATE (A4)
   ═══════════════════════════════════════════════════════════════════ */
.receipt-a4 {
  width: 210mm;
  height: 295mm;
  max-height: 295mm;
  box-sizing: border-box;
  padding: 10mm 15mm;
  overflow: hidden;
  background: #fff;
  color: #1a1a1a;
  font-family: 'Inter', serif;
  font-size: 10pt;
  line-height: 1.3;
  position: absolute;
  left: -9999px;
  top: 0;
}

.receipt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8mm;
  padding-bottom: 4mm;
  border-bottom: 2px solid #1d4ed8;
}

.receipt-logo {
  max-width: 60mm;
  max-height: 25mm;
  object-fit: contain;
}

.receipt-bailleur {
  text-align: right;
  font-size: 9pt;
  color: #555;
}

.receipt-bailleur strong {
  font-size: 12pt;
  color: #1a1a1a;
  display: block;
  margin-bottom: 1mm;
}

.receipt-title {
  text-align: center;
  font-family: var(--font-display);
  font-size: 14pt;
  font-weight: 700;
  color: #1d4ed8;
  margin-bottom: 6mm;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.receipt-section {
  margin-bottom: 5mm;
}

.receipt-section h3 {
  font-size: 10pt;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1mm;
  padding-bottom: 1mm;
  border-bottom: 1px solid #e2e8f0;
}

.receipt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2mm 5mm;
}

.receipt-field {
  font-size: 9pt;
}

.receipt-field-label {
  color: #777;
  font-size: 8pt;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.receipt-field-value {
  font-weight: 600;
  color: #1a1a1a;
}

.receipt-amount-box {
  background: #f0f4ff;
  border: 1px solid #1d4ed8;
  border-radius: 4mm;
  padding: 2mm;
  text-align: center;
  margin: 2mm 0;
}

.receipt-amount-value {
  font-family: var(--font-display);
  font-size: 18pt;
  font-weight: 800;
  color: #1d4ed8;
}

.receipt-amount-words {
  font-style: italic;
  font-size: 10pt;
  color: #555;
  margin-top: 2mm;
}

.receipt-footer {
  margin-top: 6mm;
  display: flex;
  justify-content: flex-end;
  align-items: flex-end;
}

.receipt-stamp {
  position: absolute;
  bottom: -15mm;
  left: -20mm;
  z-index: 3;
  pointer-events: none;
}

.receipt-stamp img {
  width: 28mm;
  height: 28mm;
  max-width: 28mm;
  max-height: 28mm;
  opacity: 0.85;
  transform: rotate(-6deg);
}

.receipt-signature {
  text-align: right;
  font-size: 9pt;
  color: #555;
}

.receipt-mention {
  margin-top: 8mm;
  font-size: 8pt;
  color: #999;
  text-align: center;
  border-top: 1px solid #e2e8f0;
  padding-top: 3mm;
}

/* ═══════════════════════════════════════════════════════════════════
   17. ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
}

@keyframes floatSlow {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes micPulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70%  { box-shadow: 0 0 0 20px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

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

/* ── Skeleton Loader ── */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-skeleton) 25%,
    rgba(148, 163, 184, 0.15) 50%,
    var(--bg-skeleton) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ── Loading Spinner ── */
.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-color);
  border-top-color: var(--primary-500);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

.is-busy,
button.is-busy,
.btn.is-busy {
  opacity: 0.82 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}

.inline-btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: -1px;
}

#global-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #a855f7, #ec4899);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
  z-index: 99999;
  display: none;
}
#global-loading-bar.active {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   18. UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-success { color: var(--success-500); }
.text-danger  { color: var(--danger-500); }
.text-warning { color: var(--warning-500); }
.text-muted   { color: var(--text-tertiary); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-display { font-family: var(--font-display); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* ── WhatsApp Button ── */
.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  box-shadow: 0 2px 12px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════
   19. RESPONSIVE — TABLET & DESKTOP (HYPER-RESPONSIVE)
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  :root {
    --max-width: 100%;
    --nav-height: 56px;
    --header-height: 64px;
  }

  /* ── App Shell & Header ── */
  .app-shell {
    max-width: 100%;
    width: 100%;
    margin: 0;
    border-left: none;
    border-right: none;
    min-height: 100vh;
  }

  .app-header {
    height: var(--header-height);
    padding: 0 calc(max(var(--space-6), (100% - 1360px) / 2));
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 210;
  }

  .app-header-brand h1 {
    font-size: var(--text-xl);
  }

  /* ── Desktop Horizontal Navigation Bar ── */
  .bottom-nav {
    order: 2;
    position: sticky;
    top: var(--header-height);
    bottom: auto;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: 100%;
    height: var(--nav-height);
    padding: 0 calc(max(var(--space-6), (100% - 1360px) / 2));
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: none;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-2);
    z-index: 200;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .bottom-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
  }

  .nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
  }

  .nav-item.active {
    color: var(--primary-400);
    background: rgba(59, 130, 246, 0.12);
    font-weight: 700;
  }

  .nav-item svg,
  .nav-item .nav-icon {
    width: 18px;
    height: 18px;
  }

  .nav-item.active svg,
  .nav-item.active .nav-icon {
    transform: none;
  }

  /* ── Views Container & Tab Views ── */
  .views-container {
    order: 3;
    width: 100%;
    max-width: 100%;
    padding: var(--space-6) calc(max(var(--space-6), (100% - 1360px) / 2)) var(--space-12);
  }

  .tab-view {
    padding: 0;
  }

  /* ── 1. Caisse / Recouvrement ── */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-5);
  }

  .hero-stat {
    padding: var(--space-6);
    border-radius: var(--radius-2xl);
    margin-bottom: var(--space-5);
  }

  .fab-container {
    display: flex;
    gap: var(--space-4);
    justify-content: flex-start;
    margin-bottom: var(--space-6);
  }

  .fab-container .fab {
    flex: 0 0 auto;
    min-width: 200px;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-xl);
  }

  #payments-list,
  #expenses-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--space-3);
  }

  #payments-list .empty-state,
  #expenses-list .empty-state {
    grid-column: 1 / -1;
  }

  #payments-list .list-item,
  #expenses-list .list-item {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s var(--ease-out), border-color 0.2s, box-shadow 0.2s;
  }

  #payments-list .list-item:hover,
  #expenses-list .list-item:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: var(--shadow-md);
  }

  /* ── 2. Patrimoine Immobilier (Biens) ── */
  #view-biens .card {
    border-radius: var(--radius-2xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
  }

  #view-biens .card .list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-3);
  }

  #view-biens .card .list .list-item {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    background: rgba(30, 41, 59, 0.35);
    transition: transform 0.2s var(--ease-out), border-color 0.2s;
  }

  #view-biens .card .list .list-item:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.4);
  }

  #view-biens [data-action="add-unit"] {
    grid-column: 1 / -1;
    max-width: 260px;
    margin-top: var(--space-4);
  }

  /* ── 3. Locataires ── */
  #view-locataires .list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: var(--space-3);
  }

  #view-locataires .empty-state {
    grid-column: 1 / -1;
  }

  #view-locataires .list-item {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: var(--space-4);
    transition: transform 0.2s var(--ease-out), border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
  }

  #view-locataires .list-item:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: var(--shadow-md);
  }

  /* ── 4. Coffre-fort des Preuves ── */
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
  }

  .gallery-item {
    border-radius: var(--radius-xl);
    overflow: hidden;
    aspect-ratio: 4/5;
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s;
  }

  .gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
  }

  .gallery-item:hover img {
    transform: scale(1.04);
  }

  /* ── 5. Assistant Vocal ── */
  #view-vocal .vocal-container {
    max-width: 680px;
    margin: 0 auto;
    padding: var(--space-6) 0;
  }

  /* ── 6. Profil Bailleur & Paramètres ── */
  #view-profil .profile-header {
    max-width: 900px;
    margin: 0 auto var(--space-6);
    text-align: center;
  }

  #view-profil .profile-menu {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: var(--space-3);
  }

  #view-profil .profile-menu-item {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: var(--space-4);
    transition: transform 0.2s var(--ease-out), border-color 0.2s;
  }

  #view-profil .profile-menu-item:hover {
    transform: translateY(-2px);
    border-color: rgba(59, 130, 246, 0.4);
  }

  #view-profil [data-action="open-admin-master-dashboard"],
  #view-profil [data-action="open-admin-payouts"],
  #view-profil [data-action="open-signature-hub"],
  #view-profil [data-action="open-team"] {
    grid-column: 1 / -1;
  }

  /* ── Modales Desktop ── */
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
  }

  .modal {
    max-width: 640px;
    max-height: 88vh;
    border-radius: var(--radius-2xl);
    margin: auto;
    transform: scale(0.96);
    opacity: 0;
    transition: transform var(--duration-normal) var(--ease-out), opacity var(--duration-normal) var(--ease-out);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  .modal-overlay.open .modal {
    transform: scale(1);
    opacity: 1;
  }

  .modal-handle {
    display: none;
  }

  /* Modales Larges (Contrats OHADA, EDL Inventaire, Admin Master) */
  .modal.modal--wide,
  .modal:has(.ohada-contract-preview),
  .modal:has(.edl-preview),
  .modal:has(#edl-config-form),
  .modal:has(#admin-master-container),
  .modal:has(.admin-payouts-table) {
    max-width: 980px;
    width: 95vw;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   20. PRINT STYLES
   ═══════════════════════════════════════════════════════════════════ */
@media print {
  body * { visibility: hidden; }
  .receipt-a4,
  .receipt-a4 * {
    visibility: visible;
  }
  .receipt-a4 {
    position: static;
    width: 100%;
    padding: 10mm;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   21. PRICING & SUBSCRIPTIONS
   ═══════════════════════════════════════════════════════════════════ */
.pricing-card {
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  margin-bottom: var(--space-3);
  position: relative;
  transition: all var(--transition-fast);
}

.pricing-card--popular {
  border-color: var(--primary-500);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(99, 102, 241, 0.05));
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

.pricing-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-badge--free {
  background: rgba(148, 163, 184, 0.15);
  color: var(--slate-400);
}

.pricing-badge--popular {
  background: var(--primary-500);
  color: #fff;
}

.pricing-badge--enterprise {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
}

.pricing-price {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: var(--space-2) 0;
}

.pricing-price small {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.pricing-features li {
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.pricing-features li span.check {
  color: var(--success-500);
  font-weight: 700;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   MODULE MULTI-AGENTS & COLLECTE TERRAIN
   ═══════════════════════════════════════════ */
.collect-hero {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 95, 70, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.collect-hero::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.agent-tenant-card {
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.agent-tenant-card:active {
  transform: scale(0.99);
}

.badge--agent {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.15));
  color: var(--success-400);
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-weight: 700;
}

/* ═══════════════════════════════════════════
   HUB DE SIGNATURE ÉLECTRONIQUE & GED IN-APP
   ═══════════════════════════════════════════ */
.ged-hero {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.14), rgba(236, 72, 153, 0.08));
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
  margin-bottom: 14px;
}

.ged-hero::after {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 110px;
  height: 110px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.ged-stat-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: left;
}

.ged-stat-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.ged-stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-top: 2px;
}

.ged-doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ged-doc-card:hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.ged-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.ged-doc-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ged-signature-canvas-wrapper {
  background: #ffffff;
  border: 2px dashed #94a3b8;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  margin: 12px 0;
  touch-action: none;
}

.ged-signature-canvas-wrapper canvas {
  width: 100%;
  height: 160px;
  display: block;
  cursor: crosshair;
}

.ged-signature-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #94a3b8;
  font-size: 12px;
  font-style: italic;
  pointer-events: none;
}



