/* ============================================================
   Mon Budget — Design system professionnel & minimal
   Thème clair par défaut + mode sombre automatique.
   Même structure/classes que le HTML/JS : reskin complet.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
input, select { outline: none; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- Tokens ---------- */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f1f2f5;
  --surface-3: #e7e9ee;
  --border: #e7e8ec;
  --border-2: #dcdee4;

  --text: #16181d;
  --text-dim: #6b7280;
  --text-faint: #9ca3af;

  --primary: #16181d;
  --primary-fg: #ffffff;
  --primary-hover: #2c2f36;

  --accent: #4f46e5;
  --accent-soft: #eef0fe;

  --good: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;

  --track: #eceef2;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --shadow: 0 1px 2px rgba(16,18,23,.04), 0 2px 8px rgba(16,18,23,.05);
  --shadow-pop: 0 16px 48px rgba(16,18,23,.18);

  --ease: cubic-bezier(.4, 0, .2, 1);
  --nav-h: 60px;
  --header-h: 58px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e12;
    --surface: #16181e;
    --surface-2: #1d1f26;
    --surface-3: #262932;
    --border: #23262e;
    --border-2: #31353f;

    --text: #e9eaee;
    --text-dim: #949aa5;
    --text-faint: #626772;

    --primary: #ffffff;
    --primary-fg: #16181d;
    --primary-hover: #e4e5e9;

    --accent: #8288ff;
    --accent-soft: #1b1e3a;

    --good: #4ade80;
    --bad: #f87171;
    --warn: #fbbf24;

    --track: #23262e;

    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.3);
    --shadow-pop: 0 18px 50px rgba(0,0,0,.55);
  }
}

/* ---------- Base ---------- */
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* ---------- App shell ---------- */
.app-shell {
  position: relative;
  max-width: 480px;
  height: 100dvh;
  overflow: hidden;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-inline: 1px solid var(--border);
}

/* ---------- Header ---------- */
.app-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--primary-fg);
  background: var(--primary);
}
.brand-logo svg { width: 17px; height: 17px; }
.brand h1 { font-size: 15px; font-weight: 650; letter-spacing: -0.02em; }
.brand p { display: none; }
.header-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px;
  display: grid; place-items: center; color: var(--text-dim);
  transition: color .15s, background .15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn:active { background: var(--surface-3); }

/* ---------- Main / views ---------- */
.app-main {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 16px calc(var(--nav-h) + 20px);
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.app-main::-webkit-scrollbar { width: 6px; }
.app-main::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }

.view { display: none; animation: fade .25s var(--ease) both; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.section-title {
  font-size: 12px; font-weight: 600; letter-spacing: 0;
  color: var(--text-dim);
  margin: 22px 2px 10px;
  display: flex; align-items: center; gap: 8px; text-transform: none;
}
.section-title .count {
  font-size: 11px; color: var(--text-dim); font-weight: 600;
  background: var(--surface-2); padding: 1px 7px; border-radius: 6px;
}

/* ---------- Hero (résumé du mois) ---------- */
.hero {
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--text);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; }
.hero-label { font-size: 12px; font-weight: 500; color: var(--text-dim); letter-spacing: 0; text-transform: none; }
.hero-period { display: none; }
.badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border);
}
.hero-amount {
  margin-top: 6px;
  font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.hero-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-dim); }

/* Budget dans le hero */
.hero-budget { margin-top: 18px; }
.hero-budget-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; font-weight: 500; }
.progress { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.progress-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: var(--accent);
  transition: width .8s var(--ease);
}
.progress-fill.over { background: var(--bad); }
.hero-budget-empty { margin-top: 16px; }
.hero-budget-empty button {
  font-size: 12.5px; font-weight: 600; color: var(--accent);
  padding: 7px 0;
}
.hero-budget-empty button:hover { text-decoration: underline; }

/* ---------- Month nav ---------- */
.month-nav { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 22px 0 12px; }
.month-nav h2 { min-width: 150px; text-align: center; font-size: 14px; font-weight: 600; text-transform: capitalize; }
.month-nav button {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; color: var(--text-dim);
  transition: background .15s, color .15s;
}
.month-nav button:hover { background: var(--surface-2); color: var(--text); }
.month-nav button svg { width: 17px; height: 17px; }

