/* ============================================================
   GestionBudget — Design System
   Palette : Teal #0d7a8c · Orange #f97316 · Light theme
   ============================================================ */
:root {
  --teal:         #0d7a8c;
  --teal-dark:    #0a5f6d;
  --teal-darker:  #084d59;
  --teal-light:   #e0f7f9;
  --teal-mid:     #b2eaf0;
  --orange:       #f97316;
  --orange-dark:  #ea580c;
  --orange-light: #fff7ed;
  --green:        #22c55e;
  --green-light:  #f0fdf4;
  --red:          #ef4444;
  --red-light:    #fef2f2;
  --yellow:       #f59e0b;
  --bg:           #f0f5f7;
  --white:        #ffffff;
  --text:         #1e3a5f;
  --text-muted:   #64748b;
  --border:       #dde8ec;
  --sidebar-w:    248px;
  --header-h:     64px;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 2px 16px rgba(13,122,140,.10);
  --shadow-card:  0 2px 8px rgba(13,122,140,.08);
  --transition:   .2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img, svg { display: block; }
input, select, textarea, button { font: inherit; }

/* ── Layout ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--teal-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: var(--teal-darker);
}
.sidebar-logo img { height: 36px; width: auto; }
.sidebar-logo .logo-text { font-size: .7rem; color: rgba(255,255,255,.5); margin-top: 4px; letter-spacing: .05em; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}
.nav-section {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
  padding: 12px 8px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.75);
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  margin-bottom: 2px;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 4px 12px rgba(249,115,22,.35);
}
.nav-item.active svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,.2)); }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.08);
  cursor: pointer;
  transition: background var(--transition);
}
.user-chip:hover { background: rgba(255,255,255,.14); }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; color: #fff; flex-shrink: 0;
}
.user-chip-info { flex: 1; min-width: 0; }
.user-chip-name { font-size: .85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { font-size: .72rem; color: rgba(255,255,255,.5); }
.btn-logout { background: none; border: none; cursor: pointer; color: rgba(255,255,255,.5); padding: 4px; border-radius: 4px; transition: color var(--transition); }
.btn-logout:hover { color: var(--red); }

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top header ── */
.top-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(13,122,140,.06);
}
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.page-title span { color: var(--teal); }
.header-right { display: flex; align-items: center; gap: 12px; }
.month-picker {
  display: flex; align-items: center; gap: 6px;
  background: var(--teal-light); border: 1px solid var(--teal-mid);
  border-radius: 20px; padding: 5px 14px;
  font-size: .85rem; font-weight: 600; color: var(--teal);
}
.month-picker select { border: none; background: transparent; color: var(--teal); font-weight: 600; cursor: pointer; outline: none; }
.btn-hamburger { display: none; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; }

