/* =========================================================
   Prosperio — Thèmes sombre & clair
   Fabriqué par: Technologies Nexios TF Inc. | nexiostf.com
   ========================================================= */

:root {
  --bg-primary:    #070B14;
  --bg-secondary:  #0D1526;
  --bg-card:       #141F35;
  --bg-input:      #1C2D4A;
  --accent-blue:   #2563EB;
  --accent-violet: #7C3AED;
  --accent-green:  #10B981;
  --accent-red:    #EF4444;
  --accent-amber:  #F59E0B;
  --text-primary:  #F0F5FF;
  --text-muted:    #8FA3BC;
  --border:        rgba(99,102,241,0.15);
  --radius:        8px;
  --radius-lg:     16px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --transition:    all 0.2s ease;
}

/* ── Thème clair ──────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary:    #fbfbfb;
  --bg-secondary:  #f0f2f7;
  --bg-card:       #ffffff;
  --bg-input:      #f5f6fa;
  --text-primary:  #111827;
  --text-muted:    #6b7280;
  --border:        rgba(99,102,241,0.2);
  --shadow:        0 4px 24px rgba(0,0,0,0.08);
}
[data-theme="light"] body { background-color: var(--bg-primary); color: var(--text-primary); }
[data-theme="light"] .login-page {
  background: radial-gradient(ellipse at center, #e8eaf6 0%, #fbfbfb 70%);
}
[data-theme="light"] select {
  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='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.35); }
[data-theme="light"] tbody tr:hover { background: rgba(37,99,235,0.04); }
/* Alertes : couleurs de texte lisibles sur fond clair */
[data-theme="light"] .alert-error   { color: #b91c1c; background: rgba(239,68,68,0.08);  }
[data-theme="light"] .alert-success { color: #065f46; background: rgba(16,185,129,0.08); }
[data-theme="light"] .alert-info    { color: #1e40af; background: rgba(37,99,235,0.08);  }
[data-theme="light"] .alert-warning { color: #92400e; background: rgba(245,158,11,0.08); }
[data-theme="light"] .countdown-badge { color: #b91c1c; }
[data-theme="light"] .countdown-num   { color: #b91c1c; }
[data-theme="light"] .toast { background: #ffffff; color: var(--text-primary); }
[data-theme="light"] .zadmin-sidebar { background: #f0f2f7; }

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

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typographie ──────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

/* ── Utilitaires ──────────────────────────────────────── */
.text-muted    { color: var(--text-muted); }
.text-green    { color: var(--accent-green); }
.text-red      { color: var(--accent-red); }
.text-amber    { color: var(--accent-amber); }
.text-blue     { color: var(--accent-blue); }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ── Boutons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: var(--accent-blue);   color: #fff; }
.btn-primary:hover   { background: #1d4ed8; }
.btn-success   { background: var(--accent-green);  color: #fff; }
.btn-success:hover   { background: #059669; }
.btn-danger    { background: var(--accent-red);    color: #fff; }
.btn-danger:hover    { background: #dc2626; }
.btn-warning   { background: var(--accent-amber);  color: #000; }
.btn-warning:hover   { background: #d97706; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.btn-sm  { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-xs  { padding: 0.15rem 0.45rem; font-size: 0.75rem; }
.btn-icon { padding: 0.4rem; min-width: 2rem; justify-content: center; }

/* ── Formulaires ──────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.form-group label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.2s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}
input[type="checkbox"] { width: auto; accent-color: var(--accent-blue); }
textarea { resize: vertical; min-height: 80px; }
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='%238FA3BC' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.5rem; }

/* ── Cartes ───────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

/* ── Tableau ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(99,102,241,0.08);
  vertical-align: middle;
}
tbody tr:hover { background: rgba(37,99,235,0.05); }
tbody tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-green  { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.badge-red    { background: rgba(239,68,68,0.15);  color: var(--accent-red); }
.badge-amber  { background: rgba(245,158,11,0.15); color: var(--accent-amber); }
.badge-blue   { background: rgba(37,99,235,0.15);  color: var(--accent-blue); }

/* ── Barre de progression ─────────────────────────────── */
.progress-bar-wrap {
  background: var(--bg-input);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  min-width: 80px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-violet));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-bar-fill.danger { background: linear-gradient(90deg, var(--accent-amber), var(--accent-red)); }

/* ── Alertes ──────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-info    { background: rgba(37,99,235,0.1);  border: 1px solid rgba(37,99,235,0.3);  color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #fcd34d; }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow);
  transform: translateY(-20px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1.25rem; padding: 0.25rem;
  border-radius: var(--radius); transition: color 0.2s;
}
.modal-close:hover { color: var(--text-primary); }
.modal-footer {
  display: flex; gap: 0.75rem; justify-content: flex-end;
  margin-top: 1.25rem; padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ── Header / Nav ─────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(7,11,20,0.85);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 140px;
  display: flex; align-items: center; justify-content: space-between;
  backdrop-filter: blur(12px);
}
[data-theme="light"] .header { background: rgba(251,251,251,0.88); }
.header-logo {
  font-size: 1.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex; align-items: center;
}
.header-logo-img { max-height: 140px; max-width: 360px; object-fit: contain; -webkit-text-fill-color: initial; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
/* Dropdown langue */
.lang-dropdown { position: relative; }
.lang-dropdown-toggle {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 0.3rem 0.75rem; border-radius: var(--radius); cursor: pointer;
  font-size: 0.82rem; font-weight: 600; transition: var(--transition);
  white-space: nowrap;
}
.lang-dropdown-toggle:hover { border-color: var(--accent-blue); color: var(--accent-blue); }
.lang-menu {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 150px; z-index: 200;
  box-shadow: var(--shadow); overflow: hidden;
}
.lang-menu.open { display: block; }
.lang-menu .lang-btn {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--text-primary);
  padding: 0.55rem 1rem; cursor: pointer; font-size: 0.88rem;
  transition: background 0.15s;
}
.lang-menu .lang-btn:hover { background: rgba(37,99,235,0.1); color: var(--accent-blue); }
.lang-menu .lang-btn.active { color: var(--accent-blue); font-weight: 700; background: rgba(37,99,235,0.08); }

/* ── Avatar utilisateur ──────────────────────────────── */
.user-dropdown { position: relative; }
.user-avatar-btn {
  width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--accent-blue); border: 2px solid transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 700; color: #fff; flex-shrink: 0;
  transition: var(--transition);
}
.user-avatar-btn:hover { background: var(--accent-violet); transform: scale(1.08); }
.user-avatar-btn[aria-expanded="true"] { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.25); }
.user-menu {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 210px; z-index: 300;
  box-shadow: var(--shadow); overflow: hidden;
}
.user-menu.open { display: block; }
.user-menu-header { padding: 0.9rem 1rem 0.8rem; border-bottom: 1px solid var(--border); }
.user-menu-name { font-weight: 700; font-size: 0.92rem; color: var(--text-primary); }
.user-menu-meta { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.3rem; flex-wrap: wrap; }
.user-menu-role { font-size: 0.75rem; color: var(--text-muted); }
.user-menu-plan { font-size: 0.73rem; font-weight: 600; padding: 0.1rem 0.45rem; border-radius: 999px; }
.badge-blue  { background: rgba(37,99,235,0.15); color: var(--accent-blue); }
.badge-green { background: rgba(16,185,129,0.15); color: var(--accent-green); }
.user-menu-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--text-primary);
  padding: 0.6rem 1rem; cursor: pointer; font-size: 0.88rem;
  transition: background 0.15s; text-decoration: none;
}
.user-menu-item:hover { background: rgba(37,99,235,0.08); color: var(--accent-blue); }
.user-menu-logout { color: var(--accent-red) !important; }
.user-menu-logout:hover { background: rgba(239,68,68,0.08) !important; color: var(--accent-red) !important; }
.user-menu-divider { height: 1px; background: var(--border); margin: 0; }

/* ── Navigation onglets ───────────────────────────────── */
.tab-nav {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  padding: 0 1.5rem;
  background: var(--bg-secondary);
  overflow-x: auto;
}
.tab-btn {
  background: none; border: none; color: var(--text-muted);
  padding: 0.85rem 1.25rem;
  cursor: pointer; font-size: 0.9rem; font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }

/* ── Bandeau résumé ───────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 1rem 1.5rem;
}
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}
.summary-card .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.summary-card .value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}

/* ── Contenu onglets ──────────────────────────────────── */
.tab-content { padding: 1.5rem; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section header (titre + bouton ajouter) ─────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.section-title { font-size: 1.1rem; font-weight: 700; }

/* ── Filtres ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.filter-bar select, .filter-bar input { width: auto; }

/* ── Graphiques ───────────────────────────────────────── */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.chart-container canvas { max-height: 280px; }
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* ── Page de connexion ────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0D1526 0%, #070B14 70%);
  padding: 1rem;
}
.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center;
  margin-bottom: 1.75rem;
}
.login-logo h1 {
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-logo p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.25rem; }
.app-logo { max-height: 56px; max-width: 180px; object-fit: contain; margin-bottom: 0.25rem; }

/* ── Plan picker (inscription) ───────────────────────── */
.plan-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.plan-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.6rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-align: center;
  user-select: none;
}
.plan-card:hover:not(.plan-card-disabled) { border-color: var(--accent-blue); background: rgba(37,99,235,0.05); }
.plan-card.selected { border-color: var(--accent-blue); background: rgba(37,99,235,0.1); box-shadow: 0 0 0 3px rgba(37,99,235,0.18); }
.plan-card-disabled { opacity: 0.45; cursor: not-allowed; }
.plan-card-header { display: flex; align-items: center; justify-content: center; gap: 0.3rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.plan-card-name { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); }
.plan-card-best { font-size: 0.62rem; background: var(--accent-amber); color: #000; border-radius: 999px; padding: 0.05rem 0.4rem; font-weight: 700; }
.plan-card-price { font-size: 1rem; font-weight: 800; color: var(--accent-blue); line-height: 1.1; margin-bottom: 0.2rem; }
.plan-card-desc { font-size: 0.68rem; color: var(--text-muted); line-height: 1.3; }
.plan-card-badge { font-size: 0.62rem; color: var(--text-muted); margin-top: 0.25rem; font-style: italic; }
@media (max-width: 420px) { .plan-cards { grid-template-columns: 1fr; } }
.countdown-badge {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-align: center;
  color: #fca5a5;
  margin-bottom: 1rem;
}
.countdown-num { font-size: 2rem; font-weight: 800; color: var(--accent-red); }

/* ── zadmin ───────────────────────────────────────────── */
.zadmin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.zadmin-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
}
.zadmin-sidebar .logo {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 2rem;
  color: var(--accent-amber);
}
.zadmin-nav-item {
  display: block;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
  transition: var(--transition);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.zadmin-nav-item:hover, .zadmin-nav-item.active {
  background: rgba(37,99,235,0.1);
  color: var(--accent-blue);
}
.zadmin-main { padding: 1.5rem; overflow: auto; }
.zadmin-section { display: none; }
.zadmin-section.active { display: block; }

/* ── Footer ───────────────────────────────────────────── */
.footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent-blue); }

/* ── Spinner ──────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notifications ──────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast.success { border-left: 3px solid var(--accent-green); }
.toast.error   { border-left: 3px solid var(--accent-red); }
.toast.info    { border-left: 3px solid var(--accent-blue); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Budget catégories ────────────────────────────────── */
.budget-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.budget-cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  position: relative;
}
.budget-cat-card.alerte { border-color: rgba(245,158,11,0.5); }
.budget-cat-card.depasse { border-color: rgba(239,68,68,0.5); }
.budget-cat-card__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.budget-cat-card__name { font-weight: 700; font-size: 0.95rem; }
.budget-cat-card__actions { display: flex; gap: 0.25rem; }
.budget-cat-card__amounts {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-muted);
  margin: 0.6rem 0 0.4rem;
}
.budget-cat-card__amounts strong { color: var(--text-primary); font-size: 0.88rem; }
.budget-cat-alert {
  font-size: 0.75rem; margin-top: 0.5rem; font-weight: 600;
}
.budget-cat-alert.warning { color: var(--accent-amber); }
.budget-cat-alert.danger  { color: var(--accent-red); }
.budget-cat-empty {
  grid-column: 1 / -1; text-align: center;
  color: var(--text-muted); padding: 1.5rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ── Utilitaires mobile ───────────────────────────────── */
.hidden-mobile { display: inline; }

/* ── zadmin overlay (masqué par défaut, visible uniquement sur mobile) ─── */
.zadmin-sidebar-overlay { display: none; }

/* ── zadmin hamburger (visible uniquement sur mobile) ─── */
.zadmin-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  margin-bottom: 1rem;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 767px) {
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; padding: 0.75rem 1rem; }
  .tab-content { padding: 1rem; }
  .header { padding: 0 0.75rem; height: auto; min-height: 56px; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .header-actions { gap: 0.5rem; flex-wrap: wrap; }
  .tab-nav { padding: 0 0.75rem; }
  .header-logo { font-size: 1.05rem; }
  h1 { font-size: 1.5rem; }
  .summary-card .value { font-size: 1.15rem; }
  .hidden-mobile { display: none !important; }
  .modal { padding: 1.25rem; }

  /* zadmin mobile */
  .zadmin-layout { grid-template-columns: 1fr; }
  .zadmin-sidebar {
    display: none;
    position: fixed; inset: 0; z-index: 500;
    width: 260px;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .zadmin-sidebar.open { display: block; }
  .zadmin-hamburger { display: block; }
  .zadmin-sidebar-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 499;
    background: rgba(0,0,0,0.5);
  }
  .zadmin-sidebar-overlay.open { display: block; }
}

@media (min-width: 768px) {
  .summary-grid { grid-template-columns: repeat(4, 1fr); }
  .charts-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1024px) {
  .charts-grid { grid-template-columns: 1fr 1fr; }
}

/* ── OCR Factures ─────────────────────────────────────────────────────────── */
.ocr-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-card);
}
.ocr-dropzone:hover, .ocr-dropzone.drag-over {
  border-color: var(--accent-blue);
  background: rgba(37,99,235,0.05);
}
.ocr-dropzone-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.ocr-dropzone-text { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }

.ocr-result-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.ocr-result-header {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600; font-size: 1rem;
}
.ocr-result-actions {
  display: flex; gap: 0.75rem; justify-content: flex-end;
  margin-top: 1.25rem;
}

.ocr-history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  background: var(--bg-card);
  gap: 1rem;
}
.ocr-history-item.confirmed { opacity: 0.7; }
.ocr-history-meta { display: flex; flex-direction: column; gap: 0.2rem; }
.ocr-history-name { font-weight: 600; }
.ocr-history-right {
  display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0;
}
.ocr-history-amount { font-weight: 700; color: var(--accent-blue); }

/* ── Andy Widget ──────────────────────────────────────────────────────────── */
#andy-widget {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
}

