:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --app-h: 100vh;
  --app-w: 100vw;

  --tab-bar-height: 60px;
  --tab-bar-lift: max(10px, var(--safe-bottom));
  --tab-bar-frame-extra: 5px;
  --stage-bottom: calc(var(--tab-bar-height) + var(--tab-bar-lift) + var(--tab-bar-frame-extra));
  --keyboard-inset: 0px;

  --content-inset: 20px;
  --header-drop: calc(12px + var(--safe-top));

  --navy: #0f2a3d;
  --navy-deep: #0a1f2e;
  --blue: #3a6680;
  --beige: #e4ddd0;
  --beige-soft: #f0ebe3;
  --gold: #b08d3e;
  --gold-soft: #c9a84f;
  --ink: #1a242c;
  --muted: #66747d;
  --line: rgba(15, 42, 61, 0.12);
  --danger: #b33a3a;
  --ok: #2a7a4b;
  --surface: rgba(255, 252, 247, 0.72);
  --radius: 8px;
  --page-bg-0: #f4f0e8;
  --page-bg-1: var(--beige-soft);
  --page-bg-2: var(--beige);
  --card-bg-0: #fffcf7;
  --card-bg-1: var(--beige-soft);
  --tile-bg: rgba(255, 252, 247, 0.85);
  --tile-active: rgba(15, 42, 61, 0.06);
  --shadow-soft: rgba(15, 42, 61, 0.06);
  --shadow-modal: rgba(10, 31, 46, 0.2);
  --chart-line: #0f2a3d;
  --chart-area: rgba(58, 102, 128, 0.14);
  --chart-dot: #3a6680;
  --chart-dot-end: #0f2a3d;
  --chart-label: #66747d;
  --chart-center: #0f2a3d;
  --chart-ring-track: rgba(15, 42, 61, 0.08);
  --chart-pct-halo: rgba(255, 252, 247, 0.92);

  /* Une seule famille, neutre — pas de display expressif */
  --font-display: "Source Sans 3", "Helvetica Neue", sans-serif;
  --font-body: "Source Sans 3", "Helvetica Neue", sans-serif;
}

html[data-theme="dark"] {
  --navy: #d6e2ea;
  --navy-deep: #07131c;
  --blue: #7aa8c4;
  --beige: #1c2a36;
  --beige-soft: #121e27;
  --gold: #c9a84f;
  --gold-soft: #d4b86a;
  --ink: #e8eef2;
  --muted: #b4c4ce;
  --line: rgba(214, 226, 234, 0.22);
  --danger: #d08080;
  --ok: #6fb89a;
  --surface: rgba(24, 36, 48, 0.95);
  --page-bg-0: #0c1620;
  --page-bg-1: #121e27;
  --page-bg-2: #1a2833;
  --card-bg-0: #182430;
  --card-bg-1: #121e27;
  --tile-bg: #1a2834;
  --tile-active: rgba(214, 226, 234, 0.1);
  --shadow-soft: rgba(0, 0, 0, 0.35);
  --shadow-modal: rgba(0, 0, 0, 0.45);
  --chart-line: #d6e2ea;
  --chart-area: rgba(122, 168, 196, 0.28);
  --chart-dot: #7aa8c4;
  --chart-dot-end: #e8eef2;
  --chart-label: #b4c4ce;
  --chart-center: #e8eef2;
  --chart-ring-track: rgba(214, 226, 234, 0.14);
  --chart-pct-halo: rgba(18, 30, 39, 0.92);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: var(--app-h);
  width: var(--app-w);
  max-width: 100%;
  overflow: hidden;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0;
  color: var(--ink);
  background-color: var(--beige-soft);
  background-image:
    linear-gradient(180deg, rgba(15, 42, 61, 0.04) 0%, transparent 42%),
    linear-gradient(135deg, rgba(176, 141, 62, 0.07) 0%, transparent 38%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 11px,
      rgba(15, 42, 61, 0.015) 11px,
      rgba(15, 42, 61, 0.015) 12px
    ),
    linear-gradient(168deg, var(--page-bg-0) 0%, var(--page-bg-1) 46%, var(--page-bg-2) 100%);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background-image:
    linear-gradient(180deg, rgba(122, 168, 196, 0.06) 0%, transparent 42%),
    linear-gradient(135deg, rgba(201, 168, 79, 0.05) 0%, transparent 38%),
    linear-gradient(168deg, var(--page-bg-0) 0%, var(--page-bg-1) 46%, var(--page-bg-2) 100%);
  color-scheme: dark;
}

body {
  position: fixed;
  inset: 0;
}

html.boot-locked,
html.boot-locked body {
  background: var(--navy-deep);
}

html.boot-locked .lock-screen:not([hidden]) {
  display: flex !important;
}

/* Aperçu live-reload : aucun flash du cadenas — contenu conservé à l’écran */
html.boot-unlocked.dev-mode,
html.boot-unlocked.dev-mode body {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(176, 141, 62, 0.14), transparent 55%),
    linear-gradient(168deg, var(--page-bg-0) 0%, var(--page-bg-1) 46%, var(--page-bg-2) 100%);
}

html.boot-unlocked.dev-mode #lock-screen {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

html.boot-unlocked.dev-mode body.is-locked .app-shell,
html.boot-unlocked.dev-mode #app-shell[hidden] {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

html.boot-unlocked.dev-mode body.is-locked #main-tab-bar,
html.boot-unlocked.dev-mode body.is-locked .tab-fab,
html.boot-unlocked.dev-mode #main-tab-bar[hidden] {
  visibility: visible !important;
  pointer-events: auto !important;
}

html.boot-unlocked.dev-mode #main-tab-bar[hidden] {
  display: flex !important;
}

body.is-locked .app-shell {
  visibility: hidden !important;
  pointer-events: none !important;
}

body.is-locked #main-tab-bar,
body.is-locked .tab-fab {
  visibility: hidden !important;
  pointer-events: none !important;
}

.lock-screen[hidden],
.app-shell[hidden],
.modal[hidden],
.panel[hidden],
button[hidden] {
  display: none !important;
}

/* Forcer : toute fenêtre visible = overlay plein écran, carte au centre exact */
.modal:not([hidden]) {
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  transform: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: max(20px, var(--safe-top)) max(20px, var(--safe-right)) max(20px, var(--safe-bottom)) max(20px, var(--safe-left)) !important;
  box-sizing: border-box !important;
  background: rgba(18, 42, 54, 0.5) !important;
  border: none !important;
  z-index: 400 !important;
}

.modal:not([hidden]) > .modal-card {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 auto !important;
  transform: none !important;
  flex: 0 1 auto !important;
  width: min(100%, 340px) !important;
  max-height: min(72vh, calc(var(--app-h, 100vh) - 40px)) !important;
}

/* Page pleine écran (nouvelles dépenses, revenus, budgets, etc.) */
.modal.modal-page:not([hidden]) {
  align-items: stretch !important;
  justify-content: stretch !important;
  padding: 0 !important;
  background:
    radial-gradient(120% 80% at 10% -10%, rgba(196, 163, 90, 0.22), transparent 55%),
    radial-gradient(90% 70% at 100% 0%, rgba(47, 111, 143, 0.18), transparent 50%),
    linear-gradient(165deg, var(--beige-soft) 0%, var(--beige) 48%, #ddd4c4 100%) !important;
  z-index: 420 !important;
}

.modal.modal-page:not([hidden]) > .modal-card.modal-page-card {
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  display: flex !important;
  flex-direction: column !important;
  padding:
    calc(var(--content-inset) + var(--header-drop))
    calc(var(--content-inset) + var(--safe-right))
    calc(var(--content-inset) + 8px + var(--safe-bottom))
    calc(var(--content-inset) + var(--safe-left)) !important;
  background: transparent !important;
}

.modal-page-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  /* laisse de l’air pour le contour de focus des champs */
  padding-left: 2px;
  padding-right: 2px;
}

.modal-page-actions {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 12px;
}

.modal-page .modal-hint,
.modal-page .section-label {
  max-width: 100%;
}

.modal-page .modal-input,
.modal-page .modal-select {
  font-size: 1rem;
  padding: 10px 12px;
}

.modal-page .field-label {
  margin: 8px 0 4px;
}

.modal-page .sheet-title {
  margin-bottom: 4px;
}

/* Objectif budget / épargne : mois sous le titre */
#budget-sheet .tx-sheet-head .modal-hint,
#savings-goal-modal .tx-sheet-head .modal-hint {
  margin-bottom: 0;
}

/* Feuilles courtes : contenu fixe, aucun scroll / saut / transition au focus */
#budget-sheet .modal-page-body,
#savings-goal-modal .modal-page-body,
#tx-sheet .modal-page-body {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: manipulation;
  -webkit-overflow-scrolling: auto;
}

#budget-sheet.modal-page:not([hidden]),
#savings-goal-modal.modal-page:not([hidden]),
#tx-sheet.modal-page:not([hidden]) {
  transition: none !important;
  animation: none !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  height: var(--app-h) !important;
  max-height: none !important;
  transform: none !important;
}

#budget-sheet .modal-card.modal-page-card,
#savings-goal-modal .modal-card.modal-page-card,
#tx-sheet .modal-card.modal-page-card {
  transition: none !important;
  animation: none !important;
  transform: none !important;
}

#budget-sheet .modal-input,
#budget-sheet .modal-select,
#savings-goal-modal .modal-input,
#savings-goal-modal .modal-select,
#tx-sheet .modal-input,
#tx-sheet .modal-select,
#panel-budget.is-objectif-edit .modal-input,
#panel-budget.is-objectif-edit .modal-select {
  transition: none !important;
}

#budget-label,
#budget-limit,
#budget-inline-label,
#budget-inline-limit,
#savings-goal-name,
#savings-goal-target,
#savings-goal-saved,
#savings-goal-amount,
#savings-inline-name,
#savings-inline-target,
#savings-inline-saved,
#savings-inline-amount {
  overflow-anchor: none;
}

/* Édition inline objectif : cartes comme nouvelle dépense */
#panel-budget.is-objectif-edit .objectif-edit-form:not([hidden]) {
  overscroll-behavior: none;
}

/* ——— Cadenas ——— */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(28px + var(--safe-top))
    calc(22px + var(--safe-right))
    calc(28px + var(--safe-bottom))
    calc(22px + var(--safe-left));
  background:
    linear-gradient(180deg, rgba(176, 141, 62, 0.12) 0%, transparent 34%),
    linear-gradient(165deg, #143447 0%, var(--navy) 42%, var(--navy-deep) 100%);
  color: var(--beige-soft);
}

.lock-screen-inner {
  width: min(100%, 340px);
  text-align: center;
}

.lock-brand-icon {
  display: block;
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  border-radius: 20px;
  object-fit: cover;
  background: #e7ebef;
}

.lock-screen-title {
  margin: 0 0 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0;
  color: rgba(240, 235, 227, 0.72);
}

.lock-screen-sub,
.lock-screen-hint,
.lock-screen-privacy {
  margin: 0;
  color: rgba(240, 235, 227, 0.62);
  font-size: 0.9rem;
  line-height: 1.45;
  font-weight: 400;
}

.modal-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  font-weight: 400;
}

.lock-screen-privacy {
  margin-top: 28px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  max-width: 28ch;
  margin-left: auto;
  margin-right: auto;
}

.lock-screen-hint {
  margin-top: 12px;
  color: var(--gold-soft);
}

.lock-identity-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 22px 0 8px;
  text-align: center;
}

.lock-identity-block[hidden] {
  display: none !important;
}

.lock-identity-btn {
  width: 100%;
  min-height: 48px;
  font-size: 1.05rem;
}

.lock-pin-block {
  margin-top: 18px;
  text-align: left;
}

.modal-label,
.field-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  text-transform: none;
}

.lock-screen .modal-label {
  color: rgba(243, 238, 230, 0.7);
}

.lock-pin-input,
.modal-input,
.modal-select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink);
  letter-spacing: 0.01em;
  outline: none;
  /* anneau de focus à l’intérieur → ne déborde pas des marges */
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lock-pin-input:focus,
.modal-input:focus,
.modal-select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 2px rgba(58, 102, 128, 0.45);
}

.lock-pin-input:focus-visible,
.modal-input:focus-visible,
.modal-select:focus-visible {
  outline: none;
}

#budget-new-category,
#tx-new-category,
#fixed-new-category {
  margin-top: 5px;
}

.lock-screen .lock-pin-input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(243, 238, 230, 0.22);
  color: #fff;
  text-align: center;
  letter-spacing: 0.35em;
}

.btn,
.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
  min-height: 48px;
  border-radius: var(--radius);
  border: none;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.btn-primary,
.modal-btn-primary {
  background: linear-gradient(180deg, #c9a84f 0%, var(--gold) 100%);
  color: var(--navy-deep);
}

.btn-outline,
.modal-btn-secondary {
  background: transparent;
  border: 1px solid rgba(240, 235, 227, 0.32);
  color: var(--beige-soft);
}

.modal .modal-btn-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 252, 247, 0.7);
}

.budget-duplicate-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: rgba(255, 252, 247, 0.85);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.budget-duplicate-btn[hidden] {
  display: none !important;
}

.list-gear-wrap {
  position: relative;
  flex: 0 0 auto;
}

.list-gear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.list-gear-btn[hidden] {
  display: none !important;
}

.list-gear-btn:active {
  background: rgba(15, 42, 61, 0.08);
}

.list-gear-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.list-gear-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 168px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 10px 24px rgba(10, 31, 46, 0.18);
}

.list-gear-menu[hidden] {
  display: none !important;
}

.list-gear-item {
  margin: 0;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--navy);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.list-gear-item[hidden] {
  display: none !important;
}

.list-gear-item:active {
  background: rgba(15, 42, 61, 0.08);
}

.list-select-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
}

.list-select-bar[hidden] {
  display: none !important;
}

.list-select-bar .modal-btn {
  width: 100%;
}

#panel-budget .list-select-bar {
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
}

#panel-budget #budget-select-bar {
  margin-top: 20px;
  margin-bottom: 28px;
}

#panel-budget .list-select-bar .modal-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-top: 0;
  min-height: 34px;
  padding: 6px 4px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}

#panel-budget .list-select-bar .modal-btn-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 252, 247, 0.7);
}

.item-swipe-wrap.is-selecting {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.item-swipe-wrap.is-selecting > .swipe-content {
  flex: 1;
  min-width: 0;
}

#panel-budget .item-swipe-wrap.is-selecting:has(.list-select-cb:checked) > .swipe-content {
  opacity: 0.4;
}

.list-select-check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  align-self: center;
}

.list-select-cb {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--navy);
}

.budget-section-block .home-block-header,
.budget-savings-goal-block .home-block-header {
  align-items: center;
  margin-bottom: 10px;
}

.budget-section-block .home-block-header .home-block-title,
.budget-savings-goal-block .home-block-header .home-block-title {
  margin: 0;
}

.fixed-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
}

#fixed-modal:not(.is-fixed-compose) .fixed-modal-header {
  margin-bottom: 22px;
}

#fixed-modal:not(.is-fixed-compose) #fixed-filters {
  margin: 0 0 22px;
}

.fixed-modal-header .sheet-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.top-bar-lock-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: rgba(255, 252, 247, 0.9);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.top-bar-lock-btn[hidden] {
  display: none !important;
}

.top-bar-lock-btn.is-locked {
  border-color: var(--gold);
  color: var(--navy);
}

.top-bar-lock-btn:active {
  background: rgba(15, 42, 61, 0.08);
}

.security-setup-faceid-btn {
  margin-top: 16px;
}

/* ——— Shell ——— */
.app-shell {
  height: var(--app-h);
  width: 100%;
  position: relative;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 0 var(--stage-bottom);
  min-height: 0;
  box-sizing: border-box;
}

/* Mois passé / suivant : léger retrait horizontal du contenu — barre du haut inchangée. */
html.is-past-month-view .panels {
  transform: scaleX(0.98);
  transform-origin: center top;
}

.past-month-frame {
  --past-month-gap: 3.5rem;
  --past-month-line: 2.5px;
  --past-month-label-offset: 30px;
  --past-month-accent: #d41818;
  position: fixed;
  top: 0;
  left: 2.4%;
  right: 2.4%;
  bottom: var(--stage-bottom);
  z-index: 90;
  pointer-events: none;
  box-sizing: border-box;
}

.past-month-frame.is-next {
  --past-month-accent: #2a7a4b;
}

.past-month-frame[hidden] {
  display: none !important;
}

.past-month-frame-line {
  position: absolute;
  background: var(--past-month-accent);
}

.past-month-frame-line.is-left-top,
.past-month-frame-line.is-right-top {
  width: var(--past-month-line);
  height: calc(50% + var(--past-month-label-offset) - var(--past-month-gap));
  top: 0;
}

