/* Application additions on top of FlexAdmin's main.css.
   Everything here uses the template's own CSS variables, so it follows the accent
   colour and the dark theme automatically. main.css is vendor code and is never edited;
   the rare rule here that has to override it says why, where it does. */

/* --- Brand mark: Lupibe Finanças (brand kit, icones/financas) ---
   The icon with its own graphite background, 32px with 8px corners in any bar — the kit's
   rule, and above its 24px minimum, which the template's 22-23px logos fell below. The square
   maskable art is used so the corners come from here, not from a pre-rounded PNG.
   Overrides main.css on purpose: the template turns logos into white silhouettes, always on
   the login panel and in dark mode on the header. On an icon that carries its own background
   that leaves a blank white tile — the dog and the columns simply vanish. */
.header-logo img,
.fauth-logo img,
.fx-error-logo img { width: 32px; height: 32px; border-radius: 8px; }
.fauth-visual .fauth-logo img,
[data-theme=dark] .header-logo img { filter: none; }

/* --- Initials avatar (the template uses a photo; a finance app has none) --- */
.user-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent-color), transparent 82%);
  color: var(--accent-color);
  font-weight: 700;
  font-family: var(--heading-font);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.user-avatar.user-avatar-initials { width: 36px; height: 36px; }
.user-menu-avatar.user-avatar-initials { width: 44px; height: 44px; font-size: 1.125rem; }
.sidebar-footer-avatar.user-avatar-initials { width: 36px; height: 36px; }

button.user-menu-item,
button.user-menu-logout,
button.sidebar-help-card,
button.mobile-menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
}
.user-menu-footer form { margin: 0; }
.mobile-menu-form { display: contents; }

/* --- Connectivity & sync indicator --- */
.connection-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.connection-dot {
  width: 9px;
  height: 9px;
  border-radius: var(--radius-full);
  background: var(--success-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-color), transparent 80%);
  display: inline-block;
}
body.is-offline .connection-dot {
  background: var(--warning-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning-color), transparent 80%);
}
body.is-syncing [data-sync-now] i { animation: spin 1s linear infinite; }
.header-badge[hidden] { display: none; }

.offline-banner {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0.625rem var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  background: var(--warning-color-light);
  color: var(--default-color);
  border: 1px solid color-mix(in srgb, var(--warning-color), transparent 60%);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}
.offline-banner[hidden] { display: none; }

/* --- Floating action button --- */
.fab-wrap {
  position: fixed;
  right: var(--spacing-xl);
  bottom: calc(var(--spacing-xl) + env(safe-area-inset-bottom, 0px));
  z-index: 1030;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--spacing-sm);
}
.fab {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--accent-color);
  color: var(--contrast-color);
  font-size: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-base), background-color var(--transition-fast);
}
.fab:hover { background: color-mix(in srgb, var(--accent-color), black 10%); }
.fab:focus-visible { outline: 3px solid var(--input-focus-ring); outline-offset: 2px; }
.fab[aria-expanded="true"] { transform: rotate(45deg); }
.fab-menu { display: flex; flex-direction: column; align-items: flex-end; gap: var(--spacing-sm); }
.fab-menu[hidden] { display: none; }
.fab-option {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-height: 44px;
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--surface-color);
  color: var(--default-color);
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
}
.fab-option i { color: var(--accent-color); font-size: 1.1rem; }
.fab-option-primary { background: var(--accent-color); color: var(--contrast-color); border-color: transparent; }
.fab-option-primary i { color: var(--contrast-color); }
/* The template's back-to-top button sits in the same corner: lift it above the FAB. */
.back-to-top { bottom: calc(var(--spacing-xl) + 72px + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 767px) {
  .fab-wrap { right: var(--spacing-md); bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom, 0px)); }
  .back-to-top { right: var(--spacing-md); bottom: calc(var(--spacing-md) + 72px + env(safe-area-inset-bottom, 0px)); }
  .main-content { padding-bottom: 6rem; } /* keep the last row clear of the FAB */
}

.quick-amount { margin-bottom: var(--spacing-md); }
.quick-amount .form-control { font-family: var(--heading-font); font-weight: 600; font-size: 1.5rem; }

/* --- Forms loaded into the shared modal ---
   Bootstrap's scrollable (and fullscreen) modal only works when header, body and footer are
   direct flex children of .modal-content: that is what lets the body shrink and scroll. The
   fragment wraps the three in a <form>, which would otherwise be a single block child as tall
   as its content — clipped by .modal-content's overflow:hidden, with the Save button out of
   reach. Making the form a shrinking flex column restores the chain. */
.modal-content > form[data-modal-form] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* --- Dashboard ("Visão geral") -------------------------------------------------------
   The unified dashboard design. Its fixed colours live in the tokens below, each with a
   dark-mode equivalent; everything else uses the template's own variables. */
:root {
  --balance-bg: #f0fdf4;
  --balance-border: #dcfce7;
  --balance-fg: #15803d;
  --wallet-color: #2563eb;
  --invoice-color: #6366f1;
  --type-header-bg: #5b3fa6;
  --band-dark-bg: #0f1728;
  --accent-soft-dark: #0c9190;
  --empty-bar-color: #e2e8f0;
  --expense-past-color: #f08a8a;
  --variable-color: #f59e0b;
}
[data-theme=dark] {
  --balance-bg: rgba(74, 222, 128, 0.12);
  --balance-border: rgba(74, 222, 128, 0.22);
  --balance-fg: #4ade80;
  --wallet-color: #60a5fa;
  --invoice-color: #818cf8;
  --type-header-bg: #4c3591;
  --band-dark-bg: #050c11;
  --accent-soft-dark: #5eead4;
  --empty-bar-color: #1d3141;
  --expense-past-color: rgba(251, 113, 133, 0.5);
  --variable-color: #fbbf24;
}

.main-content.page-dashboard-finance { padding-bottom: calc(4rem + 56px); } /* last card clear of the FAB */
.dash { display: flex; flex-direction: column; gap: 24px; }
/* Only a handle for the in-place refresh: the alerts inside stay direct children of the column
   above, keeping its gap, and an empty wrapper adds no box and no gap of its own. */
.dash-alerts { display: contents; }
.dash .card { margin-bottom: 0; }
.dash .money { font-family: var(--mono-font); white-space: nowrap; }
.dash b { font-weight: 700; }
.dash-muted { color: var(--muted-color); }

.tone-wallet { --tone: var(--wallet-color); }
.tone-income { --tone: var(--success-color); }
.tone-expenses { --tone: var(--danger-color); }
.tone-savings { --tone: var(--warning-color); }
.tone-surplus { --tone: var(--balance-fg); }
.tone-invoice { --tone: var(--invoice-color); }
.tone-estimate { --tone: var(--light-color); }
.tone-empty { --tone: var(--empty-bar-color); }
.tone-fixed { --tone: var(--info-color); }
.tone-variable { --tone: var(--variable-color); }

/* page header + "Personalizar" */
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.dash-title { font-family: var(--heading-font); font-size: 24px; font-weight: 600; color: var(--heading-color); margin: 0 0 4px; }
.dash-subtitle { font-size: 13px; color: var(--muted-color); margin: 0; }
.dash-head-actions { display: flex; align-items: center; gap: 12px; position: relative; flex-wrap: wrap; }
.dash-customize {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--surface-color);
  color: var(--default-color); font-size: 13px; font-weight: 600;
  transition: border-color var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast);
}
.dash-customize i { font-size: 14px; }
.dash-customize:hover, .dash-customize[aria-expanded="true"] {
  border-color: var(--accent-color); color: var(--accent-color);
  background: color-mix(in srgb, var(--accent-color) 6%, var(--surface-color));
}
.dash-customize-count {
  font-family: var(--mono-font); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--accent-color) 12%, transparent); color: var(--accent-soft-dark);
}
.widgets-panel {
  position: absolute; top: 44px; right: 0; width: 320px; z-index: 20; overflow: hidden;
  background: var(--surface-color); border: 1px solid var(--border-color); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
}
.widgets-panel[hidden] { display: none; }
.widgets-panel-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--border-color); }
.widgets-panel-title { font-family: var(--heading-font); font-size: 14px; font-weight: 600; color: var(--heading-color); }
.widgets-panel-sub { font-size: 12px; color: var(--muted-color); }
.widgets-panel-list { padding: 6px 8px; display: flex; flex-direction: column; }
.widget-option {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; font: inherit; text-align: left;
}
.widget-option:hover { background: var(--background-color); }
.widget-option:focus-visible { outline: 3px solid var(--input-focus-ring); outline-offset: -1px; }
.widget-option-icon {
  width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: color-mix(in srgb, var(--accent-color) 8%, transparent); color: var(--accent-soft-dark); font-size: 14px;
}
.widget-option-text { flex: 1; min-width: 0; }
.widget-option-label { display: block; font-size: 13px; font-weight: 600; color: var(--heading-color); }
.widget-option-hint { display: block; font-size: 11.5px; color: var(--muted-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.widget-switch {
  position: relative; width: 34px; height: 20px; flex-shrink: 0; border-radius: var(--radius-full);
  background: var(--border-color-dark); transition: background-color var(--transition-fast);
}
.widget-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: var(--radius-full);
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.2); transition: left var(--transition-fast);
}
.widget-option[aria-checked="true"] .widget-switch { background: var(--accent-color); }
.widget-option[aria-checked="true"] .widget-switch::after { left: 16px; }
.widgets-panel-foot {
  display: flex; justify-content: space-between; padding: 10px 16px; font-size: 12.5px;
  border-top: 1px solid var(--border-color); background: var(--table-stripe-bg);
}
.widgets-panel-foot button { border: 0; background: none; padding: 0; font-weight: 600; }
.widgets-all-on { color: var(--accent-color); }
.widgets-all-off { color: var(--muted-color); }

/* hero */
.dash-hero { display: grid; grid-template-columns: 300px minmax(0, 1fr); overflow: hidden; }
.dash-hero-balance {
  display: flex; flex-direction: column; justify-content: center; padding: 22px 26px; min-width: 0;
  background: var(--balance-bg); border-right: 1px solid var(--balance-border); color: var(--balance-fg);
}
.dash-hero.is-negative .dash-hero-balance {
  background: var(--danger-color-light); border-color: color-mix(in srgb, var(--danger-color) 22%, transparent); color: var(--danger-color);
}
.dash-hero-label { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.dash-hero-value { font-family: var(--heading-font); font-size: 44px; font-weight: 700; line-height: 1.1; margin: 6px 0 10px; white-space: nowrap; }
.dash-hero-value.is-long { font-size: 36px; }
.dash-hero-value.is-longer { font-size: 30px; }
.dash-hero-note { font-size: 12.5px; line-height: 1.5; color: var(--muted-color); margin: 0; }
.dash-hero-main { display: flex; flex-direction: column; gap: 16px; padding: 18px 24px; min-width: 0; container-type: inline-size; }
.dash-formula {
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr);
}
.dash-formula-3 { grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr); }
.dash-formula-op { text-align: center; font-family: var(--heading-font); font-size: 18px; color: var(--light-color); }
.dash-term { min-width: 0; }
.dash-term-label {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-color);
}
.dash-swatch { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; background: var(--tone); }
.dash-term-value { font-family: var(--heading-font); font-size: 19px; font-weight: 700; color: var(--heading-color); white-space: nowrap; margin-top: 2px; }
.dash-term-hint { font-size: 11.5px; color: var(--muted-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The wallet is correctable by hand; the pencil says so without shouting. Kept as a link and
   not a button so it reads to a screen reader as what it is: a way into the accounts. */
a.dash-term-edit { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
a.dash-term-edit > i { font-size: 12px; color: var(--light-color); }
a.dash-term-edit:hover { color: var(--accent-soft-dark); }
a.dash-term-edit:hover > i { color: var(--accent-color); }
@container (max-width: 600px) { .dash-term-value { font-size: 16px; } }
.dash-divider { height: 1px; background: var(--border-color-light); }
.dash-flows { display: flex; flex-direction: column; gap: 10px; }
.dash-flow-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 12px; color: var(--muted-color); }
.dash-flow-head b, .dash-flow-head .money { color: var(--heading-color); }
.dash-bar { display: flex; gap: 2px; height: 20px; border-radius: 5px; overflow: hidden; }
.dash-seg {
  display: block; flex: 0 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: var(--seg, var(--tone)); color: #fff; font-size: 11px; font-weight: 600; line-height: 20px;
}
.dash-seg:not(:empty) { padding: 0 10px; }
.dash-seg.tone-wallet { opacity: 0.85; }
/* Dark mode lightens these tones: white text would lose contrast on them. */
[data-theme=dark] .dash-seg { text-shadow: 0 1px 2px rgb(0 0 0 / 0.5); }
[data-theme=dark] .dash-seg:is(.tone-income, .tone-surplus, .tone-savings, .tone-wallet) { color: #06121a; text-shadow: none; }

/* main grid */
.dash-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.dash-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 22px; border-bottom: 1px solid var(--border-color);
}
.dash-card-title-row { display: flex; align-items: center; gap: 10px; }
.dash-card-title { font-family: var(--heading-font); font-size: 16px; font-weight: 600; color: var(--heading-color); margin: 0; }
.dash-pill { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: var(--radius-full); }
.dash-card-actions { display: flex; gap: 8px; }
.dash-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border: 1px solid transparent;
  border-radius: var(--radius-md); font-size: 13px; line-height: 1.4; white-space: nowrap;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}
.dash-btn i { font-size: 11px; }
.dash-btn-ghost { border-color: var(--border-color); color: var(--muted-color); font-weight: 500; background: transparent; }
.dash-btn-ghost:hover { border-color: var(--accent-color); color: var(--accent-color); }
.dash-btn-accent { background: var(--accent-color); color: var(--contrast-color); font-weight: 600; }
.dash-btn-accent:hover { background: color-mix(in srgb, var(--accent-color), black 10%); color: var(--contrast-color); }
.dash-btn-outline { border-color: var(--accent-color); color: var(--accent-color); font-weight: 500; }
.dash-btn-outline:hover { background: color-mix(in srgb, var(--accent-color) 8%, transparent); color: var(--accent-color); }
.dash-btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--radius-sm); }

