/* ============================================================
   Jiyo — CSS principal v2
   Design system : IBM Plex Sans · fintech · data-dense
   Mobile-first · WCAG 2.2 AA · sans dépendance externe
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ── Variables — thème clair ───────────────────────────────── */
:root {
  color-scheme: light;

  --color-bg:           #F1F5F9;
  --color-surface:      #FFFFFF;
  --color-surface-alt:  #F8FAFC;
  --color-border:       #E2E8F0;
  --color-border-light: #F1F5F9;

  --color-text:         #0F172A;
  --color-text-muted:   #475569;
  --color-text-light:   #94A3B8;

  --color-primary:       #1E40AF;
  --color-primary-dark:  #1E3A8A;
  --color-primary-light: #EFF6FF;
  --color-primary-mid:   #DBEAFE;
  --color-primary-rgb:   30,64,175;
  --color-link:          #1D4ED8;

  --color-success:      #059669;
  --color-success-light:#ECFDF5;
  --color-warning:      #D97706;
  --color-warning-light:#FFFBEB;
  --color-danger:       #DC2626;
  --color-danger-light: #FEF2F2;
  --color-danger-rgb:   220,38,38;
  --color-info:         #0EA5E9;
  --color-info-light:   #F0F9FF;

  --color-positive:    #059669;
  --color-negative:    #DC2626;

  --font:         'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', 'SF Mono', SFMono-Regular, ui-monospace, monospace;
  --font-size-base: 15px;

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

  --shadow-xs:  0 1px 2px rgba(15,23,42,.05);
  --shadow-sm:  0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow:     0 4px 6px -1px rgba(15,23,42,.08), 0 2px 4px -1px rgba(15,23,42,.05);
  --shadow-md:  0 10px 15px -3px rgba(15,23,42,.10), 0 4px 6px -2px rgba(15,23,42,.05);
  --shadow-lg:  0 20px 25px -5px rgba(15,23,42,.12), 0 10px 10px -5px rgba(15,23,42,.04);

  --sidebar-width:      260px;
  --topbar-height:      56px;
  --content-max:        1320px;
  --tap-target:         44px;

  --color-sidebar-bg:        #0F172A;
  --color-sidebar-border:    #1E293B;
  --color-sidebar-hover:     #1E293B;
  --color-sidebar-active-bg: #1E293B;
  --color-sidebar-accent:    #38BDF8;
  --color-sidebar-text:      #CBD5E1;
  --color-sidebar-muted:     #64748B;

  --color-accent:     #D97706;
  --color-accent-rgb: 217,119,6;

  --theme-transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
  --ease-premium: cubic-bezier(.22,1,.36,1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --color-bg:           #0B1120;
  --color-surface:      #111A2C;
  --color-surface-alt:  #0F172A;
  --color-border:       #1E293B;
  --color-border-light: #172032;

  --color-text:         #F1F5F9;
  --color-text-muted:   #94A3B8;
  --color-text-light:   #4B617B;

  --color-primary:       #3B82F6;
  --color-primary-dark:  #2563EB;
  --color-primary-light: #172032;
  --color-primary-mid:   #1E293B;
  --color-primary-rgb:   59,130,246;
  --color-link:          #60A5FA;

  --color-success:      #34D399;
  --color-success-light:#022C22;
  --color-warning:      #FBBF24;
  --color-warning-light:#1C1400;
  --color-danger:       #F87171;
  --color-danger-light: #2C0A0A;
  --color-info:         #38BDF8;
  --color-info-light:   #0B1E2E;

  --color-positive:    #34D399;
  --color-negative:    #F87171;

  --color-accent:     #FBBF24;
  --color-accent-rgb: 251,191,36;

  --shadow-xs:  0 1px 2px rgba(0,0,0,.5);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.35);
  --shadow:     0 4px 6px -1px rgba(0,0,0,.5), 0 2px 4px -1px rgba(0,0,0,.35);
  --shadow-md:  0 10px 15px -3px rgba(0,0,0,.55), 0 4px 6px -2px rgba(0,0,0,.35);
  --shadow-lg:  0 20px 25px -5px rgba(0,0,0,.6), 0 10px 10px -5px rgba(0,0,0,.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: var(--font-size-base); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  /* Pas d'overflow-x sur body : tout overflow-x non-visible sur <body> empêche
     position:fixed de fonctionner correctement sur iOS Safari.
     Le rognage horizontal est géré par .page-content (overflow-x:clip). */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: var(--theme-transition);
}
a { color: var(--color-link); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: underline; }

.sidebar, .topbar, .card, .stat-card, .form-control, .modal-dialog-inner,
.page-link, .auth-card, table, th, td, .goal-card { transition: var(--theme-transition); }

.amount-positive, .amount-negative, .amount-zero,
.stat-value, td, .font-mono { font-variant-numeric: tabular-nums; }

.sidebar, .table-wrap {
  scrollbar-width: thin;
  scrollbar-color: var(--color-sidebar-border) transparent;
}
.sidebar::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--color-sidebar-border); border-radius: 999px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 999px; }

