:root {
  color-scheme: dark;
  --night-core: #080b12;
  --deep-navy: #0b1020;
  --card-dark: rgba(16, 24, 39, 0.88);
  --surface-card: #101827;
  --surface-elevated: #172033;
  --border-subtle: rgba(148, 163, 184, 0.14);
  --clarity: #37f5a5;
  --insight: #4da3ff;
  --warning: #facc15;
  --danger: #fb7185;
  --success: #22c55e;
  --purple-soft: #a78bfa;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --shadow-premium: 0 20px 60px rgba(0, 0, 0, 0.35);
  --sidebar-width: 260px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: 16px;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(145deg, rgba(55, 245, 165, 0.08), transparent 30%),
    linear-gradient(215deg, rgba(77, 163, 255, 0.1), transparent 36%),
    var(--night-core);
  color: var(--text-primary);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.desktop-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  gap: 32px;
  padding: 28px 22px;
  border-right: 1px solid var(--border-subtle);
  background: rgba(8, 11, 18, 0.82);
  backdrop-filter: blur(18px);
}

.brand-lockup,
.mobile-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  display: block;
}

.brand-lockup strong,
.mobile-brand span:last-child {
  display: block;
  font-size: 1.02rem;
}

.brand-lockup small {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list a,
.mobile-nav a {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.nav-list a {
  min-height: 48px;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
}

.nav-list a:hover,
.nav-list a.is-active {
  border-color: rgba(55, 245, 165, 0.24);
  background: rgba(55, 245, 165, 0.08);
  color: var(--text-primary);
}

.nav-list a:hover {
  transform: translateX(2px);
}

.nav-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--clarity);
}

.content-shell {
  min-height: 100vh;
  padding-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 18px 34px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  background: rgba(8, 11, 18, 0.72);
  backdrop-filter: blur(18px);
}

.mobile-brand {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-form {
  margin: 0;
}

.account-link,
.primary-button,
.secondary-button,
.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(16, 24, 39, 0.82);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 16px;
  font-weight: 700;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease, transform 180ms ease;
}

.account-link:hover,
.secondary-button:hover,
.btn:hover {
  border-color: rgba(55, 245, 165, 0.36);
  color: var(--clarity);
  transform: translateY(-1px);
}

.account-link.accent,
.primary-button,
.btn-primary {
  border-color: rgba(55, 245, 165, 0.42);
  background: linear-gradient(135deg, var(--clarity), var(--insight));
  color: #04111d;
}

.account-link.subtle {
  background: rgba(148, 163, 184, 0.08);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: rgba(16, 24, 39, 0.82);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.icon-button:hover {
  border-color: rgba(55, 245, 165, 0.36);
  color: var(--clarity);
  transform: translateY(-1px);
}

.main-content {
  width: min(1240px, calc(100% - 44px));
  margin: 0 auto;
  padding: 34px 0 110px;
}

.dashboard-hero,
.metric-card,
.analytics-card,
.insight-card,
.balance-panel,
.health-summary {
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  background: var(--card-dark);
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(14px);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 24px;
  align-items: stretch;
  padding: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--clarity);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 2rem;
  line-height: 1.25;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
  line-height: 1.35;
}

.hero-copy,
.placeholder-copy,
.insight-card p {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--text-secondary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.balance-panel {
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
  background: linear-gradient(145deg, rgba(55, 245, 165, 0.16), rgba(77, 163, 255, 0.08));
}

.balance-panel span,
.metric-label,
.metric-note {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.balance-panel strong {
  font-size: 2.1rem;
  line-height: 1.15;
}

.balance-panel small {
  color: var(--clarity);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.metric-card {
  display: grid;
  min-height: 140px;
  gap: 10px;
  align-content: center;
  padding: 20px;
}

.metric-card strong {
  font-size: 1.75rem;
  line-height: 1.2;
}

.metric-note.positive {
  color: var(--success);
}

.metric-note.warning {
  color: var(--warning);
}

.metric-note.danger {
  color: var(--danger);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.insight-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px;
  background: linear-gradient(135deg, rgba(77, 163, 255, 0.16), rgba(55, 245, 165, 0.08)), var(--card-dark);
}

.insight-pulse {
  display: grid;
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  place-items: center;
  border: 1px solid rgba(55, 245, 165, 0.34);
  border-radius: 50%;
  color: var(--clarity);
  font-size: 1.4rem;
  font-weight: 800;
  box-shadow: inset 0 0 28px rgba(55, 245, 165, 0.14);
}

.analytics-card {
  min-height: 320px;
  padding: 22px;
}

.wide-card {
  grid-column: 1 / -1;
  min-height: 260px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading h1,
.section-heading h2 {
  margin-bottom: 0;
}

.line-chart {
  width: 100%;
  aspect-ratio: 2.36 / 1;
}

.line-chart svg {
  width: 100%;
  height: 100%;
}

.chart-grid-line {
  stroke: rgba(148, 163, 184, 0.12);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-width: 5;
}

.chart-line.planned {
  stroke: rgba(148, 163, 184, 0.44);
}

.chart-line.actual {
  stroke: var(--clarity);
  filter: drop-shadow(0 0 10px rgba(55, 245, 165, 0.34));
}

.chart-dot {
  fill: var(--clarity);
}

.category-chart {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.donut {
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--clarity) 0 32%, var(--insight) 32% 60%, var(--warning) 60% 79%, var(--purple-soft) 79% 100%);
  box-shadow: inset 0 0 0 34px var(--surface-elevated), 0 0 28px rgba(77, 163, 255, 0.16);
}

.legend-list,
.goal-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
}

.legend-list li > span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
}

.legend-dot.food {
  background: var(--clarity);
}

.legend-dot.home {
  background: var(--insight);
}

.legend-dot.transit {
  background: var(--warning);
}

.legend-dot.goals {
  background: var(--purple-soft);
}

.goal-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(120px, 1fr) 58px;
  gap: 16px;
  align-items: center;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--clarity), var(--insight));
}