.past-month-frame-line.is-left-bottom,
.past-month-frame-line.is-right-bottom {
  width: var(--past-month-line);
  height: calc(50% - var(--past-month-label-offset) - var(--past-month-gap));
  bottom: 0;
}

.past-month-frame-line.is-left-top,
.past-month-frame-line.is-left-bottom {
  left: 0;
}

.past-month-frame-line.is-right-top,
.past-month-frame-line.is-right-bottom {
  right: 0;
}

.past-month-frame-label {
  position: absolute;
  margin: 0;
  color: var(--past-month-accent);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: capitalize;
  white-space: nowrap;
  background: transparent;
  padding: 0;
  line-height: 1.2;
  animation: past-month-blink 1s step-start infinite;
}

.past-month-frame.is-next .past-month-frame-label {
  animation-name: next-month-blink;
}

.past-month-frame-label.is-left {
  top: calc(50% + var(--past-month-label-offset));
  left: 2px;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.past-month-frame-label.is-right {
  top: calc(50% + var(--past-month-label-offset));
  right: 2px;
  transform: translate(50%, -50%) rotate(90deg);
}

/* Mois passé sans données : contenu visible mais grisé, bande diagonale par-dessus. */
html.is-empty-month-view #panel-home,
html.is-empty-month-view #panel-moves,
html.is-empty-month-view #panel-budget,
html.is-empty-month-view #panel-more {
  opacity: 0.38;
  filter: grayscale(0.55);
  pointer-events: none;
}

html.is-empty-month-view #moves-add-btn,
html.is-empty-month-view #budget-add-btn,
html.is-empty-month-view #open-shop-calc-btn,
html.is-empty-month-view #open-moves-chart-btn,
html.is-empty-month-view .tab-fab {
  visibility: hidden !important;
  pointer-events: none !important;
}

.empty-month-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--stage-bottom);
  z-index: 80;
  pointer-events: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: transparent;
}

.empty-month-banner[hidden] {
  display: none !important;
}

.empty-month-banner-band {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 160%;
  margin: 0;
  padding: 14px 24px;
  transform: translate(-50%, -50%) rotate(-45deg);
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d41818;
  background: rgba(255, 252, 247, 0.88);
  border-top: 2.5px solid rgba(212, 24, 24, 0.85);
  border-bottom: 2.5px solid rgba(212, 24, 24, 0.85);
}

html[data-theme="dark"] .empty-month-banner-band {
  color: #ff6b6b;
  background: rgba(12, 22, 32, 0.88);
  border-top-color: rgba(255, 107, 107, 0.9);
  border-bottom-color: rgba(255, 107, 107, 0.9);
}

@keyframes past-month-blink {
  0%,
  49% {
    color: #d41818;
  }
  50%,
  100% {
    color: transparent;
  }
}

@keyframes next-month-blink {
  0%,
  49% {
    color: #2a7a4b;
  }
  50%,
  100% {
    color: transparent;
  }
}

.top-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding:
    max(var(--safe-top), calc(var(--content-inset) + var(--header-drop) - 20px))
    calc(var(--content-inset) + var(--safe-right))
    10px
    calc(var(--content-inset) + var(--safe-left));
  box-sizing: border-box;
  width: 100%;
}

.top-bar-left {
  min-width: 0;
  justify-self: start;
  display: flex;
  align-items: center;
  min-height: 44px;
}

.top-bar-center {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
}

.top-bar-right {
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-height: 44px;
}

.brand {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.06em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.top-bar-sub {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--navy);
  overflow-wrap: anywhere;
  text-align: right;
}

.top-bar-sub.is-capitalized {
  text-transform: capitalize;
}

.top-bar-sub[hidden] {
  display: none !important;
}

.top-bar-owner {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--navy);
  overflow-wrap: anywhere;
  text-align: center;
}

.top-bar-owner[hidden] {
  display: none !important;
}

.view-month-picker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin: 0;
  z-index: 40;
}

.view-month-picker[hidden] {
  display: none !important;
}

.top-bar-cal-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--navy);
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.top-bar-cal-btn:active {
  background: rgba(15, 42, 61, 0.08);
}

.top-bar-cal-btn[aria-expanded="true"] {
  background: rgba(15, 42, 61, 0.08);
}