.dash-table { width: 100%; font-size: 14px; border-collapse: collapse; }
.dash-table thead th {
  padding: 8px 10px; background: var(--table-header-bg); text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-color);
}
.dash-table th.text-end { text-align: right; }
.dash-table th:first-child, .dash-table td:first-child { padding-left: 22px; }
.dash-table th:last-child, .dash-table td:last-child { padding-right: 22px; }
.dash-table tbody td { padding: 10px; border-top: 1px solid var(--border-color-light); vertical-align: middle; white-space: nowrap; }
.dash-table tbody tr { transition: background-color var(--transition-fast); }
.dash-table tbody tr:hover { background: var(--table-stripe-bg); }
.dash-table tfoot td { padding: 12px 10px; border-top: 2px solid var(--border-color); background: var(--table-stripe-bg); font-weight: 700; color: var(--heading-color); }
.dash-expenses .dash-table td:first-child { width: 100%; max-width: 0; } /* the description takes what is left, then truncates */
.dash-desc { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dash-desc-icon {
  width: 32px; height: 32px; border-radius: var(--radius-full); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--background-color); color: var(--muted-color); font-size: 14px;
}
.dash-desc-name { font-weight: 500; color: var(--heading-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-table tr.is-settled .dash-desc-name, .dash-table tr.is-expected .dash-desc-name { color: var(--muted-color); }
.dash-table tr.is-pending-sync { background: color-mix(in srgb, var(--warning-color) 8%, transparent); }
.dash-due { font-size: 13px; color: var(--muted-color); }
.dash-foot-split { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--muted-color); white-space: nowrap; }
.dash .dash-total { font-weight: 600; color: var(--danger-color); }
.cat-chip {
  display: inline-block; padding: 3px 8px; border-radius: var(--radius-sm); white-space: nowrap; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--cat) 16%, transparent); color: color-mix(in srgb, var(--cat) 75%, var(--heading-color));
}
.cat-chip-none { --cat: var(--light-color); }
.dash-settle {
  display: inline-block; padding: 4px 10px; border: 1px solid var(--success-color); border-radius: var(--radius-sm);
  color: var(--success-color); font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.dash-settle:hover, .dash-settle:focus-visible { background: var(--success-color); color: var(--contrast-color); }
.dash-mobile-list { padding: 12px 16px; }
.dash-mobile-total {
  display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; font-weight: 700; color: var(--heading-color);
  border-top: 2px solid var(--border-color); background: var(--table-stripe-bg);
}
.transaction-item.is-expected { opacity: 0.75; }

/* side column */
.dash-pending, .dash-types { overflow: hidden; }
.dash-band {
  display: flex; justify-content: space-between; gap: 8px; padding: 10px 18px; color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.dash-band-dark { background: var(--band-dark-bg); }
.dash-band-type { background: var(--type-header-bg); }
.dash-pending-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 18px; font-size: 13.5px; }
.dash-pending-row + .dash-pending-row { border-top: 1px solid var(--border-color-light); }
.dash-pending-info { min-width: 0; }
.dash-pending-name { font-weight: 500; color: var(--heading-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-pending-meta { font-size: 11.5px; color: var(--muted-color); white-space: nowrap; }
.dash-pending-meta.is-late { color: var(--danger-color); }
.dash-pending-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.dash-pending-actions .dash-settle { padding: 4px 9px; }
.dash-pending-more { padding: 4px 18px 10px; font-size: 12px; color: var(--muted-color); }
.dash-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border-color); }
.dash-side-head .money { font-size: 13px; }
.dash-side-title { font-family: var(--heading-font); font-size: 15px; font-weight: 600; color: var(--heading-color); margin: 0; }
.dash-incomes-body { display: flex; flex-direction: column; padding: 6px 18px 14px; }
.dash-income-row {
  display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 8px 0;
  border-bottom: 1px solid var(--border-color-light); color: var(--success-color);
}
.dash-income-row.is-open { color: var(--warning-color); }
.dash-income-row.is-expected { opacity: 0.75; }
.dash-income-row > i { font-size: 13px; flex-shrink: 0; }
.dash-income-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--heading-color); }
.dash-income-value { flex-shrink: 0; font-size: 13px; }
.dash-income-row .dash-settle { flex-shrink: 0; padding: 3px 8px; font-size: 11.5px; }
.dash-income-row.has-note { border-bottom: 0; padding-bottom: 2px; }
.dash-income-note { padding: 0 0 8px 21px; font-size: 11.5px; color: var(--muted-color); border-bottom: 1px solid var(--border-color-light); }
.dash-incomes-foot { padding-top: 10px; font-size: 12px; color: var(--muted-color); }
.dash-incomes-foot b { color: var(--heading-color); white-space: nowrap; }
.dash-incomes-foot b.text-warning { color: var(--warning-color); }
.dash-empty-line { padding: 8px 0; font-size: 13px; color: var(--muted-color); border-bottom: 1px solid var(--border-color-light); }
.dash-limit { padding: 14px 18px; }
.dash-limit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dash-limit-used { font-size: 11.5px; color: var(--muted-color); white-space: nowrap; }
.dash .dash-progress { height: 8px; margin: 10px 0 8px; border-radius: var(--radius-full); background: var(--background-color); }
.dash-limit-value { font-family: var(--heading-font); font-size: 22px; font-weight: 700; white-space: nowrap; }
.dash-limit-value span { font-family: var(--default-font); font-size: 12px; font-weight: 500; color: var(--muted-color); }
.dash-limit-empty { margin: 8px 0; font-size: 13px; color: var(--muted-color); }
.dash-types-bar-wrap { padding: 14px 18px 4px; }
.dash-bar-thin { height: 10px; border-radius: var(--radius-full); }
.dash-type-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 18px; font-size: 13px; border-bottom: 1px solid var(--border-color-light); }
.dash-type-row:last-child { border-bottom: 0; }
.dash-type-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--heading-color); }
.dash-type-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; background: var(--seg); }
.dash-type-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-type-share { font-size: 11.5px; color: var(--muted-color); }
.dash-type-row .money { color: var(--heading-color); }

/* optional panels */
.dash-section-head { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.dash-section-head[hidden] { display: none; }
.dash-section-title {
  font-family: var(--heading-font); font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-color); white-space: nowrap;
}
.dash-section-line { flex: 1; height: 1px; background: var(--border-color); }
.dash-section-link { border: 0; background: none; padding: 0; color: var(--accent-color); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.dash-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.dash-panels > [hidden] { display: none; }
.dash-panel-wide { grid-column: 1 / -1; }
.dash-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px; border-bottom: 1px solid var(--border-color);
}
.dash-panel-title { font-family: var(--heading-font); font-size: 16px; font-weight: 600; color: var(--heading-color); margin: 0; }
.dash-panel-sub { font-size: 12px; color: var(--muted-color); }
.dash-panel-sub b { color: var(--heading-color); }
.dash-panel-link { font-size: 12.5px; font-weight: 600; }
.dash-panel-body { padding: 18px 22px 14px; }
.dash-panel-body .empty-state { padding: var(--spacing-lg) 0; }
.dash-list-body { padding: 6px 22px 10px; }
.dash-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted-color); }
.dash-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dash-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--tone); }
.dash-chart { position: relative; }
.dash-chart-flow { height: 230px; }
.dash-chart-fixvar { height: 176px; }
.dash-chart-savings { height: 170px; }
.dash-rank { display: flex; flex-direction: column; gap: 14px; }
.dash-rank-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.dash-rank-icon {
  width: 28px; height: 28px; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--cat) 16%, transparent); color: var(--cat); font-size: 13px;
}
.dash-rank-line { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 13px; }
.dash-rank-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--heading-color); }
.dash-rank-meta { color: var(--muted-color); white-space: nowrap; }
.dash-rank-track { height: 8px; border-radius: var(--radius-full); background: var(--background-color); overflow: hidden; }
.dash-rank-fill { height: 100%; border-radius: var(--radius-full); background: var(--cat); }
.dash-rank-value { min-width: 92px; text-align: right; font-size: 13px; font-weight: 500; color: var(--heading-color); }
.dash-insight { margin: 14px 0 0; padding-top: 10px; border-top: 1px solid var(--border-color-light); font-size: 12px; color: var(--muted-color); }
.dash-insight b { color: var(--heading-color); }
.dash-savings { display: flex; flex-direction: column; gap: 16px; }
.dash-overline { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-color); }
.dash-savings-value { font-family: var(--heading-font); font-size: 28px; font-weight: 700; color: var(--heading-color); white-space: nowrap; }
.dash-savings-goal { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted-color); }
.dash-savings .dash-progress { margin: 6px 0 0; }
.dash-callout {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px dashed var(--border-color-dark);
  border-radius: 10px; background: var(--table-stripe-bg);
}
.dash-card-meta + .dash-callout, .dash-card-meta + .dash-card-recent { margin-top: 14px; }
.dash-callout-icon {
  width: 36px; height: 36px; border-radius: var(--radius-full); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--success-color-light); color: var(--success-color); font-size: 16px;
}
.dash-callout-glyph { color: var(--accent-color); font-size: 15px; }
.dash-callout-text { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted-color); }
.dash-callout-link { border: 0; background: none; padding: 0; color: var(--accent-color); font-size: 12px; font-weight: 600; white-space: nowrap; }
.dash-due-row, .dash-tx-row { display: flex; align-items: center; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border-color-light); }
.dash-tx-row { gap: 12px; }
.dash-list-body > .dash-due-row:last-child, .dash-list-body > .dash-tx-row:last-child { border-bottom: 0; }
.dash-list-body .money { font-size: 13px; color: var(--heading-color); flex-shrink: 0; }
.dash-date { width: 40px; flex-shrink: 0; text-align: center; line-height: 1.1; }
.dash-date-day { display: block; font-family: var(--heading-font); font-size: 17px; font-weight: 700; color: var(--heading-color); }
.dash-date.is-soon .dash-date-day { color: var(--danger-color); }
.dash-date-month { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--light-color); }
.dash-row-main { flex: 1; min-width: 0; }
.dash-row-title { font-size: 13.5px; font-weight: 500; color: var(--heading-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-row-meta { font-size: 11.5px; color: var(--muted-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-tx-icon {
  width: 32px; height: 32px; border-radius: var(--radius-full); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
  background: var(--info-color-light); color: var(--info-color);
}
.dash-tx-icon.is-in { background: var(--success-color-light); color: var(--success-color); }
.dash-tx-icon.is-out { background: var(--danger-color-light); color: var(--danger-color); }
.dash-list-body .dash-tx-amount { font-weight: 500; }
.dash-list-body .dash-tx-amount.is-in { color: var(--success-color); }
.dash-list-body .dash-tx-amount.is-out { color: var(--danger-color); }
.dash-card-invoice { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.dash-card-invoice-value { font-family: var(--heading-font); font-size: 24px; font-weight: 700; color: var(--heading-color); white-space: nowrap; }
.dash-card-dates { font-size: 12px; color: var(--muted-color); text-align: right; }
.dash-card-dates b, .dash-card-meta b { color: var(--heading-color); }
.dash-panel .dash-card-invoice + .dash-progress { margin: 12px 0 8px; }
.dash-card-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted-color); }
.dash-card-recent { display: flex; flex-direction: column; }
.dash-card-recent-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  padding: 7px 0; border-top: 1px solid var(--border-color-light); font-size: 13px;
}
.dash-card-recent-row .money { color: var(--heading-color); }
.dash-forecast { font-size: 13.5px; }
.dash-forecast tbody td { padding: 10px 12px; }
.dash-forecast th.dash-forecast-balance, .dash-forecast td.dash-forecast-balance { width: 36%; padding-left: 28px; }
.dash-bipolar { display: flex; align-items: center; gap: 10px; }
.dash-bipolar-track { position: relative; flex: 1; min-width: 80px; height: 8px; border-radius: var(--radius-full); background: var(--background-color); overflow: hidden; }
.dash-bipolar-fill { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-full); background: var(--success-color); }
.dash-bipolar .money { min-width: 100px; text-align: right; font-weight: 600; color: var(--success-color); }
.dash-bipolar.is-negative .dash-bipolar-fill { background: var(--danger-color); }
.dash-bipolar.is-negative .money { color: var(--danger-color); }

@media (max-width: 1199px) {
  .dash-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 991px) {
  .dash-hero { grid-template-columns: minmax(0, 1fr); }
  .dash-hero-balance { border-right: 0; border-bottom: 1px solid var(--balance-border); }
  .dash-formula, .dash-formula-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
  .dash-formula-op { display: none; }
  .dash-panels { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .dash-head-actions { width: 100%; }
  .widgets-panel { left: 0; right: 0; width: auto; }
  .dash-hero-balance { padding: 18px 20px; }
  .dash-hero-main { padding: 16px 20px; }
  .dash-card-head, .dash-panel-head { padding: 14px 16px; }
  .dash-panel-body { padding: 16px; }
  .dash-list-body { padding: 4px 16px 8px; }
  .dash-forecast th:first-child, .dash-forecast td:first-child { padding-left: 16px; }
}

/* --- Month picker --- */
.month-picker { display: inline-flex; align-items: center; gap: var(--spacing-xs); }
.month-picker-step { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
.month-picker-current {
  position: relative;
  min-width: 9.5rem;
  margin: 0;
  padding: 0.375rem 0.75rem;
  text-align: center;
  font-weight: 600;
  font-family: var(--heading-font);
  color: var(--heading-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  cursor: pointer;
}
.month-picker-current input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.month-picker-current:focus-within { outline: 3px solid var(--input-focus-ring); }

/* --- Charts --- */
.chart-box { position: relative; height: 320px; }
.chart-box-sm { height: 260px; }

/* --- Lists --- */
.transaction-icon.info {
  background: var(--info-color-light);
  color: var(--info-color);
}
.transaction-item .badge { margin-top: 2px; }
.tx-mobile-row { border-bottom: 1px solid var(--border-color-light); padding-bottom: var(--spacing-sm); }
.tx-mobile-row:last-child { border-bottom: 0; }
.tx-mobile-row .transaction-item { border-bottom: 0; }
.tx-mobile-actions { display: flex; justify-content: flex-end; }
.tx-mobile-actions .btn { min-width: 40px; min-height: 36px; }
.transaction-item.is-pending-sync { opacity: 0.85; }
.transaction-item.is-pending-sync .transaction-icon { background: var(--warning-color-light); color: var(--warning-color); }

.category-dot { display: inline-block; width: 8px; height: 8px; border-radius: var(--radius-full); margin-right: 0.35rem; }

.history-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--spacing-sm) var(--spacing-md); margin-bottom: var(--spacing-md); }
.history-figures dt { font-size: 0.75rem; font-weight: 500; color: var(--muted-color); }
.history-figures dd { margin: 0; font-weight: 600; font-size: 0.9375rem; }

.review-list li { padding: 0.375rem 0; border-bottom: 1px solid var(--border-color-light); font-size: 0.875rem; }
.review-list li:last-child { border-bottom: 0; }

details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; transition: transform var(--transition-base); }
details.card[open] > summary::after { transform: rotate(180deg); }

/* --- Misc --- */
.confirm-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--spacing-md);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--danger-color-light);
  color: var(--danger-color);
  font-size: 1.5rem;
}
.pairing-code {
  font-family: var(--mono-font);
  font-size: clamp(1.75rem, 8vw, 2.75rem);
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent-color);
  margin: var(--spacing-sm) 0;
  user-select: all;
}
.icon-picker { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: var(--spacing-sm); }
.icon-picker button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--surface-color);
  color: var(--default-color);
}
.icon-picker button[aria-pressed="true"] { border-color: var(--accent-color); color: var(--accent-color); background: var(--sidebar-hover-bg); }

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--border-color-light) 25%, var(--border-color) 37%, var(--border-color-light) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  min-height: 1rem;
}
@keyframes skeleton-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton, body.is-syncing [data-sync-now] i { animation: none; }
  .fab { transition: none; }
}

/* Inputs at 16px on phones: iOS zooms the page when a focused field is smaller. */
@media (max-width: 767px) {
  .form-control, .form-select { font-size: 1rem; }
  .page-header-actions { flex-wrap: wrap; }
  .btn-sm { min-height: 36px; }
}