.warning-track span {
  background: linear-gradient(90deg, var(--warning), var(--danger));
}

.danger-track span {
  background: linear-gradient(90deg, var(--danger), #f97316);
}

.floating-action {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 20;
  display: inline-flex;
  min-height: 54px;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid rgba(55, 245, 165, 0.42);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--clarity), var(--insight));
  color: #04111d;
  box-shadow: 0 18px 44px rgba(55, 245, 165, 0.22);
  font-weight: 800;
}

.floating-action span {
  font-size: 1.3rem;
  line-height: 1;
}

.mobile-nav {
  display: none;
}

/* Caché par défaut sur desktop ; rendu visible uniquement dans le media query ≤ 1024px */
.mobile-nav-drawer {
  display: none;
}

.page-section {
  display: grid;
  gap: 18px;
}

.compact-section {
  max-width: 820px;
}

.admin-categories-section {
  max-width: 1100px;
}

.health-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
}

.health-summary.is-healthy strong {
  color: var(--success);
}

.health-summary.is-degraded strong {
  color: var(--warning);
}

.health-summary.is-unhealthy strong {
  color: var(--danger);
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.profile-section {
  max-width: 1120px;
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 18px;
  align-items: start;
}

.profile-side-panel {
  display: grid;
  gap: 18px;
}

.settings-form,
.form-section,
.toggle-grid {
  display: grid;
  gap: 18px;
}

.form-section {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.form-section:last-of-type {
  border-bottom: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

/* Champ utilisé dans une barre de filtre : sans espace vertical */
.filter-field {
  margin-bottom: 0;
}

.field span,
.form-label,
label {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.field input,
.field select,
.form-control,
.form-select,
input[type="email"],
input[type="password"],
input[type="text"],
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: rgba(8, 11, 18, 0.56);
  color: var(--text-primary);
  outline: none;
  padding: 10px 12px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.form-control:focus,
.form-select:focus {
  border-color: rgba(55, 245, 165, 0.44);
  box-shadow: 0 0 0 4px rgba(55, 245, 165, 0.08);
}

.field input[readonly] {
  color: var(--text-muted);
}

.field-error,
.text-danger,
.validation-summary {
  color: var(--danger);
  font-size: 0.84rem;
}

.toggle-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toggle-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 50px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.06);
}

.toggle-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  accent-color: var(--clarity);
  margin-top: 2px;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  color: var(--text-muted);
}

.status-message {
  border: 1px solid rgba(55, 245, 165, 0.3);
  border-radius: 16px;
  background: rgba(55, 245, 165, 0.08);
  color: var(--clarity);
  padding: 14px 16px;
}

.compact-card {
  min-height: auto;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.expenses-section {
  max-width: 1180px;
}

.budget-section {
  max-width: 1180px;
}

.goals-section {
  max-width: 1180px;
}

.insights-section {
  max-width: 1040px;
}

.reports-section {
  max-width: 1180px;
}

.expenses-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 18px;
  align-items: start;
}

.expense-form {
  min-height: auto;
}

.month-filter {
  display: grid;
  gap: 14px;
}

.expense-list {
  display: grid;
  gap: 12px;
}

.projection-list {
  display: grid;
  gap: 10px;
}

.upcoming-alert-card {
  display: grid;
  gap: 12px;
}

.upcoming-alert-list {
  display: grid;
  gap: 10px;
}

.upcoming-alert-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.06);
}

.upcoming-alert-row strong,
.upcoming-alert-row small {
  display: block;
}

.upcoming-alert-row small {
  color: var(--text-muted);
}