/* ── Page content ── */
.page-content { padding: 24px 28px; flex: 1; }

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  transform: translate(20px,-20px);
}
.stat-card.teal   { background: var(--teal); color: #fff; }
.stat-card.orange { background: var(--orange); color: #fff; }
.stat-card.green  { background: var(--green); color: #fff; }
.stat-card.red    { background: var(--red); color: #fff; }
.stat-card.purple { background: #7c3aed; color: #fff; }
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-info { flex: 1; }
.stat-label { font-size: .8rem; opacity: .85; font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.3rem; font-weight: 800; line-height: 1.2; }
.stat-sub { font-size: .75rem; opacity: .7; margin-top: 3px; }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-title span { color: var(--teal); }
.card-body { padding: 18px 22px; }

/* ── Charts grid ── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 18px;
  margin-bottom: 18px;
}
.chart-canvas-wrap { position: relative; height: 260px; }

/* ── Transactions table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 12px 14px;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 600;
  border-bottom: 2px solid var(--border);
  background: #f8fbfc;
}
td {
  padding: 13px 14px; font-size: .88rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--teal-light); }

.amount-pos { color: var(--green); font-weight: 700; }
.amount-neg { color: var(--red); font-weight: 700; }

.badge-type {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.badge-revenu  { background: var(--green-light); color: var(--green); }
.badge-depense { background: var(--red-light); color: var(--red); }

.cat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .82rem;
}
.cat-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

/* ── Action buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; border: none; cursor: pointer;
  transition: all var(--transition); white-space: nowrap;
}
.btn-primary   { background: var(--orange); color: #fff; box-shadow: 0 4px 12px rgba(249,115,22,.3); }
.btn-primary:hover { background: var(--orange-dark); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(249,115,22,.35); }
.btn-secondary { background: var(--teal); color: #fff; }
.btn-secondary:hover { background: var(--teal-dark); }
.btn-outline   { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.btn-outline:hover { background: var(--teal-light); }
.btn-danger    { background: var(--red-light); color: var(--red); border: 1px solid #fca5a5; }
.btn-danger:hover  { background: var(--red); color: #fff; }
.btn-icon  { padding: 8px; border-radius: var(--radius-sm); }
.btn-sm    { padding: 7px 14px; font-size: .8rem; }
.btn-lg    { padding: 13px 28px; font-size: .95rem; border-radius: 10px; }

/* ── FAB ── */
.fab {
  position: fixed; bottom: 30px; right: 30px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--orange); color: #fff; border: none; cursor: pointer;
  font-size: 1.6rem; box-shadow: 0 6px 20px rgba(249,115,22,.4);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); z-index: 40;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 8px 24px rgba(249,115,22,.5); }

/* ── Filter bar ── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--white); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 18px;
  box-shadow: var(--shadow-card); border: 1px solid var(--border);
}
.filter-bar label { font-size: .8rem; font-weight: 600; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.filter-bar select, .filter-bar input[type="month"] {
  padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .85rem; color: var(--text); background: var(--bg);
  outline: none; transition: border-color var(--transition);
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--teal); }
.filter-sep { flex: 1; }

/* ── Budget progress cards ── */
.budgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.budget-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.budget-card-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.budget-cat {
  display: flex; align-items: center; gap: 10px;
}
.budget-cat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.budget-cat-name { font-weight: 700; font-size: .95rem; }
.budget-cat-period { font-size: .75rem; color: var(--text-muted); }
.budget-amounts { text-align: right; }
.budget-dep  { font-weight: 800; font-size: 1rem; }
.budget-max  { font-size: .78rem; color: var(--text-muted); }
.progress-bar {
  height: 10px; border-radius: 20px;
  background: var(--border); overflow: hidden; margin: 6px 0;
}
.progress-fill {
  height: 100%; border-radius: 20px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.progress-fill.ok      { background: var(--green); }
.progress-fill.warning { background: var(--yellow); }
.progress-fill.danger  { background: var(--red); }
.progress-fill.teal    { background: var(--teal); }
.budget-footer {
  display: flex; justify-content: space-between; align-items: center; margin-top: 4px;
}
.budget-pct  { font-size: .8rem; font-weight: 700; }
.budget-rest { font-size: .78rem; color: var(--text-muted); }

/* ── Objectifs cards ── */
.objectifs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.objectif-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  position: relative;
}
.objectif-card.atteint { border-color: var(--green); }
.objectif-card.abandonne { opacity: .65; }
.obj-badge {
  position: absolute; top: 16px; right: 16px;
  padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700;
}
.obj-badge.en_cours  { background: var(--teal-light); color: var(--teal); }
.obj-badge.atteint   { background: var(--green-light); color: var(--green); }
.obj-badge.abandonne { background: #f1f5f9; color: var(--text-muted); }
.obj-desc { font-weight: 700; font-size: 1rem; margin-bottom: 4px; padding-right: 80px; }
.obj-deadline { font-size: .78rem; color: var(--text-muted); margin-bottom: 14px; }
.obj-deadline.soon { color: var(--red); font-weight: 600; }
.obj-amounts { display: flex; justify-content: space-between; margin-bottom: 8px; }
.obj-actuel  { font-weight: 800; font-size: 1.05rem; color: var(--teal); }
.obj-cible   { font-size: .82rem; color: var(--text-muted); align-self: flex-end; }
.obj-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── Alerts ── */
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 8px;
  border-left: 4px solid transparent;
}
.alert-item.ok      { border-left-color: var(--green); }
.alert-item.warning { border-left-color: var(--yellow); background: #fffbeb; }
.alert-item.danger  { border-left-color: var(--red); background: var(--red-light); }
.alert-icon { font-size: 1.2rem; flex-shrink: 0; }
.alert-info { flex: 1; }
.alert-cat  { font-weight: 600; font-size: .88rem; }
.alert-pct  { font-size: .78rem; color: var(--text-muted); }
.alert-badge { font-size: .8rem; font-weight: 700; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.btn-close {
  background: var(--bg); border: none; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1.1rem;
  transition: background var(--transition);
}
.btn-close:hover { background: var(--border); color: var(--text); }
.modal-body  { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Form ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label span { color: var(--red); }
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--text); background: var(--white);
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,122,140,.12); }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.type-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px;
}
.type-tab {
  padding: 10px; border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  text-align: center; font-weight: 600; font-size: .88rem;
  cursor: pointer; transition: all var(--transition);
}
.type-tab.depense.active  { border-color: var(--red); background: var(--red-light); color: var(--red); }
.type-tab.revenu.active   { border-color: var(--green); background: var(--green-light); color: var(--green); }
.type-tab:hover:not(.active) { border-color: var(--teal); }

/* ── Toast ── */
.toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 300; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius-sm);
  background: var(--white); box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 280px; max-width: 380px;
  animation: slideIn .3s ease;
  border-left: 4px solid var(--teal);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
.toast-icon { font-size: 1.2rem; flex-shrink: 0; }
.toast-msg  { flex: 1; font-size: .88rem; font-weight: 500; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1rem; padding: 0 2px; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(100%); } }
.toast.removing { animation: fadeOut .3s ease forwards; }