.top-bar-cal-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.view-month-fields {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(15, 42, 61, 0.12);
  background: rgba(255, 252, 247, 0.98);
  box-shadow:
    0 10px 28px rgba(10, 31, 46, 0.18),
    0 2px 6px rgba(10, 31, 46, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.view-month-fields[hidden] {
  display: none !important;
}

.view-month-select {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: rgba(255, 252, 247, 0.95);
  color: var(--navy);
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 6.5rem;
  max-width: 8rem;
  text-transform: capitalize;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.view-month-select.view-year-select {
  min-width: 4.6rem;
  max-width: 5.2rem;
  text-transform: none;
}

.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;
}

.shop-composer {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr) 36px;
  gap: 8px;
  align-items: stretch;
  margin: 4px 0 0;
  padding: 8px;
  border: 1px solid rgba(15, 42, 61, 0.12);
  border-radius: var(--radius);
  background: rgba(15, 42, 61, 0.03);
  box-sizing: border-box;
}

.shop-composer-field {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin: 0;
}

.shop-composer-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.shop-composer-input {
  width: 100%;
  min-width: 0;
  height: 36px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid rgba(15, 42, 61, 0.14);
  border-radius: calc(var(--radius) - 2px);
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.shop-composer-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(47, 122, 184, 0.25);
}

.shop-calc-live {
  margin: 10px 0 0;
  min-height: 1.35em;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
}

.shop-add-btn {
  align-self: end;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: var(--navy);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.shop-cart {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.shop-cart-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.shop-cart-swipe {
  margin-bottom: 0;
  border-radius: var(--radius);
}

.shop-cart-row.swipe-content {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  border: 1px solid rgba(15, 42, 61, 0.1);
  border-radius: var(--radius);
  border-bottom: 1px solid rgba(15, 42, 61, 0.1);
  font-size: 0.95rem;
  background: #fffdf9;
}

.shop-cart-row.is-editing {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(47, 122, 184, 0.2);
}

.shop-cart-meta {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(15, 42, 61, 0.08);
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.shop-cart-spacer {
  min-width: 0;
}

.shop-cart-amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  text-align: right;
  font-size: 1rem;
}

.shop-limit-field {
  display: grid;
  gap: 4px;
  margin: 28px 0 12px;
}

.shop-summary {
  margin-top: 12px;
  padding: 0 12px;
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.shop-calc-total {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.shop-limit-status {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.shop-limit-status.is-over {
  color: #b42318;
}

.shop-limit-status[hidden] {
  display: none !important;
}

.panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
}

.panel {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
}

.panel.is-active {
  display: flex;
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding: 8px var(--content-inset) 20px;
}

#panel-home .panel-scroll,
#panel-moves .panel-scroll,
#panel-budget .panel-scroll,
#panel-more .panel-scroll {
  padding-left: var(--content-inset);
  padding-right: var(--content-inset);
}

#panel-moves .panel-scroll,
#panel-budget .panel-scroll {
  padding-bottom: 72px;
}

/* Texte des onglets : reste dans les marges */
.panel-scroll > *,
.balances,
.budget-item,
.item-swipe-wrap,
.settings-card,
.forecast-line,
.section-label,
.empty-state,
.chart-block {
  max-width: 100%;
  box-sizing: border-box;
}

/* ——— Graphiques ——— */
.chart-block {
  margin: 18px 0 8px;
}

.chart-title {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.chart-donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.chart-donut-wrap svg {
  width: 178px;
  height: 178px;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.chart-pct-label {
  paint-order: stroke fill;
  stroke: var(--chart-pct-halo);
  stroke-width: 3px;
}

.chart-legend {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.chart-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--ink);
  padding: 10px 12px 10px 10px;
  border-left: 5px solid var(--cat-color, var(--navy));
  border-radius: 0 var(--radius) var(--radius) 0;
  box-sizing: border-box;
  background: rgba(15, 42, 61, 0.04);
}

.chart-legend-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.chart-legend-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: var(--ink);
}

.chart-legend-pct {
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  color: var(--muted);
}

/* Tons catégorie bien séparés (CSP : pas de style="") */
.cat-tone-0 { --cat-color: #1E88E5; }
.cat-tone-1 { --cat-color: #FB8C00; }
.cat-tone-2 { --cat-color: #F9A825; }
.cat-tone-3 { --cat-color: #43A047; }
.cat-tone-4 { --cat-color: #E53935; }
.cat-tone-5 { --cat-color: #00ACC1; }
.cat-tone-6 { --cat-color: #D81B60; }
.cat-tone-7 { --cat-color: #8E24AA; }
.cat-tone-8 { --cat-color: #7CB342; }
.cat-tone-9 { --cat-color: #5E35B1; }
.cat-tone-10 { --cat-color: #FF7043; }
.cat-tone-11 { --cat-color: #3949AB; }
.cat-tone-12 { --cat-color: #6D4C41; }
.cat-tone-13 { --cat-color: #039BE5; }
.cat-tone-14 { --cat-color: #C0CA33; }
.cat-tone-15 { --cat-color: #EC407A; }
.cat-tone-16 { --cat-color: #00897B; }
.cat-tone-17 { --cat-color: #AD1457; }
.cat-tone-18 { --cat-color: #FF6F00; }
.cat-tone-19 { --cat-color: #2E7D32; }
.cat-tone-20 { --cat-color: #6A1B9A; }
.cat-tone-21 { --cat-color: #00838F; }
.cat-tone-22 { --cat-color: #C62828; }
.cat-tone-23 { --cat-color: #1565C0; }
.cat-tone-24 { --cat-color: #F57F17; }
.cat-tone-25 { --cat-color: #4E342E; }
.cat-tone-26 { --cat-color: #00695C; }
.cat-tone-27 { --cat-color: #E65100; }
.cat-tone-28 { --cat-color: #4527A0; }
.cat-tone-29 { --cat-color: #558B2F; }
.cat-tone-30 { --cat-color: #0277BD; }
.cat-tone-31 { --cat-color: #D84315; }
.cat-tone-32 { --cat-color: #283593; }
.cat-tone-33 { --cat-color: #9E9D24; }
.cat-tone-34 { --cat-color: #880E4F; }
.cat-tone-35 { --cat-color: #EF6C00; }

/* Tons plus clairs en thème sombre (lisible sur fond sombre) */
html[data-theme="dark"] .cat-tone-0 { --cat-color: #64B5F6; }
html[data-theme="dark"] .cat-tone-1 { --cat-color: #FFB74D; }
html[data-theme="dark"] .cat-tone-2 { --cat-color: #FFD54F; }
html[data-theme="dark"] .cat-tone-3 { --cat-color: #81C784; }
html[data-theme="dark"] .cat-tone-4 { --cat-color: #EF5350; }
html[data-theme="dark"] .cat-tone-5 { --cat-color: #4DD0E1; }
html[data-theme="dark"] .cat-tone-6 { --cat-color: #F06292; }
html[data-theme="dark"] .cat-tone-7 { --cat-color: #BA68C8; }
html[data-theme="dark"] .cat-tone-8 { --cat-color: #AED581; }
html[data-theme="dark"] .cat-tone-9 { --cat-color: #9575CD; }
html[data-theme="dark"] .cat-tone-10 { --cat-color: #FF8A65; }
html[data-theme="dark"] .cat-tone-11 { --cat-color: #7986CB; }
html[data-theme="dark"] .cat-tone-12 { --cat-color: #A1887F; }
html[data-theme="dark"] .cat-tone-13 { --cat-color: #4FC3F7; }
html[data-theme="dark"] .cat-tone-14 { --cat-color: #DCE775; }
html[data-theme="dark"] .cat-tone-15 { --cat-color: #F48FB1; }
html[data-theme="dark"] .cat-tone-16 { --cat-color: #4DB6AC; }
html[data-theme="dark"] .cat-tone-17 { --cat-color: #CE93D8; }
html[data-theme="dark"] .cat-tone-18 { --cat-color: #FFA726; }
html[data-theme="dark"] .cat-tone-19 { --cat-color: #66BB6A; }
html[data-theme="dark"] .cat-tone-20 { --cat-color: #AB47BC; }
html[data-theme="dark"] .cat-tone-21 { --cat-color: #26A69A; }
html[data-theme="dark"] .cat-tone-22 { --cat-color: #E57373; }
html[data-theme="dark"] .cat-tone-23 { --cat-color: #42A5F5; }
html[data-theme="dark"] .cat-tone-24 { --cat-color: #FFCA28; }
html[data-theme="dark"] .cat-tone-25 { --cat-color: #8D6E63; }
html[data-theme="dark"] .cat-tone-26 { --cat-color: #80CBC4; }
html[data-theme="dark"] .cat-tone-27 { --cat-color: #FFAB91; }
html[data-theme="dark"] .cat-tone-28 { --cat-color: #7E57C2; }
html[data-theme="dark"] .cat-tone-29 { --cat-color: #9CCC65; }
html[data-theme="dark"] .cat-tone-30 { --cat-color: #29B6F6; }
html[data-theme="dark"] .cat-tone-31 { --cat-color: #FF8A50; }
html[data-theme="dark"] .cat-tone-32 { --cat-color: #5C6BC0; }
html[data-theme="dark"] .cat-tone-33 { --cat-color: #D4E157; }
html[data-theme="dark"] .cat-tone-34 { --cat-color: #FF80AB; }
html[data-theme="dark"] .cat-tone-35 { --cat-color: #FFA000; }

.chart-donut-wrap circle[class*="cat-tone-"] {
  stroke: var(--cat-color);
}

.chart-donut-wrap text[class*="cat-tone-"] {
  fill: var(--cat-color);
}

.chart-legend-val {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
  flex-shrink: 0;
}

#moves-chart.chart-block {
  margin: 10px 0 6px;
}

#panel-moves.is-moves-chart .moves-panel-scroll {
  padding-top: 14px;
  padding-bottom: calc(var(--stage-bottom) + 72px);
}

#panel-moves.is-moves-chart #moves-chart.chart-block {
  margin: 4px 0 0;
  padding: 4px 0 8px;
}

#panel-moves.is-moves-chart .moves-chart-head {
  margin: 0 0 14px;
}

#panel-moves.is-moves-chart .moves-chart-head .chart-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--navy);
  text-transform: none;
}

#panel-moves.is-moves-chart .chart-moves-total {
  font-size: 1.15rem;
}

#panel-moves.is-moves-chart .moves-combo-wrap {
  gap: 16px;
}

#panel-moves.is-moves-chart .moves-combo-svg {
  border-radius: 12px;
  padding: 6px 2px 2px;
  box-sizing: border-box;
}

#panel-moves.is-moves-chart .moves-combo-rows {
  gap: 6px;
}

#panel-moves.is-moves-chart .moves-combo-row {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px 12px;
  padding: 10px 12px;
  font-size: 0.95rem;
  border-radius: 0;
  background: transparent;
  border: none;
  border-top: 2.5px solid var(--cat-color, var(--navy));
  border-bottom: 2.5px solid var(--cat-color, var(--navy));
}

#panel-moves.is-moves-chart .moves-combo-pct {
  font-size: 0.88rem;
  color: var(--ink);
}

#panel-moves.is-moves-chart .moves-combo-amt {
  font-size: 1rem;
}

#moves-chart.chart-block[hidden],
#moves-chart.chart-block:empty {
  display: none;
  margin: 0;
}

.moves-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 6px;
}

.moves-chart-head .chart-title {
  margin: 0;
}

.chart-moves-total {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink);
  flex: 0 0 auto;
}

.chart-moves-total strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chart-moves-total .is-negative {
  color: var(--danger);
}

.moves-combo-wrap {
  display: grid;
  gap: 6px;
}

.moves-combo-svg {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
  border-radius: 8px;
}

.moves-combo-rows {
  display: grid;
  gap: 2px;
}

.moves-combo-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  gap: 6px 8px;
  padding: 3px 0;
  font-size: 0.8rem;
  min-width: 0;
}

.moves-combo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat-color, var(--navy));
  flex-shrink: 0;
}

.moves-combo-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  justify-self: start;
}

.moves-combo-pct {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  text-align: center;
  justify-self: center;
}

.moves-combo-amt {
  color: var(--navy);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
  justify-self: end;
}

html[data-theme="dark"] .moves-combo-svg {
  background: rgba(18, 30, 39, 0.65);
}

html[data-theme="dark"] .moves-combo-amt {
  color: #e8eef2;
}

/* Légende graphe : mêmes hex que CHART_COLORS / barres SVG (pas les pastels dark) */
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-0 { --cat-color: #1E88E5; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-1 { --cat-color: #FB8C00; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-2 { --cat-color: #F9A825; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-3 { --cat-color: #43A047; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-4 { --cat-color: #E53935; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-5 { --cat-color: #00ACC1; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-6 { --cat-color: #D81B60; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-7 { --cat-color: #8E24AA; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-8 { --cat-color: #7CB342; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-9 { --cat-color: #5E35B1; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-10 { --cat-color: #FF7043; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-11 { --cat-color: #3949AB; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-12 { --cat-color: #6D4C41; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-13 { --cat-color: #039BE5; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-14 { --cat-color: #C0CA33; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-15 { --cat-color: #EC407A; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-16 { --cat-color: #00897B; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-17 { --cat-color: #AD1457; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-18 { --cat-color: #FF6F00; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-19 { --cat-color: #2E7D32; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-20 { --cat-color: #6A1B9A; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-21 { --cat-color: #00838F; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-22 { --cat-color: #C62828; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-23 { --cat-color: #1565C0; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-24 { --cat-color: #F57F17; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-25 { --cat-color: #4E342E; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-26 { --cat-color: #00695C; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-27 { --cat-color: #E65100; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-28 { --cat-color: #4527A0; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-29 { --cat-color: #558B2F; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-30 { --cat-color: #0277BD; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-31 { --cat-color: #D84315; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-32 { --cat-color: #283593; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-33 { --cat-color: #9E9D24; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-34 { --cat-color: #880E4F; }
html[data-theme="dark"] #panel-moves.is-moves-chart .cat-tone-35 { --cat-color: #EF6C00; }

html[data-theme="dark"] #panel-moves.is-moves-chart .moves-combo-row {
  background: transparent;
  border-color: var(--cat-color, #8eb4c8);
}

html[data-theme="dark"] #panel-moves.is-moves-chart .moves-chart-head .chart-title {
  color: #e8eef2;
}

.chart-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.chart-compare-item {
  min-width: 0;
}

.chart-compare-label {
  margin: 0 0 4px;
  font-size: 0.78rem;
  color: var(--muted);
}

.chart-compare-value {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

.chart-compare-track {
  height: 6px;
  background: rgba(15, 42, 61, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.chart-compare-track > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--blue);
}

.chart-compare-track.is-income > span {
  background: var(--gold);
}

.chart-compare-track.is-expense > span {
  background: var(--navy);
}

.chart-month-net {
  margin: 12px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
}

.forecast-line,
.fixed-line,
.section-label,
.empty-state,
.balance-label,
.balance-value,
.budget-row-top,
.move-title,
.move-meta,
.ios-row {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.fixed-line {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.fixed-line-total {
  margin: 0 0 10px;
}

.home-fixed-list {
  display: grid;
  gap: 2px;
}

.home-fixed-list .fixed-item-wrap {
  margin-bottom: 0;
}

.home-fixed-list .budget-item.fixed-item,
.fixed-list .swipe-content.budget-item.fixed-item {
  position: relative;
  margin: 0 0 2px;
  padding: 15px 4px;
  background: transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  min-height: 54px;
  box-sizing: border-box;
  width: 100%;
  border: none;
  border-radius: 12px;
}

.fixed-list .swipe-content.budget-item.fixed-item {
  margin: 0;
  padding: 15px 14px;
  border-radius: 0;
}

.home-fixed-list .budget-item.fixed-item.is-done,
.fixed-list .swipe-content.budget-item.fixed-item.is-done {
  padding-right: 28px;
}

.fixed-list .swipe-content.budget-item.fixed-item.is-done {
  padding-right: 36px;
}

.fixed-item-col-left {
  min-width: 0;
  justify-self: start;
  text-align: left;
}

.fixed-item-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  text-align: left;
}

.fixed-item-sub {
  margin: 2px 0 0;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.fixed-item-day {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
  justify-self: center;
  width: 100%;
}

.fixed-item-mid-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  justify-self: end;
  width: 100%;
  text-align: right;
}

.fixed-item-check {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0 12px 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--ok);
}

.fixed-list .fixed-item-check {
  border-radius: 0 0 0 8px;
}

.fixed-list .fixed-item-wrap:first-of-type .fixed-item-check {
  border-radius: 0 var(--radius) 0 8px;
}

.fixed-cat-head {
  margin: 10px 0 4px;
  padding: 0 14px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.fixed-list > .fixed-cat-head:first-child {
  margin-top: 8px;
}

.home-fixed-list .fixed-cat-head {
  padding: 0 4px;
  margin-top: 12px;
}

.home-fixed-list > .fixed-cat-head:first-child {
  margin-top: 2px;
}

.home-fixed-list:has(.fixed-cat-group) {
  gap: 0;
}

.home-fixed-list .fixed-cat-group {
  margin-bottom: 34px;
}

.home-fixed-list .fixed-cat-group:last-child {
  margin-bottom: 0;
}

.home-fixed-list .moves-cat-head {
  padding-left: 4px;
  padding-right: 4px;
}

.fixed-list .fixed-cat-group {
  margin-bottom: 34px;
}

.fixed-list .fixed-cat-group:last-child {
  margin-bottom: 0;
}

.fixed-list .moves-cat-head {
  padding-left: 14px;
  padding-right: 14px;
}

.home-fixed-amount {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  text-align: right;
  flex-shrink: 0;
}

.home-fixed-amount.expense,
.fixed-list .home-fixed-amount.expense,
#fixed-edit-preview .move-amount.expense {
  color: var(--danger);
}

.home-fixed-amount.income,
.fixed-list .home-fixed-amount.income,
#fixed-edit-preview .move-amount.income {
  color: var(--ok);
}

#fixed-checking-line,
#home-fixed-total {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

#fixed-checking-line .is-negative,
#home-fixed-total .is-negative {
  color: var(--danger);
}

#fixed-checking-line .is-positive,
#home-fixed-total .is-positive {
  color: var(--ok);
}

#fixed-checking-line .fixed-total-line,
#home-fixed-total .fixed-total-line {
  display: block;
  line-height: 1.35;
}

/* Liste montants fixes — même lecture que Mouvements (groupes + traits entre lignes) */
.fixed-list {
  margin: 8px 0 4px;
  display: grid;
  gap: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}

.fixed-list:empty {
  display: none;
}

.fixed-list:has(.panel-empty) {
  border: none;
  background: transparent;
  padding: 0;
}

.fixed-list .fixed-item-wrap {
  margin: 0;
  width: 100%;
}

.fixed-list .fixed-item-wrap .swipe-content.budget-item.fixed-item {
  border-bottom: 1px solid var(--line);
}

.fixed-list .fixed-item-wrap:last-child .swipe-content.budget-item.fixed-item,
.fixed-list .fixed-cat-group .fixed-item-wrap:last-child .swipe-content.budget-item.fixed-item {
  border-bottom: none;
}

.fixed-item-wrap .swipe-actions-left,
.fixed-item-wrap .swipe-actions-right,
.move-item-wrap .swipe-actions-left,
.move-item-wrap .swipe-actions-right,
.budget-item-wrap .swipe-actions-left,
.budget-item-wrap .swipe-actions-right,
.savings-goal-item-wrap .swipe-actions-left,
.savings-goal-item-wrap .swipe-actions-right {
  top: 0;
  bottom: 0;
  width: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

.fixed-item-wrap .swipe-actions-right,
.move-item-wrap .swipe-actions-right,
.budget-item-wrap .swipe-actions-right,
.savings-goal-item-wrap .swipe-actions-right {
  left: auto;
  right: 0;
}

.fixed-item-wrap .swipe-actions-left,
.move-item-wrap .swipe-actions-left,
.budget-item-wrap .swipe-actions-left,
.savings-goal-item-wrap .swipe-actions-left {
  left: 0;
  right: auto;
}

.fixed-list .fixed-item-wrap.is-editing > .swipe-content.budget-item.fixed-item {
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  padding-top: 15px;
  padding-bottom: 15px;
}

.fixed-form-dock {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 2px 0;
  border-top: 1px solid var(--line);
  background: transparent;
  max-height: min(42vh, 320px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.fixed-form-dock[hidden] {
  display: none !important;
}

.fixed-form-dock .section-label {
  margin-top: 4px;
}

/* Bouton + montants fixes (même logique que Mouvements) */
.fixed-fab-add {
  /* Au-dessus de la barre Fermer du modal plein écran */
  bottom: calc(var(--safe-bottom) + 78px);
  z-index: 260;
}

.fixed-fab-add[hidden] {
  display: none !important;
}

#fixed-modal[hidden] .fixed-fab-add,
#fixed-modal.is-fixed-compose .fixed-fab-add {
  display: none !important;
}

.fixed-modal-actions {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  transform: translateY(20px);
}

.fixed-modal-actions .modal-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-top: 0;
  min-height: 48px;
}

#fixed-modal:not(.is-fixed-compose) .fixed-form-dock:not([hidden]) {
  margin-top: auto;
}

#fixed-modal:not(.is-fixed-compose) .fixed-form-dock:not([hidden]) ~ .fixed-modal-actions {
  margin-top: 0;
}

#fixed-modal:not(.is-fixed-compose) .fixed-form-dock[hidden] ~ .fixed-modal-actions {
  margin-top: auto;
}

/* Même barre d’actions que l’édition d’un mouvement */
#fixed-modal.is-fixed-compose .fixed-modal-actions {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  bottom: calc(var(--content-inset) + 8px + var(--safe-bottom));
  z-index: 430;
  order: 3;
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  padding-top: 12px;
  transform: none;
}

#fixed-modal.is-fixed-compose .fixed-modal-actions .modal-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-top: 0;
  min-height: 48px;
}

#fixed-modal.is-fixed-compose .fixed-modal-actions .modal-btn-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 252, 247, 0.7);
}

.fixed-item-wrap.is-editing > .swipe-content {
  outline: none;
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  border-left: none;
  border-right: none;
  border-radius: 0;
}

#fixed-modal.is-fixed-compose .modal-card.modal-page-card {
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  padding-top: calc(var(--content-inset) + var(--header-drop) + 100px) !important;
  padding-bottom: calc(var(--content-inset) + 8px + var(--safe-bottom) + 68px) !important;
}

#fixed-modal.is-fixed-compose.is-fixed-focus .modal-card.modal-page-card {
  padding-top: calc(var(--content-inset) + var(--header-drop)) !important;
}

#fixed-modal.is-fixed-compose.is-fixed-focus .fixed-edit-heading:not([hidden]) {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  z-index: auto;
  margin: 0;
}

.fixed-edit-heading {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--navy);
}

.fixed-edit-heading[hidden] {
  display: none !important;
}

#fixed-modal.is-fixed-compose .fixed-edit-heading:not([hidden]) {
  display: block !important;
  position: absolute;
  top: max(var(--safe-top), calc(var(--content-inset) + var(--header-drop) - 20px));
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  z-index: 5;
  margin: 0;
}

/* Nouvelle dépense : champs centrés, liste masquée */
#fixed-modal.is-fixed-compose:not(.is-fixed-focus) .fixed-modal-scroll {
  display: none !important;
}

#fixed-modal.is-fixed-compose:not(.is-fixed-focus),
#fixed-modal.is-fixed-compose:not(.is-fixed-focus) > .modal-card.modal-page-card {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
}

#fixed-modal.is-fixed-compose:not(.is-fixed-focus) .fixed-form-dock {
  order: 2;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 10px;
  border-top: none;
  margin: 0;
  padding: 0 2px;
  max-height: none;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
}

#fixed-modal.is-fixed-compose:not(.is-fixed-focus) #fixed-form {
  /* champs centrés (plus de .fixed-form-scroll) */
  touch-action: pan-y;
}

#fixed-modal.is-fixed-compose:not(.is-fixed-focus) .fixed-modal-actions,
#fixed-modal.is-fixed-compose:not(.is-fixed-focus) .fixed-edit-heading {
  touch-action: none;
}

/* Clavier : titre (+ ligne à modifier) et boutons restent ; seuls les paragraphes défilent */
html.keyboard-open #fixed-modal.is-fixed-compose:not(.is-fixed-focus):not([hidden]):not(.is-kb-docked) .fixed-form-dock {
  position: absolute;
  top: var(--fixed-kb-form-top, calc(var(--content-inset) + var(--header-drop) + 20px));
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  bottom: calc(var(--keyboard-inset) + var(--content-inset) + 8px + var(--safe-bottom) + 68px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0 2px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 4;
}

/* Montant fixe (nouveau + modifier) au clic : #fixed-form docké au-dessus du clavier */
html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked:not([hidden]),
html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked:not([hidden]) > .modal-card.modal-page-card {
  overflow: hidden !important;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-fixed-focus.is-kb-docked .fixed-edit-heading:not([hidden]),
html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked #fixed-form-label,
html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .fixed-modal-scroll {
  display: none !important;
}

/* Nouvelle dépense fixe : titre inchangé au clic (même place qu’hors clavier) */
html.keyboard-open #fixed-modal.is-fixed-compose:not(.is-fixed-focus).is-kb-docked .fixed-edit-heading:not([hidden]) {
  display: block !important;
  position: absolute;
  top: max(var(--safe-top), calc(var(--content-inset) + var(--header-drop) - 20px));
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  z-index: 225;
  margin: 0;
  transform: none;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked #fixed-form {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  top: var(--safe-top);
  bottom: var(--keyboard-inset);
  z-index: 220;
  display: flex !important;
  flex-direction: column;
  justify-content: flex-end;
  gap: 13px;
  margin: 0;
  padding: 15px 2px 10px;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
  background: transparent;
  border-top: none;
  max-height: none;
  transform: translateY(5px);
}

/* Nouvelle dépense / revenu fixe : pas de léger décalage au clic */
html.keyboard-open #fixed-modal.is-fixed-compose:not(.is-fixed-focus).is-kb-docked #fixed-form {
  transform: none;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-fixed-focus.is-kb-docked #fixed-edit-preview:not([hidden]) {
  display: block;
  margin-top: 0;
  padding-top: 3px;
  zoom: 1.352;
  overflow: visible;
  flex: 0 0 auto;
  transform: translateY(-35px);
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-fixed-focus.is-kb-docked #fixed-edit-preview .tx-edit-preview-row {
  border-top: 2px solid var(--gold, #b08d3e);
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked #fixed-type {
  display: none !important;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-amount-card,
html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-field-card {
  margin-top: 0;
  flex: 0 0 auto;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-amount-card {
  zoom: 1.69;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  row-gap: 8px;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-amount-label {
  margin: 0;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-amount-row {
  grid-column: 2;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-type-toggle {
  grid-column: 1 / -1;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-field-card {
  zoom: 1.4365;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  row-gap: 8px;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-field-card .field-label {
  margin: 0;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-field-card .modal-select,
html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked .tx-field-card .modal-input {
  grid-column: 2;
  min-width: 0;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-fixed-focus.is-kb-docked.is-fixed-detail-focus #fixed-edit-preview:not([hidden]) {
  zoom: 0.343429632;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked.is-fixed-detail-focus .tx-amount-card {
  zoom: 0.681408;
}

html.keyboard-open #fixed-modal.is-fixed-compose.is-kb-docked.is-fixed-detail-focus .tx-field-card {
  zoom: 1.03428;
}

/* Modifier : ligne + champs dans #fixed-form (comme édition mouvement) */
#fixed-modal.is-fixed-compose.is-fixed-focus,
#fixed-modal.is-fixed-compose.is-fixed-focus > .modal-card.modal-page-card {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
}

#fixed-modal.is-fixed-focus .fixed-modal-scroll {
  display: none !important;
}

#fixed-modal.is-fixed-focus .fixed-form-dock,
#fixed-modal.is-fixed-focus #fixed-form {
  order: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  border-top: none;
  border-bottom: none;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  max-height: none;
  overflow: hidden;
  touch-action: none;
}

#fixed-modal.is-fixed-focus .fixed-edit-heading,
#fixed-modal.is-fixed-focus .fixed-modal-actions {
  touch-action: none;
}

#fixed-modal.is-fixed-focus .tx-amount-card,
#fixed-modal.is-fixed-focus .tx-field-card {
  transform: none;
  zoom: 1;
  padding: 10px 14px 10px;
}

#fixed-modal.is-fixed-focus .tx-amount-card {
  margin-top: 28px;
}

#fixed-modal.is-fixed-focus .tx-field-card {
  margin-top: 20px;
}

#fixed-modal.is-fixed-focus .tx-amount-label {
  margin: 0 0 4px;
}

#fixed-modal.is-fixed-focus .tx-field-card .field-label {
  margin: 8px 0 4px;
}

#fixed-modal.is-fixed-focus .tx-field-card > .field-label:first-child {
  margin-top: 0;
}

#fixed-modal.is-fixed-focus #fixed-form-label {
  display: none !important;
}

#fixed-modal.is-fixed-focus #fixed-edit-preview:not([hidden]) {
  display: block;
  flex: 0 0 auto;
  margin-top: calc(80px - 1.5rem * 1.15);
  margin-bottom: 0;
  zoom: 0.8;
  overflow: visible;
}

#fixed-modal.is-fixed-compose .fixed-modal-header,
#fixed-modal.is-fixed-compose #fixed-modal-title,
#fixed-modal.is-fixed-compose #fixed-filters {
  display: none !important;
}

#fixed-modal.is-fixed-compose #fixed-form-label[hidden] {
  display: none !important;
}

/* ——— Édition inline (mouvements + objectif) = mêmes positions que dépenses fixes ——— */
.moves-edit-heading {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--navy);
}

.moves-edit-heading[hidden],
.moves-edit-form[hidden],
.moves-edit-actions[hidden],
.objectif-edit-form[hidden] {
  display: none !important;
}

html.is-moves-edit .top-bar,
html.is-objectif-edit .top-bar {
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  pointer-events: none !important;
  border: 0 !important;
}

html.is-moves-edit #main-tab-bar,
html.is-objectif-edit #main-tab-bar {
  visibility: hidden !important;
  pointer-events: none !important;
}

html.is-moves-edit .app,
html.is-objectif-edit .app {
  padding-bottom: 0 !important;
}

#panel-moves.is-moves-edit,
#panel-budget.is-objectif-edit {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  padding-top: calc(var(--content-inset) + var(--header-drop) + 100px) !important;
  padding-right: calc(var(--content-inset) + var(--safe-right)) !important;
  padding-bottom: calc(var(--content-inset) + 8px + var(--safe-bottom)) !important;
  padding-left: calc(var(--content-inset) + var(--safe-left)) !important;
  box-sizing: border-box !important;
}

#panel-budget.is-objectif-edit {
  padding-bottom: calc(var(--content-inset) + 8px + var(--safe-bottom) + 68px) !important;
}

html.is-objectif-edit .panels,
#panel-budget.is-objectif-edit.is-objectif-budget-edit {
  overflow: visible;
}

#panel-budget.is-objectif-edit.is-objectif-budget-edit {
  padding-top: calc(var(--content-inset) + var(--header-drop) + 60px) !important;
  overflow: visible !important;
}

#panel-budget.is-objectif-edit.is-objectif-budget-edit .objectif-edit-form.tx-compose:not([hidden]) {
  justify-content: flex-start;
  transform: none;
  margin-top: 28px;
  flex: 0 0 auto;
  min-height: auto;
  max-height: none;
  overflow: visible !important;
}

#panel-budget.is-objectif-edit.is-objectif-budget-edit .objectif-edit-form.tx-compose .tx-field-card {
  margin-top: 20px;
}

#panel-budget.is-objectif-edit.is-objectif-budget-edit .objectif-edit-scroll {
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}

#panel-budget.is-objectif-edit.is-objectif-budget-edit .tx-amount-card,
#panel-budget.is-objectif-edit.is-objectif-budget-edit .tx-field-card {
  zoom: 1;
}

#panel-moves.is-moves-edit .moves-edit-heading:not([hidden]),
#panel-budget.is-objectif-edit .moves-edit-heading:not([hidden]) {
  display: block !important;
  position: absolute;
  top: max(var(--safe-top), calc(var(--content-inset) + var(--header-drop) - 20px));
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  z-index: 5;
  margin: 0;
}

#panel-budget.is-objectif-edit .moves-edit-heading:not([hidden]) {
  position: fixed;
  z-index: 240;
}

#panel-moves.is-moves-edit .moves-panel-scroll,
#panel-budget.is-objectif-edit .budget-panel-scroll {
  order: 1;
  flex: 0 0 auto;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 0;
  padding: 0 2px !important;
}

#panel-moves.is-moves-chart .moves-filters,
#panel-moves.is-moves-chart #moves-list {
  display: none !important;
}

.moves-chart-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--stage-bottom) + 8px);
  z-index: 105;
  flex-shrink: 0;
  margin: 0;
  padding: 0 calc(var(--content-inset) + var(--safe-right)) 0 calc(var(--content-inset) + var(--safe-left));
  background: transparent;
  border: none;
  box-sizing: border-box;
}

.moves-chart-actions .modal-btn {
  width: 100%;
  min-height: 48px;
}

.moves-chart-actions[hidden] {
  display: none !important;
}

#panel-moves.is-moves-edit #moves-chart,
#panel-moves.is-moves-edit .moves-filters,
#panel-moves.is-moves-edit .moves-chart-actions {
  display: none !important;
}

#panel-budget.is-objectif-edit .budget-section-block .home-block-header,
#panel-budget.is-objectif-edit .budget-savings-goal-block .home-block-header,
#panel-budget.is-objectif-edit .budget-tab-summary,
#panel-budget.is-objectif-edit.is-objectif-budget-edit .budget-savings-goal-block,
#panel-budget.is-objectif-edit.is-objectif-savings-edit .budget-section-block {
  display: none !important;
}

#panel-budget.is-objectif-edit .budget-section-block,
#panel-budget.is-objectif-edit .budget-savings-goal-block {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

#panel-moves.is-moves-edit #moves-list {
  margin: 0;
}

#panel-moves.is-moves-edit .moves-edit-form:not([hidden]),
#panel-budget.is-objectif-edit .objectif-edit-form:not([hidden]) {
  order: 2;
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  border-top: 1px solid var(--line);
  border-bottom: none;
  padding-top: 10px;
  padding-bottom: 0;
  padding-left: 2px;
  padding-right: 2px;
  margin: 30px 0 0;
  max-height: none;
  overflow: hidden;
  overscroll-behavior: none;
  background: transparent;
}

/* Budget / épargne : cartes resserrées, centrées au milieu de l’écran */
#panel-budget.is-objectif-edit .objectif-edit-form.tx-compose:not([hidden]) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  border-top: none;
  padding-top: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.objectif-edit-scroll {
  display: flex;
  flex-direction: column;
  gap: inherit;
  min-height: 0;
}

.objectif-edit-dock {
  display: contents;
}

#panel-budget.is-objectif-edit .objectif-edit-dock {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
}

html.keyboard-open.is-objectif-edit .panels,
html.keyboard-open #panel-budget.is-objectif-edit.is-objectif-budget-edit.is-kb-docked {
  overflow: hidden !important;
}

html.keyboard-open #panel-budget.is-objectif-edit.is-objectif-budget-edit.is-kb-docked .objectif-edit-dock {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  top: var(--safe-top);
  bottom: var(--keyboard-inset);
  z-index: 220;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
  -webkit-overflow-scrolling: auto;
  padding: 15px 2px 16px;
  background: var(--beige-soft);
}

html.keyboard-open #panel-budget.is-objectif-edit.is-objectif-budget-edit.is-kb-docked .moves-edit-heading:not([hidden]) {
  display: none !important;
}

html.keyboard-open #panel-budget.is-objectif-edit.is-objectif-budget-edit.is-kb-docked .budget-panel-scroll,
html.keyboard-open #panel-budget.is-objectif-edit.is-objectif-budget-edit.is-kb-docked .objectif-edit-form.tx-compose:not([hidden]),
html.keyboard-open #panel-budget.is-objectif-edit.is-objectif-budget-edit.is-kb-docked .objectif-edit-scroll {
  overflow: visible;
  flex: 0 0 auto;
  max-height: none;
}

html.keyboard-open #panel-budget.is-objectif-edit.is-objectif-budget-edit.is-kb-docked .objectif-edit-form.tx-compose:not([hidden]) {
  margin-top: 13px;
  gap: 13px;
}

html.keyboard-open #panel-budget.is-objectif-edit.is-objectif-budget-edit.is-kb-docked .objectif-edit-form.tx-compose .tx-field-card {
  margin-top: 0;
}

#panel-budget.is-objectif-edit .objectif-edit-form.tx-compose .tx-amount-card,
#panel-budget.is-objectif-edit .objectif-edit-form.tx-compose .tx-field-card {
  padding: 10px 14px 10px;
}

#panel-budget.is-objectif-edit .objectif-edit-form.tx-compose .tx-field-card .field-label {
  margin: 8px 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}

#panel-budget.is-objectif-edit .objectif-edit-form.tx-compose .tx-field-card > .field-label:first-child {
  margin-top: 0;
}

#panel-budget.is-objectif-edit .objectif-edit-form.tx-compose .tx-amount-label {
  margin: 0 0 4px;
}