.budget-alert-card {
  display: grid;
  gap: 12px;
}

.budget-alert-list,
.budget-category-list,
.budget-pacing-chart {
  display: grid;
  gap: 12px;
}

.budget-alert-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: rgba(148, 163, 184, 0.06);
}

.budget-alert-row small {
  color: var(--text-muted);
}

.budget-alert-row.positive {
  border-color: rgba(34, 197, 94, 0.28);
}

.budget-alert-row.warning {
  border-color: rgba(250, 204, 21, 0.32);
}

.budget-alert-row.danger {
  border-color: rgba(251, 113, 133, 0.34);
}

.budget-heading-row,
.month-inline-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.month-inline-filter {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.month-inline-filter input {
  min-height: 42px;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  background: rgba(8, 11, 18, 0.56);
  color: var(--text-primary);
  padding: 8px 10px;
}

.budget-chart-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(120px, 1fr) minmax(90px, auto);
  gap: 14px;
  align-items: center;
}

.budget-category-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) minmax(90px, auto) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.06);
}

.budget-category-row.warning {
  border-color: rgba(250, 204, 21, 0.26);
}

.budget-category-row.danger {
  border-color: rgba(251, 113, 133, 0.32);
}

.financial-goal-list,
.goal-contribution-list {
  display: grid;
  gap: 12px;
}

.insight-list {
  display: grid;
  gap: 14px;
}

.insight-row {
  display: flex;
  min-height: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-left: 4px solid rgba(77, 163, 255, 0.42);
}

.insight-row p:not(.eyebrow) {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--text-secondary);
}

.insight-row.positive {
  border-left-color: var(--success);
}

.insight-row.warning {
  border-left-color: var(--warning);
}

.insight-row.danger {
  border-left-color: var(--danger);
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.report-card {
  min-height: 0;
}

.report-table-wrap {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.report-table th {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.report-table td {
  color: var(--text-secondary);
}

.report-table td:nth-child(2),
.report-table td:nth-child(3),
.report-table td:nth-child(4) {
  white-space: nowrap;
}

.report-state.positive {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.report-state.warning {
  border-color: rgba(250, 204, 21, 0.32);
  background: rgba(250, 204, 21, 0.1);
  color: var(--warning);
}

.report-state.danger {
  border-color: rgba(251, 113, 133, 0.34);
  background: rgba(251, 113, 133, 0.1);
  color: var(--danger);
}

.financial-goal-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.06);
}

.financial-goal-row.warning {
  border-color: rgba(250, 204, 21, 0.26);
}

.goal-contribution-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.goal-contribution-row:last-child {
  border-bottom: 0;
}

.goal-contribution-row strong,
.goal-contribution-row small {
  display: block;
}

.goal-contribution-row small {
  color: var(--text-muted);
}

.goal-linked-expense-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.goal-linked-expense-row:last-child {
  border-bottom: 0;
}

.goal-linked-expense-row strong,
.goal-linked-expense-row small {
  display: block;
}

.goal-linked-expense-row small {
  color: var(--text-muted);
}

.goal-linked-expense-row form {
  grid-column: 1 / -1;
  margin: 0;
}

.category-list {
  display: grid;
  gap: 12px;
}

.expense-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) minmax(90px, auto) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.06);
}

.recurring-row.is-paused {
  opacity: 0.68;
}

.projection-row {
  grid-template-columns: 12px minmax(0, 1fr) minmax(90px, auto) auto;
}

.category-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  background: rgba(148, 163, 184, 0.06);
}

.category-marker {
  width: 10px;
  height: 44px;
  border-radius: 999px;
}

.category-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-icon-badge {
  display: grid;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
}