/* --- Segmented control: a few tabs in one pill ---------------------------------------------------- */
.segmented {
  display: inline-flex; height: 32px; padding: 3px; gap: 2px; border-radius: 9px;
  background: var(--table-header-bg); border: 1px solid var(--border-color);
}
.segmented a {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted-color); transition: background var(--transition-fast);
}
.segmented a.is-active { background: var(--surface-color); color: var(--heading-color); box-shadow: 0 1px 3px rgb(2 12 27 / 0.12); }
.segmented .money { font-size: 11px; opacity: 0.7; }

/* --- Parcelas e financiamentos (templates/finance/installments/list.html) ------------------------ */
:root {
  --plan-purchase-bg: #fef3c7; --plan-purchase-fg: #b45309;
  --plan-financing-bg: #fde8d8; --plan-financing-fg: #9a3412;
  --due-later-bg: #e2e8f0; --due-later-fg: #475569;
}
[data-theme=dark] {
  --plan-purchase-bg: rgba(245, 158, 11, 0.16); --plan-purchase-fg: #fbbf24;
  --plan-financing-bg: rgba(249, 115, 22, 0.16); --plan-financing-fg: #fb923c;
  --due-later-bg: rgba(148, 163, 184, 0.16); --due-later-fg: #cbd5e1;
}
.main-content:has(.plans) { padding-bottom: calc(4rem + 56px); } /* last card clear of the FAB */
.plans { display: flex; flex-direction: column; gap: 24px; }
.plans .card { margin-bottom: 0; }
.plans .money { font-family: var(--mono-font); white-space: nowrap; }
.plans .is-danger { color: var(--danger-color); }
.plans-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plans-title { font-family: var(--heading-font); font-size: 24px; font-weight: 600; color: var(--heading-color); margin: 0 0 4px; }
.plans-subtitle { font-size: 13px; color: var(--muted-color); margin: 0; }
.plans-new {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px;
  background: var(--accent-color); color: #fff; font-size: 13.5px; font-weight: 700; white-space: nowrap;
  transition: filter var(--transition-fast);
}
.plans-new:hover { color: #fff; filter: brightness(0.94); }
.plans-new i { font-size: 12px; }

.plans-summary { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.4fr; border-radius: 12px; }
.plans-cell { padding: 20px 24px; border-right: 1px solid var(--border-color-light); min-width: 0; }
.plans-cell:last-child { border-right: 0; }
.plans-label {
  display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted-color);
}
.plans-unit { font-family: var(--mono-font); font-weight: 500; text-transform: none; letter-spacing: 0; }
.plans-value { font-family: var(--heading-font); font-size: 26px; font-weight: 700; color: var(--heading-color); white-space: nowrap; margin-top: 4px; }
.plans-value.is-danger { color: var(--danger-color); }
.plans-hint { font-size: 12px; color: var(--muted-color); }
.plans-relief-row { display: flex; align-items: center; gap: 10px; margin-top: 7px; font-size: 12px; }
.plans-relief-when { width: 56px; flex-shrink: 0; color: var(--muted-color); white-space: nowrap; }
.plans-relief-track { flex: 1; height: 8px; border-radius: 9999px; background: var(--background-color); overflow: hidden; }
.plans-relief-fill { display: block; height: 100%; border-radius: 9999px; background: var(--accent-color); }
.plans-relief-value { min-width: 78px; text-align: right; color: var(--heading-color); }

.plans-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px; border-bottom: 1px solid var(--border-color);
}
.plans-sort { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted-color); }
.plans-sort-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border-color);
  border-radius: 8px; background: var(--surface-color); color: var(--heading-color); font-weight: 600; white-space: nowrap;
}
.plans-sort-toggle i { font-size: 10px; }

.plans-table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.plans-table thead tr { background: var(--table-header-bg); }
.plans-table th {
  padding: 8px 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-color); text-align: left;
}
.plans-table th.text-end { text-align: right; }
.plans-table :is(th, td):first-child { padding-left: 22px; }
.plans-table :is(th, td):last-child { padding-right: 22px; }
.plans-table td { padding: 12px; border-top: 1px solid var(--border-color-light); vertical-align: middle; color: var(--heading-color); }
.plans-table tbody tr { transition: background var(--transition-fast); }
.plans-table tbody tr:hover { background: var(--table-stripe-bg); }
.plans-col-progress { width: 20%; }
.plans-left { font-weight: 500; }
.plans-table tfoot tr { border-top: 2px solid var(--border-color); background: var(--table-stripe-bg); }
.plans-table tfoot td { font-weight: 700; border-top: 0; }
.plans-table tfoot .money { font-weight: 600; }
.plans-table tfoot .plans-per-month { font-size: 12px; font-weight: 400; color: var(--muted-color); }

.plans-plan { display: flex; align-items: center; gap: 12px; min-width: 0; }
.plans-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; display: inline-flex; align-items: center;
  justify-content: center; font-size: 15px;
}
.plans-icon.is-loan { background: var(--danger-color-light); color: var(--danger-color); }
.plans-icon.is-purchase { background: var(--plan-purchase-bg); color: var(--plan-purchase-fg); }
.plans-icon.is-financing { background: var(--plan-financing-bg); color: var(--plan-financing-fg); }
.plans-plan-text { min-width: 0; }
.plans-name { display: block; font-weight: 600; color: var(--heading-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plans-name:hover { color: var(--accent-color); }
.plans-end { font-size: 11.5px; color: var(--muted-color); white-space: nowrap; }
.plans-next { white-space: nowrap; }
.plans-date { color: var(--heading-color); }
.due-chip { margin-left: 4px; padding: 2px 7px; border-radius: 9999px; font-size: 11.5px; font-weight: 600; background: var(--due-later-bg); color: var(--due-later-fg); white-space: nowrap; }
.due-chip.is-soon, .due-chip.is-late { background: var(--danger-color-light); color: var(--danger-color); }

.plans-actions { text-align: right; white-space: nowrap; }
.plans-pay {
  display: inline-block; padding: 4px 9px; border: 1px solid var(--success-color); border-radius: 6px;
  color: var(--success-color); font-size: 12px; font-weight: 600; vertical-align: middle;
  transition: background var(--transition-fast);
}
.plans-pay:hover { background: var(--success-color); color: #fff; }
.plans-auto { font-size: 11.5px; font-weight: 600; color: var(--muted-color); vertical-align: middle; }
.plans-more-wrap { display: inline-block; vertical-align: middle; margin-left: 4px; }
.plans-more {
  width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted-color);
  display: inline-flex; align-items: center; justify-content: center; transition: background var(--transition-fast);
}
.plans-more:hover, .plans-more[aria-expanded=true] { background: var(--background-color); color: var(--heading-color); }
.plans-actions .dropdown-menu form { margin: 0; }

/* {% installment_progress plan %} */
.plan-progress { display: flex; flex-direction: column; gap: 5px; min-width: 120px; }
.plan-progress-track { position: relative; height: 10px; border-radius: 4px; background: var(--border-color-light); overflow: hidden; }
.plan-progress-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.plan-progress.is-low .plan-progress-fill { background: var(--light-color); }
.plan-progress.is-mid .plan-progress-fill { background: var(--accent-color); }
.plan-progress.is-high .plan-progress-fill { background: var(--success-color); }
.plan-progress-blocks {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(to right, transparent 0 calc(100% / var(--blocks) - 2px),
    var(--surface-color) calc(100% / var(--blocks) - 2px) calc(100% / var(--blocks)));
}
.plan-progress-legend { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; white-space: nowrap; color: var(--muted-color); }
.plan-progress-legend b { font-family: var(--mono-font); font-weight: 500; color: var(--heading-color); }
.plan-progress-hint { font-weight: 600; }
.plan-progress.is-high .plan-progress-hint { color: var(--success-color); }

.plans-footnote { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; color: var(--muted-color); }
.plans-footnote b { color: var(--heading-color); }

/* Narrow screens: summary 2 x 2, then 1 column; the table becomes one card per plan */
.plans-stack { padding: 6px 18px 14px; }
.plans-item { padding: 14px 0; border-bottom: 1px solid var(--border-color-light); display: flex; flex-direction: column; gap: 10px; }
.plans-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plans-item-amount { font-size: 13.5px; color: var(--heading-color); }
.plans-item-amount small { font-family: var(--default-font); color: var(--muted-color); }
.plans-item-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.plans-item-left { font-size: 12px; color: var(--muted-color); }
.plans-stack-total { padding-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--heading-color); }
@media (max-width: 1199.98px) {
  .plans-summary { grid-template-columns: 1fr 1fr; }
  .plans-cell:nth-child(2) { border-right: 0; }
  .plans-cell:nth-child(-n + 2) { border-bottom: 1px solid var(--border-color-light); }
}
@media (max-width: 575.98px) {
  .plans-summary { grid-template-columns: 1fr; }
  .plans-cell { border-right: 0; border-bottom: 1px solid var(--border-color-light); }
  .plans-cell:last-child { border-bottom: 0; }
}

/* --- Faturas (templates/finance/cards/invoices.html) --------------------------------------------- */
:root {
  --inv-open-bg: #fafcfe;
  --inv-paid-bg: #dcfce7; --inv-paid-fg: #15803d;
  --inv-instalments: #9a3412; --inv-informed: #94a3b8;
}
[data-theme=dark] {
  --inv-open-bg: rgba(255, 255, 255, 0.025);
  --inv-paid-bg: rgba(22, 163, 74, 0.16); --inv-paid-fg: #4ade80;
  --inv-instalments: #ea580c; --inv-informed: #64748b;
}
.main-content:has(.inv) { padding-bottom: calc(4rem + 56px); } /* last card clear of the FAB */
.inv { display: flex; flex-direction: column; gap: 24px; }
.inv .card { margin-bottom: 0; }
.inv .money { font-family: var(--mono-font); white-space: nowrap; }
.inv .is-purchases { background: var(--warning-color); }
.inv .is-instalments { background: var(--inv-instalments); }
.inv .is-informed { background: var(--inv-informed); }

/* header: title | card picker + "Informar fatura" */
.inv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.inv-head-text { flex: 1 1 240px; min-width: 0; }
.inv-title { font-family: var(--heading-font); font-size: 24px; font-weight: 600; color: var(--heading-color); margin: 0 0 4px; }
.inv-subtitle { font-size: 13px; color: var(--muted-color); margin: 0; }
.inv-subtitle b { color: var(--heading-color); }
.inv-head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 100%; }
.segmented.is-lg { height: 36px; }
.segmented.is-lg a { height: 28px; padding: 0 12px; gap: 8px; font-size: 13px; }
.inv-cards { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.inv-cards::-webkit-scrollbar { display: none; }
.inv-cards a { flex-shrink: 0; white-space: nowrap; }
.inv-cards a:hover { color: var(--heading-color); }
.inv-cards .money { opacity: 0.75; }
.inv-cards a.is-active .money { color: var(--muted-color); opacity: 1; }
.inv-cards a.is-inactive { opacity: 0.6; }
.inv-cards .inv-cards-add { padding: 0 10px; }
.inv-cards-add i { font-size: 11px; }
.inv-swatch { width: 16px; height: 11px; border-radius: 2px; background: var(--card-color); flex-shrink: 0; }
.inv-inform {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9px; flex-shrink: 0;
  border: 1px solid var(--border-color); background: var(--surface-color); color: var(--heading-color);
  font-size: 13px; font-weight: 600; white-space: nowrap; transition: background var(--transition-fast);
}
.inv-inform:hover { background: var(--table-stripe-bg); color: var(--heading-color); }
.inv-inform i { font-size: 13px; }

/* hero: the closed invoice | the open one */
.inv-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); border-radius: 12px; overflow: hidden; }
.inv-closed { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 22px 26px; border-right: 1px solid var(--border-color-light); }
.inv-closed-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.inv-closed-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.inv-card-art {
  display: inline-flex; align-items: flex-end; justify-content: flex-end; flex-shrink: 0; width: 38px; height: 26px;
  padding: 3px; border-radius: 5px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--card-color), #fff 12%), color-mix(in srgb, var(--card-color), #000 35%));
}
.inv-card-art span { width: 8px; height: 6px; border-radius: 1px; background: rgb(255 255 255 / 0.7); }
.inv-closed-name { font-family: var(--heading-font); font-size: 15px; font-weight: 600; color: var(--heading-color); margin: 0; }
.inv-closed-dates { font-size: 12px; color: var(--muted-color); }
.inv-closed-status { display: flex; align-items: center; gap: 4px; }
.inv-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 9999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.inv-badge.is-paid { background: var(--inv-paid-bg); color: var(--inv-paid-fg); }
.inv-badge.is-due { background: var(--plan-purchase-bg); color: var(--plan-purchase-fg); }
.inv-badge.is-late { background: var(--danger-color-light); color: var(--danger-color); }
.inv-more {
  width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted-color);
  display: inline-flex; align-items: center; justify-content: center; transition: background var(--transition-fast);
}
.inv-more:hover, .inv-more[aria-expanded=true] { background: var(--background-color); color: var(--heading-color); }
.inv-closed-status .dropdown-menu form, .inv-open-paid .dropdown-menu form { margin: 0; }
.inv-closed-amount { display: flex; align-items: baseline; gap: 8px 14px; flex-wrap: wrap; }
.inv-closed-value { font-family: var(--heading-font); font-size: 40px; font-weight: 700; line-height: 1; color: var(--heading-color); white-space: nowrap; }
.inv-closed-note { font-size: 13px; color: var(--muted-color); }
.inv-pay {
  align-self: center; margin-left: auto; padding: 5px 12px; border: 1px solid var(--success-color); border-radius: 8px;
  color: var(--success-color); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background var(--transition-fast);
}
.inv-pay:hover { background: var(--success-color); color: #fff; }
.inv-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.inv-fact {
  display: flex; flex-direction: column; justify-content: space-between; gap: 2px; min-width: 0; padding: 10px 12px;
  border-radius: 9px; background: var(--table-stripe-bg); border: 1px solid var(--border-color-light);
}
.inv-fact-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-color); }
.inv-fact-value { font-size: 14px; color: var(--heading-color); }
.inv-fact-sub { font-size: 12px; color: var(--muted-color); white-space: nowrap; }

.inv-open { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 22px 26px; background: var(--inv-open-bg); }
.inv-open-head { display: flex; align-items: center; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.inv-open-title { font-family: var(--heading-font); font-size: 14px; font-weight: 600; color: var(--heading-color); margin: 0; }
.inv-open-dates { font-size: 12px; color: var(--muted-color); white-space: nowrap; }
.inv-open-dates b { color: var(--heading-color); }
.inv-open-amount { display: flex; align-items: baseline; gap: 8px 12px; flex-wrap: wrap; }
.inv-open-value { font-family: var(--heading-font); font-size: 30px; font-weight: 700; line-height: 1; color: var(--heading-color); white-space: nowrap; }
.inv-open-amount .inv-badge { padding: 3px 8px; }
.inv-open-paid { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: -6px; font-size: 13px; color: var(--muted-color); }
.inv-open-paid > span { display: inline-flex; align-items: center; gap: 4px; }
.inv-open-paid.is-settled > span { color: var(--inv-paid-fg); font-weight: 600; }
.inv-limit-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; font-size: 12px; color: var(--muted-color); }
.inv-limit-row .money { color: var(--heading-color); }
.inv-limit-track { height: 8px; border-radius: 9999px; background: var(--border-color-light); overflow: hidden; }
.inv-limit-track span { display: block; height: 100%; border-radius: 9999px; background: var(--warning-color); }
.inv-limit.is-high .inv-limit-track span { background: var(--danger-color); }
.inv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted-color); }
.inv-legend span, .inv-bar-legend span { display: inline-flex; align-items: center; gap: 6px; }
.inv-legend b { color: var(--heading-color); }
.inv-legend i, .inv-bar-legend i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }

/* purchases | coming invoices and paid history */
.inv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.inv-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.inv-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px; border-bottom: 1px solid var(--border-color);
}
.inv-toolbar .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.inv-toolbar .segmented a { flex-shrink: 0; white-space: nowrap; }
.inv-add {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 8px; background: var(--accent-color);
  color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; transition: filter var(--transition-fast);
}
.inv-add:hover { color: #fff; filter: brightness(0.94); }
.inv-add i { font-size: 11px; }
.inv-table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.inv-table thead tr { background: var(--table-header-bg); }
.inv-table th {
  padding: 8px 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-color); text-align: left;
}
.inv-table th.text-end { text-align: right; }
.inv-table :is(th, td):first-child { padding-left: 22px; }
.inv-table :is(th, td):last-child { padding-right: 22px; }
.inv-table td { padding: 11px 12px; border-top: 1px solid var(--border-color-light); vertical-align: middle; color: var(--heading-color); }
.inv-table tbody tr { cursor: pointer; transition: background var(--transition-fast); }
.inv-table tbody tr:hover { background: var(--table-stripe-bg); }
.inv-col-name { max-width: 260px; }
.inv-date { font-size: 13px; color: var(--muted-color); white-space: nowrap; }
.inv-table td.inv-date { color: var(--muted-color); }
.inv-table tfoot tr { border-top: 2px solid var(--border-color); background: var(--table-stripe-bg); }
.inv-table tfoot td { padding-top: 12px; padding-bottom: 12px; border-top: 0; font-weight: 700; }
.inv-table tfoot .money { font-weight: 600; }
.inv-count { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--muted-color); }
.inv-buy { display: flex; align-items: center; gap: 12px; min-width: 0; }
.inv-buy-icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 32px; height: 32px;
  border-radius: 9999px; background: var(--background-color); color: var(--muted-color); font-size: 14px;
}
.inv-buy-text { min-width: 0; overflow: hidden; }
.inv-buy-name { display: block; font-weight: 500; color: var(--heading-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-buy-name:hover { color: var(--accent-color); }
.inv-buy-source { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; color: var(--muted-color); }
.inv-buy-source > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-chip {
  --chip: var(--muted-color);
  display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--chip); background: color-mix(in srgb, var(--chip) 15%, transparent);
}
[data-theme=dark] .inv-chip { color: color-mix(in srgb, var(--chip) 55%, #fff); background: color-mix(in srgb, var(--chip) 24%, transparent); }
.inv-buy-source .inv-chip { flex-shrink: 0; padding: 1px 6px; font-size: 11px; }
.inv-queued:not(:empty) { border-bottom: 1px solid var(--border-color-light); }
.inv-queued-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 22px; font-size: 13.5px; color: var(--heading-color);
  background: color-mix(in srgb, var(--warning-color) 8%, transparent);
}
.inv-queued-row i { color: var(--warning-color); }
.inv-queued-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-queued-note { font-size: 11.5px; color: var(--muted-color); white-space: nowrap; }
.inv-detected {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 22px;
  border-top: 1px solid var(--border-color-light); font-size: 12.5px; color: var(--muted-color);
}
.inv-detected i { color: var(--accent-color); }
.inv-detected span { flex: 1 1 200px; } /* narrow: the link goes under the text */
.inv-detected a { font-weight: 600; white-space: nowrap; }
.inv-detected.is-waiting { background: var(--plan-purchase-bg); color: var(--plan-purchase-fg); }
.inv-detected.is-waiting i { color: inherit; }

.inv-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-color); }
.inv-side-head h5 { font-family: var(--heading-font); font-size: 15px; font-weight: 600; color: var(--heading-color); margin: 0; }
.inv-side-head span { font-size: 12px; color: var(--muted-color); }
.inv-upcoming-body { display: flex; flex-direction: column; padding: 14px 18px 6px; }
.inv-bar-row {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--border-color-light); color: var(--muted-color);
}
.inv-bar-row:hover .inv-bar-value { color: var(--accent-color); }
.inv-bar-month { font-size: 12px; font-weight: 600; white-space: nowrap; }
.inv-bar-row.is-selected .inv-bar-month { color: var(--heading-color); }
.inv-bar-track { display: flex; gap: 1px; height: 10px; border-radius: 4px; background: var(--border-color-light); overflow: hidden; }
.inv-bar-track span { height: 100%; }
.inv-bar-value { min-width: 82px; font-size: 12.5px; text-align: right; color: var(--heading-color); }
.inv-bar-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 0 6px; font-size: 11.5px; color: var(--muted-color); }
.inv-history { padding: 14px 18px; }
.inv-history-title { font-family: var(--heading-font); font-size: 14px; font-weight: 600; color: var(--heading-color); margin: 0 0 8px; }
.inv-history-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0;
  border-bottom: 1px solid var(--border-color-light); font-size: 13px; color: var(--heading-color);
}
.inv-history-row:hover { color: var(--accent-color); }
.inv-history-month { display: flex; align-items: center; gap: 8px; }
.inv-history-month i { font-size: 12px; color: var(--success-color); }
.inv-history-paid { font-size: 11.5px; color: var(--muted-color); }
.inv-history-empty { margin: 0; font-size: 12.5px; color: var(--muted-color); }
.inv-history-all { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 600; }

/* Narrow screens: hero and grid in one column (the open invoice first); the table becomes rows */
.inv-stack { padding: 4px 18px 12px; }
.inv-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; cursor: pointer; }
.inv-item .inv-buy { flex: 1; }
.inv-item-side { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.inv-item-side .money { font-size: 13.5px; color: var(--heading-color); }
.inv-item-side .inv-date { font-size: 11.5px; }
.inv-stack-total { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--heading-color); }
@media (max-width: 1199.98px) {
  .inv-hero, .inv-grid { grid-template-columns: minmax(0, 1fr); }
  .inv-open { order: -1; }
  .inv-closed { border-right: 0; border-top: 1px solid var(--border-color-light); }
}
@media (max-width: 575.98px) {
  .inv-head-actions, .inv-cards { width: 100%; }
  .inv-closed, .inv-open { padding: 18px; }
  .inv-closed-value { font-size: 32px; }
  .inv-facts { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .inv-fact { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; }
  .inv-toolbar { padding: 12px 18px; }
  .inv-detected { padding: 12px 18px; }
}

/* --- Shared page language (handoff "Redesign de 10 telas": lists, accounts, cards, budgets, savings, planning,
   history, settings). Components in templates/components/: segmented, strip_cell, composition_bar, category_chip,
   account_tag, row_actions, progress_bar, status_badge. --------------------------------------------------------- */
:root {
  --success-strong: #15803d; --warning-strong: #b45309; --info-strong: #0369a1;
  --tint-green: #f0fdf4; --tint-red: #fef2f2; --tint-teal: #f0fdfa; --tint-pending: #fffbeb;
  --switch-off: #c4d2e6; --count-bg: rgb(15 23 40 / 0.08);
}
[data-theme=dark] {
  --success-strong: #4ade80; --warning-strong: #fbbf24; --info-strong: #7dd3fc;
  --tint-green: rgba(22, 163, 74, 0.08); --tint-red: rgba(220, 38, 38, 0.1); --tint-teal: rgba(14, 165, 164, 0.1);
  --tint-pending: rgba(245, 158, 11, 0.07); --switch-off: #2a4052; --count-bg: rgb(255 255 255 / 0.08);
}
.main-content:has(.page) { padding-bottom: calc(4rem + 56px); } /* last card clear of the FAB */
.page { display: flex; flex-direction: column; gap: 24px; }
.page .card { margin-bottom: 0; }
.page .money { font-family: var(--mono-font); white-space: nowrap; }

/* header: title and a subtitle that sums the page up | month picker and the main button */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head-text { flex: 1 1 260px; min-width: 0; }
.page-head h1 { font-family: var(--heading-font); font-size: 24px; font-weight: 600; color: var(--heading-color); margin: 0 0 4px; }
.page-sub { font-size: 13px; color: var(--muted-color); margin: 0; }
.page-sub b { color: var(--heading-color); font-weight: 700; }
.page-sub b.is-warning { color: var(--warning-strong); }
.page-head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-cta {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 0; border-radius: 9px;
  background: var(--accent-color); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap;
  transition: filter var(--transition-fast);
}
.btn-cta:hover, .btn-cta:focus-visible { color: #fff; filter: brightness(0.94); }
.btn-cta i { font-size: 12px; }
.btn-cta .bi-chevron-down { font-size: 10px; opacity: 0.8; }
.btn-cta.is-success { background: var(--success-color); }
.btn-cta.is-danger { background: var(--danger-color); }
.btn-line {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-color); background: var(--surface-color); color: var(--heading-color);
  font-size: 13px; font-weight: 600; white-space: nowrap; transition: background var(--transition-fast);
}
.btn-line:hover { background: var(--table-stripe-bg); color: var(--heading-color); }
.btn-line i { font-size: 13px; }

/* summary strip: one card, cells side by side; the main one tinted */
.strip { display: grid; grid-template-columns: var(--strip-cols, repeat(4, minmax(0, 1fr))); border-radius: 12px; overflow: hidden; }
.strip-cell { min-width: 0; padding: 18px 22px; border-right: 1px solid var(--border-color-light); }
.strip-cell:last-child { border-right: 0; }
.strip-cell.is-green { background: var(--tint-green); }
.strip-cell.is-red { background: var(--tint-red); }
.strip-cell.is-teal { background: var(--tint-teal); }
.strip-label {
  display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted-color);
}
.strip-label .money { font-weight: 500; text-transform: none; letter-spacing: 0; }
.strip-cell.is-green .strip-label { color: var(--success-strong); }
.strip-cell.is-red .strip-label { color: var(--danger-color); }
.strip-cell.is-teal .strip-label { color: var(--accent-color); }
.strip-value {
  display: flex; align-items: center; gap: 6px; margin-top: 4px; font-family: var(--heading-font); font-size: 24px;
  font-weight: 700; line-height: 1.3; color: var(--heading-color); white-space: nowrap;
}
.strip-value.is-lg { font-size: 28px; }
.strip-value i { font-size: 16px; }
.strip-value.is-income { color: var(--success-strong); }
.strip-value.is-expense { color: var(--danger-color); }
.strip-value.is-warning { color: var(--warning-strong); }
.strip-value.is-muted { color: var(--muted-color); }
.strip-hint { margin-top: 2px; font-size: 12px; color: var(--muted-color); }
.strip-hint.is-warning { color: var(--warning-strong); font-weight: 600; }
.strip-hint a { font-weight: 600; }
.strip-cell .meter { margin: 6px 0 4px; }
@media (max-width: 1199.98px) {
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip-cell:nth-child(2n) { border-right: 0; }
  .strip-cell:not(:nth-last-child(-n + 2)) { border-bottom: 1px solid var(--border-color-light); }
}
@media (max-width: 575.98px) {
  .strip { grid-template-columns: minmax(0, 1fr); }
  .strip-cell { border-right: 0; border-bottom: 1px solid var(--border-color-light); }
  .strip-cell:last-child { border-bottom: 0; }
}

/* composition: one stacked bar and its legend */
.composition-bar { display: flex; gap: 2px; height: 10px; margin: 10px 0 8px; border-radius: 4px; overflow: hidden; }
.composition-bar span { flex-basis: 0; min-width: 2px; }
.composition-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted-color); }
.composition-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.composition-legend i { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* segmented control (.segmented, above): tones for tabs not selected, and the counter font anywhere */
.segmented .money { font-family: var(--mono-font); }
.segmented a.is-danger:not(.is-active) { color: var(--danger-color); }
.segmented a.is-warning:not(.is-active) { color: var(--warning-strong); }

/* toolbar of a list card: tabs | filter chips … | switches and export */
.list-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap;
  padding: 12px 22px; border-bottom: 1px solid var(--border-color);
}
.list-toolbar-group { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; min-width: 0; }
.list-toolbar-group:last-child:not(:first-child) { margin-left: auto; } /* stays on the right when it wraps */
.toolbar-divider { width: 1px; height: 20px; background: var(--border-color); }
.chip-filter {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 9999px;
  border: 1px solid var(--border-color); background: var(--surface-color); color: var(--muted-color);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip-filter:hover { color: var(--heading-color); }
.chip-filter > i { font-size: 11px; }
.chip-filter .chip-tail { font-size: 9px; opacity: 0.7; }
.chip-filter.is-active { border-color: rgb(14 165 164 / 0.4); background: rgb(14 165 164 / 0.08); color: var(--accent-color); }
.chip-filter-menu { max-height: 320px; overflow-y: auto; }
.pill-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; margin: 0; padding: 0 10px 0 6px; border-radius: 9999px;
  border: 1px solid var(--border-color); background: var(--surface-color); color: var(--muted-color);
  font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.pill-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.pill-toggle-track { position: relative; width: 28px; height: 16px; border-radius: 9999px; background: var(--switch-off); transition: background var(--transition-fast); }
.pill-toggle-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 9999px;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.2); transition: left var(--transition-fast);
}
.pill-toggle input:checked + .pill-toggle-track { background: var(--accent-color); }
.pill-toggle input:checked + .pill-toggle-track::after { left: 14px; }
.pill-toggle input:focus-visible + .pill-toggle-track { outline: 3px solid var(--input-focus-ring); }
.pill-toggle-count { padding: 0 6px; border-radius: 9999px; background: var(--count-bg); font-family: var(--mono-font); font-size: 11px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-color); background: var(--surface-color); color: var(--muted-color);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.btn-ghost:hover { color: var(--heading-color); background: var(--table-stripe-bg); }
.btn-ghost i { font-size: 12px; }