#panel-budget.is-objectif-edit .objectif-edit-form.tx-compose .tx-amount-first {
  font-size: 1.35rem !important;
  padding: 8px 12px;
}

#panel-moves.is-moves-edit .field-label,
#panel-budget.is-objectif-edit .field-label {
  margin: 8px 0 4px;
}

#panel-moves.is-moves-edit .modal-input,
#panel-moves.is-moves-edit .modal-select,
#panel-budget.is-objectif-edit .modal-input,
#panel-budget.is-objectif-edit .modal-select {
  font-size: 1rem;
  padding: 10px 12px;
}

#panel-moves.is-moves-edit .moves-edit-actions:not([hidden]) {
  order: 3;
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  transform: translateY(20px);
}

#panel-budget.is-objectif-edit .moves-edit-actions:not([hidden]) {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  bottom: calc(var(--content-inset) + 8px + var(--safe-bottom));
  z-index: 230;
  order: 3;
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  padding-top: 12px;
  transform: none;
}

#panel-moves.is-moves-edit .moves-edit-actions .modal-btn,
#panel-budget.is-objectif-edit .moves-edit-actions .modal-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-top: 0;
}

#panel-moves.is-moves-edit .moves-edit-actions .modal-btn-secondary,
#panel-budget.is-objectif-edit .moves-edit-actions .modal-btn-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(255, 252, 247, 0.7);
}

#panel-moves.is-moves-edit .move-item-wrap.is-editing,
#panel-budget.is-objectif-edit .budget-item-wrap.is-editing,
#panel-budget.is-objectif-edit .savings-goal-item-wrap.is-editing {
  margin-top: 4px;
}

#panel-moves.is-moves-edit .move-item-wrap.is-editing > .swipe-content,
#panel-budget.is-objectif-edit .budget-item-wrap.is-editing > .swipe-content,
#panel-budget.is-objectif-edit .savings-goal-item-wrap.is-editing > .swipe-content,
.move-item-wrap.is-editing > .swipe-content,
.budget-item-wrap.is-editing > .swipe-content,
.savings-goal-item-wrap.is-editing > .swipe-content {
  outline: none;
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  border-left: none;
  border-right: none;
  border-radius: 0;
}

/* ——— Accueil : blocs séparés ——— */
.home-scroll {
  padding-bottom: 20px;
}

.home-block {
  margin: 0 0 14px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(15, 42, 61, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 252, 247, 0.78);
}

/* Accueil : bordure noire partout, sauf Prévision (or reste dorée) */
#panel-home .home-block {
  border-color: #000;
  border-width: 2px;
}

#panel-home #home-forecast-block {
  border-color: #e0b400;
  border-width: 3.5px;
}

html[data-theme="dark"] #panel-home .home-block {
  border-color: #e8eef2;
}

html[data-theme="dark"] #panel-home #home-forecast-block {
  border-color: #e0b400;
}

.home-block[hidden] {
  display: none !important;
}

.home-collapsible .home-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

#panel-home .panel-scroll {
  overflow-anchor: none;
}

.home-collapsible .home-block-detail,
.home-collapsible .home-block-preview {
  overflow-anchor: none;
}

.home-collapsible .home-block-header .home-block-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.home-collapse-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(15, 42, 61, 0.06);
  color: var(--navy);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.home-collapse-btn:active {
  background: rgba(15, 42, 61, 0.12);
}

.home-collapse-icon {
  width: 18px;
  height: 18px;
  transition: transform 0.18s ease;
}

.home-collapsible.is-expanded .home-collapse-icon {
  transform: rotate(180deg);
}

.home-collapsible.is-collapsed .home-block-detail {
  display: none !important;
}

/* Ouvert : masquer les lignes récap de l’aperçu ; fermé : les remettre. */
.home-collapsible.is-expanded .home-block-preview {
  display: none !important;
}

.home-collapse-summary {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.home-collapse-summary:empty {
  display: none;
}

/* Garde une zone cliquable même si l’aperçu n’a pas encore de texte. */
.home-collapsible.is-collapsed .home-block-preview {
  min-height: 1.2em;
}

.home-collapsible .home-block-preview:empty {
  display: block;
  min-height: 1.2em;
}

#home-forecast-block {
  border-color: #e0b400;
  border-width: 3.5px;
}

/* ——— Récap du mois ——— */
.home-recap-block {
  border-color: rgba(58, 102, 128, 0.28);
  border-width: 1.5px;
  padding: 16px 16px 18px;
}

.home-couple-block {
  border-color: rgba(42, 122, 75, 0.35);
  border-width: 2px;
}

.couple-gauges {
  display: grid;
  gap: 14px;
}

.couple-gauge-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.couple-gauge-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.couple-gauge-amt {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
}

.couple-gauge-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 42, 61, 0.08);
  overflow: hidden;
}

.couple-gauge-track > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #2f7ab8;
  transition: width 0.25s ease;
}

.couple-gauge-partner .couple-gauge-track > span {
  background: #d45a8a;
}

.couple-gauge-pct {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.home-recent-list,
.home-week-cats,
.home-subs-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-recent-item {
  border-bottom: 1px solid rgba(15, 42, 61, 0.08);
}

.home-recent-item:last-child {
  border-bottom: none;
}

.home-recent-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.home-recent-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.home-recent-cat {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}

.home-recent-meta {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
}

.home-recent-amt {
  flex: 0 0 auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.home-recent-amt.expense { color: var(--danger); }
.home-recent-amt.income { color: var(--ok); }

.home-week-total {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.home-week-cat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(15, 42, 61, 0.06);
  font-size: 0.9rem;
}

.home-week-count {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.home-subs-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(15, 42, 61, 0.08);
}

.home-subs-cat {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
}

.home-subs-meta {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.home-subs-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.home-subs-edit,
.home-subs-dismiss {
  padding: 5px 8px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: rgba(255, 252, 247, 0.9);
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

/* ——— Feuille Nouvelle dépense (saisie pro) ——— */
#savings-goal-modal .modal-card.modal-page-card {
  justify-content: flex-start;
  gap: 10px;
}

#tx-sheet.is-tx-edit .modal-card.modal-page-card {
  justify-content: flex-start;
  gap: 6px;
}

#savings-goal-modal.is-savings-edit .modal-card.modal-page-card {
  justify-content: flex-start;
  gap: 6px;
}

#savings-goal-modal.is-savings-edit .tx-sheet-head {
  padding-bottom: 0;
  border-bottom: none;
}

#savings-goal-modal.is-savings-edit #savings-goal-sheet-month {
  display: none !important;
}

#savings-goal-modal.is-savings-edit #savings-goal-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

#savings-goal-modal.is-savings-edit #savings-goal-edit-preview:not([hidden]) {
  margin-top: calc(80px - 1.5rem * 1.15);
  zoom: 0.8;
}

#tx-sheet.is-tx-edit .tx-sheet-actions,
#savings-goal-modal.is-savings-edit .tx-sheet-actions {
  margin-top: auto;
}

#tx-sheet.is-tx-edit .tx-sheet-head {
  padding-bottom: 0;
  border-bottom: none;
}

#tx-sheet.is-tx-edit #tx-sheet-title {
  display: block !important;
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

#tx-sheet.is-tx-edit #tx-sheet-edit-preview:not([hidden]) {
  margin-top: calc(80px - 1.5rem * 1.15);
  zoom: 0.8;
}

#tx-sheet.is-tx-edit .modal-page-body.tx-compose {
  justify-content: flex-start;
  overflow: visible !important;
}

#tx-sheet.is-tx-edit .tx-amount-card,
#tx-sheet.is-tx-edit .tx-field-card {
  padding: 10px 14px 10px;
  transform: none;
  zoom: 1;
}

#tx-sheet.is-tx-edit .tx-amount-card {
  margin-top: 28px;
}

#tx-sheet.is-tx-edit .tx-field-card {
  margin-top: 20px;
}

#tx-sheet.is-tx-edit .tx-amount-label {
  margin: 0 0 4px;
}

#savings-goal-modal.is-savings-edit .tx-amount-card,
#savings-goal-modal.is-savings-edit .tx-field-card {
  padding: 10px 14px 10px;
  transform: none;
  zoom: 1;
}