.category-icon-badge svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.expense-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.expense-main small {
  color: var(--text-muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid rgba(77, 163, 255, 0.28);
  border-radius: 999px;
  background: rgba(77, 163, 255, 0.1);
  color: var(--text-secondary);
  padding: 2px 9px;
  font-size: 0.76rem;
  font-weight: 700;
}

.status-pill {
  border-color: rgba(250, 204, 21, 0.32);
  background: rgba(250, 204, 21, 0.1);
  color: var(--warning);
}

.expense-amount {
  color: var(--text-primary);
  text-align: right;
}

.expense-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.expense-actions form {
  margin: 0;
}

.danger-button:hover {
  border-color: rgba(251, 113, 133, 0.46);
  color: var(--danger);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: 28px;
  align-items: center;
  min-height: calc(100vh - 220px);
}

.auth-copy {
  max-width: 620px;
}

.auth-logo {
  display: block;
  height: 88px;
  width: auto;
  margin-bottom: 32px;
}

.auth-copy h1 {
  max-width: 560px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.08;
}

.auth-copy p:not(.eyebrow) {
  max-width: 520px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.auth-card {
  display: grid;
  gap: 18px;
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  background: var(--card-dark);
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(14px);
  padding: 24px;
}

.full-button {
  width: 100%;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth-links a:hover {
  color: var(--clarity);
}

.compact-toggle {
  min-height: 44px;
  padding: 10px 12px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.col-md-4,
.col-md-6,
.col-md-8 {
  max-width: 560px;
}

.form-floating,
.mb-3,
.form-group {
  margin-bottom: 14px;
}

.checkbox {
  margin: 12px 0;
}

@media (max-width: 1024px) {
  .desktop-sidebar {
    display: none;
  }

  .content-shell {
    padding-left: 0;
  }

  .topbar {
    padding: 16px 20px;
  }

  .mobile-brand {
    display: inline-flex;
  }

  .main-content {
    width: min(100% - 28px, 820px);
    padding-top: 22px;
    padding-bottom: 132px;
  }

  .dashboard-hero,
  .dashboard-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mobile-nav {
    position: fixed;
    right: 14px;
    bottom: 14px;
    left: 14px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    min-height: 68px;
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    background: rgba(16, 24, 39, 0.92);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(18px);
  }

  .mobile-nav a,
  .mobile-nav-more {
    display: grid;
    place-items: center;
    gap: 2px;
    min-width: 0;
    padding: 8px 2px;
    font-size: 1.08rem;
  }

  /* Bouton "Plus" : reprend l'apparence des liens de navigation */
  .mobile-nav-more {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
  }

  .mobile-nav-more.is-active,
  .mobile-nav-more.is-active small {
    color: var(--clarity);
  }

  .mobile-nav small {
    max-width: 100%;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav a.is-active,
  .mobile-nav a.is-active small {
    color: var(--clarity);
  }

  /* Panneau des sections secondaires */
  .mobile-nav-drawer {
    position: fixed;
    right: 14px;
    bottom: 96px;
    left: 14px;
    z-index: 29;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    background: rgba(16, 24, 39, 0.96);
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(18px);
  }

  .mobile-nav-drawer.is-open {
    display: flex;
  }

  .mobile-nav-drawer a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease;
  }

  .mobile-nav-drawer a:hover,
  .mobile-nav-drawer a.is-active {
    background: rgba(55, 245, 165, 0.08);
    color: var(--text-primary);
  }

  .mobile-nav-drawer a.is-active {
    color: var(--clarity);
  }

  .floating-action {
    right: 18px;
    bottom: 96px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .expenses-grid {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    align-items: start;
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .dashboard-hero,
  .analytics-card,
  .insight-card,
  .metric-card,
  .balance-panel {
    border-radius: 20px;
  }

  .dashboard-hero,
  .insight-card {
    padding: 20px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .insight-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .insight-row {
    flex-direction: column;
  }

  .insight-pulse {
    width: 76px;
    height: 76px;
    flex-basis: 76px;
  }

  .category-chart {
    grid-template-columns: 1fr;
  }

  .donut {
    width: min(190px, 58vw);
    margin: 0 auto;
  }

  .goal-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .budget-chart-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .budget-heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .floating-action strong {
    display: none;
  }

  .floating-action {
    width: 56px;
    justify-content: center;
    padding: 0;
  }

  .topbar-actions .icon-button {
    display: none;
  }

  .topbar-actions .account-link {
    min-height: 38px;
    padding: 0 10px;
    font-size: 0.82rem;
  }

  .topbar-actions .inline-form {
    display: none;
  }

  .form-grid,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .expense-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .projection-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .category-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .budget-category-row {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .financial-goal-row {
    grid-template-columns: 1fr;
  }

  .goal-linked-expense-row {
    grid-template-columns: 1fr;
  }

  .expense-amount,
  .expense-actions {
    grid-column: 2;
    text-align: left;
    justify-content: flex-start;
  }
}

/* Light visual direction inspired by airy finance apps: quiet surfaces, sharper cards, and warmer data accents. */
:root {
  color-scheme: light;
  --night-core: #f8f1f3;
  --deep-navy: #fffafb;
  --card-dark: #ffffff;
  --surface-card: #ffffff;
  --surface-elevated: #f4ecef;
  --border-subtle: rgba(49, 38, 43, 0.1);
  --clarity: #f59e0b;
  --insight: #0ea5e9;
  --warning: #f59e0b;
  --danger: #e11d48;
  --success: #10b981;
  --purple-soft: #8b5cf6;
  --text-primary: #31262b;
  --text-secondary: #655a60;
  --text-muted: #9a8f95;
  --shadow-premium: 0 18px 52px rgba(49, 38, 43, 0.08);
  --sidebar-width: 244px;
  --radius-card: 8px;
  --radius-control: 8px;
}

html {
  background: var(--night-core);
}

body {
  background: var(--night-core);
  color: var(--text-primary);
}

.desktop-sidebar {
  gap: 28px;
  border-right: 1px solid rgba(49, 38, 43, 0.08);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 16px 0 42px rgba(49, 38, 43, 0.04);
  backdrop-filter: blur(12px);
}

.brand-mark {
  flex: 0 0 auto;
}

.brand-lockup small {
  color: var(--text-muted);
}

.nav-list {
  gap: 4px;
}

.nav-list a {
  min-height: 42px;
  border-radius: var(--radius-control);
  color: var(--text-secondary);
}

.nav-list a:hover,
.nav-list a.is-active {
  border-color: rgba(225, 29, 72, 0.14);
  background: #fff1f5;
  color: var(--text-primary);
}

.nav-list a:hover {
  transform: translateX(1px);
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-control);
  background: rgba(49, 38, 43, 0.04);
  color: #e11d48;
}

.topbar {
  min-height: 68px;
  border-bottom: 1px solid rgba(49, 38, 43, 0.08);
  background: rgba(248, 241, 243, 0.78);
  backdrop-filter: blur(14px);
}

.main-content {
  width: min(1180px, calc(100% - 48px));
  padding-top: 30px;
}

.dashboard-hero,
.metric-card,
.analytics-card,
.insight-card,
.balance-panel,
.health-summary,
.auth-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--card-dark);
  box-shadow: var(--shadow-premium);
  backdrop-filter: none;
}

.dashboard-hero {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0 0 8px;
}

.dashboard-hero h1,
.section-heading h1 {
  letter-spacing: 0;
}

.eyebrow {
  color: #e88b00;
  letter-spacing: 0.02em;
}

h1 {
  font-size: 2.15rem;
}

h2 {
  font-size: 1.18rem;
}

.hero-copy,
.placeholder-copy,
.insight-card p {
  color: var(--text-secondary);
}

.balance-panel {
  background: #2f2529;
  color: #fffafb;
}

.balance-panel span,
.balance-panel small {
  color: rgba(255, 250, 251, 0.72);
}

.metric-grid {
  gap: 12px;
}

.metric-card {
  min-height: 118px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(49, 38, 43, 0.05);
}

.metric-card strong {
  font-size: 1.52rem;
}

.analytics-card {
  min-height: 260px;
  padding: 20px;
  box-shadow: 0 14px 40px rgba(49, 38, 43, 0.06);
}

.compact-card,
.expense-form {
  min-height: auto;
}

.insight-card {
  background: #ffffff;
}

.insight-pulse {
  width: 86px;
  height: 86px;
  flex-basis: 86px;
  border-color: rgba(225, 29, 72, 0.18);
  border-radius: 50%;
  color: #e11d48;
  box-shadow: inset 0 0 0 12px #fff1f5;
}

.account-link,
.primary-button,
.secondary-button,
.btn,
.floating-action {
  border-radius: var(--radius-control);
}

.account-link,
.secondary-button,
.btn {
  border-color: rgba(49, 38, 43, 0.12);
  background: #ffffff;
  color: var(--text-primary);
}

.account-link:hover,
.secondary-button:hover,
.btn:hover {
  border-color: rgba(225, 29, 72, 0.22);
  color: #e11d48;
  transform: translateY(-1px);
}

.account-link.accent,
.primary-button,
.btn-primary,
.floating-action {
  border-color: #31262b;
  background: #31262b;
  color: #ffffff;
}

.account-link.subtle {
  background: #f4ecef;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-color: rgba(49, 38, 43, 0.12);
  border-radius: var(--radius-control);
  background: #ffffff;
  color: var(--text-secondary);
}

.icon-button:hover {
  border-color: rgba(225, 29, 72, 0.22);
  color: #e11d48;
}

.floating-action {
  min-height: 50px;
  box-shadow: 0 14px 34px rgba(49, 38, 43, 0.16);
}

.chart-grid-line {
  stroke: rgba(49, 38, 43, 0.08);
}

.chart-line.planned {
  stroke: rgba(49, 38, 43, 0.22);
}

.chart-line.actual {
  stroke: #f472b6;
  filter: none;
}

.chart-dot {
  fill: #f472b6;
}

.donut {
  background: conic-gradient(#f472b6 0 42%, #f59e0b 42% 68%, #0ea5e9 68% 86%, #8b5cf6 86% 100%);
  box-shadow: inset 0 0 0 34px #ffffff;
}

.legend-dot.food {
  background: #f472b6;
}

.legend-dot.home {
  background: #f59e0b;
}

.legend-dot.transit {
  background: #0ea5e9;
}

.legend-dot.goals {
  background: #8b5cf6;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(49, 38, 43, 0.08);
}

.progress-track span {
  background: linear-gradient(90deg, #f472b6, #f59e0b);
}

.warning-track span {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.danger-track span {
  background: linear-gradient(90deg, #e11d48, #ef4444);
}

.field input,
.field select,
.form-control,
.form-select,
input[type="email"],
input[type="password"],
input[type="text"],
select,
textarea,
.month-inline-filter input {
  border-color: rgba(49, 38, 43, 0.12);
  border-radius: var(--radius-control);
  background: #fffafb;
  color: var(--text-primary);
}

.field input:focus,
.field select:focus,
.form-control:focus,
.form-select:focus {
  border-color: rgba(244, 114, 182, 0.46);
  box-shadow: 0 0 0 4px rgba(244, 114, 182, 0.1);
}

.form-section {
  border-bottom-color: rgba(49, 38, 43, 0.08);
}

.toggle-row,
.upcoming-alert-row,
.budget-alert-row,
.budget-category-row,
.financial-goal-row,
.expense-row,
.projection-row,
.category-row {
  border-color: rgba(49, 38, 43, 0.1);
  border-radius: var(--radius-card);
  background: #fffafb;
}

.budget-alert-row.positive,
.insight-row.positive,
.financial-goal-row.positive {
  border-color: rgba(16, 185, 129, 0.22);
}

.budget-alert-row.warning,
.budget-category-row.warning,
.financial-goal-row.warning,
.insight-row.warning {
  border-color: rgba(245, 158, 11, 0.28);
}

.budget-alert-row.danger,
.budget-category-row.danger,
.insight-row.danger {
  border-color: rgba(225, 29, 72, 0.26);
}

.category-marker {
  height: 40px;
  border-radius: 999px;
}

.tag-pill {
  border-color: rgba(14, 165, 233, 0.18);
  background: #eff9ff;
  color: #0369a1;
}

.status-pill {
  border-color: rgba(245, 158, 11, 0.2);
  background: #fff7ed;
  color: #b45309;
}

.status-message {
  border-color: rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-card);
  background: #ecfdf5;
  color: #047857;
}

.insight-row {
  border-left-width: 3px;
  box-shadow: 0 12px 34px rgba(49, 38, 43, 0.06);
}

.insight-row.positive {
  border-left-color: #10b981;
}

.insight-row.warning {
  border-left-color: #f59e0b;
}

.insight-row.danger {
  border-left-color: #e11d48;
}

.auth-copy p:not(.eyebrow),
.expense-main small,
.budget-alert-row small,
.upcoming-alert-row small,
.goal-contribution-row small,
.goal-linked-expense-row small {
  color: var(--text-muted);
}

.auth-card {
  background: #ffffff;
}

@media (max-width: 1024px) {
  .topbar {
    background: rgba(248, 241, 243, 0.86);
  }

  .mobile-nav {
    border-color: rgba(49, 38, 43, 0.1);
    border-radius: var(--radius-card);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 34px rgba(49, 38, 43, 0.12);
  }

  .mobile-nav a.is-active,
  .mobile-nav a.is-active small {
    color: #e11d48;
  }

  .mobile-nav-more {
    color: #5c4f54;
  }

  .mobile-nav-more.is-active,
  .mobile-nav-more.is-active small {
    color: #e11d48;
  }

  .mobile-nav-drawer {
    border-color: rgba(49, 38, 43, 0.1);
    border-radius: var(--radius-card);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 34px rgba(49, 38, 43, 0.14);
  }

  .mobile-nav-drawer a {
    color: #5c4f54;
  }

  .mobile-nav-drawer a:hover,
  .mobile-nav-drawer a.is-active {
    background: rgba(225, 29, 72, 0.06);
    color: #1a1315;
  }

  .mobile-nav-drawer a.is-active {
    color: #e11d48;
  }
}

@media (max-width: 680px) {
  .dashboard-hero,
  .analytics-card,
  .insight-card,
  .metric-card,
  .balance-panel,
  .auth-card {
    border-radius: var(--radius-card);
  }

  .dashboard-hero {
    padding: 0;
  }

  .main-content {
    width: min(100% - 26px, 820px);
  }
}


/* ========== Cloche de notifications ========== */

.notif-bell-wrap {
  position: relative;
  display: inline-flex;
}

.notif-bell-btn {
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #e11d48;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 200;
  width: 340px;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--surface-card);
  box-shadow: 0 8px 32px rgba(49, 38, 43, 0.14);
  overflow: hidden;
}

/* L'attribut hidden doit primer sur display:flex ci-dessus */
.notif-panel[hidden] {
  display: none;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.notif-panel-header strong {
  font-size: 14px;
  color: var(--text-primary);
}

.notif-mark-all-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
  color: var(--clarity);
  cursor: pointer;
  text-decoration: underline;
}

.notif-mark-all-btn:hover {
  color: var(--text-primary);
}

.notif-empty {
  padding: 24px 16px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin: 0;
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}

.notif-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item--unread {
  background: rgba(225, 29, 72, 0.04);
  border-left: 3px solid #e11d48;
}

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-item-msg {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notif-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.notif-panel-footer {
  display: block;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 500;
  color: var(--clarity);
  text-align: center;
  text-decoration: none;
}

.notif-panel-footer:hover {
  background: rgba(55, 245, 165, 0.06);
}


/* ========== Page /Profile/Notifications ========== */

.notif-page-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.notif-page-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.notif-page-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  background: var(--surface-card);
}

.notif-page-item--unread {
  border-left: 4px solid #e11d48;
  background: rgba(225, 29, 72, 0.03);
}

.notif-page-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.notif-type-badge {
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(55, 245, 165, 0.12);
  color: var(--clarity);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notif-page-title {
  font-size: 14px;
  color: var(--text-primary);
}

.notif-page-msg {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.notif-read-form {
  align-self: flex-start;
  margin-top: 4px;
}

.notif-mark-btn {
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.notif-mark-btn:hover {
  border-color: var(--clarity);
  color: var(--clarity);
}

.pagination-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}


/* ==========================================
   Administration
   ========================================== */

.admin-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.admin-nav-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: var(--card-dark);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-nav-card:hover {
  border-color: var(--clarity);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--clarity) 20%, transparent);
}

.admin-nav-icon {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--clarity);
}

.admin-nav-card strong {
  font-size: 0.95rem;
}

.admin-nav-card span:last-child {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Tableau de données */
.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--clarity) 5%, transparent);
}

.data-table .row-archived td {
  opacity: 0.5;
}

.data-table .action-cell {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Indicateurs de statut */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
  background: var(--text-secondary);
}

.status-dot.is-healthy { background: var(--success); }
.status-dot.is-degraded { background: var(--warning); }
.status-dot.is-unhealthy { background: var(--danger); }

/* Badges de rôle */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--clarity) 15%, transparent);
  color: var(--clarity);
  margin-right: 4px;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.page-link {
  padding: 6px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.page-link:hover,
.page-link.is-active {
  border-color: var(--clarity);
  color: var(--clarity);
}

/* Health check enrichie */
.health-check-card {
  border-left: 3px solid var(--border-subtle);
}

.health-check-card.is-healthy { border-left-color: var(--success); }
.health-check-card.is-degraded { border-left-color: var(--warning); }
.health-check-card.is-unhealthy { border-left-color: var(--danger); }

.health-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

.health-error {
  margin-top: 8px;
  font-size: 0.8rem;
}

.health-error summary {
  cursor: pointer;
  color: var(--danger);
}

.health-error pre {
  margin-top: 6px;
  padding: 8px;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Swatch couleur */
.color-swatch {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  vertical-align: middle;
}

/* Compteur titre */
.count-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--clarity) 12%, transparent);
  color: var(--clarity);
  margin-left: 8px;
  vertical-align: middle;
}

/* Bouton fantôme — base neutre, pas de remplissage */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* Modificateur danger — surcharge la couleur sur .btn-ghost */
.btn-ghost.btn-danger,
.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-ghost.btn-danger:hover,
.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}

