:root {
  /* ---- Coinest design-system tokens (canonical values, sampled from the
     source dashboard). App-level aliases below map onto these. ---- */
  --green-50:  #EEF6E8;
  --green-100: #DCF3D1;
  --green-200: #BFF997;
  --green-300: #B4F58C;
  --green-400: #8FDD5E;
  --green-500: #4F9C6C;
  --green-600: #2E6B54;
  --green-700: #21514A;
  --green-800: #1E4740;
  --green-900: #16332E;

  --neutral-0:   #FBFBFB;
  --neutral-50:  #EEF4EA;
  --neutral-100: #E3EAE1;
  --neutral-200: #D3DBD0;
  --neutral-300: #AEB8AB;
  --neutral-400: #8A948E;
  --neutral-500: #6B7873;
  --neutral-600: #4C5851;
  --neutral-700: #33403A;
  --neutral-800: #202B26;
  --neutral-900: #121A16;

  --red-50:  #FFEDEC;
  --red-100: #FFD9D8;
  --red-500: #D9534A;
  --red-600: #C0453D;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 999px;
  --shadow-card-ds: 0 1px 2px rgba(18, 26, 22, 0.04);
  --shadow-popover: 0 12px 32px rgba(18, 26, 22, 0.14), 0 2px 8px rgba(18, 26, 22, 0.06);
  --shadow-focus: 0 0 0 3px rgba(79, 156, 108, 0.35);

  /* ---- App semantic aliases, expressed in design-system tokens ---- */
  --sage: var(--neutral-100);
  --shell: var(--neutral-0);
  --sidebar: var(--neutral-50);
  --surface: var(--neutral-0);
  --surface-soft: #EDF3E9;
  --sunken: var(--neutral-100);

  --ink: var(--neutral-900);
  --muted: var(--neutral-500);
  --quiet: var(--neutral-400);
  --line: var(--neutral-100);
  --line-soft: #EAF0E7;

  --forest: var(--green-800);
  --forest-2: var(--green-700);
  --forest-soft: var(--green-100);
  --lime: var(--green-300);
  --lime-strong: var(--green-400);
  --mint-active: var(--green-300);

  --green: var(--green-600);
  --green-soft: var(--green-200);
  --red: var(--red-600);
  --red-soft: var(--red-100);
  /* Pending has no counterpart in the source palette (no orange anywhere);
     kept as a muted amber so the status stays legible, toned down on-brand. */
  --amber: #C98A2E;
  --amber-soft: #F3E7D2;
  --recurring: #2F6FA3;
  --recurring-soft: #DCECF7;

  --shadow-card: var(--shadow-card-ds);
  --shadow-shell: 0 24px 60px rgba(18, 26, 22, 0.10);
  --r-lg: var(--radius-lg);
  --r-md: var(--radius-md);
  --r-sm: var(--radius-sm);
  --r-xl: var(--radius-xl);
  --r-pill: var(--radius-full);
}

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

  --sage: #0e1713;
  --shell: #111d18;
  --sidebar: #0f1a16;
  --surface: #17231e;
  --surface-soft: #1d2d26;
  --sunken: #22342c;

  --ink: #EEF6E8;
  --muted: #AEB8AB;
  --quiet: #7F8E86;
  --line: rgba(220, 243, 209, 0.12);
  --line-soft: rgba(220, 243, 209, 0.08);

  --forest: #8FDD5E;
  --forest-2: #B4F58C;
  --forest-soft: rgba(180, 245, 140, 0.16);
  --lime: #B4F58C;
  --lime-strong: #BFF997;
  --mint-active: #B4F58C;

  --green: #8FDD5E;
  --green-soft: rgba(180, 245, 140, 0.18);
  --red: #FF8F87;
  --red-soft: rgba(217, 83, 74, 0.22);
  --amber: #F1BF6D;
  --amber-soft: rgba(201, 138, 46, 0.22);
  --recurring: #86BDE8;
  --recurring-soft: rgba(47, 111, 163, 0.24);

  --shadow-card: 0 1px 0 rgba(255,255,255,0.03), 0 18px 40px rgba(0,0,0,0.20);
  --shadow-shell: 0 24px 70px rgba(0,0,0,0.38);
  --shadow-popover: 0 18px 46px rgba(0,0,0,0.42), 0 2px 8px rgba(0,0,0,0.26);
  --shadow-focus: 0 0 0 3px rgba(180, 245, 140, 0.28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 18px;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--sage);
  font-family: Urbanist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

button, input, select, table { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  min-height: calc(100vh - 36px);
  background: var(--shell);
  border-radius: 28px;
  box-shadow: var(--shadow-shell);
  overflow: hidden;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 26px 18px;
  background: var(--sidebar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 26px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  color: var(--forest);
}
.brand-mark svg { display: block; width: 100%; height: 100%; }

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--forest);
}

.nav-list { display: grid; gap: 4px; min-width: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 46px;
  padding: 0 16px;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: var(--forest); background: var(--forest-soft); }
.nav-item.active {
  color: var(--forest);
  background: var(--mint-active);
  font-weight: 700;
}

/* ===================== WORKSPACE ===================== */
.workspace { min-width: 0; max-width: 100%; padding: 24px 28px 20px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.topbar h2 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; flex-shrink: 0; }

.topbar-tools { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* Compact "Atualizar" control: an icon trigger with a status dot that reveals a
   grouped-actions popover on hover or click. */
.update-control { position: relative; display: inline-flex; }
.update-trigger {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--forest);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(22, 58, 44, 0.22);
  transition: background .15s, transform .12s;
}
.update-trigger:hover { background: var(--forest-2); transform: translateY(-1px); }
.update-trigger svg { width: 19px; height: 19px; }

.update-dot {
  position: absolute;
  right: 6px; bottom: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--forest);
  background: var(--green-soft);
  transition: background .2s;
}
.update-dot[data-state="updating"] { background: var(--amber); animation: update-pulse 1s ease-in-out infinite; }
.update-dot[data-state="completed"] { background: var(--green); }
.update-dot[data-state="partial"] { background: var(--amber); }
.update-dot[data-state="failed"] { background: var(--red); }
/* Spin the refresh icon only while a run is in flight. */
.update-control:has(.update-dot[data-state="updating"]) .update-trigger svg { animation: cf-spin .9s linear infinite; }
@keyframes update-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.update-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 288px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-popover);
  z-index: 60;
}
.update-control:hover .update-menu,
.update-control.open .update-menu { display: block; }

.update-menu-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px 10px;
}
.update-menu-head strong { font-size: 13px; color: var(--ink); }
.update-state {
  font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--sunken); color: var(--muted);
}
.update-state[data-state="updating"] { background: var(--amber-soft); color: var(--amber); }
.update-state[data-state="completed"] { background: var(--forest-soft); color: var(--forest-2); }
.update-state[data-state="partial"] { background: var(--amber-soft); color: var(--amber); }
.update-state[data-state="failed"] { background: var(--red-soft); color: var(--red); }

.update-action {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 0; border-radius: var(--r-md);
  background: transparent;
  text-align: left; cursor: pointer;
  transition: background .12s;
}
.update-action:hover { background: var(--forest-soft); }
.update-action:disabled { opacity: .5; cursor: progress; }
.update-action .ua-main { display: flex; flex-direction: column; gap: 1px; }
.update-action .ua-title { font-size: 13px; font-weight: 700; color: var(--ink); }
.update-action .ua-sub { font-size: 11px; color: var(--muted); }
.update-action .ua-time { font-size: 11px; color: var(--muted); white-space: nowrap; }

.update-progress {
  display: flex; align-items: center; gap: 8px;
  margin: 6px 4px 2px;
  padding: 8px 8px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px; color: var(--muted);
}
.update-spinner {
  width: 13px; height: 13px;
  border: 2px solid var(--forest-soft);
  border-top-color: var(--forest);
  border-radius: 50%;
  animation: cf-spin .8s linear infinite;
}
@keyframes cf-spin { to { transform: rotate(360deg); } }

.round-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--sunken);
  color: var(--forest);
  transition: background .15s;
}
.round-button.sm { width: 40px; height: 40px; }
.round-button:hover { background: var(--forest-soft); }
.round-button svg { width: 19px; height: 19px; }
.round-button.has-dot::after {
  content: "";
  position: absolute;
  top: 12px; right: 13px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--sunken);
}

.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 6px; }
.user-meta { display: grid; text-align: right; line-height: 1.2; }
.user-meta strong { font-size: 14px; font-weight: 700; }
.user-meta span { font-size: 12px; color: var(--muted); }

.avatar {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.avatar-user {
  background: linear-gradient(150deg, var(--forest-2), var(--forest));
  color: var(--lime);
}

#theme-toggle.is-dark {
  background: var(--forest);
  color: var(--neutral-900);
}
#theme-toggle.is-dark:hover { background: var(--forest-2); }

/* ===================== GRID ===================== */
.grid {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.col { display: grid; gap: 24px; min-width: 0; }

.panel {
  padding: 26px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.panel-head h3 { margin: 0; font-size: 16px; font-weight: 700; }

/* ===================== LEGAL / PUBLIC DOCUMENTS ===================== */
body.legal-page {
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(220, 243, 209, 0.46), transparent 34%),
    var(--sage);
}

.legal-shell {
  width: min(920px, 100%);
  margin: 0 auto;
}

.legal-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 18px;
  color: var(--forest);
  text-decoration: none;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.legal-brand .brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.legal-card {
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-shell);
}

.legal-hero {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.legal-eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.legal-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(32px, 6vw, 54px);
  line-height: 1;
  font-weight: 850;
}

.legal-updated {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 650;
}

.legal-card section + section { margin-top: 26px; }

.legal-card h2 {
  margin: 0 0 10px;
  color: var(--forest);
  font-size: 19px;
  line-height: 1.2;
  font-weight: 800;
}

.legal-card p,
.legal-card li {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.legal-card p { margin: 0; }
.legal-card p + p { margin-top: 12px; }

.legal-card ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 22px;
}

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  font-size: 13px;
}
.link-button svg { width: 15px; height: 15px; }

.select-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.select-pill.ghost { background: var(--surface-soft); border-color: transparent; }
.select-pill svg { width: 15px; height: 15px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 8px; }

