/* Fluxo — dashboard */

.app {
  min-height: 100dvh;
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100dvh;
}

/* ------------------------------------------------------------------ sidebar */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100dvh;
  padding: 26px 18px 18px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar .brand {
  padding: 0 8px;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.side-nav button svg {
  width: 20px;
  height: 20px;
}

.side-nav button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.side-nav button[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
}

.side-nav button[aria-current='page'] svg {
  color: var(--accent);
}

:root[data-theme='light'] .side-nav button[aria-current='page'] svg {
  color: var(--text);
}

.nav-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.side-tip {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: radial-gradient(120% 120% at 0% 0%, var(--accent-soft), transparent 70%), var(--surface-2);
}

.side-tip-title {
  color: var(--text-2);
  font-size: 12.5px;
}

.side-tip-value {
  margin: 4px 0 2px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.side-tip-sub {
  color: var(--muted);
  font-size: 12px;
}

.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
}

.side-user-info {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.side-user-info strong,
.side-user-info span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-user-info strong {
  font-size: 14px;
}

.side-user-info span {
  color: var(--muted);
  font-size: 12px;
}

/* --------------------------------------------------------------------- main */

.main {
  padding: 26px 32px 60px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.topbar-date {
  color: var(--muted);
  font-size: 13.5px;
}

.topbar h1 {
  font-size: 30px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view[hidden] {
  display: none;
}

.view {
  animation: view-in 0.4s var(--ease);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* --------------------------------------------------------------------- grid */

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }

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

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-head h3 {
  font-size: 17px;
}

.card-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--text);
}

.seg-sm {
  padding: 3px;
  border-radius: 11px;
}

.seg-sm button {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 13px;
}

/* welcome */
.welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 26px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: radial-gradient(80% 140% at 0% 0%, var(--accent-soft), transparent 60%), var(--surface);
}

.welcome[hidden] {
  display: none;
}

.welcome h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.welcome p {
  max-width: 560px;
  color: var(--text-2);
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* cartão de saldo */
.balance-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  background: radial-gradient(130% 130% at 0% 0%, #e6ff8a 0%, #c6f432 45%, #9fd11c 100%);
  color: var(--accent-ink);
}

.balance-card::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 30px solid rgba(255, 255, 255, 0.16);
  pointer-events: none;
}

.bc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
}

.bc-top > span:first-child {
  opacity: 0.75;
}

.bc-chip {
  position: relative;
  z-index: 1;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(13, 18, 3, 0.1);
  font-size: 12px;
}

.bc-value {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: clamp(34px, 3.6vw, 46px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.bc-delta {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
}

.bc-spark {
  width: 100%;
  height: 70px;
  margin: 14px 0;
  overflow: visible;
}

.bc-spark .spark-line {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 2.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.bc-spark .spark-area {
  fill: rgba(13, 18, 3, 0.1);
}

.bc-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(13, 18, 3, 0.15);
}

.bc-foot span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.68;
}

.bc-foot strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 12px;
  border-radius: 11px;
  background: var(--surface-3);
}

.kpi-ico svg {
  width: 18px;
  height: 18px;
}

.kpi-in { color: var(--income); }
.kpi-out { color: var(--series-2); }
.kpi-rec { color: var(--series-1); }
.kpi-save { color: var(--accent); }

:root[data-theme='light'] .kpi-save {
  background: var(--accent);
  color: var(--accent-ink);
}

.kpi-label {
  color: var(--text-2);
  font-size: 13px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.kpi-sub {
  background: none;
  color: var(--muted);
  font-size: 12.5px;
}

.delta-up {
  color: var(--income);
  font-weight: 600;
}

.delta-down {
  color: var(--danger);
  font-weight: 600;
}

/* gráficos */
.chart-box {
  position: relative;
  width: 100%;
}

.chart-lg {
  height: 280px;
}

.chart-md {
  height: 260px;
}

.chart-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

.donut-wrap {
  display: grid;
  gap: 18px;
}

.chart-donut {
  width: 190px;
  height: 190px;
  margin: 0 auto;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center strong {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.03em;
}

.donut-center span {
  color: var(--muted);
  font-size: 12px;
}

.legend-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.legend-list .lg-name {
  flex: 1;
  color: var(--text-2);
}

.legend-list .lg-pct {
  width: 42px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: right;
}

.legend-list strong {
  font-variant-numeric: tabular-nums;
}

.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 3px;
}

.sw-1 { background: var(--series-1); }
.sw-2 { background: var(--series-2); }
.sw-3 { background: var(--series-3); }

.legend-inline {
  display: flex;
  gap: 14px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-2);
  font-size: 13px;
}