#andy-fab {
  width: 3.25rem; height: 3.25rem;
  border-radius: 50%;
  background: var(--accent-blue);
  color: #fff;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37,99,235,0.45);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex; align-items: center; justify-content: center;
}
#andy-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(37,99,235,0.55); }

#andy-panel {
  position: absolute;
  bottom: calc(100% + 0.75rem);
  right: 0;
  width: 340px;
  max-height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  flex-direction: column;
  overflow: hidden;
}

#andy-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem;
  background: var(--accent-blue);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

/* Conteneur dynamique du corps Andy */
#andy-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* ── Disclaimer / état désactivé ──────────────────────────────────────────── */
.andy-disclaimer {
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}
.andy-disclaimer-icon { font-size: 2rem; text-align: center; }
.andy-disclaimer h4   { font-size: 0.95rem; font-weight: 700; text-align: center; margin: 0; }
.andy-disclaimer p    { font-size: 0.84rem; line-height: 1.55; margin: 0; }
.andy-disclaimer-actions {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  margin-top: 0.5rem; flex-wrap: wrap;
}

/* Bandeau de rappel légal (affiché en haut du chat) */
.andy-disclaimer-bar {
  background: rgba(245,158,11,0.12);
  border-bottom: 1px solid rgba(245,158,11,0.3);
  color: var(--accent-amber);
  font-size: 0.73rem;
  padding: 0.35rem 0.75rem;
  text-align: center;
  flex-shrink: 0;
}