/* ---------- Quick actions ---------- */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; color: var(--text);
  border: 1px solid var(--border); background: var(--surface);
  transition: background .15s, border-color .15s;
}
.action:hover { background: var(--surface-2); }
.action:active { background: var(--surface-3); }
.action .action-ic { width: 20px; height: 20px; display: grid; place-items: center; flex-shrink: 0; }
.action .action-ic svg { width: 18px; height: 18px; }
.action.primary { color: var(--primary-fg); background: var(--primary); border-color: transparent; }
.action.primary:hover { background: var(--primary-hover); }
.action.primary .action-ic { color: var(--primary-fg); }
.action.secondary .action-ic { color: var(--text-dim); }

/* ---------- Expenses list ---------- */
.expense-list { display: flex; flex-direction: column; }
.expense {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  animation: rowIn .25s var(--ease) both;
}
.expense:first-child { border-top: 1px solid var(--border); }
.expense:hover { background: var(--surface-2); }
@keyframes rowIn { from { opacity: 0; } to { opacity: 1; } }
.expense-ic {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 9px;
  display: grid; place-items: center; font-size: 16px; position: relative;
}
.expense-ic > span { position: relative; }
.expense-ic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: .12; }
.expense-body { min-width: 0; flex: 1; }
.expense-title { font-size: 14px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.expense-meta { font-size: 12px; color: var(--text-dim); margin-top: 1px; display: flex; align-items: center; gap: 6px; }
.cat-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.rec-badge { display: inline-flex; align-items: center; font-size: 10px; opacity: .8; }
.expense-right { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.expense-amount { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.expense-actions { display: flex; gap: 0; margin-left: 6px; opacity: .55; transition: opacity .15s; }
.expense:hover .expense-actions { opacity: 1; }
.mini-btn {
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center; color: var(--text-faint);
  transition: background .15s, color .15s;
}
.mini-btn svg { width: 15px; height: 15px; }
.mini-btn:hover { background: var(--surface-3); color: var(--text); }
.mini-btn.danger:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }

/* ---------- Empty ---------- */
.empty {
  text-align: center; padding: 40px 20px; color: var(--text-dim);
  border: 1px dashed var(--border-2); border-radius: var(--radius); background: var(--surface);
}
.empty .empty-ic {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 12px;
  display: grid; place-items: center; color: var(--text-dim);
  background: var(--surface-2);
}
.empty .empty-ic svg { width: 22px; height: 22px; }
.empty p { font-size: 13.5px; font-weight: 500; color: var(--text); }
.empty .hint { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; font-weight: 400; }

/* ============================================================
   STATISTIQUES
   ============================================================ */
.stats-empty { margin-top: 8px; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.kpi {
  padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.kpi-head { display: flex; align-items: center; gap: 7px; color: var(--text-dim); }
.kpi-head .kpi-ic { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; }
.kpi-head .kpi-ic svg { width: 14px; height: 14px; }
.kpi-label { font-size: 12px; font-weight: 500; }
.kpi-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 11.5px; color: var(--text-faint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card {
  border-radius: var(--radius); padding: 16px;
  background: var(--surface); border: 1px solid var(--border);
  margin-bottom: 12px;
}
.card-title { font-size: 13.5px; font-weight: 650; margin-bottom: 2px; letter-spacing: -0.01em; }
.card-sub { font-size: 12px; color: var(--text-dim); margin-bottom: 16px; }

/* Comparaison */
.compare { display: flex; align-items: center; gap: 12px; }
.trend-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 650; padding: 4px 9px; border-radius: 7px; flex-shrink: 0; }
.trend-pill svg { width: 13px; height: 13px; }
.trend-up { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, transparent); }
.trend-down { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.trend-flat { color: var(--text-dim); background: var(--surface-2); }
.compare-text { font-size: 12.5px; color: var(--text-dim); }
.compare-text b { color: var(--text); font-weight: 650; }

/* Donut */
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.donut { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-seg { transition: stroke-dashoffset .9s var(--ease); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center .dc-value { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.donut-center .dc-label { font-size: 10px; color: var(--text-dim); font-weight: 500; }
.legend { flex: 1; min-width: 120px; display: flex; flex-direction: column; gap: 8px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-row .lg-dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.legend-row .lg-name { flex: 1; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-row .lg-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.legend-row .lg-pct { color: var(--text-faint); width: 36px; text-align: right; font-variant-numeric: tabular-nums; }

/* Barres mensuelles */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; height: 100%; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 68%; max-width: 30px; border-radius: 5px 5px 0 0; height: 0; min-height: 2px; background: var(--surface-3); transition: height .9s var(--ease); }
.bar.is-current { background: var(--accent); }
.bar-val { font-size: 9.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-label { font-size: 10px; color: var(--text-faint); text-transform: capitalize; white-space: nowrap; }

/* Barres journalières */
.daybars { display: flex; align-items: flex-end; gap: 3px; height: 78px; }
.daybar { flex: 1; border-radius: 2px 2px 0 0; height: 0; min-height: 2px; background: var(--accent); opacity: .85; transition: height .8s var(--ease); }
.daybar.weekend { opacity: .4; }
.daybars-axis { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-faint); margin-top: 7px; }

/* Classement */
.ranking { display: flex; flex-direction: column; gap: 13px; }
.rank-top { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.rank-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 14px; position: relative; }
.rank-ic > span { position: relative; }
.rank-ic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: .12; }
.rank-name { flex: 1; font-size: 13px; font-weight: 550; }
.rank-amount { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rank-bar-track { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.rank-bar { height: 100%; width: 0; border-radius: 999px; transition: width .9s var(--ease); }
.rank-sub { font-size: 11px; color: var(--text-faint); margin-top: 5px; display: flex; justify-content: space-between; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: var(--nav-h);
  z-index: 30;
  display: flex; align-items: center;
  padding: 0 12px calc(env(safe-area-inset-bottom));
  gap: 4px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--border);
}
.nav-item {
  flex: 1; height: 100%;
  display: flex; align-items: center; justify-content: center; gap: 7px;
  color: var(--text-faint);
  font-size: 13px; font-weight: 550;
  transition: color .15s;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item.active { color: var(--text); }
.nav-fab {
  flex: 0 0 auto; width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px; color: var(--primary-fg);
  background: var(--primary);
  transition: background .15s, transform .1s;
}
.nav-fab svg { width: 20px; height: 20px; }
.nav-fab:hover { background: var(--primary-hover); }
.nav-fab:active { transform: scale(.92); }

/* ============================================================
   MODALES
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(16, 18, 23, .32);
  backdrop-filter: blur(2px);
  animation: fadeIn .18s ease both;
}
.overlay.center { align-items: center; padding: 20px; }
.overlay[hidden] { display: none; }
#category-overlay { z-index: 55; }
#loader-overlay { z-index: 58; }
#auth-overlay { z-index: 60; background: var(--bg); backdrop-filter: none; }
#auth-overlay.checking .auth-sub,
#auth-overlay.checking #auth-form { display: none; }
.auth-loading { display: none; font-size: 13px; color: var(--text-dim); margin-top: 4px; }
#auth-overlay.checking .auth-loading { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: 100%; max-width: 480px;
  background: var(--surface); border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  padding: 8px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-pop);
  max-height: 92dvh; overflow-y: auto;
  animation: sheetUp .28s var(--ease) both;
}
.overlay.center .sheet { border-radius: 16px; border-bottom: 1px solid var(--border); max-width: 400px; animation: popIn .22s var(--ease) both; padding-top: 18px; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

.sheet-grip { width: 36px; height: 4px; border-radius: 999px; background: var(--surface-3); margin: 6px auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }

/* Formulaire */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-dim); margin-bottom: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input, .select {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-2);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--text-faint); }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.input-prefix { position: relative; }
.input-prefix .input { padding-left: 30px; }
.input-prefix::before { content: "€"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-weight: 500; }

/* Chips catégorie */
.cat-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.cat-chip {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 4px; border-radius: 10px;
  color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border-2);
  transition: border-color .15s, background .15s, color .15s;
  min-width: 0;
}
.cat-chip .cc-emoji { font-size: 17px; line-height: 1; }
.cat-chip .cc-name { font-size: 9.5px; font-weight: 550; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-chip:active { transform: scale(.96); }
.cat-chip.selected { color: var(--text); border-color: var(--text); background: var(--surface-2); }
.cat-chip.add { border-style: dashed; color: var(--accent); }
.cat-chip.add:hover { background: var(--accent-soft); }

/* Grille de couleurs */
.color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.color-swatch {
  aspect-ratio: 1; border-radius: 9px; position: relative;
  border: 2px solid transparent; transition: transform .1s;
}
.color-swatch:active { transform: scale(.9); }
.color-swatch.selected { border-color: var(--text); }
.color-swatch.selected::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 7px; height: 7px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15);
}

/* Gestion des catégories perso */
#cat-manage { margin-top: 4px; }
.cat-manage-title { font-size: 12px; color: var(--text-dim); font-weight: 600; margin: 14px 0 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.cat-manage-empty { font-size: 12.5px; color: var(--text-faint); text-align: center; padding: 14px 0 4px; margin-top: 10px; border-top: 1px solid var(--border); }
.cat-manage-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; }
.cat-manage-row .cmr-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; background: var(--surface-2); }
.cat-manage-row .cmr-name { flex: 1; font-size: 13px; font-weight: 550; }

/* Toggle (récurrence) */
.toggle { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-2); cursor: pointer; margin-bottom: 4px; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { flex-shrink: 0; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-3); position: relative; transition: background .2s; }
.toggle-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }
.toggle input:focus-visible + .toggle-track { box-shadow: 0 0 0 3px var(--accent-soft); }
.toggle-text { display: flex; flex-direction: column; gap: 1px; }
.toggle-title { font-size: 13px; font-weight: 550; color: var(--text); }
.toggle-sub { font-size: 11.5px; color: var(--text-faint); }

/* Réglages */
.settings-section { margin-top: 4px; }
.settings-section + .settings-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.settings-label { font-size: 12.5px; font-weight: 650; color: var(--text); margin-bottom: 4px; }
.settings-hint { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }
.settings-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.settings-import { width: 100%; margin-top: 9px; }

/* Liste des récurrences */
.recurring-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; }
.recurring-row + .recurring-row { border-top: 1px solid var(--border); }
.recurring-ic { width: 30px; height: 30px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center; font-size: 15px; position: relative; }
.recurring-ic > span { position: relative; }
.recurring-ic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: .12; }
.recurring-body { flex: 1; min-width: 0; }
.recurring-title { font-size: 13.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recurring-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }
.recurring-amount { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; margin-right: 2px; }
.recurring-empty { font-size: 12.5px; color: var(--text-faint); text-align: center; padding: 16px 0 4px; }