.legend-inline li {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* barras por categoria */
.cat-bars {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cat-bars li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 4px 12px;
}

.cat-ico {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-3);
  font-size: 16px;
}

.cat-name {
  font-size: 14px;
  font-weight: 500;
}

.cat-value {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.cat-track {
  grid-column: 2 / 4;
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.cat-track span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--series-2);
  transform-origin: left;
  animation: grow 0.9s var(--ease);
}

@keyframes grow {
  from {
    transform: scaleX(0);
  }
}

.cat-pct {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  margin-left: 6px;
}

/* lista de movimentações */
.tx-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tx {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  margin: 0 -10px;
  border-radius: 14px;
  transition: background 0.15s;
}

.tx:hover {
  background: var(--surface-2);
}

.tx-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--surface-3);
  font-size: 18px;
}

.tx-ico .tx-rec {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--series-1);
  color: #fff;
}

.tx-ico .tx-rec svg {
  width: 10px;
  height: 10px;
}

.tx-main {
  flex: 1;
  min-width: 0;
}

.tx-title {
  overflow: hidden;
  font-weight: 600;
  font-size: 14.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 12.5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
}

.badge-future {
  background: rgba(250, 178, 25, 0.14);
  color: var(--warning);
}

:root[data-theme='light'] .badge-future {
  color: #8a5a00;
}