/* ===================== NUBANK API ===================== */
.nubank-panel {
  background: linear-gradient(145deg, #ffffff 0%, #faf6ff 100%);
  border-color: #eee3f7;
}
.nubank-panel .panel-head { align-items: flex-start; margin-bottom: 12px; }
.nubank-title { display: flex; align-items: center; gap: 10px; }
.nubank-title h3 { line-height: 1.1; }
.nubank-provider { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.nubank-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #820ad1;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.05em;
}
.pluggy-panel {
  background: linear-gradient(145deg, #ffffff 0%, #f2f8f6 100%);
  border-color: #dcefe8;
}
.pluggy-mark { background: #0d9d73; }
.gmail-bills-panel {
  background: linear-gradient(145deg, #ffffff 0%, #f5f8ff 100%);
  border-color: #dce7f8;
}
.gmail-bills-mark {
  background: #1a73e8;
  letter-spacing: 0;
}
.gmail-bills-panel .nubank-primary { background: #1a73e8; }
.gmail-bills-panel .nubank-primary:hover { background: #155fc0; }
.gmail-bills-panel .nubank-secondary { border-color: #d4e1f7; color: #155fc0; }
.gmail-bills-panel .nubank-secondary:hover { background: #f5f8ff; }
.gmail-bills-panel .nubank-meta { background: rgba(26, 115, 232, 0.06); color: #4e607d; }
.nubank-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.nubank-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--quiet);
}
.nubank-status.connected { color: var(--green); background: var(--green-soft); }
.nubank-status.connected::before { background: var(--green); }
.nubank-status.error { color: var(--red); background: var(--red-soft); }
.nubank-status.error::before { background: var(--red); }
.nubank-summary { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.nubank-meta {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: rgba(130, 10, 209, 0.055);
  color: #665873;
  font-size: 11px;
  line-height: 1.45;
}
.nubank-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.nubank-primary,
.nubank-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 700;
}
.nubank-primary { border: 0; background: #820ad1; color: #fff; }
.nubank-primary:hover { background: #6f08b4; }
.nubank-secondary { border: 1px solid #e4d5ef; background: #fff; color: #6f08b4; }
.nubank-secondary:hover { background: #faf5fd; }
.nubank-primary svg,
.nubank-secondary svg { width: 15px; height: 15px; }
.nubank-primary:disabled,
.nubank-secondary:disabled { opacity: .6; cursor: progress; }
.nubank-primary.loading svg,
.nubank-secondary.loading svg { animation: cf-spin .8s linear infinite; }
.nubank-link { border: 0; padding: 5px 2px; background: transparent; color: var(--red); font-size: 11px; }
.nubank-link:hover { text-decoration: underline; }
.nubank-privacy { display: block; margin-top: 13px; color: var(--quiet); font-size: 10px; line-height: 1.45; }

/* ---- Source placeholders (Itaú, Ticket, Swile) ---- */
.source-card .panel-head { align-items: flex-start; margin-bottom: 12px; }
.source-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.source-title h3 { line-height: 1.1; }
.source-provider { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.source-mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.mark-itau { background: #ec7000; }
.mark-ticket { background: #e4002b; }
.mark-swile { background: #f4574b; }
.source-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.source-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--quiet);
}
.source-status.ready { background: var(--green-soft); color: var(--forest); }
.source-status.ready::before { background: var(--green); }
.source-summary { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.source-import-meta { margin-top: 10px; color: var(--quiet); font-size: 11px; font-weight: 650; }
.source-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.source-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--forest);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.source-primary:hover:not(:disabled) { background: var(--surface-soft); }
.source-primary svg { width: 15px; height: 15px; }
.source-primary:disabled { opacity: .55; cursor: not-allowed; }
.source-privacy { display: block; margin-top: 13px; color: var(--quiet); font-size: 10px; line-height: 1.45; }

/* Swile / Ticket photo import */
.manual-import-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 32, 26, .52);
  backdrop-filter: blur(3px);
}
.manual-import-modal[hidden] { display: none; }
.manual-import-card {
  width: min(1180px, calc(100vw - 40px));
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 22px;
  padding: 28px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}
.manual-import-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.manual-import-head h3 { margin: 3px 0 5px; font-size: 22px; }
.manual-import-head p { margin: 0; color: var(--muted); font-size: 12px; }
.manual-import-kicker { color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.manual-format-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.manual-format {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--sunken);
}
.manual-format > svg { width: 20px; color: var(--muted); }
.manual-format div { display: grid; gap: 2px; }
.manual-format b { color: var(--ink); font-size: 12px; }
.manual-format span { color: var(--quiet); font-size: 10px; }
.manual-format.active { border-color: var(--green); background: var(--green-soft); }
.manual-format.active > svg, .manual-format.active span { color: var(--forest); }
.manual-format.upcoming { opacity: .62; }
.manual-owner-field { display: grid; gap: 8px; margin-bottom: 16px; }
.manual-owner-field > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.manual-owner-field select {
  width: min(340px, 100%);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.manual-dropzone {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 190px;
  padding: 25px;
  border: 1.5px dashed var(--forest-soft);
  border-radius: 18px;
  background: var(--sunken);
  text-align: center;
  cursor: pointer;
}
.manual-dropzone.dragging { border-color: var(--green); background: var(--green-soft); }
.manual-dropzone b { font-size: 14px; }
.manual-dropzone > span:last-child { color: var(--quiet); font-size: 11px; }
.manual-drop-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: var(--surface); color: var(--forest); }
.manual-drop-icon svg { width: 23px; }
.manual-import-note { display: flex; align-items: center; gap: 7px; margin: 13px 0 0; color: var(--quiet); font-size: 10.5px; }
.manual-import-note svg { flex: 0 0 auto; width: 14px; }
.manual-import-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 22px; }
.manual-import-actions .source-primary { min-height: 42px; padding: 0 17px; background: var(--forest); border-color: var(--forest); color: #fff; }
.manual-import-actions .source-primary:hover:not(:disabled) { background: var(--forest-2); }
.manual-import-actions .source-primary.loading svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.manual-review-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.manual-review-summary > div { display: grid; gap: 5px; padding: 13px 15px; border-radius: 13px; background: var(--sunken); }
.manual-review-summary span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.manual-review-summary strong { color: var(--ink); font-size: 17px; }
.manual-review-summary .mismatch strong { color: var(--red); }
.manual-selection-summary { width: max-content; max-width: 100%; margin: -4px 0 12px; }
.manual-review-alert { margin-bottom: 14px; padding: 11px 13px; border-radius: 11px; background: #fff4d9; color: #765414; font-size: 11px; font-weight: 650; }
.manual-review-table-wrap { overflow: auto; max-height: 48vh; border: 1px solid var(--line-soft); border-radius: 14px; }
.manual-review-table { width: 100%; min-width: 1500px; border-collapse: collapse; font-size: 11px; }
.manual-review-table th { position: sticky; top: 0; z-index: 1; padding: 10px 8px; background: var(--sunken); color: var(--muted); text-align: left; white-space: nowrap; }
.manual-review-table td { padding: 8px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.manual-review-table tr.low-confidence { background: #fffaf0; }
.manual-review-table tr.possible-duplicate { background: #fff3f1; }
.manual-review-table tr.excluded { opacity: .48; }
.manual-review-table input:not([type="checkbox"]), .manual-review-table select {
  width: 100%; min-width: 105px; min-height: 35px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 11px;
}
.manual-review-table input[data-field="merchantName"] { min-width: 180px; }
.manual-review-table input[data-field="originalDescription"] { min-width: 220px; }
.manual-review-table input[data-field="amountCents"] { min-width: 110px; text-align: right; }
.manual-review-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--forest); }
.manual-confidence { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: var(--green-soft); color: var(--forest); font-weight: 800; }
.manual-confidence.low { background: #fff0ce; color: #835c0e; }
.manual-duplicate-label { display: block; margin-top: 4px; color: var(--red); font-size: 9px; font-weight: 800; white-space: nowrap; }

@media (max-width: 700px) {
  .manual-import-modal { padding: 8px; }
  .manual-import-card { width: 100%; max-height: 96vh; padding: 20px 15px; border-radius: 17px; }
  .manual-format-grid { grid-template-columns: 1fr; }
  .manual-review-summary { grid-template-columns: 1fr; }
}

/* ===================== CREDIT CARD ===================== */
.credit-card {
  display: grid;
  gap: 22px;
  padding: 22px;
  border-radius: var(--r-lg);
  color: #fff;
  background: linear-gradient(155deg, #1e4636 0%, #16352a 60%, #122c22 100%);
  background-image:
    radial-gradient(140px 140px at 88% 8%, rgba(170,221,110,.16), transparent 70%),
    linear-gradient(155deg, #1e4636 0%, #16352a 60%, #122c22 100%);
  box-shadow: 0 18px 36px rgba(22, 53, 42, 0.32);
}
.cc-top { display: flex; align-items: center; justify-content: space-between; }
.cc-logo { display: grid; grid-template-columns: repeat(2,1fr); gap: 3px; width: 26px; height: 26px; }
.cc-logo span { border-radius: 4px; background: var(--lime); }
.cc-logo span:nth-child(1) { border-radius: 50% 4px 4px 4px; }
.cc-logo span:nth-child(4) { border-radius: 4px 4px 50% 4px; }
.cc-mastercard { display: inline-flex; }
.cc-mastercard i { width: 26px; height: 26px; border-radius: 50%; display: block; }
.cc-mastercard i:first-child { background: #eb6c4d; }
.cc-mastercard i:last-child { background: #f2b13c; margin-left: -11px; mix-blend-mode: screen; }

.cc-name { margin: 0; font-size: 21px; font-weight: 700; }
.cc-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.cc-balance span { display: block; font-size: 12px; color: rgba(255,255,255,.62); margin-bottom: 4px; }
.cc-balance strong { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.cc-meta { display: flex; gap: 18px; }
.cc-meta span { display: block; font-size: 10px; color: rgba(255,255,255,.55); letter-spacing: .06em; }
.cc-meta b { font-size: 13px; }

/* ===================== QUICK ACTIONS ===================== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.quick-actions button {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 8px 4px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.quick-actions button:hover { background: var(--surface-soft); color: var(--forest); }
.qa-icon {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 13px;
  background: var(--forest-soft);
  color: var(--forest);
}
.qa-icon svg { width: 19px; height: 19px; }

/* ===================== PROGRESS ===================== */
.progress {
  height: 9px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--lime-strong), var(--lime));
}

.limit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.limit-row p { margin: 0; font-size: 13px; color: var(--muted); }
.limit-row p strong { color: var(--ink); font-weight: 700; }
.limit-row b { font-size: 14px; }

/* ===================== SAVING PLANS ===================== */
.saving-total { margin-bottom: 18px; }
.saving-total span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.saving-total strong { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }

.plan { display: grid; gap: 10px; padding: 14px 0; border-top: 1px solid var(--line); }
.plan-head { display: flex; align-items: center; gap: 10px; }
.plan-head b { font-size: 14px; font-weight: 600; flex: 1; }
.plan-icon {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--sunken);
  color: var(--forest);
}
.plan-icon svg { width: 17px; height: 17px; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.plan-foot b { color: var(--ink); font-weight: 700; }

/* ===================== STAT CARDS ===================== */
.stat-caption {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 14px 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.stat-caption .stat-caption-year { color: var(--muted); font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stat-card {
  display: grid;
  gap: 12px;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--forest-soft);
  color: var(--forest);
}
.stat-icon svg { width: 19px; height: 19px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
}
.badge svg { width: 13px; height: 13px; }
.badge.up { color: var(--green-800); background: var(--green-soft); }
.badge.down { color: var(--red); background: var(--red-soft); }
.stat-card strong { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card small { font-size: 13px; color: var(--muted); }

/* ===================== CASHFLOW ===================== */
.cf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cf-tabs { display: flex; align-items: center; gap: 18px; min-width: 0; }
.cf-tab {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--quiet);
  font-size: 15px;
  font-weight: 600;
  transition: color .15s;
}
.cf-tab:hover { color: var(--muted); }
.cf-tab.active { color: var(--ink); font-weight: 800; }
.cf-sep { width: 1px; height: 18px; background: var(--line); }

.cf-controls { display: flex; align-items: center; gap: 10px; }
.chart-type,
.limit-chart-type {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--sunken);
}
.chart-type button,
.limit-chart-type button {
  display: grid;
  place-items: center;
  width: 32px; height: 30px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.chart-type button svg,
.limit-chart-type button svg { width: 16px; height: 16px; }
.chart-type button.active,
.limit-chart-type button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 2px 6px rgba(22, 36, 29, 0.12);
}
.cf-period {
  height: 36px;
  padding: 0 32px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a877d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 12px center;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}
.cf-period:focus { border-color: var(--forest); }

.cf-range { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cf-range .cf-period { padding: 0 26px 0 10px; font-size: 12px; }
.cf-range-sep { color: var(--muted); font-weight: 700; padding: 0 2px; }

.cf-summary { margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 12px; }
.big { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 2px; }

.chart-legend { display: flex; gap: 16px; font-size: 12px; font-weight: 600; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.joao { background: var(--forest); }
.dot.matheus { background: var(--lime-strong); }

.cashflow-chart { width: 100%; min-height: 240px; }
.cashflow-chart svg { display: block; width: 100%; height: auto; }
.cf-axis { fill: var(--quiet); font-size: 11.5px; font-weight: 650; }
.cf-grid { stroke: var(--line); stroke-width: 1; }
.cf-zero-grid { stroke: color-mix(in srgb, var(--forest) 28%, var(--line)); stroke-width: 1.25; }
.cf-empty { color: var(--muted); font-size: 13px; padding: 40px 0; text-align: center; }

.cf-bar-joao { fill: var(--forest); }
.cf-bar-matheus { fill: var(--lime-strong); }
.cf-bar-joao, .cf-bar-matheus { transition: opacity .15s; }
.cf-line-joao { fill: none; stroke: var(--forest); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.cf-line-matheus { fill: none; stroke: var(--lime-strong); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.cf-dot-joao { fill: var(--forest); }
.cf-dot-matheus { fill: var(--lime-strong); }
.cf-col { cursor: pointer; }
.cf-col:hover .cf-bar-joao, .cf-col:hover .cf-bar-matheus { opacity: .78; }
.cf-col.hover-line { fill: rgba(22, 53, 42, 0.05); }

.cf-guide-line { stroke: var(--forest); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .4; }
.cf-guide-dot { stroke: #fff; stroke-width: 3; paint-order: stroke; }

.chart-tooltip {
  position: fixed;
  z-index: 50;
  transform: translate(-50%, -100%);
  pointer-events: none;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(22,36,29,.16);
  font-size: 12px;
  min-width: 130px;
}
.chart-tooltip .tt-title { font-weight: 700; margin-bottom: 8px; }
.chart-tooltip .tt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); }
.chart-tooltip .tt-row b { color: var(--ink); }
.chart-tooltip .tt-hint {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.highcharts-container,
.highcharts-root {
  font-family: inherit !important;
  overflow: visible !important;
}
.highcharts-tooltip-container {
  z-index: 100000 !important;
  pointer-events: none;
}
.highcharts-tooltip,
.highcharts-label.highcharts-tooltip,
.highcharts-tooltip span {
  z-index: 100000 !important;
  overflow: visible !important;
}
.hc-fixed-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 2147483647;
  pointer-events: none;
}
.hc-fixed-tooltip[hidden] {
  display: none !important;
}
body.privacy-on .hc-fixed-tooltip {
  display: none !important;
}
.hc-tt {
  min-width: 140px;
  max-width: min(270px, calc(100vw - 24px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(22,36,29,.16);
  color: var(--ink);
  font-size: 12px;
}
.hc-tt-title {
  margin-bottom: 8px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.hc-tt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}
.hc-tt-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.hc-tt-row b {
  color: var(--ink);
  font-weight: 850;
  text-align: right;
}
.hc-tt-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.hc-tt-hint {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

/* ===================== TABLE ===================== */
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--neutral-50);
  white-space: nowrap;
}
tbody td { padding: 14px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.tx-name b, .tx-date b { display: block; font-size: 13px; font-weight: 700; }
.tx-name span, .tx-date span { font-size: 12px; color: var(--muted); }
.note { color: var(--muted); max-width: 220px; }
.tx-amount.outflow { color: var(--red); }
.tx-amount.inflow { color: var(--green); }
.tx-empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.status {
  display: inline-flex;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.status.failed { color: var(--red); background: var(--red-soft); }
.status.completed { color: var(--green-800); background: var(--green-soft); }
.status.pending { color: var(--amber); background: var(--amber-soft); }

/* ===================== STATISTIC / DONUT ===================== */
.stat-panel .panel-head { flex-wrap: wrap; gap: 10px; }
.stat-period { display: flex; gap: 8px; margin-left: auto; }
.stat-period .cf-period { height: 34px; padding: 0 30px 0 12px; font-size: 12px; }

.stat-mode {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: var(--surface-soft);
  border-radius: var(--r-pill);
}
.stat-mode-btn {
  flex: 1;
  height: 32px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.stat-mode-btn.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 2px 6px rgba(22, 36, 29, 0.12);
}

.stat-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.stat-tabs[hidden] { display: none; }
.stat-tab {
  flex: 1;
  padding: 0 4px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.stat-tab small { color: var(--quiet); font-weight: 600; }
.stat-tab.active { color: var(--forest); border-bottom-color: var(--forest); }
.stat-tab.active small { color: var(--green); }

.donut-wrap {
  position: relative;
  width: 210px;
  margin: 6px auto 22px;
}
.donut { width: 100%; }
.donut svg { display: block; width: 100%; height: auto; overflow: visible; }
.donut-seg {
  cursor: pointer;
  transform: translate(0, 0);
  transition: transform .16s ease, opacity .16s ease;
}
.donut-seg:hover,
.donut-seg.active {
  transform: translate(var(--px, 0), var(--py, 0));
}
.donut-wrap:hover .donut-seg:not(.active):not(:hover) { opacity: .55; }
.donut-center { transition: none; pointer-events: none; }
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.donut-center span { font-size: 12px; color: var(--muted); }
.donut-center strong { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }

.category-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.category-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
}
.cat-chip {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}
.cat-name { font-size: 13px; font-weight: 600; }
.category-list b { font-size: 14px; font-weight: 700; }
.cat-empty { display: block; padding: 12px 0; color: var(--muted); font-size: 13px; }
.stat-tab { cursor: pointer; }
.category-list li {
  cursor: pointer;
  border-radius: 10px;
  padding-left: 8px;
  padding-right: 8px;
  margin: 0 -8px;
  transition: background .15s ease;
}
.category-list li.active { background: var(--surface-soft); }

/* ===================== RECENT ACTIVITY ===================== */
.activity-day { margin: 8px 0 10px; font-size: 13px; font-weight: 700; color: var(--ink); }
.activity-list { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 16px; position: relative; }
.activity-list li { display: flex; gap: 12px; align-items: flex-start; }
.activity-list p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.activity-list p b { color: var(--ink); font-weight: 700; }
.activity-list span { font-size: 12px; color: var(--quiet); }
.activity-list .avatar { width: 36px; height: 36px; font-size: 12px; }

/* ============= DASHBOARD: BIGGEST EXPENSES / MINI LISTS ============= */
.mini-empty { margin: 12px 0 0; color: var(--muted); font-size: 13px; }

.biggest-list { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 16px; }
.biggest-list li { display: flex; align-items: center; gap: 12px; }
.b-icon {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--forest-soft);
  color: var(--forest);
  flex: none;
}
.b-icon svg { width: 18px; height: 18px; }
.b-info { flex: 1; min-width: 0; }
.b-info b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-info span { font-size: 12px; color: var(--muted); }
.b-amount { font-size: 14px; font-weight: 700; color: var(--red); white-space: nowrap; }
.biggest-empty { display: block; padding: 12px 0; color: var(--muted); font-size: 13px; }

/* ===================== FOOTER ===================== */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 18px;
  font-size: 13px;
  color: var(--muted);
}
.footer p { margin: 0; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: min(400px, calc(100vw - 40px));
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--forest);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 16px 40px rgba(22, 36, 29, 0.28);
}
.toast.error { background: #b5442f; }

/* ===================== VIEW: CARTÕES ===================== */
.cards-tab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cards-invest-summary {
  font-size: 12px;
  font-weight: 700;
}
/* Toggle sits on the right even when the summary is empty. */
.cards-tab-head .flow-toggle { margin-left: auto; }

.cards-top {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.cards-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.cards-overview-row {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* ---- Column 1: My Cards ---- */
.mycards-panel .panel-head { margin-bottom: 16px; }
/* minmax(0,1fr) pins each tile to the column width; without it the tiles size to
   their (wide) content and spill into the next column. Cap the height so the top
   row stays balanced no matter how many cards are synced — extras scroll. */
.mycards-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
}
.mycards-list::-webkit-scrollbar { width: 6px; }
.mycards-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: var(--r-pill); }
.mycards-list::-webkit-scrollbar-track { background: transparent; }
.mycards-empty { font-size: 13px; color: var(--muted); margin: 0; padding: 20px 0; text-align: center; }

/* ---- Holder groups (collapsible "Cartões João / Matheus") ---- */
.mc-group { display: grid; gap: 12px; align-content: start; }
.mc-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  transition: background .15s ease, border-color .15s ease;
}
.mc-group-head:hover { border-color: var(--forest-soft); }
.mc-group.open .mc-group-head { background: var(--sunken); }
.mc-group-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mc-group-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.mc-group-heading { display: grid; gap: 2px; min-width: 0; }
.mc-group-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.mc-group-label b { font-weight: 800; color: var(--ink); }
.mc-group-count { font-size: 11.5px; font-weight: 600; color: var(--quiet); }
.mc-group-caret {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform .18s ease;
}
.mc-group.open .mc-group-caret { transform: rotate(180deg); }
.mc-group-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.mc-group:not(.open) .mc-group-body { display: none; }

/* ---- Account row (flat list item — NOT a card tile) ---- */
.mc-account {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--forest-soft);
  cursor: pointer;
  color: var(--ink);
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .14s ease;
}
.mc-account:hover { transform: translateX(2px); border-left-color: var(--forest); }
.mc-account.active { background: var(--sunken); border-color: var(--forest-soft); border-left-color: var(--forest); }
.mc-acc-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
}
.mc-acc-info { display: grid; gap: 2px; min-width: 0; flex: 1; }
.mc-acc-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-acc-type { font-size: 11px; font-weight: 600; color: var(--muted); }
.mc-acc-amount { display: grid; justify-items: end; gap: 2px; flex: none; }
.mc-acc-label { font-size: 10.5px; font-weight: 600; color: var(--muted); }
.mc-acc-amount strong { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }

/* Wallet tiles follow the design-system BalanceCard: a calm mint surface when
   idle, the dark forest hero treatment when selected. */
.mc-card {
  position: relative;
  display: grid;
  gap: 18px;
  min-width: 0;
  min-height: 168px;
  padding: 20px;
  border-radius: var(--r-lg);
  background: var(--neutral-50);
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}
.mc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: var(--neutral-200); }
.mc-card.active {
  background:
    radial-gradient(150px 120px at 88% 6%, rgba(180, 245, 140, 0.18), transparent 70%),
    linear-gradient(158deg, var(--green-700) 0%, var(--green-800) 58%, var(--green-900) 100%);
  border-color: transparent;
  color: var(--green-50);
  box-shadow: 0 18px 38px rgba(18, 26, 22, 0.26);
}
.mc-card.active:hover { border-color: transparent; }
.mc-card.active .mc-name,
.mc-card.active .mc-amount strong,
.mc-card.active .mc-num,
.mc-card.active .mc-field b { color: #fff; }
.mc-card.active .mc-amount-label,
.mc-card.active .mc-type,
.mc-card.active .mc-field span { color: rgba(238, 246, 232, 0.72); }

.mc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.mc-issuer { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mc-mark {
  display: grid;
  place-items: center;
  width: 30px; height: 22px;
  border-radius: 6px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}
.mc-name { font-size: 13px; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mc-amount { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-width: 0; }
.mc-value { display: grid; gap: 2px; min-width: 0; }
.mc-amount-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.mc-amount strong { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; }
.mc-type { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

.mc-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-width: 0; }
.mc-num { font-size: 14px; font-weight: 700; letter-spacing: 0.16em; font-variant-numeric: tabular-nums; white-space: nowrap; opacity: .92; }
.mc-field { display: grid; gap: 1px; text-align: right; flex-shrink: 0; }
.mc-field span { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--quiet); font-weight: 700; }
.mc-field b { font-size: 12px; font-weight: 700; }

/* Card network marks (top-right of each tile) */
.net-visa { font-style: italic; font-weight: 800; font-size: 15px; letter-spacing: 0.02em; color: #1a1f71; }
.mc-card.active .net-visa { color: #fff; }
.net-mc { display: inline-flex; align-items: center; }
.net-mc i { width: 18px; height: 18px; border-radius: 50%; display: block; }
.net-mc i:first-child { background: #eb001b; }
.net-mc i:last-child { background: #f79e1b; margin-left: -8px; mix-blend-mode: multiply; }
.mc-card.active .net-mc i:last-child { mix-blend-mode: screen; }

/* ---- Column 2: Current accounts + account flow ---- */
.cards-mid { display: grid; gap: 16px; align-content: start; }

.accounts-panel .panel-head { margin-bottom: 14px; }
.accounts-stack { display: grid; gap: 10px; }
.accounts-empty {
  margin: 0;
  padding: 26px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.accounts-empty.compact { padding: 12px 0 2px; text-align: left; }

.account-group {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.account-group-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
}
.account-group-head:hover { background: var(--sunken); }
.account-group-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.account-group-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}
.account-group-text { display: grid; gap: 2px; min-width: 0; }
.account-group-title { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-group-count { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.account-group-value {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.account-group-caret {
  width: 17px;
  height: 17px;
  color: var(--muted);
  transition: transform .18s ease;
}
.account-group.open .account-group-caret { transform: rotate(180deg); }
.account-group-body {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}
.account-group:not(.open) .account-group-body { display: none; }

.account-total-breakdown { display: grid; gap: 6px; }
.account-total-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: baseline;
  padding: 10px 2px;
  border-top: 1px solid var(--line-soft);
}
.account-total-row:first-child { border-top: 0; }
.account-total-row span { font-size: 13px; font-weight: 800; }
.account-total-row small {
  grid-column: 1;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}
.account-total-row strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 14px;
}

.account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 2px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background .15s, box-shadow .15s;
}
.account-item:first-child { border-top: 0; }
.account-item:hover { background: var(--surface-soft); }
.account-item.active {
  background: var(--sunken);
  box-shadow: inset 3px 0 0 var(--forest);
}
.account-item:focus-visible {
  outline: 2px solid var(--lime-strong);
  outline-offset: 2px;
}
.account-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.account-item-text { display: grid; gap: 1px; min-width: 0; flex: 1; }
.account-item-text b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-item-text span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-item-amount { flex: none; font-size: 14px; font-weight: 800; white-space: nowrap; }

.card-insights-panel {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  height: 625px;
  min-height: 560px;
  padding: 22px;
}
.cards-insights-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cards-insights-head > div:first-child {
  min-width: 0;
}
.cards-insights-head h3 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 800;
}
.cards-insight-caption {
  display: block;
  line-height: 1.35;
}
.cards-insights-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--sunken);
}
.cards-insights-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
  transition: background .15s, color .15s, box-shadow .15s;
}
.cards-insights-toggle button svg {
  width: 15px;
  height: 15px;
}
.cards-insights-toggle button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 2px 6px rgba(22, 36, 29, 0.12);
}
.cards-insight-view {
  flex: 1;
  min-height: 0;
}
.cards-insight-view.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.cards-insight-toolbar,
.account-flow-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.flow-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.flow-toggle input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}
.flow-toggle-track {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  border: 1px solid var(--line);
  transition: background .15s, border-color .15s;
}
.flow-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 5px rgba(22, 36, 29, 0.18);
  transition: transform .18s ease;
}
.flow-toggle input:checked + .flow-toggle-track {
  background: var(--forest);
  border-color: var(--forest);
}
.flow-toggle input:checked + .flow-toggle-track::after { transform: translateX(16px); }
.flow-toggle input:focus-visible + .flow-toggle-track { outline: 2px solid var(--lime-strong); outline-offset: 2px; }
.account-flow-range { justify-content: flex-end; }
.account-flow-range.cf-range { gap: 3px; flex-wrap: nowrap; }
.account-flow-range .cf-period {
  width: 58px;
  height: 34px;
  padding: 0 18px 0 8px;
  font-size: 11.5px;
}
#account-flow-start-year,
#account-flow-end-year { width: 62px; }
.account-flow-summary {
  display: grid;
  gap: 0;
  margin: 4px 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background:
    linear-gradient(180deg, rgba(238, 246, 232, .5), rgba(251, 251, 251, .98));
  overflow: hidden;
}
.flow-metric-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 13px 15px;
}
.flow-metric-card + .flow-metric-card { border-top: 1px solid var(--line); }
.flow-metric-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--quiet);
}
.flow-metric-icon svg { width: 16px; height: 16px; }
.flow-metric-income .flow-metric-icon { color: var(--green-600); border-color: var(--green-100); background: var(--green-100); }
.flow-metric-expense .flow-metric-icon { color: var(--forest); }
.flow-metric-net .flow-metric-icon { color: var(--ink); }
.flow-metric-label {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.flow-metric-label > span {
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
}
.flow-metric-prev {
  overflow: hidden;
  color: var(--quiet);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-metric-figure {
  display: grid;
  gap: 4px;
  justify-items: end;
  flex: none;
  text-align: right;
}
.flow-metric-card strong {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#account-flow-income { color: var(--green-600); }
#account-flow-expense { color: var(--forest); }
#account-flow-net { color: var(--ink); }
#account-flow-net.negative { color: var(--red); }
.flow-metric-delta {
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}
.flow-metric-delta.positive {
  background: var(--green-100);
  color: var(--green-700);
}
.flow-metric-delta.negative {
  background: var(--red-50);
  color: var(--red);
}
.flow-metric-delta.neutral {
  background: var(--surface-soft);
  color: var(--muted);
}
.account-flow-legend {
  align-items: center;
  flex-wrap: wrap;
  margin: 0 0 2px;
}
.line-dot.net {
  display: inline-block;
  width: 16px;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--neutral-700);
  box-shadow: 7px 0 0 -5px var(--neutral-700);
}
.partial-mark {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(201, 138, 46, .38);
  border-radius: 4px;
  background: rgba(201, 138, 46, .14);
}
.partial-legend { color: var(--quiet); }
.account-flow-note {
  margin: 0;
  color: var(--quiet);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.45;
}

.card-detail-panel { display: grid; gap: 18px; }
.cd-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cd-action {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 14px 6px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--green-50);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  transition: background .14s ease, border-color .14s ease;
}
.cd-action:hover { border-color: var(--green-200); background: var(--green-100); }
.cd-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--forest); color: #fff; }
.cd-ico i { width: 18px; height: 18px; }

.cd-number { display: grid; gap: 6px; padding-top: 16px; border-top: 1px solid var(--line); }
.cd-key { font-size: 11px; color: var(--muted); font-weight: 600; }
.cd-number strong { font-size: 20px; font-weight: 800; letter-spacing: 0.16em; font-variant-numeric: tabular-nums; }

.cd-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cd-fields > div { display: grid; gap: 3px; }
.cd-fields span { font-size: 11px; color: var(--muted); font-weight: 600; }
.cd-fields b { font-size: 14px; font-weight: 700; }
.cd-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
}
.cd-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.cards-empty { font-size: 13px; color: var(--muted); margin: 0; padding: 30px 0; text-align: center; }

/* ---- Spending limits ---- */
.spending-panel .panel-head { margin-bottom: 14px; }
.spend-bar { display: flex; gap: 6px; height: 16px; margin-bottom: 14px; }
.spend-seg { border-radius: var(--r-pill); min-width: 3px; }
.spend-seg.used { background: var(--forest); }
.spend-seg.free { background: var(--lime); }
.spend-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spend-row p { margin: 0; font-size: 13px; color: var(--muted); }
.spend-row p strong { color: var(--ink); font-weight: 800; }
.spend-pct { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.spend-figure { display: grid; gap: 2px; }
.spend-figure span { font-size: 12px; color: var(--muted); font-weight: 600; }
.spend-figure strong { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.spend-note { margin: 12px 0 0; font-size: 11px; color: var(--quiet); line-height: 1.45; }

/* ---- Account flow chart ---- */
.card-cashflow-panel { display: flex; flex-direction: column; }
.card-cf-legend { display: flex; gap: 16px; font-size: 12px; font-weight: 600; color: var(--muted); margin: 2px 0 10px; }
.card-cf-legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot.income { background: var(--lime-strong); }
.dot.expense { background: var(--forest); }
.card-cashflow { flex: 1; width: 100%; min-height: 320px; }
.account-cashflow {
  width: 100%;
  min-height: 0;
  margin: 0 auto;
}
.card-cashflow svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.ccf-income {
  fill: #8fdd5e;
  opacity: .86;
  transition: opacity .15s, filter .15s;
}
.ccf-expense {
  fill: var(--forest);
  opacity: .9;
  transition: opacity .15s, filter .15s;
}
.ccf-col:hover .ccf-income,
.ccf-col:hover .ccf-expense {
  opacity: 1;
  filter: drop-shadow(0 4px 7px rgba(18, 26, 22, .12));
}
.ccf-col.hover .ccf-hit { fill: rgba(22, 53, 42, 0.05); }
.ccf-hit { fill: transparent; cursor: pointer; }
.ccf-grid {
  stroke: var(--line);
  stroke-width: 1;
  opacity: .58;
}
.ccf-zero {
  stroke: var(--neutral-400);
  stroke-width: 1.5;
  opacity: .58;
}
.ccf-axis { fill: var(--quiet); font-size: 11.5px; font-weight: 650; }
.ccf-month { font-weight: 800; }
.ccf-empty {
  display: grid;
  place-items: center;
  min-height: 300px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.ccf-net-line {
  fill: none;
  stroke: var(--neutral-700);
  stroke-width: 2.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ccf-net-dot {
  fill: var(--green-600);
  stroke: var(--surface);
  stroke-width: 2.4;
}
.ccf-net-dot.negative { fill: var(--red); }
.ccf-guide-line {
  stroke: var(--neutral-700);
  stroke-width: 1.4;
  stroke-dasharray: 5 5;
  opacity: .46;
}
.ccf-guide-dot {
  fill: var(--neutral-700);
  stroke: var(--surface);
  stroke-width: 3;
}
.ccf-partial-label {
  fill: var(--amber);
  font-size: 9.5px;
  font-weight: 850;
  text-transform: uppercase;
}
.ccf-callout {
  fill: var(--green-700);
  font-size: 10px;
  font-weight: 850;
}

/* ---- Spending limit evolution ---- */
.limit-summary { margin-bottom: 0; }
.limit-chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.limit-range { justify-content: flex-end; }
.limit-range.cf-range { gap: 3px; flex-wrap: nowrap; }
.limit-range .cf-period {
  width: 58px;
  height: 34px;
  padding: 0 18px 0 8px;
  font-size: 11.5px;
}
#limit-start-year,
#limit-end-year { width: 62px; }
.limit-chart { flex: 1; min-height: 320px; }
.limit-chart svg { height: 100%; }
.limit-line {
  stroke: var(--amber);
  stroke-width: 2;
  stroke-dasharray: 6 5;
  opacity: .86;
}
.limit-label {
  fill: var(--amber);
  font-size: 11px;
  font-weight: 800;
}

/* ---- Month projection ---- */
.proj-legend { margin: 0 0 2px; font-size: 13px; }
.line-dot.proj-dot-actual,
.line-dot.proj-dot-proj,
.line-dot.proj-dot-hist {
  display: inline-block;
  width: 16px;
  height: 3px;
  border-radius: var(--r-pill);
}
.line-dot.proj-dot-actual { background: var(--forest); }
.line-dot.proj-dot-proj {
  height: 0;
  border-top: 3px dotted var(--green-500);
  border-radius: 0;
}
.line-dot.proj-dot-hist { background: var(--neutral-400); }
.proj-chart { flex: 1; min-height: 320px; }
.proj-chart svg { height: 100%; }
.limit-chart .cf-axis,
.proj-chart .cf-axis,
.account-cashflow .ccf-axis {
  font-size: 12.5px;
  font-weight: 700;
}
.limit-chart .cf-grid,
.proj-chart .cf-grid,
.account-cashflow .ccf-grid {
  stroke-width: 1;
  opacity: .72;
}
.proj-line-hist {
  fill: none;
  stroke: var(--neutral-400);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.proj-line-actual {
  fill: none;
  stroke: var(--forest);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.proj-line-proj {
  fill: none;
  stroke: var(--green-500);
  stroke-width: 2.5;
  stroke-dasharray: 2 6;
  stroke-linecap: round;
}
.proj-today-line {
  stroke: var(--quiet);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: .5;
}
.proj-today-dot { fill: var(--forest); stroke: #fff; stroke-width: 3; paint-order: stroke; }
.proj-guide-line { stroke: var(--forest); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .4; }
.proj-guide-dot { stroke: #fff; stroke-width: 3; paint-order: stroke; }
.proj-guide-dot.actual { fill: var(--forest); }
.proj-guide-dot.hist { fill: var(--neutral-400); }

@container (max-width: 560px) {
  .cards-insights-head,
  .cards-insight-toolbar,
  .account-flow-toolbar {
    justify-content: flex-start;
  }
  .cards-insights-toggle {
    width: 100%;
    max-width: 100%;
  }
  .cards-insights-toggle button {
    flex: 1;
    justify-content: center;
  }
  .account-flow-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .limit-range.cf-range,
  .account-flow-range.cf-range {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .flow-metric-card { padding: 12px 13px; }
  .flow-metric-card strong { font-size: 18px; }
}

/* ---- Selected card transactions ---- */
.cards-tx-panel { padding: 20px; margin-bottom: 16px; }
.cards-tx-panel .panel-head { align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.cards-tx-panel .panel-head > div:first-child { min-width: 0; }
.cards-tx-panel h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cards-tx-panel .tx-table thead th { cursor: default; }
.cards-tx-panel .tx-table thead th::after { display: none; }
.cards-tx-context { display: block; margin-top: 3px; font-size: 12px; }
.cards-tx-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.cards-tx-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 7px 5px 10px;
  border: 1px solid var(--forest-soft);
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  color: var(--forest);
  font-size: 12px;
  font-weight: 700;
}
.cards-tx-filter button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
}
.cards-tx-filter svg { width: 13px; height: 13px; }
.cards-tx-panel .tx-table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: auto;
}
.cards-tx-panel .tx-table {
  min-width: 940px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.cards-tx-panel .tx-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--quiet);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
.cards-tx-panel .tx-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.cards-tx-panel .tx-table tbody tr:last-child td { border-bottom: 0; }
.cards-tx-panel .tx-table tbody tr { transition: background .15s ease; }
.cards-tx-panel .tx-table tbody tr:hover { background: var(--surface-soft); }
.cards-tx-panel .tx-table tbody tr.selected { background: var(--green-50); }
.cards-tx-panel .tx-table th:nth-child(3),
.cards-tx-panel .tx-table td:nth-child(3) { display: none; }
.cards-tx-panel .tx-name { gap: 10px; min-width: 220px; }
.cards-tx-panel .tx-cat-icon {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  background: var(--green-50);
  border: 1px solid var(--line-soft);
}
.cards-tx-panel .tx-cat-icon i { width: 15px; height: 15px; }
.cards-tx-panel .tx-datetime b,
.cards-tx-panel .tx-name b { font-weight: 850; }
.cards-tx-panel .tx-note-cell {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cards-tx-panel .tx-status {
  padding: 4px 9px;
  font-size: 11px;
}
.cards-tx-status-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cards-tx-rule-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.cards-tx-rule-btn:hover {
  border-color: var(--forest-soft);
  background: var(--sunken);
  color: var(--forest);
}
.cards-tx-rule-btn svg { width: 14px; height: 14px; }
.cards-tx-foot { margin: 14px 0 0; font-size: 12px; color: var(--quiet); }
.cards-tx-foot:empty { display: none; }

/* ---- Spending rules ---- */
.spending-admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.spending-rules-panel { padding: 18px; }
.spending-rules-head { align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.spending-rules-head .link-button {
  flex: none;
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--green-soft);
}
.sp-rule-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
}
.sp-rule-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.sp-rule-form label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.sp-rule-field.wide,
.sp-rule-actions { grid-column: 1 / -1; }
.sp-rule-form input,
.sp-rule-form select {
  width: 100%;
  height: 38px;
  border: 1px solid #d8e0d4;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 0 11px;
  outline: none;
}
.sp-rule-form input:focus,
.sp-rule-form select:focus {
  border-color: var(--forest-soft);
  box-shadow: 0 0 0 2px rgba(155, 212, 89, .22);
}
.sp-rule-form select:disabled {
  background: var(--sunken);
  color: var(--quiet);
}
.sp-rule-exclude {
  align-self: end;
  justify-self: start;
  display: inline-flex !important;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 8px !important;
  height: 38px;
  padding: 0 10px;
}
.sp-rule-exclude input {
  width: 16px;
  height: 16px;
  padding: 0;
}
.sp-rule-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.sp-rule-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border-radius: var(--r-pill);
  padding: 0 14px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.sp-rule-actions .btn svg { width: 15px; height: 15px; }
.sp-rule-actions .btn.primary {
  background: var(--forest);
  color: #fff;
}
.sp-rule-actions .btn.ghost {
  background: transparent;
  border-color: #d8e0d4;
  color: var(--muted);
}
.sp-rule-actions .btn:disabled { opacity: .7; cursor: progress; }
.sp-rules-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}
.sp-rule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.sp-rule-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.sp-rule-main b {
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-rule-main small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}
.sp-rule-target {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: var(--r-pill);
  padding: 0 10px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11.5px;
  font-weight: 800;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-rule-target.exclude {
  background: var(--red-soft);
  color: var(--red);
}
.sp-rule-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sp-rule-row-actions button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.sp-rule-row-actions button:hover {
  background: var(--sunken);
  color: var(--forest);
}
.sp-rule-row-actions svg { width: 15px; height: 15px; }
.sp-rule-empty {
  margin: 0;
  padding: 22px 0 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---- Spending by category over time ---- */
.spending-panel { margin-bottom: 16px; padding: 22px; }
.spending-head { align-items: flex-start; }
.spending-head h3 { margin: 0 0 3px; }
.spending-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.spending-viz {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--sunken);
}
.spending-viz button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.spending-viz button svg { width: 15px; height: 15px; }
.spending-viz button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 2px 6px rgba(22, 36, 29, 0.12);
}
.spending-range.cf-range { gap: 3px; flex-wrap: nowrap; }
.spending-range .cf-period { width: 58px; height: 34px; padding: 0 18px 0 8px; font-size: 11.5px; }
#spending-start-year,
#spending-end-year { width: 62px; }

.spending-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 10px;
}
.spending-category-col {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
.spending-month-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--green-100);
  border-radius: var(--r-md);
  background: var(--green-50);
}
.spending-col-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--quiet);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.spending-month-total {
  display: grid;
  gap: 2px;
}
.spending-month-total span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.spending-month-total strong {
  color: var(--ink);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.spending-share-strip { min-width: 0; }
.spending-strip-track {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 14px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  overflow: hidden;
}
.spending-strip-seg {
  min-width: 4px;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  opacity: .86;
  transition: opacity .15s ease, transform .15s ease;
}
.spending-strip-seg:hover,
.spending-strip-seg.active {
  opacity: 1;
  transform: scaleY(1.4);
}
.spending-category-list {
  width: 100%;
  gap: 6px;
}
.spending-category-list li {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 56px;
  margin: 0;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface);
}
.spending-category-list li:hover,
.spending-category-list li.active {
  border-color: var(--forest-soft);
  background: var(--sunken);
}
.spending-category-list .cat-chip {
  min-width: 38px;
  height: 24px;
  border-radius: 8px;
}
.spending-category-list .cat-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.spending-category-list .cat-name {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spending-category-list .cat-meta {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spending-category-list .cat-bar {
  display: block;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--line-soft);
  overflow: hidden;
}
.spending-category-list .cat-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.spending-time-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.spending-time { min-width: 0; }
.spending-insights {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.spending-insight {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
  padding: 0 18px;
}
.spending-insight:first-child { padding-left: 0; }
.spending-insight:last-child { padding-right: 0; }
.si-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.si-head-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--green-50);
  color: var(--forest);
  border: 1px solid var(--line-soft);
}
.si-head-icon svg { width: 15px; height: 15px; }
.si-head h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spending-insight + .spending-insight {
  border-left: 1px solid var(--line-soft);
}
.si-list { display: grid; gap: 4px; }
.si-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}
.si-row:first-child { border-top: 0; padding-top: 0; }
.si-row span,
.si-kpis div { min-width: 0; }
.si-row b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.si-row small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.si-row strong {
  color: var(--forest);
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
}
.si-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}
.si-kpis div {
  display: grid;
  gap: 2px;
  padding-top: 7px;
  border-top: 1px solid var(--line-soft);
}
.si-kpis div:first-child,
.si-kpis div:nth-child(2) { border-top: 0; padding-top: 0; }
.si-kpis span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.si-kpis strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.si-empty {
  margin: 0;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
}
.si-merchants-chart {
  display: block;
  width: 100%;
  min-height: 230px;
}
.si-merchants { display: grid; gap: 8px; }
.si-merchant-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.si-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--forest);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.si-merchant-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.si-merchant-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.si-merchant-main b {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12.8px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.si-merchant-title em {
  flex: none;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  font-size: 9.5px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.2;
}
.si-merchant-title em.new {
  background: var(--green-100);
  color: var(--green-700);
}
.si-merchant-title em.recurring {
  background: var(--recurring-soft);
  color: var(--recurring);
}
.si-merchant-title em.committed {
  background: var(--amber-soft);
  color: var(--amber);
}
.si-merchant-title em.mixed {
  background: var(--surface-soft);
  color: var(--muted);
}
.si-merchant-main small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.si-merchant-main i {
  display: block;
  width: var(--w);
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--c, var(--forest));
}
.si-merchant-split {
  display: flex;
  width: var(--w);
  max-width: 100%;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--line-soft);
  overflow: hidden;
}
.si-merchant-split span { display: block; height: 100%; }
.si-merchant-split .new { background: var(--green-500); }
.si-merchant-split .recurring { background: var(--recurring); }
.si-merchant-split .committed { background: var(--amber); }
.si-merchant-breakdown {
  font-size: 10.5px !important;
  color: var(--quiet) !important;
}
.si-merchant-card strong {
  color: var(--forest);
  font-size: 12.8px;
  font-weight: 850;
  white-space: nowrap;
}
.sm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  max-height: 344px;
  overflow-y: auto;
  padding-right: 2px;
}
.sm-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.sm-card:hover { border-color: var(--sage); box-shadow: var(--shadow-card); }
.sm-card.active { border-color: var(--forest); box-shadow: 0 0 0 1px var(--forest); }
.sm-card.dimmed { opacity: .45; }
.sm-head { display: flex; align-items: center; gap: 6px; }
.sm-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.sm-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sm-delta {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.sm-delta.up { background: var(--red-soft); color: var(--red); }
.sm-delta.down { background: var(--green-soft); color: var(--green); }
.sm-delta.flat,
.sm-delta.neutral { background: var(--sunken); color: var(--muted); }
.sm-figure {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 6px 0 5px;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink);
}
.sm-sub { font-size: 11px; font-weight: 600; color: var(--quiet); }
.sm-svg { width: 100%; height: 42px; display: block; }
.sm-bar { opacity: .55; transition: opacity .12s; }
.sm-bar.current { opacity: 1; }
.sm-svg:hover .sm-bar { opacity: .3; }
.sm-svg .sm-bar:hover { opacity: 1; }

.stk-svg { width: 100%; height: auto; display: block; }
.stk-seg { cursor: pointer; transition: opacity .12s; }
.stk-svg:hover .stk-seg:not(:hover) { opacity: .55; }
.stk-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 12px; }
.stk-leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.stk-leg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Selected-category detail panel */
.spending-detail {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.spending-detail:empty { display: none; }
.sp-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sp-detail-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 800; color: var(--ink);
}
.sp-detail-month { font-size: 11.5px; font-weight: 700; color: var(--quiet); text-transform: capitalize; }
.sp-detail-headline { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; }
.sp-detail-headline strong {
  font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.sp-detail-headline .sm-delta { margin-left: 0; font-size: 12px; }
.sp-detail-share { font-size: 12.5px; font-weight: 600; color: var(--muted); }

.sp-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
.sp-chip {
  display: flex; flex-direction: column; gap: 3px;
  padding: 11px 13px; min-width: 0;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface);
}
.sp-chip-label { font-size: 10px; font-weight: 700; color: var(--quiet); text-transform: uppercase; letter-spacing: .03em; }
.sp-chip-value {
  font-size: 15px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sp-chip-sub { font-size: 11px; font-weight: 600; color: var(--muted); }
.sp-chip.up .sp-chip-value { color: var(--red); }
.sp-chip.down .sp-chip-value { color: var(--green); }
.sp-chip.empty .sp-chip-value { color: var(--quiet); font-weight: 700; font-size: 12px; }

.sp-trend { margin-top: 2px; }
.sp-trend-plot { position: relative; display: flex; align-items: flex-end; gap: 5px; }
.sp-tcol { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sp-tbar-wrap { width: 100%; height: 96px; display: flex; align-items: flex-end; justify-content: center; }
.sp-trend-bar {
  display: block; width: 100%; max-width: 26px; min-height: 3px;
  border-radius: 5px 5px 0 0;
  background: color-mix(in srgb, var(--c, var(--forest)) 26%, var(--neutral-100));
  transition: filter .12s ease;
}
.sp-tcol.current .sp-trend-bar { background: var(--c, var(--forest)); }
.sp-trend-bar:hover { filter: brightness(.94); }
.sp-tlabel { font-size: 10px; font-weight: 700; color: var(--quiet); text-transform: capitalize; white-space: nowrap; }
.sp-tcol.current .sp-tlabel { color: var(--ink); }
.sp-trend-avg {
  position: absolute; left: 0; right: 0; height: 0; pointer-events: none;
  border-top: 1.5px dashed var(--neutral-400);
}
.sp-trend-avg span {
  position: absolute; right: 0; top: -8px;
  font-size: 9.5px; font-weight: 700; color: var(--muted);
  background: var(--surface-soft); padding: 0 5px; border-radius: 4px;
}

.sp-detail-merchants { display: grid; gap: 9px; }
.sp-detail-subrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.sp-detail-subrow span {
  color: var(--quiet);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.sp-detail-subrow small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.sp-merch-rank {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.sp-merch-rank-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 6px 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.sp-merch-rank-num {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--forest);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}
.sp-merch-rank-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.sp-merch-rank-main b {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-merch-rank-main i {
  display: block;
  width: var(--w);
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--forest);
}
.sp-merch-rank-row strong {
  grid-column: 2;
  color: var(--forest);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.sp-merch-empty { font-size: 12px; color: var(--quiet); }

/* Comparative table */
.sp-table-shell {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.sp-table-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--neutral-50);
  border-bottom: 1px solid var(--line);
}
.sp-table-toolbar span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-table-toolbar svg { width: 15px; height: 15px; color: var(--forest); }
.sp-table-toolbar strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
}
.sp-table-toolbar em {
  color: var(--quiet);
  font-size: 11.5px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}
.sp-table-wrap {
  max-height: 560px;
  overflow: auto;
}
.sp-table {
  width: 100%;
  min-width: 1010px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.sp-table th,
.sp-table td {
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
}
.sp-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--quiet);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .03em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.sp-table th[data-sort] { cursor: pointer; }
.sp-table th[data-sort]:hover { color: var(--ink); }
.sp-table th.sorted { color: var(--forest); }
.sp-table th.num, .sp-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sp-table tbody tr { cursor: pointer; transition: background .15s ease; }
.sp-table tbody tr:hover { background: var(--surface-soft); }
.sp-table tbody tr.active { background: var(--green-50); }
.sp-table tbody tr + tr td { border-top: 1px solid var(--line-soft); }
.sp-table tbody tr.active td:first-child { box-shadow: inset 4px 0 0 var(--forest); }
.sp-table td.sp-cat { min-width: 260px; color: var(--ink); }
.sp-cat-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-right: 10px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--c) 18%, var(--surface));
  color: var(--forest);
  vertical-align: middle;
}
.sp-cat-mark svg { width: 16px; height: 16px; }
.sp-cat-copy {
  display: inline-grid;
  gap: 2px;
  min-width: 0;
  max-width: 210px;
  vertical-align: middle;
}
.sp-cat-copy b {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
}
.sp-cat-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
}
.sp-money-stack {
  position: relative;
  display: inline-grid;
  justify-items: end;
  gap: 2px;
  min-width: 112px;
  padding-bottom: 8px;
}
.sp-money-stack b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}
.sp-money-stack small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}
.sp-money-stack i {
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--w);
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--forest);
}
.sp-share-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 24px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  color: var(--forest);
  font-size: 11px;
  font-weight: 850;
}
.sp-delta-cell span {
  display: block;
  font-weight: 850;
}
.sp-delta-cell small {
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  opacity: .85;
}
.sp-delta-cell.up span,
.sp-delta-cell.up small { color: var(--red); }
.sp-delta-cell.down span,
.sp-delta-cell.down small { color: var(--green); }
.sp-delta-cell.flat span,
.sp-delta-cell.empty span { color: var(--quiet); }
.sp-count,
.sp-ticket {
  color: var(--ink);
  font-weight: 750;
}
.sp-top { max-width: 230px; }
.sp-top-pill {
  display: inline-grid;
  gap: 1px;
  min-width: 0;
  max-width: 210px;
  padding: 5px 9px;
  border-radius: 9px;
  background: var(--surface-soft);
}
.sp-top-pill b {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
}
.sp-top-pill small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
}
.sp-muted-dash { color: var(--quiet); font-weight: 800; }

/* Premium spending layout */
.spending-panel {
  margin-bottom: 16px;
  padding: 24px;
  background: var(--surface);
}
.spending-head {
  align-items: flex-start;
  margin-bottom: 18px;
}
.spending-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0;
}
.spending-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.spending-type-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--sunken);
}
.spending-type-toggle button {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.spending-type-toggle button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 2px 6px rgba(22, 36, 29, 0.12);
}
.spending-body {
  display: grid;
  grid-template-columns: minmax(320px, .84fr) minmax(0, 1.2fr);
  gap: 22px;
  align-items: start;
  margin-top: 8px;
}
.spending-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.spending-evolution {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.spending-time {
  display: flex;
  flex-direction: column;
  flex: none;
  min-width: 0;
  min-height: 0;
}
.spending-principal-slot {
  grid-column: 1 / -1;
  min-width: 0;
}
.spending-principal-slot:empty {
  display: none;
}

.sp-category-select {
  position: relative;
  display: block;
  min-width: 0;
}
.sp-category-select-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sp-category-select-shell {
  position: relative;
  display: block;
}
.sp-category-select select {
  width: 100%;
  height: 84px;
  padding: 2px 56px 2px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  appearance: none;
  background: var(--surface);
  /* The native macOS/Windows popup menu inherits the control's own font-size
     (it ignores `option { font-size }`). Keep the real select at a normal menu
     size so the open list is normal-sized, and hide its text — the big 36px
     category name is painted by the overlay span below. */
  color: transparent;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
  outline: none;
  box-shadow: none;
}
.sp-category-select select:focus {
  border-color: color-mix(in srgb, var(--c, var(--forest)) 48%, var(--line));
  box-shadow: var(--shadow-focus);
}
/* Big closed-state label, painted over the (small-font) select so the native
   dropdown menu stays a normal size. */
.sp-category-select-value {
  position: absolute;
  left: 20px;
  right: 56px;
  top: 50%;
  transform: translateY(-50%);
  overflow: hidden;
  color: var(--ink);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.16;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
}
.sp-category-select svg {
  position: absolute;
  right: 20px;
  top: 50%;
  width: 24px;
  height: 24px;
  color: var(--quiet);
  transform: translateY(-50%);
  pointer-events: none;
}

.sp-month-indicator {
  display: grid;
  gap: 8px;
  padding: 2px 2px 0;
}
.sp-month-indicator-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sp-month-indicator span {
  color: var(--green-600);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sp-month-indicator strong {
  color: var(--green-700);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.sp-month-track {
  width: 100%;
  height: 12px;
  padding: 2px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  overflow: hidden;
}
.sp-month-track i {
  display: block;
  min-width: 8px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--lime-strong), var(--lime));
}
.sp-month-indicator small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.sp-main-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: stretch;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: none;
}
/* Total on the left pins its label to the top and the amount to the bottom; the
   comparison cells mirror that (pill top, value bottom) so everything aligns on
   the same two baselines — no floating, no dead vertical gaps. */
