:root {
  --bg: #e8eee9;
  --surface: rgba(255, 255, 255, 0.62);
  --surface-elevated: rgba(255, 255, 255, 0.78);
  --surface-sheet: rgba(248, 252, 249, 0.92);
  --ink: #14241c;
  --muted: #4d5f55;
  --line: rgba(255, 255, 255, 0.78);
  --line-strong: rgba(20, 40, 30, 0.12);
  --accent: #1f5a4a;
  --accent-hover: #164539;
  --accent-soft: rgba(31, 90, 74, 0.14);
  --accent-muted: #7aa394;
  --neg: #c73e3e;
  --pos: #2f9e5b;
  --danger: #c73e3e;
  /* Emboss ultra léger : liseré haut + ombre basse (liste plate, WebKit-safe) */
  --emboss-hi: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  --emboss-lo: inset 0 -1px 0 rgba(18, 36, 28, 0.045);
  --shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -1px 0 rgba(18, 36, 28, 0.045),
    -1px -1px 2px rgba(255, 255, 255, 0.55),
    2px 3px 10px rgba(18, 36, 28, 0.07);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 220px;
  --sidebar-w-collapsed: 72px;
  --glass-blur: 22px;
  --bg-fade: rgba(232, 238, 233, 0.48);
  --header-glass: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.72) 42%,
    var(--bg-fade) 100%
  );
  --footer-glass: linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.72) 42%,
    var(--bg-fade) 100%
  );
  --sans: "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --sticky-under-topbar: 65px;
  color: var(--ink);
  background: var(--bg);
  font: 15px/1.5 var(--sans);
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; min-height: 100%; }
html, body {
  background: var(--bg);
  min-height: 100svh;
}
h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; margin: 0; }
h1 { font-size: 1.35rem; }
h2 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.hidden { display: none !important; }

.app {
  min-height: 100svh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  background: transparent;
}
.shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  view-transition-name: shell;
}
.app-main {
  flex: 1; padding: 8px 20px 28px;
  /* clip (not hidden) : évite un scrollport qui casse position:sticky sous la topbar */
  overflow-x: hidden;
  overflow-x: clip;
  display: flex; flex-direction: column;
  view-transition-name: main-pane;
}

.glass,
.kpi, .panel, .chart-card, .account-card,
.dash-chart-band, .dash-col, .filters,
.asset-card, .wealth-asset-card, .line-row {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background-image: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0) 42%
  );
}