/* ==========================================
   Authentification externe (OAuth)
   ========================================== */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.oauth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-control);
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.oauth-button:hover {
  border-color: var(--text-secondary);
  background: color-mix(in srgb, var(--text-primary) 4%, transparent);
}

/* ==========================================
   MFA — Configuration authentificateur
   ========================================== */

.mfa-setup-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: start;
}

@media (max-width: 680px) {
  .mfa-setup-grid {
    grid-template-columns: 1fr;
  }
}

.mfa-steps {
  padding-left: 20px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.mfa-steps li {
  margin-bottom: 8px;
}

.mfa-manual-key {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: color-mix(in srgb, var(--clarity) 4%, transparent);
}

.mfa-key-code {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  color: var(--clarity);
  word-break: break-all;
}

.mfa-qr-wrap {
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mfa-qr-image {
  display: block;
}

.mfa-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
}

/* Codes de récupération */
.recovery-codes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.recovery-code {
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: color-mix(in srgb, var(--clarity) 4%, transparent);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-align: center;
  color: var(--text-primary);
}

/* Alertes génériques */
.alert {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-warning {
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--text-primary);
}

/* ==========================================
   Budget partagé — Groupes
   ========================================== */

.shared-groups-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.shared-group-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s;
}

.shared-group-card:hover {
  border-color: var(--clarity);
}