#savings-goal-modal.is-savings-edit .tx-amount-card {
  margin-top: 28px;
}

#savings-goal-modal.is-savings-edit .tx-field-card {
  margin-top: 20px;
}

#savings-goal-modal.is-savings-edit .tx-amount-label {
  margin: 0 0 4px;
}

#tx-sheet.is-tx-edit .tx-field-card .field-label {
  margin: 8px 0 4px;
}

#savings-goal-modal.is-savings-edit .tx-field-card .field-label {
  margin: 8px 0 4px;
}

#tx-sheet.is-tx-edit .tx-field-card > .field-label:first-child,
#savings-goal-modal.is-savings-edit .tx-field-card > .field-label:first-child {
  margin-top: 0;
}

#tx-sheet #tx-category,
#tx-sheet #tx-new-category,
#tx-sheet #tx-note,
#tx-sheet #tx-date {
  overflow-anchor: none;
}

#budget-sheet .modal-card.modal-page-card {
  justify-content: stretch;
  gap: 0;
}

/* Titre + mois budget : position initiale en haut */
#budget-sheet > .modal-card > .tx-sheet-head {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 2px solid var(--gold, #b08d3e);
  min-width: 0;
  max-width: 100%;
}

#budget-sheet > .modal-card > .tx-sheet-head .sheet-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

#budget-sheet > .modal-card > .tx-sheet-head .modal-hint {
  margin: 6px 0 0;
}

#savings-goal-modal .tx-sheet-body {
  display: contents;
}

/* Budget (modale) : bloc saisie centré, gaps réduits */
#budget-sheet:not([hidden]),
#budget-sheet:not([hidden]) > .modal-card.modal-page-card {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
}

#budget-sheet .modal-page-body.tx-compose {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden !important;
  touch-action: none;
}

#budget-sheet .modal-actions.modal-page-actions,
#budget-sheet > .modal-card > .tx-sheet-head {
  touch-action: none;
}

#budget-sheet .modal-actions.modal-page-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  transform: translateY(20px);
}

#budget-sheet .modal-actions.modal-page-actions .modal-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  margin-top: 0;
  min-height: 48px;
}

.compose-sheet-scroll {
  display: flex;
  flex-direction: column;
  gap: inherit;
  min-height: 0;
}

#budget-sheet .compose-sheet-scroll {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
  -webkit-overflow-scrolling: auto;
}

html.keyboard-open #budget-sheet.is-kb-docked > .modal-card > .tx-sheet-head {
  position: relative;
  z-index: 225;
}

html.keyboard-open #budget-sheet.is-kb-docked .modal-page-body.tx-compose {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  top: var(--safe-top);
  bottom: var(--keyboard-inset);
  z-index: 220;
  display: flex !important;
  flex-direction: column;
  justify-content: flex-end;
  gap: 13px;
  margin: 0;
  padding: 15px 2px 10px;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
  background: transparent;
}

html.keyboard-open #budget-sheet.is-kb-docked .compose-sheet-scroll {
  flex: 0 0 auto;
  max-height: none;
  gap: 13px;
}

html.keyboard-open #budget-sheet.is-kb-docked .tx-amount-card,
html.keyboard-open #budget-sheet.is-kb-docked .tx-field-card {
  zoom: 1;
  margin-top: 0;
}

html.keyboard-open #budget-sheet.is-kb-docked .modal-actions.modal-page-actions {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  bottom: calc(var(--content-inset) + 8px + var(--safe-bottom));
  z-index: 430;
  margin-top: 0;
}

#tx-sheet .modal-card.modal-page-card {
  justify-content: stretch;
  gap: 0;
}

#tx-sheet > .modal-card > .tx-sheet-head {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 2px solid var(--gold, #b08d3e);
  min-width: 0;
  max-width: 100%;
}

#tx-sheet > .modal-card > .tx-sheet-head .sheet-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

#tx-sheet:not([hidden]),
#tx-sheet:not([hidden]) > .modal-card.modal-page-card {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
}

#tx-sheet .modal-page-body.tx-compose {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden !important;
  touch-action: none;
}

#tx-sheet .modal-actions.modal-page-actions,
#tx-sheet > .modal-card > .tx-sheet-head {
  touch-action: none;
}

html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked > .modal-card > .tx-sheet-head {
  display: none !important;
}

html.keyboard-open #tx-sheet.is-tx-edit.is-kb-docked > .modal-card > .tx-sheet-head {
  display: none !important;
}

html.keyboard-open #tx-sheet.is-tx-edit.is-kb-docked #tx-sheet-edit-preview:not([hidden]) {
  display: block;
  margin-top: 0;
  padding-top: 3px;
  zoom: 1.352;
  overflow: visible;
  flex: 0 0 auto;
}

html.keyboard-open #tx-sheet.is-tx-edit.is-kb-docked .tx-edit-preview-row {
  border-top: 2px solid var(--gold, #b08d3e);
}

html.keyboard-open #tx-sheet.is-kb-docked .modal-page-body.tx-compose {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  top: var(--safe-top);
  bottom: var(--keyboard-inset);
  z-index: 220;
  display: flex !important;
  flex-direction: column;
  justify-content: flex-end;
  gap: 13px;
  margin: 0;
  padding: 15px 2px 10px;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
  background: transparent;
  transform: translateY(10px);
}

/* Nouvelle dépense : catégorie / note / date + suggestions, zone défilable au-dessus du clavier */
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .modal-page-body.tx-compose {
  justify-content: flex-start;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-field-card {
  scroll-margin-bottom: 16px;
}

html.keyboard-open #tx-sheet.is-tx-edit.is-kb-docked .modal-page-body.tx-compose {
  transform: translateY(5px);
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-amount-card,
html.keyboard-open #tx-sheet.is-kb-docked .tx-field-card {
  margin-top: 0;
  flex: 0 0 auto;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-amount-card {
  zoom: 1.69;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-field-card {
  zoom: 1.4365;
}

/* Nouvelle dépense : au clic Montant, même taille/page qu’hors clic ; pas de grille qui pousse le contenu */
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-amount-card,
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-field-card,
#tx-sheet:not(.is-tx-edit).is-tx-note-focus .tx-amount-card,
#tx-sheet:not(.is-tx-edit).is-tx-note-focus .tx-field-card,
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked.is-tx-note-focus .tx-amount-card,
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked.is-tx-note-focus .tx-field-card {
  zoom: 1;
  display: block;
}

html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-amount-label {
  margin: 0 0 8px;
}

html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-amount-row,
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-type-toggle,
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-field-card .modal-select,
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-field-card .modal-input,
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-field-card .tx-date-wrap,
html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-field-card .tx-suggestions {
  grid-column: auto;
}

html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-field-card .field-label {
  margin: 16px 0 7px;
}

html.keyboard-open #tx-sheet:not(.is-tx-edit).is-kb-docked .tx-field-card > .field-label:first-child {
  margin-top: 0;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-amount-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  row-gap: 8px;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-amount-label {
  margin: 0;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-amount-row {
  grid-column: 2;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-type-toggle {
  grid-column: 1 / -1;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-field-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  row-gap: 8px;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-field-card .field-label {
  margin: 0;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-field-card .modal-select,
html.keyboard-open #tx-sheet.is-kb-docked .tx-field-card .modal-input,
html.keyboard-open #tx-sheet.is-kb-docked .tx-field-card .tx-date-wrap {
  grid-column: 2;
  min-width: 0;
}

html.keyboard-open #tx-sheet.is-kb-docked .tx-field-card .tx-suggestions {
  grid-column: 1 / -1;
}

#tx-sheet.is-tx-note-focus #tx-sheet-edit-preview:not([hidden]),
html.keyboard-open #tx-sheet.is-tx-edit.is-kb-docked.is-tx-note-focus #tx-sheet-edit-preview:not([hidden]) {
  zoom: 0.343429632;
}

#tx-sheet.is-tx-note-focus .tx-amount-card,
html.keyboard-open #tx-sheet.is-kb-docked.is-tx-note-focus .tx-amount-card {
  zoom: 0.681408;
}

#tx-sheet.is-tx-note-focus .tx-field-card,
html.keyboard-open #tx-sheet.is-kb-docked.is-tx-note-focus .tx-field-card {
  zoom: 1.03428;
}

html.keyboard-open #tx-sheet.is-kb-docked .modal-actions.modal-page-actions {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  bottom: calc(var(--content-inset) + 8px + var(--safe-bottom));
  z-index: 430;
  margin-top: 0;
}

html.keyboard-open #savings-goal-modal.is-kb-docked:not([hidden]),
html.keyboard-open #savings-goal-modal.is-kb-docked:not([hidden]) > .modal-card.modal-page-card {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
}

html.keyboard-open #savings-goal-modal:not(.is-savings-edit).is-kb-docked .tx-sheet-head {
  display: none !important;
}

html.keyboard-open #savings-goal-modal.is-savings-edit.is-kb-docked .tx-sheet-head {
  display: block !important;
  flex: 0 0 auto;
  margin: 0;
  padding: 4px 0 0;
  border: none;
  overflow: visible;
}

html.keyboard-open #savings-goal-modal.is-savings-edit.is-kb-docked #savings-goal-title,
html.keyboard-open #savings-goal-modal.is-savings-edit.is-kb-docked #savings-goal-sheet-month {
  display: none !important;
}

html.keyboard-open #savings-goal-modal.is-savings-edit.is-kb-docked #savings-goal-edit-preview:not([hidden]) {
  display: block;
  margin-top: 0;
  padding-top: 3px;
  zoom: 0.8;
  overflow: visible;
}

html.keyboard-open #savings-goal-modal.is-savings-edit.is-kb-docked .tx-edit-preview-row {
  border-top: 2px solid var(--gold, #b08d3e);
}

html.keyboard-open #savings-goal-modal.is-kb-docked .modal-page-body.tx-compose {
  display: flex !important;
  flex-direction: column;
  justify-content: flex-end;
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  top: var(--safe-top);
  bottom: var(--keyboard-inset);
  z-index: 220;
  gap: 13px;
  margin: 0;
  padding: 15px 2px 10px;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none;
  background: transparent;
  transition: none !important;
}

html.keyboard-open #savings-goal-modal.is-savings-edit.is-kb-docked .modal-page-body.tx-compose {
  transform: translateY(10px);
}

html.keyboard-open #savings-goal-modal.is-kb-docked .tx-amount-card,
html.keyboard-open #savings-goal-modal.is-kb-docked .tx-field-card {
  zoom: 1;
  margin-top: 0;
  flex: 0 0 auto;
  transition: none !important;
}

html.keyboard-open #savings-goal-modal.is-kb-docked .modal-actions.modal-page-actions {
  position: fixed;
  left: calc(var(--content-inset) + var(--safe-left));
  right: calc(var(--content-inset) + var(--safe-right));
  bottom: calc(var(--content-inset) + 8px + var(--safe-bottom));
  z-index: 430;
  margin-top: 0;
}

#budget-sheet .tx-compose .tx-amount-card,
#budget-sheet .tx-compose .tx-field-card {
  padding: 10px 14px 10px;
}

#budget-sheet .tx-compose .tx-field-card .field-label {
  margin: 8px 0 4px;
}

#budget-sheet .tx-compose .tx-field-card > .field-label:first-child {
  margin-top: 0;
}

#budget-sheet,
#budget-sheet * {
  -webkit-tap-highlight-color: transparent !important;
}

#budget-sheet .modal-input,
#budget-sheet .modal-select,
#budget-sheet .modal-input:focus,
#budget-sheet .modal-input:focus-visible,
#budget-sheet .modal-select:focus,
#budget-sheet .modal-select:focus-visible {
  -webkit-appearance: none;
  appearance: none;
  outline: none !important;
  border-color: var(--line) !important;
  box-shadow: none !important;
  background: rgba(255, 252, 247, 0.94) !important;
}

#budget-sheet .tx-compose .tx-amount-card,
#budget-sheet .tx-compose .tx-field-card {
  transition: none !important;
}

#budget-sheet .tx-compose .tx-amount-label {
  margin: 0 0 4px;
}

#budget-sheet .tx-compose .tx-amount-first {
  font-size: 1.35rem !important;
  padding: 8px 12px;
}

#budget-sheet .tx-sheet-head {
  padding-bottom: 4px;
  margin-bottom: 2px;
}

#budget-sheet > .modal-card > .tx-sheet-head {
  padding-bottom: 8px;
  margin-bottom: 0;
}

#tx-sheet .tx-sheet-head,
#tx-sheet .tx-amount-card,
#tx-sheet .tx-field-card,
.tx-compose .tx-sheet-head,
.tx-compose .tx-amount-card,
.tx-compose .tx-field-card {
  /* léger zoom pour tout tenir ; les marges entre blocs restent égales (gap du parent) */
  zoom: 0.94;
}

#tx-sheet .tx-sheet-head,
.tx-compose > .tx-sheet-head,
#budget-sheet .tx-sheet-head,
#savings-goal-modal .tx-sheet-head {
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 2px solid var(--gold, #b08d3e);
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
}

#tx-sheet .tx-sheet-head .sheet-title,
.tx-compose .tx-sheet-head .sheet-title,
#budget-sheet .tx-sheet-head .sheet-title,
#savings-goal-modal .tx-sheet-head .sheet-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

#tx-sheet .tx-sheet-edit-preview,
#savings-goal-modal .tx-sheet-edit-preview,
#fixed-modal .tx-sheet-edit-preview {
  margin: 0;
  min-width: 0;
  max-width: 100%;
}

#tx-sheet .tx-sheet-edit-preview[hidden],
#savings-goal-modal .tx-sheet-edit-preview[hidden],
#fixed-modal .tx-sheet-edit-preview[hidden] {
  display: none !important;
}

#tx-sheet.is-tx-edit .tx-sheet-head {
  padding-bottom: 0;
  border-bottom: none;
}

#tx-sheet.is-tx-edit .tx-sheet-edit-preview:not([hidden]),
#savings-goal-modal.is-savings-edit .tx-sheet-edit-preview:not([hidden]),
#fixed-modal.is-fixed-focus .tx-sheet-edit-preview:not([hidden]) {
  display: block;
}

#tx-sheet .tx-edit-preview-row,
#savings-goal-modal .tx-edit-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content max-content;
  column-gap: 10px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 12px 2px;
  box-sizing: border-box;
  border-top: 2px solid var(--gold, #b08d3e);
  border-bottom: 2px solid var(--gold, #b08d3e);
  border-left: none;
  border-right: none;
  border-radius: 0;
  background: transparent;
  touch-action: manipulation;
}

/* Dépense fixe : titre+catégorie | jour centré | montant CHF à droite */
#fixed-modal .tx-edit-preview-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 12px 2px;
  box-sizing: border-box;
  border-top: 2px solid var(--gold, #b08d3e);
  border-bottom: 2px solid var(--gold, #b08d3e);
  border-left: none;
  border-right: none;
  border-radius: 0;
  background: transparent;
  touch-action: manipulation;
}

#fixed-modal .tx-edit-preview-row .move-col-left {
  justify-self: start;
  text-align: left;
}

#fixed-modal .tx-edit-preview-row .move-col-mid {
  justify-self: center;
  text-align: center;
  width: 100%;
}

#fixed-modal .tx-edit-preview-row .move-col-right {
  justify-self: end;
  text-align: right;
  width: 100%;
}

#tx-sheet .tx-edit-preview-row .move-col-left,
#tx-sheet .tx-edit-preview-row .move-col-mid,
#tx-sheet .tx-edit-preview-row .move-col-right,
#savings-goal-modal .tx-edit-preview-row .move-col-left,
#savings-goal-modal .tx-edit-preview-row .move-col-mid,
#savings-goal-modal .tx-edit-preview-row .move-col-right,
#fixed-modal .tx-edit-preview-row .move-col-left,
#fixed-modal .tx-edit-preview-row .move-col-mid,
#fixed-modal .tx-edit-preview-row .move-col-right {
  min-width: 0;
}

#tx-sheet .tx-edit-preview-row .move-title,
#savings-goal-modal .tx-edit-preview-row .move-title,
#fixed-modal .tx-edit-preview-row .move-title {
  margin: 0;
}

#tx-sheet .tx-edit-preview-row .move-meta,
#savings-goal-modal .tx-edit-preview-row .move-meta,
#fixed-modal .tx-edit-preview-row .move-meta {
  margin: 2px 0 0;
}

#fixed-modal .tx-edit-preview-row .move-col-mid .move-meta {
  margin: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
}

#fixed-modal .tx-edit-preview-row .move-amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#tx-sheet .tx-edit-preview-row .move-amount,
#savings-goal-modal .tx-edit-preview-row .move-amount,
#fixed-modal .tx-edit-preview-row .move-amount {
  margin: 0;
}