/* Sidebar */
.sidebar {
  background: transparent;
  border-right: 0;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100svh;
  view-transition-name: sidebar;
  transition: padding 0.22s ease;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 4px 6px;
  min-width: 0;
  view-transition-name: brand;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-soft);
  flex: none; object-fit: contain; padding: 5px;
}
.brand-text { min-width: 0; }
.brand-name { font-weight: 650; font-size: 0.95rem; letter-spacing: -0.02em; }
.brand-sub { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.side-menu { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: transparent; border: 0; border-radius: var(--radius-sm);
  padding: 10px 12px; cursor: pointer;
  color: #1c3328; font-size: 0.9rem;
  min-height: 42px;
}
.nav-item:hover { background: var(--surface-elevated); color: var(--ink); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-toggle {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  color: var(--ink);
}
.sidebar-toggle:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.sidebar-toggle-icon {
  width: 14px;
  height: 14px;
  display: block;
  object-fit: contain;
  opacity: 0.85;
}
.sidebar-toggle .is-expand { display: none; }
.nav-settings {
  background: rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.88;
  flex-shrink: 0;
  display: block;
}
.nav-item.active .nav-icon { opacity: 1; }
.nav-label {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}
.app.sidebar-collapsed {
  --sidebar-w: var(--sidebar-w-collapsed);
}
.app.sidebar-collapsed .sidebar {
  padding: 16px 8px;
}
.app.sidebar-collapsed .brand-text,
.app.sidebar-collapsed .nav-label {
  display: none;
}
.app.sidebar-collapsed .brand {
  justify-content: center;
  padding: 4px 0;
}
.app.sidebar-collapsed .sidebar-toggle {
  align-self: center;
}
.app.sidebar-collapsed .sidebar-toggle .is-collapse { display: none; }
.app.sidebar-collapsed .sidebar-toggle .is-expand { display: block; }
.app.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 8px;
  gap: 0;
}
.app.sidebar-collapsed .nav-item .nav-icon {
  width: 20px;
  height: 20px;
}

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 20px 12px;
  background: var(--header-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 6px 24px rgba(18, 36, 28, 0.05);
  position: sticky; top: 0; z-index: 5;
  view-transition-name: topbar;
}
.topbar-settings {
  width: 40px; min-width: 40px; padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.topbar-settings-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.88;
  display: block;
}
.topbar-settings.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.topbar-settings.active .topbar-settings-icon { opacity: 1; }
.topbar-title { font-size: 1.5rem; font-weight: 650; letter-spacing: -0.03em; }
.app-banner {
  margin: 0; padding: 8px 18px; font-size: 0.86rem; line-height: 1.35;
  background: #fef2f2; border-bottom: 1px solid #fecaca;
}
.app-banner.hidden { display: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-month-cluster {
  display: flex; align-items: center;
}
.topbar-month-cluster.view-range .topbar-month .date-field-input.is-range {
  cursor: default; min-width: 14.5rem;
}
.dash-mode.live { color: var(--accent, #1e3459); font-weight: 600; }
.dash-mode.hypothesis { color: #b45309; font-weight: 600; }
.dash-hypothesis-note {
  background: var(--surface-elevated); border: 1px dashed var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.86rem;
}
.topbar-month .date-field-pill { min-width: 10.5rem; }

.boot { min-height: 60vh; display: grid; place-items: center; color: var(--muted); }
.boot.boot-import {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 12px; text-align: center; padding: 32px 20px; color: var(--ink);
  max-width: 28rem; margin: 8vh auto;
  border-radius: var(--radius);
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.boot-import p { max-width: 28em; }
.page { display: flex; flex-direction: column; gap: 16px; }
.page-header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.07em;
  font-size: 0.68rem; color: var(--muted); margin-bottom: 4px;
}
.lede { color: var(--muted); margin-top: -8px; }
.muted { color: var(--muted); font-size: 0.88rem; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* Dashboard */
.dashboard-page {
  display: flex; flex-direction: column; gap: 14px;
}
.dash-hero-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}
.dash-hero-card,
.kpi.dash-hero-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 0;
  padding: 8px 12px;
}
.dash-hero-card .dash-hero { margin: 0; font-size: 1.35rem; }
.dash-hero-balance .kpi-label {
  flex-shrink: 0;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-hero-balance-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  min-width: 0;
}
.dash-hero-amount {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding: 6px 14px;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -moz-appearance: textfield;
}
.dash-hero-amount::-webkit-inner-spin-button,
.dash-hero-amount::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.dash-hero-amount:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.dash-hero-save-btn,
.dash-hero-settle-btn {
  flex: 0 0 auto;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin-top: 0;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dash-hero-balance-row-empty {
  justify-content: flex-end;
  margin-top: 0;
}
.dash-hero-btn-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
  opacity: 0.9;
}
.dash-hero-save-btn.primary-btn,
.dash-hero-save-btn.icon-btn {
  background: var(--accent);
  color: #fff;
  border: 0;
}
.dash-hero-save-btn .dash-hero-btn-icon {
  filter: brightness(0) invert(1);
  opacity: 1;
}
.dash-hero-settle-btn.icon-btn {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.dash-hero-landing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  min-width: 0;
}
.dash-hero-landing .dash-hero {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.dash-hero-once-btn.icon-btn {
  flex: 0 0 auto;
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.dash-hero-landing .dash-delta {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.3;
}
.dash-hero-landing .dash-hypothesis-note {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.3;
}
#settle-sheet .sheet-card { width: min(480px, 100%); }
#settle-sheet .transfer-list { margin: 0; padding: 0; list-style: none; }
@media (min-width: 900px) {
  #settle-sheet {
    align-items: center;
    padding: 24px;
  }
  #settle-sheet .sheet-card {
    border-radius: var(--radius);
    max-height: min(80svh, 720px);
  }
}
.dash-hero-dues { min-height: 0; overflow: hidden; }
.dash-hero-dues-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 0;
  flex-shrink: 0;
}
.dash-hero-dues-title .muted {
  font-size: 0.78em;
  font-weight: 400;
}
.pre-salary-list.dash-due-list {
  --due-row: 1.35rem;
  flex: 1 1 auto;
  max-height: calc(5 * var(--due-row));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  gap: 0;
}
.dash-due-list .pre-salary-hit {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  flex: 0 0 var(--due-row);
  height: var(--due-row);
  min-height: var(--due-row);
  max-height: var(--due-row);
  padding: 0;
  gap: 6px;
  overflow: hidden;
  box-sizing: border-box;
}
.dash-due-list .pre-salary-hit.past:not(.paid) { border: 0; }
.dash-due-list .pre-salary-hit.past {
  opacity: 0.42;
}
.dash-due-list .pre-salary-hit.past.paid {
  opacity: 0.36;
}
.dash-due-list .pre-salary-meta {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0 6px;
}
.dash-due-list .pre-salary-meta strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14ch;
}
.dash-due-list .pre-salary-check {
  font-size: 0.74rem;
  align-items: center;
  gap: 6px;
}
.dash-due-list .pre-salary-check input[type="checkbox"] {
  width: 13px;
  height: 13px;
  min-width: 13px;
  min-height: 13px;
  border-radius: 50%;
  margin: 0;
}
.dash-due-list .pre-salary-check input[type="checkbox"]:checked {
  background-size: 9px 9px;
}
.dash-due-list .pre-salary-hit .amount { font-size: 0.74rem; }
.dash-balance-field-hero { margin-top: auto; }
.dash-chart-band {
  width: 100%;
  border-radius: var(--radius);
  padding: 12px 16px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.dash-metrics-inline {
  border: none; padding: 0 0 4px; gap: 12px 24px;
  align-items: end;
}
.metric-pair-period dd { min-width: 0; }
.metric-pair-period .date-field-pill { min-width: 11.5rem; }
.metric-pair-period .date-field-input.is-range {
  cursor: pointer;
  min-width: 11rem;
}
.chart-wrap-wide { width: 100%; margin-top: 0; }
.dash-flow { gap: 16px; }
.dash-flow-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 32px;
}
.dash-flow-proj-btn {
  min-height: 32px;
  padding: 0 12px;
  font-size: 0.78rem;
  font-weight: 650;
}
#flow-projection-sheet .sheet-card { width: min(420px, 100%); }
.flow-proj-month {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 8px;
}
.flow-proj-month-label {
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.flow-proj-note { margin: 0 0 12px; font-size: 0.82rem; }
.flow-proj-body { gap: 14px; }
.flow-proj-balances {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flow-proj-balances .flow-proj-note { margin: 0; }
.flow-proj-balances .balance-list { margin-top: 2px; }
.dash-flow-block { display: flex; flex-direction: column; gap: 10px; }
.dash-flow-expenses {
  padding-top: 14px; border-top: 1px solid var(--line);
}
.dash-charge-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-charge-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-charge-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.dash-charge-head h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.dash-charge-total {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dash-settle { gap: 8px; padding: 12px 14px 14px; }
.dash-hero-landing { min-height: 0; }
.dash-settle-block { display: flex; flex-direction: column; gap: 4px; }
.dash-settle-title {
  margin: 0; font-size: 0.72rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.dash-settle-empty { margin: 0; font-size: 0.82rem; }
.transfer-list-compact { gap: 0; }
.transfer-list-compact li {
  padding: 3px 0; font-size: 0.8rem; line-height: 1.25;
  border-bottom: none; gap: 8px;
}
.transfer-list-compact .transfer-label {
  flex: 1; min-width: 0; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.transfer-label {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0;
}
.transfer-from {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 4px; min-width: 1.1em; flex: none;
  font-weight: 750; color: var(--accent, #1e3459);
  font-variant-numeric: tabular-nums;
}
.transfer-logo {
  width: 20px; height: 20px; object-fit: contain; display: block;
  border-radius: 4px; background: #fff; flex: none;
}
.transfer-trigram {
  font-size: 0.72rem; font-weight: 750; letter-spacing: 0.04em;
  line-height: 1; color: var(--accent, #1e3459);
}
.transfer-arrow { color: var(--muted); margin: 0 2px; font-weight: 400; flex: none; }
.transfer-list-compact .amount { font-size: 0.8rem; font-weight: 650; }
.dash-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.dash-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.dash-col {
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}
.dash-col-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.dash-col-head h2 { font-size: 1rem; }
.dash-hero { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.dash-hero-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.dash-hero-line .dash-hero { margin: 0; min-width: 0; }
.dash-hero-pct {
  flex: none;
  font-size: 0.92rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: help;
}
.dash-delta { font-size: 0.82rem; }
.dash-metrics {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  padding: 10px 0 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}
.dash-metrics dt { color: var(--muted); font-weight: 400; }
.dash-metrics dd { font-weight: 650; margin: 0; font-variant-numeric: tabular-nums; }
.metric-pair { display: flex; flex-direction: column; gap: 2px; min-width: 5.5rem; }
.dash-meal-check {
  font-size: 0.78rem; color: var(--muted); margin: 0;
}
.dash-meal-check input[type="checkbox"] {
  min-height: 0; width: 16px; height: 16px; padding: 0;
}
.dash-settle .ratio-controls-compact { margin: 0; }
.dash-settle .ratio-bar { flex-wrap: wrap; }
.dash-balance-field {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface-elevated); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.dash-balance-field input { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ratio-controls {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px 14px;
  padding: 10px 12px; background: var(--surface-elevated);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 0.86rem;
}
.ratio-controls > label:not(.check) {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.ratio-controls > .check,
.ratio-controls > #ratio-agnes-pct {
  flex: none;
  white-space: nowrap;
}
.ratio-controls input[type="number"] { width: 4.5rem; min-height: 38px; padding: 6px 8px; }
@media (max-width: 640px) {
  .ratio-controls { flex-wrap: wrap; }
}
.ratio-controls-compact {
  justify-content: space-between; align-items: center;
  padding: 6px 10px; gap: 8px;
}
.ratio-bar {
  flex-wrap: nowrap; align-items: center;
}
.ratio-bar-main {
  margin: 0; flex: 1; min-width: 0;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px;
  font-size: 0.84rem; line-height: 1.25;
}
.ratio-bar-meta { font-size: 0.74rem; }
.ratio-bar-actions { display: inline-flex; gap: 4px; flex-shrink: 0; }
.ratio-chip-btn {
  font-size: 0.74rem; font-weight: 600;
  padding: 4px 9px; min-height: 0; line-height: 1.2;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--emboss-hi), var(--emboss-lo),
    1px 2px 6px rgba(18, 36, 28, 0.06);
  cursor: pointer;
}
.ratio-chip-btn.ghost { background: transparent; box-shadow: none; }
.ratio-chip-btn.accent {
  background: var(--accent, #1e3459); color: #fff; border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 4px 12px rgba(31, 90, 74, 0.22);
}
.ratio-readonly {
  display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0;
}
.ratio-readonly-values { font-size: 0.92rem; }
.ratio-readonly-kicker { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.ratio-readonly-label { margin: 0; width: 100%; font-size: 0.75rem; text-transform: uppercase; }
.ratio-controls-edit { flex-direction: column; align-items: stretch; gap: 10px; }
.ratio-edit-grid {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; width: 100%;
}
.ratio-from-field {
  display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; width: 100%;
}
.ratio-from-field .date-field { min-height: 38px; }
.ratio-edit-actions {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; width: 100%;
}
.ratio-saved-at { font-size: 0.75rem; display: block; margin-top: 2px; }
.ratio-file-history { width: 100%; margin-top: 10px; }
.ratio-history {
  list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px;
  font-size: 0.86rem;
}
.ratio-history .muted { font-size: 0.8rem; }
.dash-accordion {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-elevated); overflow: hidden;
}
.dash-accordion + .dash-accordion { margin-top: 8px; }
.dash-accordion summary {
  cursor: pointer; font-weight: 600; font-size: 0.9rem;
  padding: 12px 14px; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.dash-accordion summary::-webkit-details-marker { display: none; }
.dash-accordion summary::after {
  content: "";
  width: 0.42em; height: 0.42em; flex: none; margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.dash-accordion[open] summary::after {
  transform: rotate(225deg);
  margin-top: 0.2em;
}
.dash-accordion[open] summary { border-bottom: 1px solid var(--line); }
.dash-accordion .accordion-body { padding: 8px 14px 12px; }
.pre-salary-accordion { margin-top: 4px; }
.pre-salary-section-title {
  margin: 12px 0 8px; font-size: 0.78rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted);
}
.pre-salary-section-title:first-child { margin-top: 0; }
.pre-salary-section-early { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.pre-salary-list-early .pre-salary-hit { background: var(--surface-elevated); }
.pre-salary-help { margin: 0 0 10px; font-size: 0.8rem; line-height: 1.35; }
.pre-salary-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.pre-salary-hit {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
}
.pre-salary-hit.paid { opacity: 0.72; }
.pre-salary-hit.past:not(.paid) { border-color: #d4a574; }
/* Cases rondes mutualisées : dues avant salaire, participants, composition foyer */
.check-round,
.pre-salary-check {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  font-size: 0.86rem; cursor: pointer;
}
.check-round input[type="checkbox"],
.pre-salary-check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  min-width: 15px;
  min-height: 15px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  border: 1.5px solid rgba(20, 40, 30, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
}
.check-round input[type="checkbox"]:checked,
.pre-salary-check input[type="checkbox"]:checked {
  border-color: #1f8a4c;
  background: #3cb86a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23145c32' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M3.2 8.4l3.1 3.1 6.5-7'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
  box-shadow: none;
}
.check-round input[type="checkbox"]:focus-visible,
.pre-salary-check input[type="checkbox"]:focus-visible {
  outline: 2px solid #1f8a4c;
  outline-offset: 2px;
}
.check-round input[type="checkbox"]:disabled,
.pre-salary-check input[type="checkbox"]:disabled {
  opacity: 0.45;
  cursor: default;
}
.participant-field {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}
.participant-field legend {
  font-size: 0.86rem;
  margin-bottom: 6px;
  padding: 0;
}
.participant-checks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.participant-checks .check-round {
  flex: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}
.household-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.household-member {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}
.household-member .household-member-check {
  flex: 1 1 10rem;
  min-width: 0;
}
.household-member .household-default-check {
  flex: 0 1 auto;
  white-space: nowrap;
}
.pre-salary-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pre-salary-meta strong { font-weight: 600; line-height: 1.25; }
.pre-salary-hit .amount { font-size: 0.88rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-segments {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  background: var(--line); gap: 2px;
}
.cat-segments span { display: block; height: 100%; min-width: 4px; }
.legend-compact { font-size: 0.78rem; gap: 6px 10px !important; }

.kpi-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.kpi, .panel, .chart-card, .account-card {
  border-radius: var(--radius);
  padding: 16px;
}
.kpi-label { color: var(--muted); font-size: 0.82rem; }
.kpi-value { font-size: 1.5rem; font-weight: 700; margin: 4px 0; font-variant-numeric: tabular-nums; }
.panel, .chart-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }

.transfer-list, .balance-list, .line-list, .account-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.transfer-list li, .balance-list li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.transfer-list li:last-child, .balance-list li:last-child { border-bottom: 0; }
.balance-list.compact li { padding: 6px 0; font-size: 0.88rem; }
.balance-list li span:nth-child(2) { flex: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.amount { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.chart-wrap {
  height: 220px; margin-top: 4px; position: relative;
  touch-action: pan-y;
}
.chart-wrap.tall { height: 280px; }
.chart-wrap svg { width: 100%; height: 100%; display: block; cursor: crosshair; }
.chart-hit { touch-action: pan-y; }
.chart-hit.chart-brush-active { touch-action: none; }
.chart-today {
  stroke: var(--accent, #1f5a4a);
  stroke-width: 1.25;
  stroke-dasharray: 4 3;
  stroke-opacity: 0.95;
  pointer-events: none;
}
.chart-today-label {
  font-size: 10px;
  fill: var(--accent, #1f5a4a);
  font-weight: 650;
}
.chart-period-mark {
  stroke: #94a3b8;
  stroke-width: 1;
  stroke-dasharray: 2 3;
  stroke-opacity: 0.55;
  pointer-events: none;
}
.chart-period-mark.is-start { stroke: #0f766e; stroke-opacity: 0.5; }
.chart-period-mark.is-end { stroke: #c2410c; stroke-opacity: 0.5; }
.chart-period-mark.is-both { stroke: #64748b; stroke-opacity: 0.55; }
.chart-period-mark.is-active {
  stroke-opacity: 0.95;
  stroke-width: 1.35;
}
.chart-period-cap {
  fill: #94a3b8;
  fill-opacity: 0.7;
  pointer-events: none;
}
.chart-period-mark.is-start + .chart-period-cap { fill: #0f766e; }
.chart-period-mark.is-end + .chart-period-cap { fill: #c2410c; }
.chart-period-mark.is-both + .chart-period-cap { fill: #64748b; }
.chart-period-cap.is-active { fill-opacity: 1; }
.chart-brush {
  fill: rgba(30, 52, 89, 0.12);
  stroke: rgba(30, 52, 89, 0.35);
  stroke-width: 1;
  pointer-events: none;
}
.metric-pair-chart-reset dt { visibility: hidden; }
.metric-pair-chart-reset .dash-viewport-reset { font-size: 0.82rem; }
.chart-rule {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-opacity: 0.28;
  stroke-dasharray: 3 3;
}
.chart-hover-dot { fill: var(--surface); stroke-width: 1.75; }
.chart-tip {
  position: absolute;
  z-index: 2;
  min-width: 168px;
  max-width: min(260px, calc(100% - 16px));
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  pointer-events: none;
  font-size: 0.78rem;
  line-height: 1.35;
}
.chart-tip[hidden] { display: none; }
.chart-tip-date {
  font-weight: 650;
  margin: 0 0 6px;
  color: var(--ink);
}
.chart-tip ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.chart-tip li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-tip li span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-tip-events {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chart-tip-event {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
}
.chart-tip-event-verb {
  flex: none;
  font-weight: 650;
  color: var(--muted, #6b6f76);
}
.chart-tip-event.is-start .chart-tip-event-verb { color: #0f766e; }
.chart-tip-event.is-end .chart-tip-event-verb { color: #c2410c; }
.chart-tip-event-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-caption, .footer-note { font-size: 0.8rem; }

.evo-page { display: flex; flex-direction: column; gap: 14px; }
.evo-band-main .evo-chart {
  height: 66vh;
  min-height: 220px;
  max-height: 720px;
}
.evo-below {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.evo-general-head {
  margin-bottom: 10px;
}
.evo-general-head h2 { margin: 0; }
.evo-general-kind + .evo-general-kind {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.evo-general-kind-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.evo-general-kind-head h2 { margin: 0; font-size: 1.05rem; }
.evo-general-sub {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
}
.evo-upcoming-help {
  margin: 0 0 10px;
  font-size: 0.78rem;
}
.evo-upcoming-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(52vh, 560px);
  overflow: auto;
}
.evo-upcoming-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.evo-upcoming-item:hover,
.evo-upcoming-item:focus-visible {
  background: var(--surface-elevated);
  outline: none;
}
.evo-upcoming-kind-icon {
  width: 16px;
  height: 16px;
  display: block;
  opacity: 0.85;
}
.evo-upcoming-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.evo-upcoming-meta strong {
  font-size: 0.84rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.evo-upcoming-meta .muted {
  font-size: 0.72rem;
}
.evo-upcoming-item .amount {
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.evo-savings-head {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.evo-toolbar {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-end; gap: 10px 16px;
}
.evo-presets, .evo-range { display: flex; flex-wrap: wrap; gap: 6px; align-items: end; }
.evo-presets .ghost-btn { min-height: 36px; padding: 0 12px; font-size: 0.82rem; }
.settings-duration { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.settings-duration-label {
  margin: 0; font-size: 0.72rem; color: var(--muted); font-weight: 600;
}
.settings-duration-custom {
  display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px;
}
.settings-duration-custom-field {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.72rem; color: var(--muted); font-weight: 600;
}
.settings-duration-custom-field input {
  width: 7rem; min-height: 36px; padding: 4px 8px;
}
.settings-duration-custom-actions {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.settings-colors-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: end;
}
.settings-color-field {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  font-size: 0.78rem; color: var(--muted); font-weight: 600;
}
.settings-color-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-color-pick {
  display: flex; align-items: center; gap: 6px;
}
.settings-color-field .color-input {
  width: 2.75rem; height: 2.75rem; min-width: 44px; min-height: 44px;
  padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: transparent; cursor: pointer;
}
.settings-color-reset {
  width: 32px; min-width: 32px; min-height: 32px;
  font-size: 1rem; line-height: 1;
}
@media (max-width: 720px) {
  .settings-colors-row { grid-template-columns: 1fr; }
}
.ghost-btn.is-on {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-muted); font-weight: 650;
}
.evo-range label {
  display: flex; flex-direction: column; gap: 2px;
  font-size: 0.72rem; color: var(--muted); font-weight: 600;
}
.evo-range .date-field-input { min-height: 36px; padding: 4px 32px 4px 8px; }
.evo-chart { height: 260px; }
@media (max-width: 900px) {
  .evo-below { grid-template-columns: 1fr; }
  .evo-band-main .evo-chart {
    height: 50vh;
    max-height: 420px;
  }
}
.evo-chips {
  display: flex; flex-wrap: wrap; gap: 6px; padding-top: 4px;
}
.evo-chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: 0.78rem; cursor: pointer;
}
.evo-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.evo-chip.is-on {
  background: var(--accent-soft); border-color: var(--accent-muted);
  font-weight: 650;
}
.evo-chip:disabled { opacity: 1; cursor: default; font-weight: 650; }
.evo-panel h2 { margin-bottom: 8px; }
.evo-table-wrap {
  overflow: visible;
}
.evo-table {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.84rem;
}
.evo-table th, .evo-table td {
  padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.evo-table thead th {
  position: sticky;
  top: var(--sticky-under-topbar);
  z-index: 4;
  background: rgba(248, 252, 249, 0.94);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 1px 0 var(--line-strong);
}
.evo-table th:nth-child(2),
.evo-table th:nth-child(3),
.evo-table th:nth-child(4),
.evo-table td:nth-child(2),
.evo-table td:nth-child(3),
.evo-table td:nth-child(4) { text-align: right; }
.evo-table-lines th:nth-child(5),
.evo-table-lines td:nth-child(5) { text-align: right; }
.evo-table th:last-child, .evo-table td.evo-mini { text-align: right; width: 80px; }
.evo-line-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.evo-line-label-text { min-width: 0; }
.evo-acc-picto {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  padding: 1px 5px 1px 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2, #f6f7f9);
}
.evo-acc-logo {
  width: 16px; height: 16px; object-fit: contain; display: block;
  border-radius: 3px; background: #fff;
}
.evo-acc-dot { width: 10px; height: 10px; margin: 3px; }
.evo-acc-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}
.evo-day {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
  width: 4.6rem;
}
.evo-row { cursor: pointer; }
.evo-row:hover { background: var(--surface-elevated); }
.evo-row.is-on { background: var(--accent-soft); }
.evo-table .evo-cat-head th {
  padding-top: 12px; font-weight: 600; background: transparent;
  border-bottom: 1px solid var(--line-strong);
  text-align: left;
}
.evo-spark { width: 72px; height: 28px; display: block; margin-left: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 0.8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.filters {
  display: grid; grid-template-columns: 1fr;
  gap: 8px; border-radius: var(--radius);
  padding: 12px;
}
.search-field input {
  width: 100%;
  background: var(--surface-elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
}

.cat-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.2;
}
.cat-revenus { background: #e8f6ee; color: #1a7f4e; }
.cat-caf { background: #e3f4f1; color: #0f6b5c; }
.cat-impots { background: #fbf0e5; color: #9a4d14; }
.cat-banque { background: #eceef2; color: #4a4f57; }
.cat-immobilier, .cat-maison { background: #edf2e4; color: #4a5c28; }
.cat-quotidien { background: #fbefe0; color: #9a5410; }
.cat-kauri { background: #f6eed9; color: #7a5a12; }
.cat-manaia { background: #f0e8f8; color: #5f3f7a; }
.cat-assurances { background: #e5edf6; color: #2a4f7a; }
.cat-epargne { background: #e3efe8; color: #2a6654; }
.cat-erreur { background: #fae8e6; color: #a1322c; }
.cat-archive { background: #ecebe8; color: #5c5650; }
.cat-autre { background: #eeedeb; color: #5c5650; }

.cat-group {
  display: flex; flex-direction: column; gap: 8px;
  padding: 4px 0 10px 12px;
  border-left: 3px solid var(--line);
}
.cat-group-revenus { border-left-color: #1a7f4e; }
.cat-group-caf { border-left-color: #0f6b5c; }
.cat-group-impots { border-left-color: #9a4d14; }
.cat-group-banque { border-left-color: #4a4f57; }
.cat-group-immobilier, .cat-group-maison { border-left-color: #4a5c28; }
.cat-group-quotidien { border-left-color: #9a5410; }
.cat-group-kauri { border-left-color: #7a5a12; }
.cat-group-manaia { border-left-color: #5f3f7a; }
.cat-group-assurances { border-left-color: #2a4f7a; }
.cat-group-epargne { border-left-color: #2a6654; }
.cat-group-erreur { border-left-color: #a1322c; }
.cat-group-archive { border-left-color: #8a8580; }
.cat-group-autre { border-left-color: #5c5650; }
.cat-group-archive .line-row { opacity: 0.88; }
.cat-group-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 4px 2px 0; font-size: 0.95rem;
}
.cat-subhead, .property-kind-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin: 10px 0 6px; font-size: 0.9rem; font-weight: 650;
}
.housing-kind-block + .housing-kind-block { margin-top: 14px; }
.cat-list { display: flex; flex-direction: column; gap: 14px; }
.cat-breakdown li {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line);
}
.cat-breakdown li:last-child { border-bottom: 0; }
.cat-breakdown.compact li { padding: 6px 0; font-size: 0.88rem; }
.cat-breakdown li.cat-jump {
  cursor: pointer;
  border-radius: 8px;
  margin: 0 -6px;
  padding-left: 6px;
  padding-right: 6px;
}
.cat-breakdown li.cat-jump:hover,
.cat-breakdown li.cat-jump:focus-visible {
  background: var(--accent-soft);
  outline: none;
}
.evo-cat-block,
.evo-row[id^="evo-tablecat-"],
.evo-panel[id^="evo-section-"] {
  scroll-margin-top: 80px;
}
.evo-cat-block.is-anchor .evo-cat-head th,
.evo-row.is-anchor td {
  background: var(--accent-soft);
}

.line-row {
  width: 100%; display: flex; justify-content: space-between; gap: 12px;
  text-align: left; border-radius: var(--radius-sm); padding: 12px;
  cursor: pointer;
}
.line-row:hover { border-color: var(--line-strong); }
.form-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.86rem; }
.check { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea {
  background: rgba(255, 255, 255, 0.78); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 42px;
}
input[type="checkbox"],
input[type="radio"] {
  min-height: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  accent-color: var(--accent);
}
.date-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.date-field-input {
  width: 100%;
  padding-right: 36px;
  font-variant-numeric: tabular-nums;
}
.date-field-cal {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 8px;
}
.date-field-cal:hover { color: var(--ink); background: var(--surface-elevated); }
.date-field-cal svg { display: block; }
.date-field-pill { width: auto; }
.date-field-pill .date-field-input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 36px 8px 14px;
  min-height: 40px;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
}
.date-field-compact { width: 9.8rem; flex: none; }
.date-field-compact .date-field-input {
  min-height: 34px; font-size: 0.78rem; padding: 4px 32px 4px 8px;
}
textarea { min-height: 72px; resize: vertical; }
.name-input { flex: 1; min-height: 40px; }
.color-input { width: 40px; min-height: 40px; padding: 4px; }
.account-title { display: flex; align-items: center; gap: 8px; }
.account-card-compact {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.account-list { gap: 8px; }
.account-head-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  min-height: 32px;
}
.account-head-bar .acc-name-ro {
  flex: 1; min-width: 0; font-size: 0.92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.account-head-bar .acc-open-ro,
.account-head-bar .acc-amount-ro {
  margin-left: auto;
  font-size: 1rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.account-head-bar .acc-edit-btn { font-size: 0.8rem; padding: 0 6px; min-height: 32px; }
.account-head-bar .color-input { width: 32px; min-height: 32px; }
.account-head-bar .name-input { min-height: 34px; font-size: 0.88rem; }
.acc-readonly-meta {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.acc-readonly-meta .acc-edit-btn { margin-left: auto; flex-shrink: 0; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.icon-btn:hover { color: var(--accent); background: var(--accent-soft); }
.hist-toolbar { margin: 4px 0 8px; }
.hist-toolbar .ghost-btn { min-height: 34px; font-size: 0.82rem; }
.hist-add-form, .hist-edit-form { margin: 0 0 8px; }
.line-history-table .hist-edit-form { margin: 0; }
.acc-hist-add.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}
.acc-hist-add.form-row label { flex: 1 1 9rem; min-width: 8rem; }
.hist-form-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  flex: 1 1 auto;
}
.hist-form-actions .hist-delete-btn {
  margin-left: auto;
  color: var(--danger);
}
.account-edit-fields { display: flex; flex-direction: column; gap: 6px; }
.form-row-tight { gap: 8px; }
.form-row-tight label { font-size: 0.82rem; gap: 4px; }
.form-row-tight input, .form-row-tight select { min-height: 36px; font-size: 0.86rem; }
.check-tight { font-size: 0.82rem; margin: 0; }
.acc-spark-row {
  display: flex; align-items: center; gap: 8px; min-height: 44px;
}
.acc-spark-pct { font-size: 0.78rem; white-space: nowrap; flex-shrink: 0; }
.acc-spark {
  flex: 1; min-width: 0; height: 44px; display: block;
  border-radius: 6px; overflow: hidden;
}
.acc-spark-empty { margin: 0; font-size: 0.78rem; min-height: 28px; }
.acc-balance-live-wrap {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-left: auto; max-width: 100%;
}
.acc-balance-live-wrap .acc-open,
.acc-balance-live-wrap .acc-stock-live {
  width: 7.5rem; min-height: 34px; font-size: 0.86rem; font-weight: 600;
  text-align: right;
}
.acc-balance-live-wrap .date-field-compact { width: 9.8rem; }
.acc-balance-live-wrap .ghost-btn {
  min-height: 34px; padding: 0 8px; font-size: 0.74rem; white-space: nowrap;
}
@media (max-width: 640px) {
  .acc-balance-live-wrap { margin-left: 0; width: 100%; }
}
.hist-block.line-history,
.acc-balance-history.line-history {
  margin-top: 2px; padding: 8px 10px;
}
.hist-block .line-history-title,
.acc-balance-history .line-history-title { margin-bottom: 4px; font-size: 0.76rem; }
.hist-block .line-history-table,
.acc-balance-history .line-history-table { font-size: 0.8rem; }
.hist-block .line-history-table th,
.hist-block .line-history-table td,
.acc-balance-history .line-history-table th,
.acc-balance-history .line-history-table td { padding: 4px 4px 4px 0; }
.hist-block .line-history-delta,
.acc-balance-history .line-history-delta { margin-bottom: 6px; font-size: 0.8rem; }
.hist-block .acc-hist-add,
.acc-balance-history .acc-hist-add { margin-top: 6px; gap: 6px; }
.hist-block .acc-hist-add label,
.acc-balance-history .acc-hist-add label { font-size: 0.78rem; }
.hist-block .acc-hist-add input,
.acc-balance-history .acc-hist-add input { min-height: 34px; }
.hist-auto-check {
  flex: 0 0 auto;
  align-self: center;
  margin: 0;
  white-space: nowrap;
}
#settings-proratas .hist-block {
  margin: 12px 0;
  padding: 12px 14px;
}

.primary-btn, .secondary-btn, .danger-btn, .text-btn, .ghost-btn, .tab {
  min-height: 40px; border-radius: var(--radius-sm); border: 0;
  padding: 0 14px; cursor: pointer; font-size: 0.88rem;
}
.primary-btn { background: var(--accent); color: #fff; font-weight: 600; }
.primary-btn:hover { background: var(--accent-hover); }
.secondary-btn {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--emboss-hi), var(--emboss-lo),
    1px 2px 8px rgba(18, 36, 28, 0.06);
}
.ghost-btn {
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); box-shadow: var(--shadow);
}
.danger-btn { background: #fce9e9; color: var(--danger); }
.text-btn { background: transparent; color: var(--accent); padding: 0 8px; font-weight: 600; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

.sheet {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-end; justify-content: center; padding: 12px;
  background: rgba(18, 32, 26, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: sheet-overlay-in 0.32s ease;
}
.sheet-card {
  background: var(--surface-sheet);
  backdrop-filter: blur(28px) saturate(170%);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  width: min(640px, 100%); max-height: 92svh;
  overflow: hidden; border-radius: 16px 16px 8px 8px; padding: 0;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(16, 18, 22, 0.2);
  border: 1px solid var(--line);
  animation: sheet-card-in 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet-stage {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: min(640px, 100%);
  max-width: 100%;
  max-height: 92svh;
  min-width: 0;
  position: relative;
  transition: width 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet.is-drawer-open .sheet-stage {
  width: min(1012px, 100%);
}
.sheet-stage .sheet-card {
  flex: 0 1 auto;
  min-width: 0;
  width: min(640px, 100%);
}
.period-drawer-slot {
  flex: 0 0 auto;
  width: 0;
  margin-left: 0;
  max-height: 92svh;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  position: relative;
  z-index: 6;
  transition: width 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    margin-left 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet.is-drawer-open .period-drawer-slot {
  width: min(360px, calc(100vw - 36px));
  margin-left: 12px;
}
.period-drawer {
  width: min(360px, calc(100vw - 36px));
  max-height: 92svh;
  height: 100%;
  background: var(--surface-sheet);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-radius: 16px 16px 8px 8px;
  box-shadow: 0 20px 50px rgba(16, 18, 22, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 6;
  transform: translateX(28px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
}
.period-drawer.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.period-drawer-head {
  flex: none;
  padding: 14px 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.period-drawer-head h2 { font-size: 1rem; margin: 0; }
.period-drawer-sub { margin: 2px 0 0; font-size: 0.8rem; }
.period-drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.period-drawer-foot {
  flex: none;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.line-history-row.is-drawer-target td { background: var(--accent-soft); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sheet-head h2 { font-size: 1rem; margin: 0; }
.sheet-head-sticky {
  position: sticky; top: 0; z-index: 3;
  padding: 14px 16px 10px;
  background: var(--header-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(18, 36, 28, 0.05);
}
.sheet-body {
  flex: 1; min-height: 0; overflow: auto;
  padding: 12px 16px; display: flex; flex-direction: column; gap: 12px;
}
.sheet-foot-sticky {
  position: sticky; bottom: 0; z-index: 3;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--footer-glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(165%);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(18, 36, 28, 0.05);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
}
.sheet-foot-sticky .sheet-actions { padding-top: 0; flex-wrap: wrap; width: 100%; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.sheet-actions-edit { justify-content: flex-start; }
.sheet-action-end { margin-left: auto; }
.sheet-card.is-readonly .sheet-body input:not([type="checkbox"]):not([type="radio"]),
.sheet-card.is-readonly .sheet-body select,
.sheet-card.is-readonly .sheet-body textarea {
  background: var(--surface-2, #f6f7f9);
  color: var(--ink);
  cursor: default;
  opacity: 0.92;
}
.sheet-card.is-readonly .date-field-cal,
.sheet-card.is-readonly .hist-toolbar,
.sheet-card.is-readonly .line-history-actions {
  display: none;
}
.sheet-card.is-readonly .check { pointer-events: none; }

.sheet-head-meta {
  font-size: 0.78rem;
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: none;
}
.line-ro-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 8px;
  min-height: 44px;
  margin: 2px 0 6px;
}
.line-ro-amount {
  margin: 0;
  grid-column: 2;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 1.15;
  justify-self: center;
}
.line-ro-schedule {
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  min-width: 0;
}
@media (max-width: 420px) {
  .line-ro-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 4px;
  }
  .line-ro-amount {
    grid-column: 1;
    justify-self: start;
    font-size: 1.35rem;
    text-align: left;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .line-ro-schedule {
    grid-column: 2;
    grid-row: 1;
  }
}
.line-ro-schedule .evo-upcoming-kind-icon {
  width: 14px;
  height: 14px;
  opacity: 0.85;
}
.line-account-field .line-account-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.line-account-control .evo-acc-picto {
  flex: 0 0 auto;
}
.line-account-control select { flex: 1; min-width: 0; }
.sheet-card.is-readonly .line-account-control select {
  padding-left: 0.6rem;
}

.line-history {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2, #f6f7f9);
  border: 1px solid var(--line);
}
.line-history-title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.line-history-delta { margin: 0 0 10px; font-size: 0.86rem; }
.line-history-hint { margin: 10px 0 0; font-size: 0.78rem; line-height: 1.35; }
.line-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.line-history-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 6px 6px 0;
  border-bottom: 1px solid var(--line);
}
.line-history-table td {
  padding: 8px 6px 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  vertical-align: middle;
}
.line-history-actions { text-align: right; white-space: nowrap; }
.line-history-actions .text-btn { font-size: 0.78rem; padding: 0 4px; min-height: 28px; }
.line-history-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 8px;
}
.line-history-foot .ghost-btn { min-height: 34px; font-size: 0.82rem; }
.line-history-foot .line-history-hint { margin: 0; flex: 1; min-width: 12rem; }
.line-history-row.is-current td { background: var(--accent-soft); }
.line-sheet-spark { margin: 4px 0 8px; }
.sheet-body .line-history.panel-inset { margin: 0 0 10px; }
.line-history-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
}

.hist-block,
.acc-balance-history { margin-top: 12px; }
.hist-block > summary,
.acc-balance-history > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hist-block > summary::-webkit-details-marker,
.acc-balance-history > summary::-webkit-details-marker { display: none; }
.hist-block > summary::after,
.acc-balance-history > summary::after {
  content: "";
  width: 0.42em; height: 0.42em; flex: none; margin-left: auto;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.hist-block[open] > summary::after,
.acc-balance-history[open] > summary::after {
  transform: rotate(225deg);
  margin-top: 0.2em;
}
.acc-hist-add {
  margin-top: 10px;
  align-items: end;
}
.acc-hist-add .text-btn { margin-bottom: 2px; }
.prop-net-evolution { margin: 0 0 12px; font-size: 0.86rem; }

.asset-page { display: flex; flex-direction: column; gap: 14px; }
.asset-grid { display: flex; flex-direction: column; gap: 14px; }
.asset-card {
  border-radius: var(--radius); padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.asset-card.is-sold, .wealth-asset-card.is-sold { opacity: 0.88; }
.asset-card-photo-wrap {
  width: 100%; min-height: 120px; border-radius: 12px;
  background: #f7f7f8; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.asset-card-photo-wrap.is-car, .wealth-asset-photo-wrap.is-car { background: #fff; }
.asset-card-photo {
  width: 100%; max-height: 200px; object-fit: contain; display: block;
}
.asset-card-photo--empty {
  min-height: 96px; font-size: 2rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.asset-sold-badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 0.72rem; font-weight: 600; vertical-align: middle;
}
.asset-archive { margin-top: 8px; display: flex; flex-direction: column; gap: 12px; }
.asset-archive h2, .asset-archive-title { font-size: 0.95rem; margin: 8px 0 0; }
.asset-owner-set {
  border: 0; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
}
.asset-owner-set legend { font-size: 0.82rem; color: var(--muted); padding: 0; }
.check-sold { align-self: end; }
.acc-logo {
  width: 28px; height: 28px; object-fit: contain; flex: none;
  border-radius: 6px; background: #fff;
}
.legend .acc-logo { width: 18px; height: 18px; }
.asset-card-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.asset-card h2 { font-size: 1.15rem; }
.asset-card h3 { font-size: 0.88rem; margin: 4px 0 0; }
.asset-chart { height: 200px; margin: 0; }
.asset-cost {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.asset-cost p {
  display: flex; justify-content: space-between; gap: 12px;
  margin: 0; font-size: 0.88rem;
}
.asset-lines, .asset-events {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column;
}
.asset-lines li, .asset-events li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem;
}
.asset-lines li:last-child, .asset-events li:last-child { border-bottom: 0; }
.asset-line-checks { display: flex; flex-direction: column; gap: 6px; }
.asset-editor h3, #asset-editor h3 { font-size: 0.9rem; }
.asset-photo-field { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.asset-photo-row {
  display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start;
}
.asset-photo-preview {
  width: 120px; height: 90px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); overflow: hidden; display: flex; align-items: center;
  justify-content: center; font-size: 0.8rem;
}
.asset-photo-preview img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.asset-photo-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.wealth-asset-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-width: 0;
}
.wealth-asset-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
}
.wealth-asset-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.wealth-layout {
  display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start;
}
.wealth-archive { margin-top: 4px; }
.settings-page {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}
.settings-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0 4px;
  margin: 0 -2px;
  scrollbar-width: none;
}
.settings-nav::-webkit-scrollbar { display: none; }
.settings-nav-item {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
}
.settings-nav-item:hover {
  background: var(--surface-elevated);
}
.settings-nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.settings-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.settings-section {
  scroll-margin-top: calc(var(--sticky-under-topbar) + 12px);
}
.settings-danger {
  border-color: rgba(199, 62, 62, 0.28);
}
.settings-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.wealth-asset-photo-wrap {
  width: 100%;
  min-height: 108px;
  max-height: 168px;
  border-radius: 12px;
  overflow: hidden;
  background: #f7f7f8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.wealth-asset-photo {
  width: 100%;
  max-height: 168px;
  border-radius: 0;
  object-fit: contain;
  display: block;
  border: 0;
  background: transparent;
}
.wealth-asset-car {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  word-break: break-word;
}
.wealth-asset-photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 108px;
  font-size: 2rem;
  color: var(--muted);
}
.wealth-asset-head { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wealth-asset-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.wealth-asset-title-row h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  min-width: 0;
  flex: 1 1 auto;
}
.wealth-asset-edit {
  flex: none;
  font-size: 0.72rem;
  padding: 4px 10px;
}
.wealth-asset-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.wealth-asset-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.wealth-asset-stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.25;
}
.wealth-asset-stat-value {
  font-size: 0.92rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.wealth-asset-stat-value strong { font-size: 1rem; font-weight: 700; }
.wealth-asset-note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  word-break: break-word;
}
.wealth-assets-panel { min-width: 0; overflow: hidden; }
.wealth-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wealth-savings-panel { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wealth-savings-chart {
  width: 100%;
  height: 220px;
  min-height: 200px;
}
.wealth-savings-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wealth-savings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.wealth-savings-row:last-child { border-bottom: 0; }
.wealth-savings-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wealth-savings-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.wealth-savings-row-top strong {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wealth-savings-row .amount {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.wealth-savings-row .muted { font-size: 0.78rem; }
.wealth-savings-row .icon-btn { flex: none; }

/* Mobile bottom nav */
.mobile-only { display: none; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15;
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  background: transparent; color: var(--muted); font-size: 0.58rem;
  min-width: 0; min-height: 44px; padding: 8px 1px; line-height: 1.15;
  white-space: normal; text-align: center;
}
.tab.active { color: var(--accent); font-weight: 650; background: var(--accent-soft); border-radius: 8px; }

.wealth-net {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 4px; font-weight: 600;
}
.pie-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.pie-wrap {
  width: min(12.5rem, 100%);
  aspect-ratio: 1;
  min-height: 0;
  max-height: 12.5rem;
  margin: 0 auto;
  flex: none;
}
.pie-wrap svg { width: 100%; height: auto; display: block; }
.pie-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.pie-list .pie-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}
.pie-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pie-group-head, .pie-group ul li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 10px;
  font-size: 0.86rem;
  flex-wrap: wrap;
  min-width: 0;
}
.pie-group-head .amount,
.pie-group ul li .amount {
  flex: 0 1 auto;
  margin-left: auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  max-width: 100%;
  word-break: break-word;
}
.pie-group + .pie-group { border-top: 1px solid var(--line); padding-top: 12px; }
.pie-group-head { font-weight: 600; }
.pie-group ul {
  list-style: none; margin: 0; padding: 0 0 0 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.pie-group ul li { font-weight: 400; color: var(--muted); }
.pie-group ul .amount { color: var(--ink); }

/* Date picker (calendrier JJ/MM/AAAA) */
.dp-root {
  position: fixed; inset: 0; z-index: 90;
}
.dp-backdrop { position: absolute; inset: 0; background: transparent; }
.dp-pop {
  position: absolute;
  background: var(--surface-sheet);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(16, 18, 22, 0.18), 0 0 0 1px rgba(16, 18, 22, 0.06);
  padding: 10px 12px 12px;
  min-width: 268px;
  max-width: calc(100vw - 16px);
  color: var(--ink);
  animation: sheet-card-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.dp-pop.is-range { min-width: min(640px, calc(100vw - 16px)); }
.dp-layout { display: flex; align-items: stretch; }
.dp-presets {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 138px; padding: 4px 10px 4px 0;
  border-right: 1px solid var(--line);
}
.dp-preset {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px;
  padding: 7px 10px; min-height: 32px; font-size: 0.82rem;
  color: var(--ink); cursor: pointer;
}
.dp-preset:hover { background: #f4f5f7; }
.dp-preset.is-on { background: #eceef1; font-weight: 650; }
.dp-cals { display: flex; gap: 12px; padding-left: 10px; }
.dp-pop.is-single .dp-cals { padding-left: 0; }
.dp-pop.is-single .dp-presets { display: none; }
.dp-pop.is-single [data-dp-chip="end"] { display: none !important; }
.dp-cal { width: 252px; }
.dp-cal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 2px 0 8px; font-size: 0.88rem;
}
.dp-cal-head strong { font-weight: 650; letter-spacing: -0.02em; }
.dp-nav {
  width: 28px; height: 28px; min-height: 28px; border: 0; background: none;
  cursor: pointer; border-radius: 8px; color: var(--muted); font-size: 1.15rem;
  line-height: 1;
}
.dp-nav:hover { background: #f4f5f7; color: var(--ink); }
.dp-week, .dp-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  text-align: center;
}
.dp-week { font-size: 0.68rem; color: var(--muted); font-weight: 650; padding-bottom: 4px; }
.dp-cell {
  display: flex; align-items: center; justify-content: center;
  height: 36px;
}
.dp-cell.is-in-range { background: #f0f1f3; }
.dp-cell.is-range-start { border-radius: 999px 0 0 999px; }
.dp-cell.is-range-end { border-radius: 0 999px 999px 0; }
.dp-cell.is-range-start.is-range-end { border-radius: 999px; }
.dp-day {
  width: 32px; height: 32px; min-height: 32px; margin: 0;
  border: 0; background: none; border-radius: 50%;
  font-size: 0.82rem; cursor: pointer; color: inherit;
}
.dp-day.is-out { color: #c5c7cc; }
.dp-day.is-today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.dp-day.is-selected, .dp-day.is-selected.is-out {
  background: #15171a; color: #fff; font-weight: 650;
}
.dp-day.is-off { opacity: 0.35; cursor: default; }
.dp-day:not(.is-off):not(.is-selected):hover { background: #f4f5f7; }
.dp-foot {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line);
}
.dp-chip {
  width: 7.6rem; flex: none; min-height: 36px; border: 1px solid var(--line);
  border-radius: 10px; padding: 0 8px; font-size: 0.8rem;
  text-align: center; background: #fff; font-variant-numeric: tabular-nums;
}
.dp-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.dp-cancel {
  background: none; border: 0; color: var(--muted); min-height: 34px;
  padding: 0 10px; cursor: pointer; font-size: 0.86rem;
}
.dp-apply {
  background: #15171a; color: #fff; border: 0; border-radius: 999px;
  padding: 0 16px; min-height: 34px; font-weight: 650; cursor: pointer;
  font-size: 0.86rem;
}
.dp-pop.is-sheet {
  left: 10px !important; right: 10px !important; top: auto !important;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: auto; min-width: 0; max-height: min(86svh, 640px); overflow: auto;
}
.dp-pop.is-sheet .dp-layout { flex-direction: column; }
.dp-pop.is-sheet .dp-presets {
  flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
  min-width: 0; padding: 0 0 8px; border-right: 0;
  border-bottom: 1px solid var(--line); -webkit-overflow-scrolling: touch;
}
.dp-pop.is-sheet .dp-preset { width: auto; white-space: nowrap; }
.dp-pop.is-sheet .dp-cals {
  padding: 8px 0 0; justify-content: center; overflow-x: auto;
}
.dp-pop.is-sheet.is-range .dp-cal:last-child { display: none; }

@media (min-width: 900px) {
  body[data-page="dashboard"] {
    overflow: hidden;
  }
  body[data-page="dashboard"] .app,
  body[data-page="dashboard"] .shell {
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }
  body[data-page="dashboard"] .app-main {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 8px 24px 12px;
  }
  body[data-page="dashboard"] .topbar {
    flex-shrink: 0;
  }
  .dashboard-page {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .dash-hero-row {
    grid-template-columns: minmax(180px, 0.9fr) minmax(160px, 0.75fr) minmax(240px, 1.15fr);
    flex: 0 0 calc(100svh / 6);
    height: calc(100svh / 6);
    max-height: calc(100svh / 6);
    min-height: 0;
  }
  .dash-hero-card { overflow: hidden; }
  .dash-body {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .dash-main {
    flex: 1 1 auto;
    flex-direction: row;
    align-items: stretch;
    gap: 14px;
    min-height: 0;
  }
  .dash-main > .dash-chart-band {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    align-self: stretch;
  }
  .dash-main > .dash-flow {
    flex: 0 0 min(320px, 34vw);
    width: min(320px, 34vw);
    max-width: 340px;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    align-self: stretch;
    padding: 10px 12px;
    gap: 6px;
  }
  .dash-flow-toolbar { min-height: 28px; }
  .dash-flow-proj-btn { min-height: 28px; padding: 0 10px; font-size: 0.72rem; }
  .dash-flow .dash-hero { font-size: 1.2rem; }
  .dash-flow .dash-delta { font-size: 0.72rem; line-height: 1.25; }
  .dash-flow .dash-col-head h2 { font-size: 0.82rem; }
  .dash-flow .cat-breakdown.compact li { padding: 2px 0; font-size: 0.76rem; }
  .dash-flow .footer-note { font-size: 0.7rem; margin-top: 4px; }
  .dash-flow-block { gap: 4px; }
  .dash-flow-expenses { padding-top: 8px; }
  .dash-charge-groups { gap: 8px; }
  .dash-charge-head h3 { font-size: 0.7rem; }
  .dash-charge-total { font-size: 0.82rem; }
  .dashboard-page .dash-chart-band {
    padding: 10px 14px 10px;
    gap: 6px;
  }
  .dashboard-page .dash-chart-band .chart-wrap-wide {
    flex: 1 1 0;
    height: auto;
    min-height: 160px;
  }
  .dash-chart-band.evo-band:not(.evo-band-main) .evo-chart { height: 300px; }
  .app-main { padding: 8px 24px 32px; }
  body[data-page="dashboard"] .app-main { padding: 8px 24px 12px; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: 1.4fr repeat(4, 1fr); align-items: end; }
  .filters .search-field { grid-column: 1 / -1; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .chart-wrap { height: 240px; }
  .asset-grid { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .asset-card .asset-chart { height: 220px; }
  .wealth-asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .wealth-assets-panel .wealth-asset-grid,
  .wealth-archive .wealth-asset-grid { grid-template-columns: 1fr; }
  .pie-layout { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 10px 12px; }
  .wealth-layout .pie-layout { grid-template-columns: minmax(0, 1fr); }
  .sheet { align-items: center; }
  .sheet-card { border-radius: var(--radius); }
  .period-drawer { border-radius: var(--radius); }
  .wealth-layout { grid-template-columns: 1.1fr 0.9fr; }
  .settings-page {
    grid-template-columns: minmax(168px, 200px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
  }
  .settings-nav {
    position: sticky;
    top: calc(var(--sticky-under-topbar) + 8px);
    flex-direction: column;
    flex-wrap: nowrap;
    overflow: visible;
    gap: 4px;
    padding: 0;
    margin: 0;
  }
  .settings-nav-item {
    width: 100%;
    border-radius: var(--radius-sm);
    text-align: left;
    padding: 10px 12px;
    white-space: normal;
  }
}

@media (min-width: 1400px) and (min-height: 900px) {
  body[data-page="dashboard"] .app-main {
    padding: 4px 20px 12px;
  }
  body[data-page="dashboard"] .topbar {
    padding: 10px 20px 6px;
  }
  body[data-page="dashboard"] .topbar-title { font-size: 1.22rem; }
  body[data-page="dashboard"] .sidebar { padding: 14px 12px; }

  .dashboard-page { gap: 8px; }
  .dash-hero-card { padding: 8px 10px; gap: 2px; }
  .dash-hero-card .kpi-label { font-size: 0.74rem; }
  .dash-hero-amount { min-height: 36px; font-size: 1.12rem; padding: 4px 12px; }
  .dash-hero-save-btn,
  .dash-hero-settle-btn,
  .dash-hero-once-btn { width: 36px; min-width: 36px; height: 36px; min-height: 36px; }
  .dash-hero-btn-icon { width: 16px; height: 16px; }
  .dash-body { gap: 8px; }
  .dash-main { gap: 8px; }
  .dashboard-page .dash-chart-band {
    padding: 8px 12px 8px;
    gap: 4px;
  }
  .dashboard-page .dash-chart-band .chart-wrap-wide {
    min-height: 180px;
  }
  .dash-chart-band.evo-band:not(.evo-band-main) .evo-chart { height: 200px; }
  .dash-metrics { padding: 4px 0; font-size: 0.78rem; }
  .legend-compact { font-size: 0.72rem; }
  .dash-col {
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 10px 12px 8px;
    gap: 6px;
  }
  .dash-hero { font-size: 1.35rem; }
  .dash-delta { font-size: 0.74rem; line-height: 1.3; }
  .dash-flow { gap: 8px; }
  .dash-flow-block { gap: 4px; }
  .dash-flow-expenses { padding-top: 8px; }
  .dash-col-head h2 { font-size: 0.9rem; }
  .cat-breakdown.compact li { padding: 3px 0; font-size: 0.8rem; }
  .dash-accordion summary { padding: 8px 10px; font-size: 0.8rem; }
  .dash-accordion .accordion-body { padding: 6px 10px 8px; }
  .pre-salary-hit { padding: 4px 8px; gap: 6px; }
  .check-round,
  .pre-salary-check { font-size: 0.76rem; }
  .pre-salary-list { gap: 3px; }
  .pre-salary-help { font-size: 0.72rem; margin-bottom: 6px; }
  .pre-salary-section-title { margin: 8px 0 4px; font-size: 0.7rem; }
  .pre-salary-hit .amount { font-size: 0.76rem; }
  .dash-balance-field { padding: 6px 8px; gap: 4px; }
  .dash-balance-field input { font-size: 0.95rem; min-height: 34px; }
  .dash-meal-check { font-size: 0.72rem; }
  .ratio-controls { padding: 6px 8px; font-size: 0.78rem; }
  .ratio-bar-main { font-size: 0.78rem; }
  .transfer-list-compact li { padding: 2px 0; font-size: 0.74rem; }
  .footer-note { font-size: 0.72rem; }
  .kpi-value { font-size: 1.35rem; }
  .wealth-page { gap: 12px; }
  .wealth-asset-metrics { grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .wealth-asset-photo-wrap { max-height: 140px; min-height: 96px; }
  .wealth-asset-stat-label { font-size: 0.68rem; }
  .wealth-asset-stat-value { font-size: 0.86rem; }
  .wealth-asset-stat-value strong { font-size: 0.92rem; }
  .page { gap: 12px; }
  .page.dashboard-page { gap: 8px; }
}

@keyframes sheet-overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sheet-card-in {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes morph-out {
  to { opacity: 0; transform: scale(0.985); }
}
@keyframes morph-in {
  from { opacity: 0; transform: scale(1.015); }
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
::view-transition-old(main-pane) {
  animation: 0.4s cubic-bezier(0.22, 1, 0.36, 1) both morph-out;
}
::view-transition-new(main-pane) {
  animation: 0.45s cubic-bezier(0.22, 1, 0.36, 1) both morph-in;
}

@media (prefers-reduced-motion: reduce) {
  .period-drawer,
  .period-drawer-slot,
  .sheet-stage {
    transition: none;
  }
  .sheet, .sheet-card, .dp-pop {
    animation: none;
  }
  ::view-transition-old(root),
  ::view-transition-new(root),
  ::view-transition-old(main-pane),
  ::view-transition-new(main-pane) {
    animation: none;
  }
}

@media (max-width: 899px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .tabbar { display: grid; }
  .app-main { padding: 0 14px 88px; }
  .topbar {
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 10px;
    position: sticky;
    top: 0;
    z-index: 5;
  }
  .topbar-title { font-size: 1.25rem; }
  .topbar-settings { display: inline-flex; }
}

@media (max-width: 639px) {
  .period-drawer-slot {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(400px, calc(100% - 28px));
    margin-left: 0;
    overflow: visible;
    max-height: none;
    pointer-events: none;
  }
  .sheet.is-drawer-open .period-drawer-slot {
    width: min(400px, calc(100% - 28px));
    margin-left: 0;
    pointer-events: auto;
  }
  .period-drawer {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 16px;
    box-shadow: -16px 0 40px rgba(16, 18, 22, 0.18);
  }
}