/* dense table */
.dense { width: 100%; font-size: 13.5px; border-collapse: collapse; table-layout: fixed; }
.dense thead tr { background: var(--table-header-bg); }
.dense th {
  padding: 8px 12px; overflow: hidden; font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; text-align: left; white-space: nowrap; color: var(--muted-color);
}
.dense .text-end { text-align: right; }
.dense :is(th, td):first-child { padding-left: 22px; }
.dense :is(th, td):last-child { padding-right: 22px; }
.dense td { padding: 11px 12px; overflow: hidden; border-top: 1px solid var(--border-color-light); vertical-align: middle; color: var(--default-color); }
.dense tbody tr { transition: background var(--transition-fast); }
.dense tbody tr:hover { background: var(--table-stripe-bg); }
.dense tr.is-pending { background: var(--tint-pending); }
.dense tr.is-cancelled { opacity: 0.6; }
.dense tfoot tr { border-top: 2px solid var(--border-color); background: var(--table-stripe-bg); }
.dense tfoot td { padding-top: 12px; padding-bottom: 12px; border-top: 0; font-weight: 700; color: var(--heading-color); }
.dense tfoot .foot-note { margin-left: 8px; font-size: 12.5px; font-weight: 500; color: var(--muted-color); }
.dense .num { text-align: right; font-family: var(--mono-font); font-weight: 500; white-space: nowrap; color: var(--heading-color); }
.dense .date { font-size: 13px; color: var(--muted-color); white-space: nowrap; }
.dense .actions { text-align: right; white-space: nowrap; overflow: visible; }
.amount-in { color: var(--success-strong); }
.amount-out { color: var(--danger-color); }
.amount-pending { color: var(--warning-strong); }
.amount-void { color: var(--light-color); }

/* first column: round avatar, name and a line on where it came from */
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 32px; height: 32px;
  border-radius: 9999px; font-size: 13px; background: var(--border-color-light); color: var(--light-color);
}
.avatar.is-income { background: var(--success-color-light); color: var(--success-color); }
.avatar.is-expense { background: var(--danger-color-light); color: var(--danger-color); }
.avatar.is-pending { background: var(--plan-purchase-bg); color: var(--plan-purchase-fg); }
.avatar.is-move { background: var(--info-color-light); color: var(--info-color); }
.cell-text { min-width: 0; }
.cell-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 500; color: var(--heading-color); }
.cell-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-name .pin { flex-shrink: 0; font-size: 11px; color: var(--light-color); }
.cell-meta { overflow: hidden; font-size: 11.5px; color: var(--muted-color); text-overflow: ellipsis; white-space: nowrap; }

/* category chip, account tag, status pill */
.cat-chip {
  --chip: var(--muted-color);
  display: inline-block; max-width: 100%; overflow: hidden; padding: 3px 8px; border-radius: 6px; vertical-align: middle;
  font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap;
  color: var(--chip); background: color-mix(in srgb, var(--chip) 15%, transparent);
}
[data-theme=dark] .cat-chip { color: color-mix(in srgb, var(--chip) 55%, #fff); background: color-mix(in srgb, var(--chip) 24%, transparent); }
.cat-chip.is-none { padding-left: 0; padding-right: 0; background: transparent; color: var(--light-color); }
.acct { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; vertical-align: middle; color: var(--default-color); }
.acct > i { flex-shrink: 0; width: 12px; height: 9px; border-radius: 2px; background: var(--acct, var(--border-color)); }
.acct > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct.is-none { color: var(--light-color); }
.status-pill { display: inline-block; padding: 3px 8px; border-radius: 6px; vertical-align: middle; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status-pill.is-paid { background: var(--success-color-light); color: var(--success-strong); }
.status-pill.is-open { background: var(--warning-color-light); color: var(--warning-strong); }
.status-pill.is-late { background: var(--danger-color-light); color: var(--danger-color); }
.status-pill.is-info { background: var(--info-color-light); color: var(--info-strong); }
.status-pill.is-cancelled { background: var(--border-color-light); color: var(--muted-color); }

/* row actions: the one that matters now, then ⋯ */
.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.row-act {
  padding: 4px 9px; border: 1px solid var(--success-color); border-radius: 6px; background: var(--surface-color);
  color: var(--success-color); font-size: 12px; font-weight: 600; transition: background var(--transition-fast);
}
.row-act:hover { background: var(--success-color); color: #fff; }
.row-more {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted-color); transition: background var(--transition-fast);
}
.row-more:hover, .row-more[aria-expanded=true] { background: var(--background-color); color: var(--heading-color); }
.row-actions .dropdown-menu form { margin: 0; }

/* progress bar with an optional marker */
.meter { position: relative; border-radius: 9999px; background: var(--border-color-light); }
.meter.is-sm { height: 6px; }
.meter.is-md { height: 8px; }
.meter.is-lg { height: 14px; }
.meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--success-color); }
.meter.is-warning .meter-fill { background: var(--warning-color); }
.meter.is-danger .meter-fill { background: var(--danger-color); }
.meter.is-accent .meter-fill { background: var(--accent-color); }
.meter-marker { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--heading-color); }
.meter-marker > span {
  position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 600;
  color: var(--heading-color); white-space: nowrap;
}

/* footnote of a page */
.page-note { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; color: var(--muted-color); }
.page-note > i { color: var(--accent-color); }
.page-note b { color: var(--heading-color); }

/* narrow screens: one card per row (name and chips on the left, amount and situation on the right) */
.list-stack { padding: 4px 18px 12px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-color-light); }
.list-item:last-child { border-bottom: 0; }
.list-item.is-pending { margin: 0 -18px; padding-left: 18px; padding-right: 18px; background: var(--tint-pending); }
.list-item.is-cancelled { opacity: 0.6; }
.list-item .cell-main { flex: 1; }
.list-item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.list-item-side .money { font-size: 13.5px; font-weight: 500; }
.list-item-chips { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 3px; }
.list-item-chips .cat-chip { flex-shrink: 0; max-width: 55%; padding: 1px 6px; font-size: 11px; }
.list-item-chips .cell-meta { flex: 1; min-width: 0; }
.list-toolbar .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.list-toolbar .segmented::-webkit-scrollbar { display: none; }
.list-toolbar .segmented a { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 575.98px) {
  .list-toolbar { padding: 12px 18px; }
  .list-toolbar .toolbar-divider { display: none; }
  .dense :is(th, td):first-child { padding-left: 18px; }
  .dense :is(th, td):last-child { padding-right: 18px; }
}
.chip-filter.is-active { padding-right: 4px; }
.chip-open { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; }
.chip-x { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 9999px; color: inherit; }
.chip-x:hover { background: rgb(14 165 164 / 0.16); color: inherit; }
a.chip-filter.is-active { padding-right: 10px; }
.chip-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px; vertical-align: middle; }
.btn-ghost.is-danger { color: var(--danger-color); }
.dense tr.is-pending-sync, .list-item.is-pending-sync { background: color-mix(in srgb, var(--warning-color) 8%, transparent); }
.list-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 22px;
  border-top: 1px solid var(--border-color); font-size: 12.5px; color: var(--muted-color);
}
.list-foot a { font-weight: 600; }
.list-item-actions { display: flex; align-items: center; gap: 4px; }

/* --- Lançamentos (templates/finance/transactions/list.html) --- */
.entries-table .col-check { width: 56px; }
.entries-table .col-cat { width: 15%; }
.entries-table .col-acct { width: 13%; }
.entries-table .col-value { width: 13%; }
.entries-table .col-status { width: 14%; }
.entries-table .col-actions { width: 116px; }
.dense th.check, .dense td.check { padding-right: 0; }
.dense .check .form-check-input { margin: 0; vertical-align: middle; }
.dense tr.day-row, .dense tr.day-row:hover { background: var(--table-stripe-bg); }
.dense tr.day-row td { padding-top: 6px; padding-bottom: 6px; font-size: 11.5px; font-weight: 700; color: var(--heading-color); white-space: nowrap; }
.dense tr.day-row td span { margin-left: 6px; font-weight: 500; color: var(--muted-color); }
.dense tr.day-row td.num { font-weight: 600; }
.list-toolbar.is-selection { background: rgb(14 165 164 / 0.06); }
.bulk-count { margin-right: 4px; font-size: 12.5px; color: var(--heading-color); }
.stack-day {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 0 6px; border-bottom: 1px solid var(--border-color-light);
  font-size: 11.5px; font-weight: 700; color: var(--heading-color);
}
.stack-day small { margin-left: 4px; font-size: 11.5px; font-weight: 500; color: var(--muted-color); }

/* --- Receitas and Despesas (templates/finance/transactions/kind_list.html) --- */
.kind-table .col-cat { width: 14%; }
.kind-table .col-acct { width: 11%; }
.kind-table .col-date { width: 7%; }
.kind-table .col-value { width: 14%; }
.kind-table .col-state { width: 24%; } /* "A pagar · 10/09", "Pagar" and ⋯ side by side */
.state-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

/* --- Contas e carteiras (templates/finance/accounts/list.html) --- */
.account-table .col-spark { width: 24%; }
.account-table .col-in, .account-table .col-out { width: 14%; }
.account-table .col-balance { width: 18%; }
.dense .group-row { background: var(--table-stripe-bg); }
.dense .group-row :is(th, td) {
  padding-top: 6px; padding-bottom: 6px; border-top: 1px solid var(--border-color-light); font-size: 11.5px;
  font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--heading-color); white-space: nowrap;
}
.dense .group-row th span { margin-left: 6px; font-weight: 500; color: var(--muted-color); }
.dense tr.is-idle, .list-item.is-idle { opacity: 0.7; }
.acct-thumb {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 38px; height: 26px;
  border-radius: 5px; background: var(--acct, var(--light-color)); color: #fff;
  font: 800 10px/1 var(--heading-font); text-shadow: 0 1px 1px rgb(0 0 0 / 0.35); /* legible on yellow too */
}
.badge-main {
  flex-shrink: 0; padding: 1px 6px; border-radius: 9999px; background: #ccfbf1; color: #0c9190;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
[data-theme=dark] .badge-main { background: rgb(14 165 164 / 0.18); color: #5eead4; }
.chart-spark { display: block; width: 100%; height: 22px; }
.chart-spark .is-off { fill: var(--border-color-light); }
.chart-spark.is-wallet .is-on { fill: var(--accent-color); }
.chart-spark.is-savings .is-on { fill: var(--info-strong); }
.balance-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.page .balance { font-family: var(--mono-font); font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--heading-color); }
.page .balance.is-negative { color: var(--danger-color); }
.page .balance.is-zero { color: var(--light-color); }
.strip-hint b.is-danger { color: var(--danger-color); font-weight: 600; }
a.pill-toggle { text-decoration: none; }
a.pill-toggle:hover { color: var(--heading-color); }
.pill-toggle.is-on .pill-toggle-track { background: var(--accent-color); }
.pill-toggle.is-on .pill-toggle-track::after { left: 14px; }
.btn-link-strong { padding: 0; border: 0; background: none; color: var(--accent-color); font-size: inherit; font-weight: 600; white-space: nowrap; }
.btn-link-strong:hover { text-decoration: underline; }
.stack-group {
  display: flex; justify-content: space-between; gap: 12px; margin: 0 -18px; padding: 6px 18px;
  background: var(--table-stripe-bg); font-size: 11.5px; font-weight: 700; color: var(--heading-color);
}
.stack-flow { font-family: var(--mono-font); font-size: 11px; white-space: nowrap; }
.list-item .row-actions { flex-shrink: 0; }

/* --- Cartões de crédito (templates/finance/cards/list.html) --- */
.page-sub b.is-danger { color: var(--danger-color); }
.page .money.is-ok { color: var(--success-strong); }
.page .money.is-warning, .page b.is-warning { color: var(--warning-strong); }
.page .money.is-danger, .page b.is-danger { color: var(--danger-color); }
.usage-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.usage-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 52px; gap: 10px; align-items: center; font-size: 12px; }
.usage-row .acct { font-weight: 600; color: var(--heading-color); }
.usage-pct { text-align: right; font-weight: 600; }
.usage-pct.is-ok { color: var(--muted-color); }
.strip-tip { display: flex; gap: 6px; margin-top: 8px; font-size: 11.5px; color: var(--muted-color); }
.strip-tip > i { color: var(--warning-color); }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 1199.98px) { .card-grid { grid-template-columns: minmax(0, 1fr); } }
.card-panel { display: flex; flex-direction: column; overflow: hidden; }
.card-panel.is-archived { opacity: 0.7; }
.card-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px 0; }
.card-panel-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.card-panel-name { margin: 0; overflow: hidden; font-family: var(--heading-font); font-size: 16px; font-weight: 600; color: var(--heading-color); text-overflow: ellipsis; white-space: nowrap; }
.card-panel-state { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.card-art {
  display: inline-flex; align-items: flex-end; justify-content: flex-end; flex-shrink: 0; width: 44px; height: 30px; padding: 4px;
  border-radius: 6px; background: linear-gradient(135deg, var(--card), color-mix(in srgb, var(--card) 60%, #000));
}
.card-art > span { width: 9px; height: 7px; border-radius: 1px; background: rgb(255 255 255 / 0.7); }
.card-panel-limit { padding: 14px 22px 18px; border-bottom: 1px solid var(--border-color-light); }
.card-panel-limit .meter { height: 10px; margin: 6px 0; }
.limit-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12px; color: var(--muted-color); }
.limit-line .money { color: var(--heading-color); }
.card-panel-invoices { flex: 1; padding: 0 22px; }
.invoice-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 78px; gap: 12px; align-items: center;
  margin: 0 -22px; padding: 10px 22px; border-bottom: 1px solid var(--border-color-light);
}
.invoice-line:last-child { border-bottom: 0; }
.invoice-line.is-soon { background: var(--tint-pending); }
.invoice-name { font-size: 13.5px; font-weight: 600; color: var(--heading-color); white-space: nowrap; }
.invoice-value { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.invoice-value .money { font-size: 14px; font-weight: 600; color: var(--heading-color); }
.invoice-value .money.is-zero { color: var(--light-color); }
.invoice-value .status-pill { padding: 2px 7px; border-radius: 9999px; font-size: 11px; }
.invoice-action { text-align: right; }
.link-more { font-size: 12px; font-weight: 600; white-space: nowrap; }
.card-panel-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 22px;
  border-top: 1px solid var(--border-color-light); background: var(--table-stripe-bg); font-size: 12px; color: var(--muted-color);
}
.card-panel-foot > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-panel-foot a { flex-shrink: 0; font-weight: 600; }
@media (max-width: 575.98px) {
  .card-panel-head, .card-panel-limit, .card-panel-foot { padding-left: 18px; padding-right: 18px; }
  .card-panel-invoices { padding: 0 18px; }
  .invoice-line { margin: 0 -18px; padding: 10px 18px; grid-template-columns: minmax(0, 1fr) auto 64px; gap: 8px; }
  .limit-line { flex-wrap: wrap; }
}

/* --- shared by the pages with a side column (Orçamento, Poupança): a main card and a 320px aside --- */
.page-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 1199.98px) { .page-grid { grid-template-columns: minmax(0, 1fr); } }
.side-stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.refresh-slot { display: contents; } /* a region refreshed in place that may be empty (see settle.js) */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border-color); }
.card-head.is-stacked { flex-direction: column; align-items: flex-start; gap: 2px; }
.card-head h2 { margin: 0; font-family: var(--heading-font); font-size: 15px; font-weight: 600; color: var(--heading-color); }
.card-head > span { font-size: 12px; color: var(--muted-color); }
.card-head > span b { color: var(--heading-color); }
.card-head > a { font-size: 12px; font-weight: 600; }
.side-stack .card-head { padding: 14px 18px; }
.mini-list { margin: 0; padding: 6px 18px 4px; list-style: none; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-color-light); font-size: 13px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--heading-color); }
.mini-list-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-list-name > i { flex-shrink: 0; width: 8px; height: 8px; border-radius: 2px; }
.mini-list-name small { flex-shrink: 0; font-size: 11.5px; color: var(--muted-color); }
.mini-list-name.is-stacked { flex-direction: column; align-items: flex-start; gap: 0; }
.mini-list-name.is-stacked > span { max-width: 100%; font-weight: 500; }
.mini-list-side { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.mini-list .money { color: var(--heading-color); }
.side-empty { margin: 0; padding: 14px 18px 4px; font-size: 12.5px; color: var(--muted-color); }
.side-link { display: inline-block; margin: 4px 18px 14px; font-size: 12.5px; font-weight: 600; }
.side-stack .page-note { align-items: flex-start; padding: 4px 18px 14px; font-size: 11.5px; }
.side-stack .page-note > i { margin-top: 2px; }

/* --- a hero split in two (Orçamento, Poupança): the main figure, its bar and facts | a side panel --- */
.hero-split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); overflow: hidden; }
@media (max-width: 991.98px) { .hero-split { grid-template-columns: minmax(0, 1fr); } }
.hero-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 22px 26px; border-right: 1px solid var(--border-color-light); }
.hero-main .empty-state { margin: auto 0; }
.hero-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-title h2 { margin: 0; font-family: var(--heading-font); font-size: 15px; font-weight: 600; color: var(--heading-color); }
.hero-title .status-pill { padding: 4px 10px; border-radius: 9999px; }
.hero-title .status-pill i { margin-right: 4px; }
.hero-value { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted-color); }
.hero-value b { color: var(--heading-color); }
.big-value { font-family: var(--heading-font); font-size: 40px; font-weight: 700; line-height: 1; color: var(--heading-color); white-space: nowrap; }
.hero-track { padding-top: 18px; }
.hero-ruler { position: relative; height: 16px; margin-top: 6px; font-size: 11.5px; color: var(--muted-color); }
.hero-ruler span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.hero-ruler span:first-child { transform: none; }
.hero-ruler span:last-child { transform: translateX(-100%); }
.hero-ruler .is-limit { color: var(--danger-color); }
.hero-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hero-fact { min-width: 0; padding: 10px 12px; border: 1px solid var(--border-color-light); border-radius: 9px; background: var(--table-stripe-bg); }
.hero-fact-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-color); }
.hero-fact .money { display: block; margin-top: 2px; overflow: hidden; font-size: 16px; color: var(--heading-color); text-overflow: ellipsis; }
.hero-fact .money small { font-size: 11px; color: var(--muted-color); }
.hero-fact.is-left { border-color: var(--success-color-light); background: var(--tint-green); }
.hero-fact.is-left :is(.hero-fact-label, .money) { color: var(--success-strong); }
.hero-fact.is-over { border-color: var(--danger-color-light); background: var(--tint-red); }
.hero-fact.is-over :is(.hero-fact-label, .money) { color: var(--danger-color); }
.hero-fact .money { font-weight: 600; }
.hero-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 22px 26px; background: var(--table-stripe-bg); }
.hero-side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-side-head h2 { margin: 0; font-family: var(--heading-font); font-size: 14px; font-weight: 600; color: var(--heading-color); }
.hero-side-head span { font-size: 12px; color: var(--muted-color); }