.tx-amount {
  font-weight: 700;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pos {
  color: var(--income);
}

.tx.is-future {
  opacity: 0.72;
}

.tx-actions {
  display: flex;
  justify-content: flex-end;
  width: 68px;
  flex: none;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.tx:hover .tx-actions,
.tx:focus-within .tx-actions {
  opacity: 1;
}

.tx-actions .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.tx-actions .icon-btn svg {
  width: 16px;
  height: 16px;
}

@media (hover: none) {
  .tx-actions {
    opacity: 1;
  }
}

.tx-list.compact .tx {
  padding: 8px 10px;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 12px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}

.empty-ico {
  font-size: 28px;
}

/* ---------------------------------------------------- movimentações (view) */

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

.view-head h2 {
  font-size: 24px;
}

.view-sub {
  max-width: 620px;
  margin-top: 6px;
  color: var(--text-2);
  font-size: 14px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-nav h2 {
  min-width: 210px;
  text-align: center;
}

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

.search {
  position: relative;
}

.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.search .input {
  width: 220px;
  height: 38px;
  padding-left: 36px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
}

.summary-strip > div {
  padding: 16px 18px;
  background: var(--surface);
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
}

.summary-strip strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.list-card {
  padding: 8px 22px 16px;
}

.day-group + .day-group {
  border-top: 1px solid var(--border);
}

.day-head {
  display: flex;
  justify-content: space-between;
  padding: 14px 0 6px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.day-head .num {
  text-transform: none;
}

/* ----------------------------------------------------- assinaturas (view) */

.sub-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.sub-summary .card {
  display: grid;
  gap: 2px;
}

.sub-summary span {
  color: var(--text-2);
  font-size: 13px;
}

.sub-summary strong {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.sub-summary small {
  color: var(--muted);
  font-size: 12px;
}

.sub-toolbar {
  margin-bottom: 16px;
}

.sub-toolbar .segmented {
  display: inline-grid;
}

.sub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.sub-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.25s var(--ease), border-color 0.2s;
}

.sub-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}

.sub-card.is-cancelled {
  opacity: 0.6;
}

.sc-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sc-logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 14px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.sc-name {
  flex: 1;
  min-width: 0;
}

.sc-name strong {
  display: block;
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sc-name span {
  color: var(--muted);
  font-size: 12.5px;
}

.sc-amount {
  text-align: right;
}

.sc-amount strong {
  display: block;
  font-family: var(--font-display);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.sc-amount span {
  color: var(--muted);
  font-size: 12px;
}

.sc-progress {
  display: grid;
  gap: 6px;
}

.sc-progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-2);
}

.sc-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.sc-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--series-1);
}

.sc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.sc-stats span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

.sc-stats strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.sc-actions {
  display: flex;
  gap: 6px;
}

.sc-actions .btn {
  flex: 1;
}

.sub-empty {
  grid-column: 1 / -1;
  padding: 40px 16px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

/* ------------------------------------------------------------- ajustes */

.settings {
  display: grid;
  gap: 16px;
  max-width: 860px;
}

.setting {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

.setting h3 {
  font-size: 17px;
}

.setting-form {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.setting-form .field {
  width: 100%;
}

.setting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.setting.danger {
  border-color: var(--danger-soft);
}

/* ---------------------------------------------------------------- modais */

.modal-sm {
  width: min(400px, calc(100vw - 32px));
}

.confirm-msg {
  color: var(--text-2);
}

.modal-actions .spacer {
  flex: 1;
}

.type-toggle button[data-type='income'][aria-pressed='true'] {
  color: var(--income);
}

.type-toggle button[data-type='expense'][aria-pressed='true'] {
  color: var(--series-2);
}

.amount-field .input {
  height: 60px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
}

.amount-field .input-money::before {
  font-size: 18px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.hint:empty {
  display: none;
}

.sub-preview {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  line-height: 1.55;
}

.sub-preview strong {
  color: var(--text);
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.preset:hover {
  background: var(--surface-2);
  color: var(--text);
}

.quick-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.quick {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 18px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-weight: 600;
  cursor: pointer;
}

.quick span {
  font-size: 24px;
}

/* ------------------------------------------------------- ocultar valores */

.hide-values .money,
.hide-values .tx-amount,
.hide-values .cat-value,
.hide-values .legend-list strong,
.hide-values .sc-amount strong,
.hide-values .sc-stats strong,
.hide-values .chart-box canvas,
.hide-values .donut-center strong {
  filter: blur(9px);
  user-select: none;
}

/* ------------------------------------------------------------ bottom nav */

.bottom-nav {
  display: none;
}

/* ------------------------------------------------------------ responsivo */

@media (max-width: 1240px) {
  .span-4,
  .span-8 {
    grid-column: span 6;
  }

  .span-8 {
    grid-column: span 12;
  }

  .span-4 {
    grid-column: span 12;
  }

  .donut-wrap {
    grid-template-columns: 190px 1fr;
    align-items: center;
  }

  .sub-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1080px) {
  .span-5,
  .span-7 {
    grid-column: span 12;
  }

  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .setting {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 18px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .hide-sm {
    display: none;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(16px);
  }

  .bottom-nav button {
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 6px 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
  }

  .bottom-nav button svg {
    width: 22px;
    height: 22px;
  }

  .bottom-nav button[aria-current='page'] {
    color: var(--text);
  }

  .bottom-nav .fab {
    width: 54px;
    height: 54px;
    margin: -22px auto 0;
    place-items: center;
    border-radius: 18px;
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 10px 24px -8px rgba(198, 244, 50, 0.6);
  }

  .welcome {
    flex-direction: column;
    align-items: flex-start;
  }

  .welcome-actions {
    justify-content: flex-start;
  }

  .toasts {
    bottom: calc(92px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 640px) {
  .kpis {
    gap: 10px;
  }

  .kpi {
    padding: 16px;
  }

  .kpi-value {
    font-size: 20px;
  }

  .kpi-ico {
    margin-bottom: 8px;
  }

  .card {
    padding: 18px;
  }

  .grid {
    gap: 12px;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
  }

  .chart-lg {
    height: 230px;
  }

  .card-head {
    flex-wrap: wrap;
  }

  .month-nav {
    width: 100%;
    justify-content: space-between;
  }

  .month-nav h2 {
    min-width: 0;
    font-size: 20px;
  }

  .filters,
  .search,
  .search .input {
    width: 100%;
  }

  .summary-strip strong {
    font-size: 17px;
  }

  .sub-summary {
    gap: 10px;
  }

  .sub-summary strong {
    font-size: 20px;
  }

  .list-card {
    padding: 4px 14px 12px;
  }

  .tx-actions .icon-btn {
    width: 30px;
    height: 30px;
  }
}

.split-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.split-option input {
  margin-top: 3px;
  accent-color: var(--accent);
}

/* ------------------------------------------------------- várias carteiras */

.wallet-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  height: 34px;
  padding: 0 10px 0 6px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.wallet-btn:hover,
.wallet-btn[aria-expanded='true'] {
  background: var(--surface-2);
  border-color: var(--muted);
}

.wallet-btn-ico {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 13px;
}

.wallet-btn-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
  transition: transform 0.2s;
}

.wallet-btn[aria-expanded='true'] svg {
  transform: rotate(180deg);
}

.wallet-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(340px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.55);
  animation: menu-in 0.2s var(--ease);
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.wm-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.wm-head span {
  color: var(--muted);
  font-size: 12.5px;
}

.wm-head strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.wm-list {
  display: grid;
  max-height: 320px;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  list-style: none;
}

.wm-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.wm-item:hover,
.wm-item:focus-visible {
  background: var(--surface-2);
}

.wm-item.is-active {
  background: var(--accent-soft);
}

.wm-ico {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-3);
}

.wm-name {
  overflow: hidden;
  font-weight: 600;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wm-bal {
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.wm-check {
  color: var(--text);
  font-weight: 700;
}

.wm-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--border);
}

.wm-foot button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.wm-foot button:hover {
  background: var(--surface-2);
  color: var(--text);
}

.wm-foot svg {
  width: 16px;
  height: 16px;
}

/* lista em Ajustes */
.wallet-admin {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.wallet-rows {
  display: grid;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wallet-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.wallet-row.is-active {
  border-color: var(--accent);
}

.wr-ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 11px;
  background: var(--surface-3);
  font-size: 18px;
}

.wr-main {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.wr-main strong {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  font-size: 14.5px;
  white-space: nowrap;
}

.wr-main > span {
  color: var(--muted);
  font-size: 12.5px;
}

.wr-bal {
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wr-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wr-actions .icon-btn {
  width: 34px;
  height: 34px;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* seletor de ícone */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.icon-opt {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 20px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease);
}

.icon-opt:hover {
  transform: translateY(-1px);
}

.icon-opt[aria-checked='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.hide-values .wm-bal,
.hide-values .wr-bal,
.hide-values .wm-head strong {
  filter: blur(8px);
  user-select: none;
}

@media (max-width: 640px) {
  .wallet-switch .topbar-date {
    display: none;
  }

  .wallet-row {
    flex-wrap: wrap;
  }

  .wr-bal {
    margin-left: auto;
  }

  .wr-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ------------------------------------------------- fechamento do mês com IA */

.span-12 { grid-column: span 12; }

.ai-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(57, 135, 229, 0.12), transparent 60%),
    radial-gradient(50% 120% at 0% 100%, var(--accent-soft), transparent 60%),
    var(--surface);
}

.ai-card.is-month-end {
  border-color: var(--accent);
}

.ai-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-spark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: 700;
}

.ai-badge {
  background: var(--accent);
  color: var(--accent-ink);
}

.ai-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.ai-intro p {
  max-width: 640px;
  color: var(--text-2);
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ai-privacy {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.ai-privacy summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-2);
}

.ai-privacy ul {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.6;
}

.ai-loading {
  display: grid;
  gap: 10px;
}

.ai-loading p {
  color: var(--text-2);
  font-size: 14px;
}

.ai-skel {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: ai-shimmer 1.3s linear infinite;
}

@keyframes ai-shimmer {
  to {
    background-position: -200% 0;
  }
}

.ai-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
}

.ai-summary {
  margin-bottom: 14px;
  font-size: 15.5px;
  line-height: 1.55;
}

.ai-recs {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ai-rec {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.ai-rec-ico {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-3);
}

.ai-rec-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14.5px;
}

.ai-rec-detail {
  grid-column: 2 / 4;
  color: var(--text-2);
  font-size: 13.5px;
}

.ai-rec-save {
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--income);
}

.prio {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prio-alta { background: var(--danger-soft); color: var(--danger); }
.prio-media { background: rgba(250, 178, 25, 0.14); color: var(--warning); }
.prio-baixa { background: var(--surface-3); color: var(--text-2); }

:root[data-theme='light'] .prio-media { color: #8a5a00; }

.ai-side {
  display: grid;
  align-content: start;
  gap: 12px;
}

.ai-total {
  padding: 18px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
}

.ai-total span {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0.75;
}

.ai-total strong {
  display: block;
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: -0.03em;
}

.ai-total small {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
}

.ai-good {
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13.5px;
}

.ai-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
}

.ai-error {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

.hide-values .ai-rec-save,
.hide-values .ai-total strong,
.hide-values .ai-total small {
  filter: blur(8px);
  user-select: none;
}

@media (max-width: 900px) {
  .ai-result {
    grid-template-columns: 1fr;
  }

  .ai-side {
    order: -1;
  }
}

@media (max-width: 640px) {
  .ai-rec {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .ai-rec-save {
    grid-column: 2;
  }

  .ai-rec-detail {
    grid-column: 1 / 3;
  }
}