img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { background: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
legend { padding: 0; }

a:focus-visible, button:focus-visible,
input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
  border-radius: 2px;
}
a:focus, button:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--color-link);
  outline-offset: 1px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; top: -3rem; left: .75rem; z-index: 1000;
  background: var(--color-primary-dark); color: #fff;
  padding: .625rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600; transition: top .15s ease;
}
.skip-link:focus { top: .75rem; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout { display: flex; flex: 1; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-sidebar-border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; overflow-y: auto;
  transition: transform .25s ease, box-shadow .25s ease;
}

.sidebar-logo {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.125rem 1.5rem;
  font-weight: 700; font-size: 1.125rem; letter-spacing: -.02em;
  color: #fff; border-bottom: 1px solid var(--color-sidebar-border);
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
}
.sidebar-logo img { height: 115px; width: auto; }
.sidebar-logo:hover { text-decoration: none; }

.sidebar-nav { padding: .75rem 0; flex: 1; }
.nav-section { padding: 0 0 .5rem; }
.nav-section-title {
  font-size: .6875rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--color-sidebar-muted);
  padding: .625rem 1.5rem .375rem;
}
.nav-link {
  display: flex; align-items: center; gap: .75rem;
  min-height: var(--tap-target); padding: .5rem 1.5rem;
  color: var(--color-sidebar-text); font-size: .875rem; font-weight: 400;
  white-space: nowrap; transition: background .15s, color .15s;
  text-decoration: none; position: relative;
}
.nav-link:hover { background: var(--color-sidebar-hover); color: #E2E8F0; text-decoration: none; }
.nav-link.active { background: rgba(56,189,248,.1); color: #fff; font-weight: 500; }
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 3px; border-radius: 0 2px 2px 0; background: var(--color-sidebar-accent);
}
.nav-link svg { flex-shrink: 0; width: 18px; height: 18px; opacity: .7; }
.nav-link:hover svg { opacity: .9; }
.nav-link.active svg { opacity: 1; color: var(--color-sidebar-accent); }

.nav-badge {
  margin-left: auto; background: var(--color-danger); color: #fff;
  font-size: .625rem; font-weight: 700; padding: .1rem .45rem;
  border-radius: 999px; min-width: 1.25rem; text-align: center; flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.5rem; border-top: 1px solid var(--color-sidebar-border); flex-shrink: 0;
}
.sidebar-footer .footer-row { display: flex; align-items: center; gap: .75rem; }
.sidebar-footer .user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-sidebar-border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem; color: var(--color-sidebar-text); flex-shrink: 0;
}
.sidebar-footer .user-info { flex: 1; min-width: 0; }
.sidebar-footer .user-name {
  font-weight: 600; color: #F1F5F9; font-size: .875rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-footer .user-actions { margin-top: .25rem; display: flex; gap: .625rem; }
.sidebar-footer a, .sidebar-footer .btn-link {
  color: var(--color-sidebar-muted); font-size: .75rem; transition: color .15s;
}
.sidebar-footer a:hover, .sidebar-footer .btn-link:hover { color: var(--color-sidebar-accent); text-decoration: none; }
.sidebar-footer .btn-link {
  background: none; border: 0; padding: 0; cursor: pointer; min-height: auto; font-family: inherit;
}

.main-content { margin-left: var(--sidebar-width); flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-height); background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; padding: 0 1.5rem; gap: .75rem;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-weight: 600; font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; gap: .375rem; align-items: center; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap-target); height: var(--tap-target); min-height: 0;
  border-radius: var(--radius-sm); background: transparent; border: 1px solid transparent;
  color: var(--color-text-muted); cursor: pointer; flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.theme-toggle:hover { background: var(--color-border-light); color: var(--color-text); border-color: var(--color-border); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle-auth { position: absolute; top: 1rem; right: 1rem; }

/* overflow-x:clip contient tout débordement horizontal sans affecter position:fixed */
.page-content { padding: 1.75rem; flex: 1; min-width: 0; overflow-x: clip; }

/* ── Cartes ─────────────────────────────────────────────────── */
.card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); box-shadow: var(--shadow-xs); min-width: 0;
}
.card-header {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; min-height: 52px;
}
.card-title { font-weight: 600; font-size: .9375rem; letter-spacing: -.01em; }
.card-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .75rem 1.25rem; border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt); border-radius: 0 0 var(--radius) var(--radius);
  font-size: .8125rem;
}
.card-footer a { color: var(--color-link); }