/* --- Orçamento (templates/finance/budgets/list.html) --- */
.month-bars { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; height: 120px; margin-top: 18px; }
.month-bars-limit { position: absolute; left: 0; right: 0; z-index: 1; border-top: 2px dashed var(--light-color); pointer-events: none; }
.month-bar { position: relative; height: 100%; }
.month-bar-fill { position: absolute; left: 0; right: 0; bottom: 0; min-height: 2px; border-radius: 5px 5px 0 0; background: var(--light-color); }
.month-bar-fill .money {
  position: absolute; bottom: 100%; left: 50%; z-index: 2; margin-bottom: 3px; padding: 0 2px; border-radius: 3px;
  background: var(--table-stripe-bg); transform: translateX(-50%); font-size: 10.5px; /* over the limit line */
}
.month-bar-fill.is-ok { background: var(--success-color); }
.month-bar-fill.is-ok .money { color: var(--success-strong); }
.month-bar-fill.is-warning { background: var(--warning-color); }
.month-bar-fill.is-warning .money { color: var(--warning-strong); }
.month-bar-fill.is-danger { background: var(--danger-color); }
.month-bar-fill.is-danger .money { color: var(--danger-color); }
.month-bar-fill.is-accent { background: var(--accent-color); }
.month-bar-fill.is-accent .money { color: var(--accent-color); font-weight: 700; }
.month-bar-fill.is-muted .money { color: var(--muted-color); }
.month-bars-axis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; font-size: 11px; text-align: center; color: var(--muted-color); }
.month-bars-axis .is-current { font-weight: 700; color: var(--heading-color); }
.month-bars-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted-color); }
.month-bars-legend > i { flex-shrink: 0; width: 10px; border-top: 2px dashed var(--light-color); }
.month-bars-legend b.is-danger { color: var(--danger-color); }
.limit-rows { padding: 4px 0; }
.limit-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 150px auto; gap: 14px; align-items: center;
  padding: 12px 22px; border-top: 1px solid var(--border-color-light);
}
.limit-row:first-child { border-top: 0; }
.limit-row:hover { background: var(--table-stripe-bg); }
.cat-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px;
  background: color-mix(in srgb, var(--cat) 15%, transparent); color: var(--cat); font-size: 15px;
}
.limit-row-main { min-width: 0; }
.limit-row-name { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.limit-row-name > span { overflow: hidden; font-weight: 600; color: var(--heading-color); text-overflow: ellipsis; white-space: nowrap; }
.limit-row-name small { flex-shrink: 0; font-size: 12px; color: var(--muted-color); }
.limit-row-name small.is-warning { color: var(--warning-strong); font-weight: 600; }
.limit-row-name small.is-danger { color: var(--danger-color); font-weight: 600; }
.limit-row-figures { text-align: right; white-space: nowrap; }
.limit-row-figures .money { font-weight: 600; }
.limit-row-figures .money.is-zero { color: var(--light-color); }
.limit-row-figures small { font-size: 11px; color: var(--muted-color); }
@media (max-width: 575.98px) {
  .hero-main, .hero-side { padding: 18px; }
  .big-value { font-size: 32px; }
  .hero-facts { grid-template-columns: minmax(0, 1fr); }
  .limit-row { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 12px 18px; }
  .limit-row-figures { grid-column: 2; text-align: left; }
  .limit-row .row-actions { grid-column: 3; grid-row: 1; }
  .hero-ruler.is-quarters span:nth-child(3) { display: none; } /* 75% would run into the limit */
}
.history-table .col-month { width: 22%; }
.history-table .col-value { width: 30%; }
.history-table .col-act { width: 56px; }
@media (max-width: 575.98px) {
  .history-table .col-month { width: 20%; }
  .history-table .col-value { width: 38%; }
}

/* --- Poupança e reserva (templates/finance/savings/page.html) --- */
.savings-hero { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 991.98px) { .savings-hero { grid-template-columns: minmax(0, 1fr); } }
.hero-title .status-pill b { font-weight: 700; }
.hero-ruler .is-goal { color: var(--heading-color); }
.hero-fact small { display: block; overflow: hidden; font-size: 11px; color: var(--muted-color); text-overflow: ellipsis; white-space: nowrap; }
.hero-fact .money small { display: inline; }
.mid-value { font-family: var(--heading-font); font-size: 30px; font-weight: 700; line-height: 1; color: var(--heading-color); white-space: nowrap; }
.deposit-actions { display: flex; gap: 8px; }
.deposit-actions .btn-cta { flex: 1; justify-content: center; }
.deposit-panel.is-pending-sync { background: color-mix(in srgb, var(--warning-color) 8%, var(--table-stripe-bg)); }
.savings-tip { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 12px; color: var(--muted-color); }
.savings-tip > i { margin-top: 1px; color: var(--warning-color); }
.savings-tip > .bi-info-circle { color: var(--accent-color); }
.savings-tip b { color: var(--danger-color); }
.main-stack { gap: 24px; }
.main-stack .card-head { flex-wrap: wrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--muted-color); }
.chart-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 8px; height: 8px; border-radius: 2px; }
.chart-legend .is-in { background: var(--accent-color); }
.chart-legend .is-out { background: var(--danger-color); }
.chart-legend .is-line { width: 10px; height: 0; border-top: 2px solid var(--heading-color); border-radius: 0; }
.chart-scroll { padding: 20px 22px 10px; overflow-x: auto; direction: rtl; } /* scrolled to the latest months */
.chart-scroll > svg { direction: ltr; }
.chart-flow { display: block; width: 100%; min-width: 480px; height: auto; overflow: visible; }
.chart-grid { stroke: var(--border-color-light); }
.chart-axis { fill: var(--muted-color); font: 11px var(--mono-font); }
.chart-bar.is-in { fill: var(--accent-color); opacity: 0.85; }
.chart-bar.is-out { fill: var(--danger-color); opacity: 0.85; }
.chart-line { fill: none; stroke: var(--heading-color); stroke-width: 2; }
.chart-dot { fill: var(--surface-color); stroke: var(--heading-color); stroke-width: 1.5; }
.chart-pill rect { fill: var(--heading-color); }
.chart-pill text { fill: var(--surface-color); font: 600 11px var(--mono-font); }
.chart-label { fill: var(--muted-color); font: 500 11px var(--default-font); }
.chart-label.is-current { fill: var(--heading-color); font-weight: 700; }
.savings-table .col-acct { width: 22%; }
.savings-table .col-value { width: 21%; }
.savings-table .col-after { width: 23%; }
.amount-after { color: var(--muted-color); }
.avatar.is-saving { background: rgb(14 165 164 / 0.15); color: var(--accent-color); }
.cell-name a { overflow: hidden; color: inherit; text-overflow: ellipsis; white-space: nowrap; }
.cell-name a:hover { color: var(--accent-color); }
.goal-list { margin: 0; padding: 4px 18px 8px; list-style: none; }
.goal { padding: 12px 0; border-bottom: 1px solid var(--border-color-light); }
.goal:last-child { border-bottom: 0; }
.goal.is-inactive { opacity: 0.6; }
.goal-head { display: flex; align-items: center; gap: 8px; }
.goal-icon {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 28px; height: 28px;
  border-radius: 8px; background: rgb(14 165 164 / 0.15); color: var(--accent-color); font-size: 13px;
}
.goal-icon.is-reserve { background: var(--info-color-light); color: var(--info-strong); }
.goal-name { flex: 1; min-width: 0; overflow: hidden; font-weight: 600; color: var(--heading-color); text-overflow: ellipsis; white-space: nowrap; }
.goal-figures { display: flex; justify-content: space-between; margin: 8px 0 5px; font-size: 12px; color: var(--muted-color); }
.goal-figures .money { color: var(--heading-color); }
.goal-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; font-size: 11.5px; color: var(--muted-color); }
.goal-foot .is-danger { color: var(--danger-color); font-weight: 600; }
.goal-foot .is-warning { color: var(--warning-strong); font-weight: 600; }
.goal-foot .is-ok { color: var(--success-strong); font-weight: 600; }
@media (max-width: 575.98px) {
  .deposit-actions { flex-direction: column; }
  .chart-scroll { padding: 16px 12px 8px; }
}