#andy-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 200px;
  max-height: 340px;
}

.andy-msg {
  max-width: 88%;
  padding: 0.6rem 0.9rem;
  border-radius: 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
}
.andy-msg--user {
  align-self: flex-end;
  background: var(--accent-blue);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}
.andy-msg--assistant {
  align-self: flex-start;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.25rem;
}

/* Indicateur de saisie (trois points animés) */
.andy-typing {
  display: flex; gap: 4px; align-items: center; padding: 0.6rem 0.9rem;
}
.andy-typing span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-muted);
  animation: andyDot 1.2s ease-in-out infinite;
}
.andy-typing span:nth-child(2) { animation-delay: 0.2s; }
.andy-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes andyDot {
  0%,80%,100% { transform: scale(0.8); opacity: 0.4; }
  40%         { transform: scale(1.2); opacity: 1; }
}

#andy-input-area {
  display: flex; align-items: flex-end; gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
#andy-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  font-family: inherit;
}
#andy-input:focus { outline: none; border-color: var(--accent-blue); }
#andy-send-btn {
  background: var(--accent-blue);
  border: none;
  color: #fff;
  width: 2.25rem; height: 2.25rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
#andy-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Abonnement — page dédiée */
.plan-card { border: 1px solid var(--border); border-radius: var(--radius); }
.plan-card--featured {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 1px var(--accent-blue);
}
.plan-price { font-size: 2rem; font-weight: 800; margin: 0.75rem 0; }
.plan-price span { font-size: 1rem; font-weight: 400; color: var(--text-muted); }
.plan-features {
  list-style: none; padding: 0; margin: 0.75rem 0;
  text-align: left; font-size: 0.88rem;
  display: flex; flex-direction: column; gap: 0.4rem;
}
.plan-badge-popular {
  position: absolute; top: -0.7rem; left: 50%; transform: translateX(-50%);
  background: var(--accent-blue); color: #fff;
  font-size: 0.72rem; font-weight: 700;
  padding: 0.2rem 0.75rem; border-radius: 99px; white-space: nowrap;
}
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid var(--accent-green); color: var(--accent-green); }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid var(--accent-amber); color: var(--accent-amber); }

@media (max-width: 600px) {
  #andy-panel { width: calc(100vw - 3rem); right: 0; }
}