.sp-main-card-total {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}
.sp-main-card-total > span {
  color: var(--neutral-600);
  font-size: 13px;
  font-weight: 800;
}
.sp-main-total {
  color: var(--forest);
  font-size: 30px;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.sp-main-comparisons {
  display: grid;
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 20px;
  align-items: stretch;
}
.sp-compare-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.sp-compare-block > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.sp-compare-value {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-compare-pill {
  display: inline-flex;
  align-items: center;
  align-self: start;
  gap: 4px;
  min-height: 26px;
  margin-bottom: auto;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.sp-compare-pill svg {
  width: 13px;
  height: 13px;
}
.sp-compare-pill.up { background: var(--red-50); color: var(--red); }
.sp-compare-pill.down { background: var(--green-100); color: var(--green-700); }
.sp-compare-pill.flat,
.sp-compare-pill.empty { background: var(--surface-soft); color: var(--muted); }

.sp-metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.sp-metric-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 88px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.sp-metric-icon {
  display: none;
}
.sp-metric-card > span {
  color: var(--neutral-600);
  font-size: 12px;
  font-weight: 800;
}
.sp-metric-value {
  color: var(--ink);
  font-size: 17px;
  font-weight: 850;
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.sp-metric-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

/* João-vs-Matheus split tile: a two-segment bar + a compact per-person legend,
   reusing the app's owner colours (João = forest, Matheus = lime). */
.sp-owner-card { gap: 9px; }
.sp-owner-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--sunken);
}
.sp-owner-bar i { display: block; height: 100%; }
.sp-owner-bar i.joao { background: var(--forest); }
.sp-owner-bar i.matheus { background: var(--lime-strong); }
.sp-owner-legend { display: grid; gap: 4px; }
.sp-owner-legend span {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  color: var(--neutral-700);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.sp-owner-legend b {
  justify-self: end;
  color: var(--ink);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.sp-owner-legend i { width: 8px; height: 8px; border-radius: 50%; }
.sp-owner-legend i.joao { background: var(--forest); }
.sp-owner-legend i.matheus { background: var(--lime-strong); }
.sp-owner-empty { color: var(--quiet); }

.sp-commitment-card { gap: 9px; }
.sp-commitment-bar {
  display: flex;
  width: 100%;
  height: 8px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--sunken);
}
.sp-commitment-bar i { display: block; height: 100%; }
.sp-commitment-bar i.new { background: var(--green-500); }
.sp-commitment-bar i.recurring { background: var(--recurring); }
.sp-commitment-bar i.committed { background: var(--amber); }
.sp-commitment-legend { display: grid; gap: 4px; }
.sp-commitment-legend span {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  color: var(--neutral-700);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.sp-commitment-legend b {
  justify-self: end;
  color: var(--ink);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.sp-commitment-legend i { width: 8px; height: 8px; border-radius: 50%; }
.sp-commitment-legend i.new { background: var(--green-500); }
.sp-commitment-legend i.recurring { background: var(--recurring); }
.sp-commitment-legend i.committed { background: var(--amber); }

.sp-active-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 7px 9px 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.sp-active-context span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-active-context button,
.sp-context-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}
.sp-active-context button svg,
.sp-context-clear svg {
  width: 13px;
  height: 13px;
}
.sp-active-context button:hover,
.sp-context-clear:hover {
  border-color: var(--forest-soft);
  color: var(--forest);
}

.sp-principal-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.sp-principal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.sp-principal-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
}
.sp-principal-head-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.sp-principal-count {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}
.sp-principal-clear {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--forest);
  font: inherit;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
}
.sp-principal-clear:hover { background: var(--surface-soft); }
.sp-principal-month {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: capitalize;
  white-space: nowrap;
}
/* Fixed height so the panel never grows past a handful of rows — the rest of the
   month's transactions are reached by scrolling inside the box. */
.sp-principal-table {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
}
.sp-principal-table:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
.sp-principal-table.empty {
  display: grid;
  place-items: center;
  min-height: 140px;
}
/* Fixed layout keeps the columns aligned while the description column soaks up
   the remaining width; a min-width lets the table scroll sideways when the panel
   is too narrow to fit every column. */
.sp-principal-table table {
  width: 100%;
  min-width: 1170px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.sp-principal-table .sp-col-type { width: 168px; }
.sp-principal-table .sp-col-card { width: 128px; }
.sp-principal-table .sp-col-owner { width: 132px; }
.sp-principal-table .sp-col-status { width: 120px; }
.sp-principal-table .sp-col-date { width: 154px; }
.sp-principal-table .sp-col-time { width: 132px; }
.sp-principal-table .sp-col-amount { width: 122px; }
.sp-principal-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px;
  background: var(--surface-soft);
  vertical-align: top;
  text-align: left;
}
.sp-principal-table th:first-child { padding-left: 12px; }
.sp-principal-table td:first-child { padding-left: 12px; }
.sp-principal-table td.sp-col-amount { text-align: right; }
/* Header cell: a sortable label on top, its per-type filter control below. */
.sp-th-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.sp-col-amount .sp-th-inner { align-items: flex-end; }
.sp-th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--neutral-600);
  font: inherit;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
}
.sp-th-sort > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-th-sort:hover,
.sp-th-sort.is-active { color: var(--forest); }
.sp-sort-ind {
  flex: none;
  font-size: 11px;
  line-height: 1;
  color: var(--forest);
}
.sp-th-filter {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
}
select.sp-th-filter { cursor: pointer; }
.sp-th-filter:focus-visible {
  outline: none;
  border-color: var(--green-500);
  box-shadow: var(--shadow-focus);
}
.sp-th-min { text-align: right; font-variant-numeric: tabular-nums; }
.date-split-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  gap: 6px;
  min-width: 0;
}
.day-filter {
  padding-right: 4px;
  padding-left: 4px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.day-filter:disabled {
  background: var(--surface-soft);
  color: var(--quiet);
  cursor: not-allowed;
  opacity: 0.72;
}
.sp-principal-empty-row td {
  height: 120px;
  text-align: center;
  vertical-align: middle;
}
.sp-principal-table td {
  height: 60px;
  padding: 9px 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: middle;
}
.sp-principal-table tbody tr:first-child td { border-top: 0; }
.sp-principal-table tbody tr:hover td { background: var(--surface-soft); }
.sp-principal-merchant {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-align: left;
}
.sp-principal-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--forest);
  flex: none;
}
.sp-principal-icon svg {
  width: 15px;
  height: 15px;
}
.sp-principal-merchant span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.sp-principal-merchant b {
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-principal-merchant small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-principal-amount,
.sp-principal-date,
.sp-principal-time {
  font-variant-numeric: tabular-nums;
}
.sp-principal-date,
.sp-principal-time {
  color: var(--muted);
  line-height: 1.1;
  vertical-align: middle;
}
.sp-principal-date b,
.sp-principal-time b {
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}
.sp-principal-time span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
}
.sp-principal-amount-cell {
  text-align: right;
  vertical-align: middle;
}
.sp-principal-amount {
  color: var(--forest);
  font-size: 12.5px;
  font-weight: 900;
}
/* Credit (card) vs debit (account) — the product used, not the ledger direction.
   Filled green reads as "card", the neutral outline as "account". */
.sp-principal-pay {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 850;
  white-space: nowrap;
}
.sp-principal-pay i,
.sp-principal-pay svg {
  width: 13px;
  height: 13px;
  flex: none;
}
.sp-principal-pay.credit {
  background: var(--green-100);
  color: var(--green-700);
}
.sp-principal-pay.debit {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.sp-principal-card-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sp-principal-card-chip i {
  color: var(--quiet);
  font-size: 11px;
  font-style: normal;
  letter-spacing: 1px;
}
.sp-principal-card-chip .sp-card-bank { font-weight: 800; }
.sp-principal-card-chip.empty { color: var(--quiet); font-weight: 700; }
.sp-principal-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}
.sp-principal-person > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sp-principal-owner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--forest);
  font-size: 10.5px;
  font-weight: 900;
  white-space: nowrap;
}
.sp-principal-owner.matheus {
  background: var(--green-100);
  color: var(--green-700);
}
.sp-principal-type {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  max-width: 82px;
  padding: 2px 6px;
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1.1;
  white-space: nowrap;
}
.sp-principal-type.new {
  background: var(--green-100);
  color: var(--green-700);
}
.sp-principal-type.recurring {
  background: var(--recurring-soft);
  color: var(--recurring);
}
.sp-principal-type.committed {
  background: var(--amber-soft);
  color: var(--amber);
}

.sp-evo-card {
  display: flex;
  flex-direction: column;
  flex: none;
  min-height: 0;
  padding: 22px 24px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  overflow: visible;
}
.sp-evo-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}
.sp-evo-head > div:first-child {
  min-width: 0;
}
.sp-evo-head span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}
.sp-evo-head h4 {
  margin: 3px 0 0;
  color: var(--forest);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-evo-tools {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}
.sp-evo-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  flex: none;
}
.sp-evo-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.sp-evo-toggle button svg {
  width: 14px;
  height: 14px;
}
.sp-evo-toggle button.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 2px 6px rgba(22, 36, 29, 0.12);
}
.sp-evo-kpi {
  display: grid;
  justify-items: end;
  gap: 3px;
  flex: none;
}
.sp-evo-kpi strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
}
.sp-evo-svg {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: visible;
}
.sp-hc-chart {
  display: block;
  width: 100%;
  flex: none;
  height: clamp(300px, 32vw, 380px);
  min-height: 0;
}
.sp-evo-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}
.sp-evo-axis,
.sp-evo-month {
  fill: var(--quiet);
  font-size: 11px;
  font-weight: 750;
}
.sp-evo-month.current {
  fill: var(--forest);
  font-weight: 850;
}
.sp-evo-bar {
  fill: var(--green-100);
  transition: fill .15s, opacity .15s;
}
.sp-evo-bar.current {
  fill: var(--forest);
}
.sp-evo-hit { cursor: default; }
.sp-evo-hit.sp-evo-clickable,
.sp-evo-bar.sp-evo-clickable { cursor: pointer; }
.sp-evo-col:hover .sp-evo-bar {
  fill: var(--green-200);
}
/* Dashed reference line at the period average, with a legible halo over the bars. */
.sp-evo-avg {
  stroke: var(--neutral-500);
  stroke-width: 1.5;
  stroke-dasharray: 5 5;
  opacity: .85;
}
.sp-evo-avg-label {
  fill: var(--neutral-600);
  font-size: 10.5px;
  font-weight: 800;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.sp-evo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.sp-evo-foot strong {
  color: var(--forest);
  font-weight: 850;
}

.sp-focus-card {
  --focus-muted: #cfd6cc;
}
.sp-focus-svg {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: visible;
}
.sp-focus-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}
.sp-focus-axis,
.sp-focus-month {
  fill: var(--quiet);
  font-size: 11px;
  font-weight: 750;
}
.sp-focus-month.current {
  fill: var(--forest);
  font-weight: 850;
}
.sp-focus-line {
  fill: none;
  stroke: var(--focus-muted);
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .62;
  transition: opacity .15s ease, stroke .15s ease, stroke-width .15s ease;
}
.sp-focus-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  stroke-linecap: round;
  pointer-events: stroke;
  cursor: pointer;
  outline: none;
}
.sp-focus-series.hovered .sp-focus-line,
.sp-focus-series.selected .sp-focus-line {
  stroke: var(--c, var(--forest));
  stroke-width: 3.2;
  opacity: 1;
}
.sp-focus-card.has-active .sp-focus-series:not(.selected):not(.hovered) .sp-focus-line {
  opacity: .38;
}
.sp-focus-marker {
  fill: var(--c, var(--forest));
  stroke: var(--surface);
  stroke-width: 2.5;
  paint-order: stroke;
}
.sp-focus-label {
  fill: var(--c, var(--forest));
  font-size: 12px;
  font-weight: 900;
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.sp-mix-card {
  --mix-muted-opacity: .24;
}
.sp-mix-svg {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: visible;
}
.sp-mix-grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}
.sp-mix-axis,
.sp-mix-month {
  fill: var(--quiet);
  font-size: 11.5px;
  font-weight: 750;
}
.sp-mix-month.current {
  fill: var(--forest);
  font-weight: 900;
}
.sp-mix-current {
  fill: none;
  stroke: var(--forest);
  stroke-width: 1.5;
  opacity: .34;
  pointer-events: none;
}
.sp-mix-seg {
  cursor: pointer;
  opacity: .9;
  transition: opacity .15s ease, filter .15s ease;
}
.sp-mix-seg.muted {
  opacity: var(--mix-muted-opacity);
}
.sp-mix-seg.selected {
  opacity: 1;
  stroke: var(--surface);
  stroke-width: 2.4;
  paint-order: stroke;
}
.sp-mix-seg:focus {
  outline: none;
  filter: drop-shadow(0 0 0 rgba(0,0,0,0));
  stroke: var(--ink);
  stroke-width: 2;
}
.sp-mix-foot {
  flex-wrap: wrap;
}
.sp-mix-foot strong {
  color: var(--forest);
}