/* --- Planejamento (templates/finance/planning/page.html) --- */
.strip-label > span { display: inline-flex; align-items: center; gap: 6px; }
.strip-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; font-weight: 600; }
.page-note.is-scenario { padding: 10px 14px; border: 1px solid rgb(14 165 164 / 0.3); border-radius: 9px; background: var(--tint-teal); color: var(--heading-color); }
.page-note.is-scenario a { font-weight: 600; }
.scenario summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; cursor: pointer; list-style: none; }
.scenario summary::-webkit-details-marker { display: none; }
.scenario[open] summary { border-bottom: 1px solid var(--border-color); }
.scenario-title { display: inline-flex; align-items: center; gap: 8px; font-family: var(--heading-font); font-size: 15px; font-weight: 600; color: var(--heading-color); }
.scenario-title i { color: var(--accent-color); font-size: 14px; }
.scenario-sub { font-size: 12px; color: var(--muted-color); }
.scenario-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 16px; align-items: end; padding: 16px 22px 18px; }
@media (max-width: 991.98px) { .scenario-form { grid-template-columns: minmax(0, 1fr); } }
.scenario-option { display: flex; flex-direction: column; gap: 8px; margin: 0; font-size: 13px; color: var(--default-color); }
.scenario-option:has(> input[type=checkbox]) { flex-direction: row; align-items: flex-start; gap: 10px; }
.scenario-option > input[type=checkbox] { margin-top: 3px; flex-shrink: 0; }
.scenario-option b { display: block; font-weight: 600; color: var(--heading-color); }
.scenario-option small { display: block; font-size: 11.5px; color: var(--muted-color); }
.scenario-extra { display: flex; gap: 8px; }
.scenario-extra input { flex: 1; min-width: 0; }
.scenario-extra select { width: auto; }
.scenario-actions { display: flex; gap: 8px; }
.chart-legend .is-positive { width: 10px; height: 3px; background: var(--accent-color); }
.chart-legend .is-negative { width: 10px; height: 3px; background: var(--danger-color); }
.chart-legend .is-dashed { width: 10px; height: 0; border-top: 2px dashed var(--light-color); border-radius: 0; }
.chart-legend .is-fixed { background: #475569; }
.chart-legend .is-card { background: #d97706; }
.chart-legend .is-variable { background: var(--light-color); }
.chart-legend .is-saving { background: var(--accent-color); }
.chart-grid.is-zero { stroke: var(--light-color); stroke-width: 1.2; }
.chart-area.is-negative { fill: var(--danger-color); fill-opacity: 0.1; }
.chart-area.is-positive { fill: var(--accent-color); fill-opacity: 0.12; }
.chart-line.is-negative { stroke: var(--danger-color); stroke-width: 2.5; }
.chart-line.is-positive { stroke: var(--accent-color); stroke-width: 2.5; }
.chart-line.is-dashed { stroke: var(--light-color); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart-dot.is-negative { stroke: var(--danger-color); stroke-width: 2; }
.chart-dot.is-positive { stroke: var(--accent-color); stroke-width: 2; }
.chart-projection .chart-label { font-size: 11.5px; }
.plan-table .col-month { width: 15%; }
.plan-table .col-in { width: 14%; }
.plan-table .col-out { width: 14%; }
.plan-table .col-balance { width: 18%; }
.dense tr.is-worst, .list-item.is-worst { background: var(--tint-red); }
.list-item.is-worst { margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.plan-table .cell-name a, .plan-item .cell-name a { color: var(--heading-color); font-weight: 600; }
.out-bar { display: flex; gap: 2px; height: 12px; overflow: hidden; border-radius: 4px; background: var(--background-color); }
.out-bar span { flex-shrink: 0; }
.out-bar .is-fixed { background: #475569; }
.out-bar .is-card { background: #d97706; }
.out-bar .is-variable { background: var(--light-color); }
.out-bar .is-saving { background: var(--accent-color); }
[data-theme=dark] .out-bar .is-fixed, [data-theme=dark] .chart-legend .is-fixed { background: #94a3b8; }
.out-values { display: flex; gap: 10px; margin-top: 5px; overflow: hidden; font-size: 11px; color: var(--muted-color); white-space: nowrap; }
.out-values .is-card { color: var(--warning-strong); }
.out-values .is-saving { color: var(--accent-color); }
.plan-table .balance, .plan-item .balance { font-size: 14px; }
.page .balance.is-positive { color: var(--success-strong); }
.plan-table .delta { margin-top: 2px; font-family: var(--default-font); font-size: 11px; font-weight: 500; color: var(--muted-color); }
.plan-item .cell-text { flex: 1; min-width: 0; }
.plan-item .out-bar { margin-top: 6px; }

/* --- Histórico mensal (templates/finance/history/page.html) --- */
.best-worst { display: flex; flex-direction: column; margin-top: 8px; font-family: var(--heading-font); font-size: 16px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.best-worst .is-income { color: var(--success-strong); }
.best-worst .is-expense { color: var(--danger-color); }
.chart-legend .is-received { background: var(--success-color); }
.chart-legend .is-spent { background: var(--danger-color); opacity: 0.8; }
.chart-bar.is-received { fill: var(--success-color); }
.chart-bar.is-spent { fill: var(--danger-color); opacity: 0.8; }
.chart-dot.is-below { fill: var(--danger-color); }
.history-months .col-month { width: 23%; }
.history-months .col-in, .history-months .col-out { width: 11%; }
.history-months .col-result { width: 13%; }
.history-months .col-bar { width: 15%; }
.history-months .col-act { width: 64px; }
.history-months .cell-name a { color: var(--heading-color); font-weight: 600; }
.month-lock { flex-shrink: 0; font-size: 11px; color: var(--light-color); }
.badge-open {
  flex-shrink: 0; padding: 1px 6px; border-radius: 9999px; background: var(--success-color-light); color: var(--success-strong);
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.out-bar.is-thin { height: 10px; }
.out-bar .is-spending, .chart-legend .is-spending { background: #d97706; } /* variable expenses, as in the strip */
.history-months .balance { font-size: 14px; }
.history-months .delta { margin-top: 2px; font-family: var(--default-font); font-size: 11px; font-weight: 500; color: var(--muted-color); }
.top-category { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 12px; color: var(--default-color); }
.top-category > i { flex-shrink: 0; width: 8px; height: 8px; border-radius: 2px; }
.top-category > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dense tr.is-best, .list-item.is-best { background: var(--tint-green); }
.list-item > .cell-text { flex: 1; min-width: 0; } /* the figures and the menu stay on the right */
.list-item.is-best { margin: 0 -18px; padding-left: 18px; padding-right: 18px; }

/* --- Configurações (templates/accounts/settings.html): each control saves itself; the seal tells where it stands --- */
.save-seal {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 9999px;
  background: #dcfce7; color: var(--success-strong); font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.save-seal[data-state="saving"] { background: var(--table-header-bg); color: var(--muted-color); }
.save-seal[data-state="saving"] i { animation: seal-spin 1s linear infinite; }
.save-seal[data-state="offline"] { background: #ffedd5; color: var(--warning-strong); }
.save-seal[data-state="error"] { background: #fee2e2; color: var(--danger-color); white-space: normal; }
[data-theme=dark] .save-seal { background: rgba(22, 163, 74, 0.16); }
[data-theme=dark] .save-seal[data-state="saving"] { background: var(--table-header-bg); }
[data-theme=dark] .save-seal[data-state="offline"] { background: rgba(245, 158, 11, 0.16); }
[data-theme=dark] .save-seal[data-state="error"] { background: rgba(220, 38, 38, 0.14); }
@keyframes seal-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .save-seal[data-state="saving"] i { animation: none; } }

.prefs-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; align-items: start; }
.prefs-nav { position: sticky; top: calc(var(--header-height) + 32px); display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
/* FlexAdmin hides the horizontal overflow of html and body; on body that makes a scroll box that never scrolls, and a
   sticky nav would stick to it, i.e. never. Clipping looks the same and is no scroll box. */
body:has(.prefs-layout) { overflow-x: clip; }
.prefs-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; border: 1px solid transparent;
  color: var(--muted-color); font-weight: 600;
}
.prefs-nav a i { font-size: 14px; color: var(--light-color); }
.prefs-nav a:hover { color: var(--heading-color); }
.prefs-nav a.is-active {
  background: var(--surface-color); border-color: var(--border-color); color: var(--heading-color);
  box-shadow: 0 1px 3px rgb(2 12 27 / 0.06);
}
.prefs-nav a.is-active i { color: var(--accent-soft-dark); }
.prefs-sections { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.prefs-card { overflow: hidden; scroll-margin-top: calc(var(--header-height) + 24px); }
.prefs-card-head { padding: 16px 22px 14px; }
.prefs-card-head h2 { margin: 0; font-family: var(--heading-font); font-size: 15px; font-weight: 600; color: var(--heading-color); }
.prefs-card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted-color); }

/* a setting: what it is and what it changes on the left, its control on the right */
.pref {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center;
  padding: 16px 22px; border-top: 1px solid var(--border-color-light);
}
.pref-name { display: block; margin: 0; font-size: 13.5px; font-weight: 600; color: var(--heading-color); }
.pref-hint { margin-top: 2px; font-size: 12px; color: var(--muted-color); text-wrap: pretty; }
.pref-hint a, .pref-link { font-weight: 600; color: var(--accent-soft-dark); }
.pref-hint b { font-weight: 600; color: var(--heading-color); }
.pref-control { display: flex; align-items: center; gap: 8px; }
.pref-control.is-wrap { flex-wrap: wrap; justify-content: flex-end; }
.pref-control.is-disabled { opacity: 0.5; }
.pref-control .btn-line, .pref-control .btn-cta { height: 34px; }
.pref-value { font-size: 13px; color: var(--heading-color); }
.pref-link { font-size: 12px; white-space: nowrap; }
.pref-last-sync:not(:empty)::before { content: " · "; }
.pref-block { padding: 16px 22px; border-top: 1px solid var(--border-color-light); }
.pref-conflicts { margin-top: 10px; }
.pref.is-danger { background: var(--tint-red); }
.pref.is-danger .pref-name { color: #b91c1c; }
[data-theme=dark] .pref.is-danger .pref-name { color: #f87171; }
.btn-line.is-danger { border-color: #fecaca; color: var(--danger-color); }
[data-theme=dark] .btn-line.is-danger { border-color: rgba(220, 38, 38, 0.4); }

/* the controls: radios in the segmented pill, toggle chips, a switch, a number with its unit, a slider */
.segmented label { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.segmented label input, .chip-toggle input, .switch input, .mode-card input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label span {
  display: inline-flex; align-items: center; justify-content: center; height: 24px; padding: 0 12px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted-color); white-space: nowrap; transition: background var(--transition-fast);
}
.segmented label input:checked + span { background: var(--surface-color); color: var(--heading-color); box-shadow: 0 1px 3px rgb(2 12 27 / 0.12); }
.segmented label input:focus-visible + span, .chip-toggle input:focus-visible + span { outline: 2px solid var(--accent-color); outline-offset: 1px; }
.chip-toggle { position: relative; margin: 0; cursor: pointer; }
.chip-toggle span {
  display: inline-flex; padding: 4px 10px; border-radius: 9999px; border: 1px solid var(--border-color);
  background: var(--surface-color); color: var(--muted-color); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip-toggle input:checked + span {
  border-color: var(--accent-color); background: color-mix(in srgb, var(--accent-color) 8%, var(--surface-color)); color: var(--accent-soft-dark);
}
.switch { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.switch-track { position: relative; width: 36px; height: 20px; border-radius: 9999px; background: var(--switch-off); transition: background var(--transition-fast); }
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 9999px;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.2); transition: left var(--transition-fast);
}
.switch input:checked + .switch-track { background: var(--accent-color); }
.switch input:checked + .switch-track::after { left: 18px; }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--input-focus-ring); }
.unit-input {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border-color); background: var(--surface-color);
}
.unit-input:focus-within { border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.unit-input input {
  width: 100%; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent;
  font-family: var(--mono-font); font-size: 13px; color: var(--heading-color);
}
.unit-input input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.unit-input input::-webkit-outer-spin-button, .unit-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit-input > span { margin-left: auto; font-size: 11px; color: var(--muted-color); white-space: nowrap; }
.unit-input.is-money { width: 130px; }
.unit-input.is-pct { width: 64px; }
.range-input {
  -webkit-appearance: none; appearance: none; width: 160px; height: 6px; margin: 0; border-radius: 9999px; cursor: pointer;
  background: linear-gradient(to right, var(--accent-color) var(--fill, 50%), var(--border-color-light) var(--fill, 50%));
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 9999px;
  border: 2px solid var(--accent-color); background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
}
.range-input::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 9999px; border: 2px solid var(--accent-color); background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.15);
}
.range-input::-moz-range-track { background: transparent; }
.range-input:focus-visible { outline: 3px solid var(--input-focus-ring); outline-offset: 4px; }
.range-input:disabled, .unit-input input:disabled { cursor: not-allowed; }

/* Lançamentos detectados: the three modes as cards */
.mode-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 4px 22px 18px; }
.mode-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 14px; border-radius: 10px;
  border: 1.5px solid var(--border-color); background: var(--surface-color); cursor: pointer;
}
.mode-card-top { display: flex; align-items: center; justify-content: space-between; }
.mode-card-top > i { font-size: 16px; color: var(--light-color); }
.mode-card-check {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 9999px;
  border: 1.5px solid var(--switch-off);
}
.mode-card-check i { display: none; font-size: 15px; line-height: 1; color: var(--accent-color); }
.mode-card-title { font-size: 13.5px; font-weight: 600; color: var(--heading-color); }
.mode-card-text { font-size: 12px; color: var(--muted-color); text-wrap: pretty; }
.mode-card:has(input:checked) { border-color: var(--accent-color); background: color-mix(in srgb, var(--accent-color) 5%, var(--surface-color)); }
.mode-card:has(input:checked) .mode-card-top > i { color: var(--accent-soft-dark); }
.mode-card:has(input:checked) .mode-card-check { border: 0; }
.mode-card:has(input:checked) .mode-card-check i { display: block; }
.mode-card:has(input:focus-visible) { outline: 3px solid var(--input-focus-ring); }

@media (max-width: 991.98px) {
  .prefs-layout { grid-template-columns: minmax(0, 1fr); }
  .prefs-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .prefs-nav::-webkit-scrollbar { display: none; }
  .prefs-nav a { flex-shrink: 0; white-space: nowrap; }
  .mode-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 575.98px) {
  .pref { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px 16px; }
  .pref:has(> .pref-control > .switch) { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; } /* a switch stays beside */
  .pref-control { flex-wrap: wrap; }
  .pref-control.is-wrap { justify-content: flex-start; }
  .prefs-card-head, .pref-block, .mode-cards { padding-left: 16px; padding-right: 16px; }
  .pref-control .segmented { width: 100%; }
  .pref-control .segmented label { flex: 1; }
  .pref-control .segmented label span { width: 100%; padding: 0 6px; }
  .pref-control .range-input { flex: 1; width: auto; }
}
.delete-card { max-width: 760px; } /* Apagar conta (templates/accounts/delete.html) */
.delete-steps { margin: 0; padding: 0 22px 16px 42px; list-style: decimal; font-size: 13px; color: var(--default-color); }
.delete-steps li + li { margin-top: 4px; }
.delete-form { padding: 16px 22px 20px; border-top: 1px solid var(--border-color-light); }
.delete-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
@media (max-width: 575.98px) {
  .delete-steps { padding-left: 34px; padding-right: 16px; }
  .delete-form { padding-left: 16px; padding-right: 16px; }
}
.fauth-help ul { margin: 4px 0 0; padding-left: 1.1rem; list-style: disc; } /* Criar conta: the password rules, as a short list */

/* --- Lançamento rápido (templates/includes/quick_entry.html): value, description, Enter ------------- */
.qe-modal .modal-dialog { max-width: 480px; }
.qe {
  --qe-accent: var(--danger-color);
  --qe-tint: var(--tint-red);
  border: 0; border-radius: 16px; overflow: visible;
  box-shadow: 0 30px 60px -20px rgb(2 12 27 / 0.45);
}
.qe[data-accent="income"] { --qe-accent: var(--success-color); --qe-tint: var(--tint-green); }
.qe .segmented label input:checked + span { color: var(--qe-accent); }

.qe-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 0; }
.qe-head-end { display: flex; align-items: center; gap: 6px; }
.qe-tip { font-size: 11px; color: var(--light-color); }
.qe-close {
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted-color);
  font-size: 15px;
}
.qe-close:hover { background: var(--background-color); color: var(--heading-color); }

.qe-amount { padding: 18px 16px 6px; text-align: center; }
.qe-amount-field { display: inline-flex; align-items: baseline; gap: 8px; max-width: 100%; }
.qe-currency { font-family: var(--heading-font); font-size: 20px; font-weight: 600; color: var(--light-color); }
.qe-amount input {
  width: 260px; max-width: 100%; padding: 0; border: 0; background: transparent; text-align: left;
  font-family: var(--mono-font); font-size: 44px; font-weight: 600; letter-spacing: -0.01em; color: var(--heading-color);
}
.qe-amount input::placeholder { color: var(--border-color-dark); }
.qe-rule { width: 120px; height: 2px; margin: 4px auto 0; border-radius: 2px; background: var(--qe-accent); }

.qe-what { padding: 14px 16px 0; }
.qe-desc-wrap { position: relative; }
.qe-desc {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px; border-radius: 10px;
  border: 1.5px solid var(--border-color); background: var(--surface-color);
}
.qe-desc:focus-within { border-color: var(--qe-accent); }
.qe-desc input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; font-weight: 500; color: var(--heading-color); }
.qe-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 9999px; background: var(--background-color); color: var(--light-color); font-size: 13px;
}
.qe-clear { border: 0; background: transparent; color: var(--light-color); font-size: 13px; }
.qe-clear:hover { color: var(--muted-color); }

.qe-list {
  position: absolute; left: 0; right: 0; top: 50px; z-index: 5; overflow: hidden; border-radius: 10px;
  border: 1px solid var(--border-color); background: var(--surface-color);
  box-shadow: 0 12px 28px -10px rgb(2 12 27 / 0.25);
}
.qe-option {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%;
  padding: 9px 12px; border: 0; border-top: 1px solid var(--border-color-light); background: var(--surface-color);
  text-align: left;
}
.qe-option:first-child { border-top: 0; }
.qe-option.is-on, .qe-option:hover { background: var(--table-stripe-bg); }
.qe-option-text { min-width: 0; }
.qe-option-name { display: block; font-size: 13.5px; font-weight: 600; color: var(--heading-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qe-option-meta { display: block; font-size: 11.5px; color: var(--muted-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qe-option-amount { font-size: 12px; color: var(--muted-color); white-space: nowrap; }
.qe-list-foot {
  display: flex; justify-content: space-between; gap: 8px; padding: 7px 12px;
  background: var(--table-stripe-bg); font-size: 11px; color: var(--light-color);
}

.qe-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.qe-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 6px; border-radius: 9999px;
  border: 1px solid var(--border-color); background: var(--surface-color); color: var(--heading-color);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.qe-chip:hover { background: var(--table-stripe-bg); }
.qe-chip.is-on { border-color: var(--qe-accent); background: var(--qe-tint); }
.qe-chip-avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0;
  border-radius: 9999px; background: var(--background-color); color: var(--light-color); font-size: 10px;
}
.qe-chip-amount { font-size: 11px; font-weight: 500; color: var(--muted-color); }

.qe-details { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 0; }
.qe-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qe-picker-wrap { position: relative; min-width: 0; }
.qe-picker {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 42px;
  padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--surface-color);
  text-align: left;
}
.qe-picker:hover { background: var(--table-stripe-bg); }
.qe-picker-label { flex-shrink: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--light-color); }
.qe-picker-value { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--heading-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qe-picker-value.is-empty { color: var(--light-color); }
.qe-picker i { font-size: 11px; color: var(--light-color); }
.qe-menu {
  position: absolute; left: 0; right: 0; top: 46px; z-index: 6; overflow: hidden; border-radius: 10px;
  border: 1px solid var(--border-color); background: var(--surface-color);
  box-shadow: 0 12px 28px -10px rgb(2 12 27 / 0.25);
}
.qe-menu-search {
  width: 100%; height: 36px; padding: 0 12px; border: 0; border-bottom: 1px solid var(--border-color-light);
  background: var(--surface-color); font-size: 13px; color: var(--heading-color); outline: 0;
}
.qe-menu-list { max-height: 220px; overflow-y: auto; }
.qe-menu-option {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; border: 0;
  background: var(--surface-color); font-size: 13px; color: var(--heading-color); text-align: left;
}
.qe-menu-option:hover, .qe-menu-option[aria-selected="true"] { background: var(--table-stripe-bg); }

.qe-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.qe-date-pick { position: relative; }
.qe-date-input { position: absolute; inset: 0; opacity: 0; width: 100%; border: 0; }
.qe-paid {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; margin: 0; padding: 0 12px 0 6px;
  border-radius: 9999px; border: 1px solid rgb(14 165 164 / 0.4); background: rgb(14 165 164 / 0.06);
  color: var(--accent-soft-dark); font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.qe-paid.is-off { border-color: var(--border-color); background: var(--surface-color); color: var(--muted-color); }
.qe-paid input { position: absolute; opacity: 0; pointer-events: none; }
.qe-paid .switch-track { width: 30px; height: 18px; background: var(--switch-off); }
.qe-paid .switch-track::after { width: 14px; height: 14px; }
.qe-paid input:checked + .switch-track { background: var(--accent-color); }
.qe-paid input:checked + .switch-track::after { left: 14px; }
.qe-paid input:disabled + .switch-track { opacity: 0.5; }

.qe-repeat {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px;
  border: 1px dashed var(--border-color); background: var(--table-stripe-bg);
  font-size: 12.5px; color: var(--muted-color);
}
.qe-repeat > i { color: var(--accent-color); }
.qe-repeat > span { flex: 1; min-width: 0; }
.qe-repeat.is-on { border-style: solid; border-color: rgb(14 165 164 / 0.4); }
.qe-repeat-action { border: 0; background: transparent; color: var(--accent-soft-dark); font-size: 12.5px; font-weight: 700; }

.qe-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 16px;
  border-top: 1px solid var(--border-color-light); background: var(--table-stripe-bg);
}
.qe-summary { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; font-size: 12px; color: var(--muted-color); }
.qe-summary > i { flex-shrink: 0; color: var(--warning-strong); }
.qe-summary > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qe-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.qe-more-row { display: flex; justify-content: flex-end; }
.qe-more { font-size: 12px; font-weight: 600; color: var(--muted-color); white-space: nowrap; }
.qe-more:hover { color: var(--heading-color); }
.qe-actions .btn-line { height: 40px; }
.qe-save { height: 40px; background: var(--qe-accent); }
.qe-save:disabled { opacity: 0.5; }
.qe-kbd {
  padding: 2px 5px; border-radius: 4px; background: rgb(255 255 255 / 0.18);
  font-family: var(--mono-font); font-size: 10.5px; opacity: 0.75;
}

@media (max-width: 575.98px) {
  .qe-modal .modal-dialog { margin: 0; max-width: 100%; min-height: 100%; align-items: flex-end; }
  .qe { border-radius: 16px 16px 0 0; }
  .qe-amount input { width: 220px; font-size: 40px; }
  .qe-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .qe-chips::-webkit-scrollbar { display: none; }
  .qe-chip { flex-shrink: 0; }
  .qe-pickers { grid-template-columns: 1fr; }
  .qe-foot { flex-direction: column; align-items: stretch; }
  .qe-actions { justify-content: space-between; }
  .qe-actions .btn-line, .qe-save { flex: 1; justify-content: center; }
}

/* --- Metas de gastos (templates/finance/goals/, ADR-0004) ----------------------------------------------------
   Scoped to the goals block and pages: the rest of the dashboard keeps its own styles. Bars are the shared
   components/progress_bar.html (.meter). */
.goals-block { margin-bottom: 24px; }
/* Collapsed: only the title row stays, without its rule; the week arrows have nothing to move. */
.goals-collapse { justify-content: center; min-width: 34px; }
.goals-collapse i { font-size: 13px; transition: transform var(--transition-base); }
.goals-block.is-collapsed .goals-collapse i { transform: rotate(180deg); }
.goals-block.is-collapsed > .dash-card-head { border-bottom: 0; }
.goals-block.is-collapsed .goals-weeks { display: none; }
@media (prefers-reduced-motion: reduce) { .goals-collapse i { transition: none; } }
.goals-period { font-size: 13px; color: var(--muted-color); }
.goals-weeks { display: inline-flex; gap: 6px; align-items: center; }
.goals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 4px 20px 16px; }
.page .goals-grid { padding: 18px 22px 16px; }
.page .goals-block > .card-head { flex-wrap: wrap; }
.page .goals-block > .page-note { align-items: flex-start; padding: 0 22px 18px; line-height: 1.45; }
.page .goals-block > .page-note > i { margin-top: 2px; }
.goals-note { font-size: 13px; color: var(--muted-color); margin: 0 20px 8px; }
.goals-foot { font-size: 13px; color: var(--muted-color); margin: 0 20px 16px; }
.goals-foot a { font-weight: 600; }
.goals-note-inline { color: var(--muted-color); }

.goal-card {
  display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-width: 0;
  border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--surface-color);
}
.goal-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.goal-card-name { min-width: 0; }
.goal-card-name h3 { font-size: 15px; font-weight: 600; color: var(--heading-color); margin: 0; overflow-wrap: anywhere; }
.goal-card-name small { display: block; font-size: 12.5px; color: var(--muted-color); overflow-wrap: anywhere; }
.goal-card-foot { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; font-weight: 600; margin-top: auto; }
.goal-card-foot a { min-height: 32px; display: inline-flex; align-items: center; }

.goal-bar { display: flex; flex-direction: column; gap: 6px; }
.goal-bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.goal-bar-period { color: var(--muted-color); }
.goal-bar-figures { color: var(--default-color); white-space: nowrap; }
.goal-bar-figures b { color: var(--heading-color); }
.goal-bar-foot { font-size: 13px; color: var(--default-color); margin: 0; }
.goal-state { font-weight: 600; }
/* The warning yellow is too light as text on white; dark text on the light theme, the yellow on the dark one. */
.goal-state.is-near, .goal-state.is-full { color: #b45309; }
[data-theme=dark] .goal-state.is-near, [data-theme=dark] .goal-state.is-full { color: var(--warning-color); }
.goal-state.is-over { color: var(--danger-color); display: inline-flex; align-items: center; gap: 4px; }
.goal-state.is-muted { color: var(--muted-color); font-weight: 500; }
.goal-both { font-size: 13px; margin: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--table-stripe-bg); display: flex; gap: 6px; align-items: baseline; }
.goal-both b { color: var(--heading-color); }
.goal-note { font-size: 12.5px; color: var(--muted-color); margin: 0; }
.goal-note.is-warning { color: var(--default-color); }

.goals-summary { padding: 18px 20px; }
.goals-totals { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 16px 0 0; }
.goals-totals div { display: flex; flex-direction: column; }
.goals-totals dt { font-size: 12.5px; font-weight: 500; color: var(--muted-color); }
.goals-totals dd { margin: 0; font-size: 15px; color: var(--heading-color); }
.goals-table { width: 100%; }
.goals-table td, .goals-table th { vertical-align: top; }
.goals-tag { display: inline-block; font-size: 11.5px; color: var(--muted-color); }
.goals-suggestions { list-style: none; margin: 0; padding: 0; }
.goals-suggestions li {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 22px;
  border-top: 1px solid var(--border-color-light);
}
.goals-suggestions li:first-child { border-top: 0; }
.goals-suggestions .btn-line { flex-shrink: 0; }
.goals-suggestion { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.goals-suggestion > b { font-family: var(--heading-font); font-size: 15px; font-weight: 600; color: var(--heading-color); }
.goals-suggestion p { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; }
.goals-suggestion-limits { font-size: 13px; color: var(--muted-color); }
.page .goals-suggestion-limits .money { font-family: var(--default-font); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--heading-color); }
.goals-suggestion-cats { gap: 6px; }
.goals-suggestion-cats .goals-tag {
  padding: 2px 9px; border-radius: 9999px; background: var(--table-stripe-bg); font-size: 12px; font-weight: 500;
  color: var(--default-color);
}
.goals-suggestion-cats .goals-tag.is-empty { background: none; border: 1px dashed var(--border-color); color: var(--muted-color); }
.goals-unassigned { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px 22px 20px; }
.goals-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; }
/* The big figure in the headings' face, like the other headline values; .money alone is the small tabular one. */
.page .goals-figure .money { font-family: var(--heading-font); font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--heading-color); }
.goals-figure small { font-size: 13px; font-weight: 500; color: var(--muted-color); }
.goals-unassigned .goals-unassigned-note {
  align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-md); background: var(--table-stripe-bg);
  line-height: 1.45;
}
.goals-unassigned-note > i { margin-top: 2px; }