#tx-sheet .tx-amount-card,
#tx-sheet .tx-field-card,
.tx-compose .tx-amount-card,
.tx-compose .tx-field-card {
  border: 1px solid rgba(15, 42, 61, 0.1);
  border-radius: 16px;
  background:
    linear-gradient(165deg, rgba(255, 252, 247, 0.97) 0%, rgba(240, 235, 227, 0.9) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 8px 22px rgba(15, 42, 61, 0.05);
  transition: background 0.2s ease, border-color 0.2s ease;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  flex: 0 0 auto;
}

#tx-sheet .tx-amount-card,
.tx-compose .tx-amount-card {
  overflow: visible;
  padding: 14px 16px 14px;
  border-color: rgba(140, 58, 72, 0.22);
  background:
    linear-gradient(155deg, rgba(158, 64, 78, 0.14) 0%, transparent 48%),
    linear-gradient(165deg, #fffcf7 0%, #f3eee6 100%);
}

#tx-sheet[data-tx-kind="income"] .tx-amount-card,
.tx-compose[data-tx-kind="income"] .tx-amount-card {
  border-color: rgba(42, 122, 75, 0.28);
  background:
    linear-gradient(155deg, rgba(42, 122, 75, 0.15) 0%, transparent 48%),
    linear-gradient(165deg, #fffcf7 0%, #f3eee6 100%);
}

.tx-compose[data-amount-tone="budget"] .tx-amount-card {
  border-color: rgba(58, 102, 128, 0.28);
  background:
    linear-gradient(155deg, rgba(58, 102, 128, 0.14) 0%, transparent 48%),
    linear-gradient(165deg, #fffcf7 0%, #f3eee6 100%);
}

.tx-compose[data-amount-tone="savings"] .tx-amount-card {
  border-color: rgba(176, 141, 62, 0.35);
  background:
    linear-gradient(155deg, rgba(176, 141, 62, 0.16) 0%, transparent 48%),
    linear-gradient(165deg, #fffcf7 0%, #f3eee6 100%);
}

.tx-compose[data-amount-tone="budget"] .tx-amount-first:focus,
.tx-compose[data-amount-tone="budget"] .tx-amount-first:focus-visible {
  border-color: var(--blue, #3a6680);
  box-shadow: 0 0 0 3px rgba(58, 102, 128, 0.22);
}

.tx-compose[data-amount-tone="savings"] .tx-amount-first:focus,
.tx-compose[data-amount-tone="savings"] .tx-amount-first:focus-visible {
  border-color: var(--gold, #b08d3e);
  box-shadow: 0 0 0 3px rgba(176, 141, 62, 0.22);
}

#budget-sheet .tx-sheet-head .modal-hint,
#savings-goal-modal .tx-sheet-head .modal-hint {
  margin: 6px 0 0;
}

#tx-sheet #tx-type[hidden],
.tx-compose #fixed-type[hidden] {
  display: none !important;
}

#tx-sheet .tx-amount-label,
.tx-compose .tx-amount-label {
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--navy);
}

#tx-sheet .tx-amount-row,
.tx-compose .tx-amount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

#tx-sheet .tx-amount-first,
.tx-compose .tx-amount-first {
  margin: 0;
  padding: 10px 12px;
  border: 1.5px solid rgba(15, 42, 61, 0.16);
  border-radius: 10px;
  background: rgba(255, 252, 247, 0.96);
  font-size: 1.45rem !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--navy);
  line-height: 1.15;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#tx-sheet .tx-amount-first:focus,
#tx-sheet .tx-amount-first:focus-visible,
.tx-compose .tx-amount-first:focus,
.tx-compose .tx-amount-first:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 141, 62, 0.22);
}

#tx-sheet[data-tx-kind="expense"] .tx-amount-first:focus,
#tx-sheet[data-tx-kind="expense"] .tx-amount-first:focus-visible,
.tx-compose[data-tx-kind="expense"] .tx-amount-first:focus,
.tx-compose[data-tx-kind="expense"] .tx-amount-first:focus-visible {
  border-color: #a04a58;
  box-shadow: 0 0 0 3px rgba(158, 64, 78, 0.2);
}

#tx-sheet[data-tx-kind="income"] .tx-amount-first:focus,
#tx-sheet[data-tx-kind="income"] .tx-amount-first:focus-visible,
.tx-compose[data-tx-kind="income"] .tx-amount-first:focus,
.tx-compose[data-tx-kind="income"] .tx-amount-first:focus-visible {
  border-color: #2f7a4d;
  box-shadow: 0 0 0 3px rgba(42, 122, 75, 0.22);
}

#tx-sheet .tx-amount-currency,
.tx-compose .tx-amount-currency {
  flex: 0 0 auto;
  min-width: 2.6rem;
  padding: 8px 0;
  text-align: right;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--navy);
}

#tx-sheet .tx-type-toggle,
.tx-compose .tx-type-toggle,
.tx-payer-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(15, 42, 61, 0.06);
}

.tx-payer-wrap {
  margin-top: 4px;
}

.tx-payer-wrap[hidden] {
  display: none !important;
}

.tx-payer-wrap > .field-label {
  margin: 12px 0 0;
}

#tx-sheet .tx-type-btn,
.tx-compose .tx-type-btn,
.tx-payer-toggle .tx-type-btn {
  appearance: none;
  margin: 0;
  padding: 8px 10px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

#tx-sheet .tx-type-btn.is-active,
.tx-compose .tx-type-btn.is-active,
.tx-payer-toggle .tx-type-btn.is-active {
  background: rgba(255, 252, 247, 0.9);
  color: var(--navy);
  border-color: #9e404e;
  box-shadow: none;
}

#tx-sheet .tx-type-btn[data-tx-type="income"].is-active,
.tx-compose .tx-type-btn[data-tx-type="income"].is-active {
  background: rgba(255, 252, 247, 0.9);
  color: var(--navy);
  border-color: #2f7a4d;
  box-shadow: none;
}

#tx-sheet .tx-type-btn:not(.is-active):active,
.tx-compose .tx-type-btn:not(.is-active):active {
  background: rgba(15, 42, 61, 0.08);
  color: var(--navy);
}

#tx-sheet .tx-field-card,
.tx-compose .tx-field-card {
  padding: 14px 18px 12px;
}

#tx-sheet .tx-field-card .field-label,
.tx-compose .tx-field-card .field-label {
  margin: 16px 0 7px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}

#tx-sheet .tx-field-card > .field-label:first-child,
.tx-compose .tx-field-card > .field-label:first-child {
  margin-top: 0;
}

#tx-sheet .tx-field-card .modal-input,
#tx-sheet .tx-field-card .modal-select,
.tx-compose .tx-field-card .modal-input,
.tx-compose .tx-field-card .modal-select {
  display: block;
  border-radius: 9px;
  border-width: 1.5px;
  background: rgba(255, 252, 247, 0.94);
  min-height: 40px;
  padding: 8px 11px;
  font-size: 0.95rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* display:block ci-dessus écrasait [hidden] → champ « Nom de la catégorie » toujours visible */
#tx-sheet .tx-field-card .modal-input[hidden],
#tx-sheet .tx-field-card .modal-select[hidden],
.tx-compose .tx-field-card .modal-input[hidden],
.tx-compose .tx-field-card .modal-select[hidden] {
  display: none !important;
}

/* Coque visible autour de la date (Safari ne peut plus déborder à droite) */
#tx-sheet .tx-date-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1.5px solid rgba(15, 42, 61, 0.16);
  border-radius: 9px;
  background: rgba(255, 252, 247, 0.94);
}

#tx-sheet #tx-date,
#tx-sheet input[type="date"] {
  position: absolute;
  inset: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 12px !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
  font-size: 0.95rem;
  line-height: 42px;
  color: var(--navy);
  text-align: center !important;
  -webkit-appearance: none;
  appearance: none;
}

#tx-sheet #tx-date:focus,
#tx-sheet #tx-date:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

#tx-sheet .tx-date-wrap:focus-within {
  border-color: var(--gold, #b08d3e);
  box-shadow: inset 0 0 0 2px rgba(176, 141, 62, 0.22);
}

/* Valeur date centrée (WebKit / iOS) */
#tx-sheet #tx-date::-webkit-date-and-time-value {
  text-align: center !important;
  margin: 0;
  padding: 0;
  width: 100%;
  height: auto;
  line-height: 42px;
}

#tx-sheet #tx-date::-webkit-datetime-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  line-height: 42px;
  text-align: center;
}

#tx-sheet #tx-date::-webkit-datetime-edit-fields-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0;
  margin: 0;
}

#tx-sheet #tx-date::-webkit-datetime-edit-text,
#tx-sheet #tx-date::-webkit-datetime-edit-month-field,
#tx-sheet #tx-date::-webkit-datetime-edit-day-field,
#tx-sheet #tx-date::-webkit-datetime-edit-year-field {
  padding: 0;
  margin: 0;
  line-height: 42px;
  text-align: center;
}

#tx-sheet #tx-date::-webkit-calendar-picker-indicator {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  height: 18px;
  width: 18px;
  opacity: 0.65;
  cursor: pointer;
}

#tx-sheet .tx-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 2px;
  max-width: 100%;
}

#tx-sheet .tx-suggestions[hidden] {
  display: none !important;
}

/* 4 catégories : 2 lignes × 2 colonnes, libellé complet (pas de « … ») */
#tx-sheet #tx-cat-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

#tx-sheet .tx-suggest-chip {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(176, 141, 62, 0.45);
  background: rgba(176, 141, 62, 0.1);
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

#tx-sheet #tx-cat-suggestions .tx-suggest-chip {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  text-align: center;
  hyphens: auto;
}

#tx-sheet #tx-note-suggestions .tx-suggest-chip {
  flex: 0 1 auto;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#tx-sheet .tx-suggest-chip:active {
  background: rgba(176, 141, 62, 0.22);
  border-color: rgba(176, 141, 62, 0.7);
}

#tx-sheet .tx-sheet-actions,
#savings-goal-modal .tx-sheet-actions {
  gap: 10px;
  margin-top: auto;
  padding-top: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background: transparent;
}

#tx-sheet .tx-sheet-actions .modal-btn,
#savings-goal-modal .tx-sheet-actions .modal-btn {
  min-height: 48px;
  border-radius: 12px;
  font-weight: 500;
}

html[data-theme="dark"] #tx-sheet .tx-amount-card,
html[data-theme="dark"] #tx-sheet .tx-field-card,
html[data-theme="dark"] .tx-compose .tx-amount-card,
html[data-theme="dark"] .tx-compose .tx-field-card {
  background: rgba(26, 40, 52, 0.92);
  border-color: rgba(214, 226, 234, 0.14);
  box-shadow: none;
}

html[data-theme="dark"] #tx-sheet .tx-amount-card,
html[data-theme="dark"] .tx-compose .tx-amount-card {
  background:
    linear-gradient(155deg, rgba(180, 80, 95, 0.18) 0%, transparent 48%),
    rgba(26, 40, 52, 0.95);
  border-color: rgba(180, 80, 95, 0.28);
}

html[data-theme="dark"] #tx-sheet[data-tx-kind="income"] .tx-amount-card,
html[data-theme="dark"] .tx-compose[data-tx-kind="income"] .tx-amount-card {
  background:
    linear-gradient(155deg, rgba(56, 140, 90, 0.2) 0%, transparent 48%),
    rgba(26, 40, 52, 0.95);
  border-color: rgba(56, 140, 90, 0.32);
}

html[data-theme="dark"] .tx-compose[data-amount-tone="budget"] .tx-amount-card {
  background:
    linear-gradient(155deg, rgba(90, 140, 170, 0.2) 0%, transparent 48%),
    rgba(26, 40, 52, 0.95);
  border-color: rgba(90, 140, 170, 0.32);
}

html[data-theme="dark"] .tx-compose[data-amount-tone="savings"] .tx-amount-card {
  background:
    linear-gradient(155deg, rgba(201, 168, 79, 0.2) 0%, transparent 48%),
    rgba(26, 40, 52, 0.95);
  border-color: rgba(201, 168, 79, 0.35);
}

html[data-theme="dark"] #tx-sheet .tx-amount-first,
html[data-theme="dark"] #tx-sheet .tx-field-card .modal-input,
html[data-theme="dark"] #tx-sheet .tx-field-card .modal-select,
html[data-theme="dark"] .tx-compose .tx-amount-first,
html[data-theme="dark"] .tx-compose .tx-field-card .modal-input,
html[data-theme="dark"] .tx-compose .tx-field-card .modal-select {
  background: rgba(18, 30, 39, 0.85);
  border-color: rgba(214, 226, 234, 0.18);
  color: #e8eef2;
}

html[data-theme="dark"] #tx-sheet .tx-date-wrap {
  background: rgba(18, 30, 39, 0.85);
  border-color: rgba(214, 226, 234, 0.18);
}

html[data-theme="dark"] #tx-sheet #tx-date {
  color: #e8eef2;
  background: transparent !important;
}

html[data-theme="dark"] #tx-sheet .tx-amount-label,
html[data-theme="dark"] #tx-sheet .tx-amount-currency,
html[data-theme="dark"] .tx-compose .tx-amount-label,
html[data-theme="dark"] .tx-compose .tx-amount-currency,
html[data-theme="dark"] #tx-sheet .tx-sheet-head .sheet-title,
html[data-theme="dark"] #tx-sheet .tx-field-card .field-label,
html[data-theme="dark"] .tx-compose .tx-field-card .field-label {
  color: #e8eef2;
}

html[data-theme="dark"] #tx-sheet .tx-sheet-head {
  border-bottom-color: rgba(201, 168, 79, 0.55);
}

html[data-theme="dark"] #tx-sheet.is-tx-edit .tx-sheet-head {
  border-bottom: none;
}

html[data-theme="dark"] #tx-sheet .tx-type-toggle,
html[data-theme="dark"] .tx-payer-toggle {
  background: rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] #tx-sheet .tx-type-btn,
html[data-theme="dark"] .tx-payer-toggle .tx-type-btn {
  color: rgba(214, 226, 234, 0.55);
}

html[data-theme="dark"] #tx-sheet .tx-type-btn.is-active,
html[data-theme="dark"] .tx-payer-toggle .tx-type-btn.is-active {
  background: rgba(18, 30, 39, 0.7);
  color: #e8eef2;
  border-color: #c46a78;
}

html[data-theme="dark"] #tx-sheet .tx-type-btn[data-tx-type="income"].is-active {
  border-color: #4a9e68;
}

html[data-theme="dark"] #tx-sheet .tx-suggest-chip {
  background: rgba(201, 168, 79, 0.14);
  border-color: rgba(201, 168, 79, 0.4);
  color: #e8eef2;
}

.home-activity-block {
  border-color: rgba(42, 122, 75, 0.22);
  border-width: 1.5px;
}

.home-activity-block[hidden] {
  display: none !important;
}

.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(15, 42, 61, 0.08);
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-item:first-child {
  padding-top: 2px;
}

.activity-main {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
}

.activity-who {
  font-weight: 600;
  color: var(--navy);
  font-size: 0.88rem;
}

.activity-text {
  color: var(--ink);
  font-size: 0.88rem;
}

.activity-when {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.couple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.couple-table th,
.couple-table td {
  padding: 6px 4px;
  vertical-align: baseline;
}

.couple-table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-align: right;
  border-bottom: 1px solid var(--line);
}

.couple-table thead th:first-child {
  text-align: left;
}

.couple-td-cat {
  color: var(--ink);
  padding-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 7.5rem;
}

.couple-td-amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
}

.couple-table tfoot td {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-weight: 700;
  color: var(--navy);
}

.couple-table tfoot .couple-td-amt {
  font-weight: 700;
}

.recap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.recap-vs {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.recap-hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px 16px 14px;
  border-radius: 10px;
  background: rgba(15, 42, 61, 0.05);
  border: 1px solid var(--line);
}

.recap-hero-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.recap-hero-value {
  font-size: 1.55rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--navy);
  line-height: 1.15;
}

.recap-hero-value.is-positive {
  color: #2a7a4b;
}

.recap-hero-value.is-negative {
  color: var(--danger);
}

.recap-hero-delta {
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.recap-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.recap-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 14px 12px;
  border-radius: 10px;
  background: rgba(15, 42, 61, 0.035);
  border: 1px solid rgba(15, 42, 61, 0.08);
}

.recap-metric-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.recap-metric-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.recap-metric-value.recap-muted {
  color: var(--muted);
  font-weight: 600;
}

.recap-metric-sub {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
}

.recap-metric-delta {
  margin-top: 2px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
}