.spending-comparison {
  min-width: 0;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.spending-comparison-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.spending-comparison-head h4 {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0;
}
.spending-comparison-head .muted {
  display: block;
  font-size: 12px;
}
.spending-comparison-body {
  min-width: 0;
}
.spending-comparison .sp-table-wrap {
  max-height: 460px;
}

@media (max-width: 1180px) {
  .spending-admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
  .spending-body { grid-template-columns: 1fr; }
  .sp-evo-card { min-height: 0; }
  .spending-category-col {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    align-items: start;
  }
  .spending-insights { grid-template-columns: 1fr; }
  .spending-insight,
  .spending-insight:first-child,
  .spending-insight:last-child {
    padding: 14px 0 0;
  }
  .spending-insight:first-child { padding-top: 0; }
  .spending-insight + .spending-insight {
    padding-left: 0;
    padding-top: 14px;
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }
}

@media (max-width: 680px) {
  .spending-panel { padding: 18px; }
  .spending-head,
  .spending-comparison-head {
    display: grid;
    grid-template-columns: 1fr;
  }
  .spending-controls,
  .spending-type-toggle {
    width: 100%;
  }
  .spending-type-toggle button {
    flex: 1;
    padding-inline: 6px;
  }
  .sp-category-select select {
    height: 88px;
    padding-right: 52px;
  }
  .sp-category-select-value {
    right: 52px;
    font-size: 34px;
    line-height: 1.16;
  }
  .sp-category-select svg {
    right: 18px;
    width: 24px;
    height: 24px;
  }
  .sp-evo-head {
    display: grid;
    grid-template-columns: 1fr;
  }
  .sp-evo-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .sp-evo-toggle {
    width: 100%;
  }
  .sp-evo-toggle button {
    flex: 1;
    justify-content: center;
  }
  .sp-evo-kpi {
    justify-items: start;
  }
  .sp-main-card,
  .sp-main-comparisons,
  .sp-metric-grid {
    grid-template-columns: 1fr;
  }
  .sp-compare-block {
    justify-items: start;
  }
  .sp-compare-block span {
    text-align: left;
  }
  .sp-principal-card {
    padding: 16px;
  }
  .sp-principal-table {
    max-height: 340px;
    overflow: auto;
  }
  .sp-principal-table table {
    min-width: 1060px;
  }
  .sp-evo-card {
    min-height: 0;
    padding: 18px 14px 14px;
  }
  .sp-evo-head,
  .sp-evo-foot {
    align-items: flex-start;
    flex-direction: column;
  }
  .sp-evo-kpi {
    justify-items: start;
  }
  .sp-evo-svg,
  .sp-hc-chart {
    height: 300px;
    min-height: 0;
  }
  .spending-category-col {
    grid-template-columns: 1fr;
  }
  .sp-table-toolbar,
  .sp-merch-rank {
    grid-template-columns: 1fr;
  }
  .sp-table-toolbar {
    align-items: start;
    gap: 6px;
  }
  .sp-detail-subrow {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .sp-detail-subrow small { white-space: normal; }
  .spending-controls,
  .cards-tx-tools {
    justify-content: flex-start;
  }
  .sp-rule-form,
  .sp-rule-row {
    grid-template-columns: 1fr;
  }
  .sp-rule-field.wide,
  .sp-rule-actions { grid-column: auto; }
  .sp-rule-actions { justify-content: flex-start; }
  .sp-rule-target,
  .sp-rule-row-actions {
    justify-self: start;
  }
}

/* ===================== ESSENTIALS ===================== */
#view-essentials { min-width: 0; }
.essentials-page-bar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 14px;
}
.essentials-range-controls { justify-content: flex-end; }
.essentials-range-controls .cf-period {
  width: 76px;
  height: 36px;
  padding-left: 10px;
}
.essentials-range-controls select[id$="-year"] { width: 82px; }
.essentials-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr);
  gap: 18px;
  align-items: start;
}
.essentials-head {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.essentials-head h3 { margin-bottom: 3px; }
.essentials-ledger-panel,
.essentials-charts-panel { min-width: 0; }
.essentials-table-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.essentials-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 190px;
  flex: 1;
}
.essentials-search input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 0 36px 0 14px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  font-size: 13px;
  font-weight: 600;
}
.essentials-search input:focus { border-color: var(--forest); }
.essentials-search svg {
  position: absolute;
  right: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.essentials-table-controls .cf-period {
  width: 156px;
  height: 36px;
  font-size: 12px;
}
.essentials-table-wrap {
  max-height: calc(100vh - 286px);
  overflow: auto;
}
.essentials-table th:first-child,
.essentials-table td:first-child { width: 64px; }
.essentials-table th[data-ess-sort] {
  position: relative;
  cursor: pointer;
  user-select: none;
  padding-right: 24px;
}
.essentials-table th[data-ess-sort]::after {
  content: "↕";
  position: absolute;
  right: 9px;
  color: var(--quiet);
  font-size: 11px;
  font-weight: 800;
}
.essentials-table th.sort-asc::after { content: "↑"; color: var(--forest); }
.essentials-table th.sort-desc::after { content: "↓"; color: var(--forest); }
.essentials-table th:last-child,
.essentials-table td:last-child {
  text-align: right;
  white-space: nowrap;
}
.essentials-table tbody td { padding: 12px 10px; }
.ess-id {
  color: var(--quiet);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ess-type,
.ess-status-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ess-type b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ess-type span,
.ess-status-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ess-status {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  height: 24px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.ess-status.paid { background: var(--green-soft); color: var(--green); }
.ess-status.pending { background: var(--amber-soft); color: #9a631f; }
.ess-status.overdue { background: var(--red-soft); color: var(--red); }
.ess-amount {
  color: var(--forest);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.essentials-charts {
  display: grid;
  gap: 0;
}
.ess-chart-card {
  padding: 16px 0 12px;
  border-top: 1px solid var(--line-soft);
}
.ess-chart-card:first-of-type { padding-top: 0; border-top: 0; }
.ess-chart-spacer {
  display: block;
  visibility: hidden;
  pointer-events: none;
}
.ess-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ess-chart-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}
.ess-chart-total {
  color: var(--forest);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.ess-chart {
  width: 100%;
  min-height: 178px;
  margin-top: 10px;
  position: relative;
  overflow: visible;
}
/* ---- Expandable essentials sections (accordion) ---- */
.essentials-sections { display: grid; gap: 16px; align-content: start; }
.ess-section { padding: 0; overflow: hidden; }
.ess-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 18px 22px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  transition: background .15s ease;
}
.ess-section-head:hover { background: var(--surface-soft); }
.ess-section.open .ess-section-head { border-bottom: 1px solid var(--line-soft); }
.ess-section-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.ess-section-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--forest);
}
.ess-section-icon svg { width: 20px; height: 20px; }
.ess-section-heading { display: grid; gap: 3px; min-width: 0; }
.ess-section-heading b {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}
.ess-section-heading .muted {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ess-section-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--amber-soft);
  color: #9a631f;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ess-section-meta { display: flex; align-items: center; gap: 14px; flex: none; }
.ess-section-total {
  color: var(--forest);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ess-section-caret {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: transform .18s ease;
}
.ess-section.open .ess-section-caret { transform: rotate(180deg); }
.ess-section-body { padding: 20px 22px 22px; }
.ess-section:not(.open) .ess-section-body { display: none; }
.ess-section--placeholder .ess-section-icon { background: var(--surface-soft); color: var(--muted); }
.ess-section[data-ess-section="voucher-alimentacao"]:not(.ess-section--placeholder) .ess-section-icon {
  background: #fee2e2;
  color: #c5162e;
}
.ess-section[data-ess-section="voucher-alimentacao"]:not(.ess-section--placeholder) .ess-section-badge {
  background: #fee2e2;
  color: #a11225;
}
.ess-subhead { margin-bottom: 12px; }
.ess-subhead h4 { margin: 0; font-size: 14px; font-weight: 800; color: var(--ink); }

/* Placeholder voucher grids */
.ess-voucher-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.ess-voucher-note svg { width: 15px; height: 15px; flex: none; color: var(--quiet); }
.ess-voucher-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ess-voucher-table th {
  text-align: left;
  padding: 0 10px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line);
}
.ess-voucher-table td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); }
.ess-voucher-table tbody tr:last-child td { border-bottom: 0; }
.ess-voucher-table th:last-child,
.ess-voucher-table td:last-child { text-align: right; white-space: nowrap; }
.ess-voucher-place { font-weight: 700; color: var(--ink); }
.ess-voucher-cat { color: var(--muted); font-size: 11px; font-weight: 600; }
.ticket-import-list {
  display: grid;
  gap: 12px;
}
.ticket-import-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.ticket-import-toolbar-label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.ticket-import-toolbar-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--sunken);
  color: var(--forest);
}
.ticket-import-toolbar-icon svg { width: 21px; height: 21px; }
.ticket-import-toolbar-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.ticket-import-toolbar-label b {
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.1;
}
.ticket-import-toolbar-label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.25;
}
.ticket-import-sync-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: none;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--forest);
  border-radius: var(--r-pill);
  background: var(--forest);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.ticket-import-sync-btn:hover:not(:disabled) {
  background: var(--forest-2);
  border-color: var(--forest-2);
}
.ticket-import-sync-btn:disabled {
  opacity: .7;
  cursor: progress;
}
.ticket-import-sync-btn svg {
  width: 14px;
  height: 14px;
}
.ticket-import-sync-btn.loading svg { animation: spin .8s linear infinite; }
.ticket-import-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(130px, .75fr));
  gap: 12px;
  margin: 0 0 14px;
}
.ticket-import-summary-item {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 6px;
  min-width: 0;
  min-height: 82px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.ticket-import-summary-item.primary {
  border-color: color-mix(in srgb, var(--forest) 18%, var(--line));
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}
.ticket-import-summary-item svg {
  position: absolute;
  right: 13px;
  top: 13px;
  width: 16px;
  height: 16px;
  color: var(--quiet);
}
.ticket-import-summary-label {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ticket-import-summary-item strong {
  align-self: end;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ticket-import-summary-item.primary strong {
  color: var(--forest);
  font-size: 24px;
}
.ticket-import-summary-item.attention {
  border-color: color-mix(in srgb, var(--red) 28%, var(--line));
  background: var(--red-soft);
}
.ticket-import-summary-item.attention strong,
.ticket-import-summary-item.attention svg { color: var(--red); }
.ticket-import-card {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  overflow: hidden;
}
.ticket-import-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line-soft);
}
.ticket-import-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.ticket-import-title b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.ticket-import-title span,
.ticket-import-meta span,
.ticket-import-row-main span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.ticket-import-meta {
  display: grid;
  gap: 3px;
  text-align: right;
  white-space: nowrap;
}
.ticket-import-meta strong {
  color: var(--forest);
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.ticket-import-rows {
  display: grid;
}
.ticket-import-receipt {
  display: grid;
  border-bottom: 1px solid var(--line-soft);
}
.ticket-import-receipt:last-child { border-bottom: 0; }
.ticket-import-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
}
.ticket-import-row > strong {
  flex: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ticket-import-row-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.ticket-import-row-main b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.ticket-line-items {
  display: grid;
  gap: 0;
  margin: 0 16px 12px 28px;
  border-left: 2px solid var(--line);
  border-radius: 0 0 var(--r-sm) 0;
  background: var(--sunken);
}
.ticket-line-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.ticket-line-item-row:last-child { border-bottom: 0; }
.ticket-line-item-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ticket-line-item-main span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.ticket-line-item-main small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
}
.ticket-line-item-row strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ticket-line-item-row.is-uncertain {
  background: color-mix(in srgb, var(--amber-soft) 45%, transparent);
}
.ticket-line-item-row.is-uncertain .ticket-line-item-main small {
  color: #9a631f;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1280px) {
  .grid { grid-template-columns: 270px minmax(0, 1fr); }
  .col-right { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cards-top { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
  .cards-overview-row { grid-template-columns: 1fr; }
  .essentials-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  body { padding: 0; }
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
    min-height: 100vh;
  }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    padding: 18px 20px;
    gap: 18px;
  }
  .brand { padding: 0; }
  .nav-list {
    display: flex;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-padding-inline: 4px;
    scroll-snap-type: inline proximity;
    scrollbar-width: none;
  }
  .nav-list::-webkit-scrollbar { display: none; }
  .nav-item { flex: 0 0 auto; scroll-snap-align: start; }
  .workspace { width: 100%; max-width: 100vw; min-width: 0; }
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .topbar-tools { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; }
  .grid { grid-template-columns: 1fr; }
  .col-right { grid-template-columns: 1fr; }
  .cards-top { grid-template-columns: 1fr; }
  .essentials-page-bar { justify-content: flex-start; }
  .essentials-table-wrap { max-height: none; }
}
@media (max-width: 720px) {
  .sidebar {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 10px;
  }
  .brand { padding-inline: 4px; }
  .brand h1 { font-size: 16px; }
  .brand-mark { width: 26px; height: 26px; }
  .nav-list { padding: 0 2px 6px; }
  .nav-item {
    min-height: 40px;
    gap: 9px;
    padding: 0 12px;
    font-size: 12.5px;
  }
  .nav-item svg { width: 17px; height: 17px; }
  .workspace { padding: 16px 14px 18px; }
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .topbar h2 { font-size: 22px; line-height: 1.12; }
  .user-filter { width: 100%; }
  .user-filter-option { min-width: 0; padding: 8px 6px; font-size: 12.5px; }
  .topbar-tools {
    grid-column: 1;
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }
  .user-chip { margin-left: auto; }
  .update-trigger,
  .round-button {
    width: 44px;
    height: 44px;
  }
  .round-button.sm {
    width: 40px;
    height: 40px;
  }
  .update-menu {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
    max-height: min(420px, calc(100dvh - 24px));
    overflow: auto;
  }
  .panel {
    padding: 20px 16px;
    border-radius: var(--r-md);
  }
  .panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }
  .stat-row { grid-template-columns: 1fr; }
  #view-cards {
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
    min-width: 0;
  }
  .cards-top,
  .cards-main,
  .cards-overview-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .card-insights-panel { padding: 20px; }
  .cards-insights-head,
  .cards-insight-toolbar,
  .account-flow-toolbar {
    justify-content: flex-start;
  }
  .cards-insights-toggle { width: 100%; }
  .cards-insights-toggle button {
    flex: 1;
    justify-content: center;
  }
  .account-flow-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .flow-toggle {
    align-items: flex-start;
    white-space: normal;
  }
  .limit-range.cf-range,
  .account-flow-range.cf-range {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .ess-section-head {
    align-items: flex-start;
    padding: 16px;
  }
  .ess-section-title {
    align-items: flex-start;
    gap: 11px;
  }
  .ess-section-heading b {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 15px;
  }
  .ess-section-heading .muted {
    white-space: normal;
  }
  .ess-section-meta {
    gap: 8px;
  }
  .ess-section-total {
    font-size: 13px;
  }
  .ess-section-body {
    padding: 16px;
  }
  .ticket-import-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }
  .ticket-import-sync-btn {
    width: 100%;
  }
  .ticket-import-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ticket-import-head,
  .ticket-import-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .ticket-import-meta,
  .ticket-import-row > strong {
    justify-self: start;
    text-align: left;
  }
  .ticket-line-items {
    margin-left: 16px;
  }
  .ticket-line-item-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .user-meta { display: none; }
  .note { display: none; }
}

@media (max-width: 420px) {
  .workspace { padding-inline: 12px; }
  .topbar-tools { gap: 6px; }
  .brand h1 { display: none; }
  .nav-item {
    min-height: 38px;
    padding-inline: 10px;
  }
  .nav-item span { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-chip { gap: 6px; padding-left: 0; }
  .avatar,
  .round-button.sm {
    width: 38px;
    height: 38px;
  }
  .ticket-import-summary {
    grid-template-columns: 1fr;
  }
}

/* ============================ USER FILTER (Liquid Glass) ============================ */

.user-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 4px;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(240, 246, 237, 0.35));
  border: 1px solid rgba(22, 53, 42, 0.08);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(22, 36, 29, 0.05);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
}

.user-filter-glass {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(233, 244, 233, 0.8));
  box-shadow: 0 1px 1px rgba(255, 255, 255, 0.9) inset, 0 6px 14px rgba(22, 36, 29, 0.12), 0 1px 2px rgba(22, 36, 29, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.user-filter:has(.user-filter-option[data-user="all"].active) .user-filter-glass { transform: translateX(0); }
.user-filter:has(.user-filter-option[data-user="joao"].active) .user-filter-glass { transform: translateX(100%); }
.user-filter:has(.user-filter-option[data-user="matheus"].active) .user-filter-glass { transform: translateX(200%); }

.user-filter-option {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  min-width: 62px;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
}
.user-filter-option:hover { color: var(--forest); }
.user-filter-option.active { color: var(--forest); font-weight: 700; }

/* ============================ ACCOUNT OVERVIEW ============================ */

.overview-panel .panel-head { margin-bottom: 14px; }
.overview-sync { font-size: 11px; color: var(--quiet); font-weight: 500; }

.overview-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.overview-total {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.overview-total span { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.overview-total strong { font-size: 18px; font-weight: 800; letter-spacing: -0.02em; color: var(--forest); }
.overview-total.owed strong { color: var(--red); }

.overview-group + .overview-group { margin-top: 14px; }
.overview-group-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--quiet);
  margin: 0 0 8px 2px;
}

.overview-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
}
.overview-row + .overview-row { border-top: 1px solid var(--line-soft); }

.overview-icon {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--forest-soft);
  color: var(--forest);
}
.overview-icon.credit { background: var(--red-soft); color: var(--red); }
.overview-icon svg { width: 18px; height: 18px; }

.overview-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.overview-info b { font-size: 14px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overview-info span { font-size: 11px; color: var(--muted); }

.overview-value { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: var(--forest); white-space: nowrap; }
.overview-value.owed { color: var(--red); }

.overview-empty { font-size: 13px; color: var(--muted); margin: 0; }

/* ============================ CONNECTIONS VIEW ============================ */

.connections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* ===================== TRANSACTIONS VIEW ===================== */
.tx-panel { padding: 20px 22px 22px; }

.tx-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.tx-panel-head h3 {
  margin: 0 0 3px;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0;
}
.tx-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tx-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tx-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  flex: 1 1 260px;
  max-width: 360px;
  padding: 0 14px;
  height: 42px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  color: var(--muted);
}
.tx-search i { width: 18px; height: 18px; }
.tx-search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
  color: var(--ink);
}
.tx-search input::placeholder { color: var(--quiet); }

.tx-filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.tx-select { position: relative; display: inline-flex; align-items: center; }
.tx-select select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  height: 42px;
  padding: 0 34px 0 16px;
  border-radius: var(--r-pill);
  cursor: pointer;
  outline: none;
}
.tx-select select:hover { border-color: var(--forest-soft); }
.tx-select i {
  position: absolute;
  right: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.tx-select.sm select { height: 34px; padding: 0 30px 0 12px; border-radius: var(--r-sm); }
.tx-select.sm i { right: 9px; width: 14px; height: 14px; }

.tx-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.tx-range i { width: 16px; height: 16px; color: var(--muted); }

.tx-download {
  height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--forest);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.tx-download:hover { background: var(--forest-2); transform: translateY(-1px); }

.tx-table-wrap {
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.tx-table {
  width: 100%;
  min-width: 1300px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.tx-table .sp-col-type { width: 168px; }
.tx-table .sp-col-card { width: 148px; }
.tx-table .sp-col-owner { width: 132px; }
.tx-table .sp-col-status { width: 138px; }
.tx-table .sp-col-date { width: 154px; }
.tx-table .sp-col-time { width: 132px; }
.tx-table .sp-col-amount { width: 124px; }
.tx-table td.sp-col-amount { text-align: right; }

/* The ledger has its own denser column map; other .tx-table instances (cards,
   savings) deliberately keep their existing dimensions. */
#view-transactions .tx-ledger-table { min-width: 1260px; }
#view-transactions .tx-ledger-table .sp-col-tx { width: 220px; }
#view-transactions .tx-ledger-table .sp-col-type { width: 144px; }
#view-transactions .tx-ledger-table .sp-col-category { width: 158px; }
#view-transactions .tx-ledger-table .sp-col-owner { width: 102px; }
#view-transactions .tx-ledger-table .sp-col-status { width: 112px; }
#view-transactions .tx-ledger-table .sp-col-date { width: 126px; }
#view-transactions .tx-ledger-table .sp-col-time { width: 104px; }
#view-transactions .tx-ledger-table .sp-col-amount { width: 112px; }
#view-transactions .tx-ledger-table .tx-flag-col { width: 68px; }
.tx-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px;
  text-align: left;
  vertical-align: top;
  background: var(--surface-soft);
}
.tx-table thead th[data-sort]::after {
  content: attr(data-sort-indicator);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  margin-left: 6px;
  vertical-align: middle;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
  opacity: 0.35;
}
.tx-table thead th.sort-asc::after,
.tx-table thead th.sort-desc::after { color: var(--forest); opacity: 1; }
.tx-table thead th.tx-check-col { cursor: default; }
.tx-table thead th.tx-check-col::after { display: none; }

.tx-table tbody td {
  height: 60px;
  padding: 9px 8px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: middle;
}
.tx-table tbody tr:first-child td { border-top: 0; }
.tx-table tbody tr:last-child td { border-bottom: 0; }
.tx-table tbody tr:hover td { background: var(--surface-soft); }
.tx-table tbody tr.selected td { background: var(--green-50); }

#view-transactions .tx-ledger-table thead th {
  background: color-mix(in srgb, var(--surface-soft) 84%, var(--surface));
}
#view-transactions .tx-ledger-table .tx-flag-col {
  text-align: center;
  overflow: visible;
}
#view-transactions .tx-ledger-table thead .tx-flag-col {
  padding-right: 4px;
  padding-left: 4px;
  vertical-align: middle;
}
#view-transactions .tx-ledger-table thead .tx-flag-col > span {
  display: block;
  color: var(--neutral-600);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.025em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: normal;
}
#view-transactions .tx-ledger-table .tx-category-select {
  width: 100%;
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  outline: none;
}
#view-transactions .tx-ledger-table .tx-category-select:hover {
  border-color: var(--forest-soft);
  background-color: var(--green-50);
}
#view-transactions .tx-ledger-table .tx-category-select:focus-visible {
  border-color: var(--green-500);
  box-shadow: var(--shadow-focus);
}
#view-transactions .tx-ledger-table .tx-flag-toggle {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--forest);
  cursor: pointer;
}
#view-transactions .tx-ledger-table .tx-flag-toggle:disabled { opacity: .5; cursor: wait; }
#view-transactions .tx-ledger-table tbody td.sp-col-type {
  position: relative;
  overflow: visible;
}
#view-transactions .tx-type-with-account {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  cursor: help;
  outline: none;
}
#view-transactions .tx-account-tooltip {
  position: absolute;
  z-index: 8;
  top: calc(100% + 9px);
  left: 0;
  width: max-content;
  max-width: 230px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--forest) 16%, var(--line));
  border-radius: 10px;
  background: var(--neutral-900);
  box-shadow: var(--shadow-popover);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}
#view-transactions .tx-account-tooltip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 18px;
  border: 5px solid transparent;
  border-bottom-color: var(--neutral-900);
}
#view-transactions .tx-account-tooltip b {
  display: block;
  margin-bottom: 2px;
  color: var(--green-200);
  font-size: 10px;
  letter-spacing: .025em;
  text-transform: uppercase;
}
#view-transactions .tx-type-with-account:hover .tx-account-tooltip,
#view-transactions .tx-type-with-account:focus .tx-account-tooltip,
#view-transactions .tx-type-with-account:focus-within .tx-account-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tx-check-col { width: 42px; text-align: center !important; }
.tx-check-col input { width: 16px; height: 16px; accent-color: var(--forest); cursor: pointer; }

.tx-name { display: flex; align-items: center; gap: 12px; }
.tx-cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--green-800);
  flex: none;
}
.tx-cat-icon i { width: 18px; height: 18px; }
.tx-name b { display: block; font-size: 13px; font-weight: 700; color: var(--ink); }
.tx-name span { font-size: 12px; color: var(--muted); }
.tx-table .tx-name b { font-weight: 850; }
.tx-table .tx-cat-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

.tx-account { display: flex; align-items: center; gap: 10px; }
.tx-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 24px;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  flex: none;
}
.tx-account-name { font-weight: 600; color: var(--ink); white-space: nowrap; }

.tx-id { color: var(--muted); font-variant-numeric: tabular-nums; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tx-datetime b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.tx-datetime span { font-size: 12px; color: var(--muted); }

.tx-note-cell { color: var(--muted); max-width: 240px; }

.tx-status {
  display: inline-flex;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.tx-status.completed { color: var(--green-800); background: var(--green-soft); }
.tx-status.pending { color: var(--amber); background: var(--amber-soft); }
.tx-installment { max-width: none; }

/* Compact ledger actions replace the legacy recurring/third-party bulk banner. */
#view-transactions .tx-ledger-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface-soft) 64%, var(--surface));
}
#view-transactions .tx-ledger-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
#view-transactions .tx-ledger-search:focus-within {
  border-color: var(--green-500);
  background: #fff;
  box-shadow: var(--shadow-focus);
}
#view-transactions .tx-ledger-search svg {
  width: 17px;
  height: 17px;
  flex: none;
}
#view-transactions .tx-ledger-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}
#view-transactions .tx-ledger-search input::placeholder { color: var(--quiet); font-weight: 600; }
#view-transactions .tx-ledger-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
#view-transactions .tx-selection-count {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 11px;
}
#view-transactions .tx-alias-form {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 258px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
#view-transactions .tx-alias-form:focus-within {
  border-color: var(--green-500);
  box-shadow: var(--shadow-focus);
}
#view-transactions .tx-alias-form input {
  flex: 1 1 130px;
  min-width: 105px;
  height: 32px;
  padding: 0 8px 0 11px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
}
#view-transactions .tx-alias-form input::placeholder { color: var(--quiet); }
#view-transactions .tx-alias-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--forest);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  transition: background .15s ease, opacity .15s ease;
}
#view-transactions .tx-alias-form button:hover:not(:disabled) { background: var(--forest-2); }
#view-transactions .tx-alias-form button:disabled { opacity: .42; cursor: not-allowed; }
#view-transactions .tx-alias-form button svg { width: 14px; height: 14px; }
#view-transactions .tx-thirdparty-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
#view-transactions .tx-thirdparty-toggle:hover { background: var(--green-50); color: var(--ink); }
#view-transactions .tx-thirdparty-toggle input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--forest);
}