/* ── Stats ───────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: .875rem; margin-bottom: 1.5rem;
}
@media (min-width: 1200px) { .stats-grid { grid-template-columns: repeat(8, minmax(0,1fr)); } }

.stat-card {
  position: relative; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 1.125rem 1.25rem; box-shadow: var(--shadow-xs); min-width: 0; overflow: hidden;
  transition: box-shadow .2s var(--ease-premium), transform .2s var(--ease-premium);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent) 80%, transparent);
  opacity: .5;
}
.stat-label {
  font-size: .6875rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--color-text-muted); font-weight: 600; margin-bottom: .375rem; line-height: 1.3;
}
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: break-word; }
.stat-sub { font-size: .75rem; color: var(--color-text-muted); margin-top: .3rem; line-height: 1.4; }

/* ── Grilles ────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.grid-main-side { display: grid; grid-template-columns: 1fr 340px; gap: 1.25rem; align-items: start; }
/* Les cellules de grille ne peuvent pas s'élargir au-delà de leur fraction disponible.
   Sans min-width:0 un tableau large fait gonfler la cellule → débordement horizontal. */
.grid-2 > *, .grid-main-side > * { min-width: 0; overflow-x: clip; }
@media (max-width: 1024px) { .grid-main-side { grid-template-columns: 1fr; } }
@media (max-width: 900px)  { .grid-2 { grid-template-columns: 1fr; } }

/* ── Boutons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  min-height: var(--tap-target); padding: .5rem 1.125rem;
  border-radius: var(--radius-sm); font-size: .875rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: background .15s var(--ease-premium), border-color .15s var(--ease-premium),
    color .15s var(--ease-premium), box-shadow .15s var(--ease-premium), transform .1s var(--ease-premium);
  text-decoration: none; white-space: nowrap; letter-spacing: -.005em;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn:not(:disabled):active { transform: translateY(1px); }

.btn-primary   { background: var(--color-primary); color: #fff; border-color: var(--color-primary); box-shadow: 0 1px 2px rgba(var(--color-primary-rgb),.3); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); box-shadow: 0 4px 12px -2px rgba(var(--color-primary-rgb),.4); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--color-surface-alt); box-shadow: var(--shadow-sm); }
.btn-danger    { background: var(--color-danger);   color: #fff; border-color: var(--color-danger); }
.btn-danger:hover  { background: #B91C1C; }
.btn-success   { background: var(--color-success);  color: #fff; border-color: var(--color-success); }
.btn-success:hover { background: #047857; }
.btn-warning   { background: var(--color-warning);  color: #fff; border-color: var(--color-warning); }
.btn-warning:hover { background: #B45309; }
.btn-ghost     { background: transparent; color: var(--color-text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--color-border-light); color: var(--color-text); }

.btn-sm   { min-height: 34px; padding: .3rem .75rem; font-size: .8125rem; }
.btn-lg   { min-height: 52px; padding: .75rem 1.5rem; font-size: 1rem; }
.btn-icon { min-width: var(--tap-target); padding-left: .5rem; padding-right: .5rem; }
.btn-icon.btn-sm { min-width: 34px; }

/* ── Formulaires ──────────────────────────────────────────── */
.form-group { margin-bottom: 1.125rem; }
.form-label { display: block; font-size: .8125rem; font-weight: 500; margin-bottom: .375rem; color: var(--color-text); letter-spacing: -.005em; }
.form-label .required { color: var(--color-danger); margin-left: .2rem; }
.form-control {
  display: block; width: 100%; min-height: var(--tap-target);
  padding: .5rem .875rem; border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text);
  font-size: .875rem; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.form-control::placeholder { color: var(--color-text-light); }