/* Option groups in forms (components/form_fields.html): chips to pick many, cards to pick one. The native input
   stays in the label, invisible but focusable, so keyboard and screen readers work as with plain inputs. */
.choice-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-field > legend { float: none; width: auto; margin-bottom: 8px; padding: 0; font-size: inherit; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chip, .choice-card { position: relative; max-width: 100%; margin: 0; cursor: pointer; }
.choice-chip > span { max-width: 100%; overflow-wrap: anywhere; }
.choice-chip > input, .choice-card > input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chip > span {
  display: inline-block; min-height: 38px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--border-color);
  background: var(--surface-color); color: var(--heading-color); font-size: 14px; font-weight: 500; line-height: 1.25;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.choice-chip > span:has(small) { border-radius: 14px; border-style: dashed; padding-top: 6px; padding-bottom: 6px; }
.choice-chip small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted-color); }
.choice-chip > input:checked + span {
  border: 1px solid var(--accent-color); background: color-mix(in srgb, var(--accent-color) 10%, var(--surface-color));
  color: var(--accent-soft-dark);
}
.choice-chip > input:checked + span::before { content: "\F633"; margin-right: 6px; font-family: "bootstrap-icons"; font-size: 13px; vertical-align: -1px; }
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.choice-card > span {
  display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px 10px; height: 100%; padding: 12px 14px;
  border: 1px solid var(--border-color); border-radius: var(--radius-lg); background: var(--surface-color);
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.choice-card > span::before {
  content: ""; grid-row: span 2; width: 18px; height: 18px; margin-top: 1px; border-radius: 9999px;
  border: 1.5px solid var(--light-color); background: var(--surface-color); transition: border var(--transition-fast);
}
.choice-card b { font-size: 14px; font-weight: 600; color: var(--heading-color); }
.choice-card small { font-size: 12.5px; line-height: 1.4; color: var(--muted-color); }
.choice-card > input:checked + span { border-color: var(--accent-color); background: color-mix(in srgb, var(--accent-color) 6%, var(--surface-color)); }
.choice-card > input:checked + span::before { border: 5px solid var(--accent-color); }
.choice-chip > input:focus-visible + span, .choice-card > input:focus-visible + span { outline: 2px solid var(--accent-color); outline-offset: 2px; }
@media (hover: hover) {
  .choice-chip:hover > input:not(:checked) + span, .choice-card:hover > input:not(:checked) + span { border-color: var(--accent-color); }
}
@media (prefers-reduced-motion: reduce) {
  .choice-chip > span, .choice-card > span, .choice-card > span::before { transition: none; }
}
@media (max-width: 575.98px) {
  .goals-suggestions li { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; }
  .goals-suggestions .btn-line { align-self: flex-start; }
  .goals-unassigned { padding: 16px; }
  .page .goals-grid { padding: 14px 12px 12px; }
  .page .goals-block > .card-head { padding: 14px 16px; }
  .page .goals-block > .card-head h2 { flex: 1 1 100%; }
  /* The two neighbour weeks share the row under the title instead of squeezing it. */
  .page .goals-weeks { display: flex; width: 100%; }
  .page .goals-weeks .btn-line { flex: 1 1 0; min-width: 0; height: auto; min-height: 36px; justify-content: center; text-align: center; white-space: normal; line-height: 1.2; }
  .page .goals-block > .page-note { padding: 0 16px 16px; }
}
@media (max-width: 575.98px) {
  .goals-grid { grid-template-columns: minmax(0, 1fr); padding: 4px 12px 12px; }
  .goals-block .dash-card-actions { flex-wrap: wrap; }
  .goals-table thead { display: none; }
  /* Each line becomes a small card: what and how much, then when/where, then the actions. */
  .goals-table tbody tr {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 16px;
    grid-template-areas: "desc desc desc amount" "date cat paid paid" "actions actions actions actions";
    border-bottom: 1px solid var(--border-color-light);
  }
  .goals-table tbody td { border: 0; padding: 0; min-width: 0; text-align: left; }
  .goals-table .goals-c-desc { grid-area: desc; font-weight: 600; color: var(--heading-color); overflow-wrap: anywhere; }
  .goals-table .goals-c-amount { grid-area: amount; text-align: right; white-space: nowrap; }
  .goals-table .goals-c-date, .goals-table .goals-c-cat, .goals-table .goals-c-paid { font-size: 12.5px; color: var(--muted-color); overflow-wrap: anywhere; }
  .goals-table .goals-c-date { grid-area: date; }
  .goals-table .goals-c-cat { grid-area: cat; }
  .goals-table .goals-c-paid { grid-area: paid; }
  .goals-table .goals-c-actions { grid-area: actions; font-size: 13px; }
  .goals-table tfoot tr { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 16px; }
  .goals-table tfoot th, .goals-table tfoot td { border: 0; padding: 0; white-space: normal; }
  .goals-table tfoot th { min-width: 0; }
  .goals-table tfoot td { flex: none; white-space: nowrap; }
  .goals-table tfoot td:empty { display: none; }
}