.tx-thirdparty-badge,
.tx-recurring-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--amber);
  background: var(--amber-soft);
  vertical-align: middle;
}
.tx-recurring-badge {
  color: var(--recurring);
  background: var(--recurring-soft);
}
tr.is-thirdparty { opacity: 0.62; }
tr.is-thirdparty:hover { opacity: 1; }

/* Native category editor. */
#view-transactions .tx-category-dialog {
  width: min(480px, calc(100vw - 32px));
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(18, 26, 22, .24), var(--shadow-popover);
}
#view-transactions .tx-category-dialog::backdrop {
  background: rgba(18, 26, 22, .44);
  backdrop-filter: blur(3px);
}
#view-transactions .tx-category-form { display: grid; gap: 20px; padding: 24px; }
#view-transactions .tx-category-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
#view-transactions .tx-category-dialog-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--forest);
}
#view-transactions .tx-category-dialog-icon svg { width: 18px; height: 18px; }
#view-transactions .tx-category-dialog-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0;
}
#view-transactions .tx-category-dialog-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
#view-transactions .tx-category-field { display: grid; gap: 7px; }
#view-transactions .tx-category-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
#view-transactions .tx-category-field select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
#view-transactions .tx-category-field select:focus {
  border-color: var(--green-500);
  box-shadow: var(--shadow-focus);
}
#view-transactions .tx-category-same-name {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  cursor: pointer;
}
#view-transactions .tx-category-same-name input {
  flex: none;
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: var(--forest);
}
#view-transactions .tx-category-same-name:has(input:disabled) { opacity: .58; cursor: default; }
#view-transactions .tx-category-same-name span { display: grid; gap: 3px; }
#view-transactions .tx-category-same-name b { color: var(--ink); font-size: 12.5px; }
#view-transactions .tx-category-same-name small { color: var(--muted); font-size: 11.5px; line-height: 1.4; }
#view-transactions .tx-category-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}
#view-transactions .tx-category-dialog-actions button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 800;
}
#view-transactions .tx-category-cancel {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
#view-transactions .tx-category-cancel:hover { background: var(--surface-soft); color: var(--ink); }
#view-transactions .tx-category-confirm { border: 1px solid var(--forest); background: var(--forest); color: #fff; }
#view-transactions .tx-category-confirm:hover { background: var(--forest-2); border-color: var(--forest-2); }

.tx-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.tx-showing { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }

.tx-pagination { display: flex; align-items: center; gap: 6px; }
.tx-page, .tx-page-arrow {
  min-width: 34px;
  height: 34px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.tx-page:hover, .tx-page-arrow:not([disabled]):hover { border-color: var(--forest-soft); background: var(--surface-soft); }
.tx-page.active { background: var(--forest); color: #fff; border-color: var(--forest); }
.tx-page-arrow[disabled] { opacity: 0.4; cursor: not-allowed; }
.tx-page-arrow i { width: 16px; height: 16px; }
.tx-page-gap { min-width: 24px; text-align: center; color: var(--quiet); }

@media (max-width: 720px) {
  .tx-toolbar { flex-direction: column; align-items: stretch; }
  .tx-search {
    flex: 0 0 42px;
    width: 100%;
    min-width: 0;
    max-width: none;
  }
  .tx-filters { width: 100%; }

  #view-transactions .tx-panel { padding: 18px 14px; }
  #view-transactions .tx-panel-head { align-items: flex-start; }
  #view-transactions .tx-ledger-toolbar { grid-template-columns: 1fr; padding: 8px; }
  #view-transactions .tx-ledger-tools { align-items: stretch; flex-direction: column; }
  #view-transactions .tx-selection-count { align-self: flex-start; }
  #view-transactions .tx-alias-form { width: 100%; min-width: 0; }
  #view-transactions .tx-thirdparty-toggle { align-self: flex-start; }
  #view-transactions .tx-category-form { padding: 20px; }
  #view-transactions .tx-category-dialog-actions button { flex: 1 1 0; }
}

@media (max-width: 720px) {
  .table-wrap,
  .tx-table-wrap,
  .data-table-shell,
  .sp-table-wrap,
  .manual-review-table-wrap,
  .bs-table-wrap,
  .income-table-wrap,
  .debt-table-wrap {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .tx-filters,
  .tx-select,
  .tx-select select,
  .tx-download,
  .tx-range {
    width: 100%;
  }
  .tx-select select,
  .tx-download,
  .tx-range {
    min-height: 44px;
  }
  .tx-foot {
    align-items: stretch;
  }
  .tx-showing,
  .tx-pagination {
    width: 100%;
  }
  .tx-pagination {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
  }
}

@media (min-width: 721px) and (max-width: 1240px) {
  #view-transactions .tx-ledger-toolbar { grid-template-columns: 1fr; }
  #view-transactions .tx-ledger-tools { justify-content: flex-start; flex-wrap: wrap; }
}

/* ============================ DEBTS VIEW ============================ */

#view-debts {
  display: grid;
  gap: 22px;
}

.debt-layout { display: grid; gap: 20px; }

.debt-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.debt-selection-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(22, 53, 42, 0.1);
  border-radius: var(--r-md);
  background: #fbfcf8;
}

.debt-kpi {
  min-height: 88px;
  display: grid;
  align-content: space-between;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(22, 53, 42, 0.08);
  border-radius: var(--r-md);
  background: #f8faf5;
}
.debt-kpi-total {
  background: var(--forest);
  border-color: var(--forest);
}
.debt-kpi span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.debt-kpi strong { color: var(--ink); font-size: 22px; font-weight: 800; line-height: 1.1; }
.debt-kpi small { color: var(--quiet); font-size: 12px; }
.debt-kpi-total span,
.debt-kpi-total small { color: rgba(255, 255, 255, 0.74); }
.debt-kpi-total strong { color: #fff; }

.debt-table-panel { padding: 20px 22px; }
.debt-table-panel .panel-head { align-items: flex-start; gap: 14px; }
.debt-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.debt-table-panel .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(22, 53, 42, 0.1);
}
.debt-table-panel .btn-ghost svg { width: 15px; height: 15px; }
.debt-new-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.8fr) 118px 118px 104px repeat(4, minmax(72px, .8fr)) auto;
  gap: 8px;
  align-items: end;
  margin-top: 14px;
  padding: 12px 0;
  border-top: 1px solid rgba(22, 53, 42, 0.08);
  border-bottom: 1px solid rgba(22, 53, 42, 0.08);
}
.debt-new-form[hidden] { display: none; }
.debt-new-form label {
  display: grid;
  gap: 4px;
  color: var(--quiet);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .025em;
}
.debt-new-form input,
.debt-new-form select,
.debt-edit-input,
.debt-edit-select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(22, 53, 42, 0.12);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
}
.debt-new-form input,
.debt-new-form select {
  min-height: 34px;
  padding: 7px 8px;
}
.debt-new-actions {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.debt-new-form input[readonly] {
  background: var(--sunken);
  color: var(--quiet);
  cursor: default;
}
.debt-save-button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  box-shadow: none;
}
.debt-save-button svg {
  width: 14px;
  height: 14px;
}