.form-control:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb),.15);
}
.form-control.is-invalid { border-color: var(--color-danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(var(--color-danger-rgb),.15); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 88px; }
input[type=color].form-control { cursor: pointer; padding: .25rem; min-height: 40px; }
.form-hint  { font-size: .75rem; color: var(--color-text-muted); margin-top: .3rem; }
.form-error { font-size: .75rem; color: var(--color-danger);     margin-top: .3rem; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr;     gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-check { display: flex; align-items: center; gap: .5rem; min-height: var(--tap-target); }
.form-check input[type=checkbox],
.form-check input[type=radio] { width: 1.125rem; height: 1.125rem; cursor: pointer; flex-shrink: 0; accent-color: var(--color-primary); }
.form-check-label { font-size: .875rem; cursor: pointer; }
.radio-row { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Tableaux ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { background: var(--color-surface-alt); }
th {
  text-align: left; padding: .625rem 1rem;
  font-size: .6875rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--color-text-muted);
  border-bottom: 1.5px solid var(--color-border); white-space: nowrap;
}
th a { color: inherit; transition: color .15s; }
th a:hover { color: var(--color-text); }
td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-border-light); vertical-align: middle; line-height: 1.4; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--color-border-light); }
.table-actions { display: flex; gap: .25rem; justify-content: flex-end; flex-wrap: wrap; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: .2rem .6rem;
  border-radius: 999px; font-size: .6875rem; font-weight: 600;
  white-space: nowrap; border: 1px solid transparent; letter-spacing: .02em;
}
.badge-primary { background: var(--color-primary-light); color: var(--color-link);   border-color: var(--color-primary-mid); }
.badge-success { background: var(--color-success-light); color: #047857;             border-color: rgba(5,150,105,.2); }
.badge-warning { background: var(--color-warning-light); color: #B45309;             border-color: rgba(217,119,6,.2); }
.badge-danger  { background: var(--color-danger-light);  color: #B91C1C;             border-color: rgba(var(--color-danger-rgb),.2); }
.badge-muted   { background: var(--color-border);        color: var(--color-text-muted); }

/* ── Montants ───────────────────────────────────────────────── */
.amount-positive { color: var(--color-positive); font-weight: 600; font-family: var(--font-mono); }
.amount-negative { color: var(--color-negative); font-weight: 600; font-family: var(--font-mono); }
.amount-zero     { color: var(--color-text-muted); font-family: var(--font-mono); }

/* ── Alertes flash ─────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .875rem 1rem; border-radius: var(--radius-sm);
  font-size: .875rem; margin-bottom: 1rem; border: 1px solid transparent;
  border-left-width: 4px;
}
.alert-success { background: var(--color-success-light); color: #065F46; border-color: rgba(5,150,105,.3); border-left-color: var(--color-success); }
.alert-error   { background: var(--color-danger-light);  color: #991B1B; border-color: rgba(220,38,38,.3);  border-left-color: var(--color-danger); }
.alert-danger  { background: var(--color-danger-light);  color: #991B1B; border-color: rgba(220,38,38,.3);  border-left-color: var(--color-danger); }
.alert-warning { background: var(--color-warning-light); color: #92400E; border-color: rgba(217,119,6,.3);  border-left-color: var(--color-warning); }
.alert-info    { background: var(--color-info-light);    color: #0369A1; border-color: rgba(14,165,233,.3); border-left-color: var(--color-info); }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: .25rem; justify-content: center; flex-wrap: wrap; padding: 1rem 0; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap-target); height: var(--tap-target); padding: 0 .625rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: .875rem; color: var(--color-text-muted); background: var(--color-surface);
  text-decoration: none; transition: background .15s, border-color .15s, color .15s;
}
.page-link:hover  { background: var(--color-border-light); color: var(--color-text); text-decoration: none; }
.page-link.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); font-weight: 600; }
.page-link.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ── Filtres ──────────────────────────────────────────────── */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: .875rem .75rem; align-items: flex-end;
  padding: 1rem 1.25rem; background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border); border-radius: var(--radius) var(--radius) 0 0;
}
.filters-bar .form-group { margin-bottom: 0; flex: 1 1 160px; min-width: 140px; }
.filters-bar .form-label { font-size: .6875rem; letter-spacing: .05em; text-transform: uppercase; }
.filters-bar .form-control { font-size: .8125rem; min-height: 36px; }
@media (max-width: 640px) {
  .filters-bar { gap: .75rem; padding: .875rem 1rem; }
  .filters-bar .form-group { flex: 1 1 100%; min-width: 0; }
}

/* ── Cat dot ──────────────────────────────────────────────── */
.cat-dot { width: .5rem; height: .5rem; border-radius: 50%; display: inline-block; flex-shrink: 0; border: 1.5px solid rgba(0,0,0,.12); }
[data-theme="dark"] .cat-dot { border-color: rgba(255,255,255,.18); }
.cat-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .8125rem; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--color-text-muted); }
.empty-state svg { margin: 0 auto 1rem; opacity: .3; }
.empty-state h3  { font-size: .9375rem; font-weight: 600; margin-bottom: .5rem; color: var(--color-text); }
.empty-state p   { font-size: .875rem; }