.recap-section {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.recap-section-title {
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.recap-cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.recap-cat-item {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}

.recap-cat-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.recap-cat-item:first-child {
  padding-top: 0;
}

.recap-cat-name {
  grid-column: 1;
  grid-row: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  overflow-wrap: anywhere;
}

.recap-cat-amount {
  grid-column: 2;
  grid-row: 1;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  text-align: right;
}

.recap-cat-delta {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 0.75rem;
  color: var(--muted);
}

.recap-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Lignes compactes (aperçu couple) */
.recap-rows {
  display: grid;
  gap: 10px;
}

.recap-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 6px 12px;
  align-items: baseline;
}

.recap-label {
  font-size: 0.9rem;
  color: var(--ink);
  min-width: 0;
}

.recap-value {
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--navy);
  text-align: right;
}

.recap-value.is-positive {
  color: #2a7a4b;
}

.recap-value.is-negative {
  color: var(--danger);
}

.recap-value.recap-muted {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-align: right;
}

.home-block-title {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-block-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.home-block-header .home-block-title {
  margin: 0 0 10px;
}

.home-block .chart-block {
  margin: 0;
}

.home-block .chart-title {
  display: none;
}

.home-block .forecast-line {
  margin: 0;
}

#home-fixed-block .home-block-title {
  margin-bottom: 22px;
}

#home-fixed-after {
  margin: 0 0 10px;
}

.budget-coverage-ok {
  color: var(--ok);
  font-weight: 700;
  margin-left: 2px;
}

.forecast-lines {
  display: grid;
  gap: 8px;
}

.forecast-lines .forecast-line {
  margin: 0;
  padding: 0;
}

.forecast-label {
  display: block;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 2px;
}

.forecast-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.forecast-label-row .forecast-label {
  margin-bottom: 0;
}

.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid var(--muted);
  background: transparent;
  color: var(--muted);
  font-size: 0.65rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.info-btn:active {
  background: rgba(15, 42, 61, 0.08);
}

.forecast-info-text {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
}

.forecast-info-text[hidden] {
  display: none;
}

.forecast-value {
  display: block;
  font-weight: 400;
  color: var(--ink);
}

.home-block .empty-state {
  margin: 4px 0 0;
}

.home-block .budget-row:last-child {
  margin-bottom: 0;
}

.balances {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.balance-block {
  padding: 0;
  border-bottom: none;
  min-width: 0;
}

.balance-label {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.balance-label-past {
  font-weight: 700;
  color: var(--navy);
}

.balance-value.is-negative {
  color: var(--danger);
}

/* Montants négatifs (soldes, totaux, HTML formatMoneyHtml) */
.is-negative {
  color: var(--danger);
}

.is-positive {
  color: var(--ok);
}

.recap-metric-value.is-positive {
  color: var(--ok);
}

.recap-metric-value.is-negative {
  color: var(--danger);
}

.balance-value {
  margin: 6px 0 0;
  font-family: var(--font-body);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  max-width: 100%;
}

.balance-range-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 0;
}

.balance-range-label {
  font-size: 0.78rem;
  color: var(--muted);
}

.balance-range-value {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.balance-range-value.is-negative {
  color: var(--danger);
}

.budget-row {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.budget-row-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.95rem;
}

.budget-row-top > span:first-child,
.budget-row-top > strong {
  min-width: 0;
  flex: 1 1 auto;
}

.budget-row-top > span:last-child {
  flex-shrink: 0;
  text-align: right;
}

.budget-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(27, 58, 75, 0.1);
  overflow: hidden;
}

.budget-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  border-radius: inherit;
}

.budget-bar.is-over > span {
  background: var(--danger);
}

.budget-status {
  margin: 6px 0 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

#budget-list .budget-item,
#home-budget-body .budget-item {
  margin: 0 0 2px;
  padding: 4px 0 5px;
}

#budget-list .item-swipe-wrap:last-child .budget-item,
#home-budget-body .item-swipe-wrap:last-child .budget-item {
  margin-bottom: 0;
  padding-bottom: 2px;
}

#budget-list .budget-item .move-meta,
#home-budget-body .budget-item .move-meta {
  margin: 2px 0 0;
}

#budget-list .budget-item .budget-bar,
#home-budget-body .budget-item .budget-bar {
  margin-top: 6px;
}

#budget-list .budget-item .budget-status,
#home-budget-body .budget-item .budget-status {
  margin-top: 4px;
}

.budget-status.is-over,
.budget-item.is-over .budget-row-top strong {
  color: #b33a3a;
}

.budget-item.is-over .budget-row-top > span:last-child {
  color: #b33a3a;
  font-weight: 600;
}

.forecast-line {
  margin: 22px 0 0;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.budget-tab-summary,
#fixed-forecast-line {
  margin: 0 0 24px;
  font-weight: 500;
  color: var(--navy);
}

#fixed-checking-line {
  font-weight: 700;
  margin: 0 0 22px;
}

#fixed-forecast-line strong {
  font-weight: 700;
}

.budget-tab-summary {
  padding-left: 1.15em;
  position: relative;
}

.budget-tab-summary .forecast-label-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  margin-right: 0;
  vertical-align: baseline;
}

.budget-tab-summary .forecast-label {
  display: inline;
  font-weight: 400;
  margin-bottom: 0;
}

.budget-tab-summary .forecast-value {
  display: inline;
}

.budget-tab-summary .forecast-info-text {
  display: block;
  margin-top: 6px;
}

.budget-tab-summary .forecast-info-text[hidden] {
  display: none;
}

.budget-tab-summary::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--navy);
}

#budget-summary-line,
#home-budget-summary-line {
  margin-bottom: 28px;
}

#budget-savings-goal-body .budget-tab-summary {
  margin-bottom: 4px;
}

#budget-savings-goal-body .budget-tab-summary:last-of-type {
  margin-bottom: 14px;
}

.budget-savings-goal-block {
  border-color: var(--gold);
  border-width: 2px;
}

#panel-budget .budget-savings-goal-block {
  margin-top: 28px;
}

.budget-section-block {
  border-color: var(--blue);
  border-width: 2px;
}

/* Contenu hors budget */
.outbudget-total {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--navy);
}

.outbudget-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.outbudget-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.outbudget-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.outbudget-cat {
  font-weight: 600;
  color: var(--navy);
}

.outbudget-meta {
  font-size: 0.9rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.outbudget-add-btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(15, 42, 61, 0.18);
  border-radius: 10px;
  background: rgba(15, 42, 61, 0.06);
  color: var(--navy);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.outbudget-add-btn:active {
  background: rgba(15, 42, 61, 0.12);
}

#budget-outbudget-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(15, 42, 61, 0.12);
}

#budget-outbudget-block .home-block-title {
  margin: 0 0 10px;
}

#panel-budget.is-objectif-edit #budget-outbudget-block {
  display: none !important;
}

.section-label {
  margin: 22px 0 10px;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

/* ——— Réglages (onglet engrenage) ——— */
.settings-scroll {
  padding-bottom: 36px;
}

.settings-header {
  margin: 2px 0 22px;
}

.settings-page-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--navy);
}

.settings-page-sub {
  margin: 6px 0 0;
  font-size: 0.88rem;
  font-weight: 450;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.settings-group {
  margin: 0 0 22px;
}

.settings-group-title {
  margin: 0 0 8px;
  padding: 0 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, var(--card-bg-0) 0%, var(--card-bg-1) 100%);
  box-shadow: 0 1px 2px var(--shadow-soft);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 12px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease;
}

.settings-row + .settings-row {
  border-top: 1px solid var(--line);
}

.settings-row:active {
  background: var(--tile-active);
}

.settings-row[hidden] {
  display: none !important;
}

.settings-row-label {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.3;
}

.settings-row-value {
  flex: 0 0 auto;
  max-width: 46%;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--blue);
  text-align: right;
  line-height: 1.25;
}

.settings-row[aria-pressed="true"] .settings-row-value {
  color: var(--ok);
}

.settings-row-chevron {
  flex: 0 0 auto;
  width: 0.45em;
  height: 0.45em;
  margin-right: 2px;
  border-right: 2px solid rgba(102, 116, 125, 0.55);
  border-top: 2px solid rgba(102, 116, 125, 0.55);
  transform: rotate(45deg);
}

.settings-row-danger .settings-row-label {
  color: var(--danger);
  font-weight: 600;
}

.ios-row {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 13px 0;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}

label.ios-row-file {
  cursor: pointer;
}

/* ——— Listes mouvements (tableaux par catégorie) ——— */
.moves-cat-group.moves-table {
  margin-bottom: 34px;
}

.moves-cat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 8px 0 8px;
  border-bottom: 3px solid var(--cat-color, var(--gold));
}

.moves-cat-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--navy);
}

.moves-cat-total {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  flex-shrink: 0;
}

.moves-table-body {
  margin: 0;
}

.moves-table-body .item-swipe-wrap {
  margin-bottom: 0;
}

.moves-table-body .move-row.swipe-content {
  padding: 10px 0;
}

.move-date {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.move-item,
.budget-item {
  position: relative;
  touch-action: pan-y;
}

.item-swipe-wrap {
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
  touch-action: pan-y;
}

.moves-table-body .item-swipe-wrap,
.moves-table-body .move-item,
.moves-table-body .move-title,
.moves-table-body .move-meta,
.moves-table-body .move-amount,
.moves-table-body .move-balance {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.item-swipe-wrap.is-day-picking {
  overflow: visible;
  z-index: 3;
}

.item-swipe-wrap.is-day-picking > .swipe-content {
  border-radius: 0;
  background: rgba(47, 122, 184, 0.08);
  border-top: 2px solid #2f7ab8;
  border-bottom: 2px solid #2f7ab8;
  border-left: none;
  border-right: none;
  box-shadow: none;
}

.move-insert-marker {
  height: 3px;
  margin: 2px 4px;
  border-radius: 999px;
  background: var(--gold, #b08d3e);
  box-shadow: 0 0 0 3px rgba(176, 141, 62, 0.22);
  pointer-events: none;
  animation: move-insert-pulse 0.85s ease-in-out infinite;
}

@keyframes move-insert-pulse {
  0%, 100% { opacity: 1; transform: scaleX(1); }
  50% { opacity: 0.55; transform: scaleX(0.98); }
}

html.is-move-reordering {
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

html.is-move-reordering #panel-moves .panel-scroll,
html.is-move-reordering #panel-moves .moves-panel-scroll {
  overflow: hidden !important;
  touch-action: none !important;
}

html.is-move-reordering .item-swipe-wrap > .swipe-content {
  transition: transform 0.18s ease;
}

.item-swipe-wrap.is-day-neighbor-above > .swipe-content {
  transform: translateY(-6px);
}

.item-swipe-wrap.is-day-neighbor-below > .swipe-content {
  transform: translateY(6px);
}

.swipe-actions-right,
.swipe-actions-left {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  opacity: 0;
}

.swipe-actions-right {
  right: 0;
  background: var(--danger);
}

.swipe-actions-left {
  left: 0;
  background: var(--blue);
}

.swipe-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  touch-action: pan-y;
  transition: transform 0.16s ease;
}

.move-item.swipe-content {
  grid-template-columns: minmax(0, 1.35fr) max-content max-content;
  column-gap: 10px;
  align-items: start;
}

.budget-item.swipe-content {
  display: block;
  border-bottom: none;
}

.move-col-left {
  min-width: 0;
  grid-column: 1;
}

.move-col-mid {
  grid-column: 2;
  justify-self: end;
  align-self: center;
  text-align: right;
}

.move-col-right {
  grid-column: 3;
  justify-self: end;
  align-self: center;
  text-align: right;
  min-width: 4.6rem;
}

.move-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.move-meta {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.move-meta.move-date-line {
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.move-meta .move-payer,
.move-payer-line .move-payer {
  font-weight: 400;
  font-style: normal;
}

.move-meta .move-payer-me,
.move-payer-line .move-payer-me {
  color: #2f7ab8;
}

.move-meta .move-payer-partner,
.move-payer-line .move-payer-partner {
  color: #d45a8a;
}

.move-amount {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.move-amount.expense { color: var(--danger); }
.move-amount.income { color: var(--ok); }

.move-balance {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
  color: var(--muted);
}

.move-balance.is-negative {
  color: var(--danger);
}

.empty-state {
  margin: 28px 0;
  color: var(--muted);
  line-height: 1.45;
}

/* ——— États vides (mouvements / budget / épargne) ——— */
.panel-empty {
  margin: 4px 0 8px;
  padding: 26px 18px 24px;
  text-align: center;
  border: 1px solid rgba(15, 42, 61, 0.1);
  border-radius: var(--radius);
  background:
    linear-gradient(165deg, rgba(176, 141, 62, 0.08) 0%, transparent 42%),
    rgba(255, 252, 247, 0.78);
  box-sizing: border-box;
}

.panel-empty-moves,
.panel-empty-budget {
  background:
    linear-gradient(165deg, rgba(58, 102, 128, 0.1) 0%, transparent 42%),
    rgba(255, 252, 247, 0.78);
}

.panel-empty-savings {
  background:
    linear-gradient(165deg, rgba(176, 141, 62, 0.12) 0%, transparent 42%),
    rgba(255, 252, 247, 0.78);
}

.panel-empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 18px;
  color: var(--blue);
  background: rgba(58, 102, 128, 0.1);
}

.panel-empty-savings .panel-empty-icon {
  color: var(--gold);
  background: rgba(176, 141, 62, 0.14);
}

.panel-empty-icon svg {
  width: 34px;
  height: 34px;
}

.panel-empty-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.01em;
}

.panel-empty-sub {
  margin: 0 auto;
  max-width: 16.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
}

.home-block .panel-empty {
  margin: 0;
}

#panel-moves .moves-empty-block {
  margin: 8px 0 12px;
}

#panel-moves .moves-empty-block .panel-empty {
  margin: 0;
}

/* ——— Tab bar ——— */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tab-bar-lift);
  height: var(--tab-bar-height);
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  padding: 5px 0;
  background: transparent;
}

.tab-bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: calc(-1 * var(--tab-bar-frame-extra));
  background: rgba(255, 252, 247, 0.94);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid rgba(176, 141, 62, 0.22);
  pointer-events: none;
  z-index: 0;
}

html.keyboard-open .tab-bar {
  bottom: calc(var(--tab-bar-lift) - var(--keyboard-inset, 0px)) !important;
  transform: none !important;
}

.tab-btn {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  margin: 0;
  border: none;
  border-left: 1px solid rgba(15, 42, 61, 0.14);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  padding: 0;
  overflow: hidden;
}

.tab-btn:first-child {
  border-left: none;
}

.tab-btn.is-active {
  color: var(--navy);
}

.tab-icon {
  width: 29px;
  height: 29px;
  display: block;
  flex-shrink: 0;
}

/* Bouton + au-dessus de la tab bar (Mouvements / Budget) */
.tab-fab {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(var(--stage-bottom) + 10px);
  z-index: 110;
  width: 50px;
  height: 50px;
  margin: 0;
  padding: 0;
  transform: translateX(-50%);
  border: 1px solid rgba(176, 141, 62, 0.5);
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--gold-soft);
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(10, 31, 46, 0.22);
  cursor: pointer;
}

.tab-fab[hidden] {
  display: none !important;
}

.tab-fab-calc,
.tab-fab-chart {
  left: auto;
  right: calc(var(--content-inset) + var(--safe-right));
  transform: none;
  width: 44px;
  height: 44px;
  bottom: calc(var(--stage-bottom) + 13px);
  background: rgba(255, 252, 247, 0.98);
  color: var(--navy);
  border: 1.5px solid var(--line);
  box-shadow: 0 8px 18px rgba(10, 31, 46, 0.14);
  display: grid;
  place-items: center;
}

.tab-fab-chart {
  right: auto;
  left: calc(var(--content-inset) + var(--safe-left));
}

.tab-fab-chart.is-active {
  border-color: var(--navy);
  background: rgba(15, 42, 61, 0.08);
  color: var(--navy);
}

.tab-fab-calc-icon,
.tab-fab-chart-icon {
  width: 22px;
  height: 22px;
  display: block;
}

/* Menu de choix "Budget / Épargne" au-dessus du bouton + */
.add-choice-menu {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(var(--stage-bottom) + 68px);
  z-index: 111;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.98);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(10, 31, 46, 0.22);
}

.add-choice-menu[hidden] {
  display: none !important;
}

.add-choice-btn {
  min-width: 190px;
  margin: 0;
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(15, 42, 61, 0.05);
  color: var(--navy);
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
}

.add-choice-btn:active {
  background: rgba(15, 42, 61, 0.12);
}

html.keyboard-open .tab-fab {
  display: none !important;
}

/* ——— Modales ——— */
.modal-card {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px 18px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, var(--card-bg-0) 0%, var(--card-bg-1) 100%);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px var(--shadow-modal);
}