.debt-table-wrap { overflow-x: visible; margin-top: 14px; max-width: 100%; }
.debt-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}
.debt-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 8px 5px;
  background: var(--surface);
  color: var(--quiet);
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .025em;
  vertical-align: top;
  overflow: visible;
}
.debt-th-main {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
}
.debt-th-sort,
.debt-th-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}
.debt-th-sort {
  cursor: pointer;
}
.debt-th-sort:hover { color: var(--ink); }
.debt-filter-menu {
  position: relative;
  display: inline-flex;
  flex: none;
}
.debt-filter-trigger,
.debt-th-filter {
  min-width: 0;
  border: 1px solid rgba(22, 53, 42, 0.12);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.debt-filter-trigger {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: var(--quiet);
  cursor: pointer;
}
.debt-filter-trigger svg {
  width: 13px;
  height: 13px;
}
.debt-filter-trigger:hover,
.debt-filter-menu:focus-within .debt-filter-trigger {
  color: var(--ink);
  border-color: rgba(22, 53, 42, 0.22);
}
.debt-th-filter {
  width: 100%;
  min-height: 30px;
  padding: 5px 6px;
}
select.debt-th-filter { cursor: pointer; }
.debt-filter-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 5;
  display: grid;
  gap: 6px;
  width: 190px;
  padding: 8px;
  border: 1px solid rgba(22, 53, 42, 0.12);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: 0 16px 36px rgba(22, 53, 42, 0.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}
.debt-filter-menu-right .debt-filter-popover {
  right: 0;
  left: auto;
}
.debt-filter-menu:hover .debt-filter-popover,
.debt-filter-menu:focus-within .debt-filter-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.debt-date-picker {
  position: relative;
  display: inline-flex;
  flex: none;
}
.debt-date-trigger {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(22, 53, 42, 0.12);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--quiet);
  cursor: pointer;
}
.debt-date-trigger svg {
  width: 13px;
  height: 13px;
}
.debt-date-trigger:hover,
.debt-date-picker:focus-within .debt-date-trigger {
  color: var(--ink);
  border-color: rgba(22, 53, 42, 0.22);
}
.debt-date-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 5;
  width: 238px;
  padding: 10px;
  border: 1px solid rgba(22, 53, 42, 0.12);
  border-radius: var(--r-md);
  background: #fff;
  box-shadow: 0 16px 36px rgba(22, 53, 42, 0.14);
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}
.debt-date-picker:hover .debt-date-popover,
.debt-date-picker:focus-within .debt-date-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.debt-calendar-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.debt-calendar-head strong {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.debt-calendar-head button,
.debt-calendar-foot button {
  border: 1px solid rgba(22, 53, 42, 0.1);
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.debt-calendar-head button {
  width: 28px;
  height: 28px;
}
.debt-calendar-week,
.debt-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.debt-calendar-week {
  margin-bottom: 4px;
  color: var(--quiet);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}
.debt-calendar-day {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.debt-calendar-day:hover {
  background: var(--sunken);
}
.debt-calendar-day.is-muted {
  color: var(--muted);
  opacity: .55;
}
.debt-calendar-day.is-in-range {
  background: rgba(47, 143, 91, 0.12);
}
.debt-calendar-day.is-selected {
  background: var(--forest);
  color: #fff;
}
.debt-calendar-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(22, 53, 42, 0.08);
  color: var(--quiet);
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}
.debt-calendar-foot button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 10px;
}
.debt-table th:nth-child(1),
.debt-table td:nth-child(1) { width: 2.4%; }
.debt-table th:nth-child(2),
.debt-table td:nth-child(2) { width: 25%; }
.debt-table th:nth-child(3),
.debt-table td:nth-child(3) { width: 8%; }
.debt-table th:nth-child(4),
.debt-table td:nth-child(4) { width: 9%; }
.debt-table th:nth-child(5),
.debt-table td:nth-child(5) { width: 8%; }
.debt-table th:nth-child(6),
.debt-table td:nth-child(6) { width: 8%; }
.debt-table th:nth-child(7),
.debt-table td:nth-child(7) { width: 6%; }
.debt-table th:nth-child(8),
.debt-table td:nth-child(8) { width: 6%; }
.debt-table th:nth-child(9),
.debt-table td:nth-child(9) { width: 6.5%; }
.debt-table th:nth-child(10),
.debt-table td:nth-child(10) { width: 10%; }
.debt-table th:nth-child(11),
.debt-table td:nth-child(11) { width: 11.1%; }
.debt-table td {
  padding: 7px 4px;
  border-top: 1px solid rgba(22, 53, 42, 0.08);
  color: var(--ink);
  vertical-align: middle;
}
.debt-table td:nth-child(5),
.debt-table td:nth-child(7),
.debt-table td:nth-child(8),
.debt-table td:nth-child(9),
.debt-table td:nth-child(10) {
  white-space: nowrap;
  text-align: left;
}
.debt-check-col {
  text-align: center;
}
.debt-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.debt-table td:nth-child(2) {
  white-space: normal;
  overflow-wrap: anywhere;
}
.debt-description-text {
  display: block;
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.debt-edit-input,
.debt-edit-select {
  min-height: 30px;
  padding: 5px 6px;
}
.debt-edit-input:focus,
.debt-edit-select:focus,
.debt-new-form input:focus,
.debt-new-form select:focus {
  outline: 2px solid rgba(47, 143, 91, 0.18);
  border-color: rgba(47, 143, 91, 0.36);
}
.debt-edit-input[aria-busy="true"],
.debt-edit-select[aria-busy="true"] {
  background: var(--sunken);
}
.debt-edit-money,
.debt-edit-rate {
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.debt-row-sub {
  display: block;
  margin-top: 3px;
  color: var(--quiet);
  font-size: 10px;
}
.debt-person,
.debt-creditor,
.debt-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: var(--r-pill);
  background: #eef2ec;
  color: var(--forest-2);
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.debt-person-joao,
.debt-creditor-joao { background: rgba(22, 53, 42, 0.1); color: var(--forest); }
.debt-person-matheus,
.debt-creditor-matheus { background: var(--green-100); color: var(--green-700); }
.debt-person-conjunta { background: var(--sunken); color: var(--ink); }
.debt-status-settled { background: var(--green-soft); color: var(--green); }
.debt-status-overdue { background: var(--red-soft); color: var(--red); }
.debt-status-in_progress { background: var(--amber-soft); color: var(--amber); }
.debt-status-not_started { background: var(--sunken); color: var(--quiet); }
.debt-ledger-row.is-settled { opacity: .68; }
.debt-ledger-row.is-editing td { background: #fbfcf8; }
.debt-ledger-row.creditor-joao .debt-creditor { border: 1px solid rgba(22, 53, 42, .12); }
.debt-ledger-row.creditor-matheus .debt-creditor { border: 1px solid rgba(47, 143, 91, .18); }
.debt-empty { margin: 16px 0 0; text-align: center; }

@media (max-width: 980px) {
  .debt-summary,
  .debt-selection-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .debt-summary,
  .debt-selection-summary { grid-template-columns: 1fr; }
  .debt-table-panel {
    padding: 18px 14px;
  }
  .debt-table-panel .panel-head {
    gap: 14px;
  }
  .debt-table-panel .panel-head > div:first-child,
  .debt-head-actions {
    width: 100%;
  }
  .debt-head-actions {
    justify-content: flex-start;
  }
  .debt-table-panel .btn-ghost {
    flex: 1 1 140px;
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
  }
  .debt-new-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .debt-new-actions {
    display: grid;
    grid-template-columns: 1fr;
    white-space: normal;
  }
  .debt-new-actions .btn,
  .debt-new-actions .btn-ghost {
    width: 100%;
    justify-content: center;
  }
  .debt-new-form input,
  .debt-new-form select,
  .debt-edit-input,
  .debt-edit-select {
    min-height: 42px;
    font-size: 13px;
  }
  .debt-table-wrap {
    overflow: visible;
    border: 0;
    margin-top: 16px;
  }
  .debt-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
    border-collapse: separate;
  }
  .debt-table thead {
    display: block;
    margin-bottom: 12px;
  }
  .debt-table thead tr {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 0 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .debt-table thead tr::-webkit-scrollbar { display: none; }
  .debt-table thead th {
    position: static;
    display: flex;
    flex: 0 0 auto;
    width: auto !important;
    padding: 0;
    background: transparent;
  }
  .debt-table thead th:nth-child(1),
  .debt-table thead th:nth-child(7),
  .debt-table thead th:nth-child(8),
  .debt-table thead th:nth-child(9) {
    display: none;
  }
  .debt-th-main,
  .debt-th-sort,
  .debt-th-label {
    min-height: 36px;
  }
  .debt-th-main,
  .debt-th-sort,
  .debt-th-label,
  .debt-filter-trigger,
  .debt-date-trigger {
    border-radius: var(--r-pill);
  }
  .debt-th-sort,
  .debt-th-label {
    padding: 0 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
  }
  .debt-th-main .debt-th-sort,
  .debt-th-main .debt-th-label {
    border-top-right-radius: var(--r-sm);
    border-bottom-right-radius: var(--r-sm);
  }
  .debt-filter-trigger,
  .debt-date-trigger {
    width: 36px;
    height: 36px;
  }
  .debt-filter-popover,
  .debt-date-popover {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    width: auto;
    max-height: min(420px, calc(100dvh - 24px));
    overflow: auto;
  }
  .debt-table tbody {
    display: grid;
    gap: 12px;
  }
  .debt-table tr.debt-ledger-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
    padding: 15px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
  }
  .debt-table tr.debt-ledger-row.is-editing {
    background: #fbfcf8;
  }
  .debt-ledger-row td {
    display: grid;
    gap: 4px;
    width: auto !important;
    padding: 0;
    border: 0;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }
  .debt-ledger-row td::before {
    content: "";
    color: var(--quiet);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .04em;
    line-height: 1;
    text-transform: uppercase;
  }
  .debt-ledger-row td:nth-child(1) {
    position: absolute;
    top: 14px;
    right: 14px;
    display: block;
    z-index: 1;
  }
  .debt-ledger-row td:nth-child(1)::before,
  .debt-ledger-row td:nth-child(2)::before {
    display: none;
  }
  .debt-ledger-row td:nth-child(2) {
    grid-column: 1 / -1;
    padding-right: 34px;
  }
  .debt-ledger-row td:nth-child(3)::before { content: "Data"; }
  .debt-ledger-row td:nth-child(4)::before { content: "Respons."; }
  .debt-ledger-row td:nth-child(5)::before { content: "Valor"; }
  .debt-ledger-row td:nth-child(6)::before { content: "Credor"; }
  .debt-ledger-row td:nth-child(7)::before { content: "Prop. M"; }
  .debt-ledger-row td:nth-child(8)::before { content: "Prop. J"; }
  .debt-ledger-row td:nth-child(9)::before { content: "% pago"; }
  .debt-ledger-row td:nth-child(10)::before { content: "Saldo"; }
  .debt-ledger-row td:nth-child(11)::before { content: "Status"; }
  .debt-description-text {
    font-size: 15px;
    line-height: 1.25;
  }
  .debt-row-sub {
    font-size: 12px;
  }
  .debt-person,
  .debt-creditor,
  .debt-status {
    justify-self: start;
    min-height: 30px;
    padding: 5px 10px;
    font-size: 12px;
  }
  .debt-money,
  .debt-rate {
    font-size: 14px;
    font-weight: 800;
  }
}

/* ============================ BALANCE SHEET VIEW ============================ */
#view-networth { display: grid; gap: 22px; }
.bs-layout { display: grid; gap: 20px; }
.bs-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.bs-kpi {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 18px 20px;
}
.bs-kpi-primary {
  background: var(--forest);
  border-color: var(--forest);
}
.bs-kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.bs-kpi strong { color: var(--ink); font-size: 25px; line-height: 1.08; }
.bs-kpi small { color: var(--quiet); font-size: 12px; }
.bs-kpi-primary span,
.bs-kpi-primary small { color: rgba(255, 255, 255, .74); }
.bs-kpi-primary strong { color: #fff; }
.bs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.bs-breakdown,
.bs-table-panel { padding: 22px 24px; }
.bs-breakdown-list { display: grid; gap: 8px; margin-top: 14px; }
.bs-break-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid rgba(22, 53, 42, .08);
}
.bs-break-row:first-child { border-top: 0; }
.bs-break-row span { color: var(--ink); font-weight: 700; font-size: 13px; }
.bs-break-row strong { color: var(--forest); font-size: 13px; white-space: nowrap; }
.bs-break-row small { grid-column: 1 / -1; color: var(--quiet); font-size: 11px; }
.bs-tables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}
.bs-table-wrap { overflow-x: auto; min-width: 0; }
.bs-table-wrap h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.bs-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 13px;
}
.bs-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 10px 9px;
  background: var(--surface);
  color: var(--quiet);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.bs-table td {
  padding: 12px 9px;
  border-top: 1px solid rgba(22, 53, 42, .08);
  vertical-align: top;
  color: var(--ink);
}
.bs-table td:first-child strong { display: block; font-size: 13px; }
.bs-table td:first-child span { display: block; margin-top: 3px; color: var(--quiet); font-size: 11px; }
.bs-table td:last-child { text-align: right; white-space: nowrap; font-weight: 800; }
.bs-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.bs-pill-ok { background: var(--green-100); color: var(--green-800); }
.bs-pill-warn { background: var(--amber-soft); color: var(--amber); }
.bs-pill-muted { background: var(--surface-soft); color: var(--muted); }
.bs-empty,
.bs-empty-line { margin: 12px 0 0; }

@media (max-width: 980px) {
  .bs-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bs-grid,
  .bs-tables { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .bs-kpis { grid-template-columns: 1fr; }
}

/* ============================ SAVING PLANS VIEW ============================ */

#view-savings {
  --sv-card: #e9f2da;
  --sv-line: rgba(22, 53, 42, 0.09);
  --sv-line-soft: rgba(22, 53, 42, 0.055);
  display: grid;
  gap: 22px;
  letter-spacing: 0;
}

/* Summary cards */
.sv-stats {
  display: grid;
  grid-template-columns: minmax(300px, 1.12fr) minmax(220px, 1fr) minmax(220px, 1fr) minmax(210px, .9fr);
  gap: 20px;
  margin-bottom: 0;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--sv-line-soft);
}
.sv-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 96px;
  padding: 22px 26px;
  border-radius: 20px;
  background: var(--sv-card);
  border: 1px solid rgba(22, 53, 42, 0.025);
}
.sv-stat-label { font-size: 14px; font-weight: 600; color: #5d6c5f; }
.sv-stat-value-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sv-stat-value-row strong { font-size: 28px; font-weight: 800; color: var(--forest); }
.sv-stat-note { display: block; margin-top: 8px; font-size: 11px; line-height: 1.35; color: #7c8a7e; }

/* Per-person monthly savings: two simple name → amount lines (replaces the old
   "Metas ativas" count). Amounts come from the same planned-investment figure the
   dashboard shows, so this stays in sync with "Investimento planejado". */
.sv-stat-people .sv-stat-info { flex: 1; min-width: 0; }
.sv-people-lines { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.sv-people-lines li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.sv-people-name { font-size: 13px; font-weight: 600; color: #5d6c5f; }
.sv-people-value { font-size: 19px; font-weight: 800; color: var(--forest); white-space: nowrap; }

/* Primary Metas card: the invested portfolio total, styled as the tab headline. */
.sv-stat-primary { background: var(--forest); border-color: var(--forest); }
.sv-stat-primary .sv-stat-label { color: rgba(255, 255, 255, 0.78); }
.sv-stat-primary .sv-stat-value-row strong { color: #ffffff; }
.sv-stat-primary .sv-stat-note { color: rgba(255, 255, 255, 0.72); }
.sv-stat-primary .sv-stat-icon { background: rgba(255, 255, 255, 0.16); color: #ffffff; }
.sv-stat-primary .sv-chip { background: rgba(255, 255, 255, 0.16); color: #ffffff; }
.sv-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.sv-chip svg { width: 12px; height: 12px; }
.sv-chip.up { color: #3f9d54; background: #d6efc4; }
.sv-chip.down { color: var(--red); background: var(--red-soft); }
.sv-stat-icon {
  display: grid;
  place-items: center;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--forest);
  flex-shrink: 0;
}
.sv-stat-icon svg { width: 24px; height: 24px; }

/* Main two-column layout. Left column width == one summary card, so the
   Saving Plans list aligns with the first stat card above it. */
.sv-main {
  display: grid;
  grid-template-columns: minmax(340px, 0.96fr) minmax(0, 2fr);
  gap: 22px;
  align-items: start;
}
.sv-right { display: grid; gap: 22px; min-width: 0; }
/* Reference proportions: the goal-detail column is the narrowest (~25% of the
   content width), the plans list wider (~33%), and the tips/balance stack widest
   (~41%). Within this right 2/3, that means detail:stack ≈ 0.9 : 1.5. */
.sv-right-top {
  display: grid;
  grid-template-columns: minmax(324px, 0.88fr) minmax(430px, 1.5fr);
  gap: 22px;
  align-items: start;
}
.sv-right-stack { display: grid; gap: 22px; align-content: start; }
/* Middle column stack: goal detail on top, asset-class allocation pie beneath it. */
.sv-mid-col { display: grid; gap: 22px; align-content: start; min-width: 0; }

#view-savings .panel {
  border-color: var(--sv-line);
  box-shadow: 0 1px 1px rgba(22, 36, 29, 0.035), 0 16px 34px rgba(22, 36, 29, 0.045);
}

#view-savings .panel-head {
  margin-bottom: 18px;
}

/* Plans list */
.sv-plans-panel { display: flex; flex-direction: column; padding: 22px 20px 20px; }
.sv-plan-list { display: grid; gap: 14px; }
.sv-plan {
  display: grid;
  gap: 13px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--sv-line-soft);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 1px 1px rgba(22, 36, 29, 0.02);
}
.sv-plan.is-selected {
  background: var(--sv-card);
  border-color: rgba(22, 53, 42, 0.07);
}
.sv-plan-top { display: flex; align-items: center; gap: 12px; }
.sv-plan-icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #eff2ed;
  color: var(--forest);
  flex-shrink: 0;
}
.sv-plan.is-selected .sv-plan-icon { background: #ffffff; }
.sv-plan-icon svg { width: 20px; height: 20px; }
.sv-plan-name { flex: 1; min-width: 0; display: grid; gap: 3px; }
.sv-plan-name b { font-size: 15px; font-weight: 700; color: var(--ink); }
.sv-plan-name span { font-size: 12.5px; color: var(--muted); }
.sv-plan-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.sv-plan-title b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sv-plan-meta { display: grid; gap: 3px; text-align: right; flex-shrink: 0; }
.sv-plan-meta b { font-size: 15px; font-weight: 700; color: var(--ink); }
.sv-plan-meta span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sv-reserve-wrap,
.sv-feasibility-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
.sv-reserve-info,
.sv-feasibility-info {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid rgba(22, 53, 42, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.74);
  color: var(--forest);
  cursor: help;
}
.sv-reserve-info svg,
.sv-feasibility-info svg { width: 13px; height: 13px; }
.sv-reserve-info:focus-visible,
.sv-feasibility-info:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--forest) 42%, transparent);
  outline-offset: 2px;
}
.sv-reserve-below_suggested_range .sv-reserve-info {
  color: var(--amber);
  border-color: rgba(190, 120, 39, 0.28);
  background: var(--amber-soft);
}
.sv-reserve-above_suggested_range .sv-reserve-info {
  color: var(--forest-2);
  border-color: rgba(22, 53, 42, 0.22);
}
.sv-reserve-insufficient_data .sv-reserve-info {
  color: var(--quiet);
  border-color: rgba(22, 53, 42, 0.14);
  background: #f5f6f2;
}
.sv-feasibility-ahead .sv-feasibility-info,
.sv-feasibility-on_track .sv-feasibility-info,
.sv-feasibility-completed .sv-feasibility-info {
  color: var(--forest);
  border-color: rgba(58, 130, 92, 0.24);
  background: var(--green-100);
}
.sv-feasibility-behind .sv-feasibility-info {
  color: var(--amber);
  border-color: rgba(190, 120, 39, 0.28);
  background: var(--amber-soft);
}
.sv-feasibility-not_started .sv-feasibility-info,
.sv-feasibility-insufficient_data .sv-feasibility-info {
  color: var(--quiet);
  border-color: rgba(22, 53, 42, 0.14);
  background: #f5f6f2;
}
.sv-reserve-tooltip,
.sv-feasibility-tooltip {
  position: absolute;
  z-index: 25;
  left: 50%;
  bottom: calc(100% + 9px);
  width: min(308px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid rgba(22, 53, 42, 0.12);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(22, 36, 29, 0.16);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition: opacity .14s ease, transform .14s ease;
}
.sv-reserve-wrap:hover .sv-reserve-tooltip,
.sv-reserve-wrap:focus-within .sv-reserve-tooltip,
.sv-reserve-wrap.is-open .sv-reserve-tooltip,
.sv-feasibility-wrap:hover .sv-feasibility-tooltip,
.sv-feasibility-wrap:focus-within .sv-feasibility-tooltip,
.sv-feasibility-wrap.is-open .sv-feasibility-tooltip {
  opacity: 1;
  transform: translate(-50%, 0);
}
.sv-detail-head h3 {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.sv-bar { height: 10px; border-radius: var(--r-pill); background: #d6ecb0; overflow: hidden; }
.sv-bar > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--forest); }
.sv-bar.lg { height: 16px; }

/* Portfolio scaffold additions */
.sv-empty { padding: 24px 12px; color: var(--muted); font-size: 14px; text-align: center; }
.sv-alloc-list { display: grid; gap: 16px; }
.sv-alloc-row { display: grid; gap: 8px; }
.sv-alloc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sv-alloc-head span { font-size: 14px; color: var(--ink); }
.sv-alloc-head b { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* Goals / history / stocks (savings modules) */
.sv-history-panel { margin-bottom: 0; }
.sv-history-heading { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.sv-history-mode {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: #eef2ec;
}
.sv-history-mode button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.sv-history-mode button svg { width: 14px; height: 14px; }
.sv-history-mode button.active {
  background: #fff;
  color: var(--forest);
  box-shadow: 0 2px 6px rgba(22, 36, 29, 0.12);
}
.sv-history { min-height: 220px; display: flex; align-items: center; justify-content: center; }
.sv-history svg { width: 100%; height: auto; display: block; }
.sv-history-note { margin: 8px 2px 0; font-size: 12px; color: var(--muted); }
.sv-strategy { display: grid; gap: 0; }
.sv-strategy-empty { color: var(--muted); font-size: 12px; padding: 6px 0; }
.sv-goal { cursor: pointer; transition: background 0.15s ease; }
.sv-goal:hover { background: #f4f8f0; border-color: rgba(22, 53, 42, 0.1); }
.sv-goal:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }

.sv-seg { display: inline-flex; gap: 4px; padding: 4px; background: #eef2ec; border-radius: var(--r-pill); }
.sv-seg-btn {
  border: 0; background: transparent; padding: 6px 14px; border-radius: var(--r-pill);
  font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.sv-seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* Holdings grouped by type */
.sv-group + .sv-group { margin-top: 22px; }
.sv-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sv-group-head h4 { margin: 0; font-size: 15px; }
.sv-group-head span { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.sv-holdings-table th.sv-num, .sv-holdings-table td.sv-num { text-align: right; white-space: nowrap; }
.sv-holdings-table td.up { color: #2f8f5b; font-weight: 600; }
.sv-holdings-table td.down { color: #c96f6f; font-weight: 600; }
.sv-stock-amount { text-align: right; white-space: nowrap; }

/* Goal editor modal */
.sv-modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(16, 32, 26, 0.45);
}
.sv-modal[hidden] { display: none; }
.sv-modal-card {
  width: min(1120px, calc(100vw - 48px)); max-height: 92vh; overflow-y: auto; background: #fff;
  border-radius: 20px; padding: 32px; box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.sv-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.sv-modal-head h3 { margin: 0; }
.icon-btn { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 4px; }
.sv-form { display: grid; gap: 22px; }
.sv-field { display: grid; gap: 9px; }
.sv-field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.sv-field input, .sv-field select {
  border: 1px solid #d8e0d4; border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 14px; background: #fff;
}
.sv-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.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;
}
.sv-holding-picker {
  max-height: min(48vh, 540px); overflow: auto; border: 1px solid #eef2ec;
  border-radius: 12px; padding: 0 12px; background: #fff;
}
.sv-allocation-selection {
  position: sticky;
  top: 0;
  z-index: 3;
  width: max-content;
  max-width: 100%;
  margin: 10px 0 0;
}
.sv-alloc-table { width: 100%; min-width: 920px; border-collapse: collapse; }
.sv-alloc-table th, .sv-alloc-table td { padding: 14px 12px; text-align: left; vertical-align: middle; }
.sv-alloc-table thead th {
  position: sticky; top: 0; z-index: 1; background: #fff; border-bottom: 1px solid #eef2ec;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--quiet);
}
.sv-holding-picker:has(.sv-allocation-selection:not([hidden])) .sv-alloc-table thead th { top: 42px; }
.sv-alloc-table thead th[data-sort] { cursor: pointer; user-select: none; }
.sv-alloc-table thead th[data-sort]::after {
  content: ""; display: inline-block; margin-left: 6px; vertical-align: middle;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid var(--quiet); opacity: .35; transform: translateY(1px);
}
.sv-alloc-table thead th[data-sort]:hover { color: var(--forest); }
.sv-alloc-table thead th.sort-asc::after {
  border-top-color: transparent; border-bottom: 5px solid var(--forest);
  transform: translateY(-2px); opacity: 1;
}
.sv-alloc-table thead th.sort-desc::after { border-top-color: var(--forest); opacity: 1; }
.sv-alloc-table th.sv-num, .sv-alloc-table td.sv-num { text-align: right; white-space: nowrap; }
.sv-alloc-table tbody tr:hover { background: #f4f8f0; }
.sv-alloc-table tbody tr { border-bottom: 1px solid #eef2ec; }
.sv-alloc-table tbody tr:last-child { border-bottom: 0; }
.sv-alloc-table tfoot td { border-top: 1px solid #eef2ec; padding-top: 16px; padding-bottom: 16px; font-size: 13px; font-weight: 700; color: var(--ink); }
.sv-pick-cell-check { width: 42px; padding-right: 4px; text-align: center; }
.sv-pick-check { cursor: pointer; }
.sv-pick-name { min-width: 260px; font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.25; }
.sv-pick-owner, .sv-pick-bank { font-size: 13px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.sv-pick-value { font-size: 13px; color: var(--muted); }
.sv-pick-alloc {
  min-width: 180px;
  display: grid;
  justify-items: end;
  row-gap: 8px;
  padding-right: 16px;
}
.sv-pick-alloc-amount {
  display: block; margin-top: 2px; font-size: 13px; color: var(--ink); line-height: 1.2;
}
.sv-pick-avail { display: block; font-size: 11px; color: var(--quiet); line-height: 1.2; }
.sv-pick-avail.is-over { color: #c96f6f; font-weight: 600; }
.sv-pick-pct-box { display: inline-grid; grid-template-columns: 88px 20px; align-items: center; column-gap: 8px; }
.sv-pick-pct {
  width: 88px; border: 1px solid #d8e0d4; border-radius: 12px; padding: 8px 10px;
  font: inherit; font-size: 13px; text-align: right; -moz-appearance: textfield; appearance: textfield;
}
.sv-pick-pct::-webkit-outer-spin-button, .sv-pick-pct::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sv-pick-pct:disabled { background: #f4f6f2; color: var(--quiet); }
.sv-pick-pct.is-over { border-color: #c96f6f; color: #c96f6f; }
.sv-pick-pct-suffix { font-size: 13px; color: var(--muted); text-align: left; }
.sv-alloc-total-target { font-weight: 400; color: var(--muted); }
.sv-modal-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.sv-modal-actions-right { display: flex; gap: 10px; margin-left: auto; }
.btn-ghost { border: 1px solid #d8e0d4; background: #fff; border-radius: var(--r-pill); padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.btn-primary { border: 0; background: var(--forest); color: #fff; border-radius: var(--r-pill); padding: 9px 20px; font: inherit; font-weight: 600; cursor: pointer; }
#sv-goal-delete { color: #c96f6f; border-color: #ecc7c7; }

.sv-add-plan {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 14px;
  background: var(--forest);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}
.sv-add-plan:hover { background: var(--forest-2); }
.sv-add-plan svg { width: 18px; height: 18px; }

/* Vacation Fund detail */
.sv-detail-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 30px 24px 32px;
  border-radius: 20px;
  background: var(--sv-card);
  border: 1px solid rgba(22, 53, 42, 0.035);
}
.sv-detail-head { display: flex; align-items: center; gap: 15px; margin-bottom: 30px; }
.sv-detail-icon {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--forest);
  flex-shrink: 0;
}
.sv-detail-icon svg { width: 23px; height: 23px; stroke-width: 1.9; }
.sv-detail-head h3 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.18; color: var(--ink); }
.sv-detail-amount { display: flex; align-items: baseline; flex-wrap: wrap; margin: 0 0 18px; color: var(--forest); }
.sv-detail-amount strong { font-size: 28px; font-weight: 700; letter-spacing: 0; }
.sv-detail-amount span { font-size: 18px; font-weight: 500; color: #6f7c73; }
.sv-detail-status { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; font-size: 17px; line-height: 1.2; }
.sv-detail-status span { color: var(--forest); font-weight: 600; }
.sv-detail-status b { font-size: 18px; font-weight: 700; color: var(--forest); }
.sv-divider { border: 0; border-top: 1px solid rgba(22, 53, 42, 0.12); margin: 32px 0 28px; }
.sv-detail-list { margin: 0; display: grid; gap: 24px; }
.sv-detail-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
  align-items: flex-start;
  column-gap: 20px;
}
.sv-detail-row dt { font-size: 14px; font-weight: 500; color: #7f897f; line-height: 1.35; }
.sv-detail-row dd { margin: 0; min-width: 0; font-size: 14px; font-weight: 500; color: var(--ink); text-align: left; line-height: 1.35; }
.sv-members { display: grid; gap: 12px; justify-items: start; }
.sv-member { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.sv-avatar {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.sv-contrib-list {
  display: grid;
  gap: 22px;
  min-width: 0;
}
.sv-contrib-line {
  display: grid;
  gap: 9px;
  min-width: 0;
}
.sv-contrib-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.sv-contrib-main span,
.sv-contrib-main b,
.sv-contrib-main em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sv-contrib-main b { font-weight: 750; color: var(--ink); }
.sv-contrib-main em {
  font-style: normal;
  font-size: 12px;
  font-weight: 750;
  color: var(--forest);
}
.sv-contrib-line small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.sv-contrib-bar {
  height: 6px;
  border-radius: var(--r-pill);
  background: rgba(22, 53, 42, 0.11);
  overflow: hidden;
}
.sv-contrib-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--forest);
}
.sv-contrib-line:nth-child(2) .sv-contrib-bar span { background: var(--lime-strong); }
.sv-contrib-basis {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

/* Saving tips */
.sv-tips-panel h3 { margin: 0 0 16px; font-size: 17px; font-weight: 700; }
.sv-tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
.sv-tips li { position: relative; padding-left: 20px; font-size: 14px; line-height: 1.45; color: #46514a; }
.sv-tips li::before {
  content: "";
  position: absolute;
  left: 4px; top: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--forest);
}
.sv-tips li b { color: var(--ink); font-weight: 700; }

/* Balance chart */
.sv-balance-panel { display: flex; flex-direction: column; }
.sv-chart { margin-top: 8px; }
.sv-chart svg { display: block; width: 100%; height: auto; }
.sv-line { fill: none; stroke: var(--forest); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.sv-line-area { fill: url(#sv-area); stroke: none; }
.sv-guide-dot { fill: var(--forest); }
.sv-chart .cf-col { cursor: pointer; }

/* Detail-pane avatar + edit button */
.sv-avatar.joao { background: var(--forest); color: #fff; }
.sv-avatar.matheus { background: var(--lime-strong); color: var(--forest); }
.sv-detail-head .sv-detail-edit {
  position: absolute;
  top: 18px;
  right: 16px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.12s ease, color 0.12s ease;
}
.sv-detail-panel:hover .sv-detail-edit,
.sv-detail-edit:focus-visible { opacity: 1; }
.sv-detail-head .sv-detail-edit:hover { color: var(--forest); }

/* Transactions numeric column */
.sv-tx-table td.sv-num, .sv-tx-table th.sv-num { text-align: right; white-space: nowrap; }

/* Transactions */
.sv-tx-table thead th { cursor: default; padding: 12px 14px 16px; }
.sv-tx-table thead th::after { display: none; }
.sv-tx-th { display: inline-flex; align-items: center; gap: 6px; }
.sv-tx-th svg { width: 13px; height: 13px; color: var(--quiet); }
.sv-tx-table tbody td { font-size: 13.5px; color: var(--muted); }
.sv-tx-type { display: flex; align-items: center; gap: 12px; }
.sv-tx-icon {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #e2f0d0;
  color: #3f9d54;
  flex-shrink: 0;
}
.sv-tx-icon svg { width: 17px; height: 17px; }
.sv-tx-label { color: var(--muted); }
.sv-tx-label b { color: var(--ink); font-weight: 700; }
.sv-amount { font-weight: 700; }
.sv-amount.up { color: #3f9d54; }
.sv-amount.down { color: var(--red); }

/* Allocation pie (investments split across goals) */
.sv-pie { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.sv-pie-svg { width: 132px; height: 132px; flex-shrink: 0; }
.sv-pie-total { font-size: 14px; font-weight: 700; fill: var(--ink); }
.sv-pie-caption { font-size: 10px; fill: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sv-pie-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; flex: 1; min-width: 120px; }
.sv-pie-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sv-pie-legend .sv-pie-name { flex: 1; min-width: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-pie-legend b { font-weight: 700; color: var(--ink); }
.sv-pie-swatch { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }

.sv-pie-panel,
.sv-alloc-panel,
.sv-aportes-panel,
.sv-holdings-panel {
  padding: 24px 26px;
}

/* Holdings-table allocation column: one chip per goal the holding funds */
.sv-alloc-cell { min-width: 140px; }
.sv-alloc-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sv-alloc-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: #f1f5ee; font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.sv-alloc-swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.sv-alloc-free { font-size: 12px; color: var(--quiet); }

/* Evolução range selector fits the narrower balance panel by wrapping under the title */
.sv-balance-panel .panel-head { flex-wrap: wrap; row-gap: 10px; }
.sv-balance-panel .cf-range { justify-content: flex-start; }

@media (min-width: 1201px) and (max-width: 1500px) {
  .sv-main { grid-template-columns: minmax(260px, .72fr) minmax(0, 2.28fr); }
  .sv-right-top { grid-template-columns: minmax(250px, .8fr) minmax(340px, 1.5fr); }
}

@media (max-width: 1200px) {
  .sv-main { grid-template-columns: 1fr; }
  .sv-stats { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sv-right-top { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .sv-modal { padding: 12px; }
  .sv-modal-card { width: 100%; padding: 22px 18px; }
  .sv-field-row { grid-template-columns: 1fr; gap: 16px; }
  .sv-alloc-table th, .sv-alloc-table td { padding: 7px 5px; }
  .sv-reserve-tooltip,
  .sv-feasibility-tooltip {
    position: fixed;
    left: 16px;
    right: 16px;
    top: 88px;
    bottom: auto;
    width: auto;
    transform: translate(0, 4px);
  }
  .sv-reserve-wrap:hover .sv-reserve-tooltip,
  .sv-reserve-wrap:focus-within .sv-reserve-tooltip,
  .sv-reserve-wrap.is-open .sv-reserve-tooltip,
  .sv-feasibility-wrap:hover .sv-feasibility-tooltip,
  .sv-feasibility-wrap:focus-within .sv-feasibility-tooltip,
  .sv-feasibility-wrap.is-open .sv-feasibility-tooltip {
    transform: translate(0, 0);
  }
}

/* ===================== PRIVACY MODE ===================== */
/* Masked figures: calm colour + spacing so the dots read as an intentional
   placeholder, overriding any per-value colour (e.g. red/green amounts). */
.pv-masked {
  color: var(--muted) !important;
  letter-spacing: .18em;
  user-select: none;
}
/* Charts encode the same figures as shapes/heights, so blur them while hidden. */
body.privacy-on #cashflow-chart,
body.privacy-on #donut-chart,
body.privacy-on #account-cashflow,
body.privacy-on #spending-limit-chart,
body.privacy-on #cards-projection-chart,
body.privacy-on .sp-hc-chart,
body.privacy-on .si-merchants-chart,
body.privacy-on .sv-chart,
body.privacy-on .ess-chart {
  filter: blur(8px);
  pointer-events: none;
}
/* Toggle button: highlighted while values are hidden. */
#privacy-toggle.is-hiding { background: var(--forest); color: #fff; }
#privacy-toggle.is-hiding:hover { background: var(--forest-2); }

/* ===== Nubank caixinhas ===== */
#sv-caixinha-organize { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; font-size: 13px; }
#sv-caixinha-organize svg { width: 15px; height: 15px; }

/* Group headers inside the goal picker */
.sv-alloc-table tbody tr.sv-pick-group { background: var(--surface-soft); }
.sv-alloc-table tbody tr.sv-pick-group:hover { background: var(--surface-soft); }
.sv-pick-group-name { font-size: 13px !important; font-weight: 700 !important; color: var(--forest) !important; }
.sv-pick-group-name svg { width: 15px; height: 15px; vertical-align: -3px; margin-right: 7px; color: var(--forest); }
.sv-pick-group-count { margin-left: 8px; font-size: 11px; font-weight: 600; color: var(--quiet); }
.sv-pick-group-total { font-size: 13px; font-weight: 700; color: var(--ink); }
.sv-pick-group-check { cursor: pointer; }

/* Collapsible groups: the header row toggles its components (hidden by default) */
.sv-alloc-table tbody.sv-pick-group-body tr.sv-pick-group { cursor: pointer; }
.sv-pick-group-body.is-collapsed tr.sv-pick { display: none; }
.sv-pick-group-caret {
  display: inline-flex;
  margin-right: 4px;
  color: var(--muted);
  transition: transform .18s ease;
}
.sv-pick-group-caret svg { width: 14px !important; height: 14px !important; margin-right: 0 !important; color: var(--muted) !important; vertical-align: -2px !important; }
.sv-pick-group-body.is-collapsed .sv-pick-group-caret { transform: rotate(-90deg); }

/* Caixinha header: one % for the whole caixinha; components shown read-only */
.sv-pick-group--caixinha .sv-pick-group-alloc-amount {
  display: block; margin-top: 2px; font-size: 13px; color: var(--ink); line-height: 1.2;
}
.sv-pick--component .sv-pick-name { font-weight: 500; color: var(--muted); padding-left: 8px; }
.sv-pick--component .sv-pick-value { color: var(--quiet); }
.sv-pick-component-amount { font-size: 13px; color: var(--muted); }
.sv-pick-component-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line);
  vertical-align: middle;
}

/* Organizer modal */
.sv-modal-card-wide { width: min(760px, calc(100vw - 48px)); }
.sv-org-body { display: grid; gap: 22px; }
.sv-org-section { display: grid; gap: 12px; }
.sv-org-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sv-org-section h4 { margin: 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.sv-org-hint { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.sv-sg-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 14px 16px; background: var(--surface);
}
.sv-sg-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sv-sg-info strong { font-size: 16px; color: var(--ink); }
.sv-sg-info > span { font-size: 12px; color: var(--muted); }
.sv-sg-match { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--green); margin-top: 2px; }
.sv-sg-match svg { width: 13px; height: 13px; }
.sv-sg-nomatch { font-size: 12px; color: var(--quiet); margin-top: 2px; }
.sv-sg-actions { display: flex; align-items: center; gap: 8px; }
.sv-sg-select, .sv-mn-select, #sv-cx-new-name, #sv-cx-new-owner {
  border: 1px solid #d8e0d4; border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px; background: #fff;
}
.sv-sg-select { max-width: 220px; }
.sv-org-create { display: flex; gap: 10px; flex-wrap: wrap; }
.sv-org-create #sv-cx-new-name { flex: 1; min-width: 180px; }
.sv-org-manual summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--forest); padding: 4px 0; }
.sv-mn-table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.sv-mn-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); font-size: 13px; vertical-align: middle; }
.sv-mn-val { font-weight: 600; color: var(--ink); white-space: nowrap; }
.sv-mn-meta { color: var(--muted); }
.sv-mn-sel { text-align: right; }

/* ===================== INCOME (RENDA) INBOX ===================== */
.income-view {
  display: grid;
  gap: 20px;
  letter-spacing: 0;
}

.income-overview {
  display: grid;
  grid-template-columns: minmax(280px, 1.35fr) repeat(3, minmax(170px, 1fr));
  gap: 16px;
}

.income-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 104px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.income-stat > div { display: grid; gap: 5px; min-width: 0; }
.income-stat span { font-size: 12px; font-weight: 800; color: var(--muted); }
.income-stat strong {
  font-size: 28px;
  font-weight: 800;
  color: var(--forest);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.income-stat small {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--quiet);
}
.income-stat-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--forest-soft);
  color: var(--forest);
}
.income-stat-icon svg { width: 21px; height: 21px; }
.income-stat-primary {
  position: relative;
  border-color: var(--forest);
  background:
    radial-gradient(150px 150px at 92% 8%, rgba(170, 221, 110, .18), transparent 72%),
    var(--forest);
}
.income-stat-primary span,
.income-stat-primary small { color: rgba(255, 255, 255, .72); }
.income-stat-primary strong { color: #fff; }
.income-stat-primary .income-stat-icon {
  background: rgba(255, 255, 255, .14);
  color: var(--lime);
}

.income-panel {
  display: flex;
  flex-direction: column;
  padding: 24px;
}
.income-head {
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.income-head-left { display: flex; flex-direction: column; gap: 4px; }
.income-head-left h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--forest);
}
.income-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}
.income-kicker svg { width: 14px; height: 14px; }
.income-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.income-filter { display: inline-flex; background: var(--sunken); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.income-chip {
  min-height: 32px;
  border: 0;
  background: transparent;
  border-radius: var(--r-pill);
  padding: 0 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.income-chip:hover { color: var(--forest); }
.income-chip.active {
  background: var(--surface);
  color: var(--forest);
  box-shadow: 0 2px 6px rgba(22, 36, 29, 0.12);
}
.income-panel #income-detect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 15px;
  border-color: transparent;
  background: var(--forest);
  color: #fff;
  box-shadow: 0 8px 18px rgba(22, 53, 42, .16);
}
.income-panel #income-detect:hover { background: var(--forest-2); }
.income-panel #income-detect svg { width: 16px; height: 16px; }
.income-panel #income-detect:disabled { opacity: .7; cursor: progress; }

.income-note {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 0 0 18px;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.income-note svg {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--green);
}

/* Renda review ledger — mirrors the Lançamentos table (.tx-table). */
.income-table-wrap { margin-top: 2px; }
.income-table { min-width: 940px; }
.income-table .income-col-owner   { width: 150px; }
.income-table .income-col-label   { width: 148px; }
.income-table .income-col-date    { width: 116px; }
.income-table .income-col-status  { width: 118px; }
.income-table .income-col-amount  { width: 128px; }
.income-table .income-col-actions { width: 248px; }
.income-table td.income-col-amount { text-align: right; }
.income-table thead th {
  vertical-align: middle;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.income-table tbody tr.status-rejected td { opacity: .56; }
.income-empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.income-tx-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.income-tx-cell b {
  font-size: 13px;
  font-weight: 850;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.income-tx-cell small {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.income-date { font-size: 12.5px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.income-amount {
  font-size: 14px;
  font-weight: 850;
  color: var(--green);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.income-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.income-status.status-pending { color: var(--amber); background: var(--amber-soft); }
.income-status.status-confirmed { color: var(--green); background: var(--green-soft); }
.income-status.status-rejected { color: var(--muted); background: var(--sunken); }

.income-table .income-label-select {
  width: 100%;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  outline: none;
}
.income-table .income-label-select:hover { border-color: var(--forest-soft); background: var(--green-50); }
.income-table .income-label-select:focus-visible { border-color: var(--green-500); box-shadow: var(--shadow-focus); }

.income-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.income-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  border-radius: var(--r-pill);
  padding: 0 11px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
}
.income-btn svg { width: 14px; height: 14px; }
.income-btn.confirm {
  background: var(--forest);
  border-color: var(--forest);
  color: #fff;
  box-shadow: 0 7px 14px rgba(22, 53, 42, .13);
}
.income-btn.reject {
  color: var(--red);
  border-color: transparent;
  background: var(--red-soft);
}
.income-btn.ghost { color: var(--muted); background: transparent; border-color: transparent; }
.income-btn:hover { filter: brightness(0.97); }
.income-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.income-state svg { width: 15px; height: 15px; }
.income-state.ok { color: var(--green); }
.income-state.no { color: var(--muted); }

@media (max-width: 1280px) {
  .income-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .income-panel { padding: 20px; }
  .income-head-actions { width: 100%; justify-content: flex-start; }
  .income-filter { max-width: 100%; overflow-x: auto; }
  .income-note { width: 100%; border-radius: var(--r-sm); align-items: flex-start; }
}

@media (max-width: 620px) {
  .income-overview { grid-template-columns: 1fr; }
  .income-stat { min-height: 92px; }
}
.sv-mn-select { min-width: 180px; }

/* ============================ DASHBOARD DECISION ORDER (M17) ============================ */
#view-dashboard {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}
/* Decision-led order: Safe to Spend → on-track → alerts → upcoming
   commitments → the analytical grid. The full Compromissos timeline moved to the
   Recorrentes tab (Phase 1); the Dashboard keeps the compact .commit-mini here. */
.sts-panel { order: 1; }
.on-track-panel { order: 2; }
.attention-panel { order: 3; }
.commit-mini { order: 4; }
#view-dashboard > .grid { order: 5; }

.card-pressure-line .plan-head { align-items: center; }
.card-pressure-money { color: var(--forest); font-weight: 800; white-space: nowrap; }

/* ============================ SAFE TO SPEND ============================ */
/* Primary decision panel: sits above the dashboard grid with elevated emphasis
   over the descriptive metrics below it. Uses the forest accent as its ground. */
.sts-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-bottom: 22px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 55%, var(--green-700) 100%);
  border: 1px solid var(--green-800);
  color: #EEF6E8;
}
.sts-main {
  display: flex;
  gap: 28px;
  padding: 26px 28px 22px;
  flex-wrap: wrap;
}
.sts-lead { flex: 1 1 320px; min-width: 0; }
.sts-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-width: 220px;
}
.sts-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; min-width: 0; }
.sts-head > div { flex: 1 1 auto; min-width: 0; }
.sts-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0; color: #EEF6E8; }
.sts-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--green-200); }
.sts-icon {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255, 255, 255, .12);
  color: var(--green-200);
}
.sts-icon i { width: 20px; height: 20px; }
.sts-status {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .14);
}
.sts-status i { width: 14px; height: 14px; }
.sts-status.ok { background: rgba(180, 245, 140, .22); color: var(--green-200); }
.sts-status.warn { background: rgba(255, 214, 120, .2); color: #FFE29A; }
.sts-status.bad { background: rgba(217, 83, 74, .26); color: #FFC7C2; }
.sts-status.muted { background: rgba(255, 255, 255, .12); color: var(--green-100); }

.sts-figure { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sts-figure .sts-value {
  font-size: clamp(34px, 5vw, 46px);
  font-weight: 800; line-height: 1.05;
  color: #FBFBFB; letter-spacing: 0;
}
.sts-figure-caption { font-size: 12.5px; color: var(--green-200); text-transform: lowercase; }
.sts-explanation {
  margin: 14px 0 0; max-width: 62ch;
  font-size: 13.5px; line-height: 1.5; color: var(--green-100);
}

.sts-warnings { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.sts-warn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 12.5px; line-height: 1.35;
  background: rgba(255, 255, 255, .1); color: #FDE8C8;
}
.sts-warn i { width: 15px; height: 15px; flex: 0 0 auto; }
.sts-warn-high { background: rgba(217, 83, 74, .24); color: #FFD3CE; }

.sts-pace {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  background: rgba(255, 255, 255, .08);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.sts-pace-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sts-pace-item .muted { font-size: 11px; color: var(--green-200); }
.sts-pace-item strong { font-size: 16px; font-weight: 700; color: #FBFBFB; }
.sts-refresh { margin: 0; font-size: 11px; color: var(--green-200); text-align: right; }

.sts-breakdown { border-top: 1px solid rgba(255, 255, 255, .12); }
.sts-breakdown > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 14px 28px; font-size: 12.5px; font-weight: 600;
  color: var(--green-200);
}
.sts-breakdown > summary::-webkit-details-marker { display: none; }
.sts-breakdown > summary i { width: 15px; height: 15px; }
.sts-breakdown[open] > summary { color: #EEF6E8; }
.sts-lines { margin: 0; padding: 0 28px 22px; display: flex; flex-direction: column; gap: 2px; }
.sts-line {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sts-line dt { margin: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--green-100); }
.sts-line dt small { font-size: 11px; color: var(--green-200); opacity: .85; }
.sts-line dd { margin: 0; display: inline-flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.sts-line-sign { color: var(--green-200); font-size: 12px; }
.sts-line-value { font-size: 14px; font-weight: 600; color: #FBFBFB; }
.sts-line.is-muted { opacity: .72; }
.sts-line.is-muted .sts-line-value { font-weight: 500; }
.sts-line.is-total { border-bottom: 0; margin-top: 6px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .22); }
.sts-line.is-total dt { font-size: 14px; font-weight: 700; color: #FBFBFB; }
.sts-line.is-total .sts-line-value { font-size: 18px; font-weight: 800; }
.sts-audit-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 16px; padding: 16px 0 8px;
  border-top: 1px solid rgba(255, 255, 255, .22);
  color: #FBFBFB; font-size: 14px; font-weight: 700;
}
.sts-audit-state { font-size: 12px; font-weight: 700; color: var(--green-100); }
.sts-audit-state.ok { color: #C8F2B5; }
.sts-audit-state.pending { color: #F5D89A; }
.sts-audit-state.warn { color: #FFC3BB; }
.sts-audit-state.muted { color: var(--green-200); }
.sts-audit-line dd { flex: 0 0 auto; }

@media (max-width: 720px) {
  .sts-main { flex-direction: column; gap: 18px; padding: 20px; }
  .sts-lead, .sts-side { width: 100%; max-width: 100%; min-width: 0; flex-basis: auto; }
  .sts-head { align-items: flex-start; flex-wrap: wrap; }
  .sts-icon { flex: 0 0 auto; }
  .sts-status { margin-left: 52px; margin-top: -8px; }
  #view-dashboard .sts-explanation {
    display: block;
    overflow: visible;
    -webkit-line-clamp: initial;
  }
  .sts-warn { width: 100%; min-width: 0; overflow-wrap: anywhere; }
  .sts-breakdown > summary, .sts-lines { padding-left: 20px; padding-right: 20px; }
  .sts-line { align-items: flex-start; }
  .sts-line dt { min-width: 0; overflow-wrap: anywhere; }
}

/* ============================ ON TRACK (M11) ============================ */
.on-track-panel { margin-bottom: 22px; padding: 20px 22px; }
.on-track-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.on-track-head h3 { margin: 0; color: var(--ink); font-size: 1.02rem; }
.on-track-head p { margin: 4px 0 0; font-size: .82rem; }
.on-track-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.on-track-status.ok { background: var(--green-100); color: var(--green-800); }
.on-track-status.warn { background: var(--amber-soft); color: var(--amber); }
.on-track-status.bad { background: var(--red-soft); color: var(--red); }
.on-track-status.muted { background: var(--surface-soft); color: var(--muted); }
.on-track-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.on-track-item {
  min-height: 94px;
  display: grid;
  align-content: space-between;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fbfcf8;
}
.on-track-item > span {
  color: var(--quiet);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.on-track-item strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.05;
}
.on-track-item small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}
@media (max-width: 720px) {
  .on-track-head { flex-direction: column; align-items: stretch; }
  .on-track-status { justify-self: start; }
  .on-track-grid { grid-template-columns: 1fr; }
}

/* ============================ NEEDS ATTENTION (M6) ============================ */
.attention-panel { margin-bottom: 22px; padding: 22px 24px; }
.attention-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.attention-head h3 { margin: 0; color: var(--ink); font-size: 1.05rem; }
.attention-head p { margin: 4px 0 0; font-size: .84rem; }
.attention-count {
  padding: 6px 11px; border-radius: var(--r-pill); background: var(--surface-soft);
  color: var(--forest-2); font-size: .76rem; font-weight: 700; white-space: nowrap;
}
.attention-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; }
.attention-item {
  display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 15px 0; border-top: 1px solid var(--line-soft);
}
.attention-item:first-child { border-top: 0; padding-top: 4px; }
.attention-rank {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-soft); color: var(--forest-2); font-size: .84rem; font-weight: 800;
}
.attention-high .attention-rank { background: var(--red-soft); color: var(--red); }
.attention-medium .attention-rank { background: var(--amber-soft); color: var(--amber); }
.attention-body { min-width: 0; }
.attention-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.attention-title-row h4 { margin: 0; color: var(--ink); font-size: .95rem; }
.attention-urgency {
  display: inline-flex; padding: 3px 7px; border-radius: var(--r-pill);
  font-size: .67rem; font-weight: 800; text-transform: uppercase; letter-spacing: .035em;
}
.attention-urgency-high { background: var(--red-soft); color: var(--red); }
.attention-urgency-medium { background: var(--amber-soft); color: var(--amber); }
.attention-urgency-low { background: var(--green-100); color: var(--green-800); }
.attention-body > p { margin: 5px 0 7px; color: var(--muted); font-size: .82rem; line-height: 1.4; }
.attention-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--quiet); font-size: .73rem; cursor: help; }
.attention-meta b { color: var(--forest-2); font-weight: 700; }
.attention-action {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  color: var(--forest-2); background: var(--surface); font-size: .78rem; font-weight: 700;
  text-decoration: none; white-space: nowrap; transition: background .15s ease, border-color .15s ease;
}
.attention-action:hover { background: var(--green-100); border-color: var(--green-300); }
.attention-action:focus-visible { outline: 3px solid color-mix(in srgb, var(--green-600) 28%, transparent); outline-offset: 2px; }
.attention-action i { width: 14px; height: 14px; }
.attention-empty { margin: 16px 0 0; padding: 18px 0 4px; text-align: center; }
@media (max-width: 1080px) {
  /* The legacy dashboard grid has wide table descendants whose intrinsic size
     can widen #view-dashboard even though the shell itself is fluid. Keep this
     decision card tied to the viewport so its actions remain usable. */
  .attention-panel {
    box-sizing: border-box;
    width: calc(100vw - 56px);
    max-width: calc(100vw - 56px);
  }
}
@media (max-width: 700px) {
  .attention-panel {
    width: calc(100vw - 36px);
    max-width: calc(100vw - 36px);
    padding: 19px 18px;
  }
  .attention-item { grid-template-columns: 32px minmax(0, 1fr); align-items: start; gap: 10px; }
  .attention-action { grid-column: 2; justify-self: start; white-space: normal; text-align: left; }
}

/* ============================ DATA HEALTH (M1) ============================ */
.data-health-card { margin-bottom: 20px; padding: 22px 24px; }
.dh-loading { color: var(--muted); font-size: 0.95rem; padding: 8px 0; }
.dh-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dh-title { margin: 0; font-size: 1.15rem; color: var(--ink); }
.dh-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.85rem; }
.dh-score { display: flex; align-items: baseline; gap: 2px; font-weight: 700; line-height: 1;
  padding: 8px 14px; border-radius: var(--r-pill); white-space: nowrap; }
.dh-score-num { font-size: 1.6rem; }
.dh-score-max { font-size: 0.85rem; opacity: 0.7; }
.dh-score-good { background: var(--green-100); color: var(--green-800); }
.dh-score-warn { background: var(--amber-soft); color: var(--amber); }
.dh-score-bad { background: var(--red-soft); color: var(--red); }
.dh-metrics { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 6px; }
.dh-metric { flex: 1 1 140px; background: var(--surface-soft); border-radius: var(--r-md);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.dh-metric-label { color: var(--muted); font-size: 0.78rem; }
.dh-metric-value { color: var(--ink); font-size: 1.2rem; font-weight: 700; }
.dh-issues { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dh-issue-link { display: flex; align-items: center; gap: 10px; text-decoration: none;
  padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-soft);
  color: var(--ink); transition: background 0.15s ease; }
.dh-issue-link:hover { background: var(--line-soft); }
.dh-issue-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.dh-high .dh-issue-dot { background: var(--red); }
.dh-medium .dh-issue-dot { background: var(--amber); }
.dh-low .dh-issue-dot { background: var(--recurring); }
.dh-issue-msg { flex: 1 1 auto; font-size: 0.9rem; }
.dh-issue-go { color: var(--muted); font-weight: 700; }
.dh-clear { color: var(--green-700); font-size: 0.9rem; padding: 10px 12px;
  background: var(--green-100); border-radius: var(--r-sm); }
@media (max-width: 640px) {
  .dh-head { flex-direction: column-reverse; align-items: flex-start; }
  .dh-metric { flex-basis: 100%; }
}

/* Reconciliation strip inside the data-health card (M2) */
.dh-rec { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.dh-rec > summary { cursor: pointer; color: var(--forest-2); font-weight: 600; font-size: 0.9rem; list-style: none; }
.dh-rec > summary::-webkit-details-marker { display: none; }
.dh-rec > summary::before { content: "▸"; margin-right: 8px; color: var(--muted); }
.dh-rec[open] > summary::before { content: "▾"; }
.dh-rec-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dh-rec-row { display: grid; grid-template-columns: 84px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--surface-soft); border-radius: var(--r-sm); font-size: 0.88rem; }
.dh-rec-month { color: var(--ink); font-weight: 600; }
.dh-rec-src { color: var(--muted); }
.dh-rec-ok { color: var(--green-700); font-weight: 600; }
.dh-rec-delta { color: var(--red); font-weight: 700; }

/* ============================ RECURRING COMMITMENTS (M5) ============================ */
.recurring-head { align-items: flex-start; }
.recurring-totals { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 8px; }
.rec-total { flex: 1 1 150px; background: var(--surface-soft); border-radius: var(--r-md);
  padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.rec-total strong { font-size: 1.3rem; color: var(--ink); }
.recurring-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.rec-item { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 14px;
  padding: 12px 0; border-top: 1px solid var(--line-soft); }
.rec-item:first-child { border-top: 0; }
.rec-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rec-merchant { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { font-size: 0.78rem; }
.rec-owner { color: var(--forest-2); }
.rec-price-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--amber-soft);
  color: var(--amber); font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: var(--r-pill); white-space: nowrap; }
.rec-price-badge i { width: 13px; height: 13px; }
.rec-amounts { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.rec-monthly { color: var(--ink); font-weight: 700; }
.rec-monthly small { color: var(--muted); font-weight: 500; font-size: 0.72rem; }
.rec-annual { font-size: 0.74rem; }
.rec-class { font: inherit; font-size: 0.82rem; padding: 6px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.recurring-empty { padding: 24px 0; text-align: center; }
@media (max-width: 720px) {
  .rec-item { grid-template-columns: 1fr auto; row-gap: 6px; }
  .rec-price-badge { grid-column: 2; }
  .rec-class { grid-column: 1 / -1; }
}

/* ============================ NOTIFICATION BELL (Phase 1) ============================ */
.notif-wrap { position: relative; display: inline-flex; }
.notif-bell .notif-badge {
  position: absolute; top: 5px; right: 5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-pill); background: var(--red); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 1;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.notif-bell.has-alerts { color: var(--forest); }

.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: min(384px, 92vw); max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-popover);
  z-index: 70;
}
.notif-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.notif-head strong { font-size: 15px; color: var(--ink); }
.notif-sub { display: block; font-size: 12px; margin-top: 2px; }
.notif-readall {
  border: 0; background: transparent; color: var(--green);
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.notif-readall:hover { text-decoration: underline; }

.notif-body { padding: 4px 8px 6px; }
.notif-group { padding: 8px 8px 2px; }
.notif-group-label { display: flex; align-items: center; gap: 8px; margin: 4px 2px 8px; }
.notif-group-label .muted { font-size: 11px; font-weight: 700; }
.notif-urgency { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); }
.notif-urgency-high { background: var(--red-soft); color: var(--red); }
.notif-urgency-medium { background: var(--amber-soft); color: var(--amber); }
.notif-urgency-low { background: var(--green-100); color: var(--green-800); }

.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.notif-item {
  display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 10px;
  padding: 10px; border-radius: var(--r-md); transition: background .12s;
}
.notif-item:hover { background: var(--sunken); }
.notif-item:not(.is-unread) { opacity: 0.66; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--neutral-300); }
.notif-item.is-unread.notif-high .notif-dot { background: var(--red); }
.notif-item.is-unread.notif-medium .notif-dot { background: var(--amber); }
.notif-item.is-unread.notif-low .notif-dot { background: var(--green-500); }
.notif-main { min-width: 0; }
.notif-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.notif-item-head h5 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--ink); }
.notif-item:not(.is-unread) .notif-item-head h5 { font-weight: 600; }
.notif-dismiss {
  border: 0; background: transparent; color: var(--quiet);
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0;
}
.notif-dismiss:hover { background: var(--sunken); color: var(--ink); }
.notif-dismiss svg { width: 14px; height: 14px; }
.notif-main p { margin: 3px 0 7px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.notif-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.notif-action { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--green); text-decoration: none; }
.notif-action:hover { text-decoration: underline; }
.notif-action svg { width: 13px; height: 13px; }
.notif-impact { font-size: 11px; color: var(--quiet); }
.notif-impact b { color: var(--forest-2); font-weight: 700; }
.notif-empty {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  text-align: center; color: var(--muted); font-size: 13px; padding: 28px 16px;
}
.notif-empty svg { width: 16px; height: 16px; color: var(--green-500); }
.notif-foot { position: sticky; bottom: 0; padding: 10px 16px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.notif-foot-link { border: 0; background: transparent; color: var(--green); font: inherit; font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.notif-foot-link svg { width: 13px; height: 13px; }

/* Dashboard: "Ver todas" pill in the concise attention summary. */
.attention-see-all {
  border: 1px solid var(--line); background: var(--surface); color: var(--green);
  font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 12px;
  border-radius: var(--r-pill); cursor: pointer; white-space: nowrap;
}
.attention-see-all:hover { background: var(--green-100); border-color: var(--green-300); }

/* ============================ COMPACT COMMITMENTS (Phase 1) ============================ */
.commit-mini { margin-bottom: 22px; padding: 20px 24px; }
.commit-mini-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.commit-mini-head h3 { margin: 0; font-size: 1.05rem; color: var(--ink); }
.commit-mini-head .muted { font-size: 0.84rem; }
.commit-mini-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.commit-mini-total .muted { font-size: 0.84rem; }
.commit-mini-total strong { font-size: 1.4rem; color: var(--ink); }
.commit-mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.commit-mini-item { display: grid; grid-template-columns: auto 24px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.commit-mini-item:first-child { border-top: 0; }
.commit-mini-date { font-size: 0.76rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
.commit-mini-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--sunken); color: var(--forest); }
.commit-mini-ico svg { width: 14px; height: 14px; }
.commit-mini-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.commit-mini-amount { font-weight: 700; color: var(--ink); white-space: nowrap; }
@media (max-width: 720px) {
  .notif-panel { position: fixed; top: 68px; right: 8px; left: 8px; width: auto; }
}

/* A single keyboard-focus language across native and custom controls. */
:where(button, a, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--green-500) 42%, transparent) !important;
  outline-offset: 2px;
}

/* ===================== SHARED DECISION TABLE PATTERN ===================== */
.data-table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 12px;
}
.selection-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--forest-soft);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--green-100) 68%, var(--surface));
  color: var(--forest);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
}
.selection-summary[hidden] { display: none !important; }
.selection-summary > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.selection-summary strong { color: var(--ink); font-weight: 850; }
.selection-summary-muted { color: var(--muted); font-weight: 650; }
.data-table-toolbar select,
.data-table-toolbar input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
}
.data-table-toolbar select { min-width: 150px; padding: 0 34px 0 11px; }
.data-table-search { position: relative; flex: 1 1 240px; max-width: 420px; }
.data-table-search input { width: 100%; padding: 0 12px 0 36px; }
.data-table-search svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--quiet); pointer-events: none; }
.data-table-shell {
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 11px 10px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .035em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table th[data-rec-sort], .data-table th[data-sv-sort], .data-table th[data-table-sort],
.sv-holdings-table th[data-sv-sort] { cursor: pointer; user-select: none; }
.data-table th[data-rec-sort]::after, .data-table th[data-sv-sort]::after, .data-table th[data-table-sort]::after,
.sv-holdings-table th[data-sv-sort]::after { content: "↕"; margin-left: 6px; color: var(--quiet); }
.data-table th.sort-asc::after, .sv-holdings-table th.sort-asc::after { content: "↑"; color: var(--forest); }
.data-table th.sort-desc::after, .sv-holdings-table th.sort-desc::after { content: "↓"; color: var(--forest); }
.data-table td { padding: 11px 10px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr:not(.data-detail-row):hover td { background: var(--surface-soft); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-row-expand { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.data-row-expand:hover { background: var(--green-100); color: var(--forest); }
.data-row-expand svg { width: 16px; height: 16px; transition: transform .15s ease; }
[aria-expanded="true"].data-row-expand svg { transform: rotate(90deg); }
.rec-actions { display: flex; align-items: center; gap: 2px; justify-content: flex-end; }
.rec-remove { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; padding: 0; opacity: .5; transition: opacity .15s ease, background .15s ease, color .15s ease; }
.rec-remove svg { width: 15px; height: 15px; }
.rec-item:hover .rec-remove { opacity: 1; }
.rec-remove:hover { background: var(--danger-soft, #fbe4e4); color: var(--danger, #c0392b); }
.data-detail-row > td { padding: 0 !important; background: #f8faf6; }

@media (max-width: 720px) {
  .data-table-toolbar {
    align-items: stretch;
  }
  .data-table-search,
  .data-table-toolbar select,
  .data-table-toolbar input,
  .selection-summary {
    flex-basis: 100%;
    max-width: 100%;
  }
  .data-table-toolbar select,
  .data-table-toolbar input {
    width: 100%;
  }
}

/* Recurring-cost management ledger */
.recurring-panel { padding: 22px 24px; }
.recurring-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.recurring-totals { display: block; margin: 16px 0 12px; }
.rec-overview {
  display: grid;
  grid-template-columns: minmax(280px, 1.2fr) minmax(360px, .8fr);
  gap: 14px;
  align-items: stretch;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #fbfcf8 0%, var(--surface-soft) 100%);
}
.rec-overview-main { display: grid; align-content: center; gap: 5px; min-width: 0; }
.rec-eyebrow { color: var(--quiet); font-size: 10.5px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.rec-overview-value { color: var(--ink); font-size: clamp(28px, 4vw, 44px); font-weight: 850; line-height: .95; }
.rec-overview-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rec-overview-metrics > div { display: grid; align-content: center; gap: 4px; min-width: 0; padding: 12px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface); }
.rec-overview-metrics strong { color: var(--ink); font-size: 16px; line-height: 1.1; }
.recurring-insight { display: flex; align-items: flex-start; gap: 10px; min-height: 42px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-soft); color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.recurring-insight svg { width: 17px; height: 17px; flex: none; color: var(--amber); }
.recurring-insight b { color: var(--ink); }
.recurring-candidate-panel { margin: 12px 0 14px; padding: 14px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: #fbfcf8; }
.recurring-candidate-panel[hidden] { display: none !important; }
.rec-candidate-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rec-candidate-head h4 { margin: 0 0 3px; color: var(--ink); font-size: 14px; }
.rec-candidate-search { max-width: none; margin-bottom: 10px; }
.recurring-candidates { display: grid; gap: 8px; }
.rec-candidate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto) 132px auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.rec-candidate.already { opacity: .68; }
.rec-candidate-main { display: grid; gap: 2px; min-width: 0; }
.rec-candidate-main b { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-candidate-main span, .rec-candidate-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-candidate-amounts { display: grid; justify-items: end; gap: 2px; }
.rec-candidate-amounts strong { color: var(--ink); }
.rec-candidate-amounts small { color: var(--muted); font-size: 11px; font-weight: 650; }
.rec-candidate .rec-class { width: 132px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; }
.rec-candidate-add { min-height: 34px; padding: 0 12px; border-radius: 9px; white-space: nowrap; }
.recurring-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.recurring-charts > section { min-width: 0; padding: 14px 14px 12px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: #fbfcf8; }
.recurring-charts h4 { margin: 0 0 10px; color: var(--ink); font-size: 13.5px; }
.recurring-chart { width: 100%; min-height: 262px; }
.recurring-toolbar { margin-top: 16px; }
.recurring-selection { margin-left: auto; font-size: 12px; }
.recurring-selection.selection-summary { color: var(--forest); }
.recurring-selection b { color: var(--forest); }
.recurring-ledger-wrap { max-height: min(62vh, 660px); }
.recurring-ledger { min-width: 1060px; }
.recurring-ledger .rec-item { display: table-row; padding: 0; border: 0; }
.recurring-ledger .rec-main { display: grid; gap: 3px; }
.recurring-ledger .rec-merchant { max-width: 230px; }
.recurring-ledger .rec-price-badge { width: max-content; margin-top: 5px; }
.recurring-ledger .rec-class, .recurring-ledger .rec-status { width: 128px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; }
.recurring-ledger .rec-status { width: 102px; }
.recurring-ledger .rec-cost { display: grid; justify-items: end; gap: 2px; }
.recurring-ledger .rec-cost small { color: var(--muted); font-size: 11px; font-weight: 650; }
.rec-check-col { width: 42px; text-align: center !important; }
.rec-check-col input { width: 16px; height: 16px; accent-color: var(--forest); }
.rec-account { max-width: 170px; color: var(--muted); }
.rec-owner { color: var(--forest); font-weight: 750; }
.rec-detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .8fr); gap: 24px; padding: 18px 22px; }
.rec-detail > div > b { display: block; margin-bottom: 10px; color: var(--ink); }
.rec-detail dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.rec-detail dl div { display: grid; gap: 3px; }
.rec-detail dt { color: var(--quiet); font-size: 10.5px; font-weight: 800; text-transform: uppercase; }
.rec-detail dd { margin: 0; color: var(--ink); font-weight: 700; }
.rec-history-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.rec-history-list span { flex: 0 0 auto; display: grid; gap: 2px; min-width: 82px; padding: 8px 9px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--surface); }
.rec-history-list small { color: var(--quiet); }
.rec-history-list b { color: var(--forest); }

/* Essentials small multiples: six charts above the ledger, aligned to its width. */
.essentials-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.essentials-charts-panel { width: 100%; }
.essentials-charts-panel .ess-subhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.essentials-charts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; letter-spacing: 0; }
.ess-chart-card {
  position: relative;
  min-width: 0;
  padding: 18px 18px 14px;
  border: 1px solid var(--line-soft) !important;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: none;
  overflow: visible;
}
.ess-chart-card:first-of-type { padding-top: 18px; }
.ess-chart-card .ess-chart-head { gap: 14px; }
.ess-chart-card .ess-chart-head h4 {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}
.ess-chart-card .ess-chart-total {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
}
.ess-chart-total-card {
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-soft));
  border-color: var(--line) !important;
}
.ess-chart-total-card .ess-chart-head h4 { color: var(--ink); }
.ess-chart-total-card .sm-delta {
  margin-left: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 750;
}
.ess-chart-total-card .sm-delta.up { background: transparent; color: var(--red); }
.ess-chart-total-card .sm-delta.down { background: transparent; color: var(--green); }
.ess-chart-total-card .sm-delta.flat,
.ess-chart-total-card .sm-delta.neutral { background: transparent; color: var(--muted); }
.ess-total-figure { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
.ess-chart { min-height: 176px; }
.ess-sync-cursor {
  position: absolute;
  z-index: 2;
  width: 1px;
  transform: translateX(-0.5px);
  background: color-mix(in srgb, var(--forest) 30%, transparent);
  pointer-events: none;
}
.ess-sync-cursor[hidden],
.ess-sync-tooltip[hidden] { display: none !important; }
.ess-sync-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 156px;
  max-width: min(230px, calc(100% - 16px));
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(18, 26, 22, 0.14);
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.25;
  pointer-events: none;
}
.ess-sync-tooltip-title {
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 800;
}
.ess-sync-tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}
.ess-sync-tooltip-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ess-sync-tooltip-row b {
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}
.ess-sync-tooltip-muted { margin-top: 2px; color: var(--quiet); }
body.privacy-on .ess-sync-tooltip,
body.privacy-on .ess-sync-cursor { display: none !important; }

/* Expandable investment rows and concluding portfolio analysis */
.sv-holdings-toolbar { margin-top: 10px; }
.sv-holdings-clear { min-height: 38px; padding: 8px 14px; font-size: 12.5px; }
.sv-holdings-table {
  min-width: 1180px;
  table-layout: fixed;
}
.sv-holdings-table th { vertical-align: top; }
.sv-holdings-table .sv-col-name { width: 260px; }
.sv-holdings-table .sv-col-owner { width: 132px; }
.sv-holdings-table .sv-col-rate { width: 118px; }
.sv-holdings-table .sv-col-maturity { width: 132px; }
.sv-holdings-table .sv-col-money { width: 138px; }
.sv-holdings-table .sv-col-qty { width: 96px; }
.sv-holdings-table .sv-col-allocation { width: 210px; }
.sv-holdings-table th.sv-num .sp-th-inner { align-items: flex-end; }
.sv-holdings-table .sp-th-filter { height: 28px; font-size: 10.5px; }
.sv-holdings-table .sp-th-sort { font-size: 10px; }
.sv-holding-primary { display: flex; align-items: center; gap: 7px; min-width: 190px; }
.sv-holding-primary > span { display: grid; gap: 3px; }
.sv-holding-primary small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10.5px; font-weight: 650; }
.sv-holding-primary small svg { width: 12px; height: 12px; }
.sv-owner-cell { white-space: nowrap; }
.sv-holding-primary--caixinha b { color: var(--forest); }
.sv-caixinha-row td { background: #fbfcf8; }
.sv-holding-child-row td { background: #ffffff; }
.sv-holding-child-row .sv-holding-primary { padding-left: 37px; min-width: 220px; }
.sv-holding-child-row .sv-holding-primary b { font-size: 12.5px; font-weight: 750; }
.sv-holding-child-row .sv-holding-primary small { font-size: 10px; }
.sv-nested-grid { padding: 16px 18px 18px; }
.sv-nested-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sv-nested-head > div { display: grid; gap: 3px; }
.sv-nested-head b { color: var(--ink); }
.sv-nested-head span { color: var(--muted); font-size: 11.5px; }
.sv-allocation-detail .data-table { min-width: 960px; }
.sv-alloc-goal { display: inline-flex; align-items: center; gap: 8px; }
.sv-alloc-goal > i { width: 10px; height: 10px; border-radius: 50%; }
.sv-fit { display: inline-flex; min-height: 25px; align-items: center; padding: 0 9px; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 800; }
.sv-fit-compatible { background: var(--green-100); color: var(--green-800); }
.sv-fit-attention { background: var(--amber-soft); color: var(--amber); }
.sv-fit-incompatible { background: var(--red-soft); color: var(--red); }
.sv-analysis-panel { margin-top: 20px; padding: 26px; }
.sv-analysis-head { align-items: end; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.sv-analysis-period { display: grid; gap: 4px; color: var(--quiet); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.sv-analysis-period select { height: 36px; min-width: 132px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; text-transform: none; }
/* Two decision blocks: A · efficiency (return in context), B · strategy
   (composition vs. goals). Both open with an eyebrow + title + status pill. */
.sv-strat { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.sv-block-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.sv-eyebrow { color: var(--quiet); font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.sv-block-head h4 { margin: 4px 0 0; color: var(--ink); font-size: 19px; letter-spacing: -.01em; }
.sv-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 11px; border-radius: var(--r-pill); font-size: 11px; font-weight: 800; white-space: nowrap; }
.sv-pill.ok { background: var(--green-100); color: var(--green-800); }
.sv-pill.warn { background: var(--amber-soft); color: var(--amber); }
.sv-subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.sv-subhead h5 { margin: 0; font-size: 12.5px; color: var(--ink); font-weight: 800; }
.sv-subhead span { color: var(--muted); font-size: 11px; text-align: right; }
.sv-note { display: flex; gap: 7px; align-items: flex-start; margin: 15px 0 0; color: var(--quiet); font-size: 10.75px; line-height: 1.5; }
.sv-note svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* Shared meter bar: fill + optional target/limit tick. */
.sv-strategy-bar { position: relative; height: 8px; border-radius: var(--r-pill); overflow: hidden; background: #e3eadf; }
.sv-strategy-bar > span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--forest); }
.sv-strategy-bar > i { position: absolute; top: -3px; width: 2px; height: 14px; border-radius: 2px; background: var(--ink); box-shadow: 0 0 0 1.5px #fbfcf8; }
.sv-strategy-overweight .sv-strategy-bar > span { background: var(--amber); }
.sv-strategy-underweight .sv-strategy-bar > span { background: #7aa7c7; }
.sv-strategy-ontarget .sv-strategy-bar > span { background: var(--green); }
.sv-bar-pos > span { background: var(--green-500); }
.sv-bar-neg > span { background: var(--red); }

/* A · Efficiency */
.sv-eff-hero { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 14px; margin-bottom: 22px; }
.sv-eff-return { display: grid; align-content: start; gap: 7px; padding: 19px 22px; border-radius: var(--r-md); background: linear-gradient(140deg, var(--green-900), var(--green-700)); color: #fff; }
.sv-eff-label { color: rgba(255, 255, 255, .72); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.sv-eff-value { font-size: clamp(28px, 3.4vw, 38px); color: #fff; line-height: 1.02; letter-spacing: -.02em; }
.sv-eff-delta { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; }
.sv-eff-delta.up { color: var(--green-300); }
.sv-eff-delta.down { color: #ffb4ad; }
.sv-eff-delta small { color: rgba(255, 255, 255, .7); font-weight: 600; }
.sv-eff-delta svg { width: 16px; height: 16px; }
.sv-eff-sub { color: rgba(255, 255, 255, .66); font-size: 11.5px; line-height: 1.4; }
.sv-eff-refs { display: grid; align-content: start; gap: 11px; padding: 16px 18px; border: 1px solid var(--sv-line-soft); border-radius: var(--r-md); background: #fbfcf8; }
.sv-eff-refs-title { color: var(--quiet); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.sv-eff-refs-title small { margin-left: 7px; padding: 2px 7px; border-radius: var(--r-pill); background: var(--amber-soft); color: var(--amber); font-size: 9.5px; font-weight: 800; text-transform: none; letter-spacing: 0; vertical-align: middle; }
.sv-ref-rates { list-style: none; margin: 0; padding: 0; display: grid; }
.sv-ref-rates li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--sv-line-soft); }
.sv-ref-rates li:first-child { border-top: 0; padding-top: 2px; }
.sv-ref-rates span { color: var(--muted); font-size: 12.5px; }
.sv-ref-rates b { color: var(--ink); font-size: 15px; }
.sv-eff-refs-note { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.sv-eff-refs-note b { color: var(--ink); }
.sv-cmp { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sv-cmp li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 58px; align-items: center; gap: 10px; }
.sv-cmp-name { color: var(--ink); font-size: 12px; font-weight: 700; }
.sv-cmp li b { font-size: 13px; color: var(--ink); text-align: right; }
.sv-cmp li em { font-size: 10.5px; font-weight: 800; font-style: normal; text-align: right; }
.sv-cmp li em.up { color: var(--green); }
.sv-cmp li em.down { color: var(--red); }
.sv-cmp li em.sv-cmp-base { color: var(--quiet); }
.sv-cmp li.tone-self .sv-strategy-bar > span { background: var(--forest); }
.sv-cmp li.tone-cdi .sv-strategy-bar > span { background: var(--green-500); }
.sv-cmp li.tone-ibov .sv-strategy-bar > span { background: var(--amber); }
.sv-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.sv-bars li { display: grid; gap: 7px; }
.sv-bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.sv-bar-name { color: var(--ink); font-size: 12.5px; font-weight: 650; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sv-bar-name small { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.sv-bar-head b { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; font-size: 13px; }
.sv-bar-head b.up { color: var(--green-700); }
.sv-bar-head b.down { color: var(--red); }
.sv-bar-head b em { color: var(--muted); font-size: 10.5px; font-style: normal; font-weight: 600; }

/* B · Strategy */
.sv-decisions { padding: 16px 18px; border: 1px solid var(--sv-line-soft); border-radius: var(--r-md); background: #fbfcf8; margin-bottom: 18px; }
.sv-decisions-amount { color: var(--amber); font-size: 11.5px; font-weight: 800; white-space: nowrap; }
.sv-decision-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sv-decision { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px 13px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--sv-line-soft); }
.sv-decision-mark { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; }
.sv-decision-mark svg { width: 16px; height: 16px; }
.sv-decision.sev-high .sv-decision-mark { background: var(--red-soft); color: var(--red); }
.sv-decision.sev-medium .sv-decision-mark { background: var(--amber-soft); color: var(--amber); }
.sv-decision b { display: block; color: var(--ink); font-size: 12.5px; line-height: 1.3; }
.sv-decision small { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.sv-decisions-clear { display: flex; align-items: center; gap: 12px; }
.sv-decisions-clear > svg { width: 20px; height: 20px; color: var(--forest); flex: none; }
.sv-decisions-clear b { display: block; color: var(--ink); font-size: 13px; }
.sv-decisions-clear small { color: var(--muted); font-size: 11.5px; }
.sv-diag-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.sv-diag-card { padding: 15px 16px; border: 1px solid var(--sv-line-soft); border-radius: var(--r-md); background: #fbfcf8; display: grid; align-content: start; gap: 13px; }
.sv-diag-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sv-diag-card-head h6 { margin: 0; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink); font-weight: 800; }
.sv-diag-card-head h6 svg { width: 15px; height: 15px; color: var(--forest); flex: none; }
.sv-diag-badge { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: var(--r-pill); white-space: nowrap; }
.sv-diag-badge.ok { background: var(--green-100); color: var(--green-800); }
.sv-diag-badge.warn { background: var(--amber-soft); color: var(--amber); }
.sv-alloc, .sv-conc { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.sv-alloc li, .sv-conc li { display: grid; gap: 6px; }
.sv-strategy-alloc-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; }
.sv-strategy-alloc-head > span { flex: 1; min-width: 0; color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-strategy-alloc-head > small { color: var(--muted); font-weight: 600; font-size: 10.5px; white-space: nowrap; }
.sv-strategy-alloc-head > b { color: var(--ink); font-weight: 800; font-size: 12px; white-space: nowrap; }
.sv-liq-ladder { display: flex; height: 12px; border-radius: var(--r-pill); overflow: hidden; background: #e3eadf; gap: 2px; }
.sv-liq-ladder .seg { height: 100%; }
.seg.imm, .sv-liq-legend i.imm { background: var(--forest); }
.seg.yr, .sv-liq-legend i.yr { background: var(--green-500); }
.seg.long, .sv-liq-legend i.long { background: var(--neutral-300); }
.seg.unk, .sv-liq-legend i.unk { background: var(--neutral-200); }
.sv-liq-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.sv-liq-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 30px; align-items: center; gap: 9px; }
.sv-liq-legend i { width: 9px; height: 9px; border-radius: 3px; }
.sv-liq-legend span { color: var(--muted); font-size: 11.5px; }
.sv-liq-legend b { color: var(--ink); font-size: 11.5px; white-space: nowrap; }
.sv-liq-legend em { color: var(--quiet); font-size: 10.5px; font-style: normal; font-weight: 800; text-align: right; }
.sv-maturities { margin-top: 2px; }
.sv-mat-list { list-style: none; margin: 0; padding: 0; display: grid; }
.sv-mat-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--sv-line-soft); }
.sv-mat-list li:first-child { border-top: 0; padding-top: 2px; }
.sv-mat-when { display: grid; gap: 1px; }
.sv-mat-when b { color: var(--ink); font-size: 12px; }
.sv-mat-when small { color: var(--quiet); font-size: 10px; }
.sv-mat-name { color: var(--ink); font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-mat-dest { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10.5px; font-weight: 700; background: var(--surface-soft); padding: 3px 9px; border-radius: var(--r-pill); white-space: nowrap; }
.sv-mat-dest svg { width: 13px; height: 13px; color: var(--forest); }
.sv-mat-list strong { color: var(--ink); font-size: 12.5px; white-space: nowrap; }
body.privacy-on #recurring-history-chart,
body.privacy-on #recurring-concentration-chart { filter: blur(8px); pointer-events: none; user-select: none; }

/* Dashboard bird's-eye view: decision areas in three compact rows. */
#view-dashboard { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
#view-dashboard > .sts-panel { grid-column: 1 / span 7; grid-row: 1; order: initial; margin: 0; }
#view-dashboard > .attention-panel { grid-column: 8 / -1; grid-row: 1; order: initial; margin: 0; }
#view-dashboard > .on-track-panel { grid-column: 1 / span 7; grid-row: 2; order: initial; margin: 0; }
#view-dashboard > .commit-mini { grid-column: 8 / -1; grid-row: 2; order: initial; margin: 0; }
#view-dashboard > .grid { grid-column: 1 / -1; grid-row: 3; order: initial; margin-top: 6px; }
#view-dashboard .sts-main { padding: 20px 22px 16px; gap: 18px; }
#view-dashboard .sts-figure .sts-value { font-size: clamp(30px, 3.2vw, 42px); }
#view-dashboard .sts-explanation { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#view-dashboard .sts-pace { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 11px 12px; }
#view-dashboard .attention-panel { padding: 19px 20px; width: auto; max-width: none; }
#view-dashboard .attention-list { margin-top: 10px; }
#view-dashboard .attention-item { grid-template-columns: 30px minmax(0, 1fr); align-items: start; padding: 10px 0 0; gap: 10px; }
#view-dashboard .attention-action { grid-column: 2; justify-self: start; min-height: 31px; padding: 6px 9px; }
#view-dashboard .attention-meta { display: none; }
#view-dashboard .commit-mini { padding: 18px 20px; }
#view-dashboard .commit-mini-head { margin-bottom: 9px; }
#view-dashboard .commit-mini-total { padding-bottom: 8px; }
#view-dashboard .commit-mini-item { padding: 7px 0; }
#view-dashboard .on-track-panel { padding: 16px 20px; }
#view-dashboard .on-track-head { margin-bottom: 11px; }
#view-dashboard .on-track-item { min-height: 72px; padding: 10px 12px; }
#view-dashboard .on-track-item strong { font-size: 19px; }

@media (max-width: 1180px) {
  .rec-overview { grid-template-columns: 1fr; }
  .rec-candidate { grid-template-columns: minmax(0, 1fr) auto; }
  .rec-candidate .rec-class { justify-self: start; }
  .rec-candidate-add { justify-self: end; }
  .essentials-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ess-chart-spacer { display: none; }
  .sv-eff-hero, .sv-diag-grid { grid-template-columns: 1fr; }
  #view-dashboard { grid-template-columns: 1fr; }
  #view-dashboard > .sts-panel, #view-dashboard > .attention-panel,
  #view-dashboard > .commit-mini, #view-dashboard > .on-track-panel, #view-dashboard > .grid { grid-column: 1; grid-row: auto; }
}
@media (max-width: 720px) {
  .recurring-panel { padding: 18px; }
  .recurring-head-actions { justify-content: flex-start; }
  .rec-overview { padding: 14px; }
  .rec-overview-metrics { grid-template-columns: 1fr; }
  .rec-candidate { grid-template-columns: 1fr; }
  .rec-candidate-amounts { justify-items: start; }
  .rec-candidate .rec-class, .rec-candidate-add { width: 100%; justify-self: stretch; }
  .recurring-charts { grid-template-columns: 1fr; }
  .recurring-selection { width: 100%; margin-left: 0; }
  .rec-detail { grid-template-columns: 1fr; }
  .essentials-charts { grid-template-columns: 1fr; }
  .sv-analysis-panel { padding: 20px 18px; }
  .sv-analysis-head, .sv-block-head, .sv-nested-head { align-items: flex-start; flex-direction: column; }
  .sv-mat-list li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .sv-mat-list .sv-mat-when { grid-column: 1; }
  .sv-mat-list .sv-mat-name { grid-column: 1 / -1; grid-row: 2; }
  .sv-mat-list .sv-mat-dest { grid-column: 1; grid-row: 3; justify-self: start; }
  .sv-mat-list strong { grid-column: 2; grid-row: 1; text-align: right; }
  #view-dashboard .on-track-grid { grid-template-columns: 1fr; }
}

/* ===================== DARK MODE ===================== */
:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(180, 245, 140, 0.08), transparent 34rem),
    var(--sage);
}

:root[data-theme="dark"] .app-shell {
  border: 1px solid rgba(220, 243, 209, 0.08);
}

:root[data-theme="dark"] .sidebar {
  border-right: 1px solid var(--line-soft);
}

:root[data-theme="dark"] .brand h1,
:root[data-theme="dark"] .brand-mark,
:root[data-theme="dark"] .link-button,
:root[data-theme="dark"] .notif-action,
:root[data-theme="dark"] .notif-foot-link {
  color: var(--forest);
}

:root[data-theme="dark"] .nav-item:hover {
  color: var(--forest-2);
  background: var(--forest-soft);
}

:root[data-theme="dark"] .nav-item.active {
  color: var(--neutral-900);
  background: var(--mint-active);
}

:root[data-theme="dark"] .update-trigger,
:root[data-theme="dark"] #privacy-toggle.is-hiding,
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn.primary,
:root[data-theme="dark"] .tx-download,
:root[data-theme="dark"] #view-transactions .tx-alias-form button,
:root[data-theme="dark"] #view-transactions .tx-category-confirm,
:root[data-theme="dark"] .debt-kpi-total,
:root[data-theme="dark"] .bs-kpi-primary,
:root[data-theme="dark"] .income-stat-primary {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--neutral-900);
}

:root[data-theme="dark"] .update-trigger:hover,
:root[data-theme="dark"] #privacy-toggle.is-hiding:hover,
:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .tx-download:hover,
:root[data-theme="dark"] #view-transactions .tx-category-confirm:hover {
  background: var(--forest-2);
  border-color: var(--forest-2);
}

:root[data-theme="dark"] .round-button,
:root[data-theme="dark"] .update-menu,
:root[data-theme="dark"] .notif-panel,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .toast,
:root[data-theme="dark"] .table-wrap,
:root[data-theme="dark"] .tx-table-wrap,
:root[data-theme="dark"] .data-table-shell,
:root[data-theme="dark"] .manual-import-card,
:root[data-theme="dark"] dialog,
:root[data-theme="dark"] .sv-modal,
:root[data-theme="dark"] .sv-caixinha-modal {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

:root[data-theme="dark"] .round-button:hover,
:root[data-theme="dark"] .update-action:hover,
:root[data-theme="dark"] .quick-actions button:hover,
:root[data-theme="dark"] .category-list li.active,
:root[data-theme="dark"] .sp-table tbody tr:hover,
:root[data-theme="dark"] .tx-table tbody tr:hover td,
:root[data-theme="dark"] .data-table tbody tr:not(.data-detail-row):hover td,
:root[data-theme="dark"] .cards-tx-panel .tx-table tbody tr:hover,
:root[data-theme="dark"] .account-item:hover,
:root[data-theme="dark"] .ess-section-head:hover,
:root[data-theme="dark"] .debt-table tr.debt-ledger-row.is-editing,
:root[data-theme="dark"] .debt-ledger-row.is-editing td {
  background: var(--surface-soft);
}

:root[data-theme="dark"] .ess-section[data-ess-section="voucher-alimentacao"]:not(.ess-section--placeholder) .ess-section-icon,
:root[data-theme="dark"] .ess-section[data-ess-section="voucher-alimentacao"]:not(.ess-section--placeholder) .ess-section-badge {
  background: rgba(217, 83, 74, 0.18);
  color: #ffb4ac;
}

:root[data-theme="dark"] .ticket-import-toolbar-icon {
  background: var(--sunken);
  color: var(--forest);
}

:root[data-theme="dark"] .ticket-import-summary-item.attention {
  border-color: rgba(255, 180, 172, 0.24);
  background: rgba(217, 83, 74, 0.16);
}

:root[data-theme="dark"] .ticket-import-summary-item.attention strong {
  color: #ffb4ac;
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .select-pill,
:root[data-theme="dark"] .tx-select select,
:root[data-theme="dark"] .debt-th-filter,
:root[data-theme="dark"] .debt-filter-trigger,
:root[data-theme="dark"] .debt-date-trigger,
:root[data-theme="dark"] .debt-edit-input,
:root[data-theme="dark"] .debt-edit-select,
:root[data-theme="dark"] .debt-new-form input,
:root[data-theme="dark"] .debt-new-form select,
:root[data-theme="dark"] .income-table .income-label-select,
:root[data-theme="dark"] .rec-class,
:root[data-theme="dark"] .rec-status,
:root[data-theme="dark"] .sv-analysis-period select,
:root[data-theme="dark"] .btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
  color: var(--quiet);
}

:root[data-theme="dark"] thead th,
:root[data-theme="dark"] .data-table th,
:root[data-theme="dark"] #view-transactions .tx-ledger-table thead th,
:root[data-theme="dark"] .debt-table th,
:root[data-theme="dark"] .manual-review-table th {
  background: var(--sunken);
  color: var(--muted);
}

:root[data-theme="dark"] .user-filter {
  background: rgba(29, 45, 38, 0.72);
  border-color: var(--line);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.04), 0 1px 2px rgba(0,0,0,0.24);
}

:root[data-theme="dark"] .user-filter-glass {
  background: linear-gradient(180deg, rgba(180, 245, 140, 0.22), rgba(143, 221, 94, 0.12));
  box-shadow: 0 8px 18px rgba(0,0,0,0.24), inset 0 1px 1px rgba(255,255,255,0.06);
}

:root[data-theme="dark"] .user-filter-option.active {
  color: var(--green-50);
}

:root[data-theme="dark"] .avatar-user {
  background: linear-gradient(150deg, var(--green-700), var(--green-900));
  color: var(--green-100);
}

:root[data-theme="dark"] .nubank-panel {
  background: linear-gradient(145deg, #201626 0%, var(--surface) 100%);
  border-color: rgba(180, 122, 217, 0.24);
}

:root[data-theme="dark"] .pluggy-panel {
  background: linear-gradient(145deg, #10221b 0%, var(--surface) 100%);
  border-color: rgba(79, 156, 108, 0.24);
}

:root[data-theme="dark"] .gmail-bills-panel {
  background: linear-gradient(145deg, #101d2b 0%, var(--surface) 100%);
  border-color: rgba(90, 142, 219, 0.24);
}

:root[data-theme="dark"] :is(
  .debt-selection-summary,
  .debt-kpi,
  .debt-filter-popover,
  .debt-date-popover,
  .debt-table tr.debt-ledger-row,
  .manual-review-alert,
  .manual-review-table tr.low-confidence,
  .manual-review-table tr.possible-duplicate,
  .rec-overview,
  .recurring-candidate-panel,
  .recurring-charts > section,
  .ess-chart-card,
  .on-track-item,
  .attention-action,
  .dh-metric,
  .dh-issue-link,
  .dh-rec-row,
  .rec-total,
  .recurring-insight,
  .data-detail-row > td,
  .sv-caixinha-row td,
  .sv-holding-child-row td,
  .sv-eff-refs,
  .sv-decisions,
  .sv-diag-card,
  .sv-analysis-panel,
  .sv-stat,
  .sv-plan,
  .sv-detail-panel,
  .sv-form-card,
  .sv-alloc-table tbody tr.sv-pick-group
) {
  background: var(--surface-soft);
  border-color: var(--line);
}

:root[data-theme="dark"] :is(
  .debt-new-form input[readonly],
  .selection-summary,
  .tx-ledger-toolbar,
  .tx-ledger-search,
  .tx-alias-form,
  .tx-category-same-name,
  .spending-panel,
  .sp-main-card,
  .sp-main-comparisons,
  .sp-context-card,
  .sp-diag-card,
  .account-group-head,
  .account-item,
  .mc-group-head,
  .cards-insights-toggle,
  .flow-toggle,
  .sp-evo-toggle,
  .sv-seg,
  .sv-pick-group-head,
  .sv-decision
) {
  background: var(--sunken);
  border-color: var(--line);
}

:root[data-theme="dark"] .manual-review-table tr.low-confidence,
:root[data-theme="dark"] .manual-confidence.low {
  color: #F4C978;
}

:root[data-theme="dark"] .manual-review-table tr.possible-duplicate {
  color: #FFAAA4;
}

:root[data-theme="dark"] .badge.up,
:root[data-theme="dark"] .debt-status-settled,
:root[data-theme="dark"] .sv-diag-badge.ok,
:root[data-theme="dark"] .sv-fit-compatible {
  background: rgba(180, 245, 140, 0.18);
  color: var(--forest-2);
}

:root[data-theme="dark"] .badge.down,
:root[data-theme="dark"] .debt-status-overdue,
:root[data-theme="dark"] .sv-fit-incompatible {
  background: var(--red-soft);
  color: var(--red);
}

:root[data-theme="dark"] .debt-person,
:root[data-theme="dark"] .debt-creditor,
:root[data-theme="dark"] .debt-status,
:root[data-theme="dark"] .tx-status,
:root[data-theme="dark"] .sv-pill,
:root[data-theme="dark"] .sv-chip,
:root[data-theme="dark"] .sp-ticket,
:root[data-theme="dark"] .sp-share-pill {
  border-color: var(--line);
}

:root[data-theme="dark"] .debt-person-conjunta,
:root[data-theme="dark"] .debt-status-not_started,
:root[data-theme="dark"] .bs-pill-muted {
  background: var(--sunken);
  color: var(--muted);
}

:root[data-theme="dark"] .debt-person-joao,
:root[data-theme="dark"] .debt-creditor-joao {
  background: rgba(180, 245, 140, 0.14);
  color: var(--forest);
}

:root[data-theme="dark"] .debt-person-matheus,
:root[data-theme="dark"] .debt-creditor-matheus {
  background: rgba(143, 221, 94, 0.24);
  color: var(--forest-2);
}

:root[data-theme="dark"] .credit-card,
:root[data-theme="dark"] .sts-panel,
:root[data-theme="dark"] .sv-stat-primary,
:root[data-theme="dark"] .sv-eff-return {
  background: linear-gradient(145deg, var(--green-900), #0f241f);
  color: var(--green-50);
}

:root[data-theme="dark"] .sv-seg-btn.active,
:root[data-theme="dark"] .stat-tab.active,
:root[data-theme="dark"] .chart-type button.active {
  background: var(--surface);
  color: var(--ink);
}

:root[data-theme="dark"] .notif-bell .notif-badge {
  border-color: var(--surface);
}