/* ── Auth page ── */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-brand {
  background: linear-gradient(145deg, var(--teal-darker) 0%, var(--teal) 60%, #1ab4cc 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px; color: #fff; text-align: center;
}
.auth-brand-logo { width: 80px; height: 80px; margin-bottom: 24px; }
.auth-brand h1 { font-size: 2rem; font-weight: 900; margin-bottom: 8px; }
.auth-brand h1 span { color: var(--orange); }
.auth-brand p { opacity: .75; font-size: 1.05rem; max-width: 340px; line-height: 1.6; }
.auth-features { margin-top: 40px; display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 300px; }
.auth-feat {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,255,255,.1); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: .88rem;
}
.auth-feat-icon { font-size: 1.3rem; }
.auth-form-side {
  display: flex; align-items: center; justify-content: center; padding: 40px;
  background: var(--bg);
}
.auth-card {
  background: var(--white); border-radius: var(--radius);
  padding: 36px 36px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.auth-card h2 span { color: var(--orange); }
.auth-card p.subtitle { color: var(--text-muted); font-size: .88rem; margin-bottom: 28px; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 24px; overflow: hidden;
}
.auth-tab {
  padding: 10px; text-align: center; font-weight: 600; font-size: .9rem;
  cursor: pointer; color: var(--text-muted);
  transition: all var(--transition);
}
.auth-tab.active { background: var(--teal); color: #fff; }
.auth-submit {
  width: 100%; padding: 13px; background: var(--orange); color: #fff;
  border: none; border-radius: var(--radius-sm);
  font-size: 1rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(249,115,22,.3);
  transition: all var(--transition); margin-top: 8px;
}
.auth-submit:hover { background: var(--orange-dark); transform: translateY(-1px); }

/* ── Empty state ── */
.empty-state {
  text-align: center; padding: 50px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-state svg { width: 64px; height: 64px; opacity: .3; }
.empty-state h3 { font-size: 1rem; font-weight: 700; color: var(--text-muted); }
.empty-state p  { font-size: .85rem; color: var(--text-muted); }

/* ── Recent transactions (dashboard) ── */
.recent-list { display: flex; flex-direction: column; gap: 0; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }
.recent-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  background: var(--teal-light);
}
.recent-info { flex: 1; min-width: 0; }
.recent-desc { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-meta { font-size: .76rem; color: var(--text-muted); }
.recent-amount { font-weight: 800; font-size: .95rem; flex-shrink: 0; }

/* ── Contribution modal ── */
.contrib-info {
  background: var(--teal-light); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 16px;
  font-size: .85rem; color: var(--teal);
}

/* ── Spinner ── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }

/* ── Premium nav item ── */
.nav-item.nav-premium { color: rgba(251,191,36,.9); }
.nav-item.nav-premium:hover { background: rgba(251,191,36,.12); color: #fbbf24; }
.nav-item.nav-premium.active { background: linear-gradient(135deg,#f59e0b,#d97706); color:#fff; }
.nav-badge {
  margin-left: auto;
  font-size: .6rem;
  background: rgba(251,191,36,.18);
  color: #fbbf24;
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 700;
}

/* ── Export dropdown ── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--white); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
  border: 1px solid var(--border);
  min-width: 180px; z-index: 50; overflow: hidden;
  display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; font-size: .88rem; font-weight: 500;
  cursor: pointer; transition: background .15s; color: var(--text);
}
.dropdown-item:hover { background: var(--teal-light); }
.dropdown-item svg { color: var(--teal); flex-shrink: 0; }

/* ── Two-column layout ── */
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ── Score ring (Conseils) ── */
.score-section {
  display: flex; align-items: center; gap: 28px;
  background: var(--white); border-radius: var(--radius);
  padding: 24px 28px; box-shadow: var(--shadow-card);
  margin-bottom: 20px; flex-wrap: wrap;
}
.score-ring-wrap { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.score-svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.score-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score-number { font-size: 2rem; font-weight: 900; color: var(--text); }
.score-sub { font-size: .7rem; color: var(--text-muted); margin-top: -4px; }
.score-label-wrap { flex: 0 0 auto; }
.score-title { font-size: .78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.score-kpis { display: flex; gap: 24px; flex-wrap: wrap; }
.kpi-item { display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: .72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.kpi-value { font-size: 1rem; font-weight: 800; }

/* ── Règle 50/30/20 segments ── */
.rule-segment { margin-bottom: 16px; }
.rule-segment:last-child { margin-bottom: 0; }
.rule-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rule-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.rule-name { font-weight: 600; font-size: .9rem; flex: 1; }
.rule-pct { font-weight: 800; font-size: .95rem; color: var(--teal); }
.rule-footer { display: flex; justify-content: space-between; font-size: .78rem; margin-top: 4px; color: var(--text-muted); }

/* ── Conseils cards ── */
.conseil-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 16px; border-left: 4px solid transparent;
  border-radius: var(--radius-sm); background: var(--white);
  margin-bottom: 12px; box-shadow: var(--shadow-card);
  animation: fadeUp .35s ease both;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
.conseil-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; background: #f8fafc; border-radius: 10px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.conseil-body { flex: 1; min-width: 0; }
.conseil-titre { font-weight: 700; font-size: .92rem; margin-bottom: 4px; }
.conseil-texte { font-size: .82rem; color: var(--text-muted); line-height: 1.5; }
.conseil-type { font-size: .68rem; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 8px; align-self: flex-start; flex-shrink: 0; letter-spacing: .04em; }
.conseil-type-danger  { background: #fef2f2; color: #dc2626; }
.conseil-type-warning { background: #fffbeb; color: #d97706; }
.conseil-type-info    { background: #eff6ff; color: #2563eb; }
.conseil-type-success { background: #f0fdf4; color: #16a34a; }

/* ── Groupe cards ── */
.groupe-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--white); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-card);
  margin-bottom: 14px; transition: box-shadow .2s;
}
.groupe-card:hover { box-shadow: 0 4px 20px rgba(13,122,140,.14); }
.groupe-card.is-admin { border-left: 4px solid var(--teal); }
.groupe-avatar {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg,var(--teal),var(--teal-dark));
  color: #fff; font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.groupe-info { flex: 1; min-width: 0; }
.groupe-nom { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.groupe-meta { font-size: .78rem; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.groupe-desc { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.groupe-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.badge-admin { background: var(--teal-light); color: var(--teal); padding: 2px 8px; border-radius: 8px; font-size: .72rem; font-weight: 700; }
.badge-membre { background: #f1f5f9; color: #64748b; padding: 2px 8px; border-radius: 8px; font-size: .72rem; font-weight: 700; }

/* ── Membre cards ── */
.membres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.membre-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg); border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.membre-card:last-child { border-bottom: none; }
.membre-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; flex-shrink: 0; color: #fff;
}
.membre-info { flex: 1; min-width: 0; }
.membre-nom { font-weight: 600; font-size: .9rem; }
.membre-email { font-size: .75rem; color: var(--text-muted); }
.membre-role { flex-shrink: 0; }
.membre-stat-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.membre-stat-row:last-child { border-bottom: none; }
.membre-stat-info { flex: 1; }
.membre-stat-nom { font-weight: 600; font-size: .88rem; }
.membre-stat-vals { font-size: .78rem; color: var(--text-muted); }
.cat-stat-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.cat-stat-row:last-child { border-bottom: none; }
.cat-icon-sm { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; }
.cat-nom { flex: 1; font-size: .85rem; font-weight: 500; }
.cat-total { font-weight: 700; font-size: .85rem; }

/* ── Helpers ── */
.text-green { color: var(--green); }
.text-red   { color: var(--red); }

/* ── Sidebar backdrop (mobile) ── */
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-backdrop.active { display: block; }

/* ── Bottom navigation (mobile) ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--teal-darker);
  border-top: 1px solid rgba(255,255,255,.1);
  z-index: 89;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-inner { display: flex; height: 56px; }
.bottom-nav-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,.5);
  font-size: .6rem; font-weight: 600; letter-spacing: .02em;
  text-decoration: none;
  background: none; border: none; cursor: pointer;
  transition: color var(--transition), background var(--transition);
  padding: 6px 2px;
  border-top: 2px solid transparent;
}
.bottom-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.bottom-nav-item.active {
  color: var(--orange);
  border-top-color: var(--orange);
  background: rgba(249,115,22,.08);
}
.bottom-nav-item:not(.active):active { color: rgba(255,255,255,.85); }

/* ── Responsive 900px ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-248px); z-index: 100; }
  .sidebar.open { transform: translateX(0); width: 248px; }
  .main-content { margin-left: 0; }
  .btn-hamburger { display: flex; }
  .charts-grid { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

/* ── Responsive 768px — mobile principal ── */
@media (max-width: 768px) {
  /* Bottom nav visible */
  .bottom-nav { display: block; }

  /* Contenu décalé pour la bottom nav */
  .page-content {
    padding: 14px 14px calc(56px + 16px + env(safe-area-inset-bottom, 0px));
  }

  /* Header compact */
  .top-header { padding: 0 14px; height: 56px; }
  .page-title { font-size: 1rem; }
  .header-right { gap: 8px; }
  .month-picker { padding: 4px 10px; font-size: .78rem; border-radius: 14px; }
  .month-picker select { font-size: .78rem; }

  /* FAB au-dessus de la bottom nav */
  .fab {
    bottom: calc(56px + 14px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    width: 50px; height: 50px;
    font-size: 1.4rem;
  }

  /* Stat cards */
  .stats-grid { gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px 12px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; border-radius: 10px; }
  .stat-value { font-size: 1rem; }

  /* Cards */
  .card-header { padding: 14px 16px 0; }
  .card-body   { padding: 14px 16px; }
  .chart-canvas-wrap { height: 200px; }

  /* Grilles → 1 colonne */
  .budgets-grid   { grid-template-columns: 1fr; }
  .objectifs-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .two-cols { grid-template-columns: 1fr; }

  /* Filter bar */
  .filter-bar { padding: 10px 12px; gap: 8px; }
  .filter-sep { display: none; }

  /* Modal → bottom sheet */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100% !important;
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92vh;
    transform: translateY(100%);
  }
  .modal-overlay.open .modal { transform: translateY(0); }

  /* Auth */
  .auth-form-side { padding: 24px 16px; }
  .auth-card { padding: 28px 20px; }

  /* Score */
  .score-section { flex-direction: column; align-items: flex-start; }
  .score-kpis { gap: 14px; }

  /* Groupe */
  .groupe-card { flex-wrap: wrap; }
  .groupe-actions { width: 100%; justify-content: flex-end; }

  /* Toast → en bas, pleine largeur */
  .toast-container {
    top: auto;
    bottom: calc(56px + 10px + env(safe-area-inset-bottom, 0px));
    left: 10px; right: 10px;
    align-items: stretch;
  }
  .toast { min-width: 0; max-width: 100%; }
}

/* ── Responsive 480px ── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px 10px; gap: 8px; }
  .stat-icon { width: 34px; height: 34px; font-size: .9rem; }
  .stat-value { font-size: .9rem; }
  .stat-label { font-size: .68rem; }
  .stat-sub   { display: none; }
  #dash-period { display: none; }
  .bottom-nav-item { font-size: .56rem; }
  .bottom-nav-item svg { width: 19px; height: 19px; }
  .membres-grid { grid-template-columns: 1fr; }
}

/* ── Responsive 360px ── */
@media (max-width: 360px) {
  .page-content { padding-left: 10px; padding-right: 10px; }
  .stat-value { font-size: .82rem; }
  .stat-card { padding: 10px 8px; }
  /* Icônes seules, labels masqués */
  .bottom-nav-item span { display: none; }
  .bottom-nav-inner { height: 50px; }
  .bottom-nav-item svg { width: 22px; height: 22px; }
}