.modal-card h2,
.sheet-title {
  margin: 0 0 10px;
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--navy);
}

.export-actions {
  margin-top: 28px;
}

#backup-modal .sheet-title {
  margin-bottom: 18px;
}

#backup-modal #backup-export-btn {
  margin-top: 40px;
}

/* ——— Rapport type relevé bancaire (couleurs Va2) ——— */
.rpt-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--navy);
}

.rpt-brand {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--navy);
  line-height: 1.1;
}

.rpt-meta {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.rpt-issued {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}

.rpt-section {
  margin: 0 0 14px;
}

.rpt-h {
  margin: 0 0 6px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.rpt-table th,
.rpt-table td {
  padding: 5px 4px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.rpt-table thead th {
  padding: 4px;
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid rgba(15, 42, 61, 0.22);
  background: transparent;
}

.rpt-table th.rpt-num,
.rpt-table .rpt-cell-amt {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}

.rpt-cell-date {
  width: 4.6rem;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.rpt-cell-label {
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.rpt-sub {
  display: block;
  margin-top: 1px;
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--muted);
}

.rpt-cell-amt {
  color: var(--navy);
}

.rpt-cell-amt.expense,
.rpt-cell-amt.is-negative {
  color: var(--danger);
}

.rpt-cell-amt.income,
.rpt-cell-amt.is-positive {
  color: var(--ok);
}

.rpt-muted {
  color: var(--muted) !important;
  font-weight: 500 !important;
}

.rpt-row-total td {
  border-bottom: none;
  padding-top: 7px;
  font-weight: 650;
  border-top: 1px solid rgba(15, 42, 61, 0.22);
}

.rpt-table-2 td:last-child {
  width: 38%;
}

.rpt-empty {
  margin: 4px 0;
  font-size: 0.78rem;
  color: var(--muted);
}

#report-preview-modal .report-preview-scroll .rpt-table tbody tr:last-child td {
  border-bottom: none;
}

/* Mode PDF / partage iOS : masquer le reste de l’app AVANT la capture
   (pas seulement @media print — sinon la feuille iOS voit encore l’UI). */
html.is-printing-report body > *:not(#report-preview-modal) {
  display: none !important;
}

html.is-printing-report #report-preview-modal {
  display: block !important;
  position: fixed !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  background: var(--beige-soft) !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
  z-index: 9999 !important;
}

html.is-printing-report #report-preview-modal > .modal-card.modal-page-card {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: auto !important;
  min-height: 100% !important;
  max-height: none !important;
  margin: 0 !important;
  padding:
    calc(16px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(24px + var(--safe-bottom))
    calc(16px + var(--safe-left)) !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: visible !important;
}

html.is-printing-report #report-preview-modal .report-preview-actions,
html.is-printing-report #report-preview-modal .no-print {
  display: none !important;
}

html.is-printing-report #report-preview-modal .report-preview-scroll {
  display: block !important;
  overflow: visible !important;
  max-height: none !important;
  height: auto !important;
  padding: 0 !important;
  flex: none !important;
}

@media print {
  html.is-printing-report #report-preview-modal {
    position: static !important;
    height: auto !important;
    overflow: visible !important;
  }

  html.is-printing-report #report-preview-modal > .modal-card.modal-page-card {
    min-height: 0 !important;
    padding: 10mm 12mm !important;
  }

  html.is-printing-report .rpt-section,
  html.is-printing-report .rpt-table tr {
    break-inside: avoid;
  }
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions .modal-btn {
  margin-top: 0;
  flex: 1;
}

.modal-btn-full {
  width: 100%;
}

.share-code-display {
  margin: 18px 0;
  padding: 16px 12px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  word-break: break-all;
  color: var(--navy);
  background: rgba(15, 42, 61, 0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.accounts-body .account-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.account-row input {
  width: 120px;
  text-align: right;
}

.categories-body .category-manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.categories-body .category-manage-row:last-child {
  border-bottom: none;
}

.category-manage-name {
  font-weight: 600;
  color: var(--navy);
  min-width: 0;
}

.category-manage-del {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--danger);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 0 8px 12px;
}

/* ——— Filtres mouvements ——— */
.moves-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.moves-account-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(15, 42, 61, 0.06);
}

.moves-account-btn {
  appearance: none;
  margin: 0;
  padding: 8px 6px;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.moves-account-btn.is-active {
  background: rgba(255, 252, 247, 0.95);
  color: var(--navy);
  border-color: rgba(176, 141, 62, 0.55);
  box-shadow: none;
}

.moves-filters .modal-select {
  padding: 8px 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.moves-filters .modal-select:disabled {
  opacity: 0.55;
}

.moves-filters .moves-search {
  width: 100%;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.moves-amount-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.moves-amount-row .modal-input {
  padding: 8px 10px;
  font-size: 0.9rem;
  transition: none !important;
  overflow-anchor: none;
}

/* ——— Empty states avec bouton ——— */
.empty-state-cta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin: 20px 0;
}

.empty-state-cta p {
  margin: 0;
  color: var(--muted);
}

.empty-state-cta .modal-btn {
  margin-top: 4px;
  max-width: 260px;
  align-self: center;
}

.savings-goal-simple {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 6px;
}

.savings-goal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.savings-goal-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.savings-goal-month-amt {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.savings-goal-progress-top {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--ink);
}

.savings-goal-simple .budget-bar {
  margin-top: 0;
}

.goal-progress-hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.savings-goal-fund-btn,
.savings-goal-fund-badge {
  box-sizing: border-box;
  flex: 0 0 auto;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.75rem;
  height: 1.85rem;
  border: 1px solid rgba(15, 42, 61, 0.16);
  background: #0f2a3d;
  color: #fff;
  border-radius: 999px;
  padding: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.savings-goal-fund-btn.is-funded,
.savings-goal-fund-badge.is-funded {
  background: rgba(31, 138, 91, 0.14);
  border-color: rgba(31, 138, 91, 0.35);
  color: #1f8a5b;
  font-size: 0.95rem;
  font-weight: 700;
}

.savings-goal-fund-badge:not(.is-funded) {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-weight: 500;
}

.savings-goal-simple.is-funded {
  border-color: rgba(31, 138, 91, 0.28);
}

html[data-theme="dark"] .savings-goal-fund-btn {
  background: #dce8f2;
  color: #0b1a26;
  border-color: transparent;
}

html[data-theme="dark"] .savings-goal-fund-btn.is-funded,
html[data-theme="dark"] .savings-goal-fund-badge.is-funded {
  background: rgba(109, 202, 160, 0.16);
  border-color: rgba(109, 202, 160, 0.4);
  color: #6dcaa0;
}

/* ——— Sécurité (info) ——— */
.security-info-p {
  margin: 12px 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink);
}

.security-info-p strong {
  color: var(--navy);
}

/* ——— Onboarding ——— */
.onboarding-body {
  margin-top: 14px;
}

.onboarding-step-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
}

.onboarding-step-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
  line-height: 1.5;
}

/* ——— Récap ——— */
.recap-body .summary-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.recap-body .summary-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
  color: var(--ink);
}

.recap-body .summary-list li strong {
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

/* Pastille de confirmation (style app, pas la boîte système) */
.modal.app-confirm-modal:not([hidden]) {
  z-index: 520 !important;
  background: rgba(15, 42, 61, 0.45) !important;
}

.app-confirm-card {
  width: min(100%, 320px) !important;
  padding: 22px 18px 16px;
  text-align: center;
}

.app-confirm-card .sheet-title {
  margin-bottom: 8px;
}

.app-confirm-message {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink);
  text-align: center;
}

.app-confirm-message strong {
  font-weight: 700;
  color: var(--navy);
}

.app-confirm-detail {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--navy);
}

.app-confirm-detail .app-confirm-cat {
  font-weight: 700;
  color: var(--navy);
}

.app-confirm-detail .app-confirm-note {
  font-weight: 400;
  color: var(--ink);
}

.app-confirm-amount {
  font-weight: 700;
  color: #1f8a5b;
}

.app-confirm-amount.expense {
  color: var(--danger);
}

.app-confirm-amount.income {
  color: var(--ok, #1f8a5b);
}

.app-confirm-accounts {
  display: inline-block;
  margin: 6px 0 2px;
  font-style: normal;
  font-weight: 400;
  font-size: inherit;
  color: var(--navy);
}

.app-confirm-arrow {
  display: inline-block;
  margin: 0 0.12em;
  font-size: 0.85em;
  transform: scaleX(0.82);
  transform-origin: center;
}

html[data-theme="dark"] .app-confirm-amount {
  color: #6dcaa0;
}

html[data-theme="dark"] .app-confirm-amount.expense {
  color: #e07070;
}

html[data-theme="dark"] .app-confirm-amount.income {
  color: #6dcaa0;
}

html[data-theme="dark"] .app-confirm-accounts {
  color: #e8eef2;
}

.app-confirm-card .modal-actions {
  margin-top: 20px;
}

.modal.app-confirm-single .modal-actions {
  display: block;
}

.modal.app-confirm-single #app-confirm-ok {
  width: 100%;
}

html[data-theme="dark"] .modal.app-confirm-modal:not([hidden]) {
  background: rgba(0, 0, 0, 0.55) !important;
}

/* ——— Thème sombre (passe 5) ——— */
html[data-theme="dark"] .home-block,
html[data-theme="dark"] .tab-bar::before,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .ios-row,
html[data-theme="dark"] .add-choice-menu,
html[data-theme="dark"] .list-gear-menu,
html[data-theme="dark"] .swipe-content,
html[data-theme="dark"] .modal-input,
html[data-theme="dark"] .modal-select,
html[data-theme="dark"] .view-month-select,
html[data-theme="dark"] .budget-duplicate-btn,
html[data-theme="dark"] .top-bar-lock-btn,
html[data-theme="dark"] .lock-pin-input {
  background: var(--tile-bg);
  border-color: var(--line);
  color: var(--ink);
  color-scheme: dark;
}

html[data-theme="dark"] .settings-page-title {
  color: var(--navy);
}

html[data-theme="dark"] .settings-row-value {
  color: var(--blue);
}

html[data-theme="dark"] .settings-row[aria-pressed="true"] .settings-row-value {
  color: var(--ok);
}

html[data-theme="dark"] .settings-row-chevron {
  border-color: rgba(180, 196, 206, 0.55);
}

html[data-theme="dark"] .view-month-select,
html[data-theme="dark"] .modal-select {
  background-color: #1a2834;
  color: #e8eef2;
  border-color: rgba(214, 226, 234, 0.35);
}

html[data-theme="dark"] .view-month-fields {
  background: rgba(26, 40, 52, 0.98);
  border-color: rgba(214, 226, 234, 0.22);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .view-month-select option,
html[data-theme="dark"] .modal-select option {
  background-color: #1a2834;
  color: #e8eef2;
}

html[data-theme="dark"] .budget-duplicate-btn,
html[data-theme="dark"] .top-bar-lock-btn {
  background: #223140;
  border-color: rgba(214, 226, 234, 0.35);
  color: #e8eef2;
}

html[data-theme="dark"] .budget-duplicate-btn:active,
html[data-theme="dark"] .top-bar-lock-btn:active {
  background: #2a3d4e;
}

html[data-theme="dark"] .tab-bar::before {
  background: rgba(18, 30, 39, 0.96);
  border-bottom-color: rgba(201, 168, 79, 0.28);
}

html[data-theme="dark"] .home-block,
html[data-theme="dark"] .fixed-list {
  background: transparent;
  border: none;
}

html[data-theme="dark"] .fixed-list:has(.panel-empty) {
  background: transparent;
  border: none;
}

html[data-theme="dark"] .fixed-list .swipe-content.budget-item.fixed-item,
html[data-theme="dark"] .home-fixed-list .budget-item.fixed-item {
  background: transparent;
}

html[data-theme="dark"] .panel-empty,
html[data-theme="dark"] .panel-empty-moves,
html[data-theme="dark"] .panel-empty-budget,
html[data-theme="dark"] .panel-empty-savings {
  background:
    linear-gradient(165deg, rgba(122, 168, 196, 0.12) 0%, transparent 45%),
    #1a2834;
  border-color: rgba(214, 226, 234, 0.22);
}

html[data-theme="dark"] .panel-empty-savings {
  background:
    linear-gradient(165deg, rgba(201, 168, 79, 0.14) 0%, transparent 45%),
    #1a2834;
}

html[data-theme="dark"] .panel-empty-title,
html[data-theme="dark"] .home-block-title {
  color: #e8eef2;
}

html[data-theme="dark"] .top-bar-owner {
  color: var(--navy);
}

html[data-theme="dark"] .panel-empty-sub,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .chart-title,
html[data-theme="dark"] .goal-progress-hint,
html[data-theme="dark"] .activity-who {
  color: #e8eef2;
}

html[data-theme="dark"] .activity-text {
  color: #d6e2ea;
}

html[data-theme="dark"] .activity-item {
  border-bottom-color: rgba(214, 226, 234, 0.1);
}

html[data-theme="dark"] .chart-legend-row {
  background: rgba(214, 226, 234, 0.06);
}

html[data-theme="dark"] .chart-legend-name,
html[data-theme="dark"] .chart-legend-val,
html[data-theme="dark"] .chart-compare-value,
html[data-theme="dark"] .chart-month-net,
html[data-theme="dark"] .chart-moves-total {
  color: #e8eef2;
}

html[data-theme="dark"] .chart-compare-label {
  color: #b4c4ce;
}

html[data-theme="dark"] .recap-hero {
  background: rgba(214, 226, 234, 0.06);
  border-color: rgba(214, 226, 234, 0.14);
}

html[data-theme="dark"] .recap-metric {
  background: rgba(214, 226, 234, 0.05);
  border-color: rgba(214, 226, 234, 0.12);
}

html[data-theme="dark"] .recap-hero-value,
html[data-theme="dark"] .recap-metric-value,
html[data-theme="dark"] .recap-cat-amount,
html[data-theme="dark"] .recap-cat-name {
  color: #e8eef2;
}

html[data-theme="dark"] .recap-hero-value.is-positive,
html[data-theme="dark"] .recap-value.is-positive,
html[data-theme="dark"] .recap-metric-value.is-positive,
html[data-theme="dark"] .is-positive {
  color: var(--ok);
}

html[data-theme="dark"] .recap-metric-value.is-negative,
html[data-theme="dark"] .is-negative {
  color: var(--danger);
}

html[data-theme="dark"] .recap-section {
  border-top-color: rgba(214, 226, 234, 0.14);
}

html[data-theme="dark"] .recap-cat-item {
  border-bottom-color: rgba(214, 226, 234, 0.1);
}

html[data-theme="dark"] .panel-empty-icon {
  color: #7aa8c4;
  background: rgba(122, 168, 196, 0.18);
}

html[data-theme="dark"] .panel-empty-savings .panel-empty-icon {
  color: #d4b86a;
  background: rgba(201, 168, 79, 0.2);
}

html[data-theme="dark"] .modal .modal-btn-secondary {
  background: #223140;
  border-color: rgba(214, 226, 234, 0.3);
  color: #e8eef2;
}

html[data-theme="dark"] #panel-budget .list-select-bar .modal-btn-secondary {
  background: #223140;
  border-color: rgba(214, 226, 234, 0.3);
  color: #e8eef2;
}

html[data-theme="dark"] #panel-moves.is-moves-edit .moves-edit-actions .modal-btn-secondary,
html[data-theme="dark"] #panel-budget.is-objectif-edit .moves-edit-actions .modal-btn-secondary,
html[data-theme="dark"] #fixed-modal.is-fixed-compose .fixed-modal-actions .modal-btn-secondary {
  background: #223140;
  border-color: rgba(214, 226, 234, 0.3);
  color: #e8eef2;
}

html[data-theme="dark"] .tab-fab,
html[data-theme="dark"] .modal-btn-primary,
html[data-theme="dark"] .btn-primary {
  color: #0a1f2e;
}

html[data-theme="dark"] .tab-fab-calc,
html[data-theme="dark"] .tab-fab-chart {
  background: #223140;
  color: #e8eef2;
  border-color: rgba(214, 226, 234, 0.3);
}

html[data-theme="dark"] .tab-fab-chart.is-active {
  background: rgba(214, 226, 234, 0.14);
  border-color: #d6e2ea;
}

html[data-theme="dark"] .move-amount.income,
html[data-theme="dark"] .recap-value.is-positive {
  color: #6fb89a;
}

html[data-theme="dark"] .move-meta .move-payer-me {
  color: #6eb0e0;
}

html[data-theme="dark"] .move-meta .move-payer-partner {
  color: #e890b8;
}