/* Boutons */
.btn-row { display: flex; gap: 9px; margin-top: 18px; }
.btn { flex: 1; padding: 12px; border-radius: 10px; font-size: 14px; font-weight: 600; transition: background .15s, opacity .15s, border-color .15s; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(.5px); }
.btn-ghost { color: var(--text); background: var(--surface); border: 1px solid var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-primary { color: var(--primary-fg); background: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .5; pointer-events: none; }

/* Loader IA */
.loader-box { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; padding: 26px; }
.spinner { position: relative; width: 44px; height: 44px; }
.spinner .ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner .ring.two { display: none; }
.spinner .sp-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader-box p { font-size: 14.5px; font-weight: 650; }
.loader-box span { font-size: 12.5px; color: var(--text-dim); }

/* Auth */
.auth-card {
  width: 100%; max-width: 340px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; text-align: center; box-shadow: var(--shadow);
  animation: popIn .3s var(--ease) both;
}
.auth-logo { width: 46px; height: 46px; margin: 0 auto 16px; border-radius: 12px; display: grid; place-items: center; color: var(--primary-fg); background: var(--primary); }
.auth-logo svg { width: 22px; height: 22px; }
.auth-card h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.auth-card > p { font-size: 13px; color: var(--text-dim); margin: 5px 0 20px; }
.auth-card .input { margin-bottom: 0; }
.form-error { font-size: 12.5px; color: var(--bad); margin: 12px 0; min-height: 15px; }

/* Toasts */
.toast-wrap {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 12px); transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px;
  width: calc(100% - 40px); max-width: 420px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: 10px; font-size: 13px; font-weight: 550;
  color: var(--surface); background: var(--text);
  box-shadow: var(--shadow-pop);
  animation: toastIn .25s var(--ease) both;
}
.toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast.success svg { color: #4ade80; }
.toast.error svg { color: #f87171; }
.toast.info svg { color: #93a4ff; }
.toast.leaving { animation: toastOut .22s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

[hidden] { display: none !important; }
.count-up { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