/* ── Page header ──────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.page-header h1 { font-size: 1.375rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; }
.page-header h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -.02em; }
.page-header-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ── Wizard ───────────────────────────────────────────────── */
.wizard-steps { display: flex; list-style: none; gap: 3px; margin-bottom: 1.5rem; border-radius: var(--radius-sm); overflow: hidden; }
.wizard-step { flex: 1; min-width: 0; }
.wizard-step-inner {
  display: block; text-align: center; padding: .625rem .5rem; font-size: .8125rem; font-weight: 400;
  background: var(--color-border); color: var(--color-text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: background .15s, color .15s;
}
.wizard-step.is-done .wizard-step-inner    { background: var(--color-success); color: #fff; }
.wizard-step.is-current .wizard-step-inner { background: var(--color-primary); color: #fff; font-weight: 600; }
@media (max-width: 480px) {
  .wizard-steps { flex-wrap: wrap; }
  .wizard-step  { flex: 1 1 calc(50% - 3px); }
}

/* ── Modales ───────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(9,9,18,.6);
  z-index: 200; align-items: flex-start; justify-content: center;
  padding: 1rem; overflow-y: auto; backdrop-filter: blur(2px);
}
.modal-backdrop.open { display: flex; }
.modal-dialog { width: 100%; max-width: 440px; margin: auto; animation: modal-in .2s var(--ease-premium) both; }
.modal-dialog.modal-dialog-lg { max-width: 660px; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-dialog-inner { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; gap: .75rem; }
.modal-title  { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; flex: 1; }
.modal-close  { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: none; border: none; cursor: pointer; color: var(--color-text-muted); transition: background .15s, color .15s; }
.modal-close:hover { background: var(--color-border-light); color: var(--color-text); }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--color-border); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; background: var(--color-surface-alt); }

/* ── Bulk bar ─────────────────────────────────────────────── */
.bulk-bar { display: none; padding: .875rem 1.25rem; background: var(--color-sidebar-bg); border-top: 1px solid var(--color-sidebar-border); align-items: center; gap: 1rem; flex-wrap: wrap; }
.bulk-bar.open { display: flex; }
.bulk-bar-count { color: var(--color-sidebar-text); font-size: .8125rem; }
.bulk-bar-count strong { color: #fff; }
.bulk-bar-fields { display: flex; align-items: center; gap: .5rem; flex: 1; flex-wrap: wrap; }
.bulk-bar .form-control { width: auto; min-height: 38px; font-size: .8125rem; padding: .3rem .625rem; background: var(--color-sidebar-border); border-color: rgba(255,255,255,.12); color: #fff; }
.bulk-bar-clear { background: none; border: 1px solid transparent; color: var(--color-sidebar-text); cursor: pointer; font-size: .8125rem; min-height: var(--tap-target); padding: 0 .5rem; transition: color .15s; }
.bulk-bar-clear:hover { color: #fff; }
@media (max-width: 640px) {
  .bulk-bar { padding: .75rem 1rem; }
  .bulk-bar-fields { width: 100%; }
  .bulk-bar .form-control { flex: 1 1 auto; }
}

/* ── Admin tabs ───────────────────────────────────────────── */
.admin-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 2px solid var(--color-border); overflow-x: auto; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab { padding: .625rem 1.25rem; min-height: var(--tap-target); border: none; background: none; cursor: pointer; font-size: .875rem; font-weight: 500; color: var(--color-text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: color .15s, border-color .15s; font-family: inherit; }
.admin-tab:hover { color: var(--color-text); }
.admin-tab.is-active { color: var(--color-link); border-color: var(--color-link); }

/* ── Split line ──────────────────────────────────────────── */
.split-line { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: .75rem; align-items: end; margin-bottom: .875rem; padding-bottom: .875rem; border-bottom: 1px solid var(--color-border-light); }
@media (max-width: 720px) { .split-line { grid-template-columns: 1fr; } }

/* ── Objectifs épargne ─────────────────────────────────────── */
.goals-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .875rem; margin-bottom: 1.5rem; }
.goals-grid    { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.goal-card { display: flex; flex-direction: column; gap: .875rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow-xs); padding: 1.25rem; min-width: 0; transition: box-shadow .2s var(--ease-premium), transform .2s var(--ease-premium); }
.goal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.goal-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.goal-card-name { font-size: .9375rem; font-weight: 700; letter-spacing: -.01em; }
.goal-card-heading { min-height: 2.625rem; }
.goal-card-desc { font-size: .8125rem; color: var(--color-text-muted); margin-top: .2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-progress-track { width: 100%; height: 7px; border-radius: 999px; background: var(--color-border); overflow: hidden; }
.goal-progress-fill { height: 100%; border-radius: 999px; background: var(--color-primary); transition: width .4s var(--ease-premium); }
.goal-progress-fill.is-reached { background: var(--color-success); }
.goal-progress-meta { display: flex; align-items: baseline; justify-content: space-between; margin-top: .35rem; font-size: .8125rem; }
.goal-progress-pct { font-weight: 700; color: var(--color-text); }
.goal-meta-row { display: flex; justify-content: space-between; gap: .5rem; }
.goal-indicators { display: flex; gap: .4rem 1rem; flex-wrap: wrap; padding: .625rem .75rem; background: var(--color-surface-alt); border-radius: var(--radius-sm); color: var(--color-text-muted); }
.goal-indicators strong { color: var(--color-text); font-weight: 600; }
.goal-card-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto; }
.goal-card-forms { display: flex; flex-direction: column; gap: .5rem; padding-top: .75rem; border-top: 1px solid var(--color-border-light); }
.goal-card-forms form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.goal-card-forms .form-control { flex: 1 1 auto; width: auto; min-width: 0; }
.goal-transfer-divider { display: flex; align-items: center; gap: .625rem; margin: .125rem 0; color: var(--color-text-muted); font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.goal-transfer-divider::before, .goal-transfer-divider::after { content: ''; flex: 1; height: 1px; background: var(--color-border-light); }
.goal-card-footer { display: flex; gap: .5rem; flex-wrap: wrap; padding-top: .75rem; border-top: 1px solid var(--color-border-light); }

/* ── Barre de progression ─────────────────────────────────── */
.progress-bar { width: 100%; height: 6px; border-radius: 999px; background: var(--color-border); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 999px; background: var(--color-primary); transition: width .4s var(--ease-premium); }
.progress-bar-fill.is-warning { background: var(--color-warning); }
.progress-bar-fill.is-danger  { background: var(--color-danger); }

/* ── Utilitaires ──────────────────────────────────────────── */
.text-muted   { color: var(--color-text-muted); }
.text-small   { font-size: .8125rem; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.font-mono    { font-family: var(--font-mono); }
.font-bold    { font-weight: 700; }
.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}
.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}
.gap-1{gap:.25rem}.gap-2{gap:.5rem}
.flex{display:flex}.items-center{align-items:center}
.justify-between{justify-content:space-between}
.flex-wrap{flex-wrap:wrap}
.w-full{width:100%}
.hidden{display:none!important}

/* ── Auth ──────────────────────────────────────────────────── */
.auth-page {
  display: flex; flex: 1; min-height: 100dvh;
  align-items: center; justify-content: center; padding: 1.5rem;
  background: var(--color-bg);
  background-image: radial-gradient(circle at 20% 20%, rgba(30,64,175,.06) 0%, transparent 60%),
                    radial-gradient(circle at 80% 80%, rgba(5,150,105,.04) 0%, transparent 60%);
}
.auth-box { width: 100%; max-width: 400px; }
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo a { font-size: 1.5rem; font-weight: 800; color: var(--color-text); text-decoration: none; display: inline-flex; align-items: center; gap: .5rem; }
.auth-logo img { height: 36px; width: auto; margin: 0 auto; }
.auth-card {
  position: relative; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  padding: 2.25rem; box-shadow: var(--shadow-lg); overflow: hidden;
}
.auth-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-success) 60%, transparent 100%);
}
.auth-title    { font-size: 1.25rem; font-weight: 700; margin-bottom: .3rem; letter-spacing: -.02em; }
.auth-subtitle { font-size: .875rem; color: var(--color-text-muted); margin-bottom: 1.75rem; }
.auth-footer   { text-align: center; margin-top: 1.5rem; font-size: .875rem; color: var(--color-text-muted); }
@media (max-width: 480px) {
  .auth-card { padding: 1.75rem 1.375rem; }
  .auth-page { padding: 1rem; }
}

/* ── Footer ───────────────────────────────────────────────── */
.app-footer { border-top: 1px solid var(--color-border); padding: 1.25rem 1.5rem; text-align: center; font-size: .8125rem; color: var(--color-text-muted); }
.app-footer p { margin: 0; }

/* ── Menu toggle ──────────────────────────────────────────── */
.menu-toggle { display: none; align-items: center; justify-content: center; width: var(--tap-target); height: var(--tap-target); background: none; border: none; cursor: pointer; color: var(--color-text-muted); flex-shrink: 0; border-radius: var(--radius-sm); transition: background .15s, color .15s; }
.menu-toggle:hover { background: var(--color-border-light); color: var(--color-text); }

/* ── Budget Tree View ─────────────────────────────────────── */
.budget-tree-container {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.budget-category-group {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: var(--theme-transition);
}

.budget-category-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border-bottom: 1px solid transparent;
  transition: background-color .2s ease, border-color .2s ease;
}

.budget-category-header:hover {
  background: var(--color-surface-alt);
}

.budget-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: background-color .15s ease, color .15s ease, transform .2s ease;
  flex-shrink: 0;
}

.budget-expand-btn:hover {
  background: var(--color-border-light);
  color: var(--color-text);
}

.budget-category-group.is-collapsed .budget-expand-btn .expand-icon {
  transform: rotate(0deg);
}

.budget-category-group.is-expanded .budget-expand-btn .expand-icon {
  transform: rotate(90deg);
}

.budget-category-info {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex: 0 0 auto;
  min-width: 0;
}

.budget-category-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -.01em;
}

.budget-subcat-count {
  font-size: .75rem;
  color: var(--color-text-muted);
  background: var(--color-border-light);
  padding: .25rem .5rem;
  border-radius: 12px;
  white-space: nowrap;
}

.budget-category-data {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.budget-category-no-budget {
  margin-left: auto;
  padding: .5rem 1rem;
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
}

.budget-data-col {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 90px;
}

.budget-data-label {
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--color-text-light);
  font-weight: 500;
}

.budget-data-value {
  font-size: .9375rem;
  color: var(--color-text);
  font-weight: 500;
}

.budget-progress-col {
  display: flex;
  flex-direction: column;
  gap: .375rem;
  min-width: 120px;
}

.budget-progress-text {
  font-size: .75rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  text-align: right;
}

.budget-actions {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: .5rem;
}

/* Subcategories container */
.budget-subcategories {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .3s cubic-bezier(.22,1,.36,1), opacity .25s ease;
}

.budget-category-group.is-expanded .budget-subcategories {
  max-height: 2000px;
  opacity: 1;
}

.budget-subcat-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1.25rem .875rem 3.75rem;
  border-bottom: 1px solid var(--color-border-light);
  transition: background-color .15s ease;
  position: relative;
}