.shared-group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.shared-group-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--text-primary);
}

.shared-group-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin: 0;
}

.shared-group-stats {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Badge de rôle */
.shared-group-role-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-owner {
  background: color-mix(in srgb, var(--clarity) 15%, transparent);
  color: var(--clarity);
  border: 1px solid color-mix(in srgb, var(--clarity) 30%, transparent);
}

.role-contributor {
  background: color-mix(in srgb, var(--info, #7b95d4) 15%, transparent);
  color: var(--info, #7b95d4);
  border: 1px solid color-mix(in srgb, var(--info, #7b95d4) 30%, transparent);
}

.role-viewer {
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  color: var(--text-muted);
  border: 1px solid color-mix(in srgb, var(--text-muted) 25%, transparent);
}

/* Grille détail groupe */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Liste de membres */
.member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.member-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-card);
}

.member-row strong {
  display: block;
  font-size: 0.875rem;
}

.member-row .text-muted {
  font-size: 0.775rem;
}

.member-row-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Formulaire d'invitation */
.invite-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Invitations en attente */
.invitation-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 0.825rem;
  margin-bottom: 6px;
}

/* Page Join */
.join-group-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* Barre de budget */
.budget-bar-track {
  width: 100%;
  height: 4px;
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
  border-radius: 2px;
  margin: 6px 0 2px;
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  background: var(--clarity);
  border-radius: 2px;
  transition: width 0.3s;
}

.budget-bar-fill.over-budget {
  background: var(--danger);
}

/* Liste de dépenses du groupe */
.expense-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.expense-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--surface-card);
}

.expense-row-info strong {
  display: block;
  font-size: 0.875rem;
}

.expense-row-info .text-muted,
.expense-row-right .text-muted {
  display: block;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.expense-row-right {
  text-align: right;
}

.expense-row-right strong {
  display: block;
  font-size: 0.9rem;
}


/* Picker d'icônes */
.icon-picker {
  position: relative;
}

.icon-picker-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--surface-elevated, #172033);
  border: 1px solid var(--border, #263246);
  border-radius: 8px;
  color: var(--text-primary, #f1f5f9);
  cursor: pointer;
  font-size: 0.875rem;
  text-align: left;
}

.icon-picker-trigger:hover {
  border-color: var(--clarity, #37F5A5);
}

.icon-picker-trigger svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  stroke: var(--clarity, #37F5A5);
}

.icon-picker-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  display: none;
  /* Au minimum aussi large que le contrôle, jusqu'à 340px si l'espace le permet */
  min-width: 100%;
  width: max-content;
  max-width: 340px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface-card, #101827);
  border: 1px solid var(--border, #263246);
  border-radius: 12px;
  padding: 0.75rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.icon-picker-popover.is-open {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.icon-picker-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 0.65rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-picker-option svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.icon-picker-option:hover {
  background: var(--surface-elevated, #172033);
  color: var(--text-primary, #f1f5f9);
}

.icon-picker-option.is-selected {
  background: rgba(55, 245, 165, 0.12);
  border-color: var(--clarity, #37F5A5);
  color: var(--clarity, #37F5A5);
}


/* Lien "À propos" dans la sidebar — séparé visuellement du reste de la navigation */
.nav-about {
  margin-top: auto;
  opacity: 0.6;
  font-size: 0.82rem;
}

.nav-about:hover {
  opacity: 1;
}

/* Page À propos */
.about-section {
  max-width: 900px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}

.about-side {
  display: grid;
  gap: 20px;
}

.about-hero-card {
  display: grid;
  gap: 14px;
}

.about-logo {
  display: block;
}

.about-tagline {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

.about-description {
  line-height: 1.7;
  color: var(--text-secondary);
}

.about-info-card {
  display: grid;
  gap: 16px;
}

.about-info-card h2 {
  font-size: 0.95rem;
  font-weight: 600;
}

.about-dl {
  display: grid;
  gap: 10px;
}

.about-dl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.about-dl-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.about-dl-row dt {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.about-dl-row dd {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.about-designer {
  display: flex;
  align-items: center;
  gap: 14px;
}

.about-designer-avatar {
  display: grid;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--clarity) 18%, transparent);
  color: var(--clarity);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.about-designer strong {
  display: block;
  font-size: 0.95rem;
}

.about-designer small {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.about-designer-note {
  font-size: 0.83rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* Responsive : table des catégories admin */
/* Sur tablette (≤ 900px) : masquer EN et Ordre */
@media (max-width: 900px) {
  .admin-cat-table th:nth-child(4),
  .admin-cat-table td:nth-child(4),
  .admin-cat-table th:nth-child(6),
  .admin-cat-table td:nth-child(6) {
    display: none;
  }
}

/* Sur mobile (≤ 600px) : masquer aussi l'icône et l'état */
@media (max-width: 600px) {
  .admin-cat-table th:nth-child(5),
  .admin-cat-table td:nth-child(5),
  .admin-cat-table th:nth-child(7),
  .admin-cat-table td:nth-child(7) {
    display: none;
  }

  .admin-cat-table .action-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