.budget-subcat-row:last-child {
  border-bottom: none;
}

.budget-subcat-row:hover {
  background: var(--color-surface);
}

.budget-subcat-info {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex: 0 0 auto;
  min-width: 0;
  position: relative;
}

.budget-tree-line {
  position: absolute;
  left: -2rem;
  top: 50%;
  width: 1.25rem;
  height: 1px;
  background: var(--color-border);
}

.budget-tree-line::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: -1.5rem;
  width: 1px;
  background: var(--color-border);
}

.budget-subcat-icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
  transform: rotate(-90deg);
  opacity: 0.6;
}

.budget-subcat-name {
  font-size: .9375rem;
  color: var(--color-text);
  font-weight: 500;
}

.budget-subcat-data {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}

/* Total summary */
.budget-total-summary {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--color-primary-light);
  border: 2px solid var(--color-primary-mid);
  border-radius: var(--radius);
  margin-top: .75rem;
}

.budget-total-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  min-width: 80px;
}

.budget-total-data {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-left: auto;
  flex-wrap: wrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .budget-category-header {
    flex-wrap: wrap;
    gap: .5rem;
  }
  
  .budget-category-info {
    flex: 1 1 100%;
    order: 1;
  }
  
  .budget-category-data,
  .budget-subcat-data {
    flex: 1 1 100%;
    order: 2;
    gap: 1rem;
    margin-left: 0;
    padding-top: .5rem;
  }
  
  .budget-category-no-budget {
    flex: 1 1 100%;
    order: 2;
    margin-left: 0;
    margin-top: .5rem;
  }
  
  .budget-actions {
    order: 3;
    margin-left: 0;
    flex: 1 1 100%;
    justify-content: flex-end;
    padding-top: .25rem;
  }
  
  .budget-data-col {
    min-width: 80px;
  }
  
  .budget-progress-col {
    min-width: 100%;
  }
  
  .budget-subcat-row {
    padding-left: 2.5rem;
    flex-wrap: wrap;
  }
  
  .budget-tree-line {
    left: -1.5rem;
  }
  
  .budget-total-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .budget-total-data {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .budget-category-header,
  .budget-subcat-row {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .budget-subcat-row {
    padding-left: 2rem;
  }
  
  .budget-tree-line {
    left: -1rem;
    width: .75rem;
  }
  
  .budget-data-col {
    min-width: 70px;
    font-size: .875rem;
  }
  
  .budget-subcat-name,
  .budget-category-name {
    font-size: .875rem;
  }
}

/* ── Navigation par mois (budgets, prévisionnel…) ─────────── */
/* Groupe de boutons ‹ Mois › + bouton d'action secondaire.
   Sur mobile : empile le bouton secondaire sous le groupe principal. */
.month-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.month-nav h1 { margin: 0; }
@media (max-width: 640px) {
  .month-nav { gap: .375rem; }
  .month-nav h1 { font-size: 1.0625rem; }
}

/* ── Navigation mobile inférieure ──────────────────────────── */
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; height: 60px; background: var(--color-surface); border-top: 1px solid var(--color-border); z-index: 90; box-shadow: 0 -2px 12px rgba(15,23,42,.07); }
.bottom-nav-inner { display: flex; height: 100%; }
.bottom-nav-link { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; text-decoration: none; color: var(--color-text-muted); font-size: .5625rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; transition: color .15s, background .15s; position: relative; min-height: var(--tap-target); }
.bottom-nav-link:hover { text-decoration: none; }
.bottom-nav-link.active { color: var(--color-primary); }
.bottom-nav-link svg { width: 22px; height: 22px; flex-shrink: 0; }
.bottom-nav-link .bnav-badge { position: absolute; top: 6px; right: calc(50% - 18px); background: var(--color-danger); color: #fff; font-size: .5rem; font-weight: 700; min-width: 14px; height: 14px; border-radius: 999px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--color-surface); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform .25s var(--ease-premium), box-shadow .25s;
    width: min(var(--sidebar-width), 85vw);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.35); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar { padding: 0 .75rem; }
  .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 99; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
  .overlay.open { display: block; }
  .bottom-nav { display: block; }
  .page-content { padding: 1rem 1rem calc(1rem + 60px); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  /* Flexbox horizontal scroll : plus fiable que CSS grid auto-column sur mobile.
     Un grid avec grid-auto-flow:column calcule sa largeur intrinsèque comme
     n×colonne AVANT d'appliquer overflow-x:auto, ce qui élargit le body.
     Un flex row avec overflow-x:auto est contraint par son conteneur. */
  .stats-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    gap: .875rem;
    padding-bottom: .5rem;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .stats-grid::-webkit-scrollbar { display: none; }
  .stat-card { flex: 0 0 auto; width: max(155px, 42vw); scroll-snap-align: start; }
  th, td { padding: .5rem .625rem; }
  .table-responsive-hide { display: none; }
  .page-header h1 { font-size: 1.25rem; }
  .grid-2 { gap: 1rem; }
}

@media (max-width: 480px) {
  .page-header h1 { font-size: 1.125rem; }
  .goals-grid { grid-template-columns: 1fr; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .page-content { padding: 1.5rem; }
}

@media (min-width: 1440px) {
  .stats-grid { grid-template-columns: repeat(8, minmax(0,1fr)); }
  .page-content { padding: 2rem; }
}
