/* ==========================================================================
   Componentes
   ========================================================================== */

/* ---- Cards ---- */
.card {
  background: var(--surface-lowest);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem;
  min-width: 0;
}

.card--md {
  border-radius: var(--r-lg);
  padding: 0.875rem;
}

.card--sm {
  border-radius: var(--r-md);
  padding: var(--space-md);
}

.card--list {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card--flat {
  box-shadow: none;
  background: var(--surface-low);
}

.card--clickable {
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
  text-align: left;
  width: 100%;
}

.card--clickable:hover {
  background: var(--surface-low);
}

.card--clickable:active {
  transform: scale(0.99);
}

/* ---- Botões ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: 48px;
  padding: 0 1.25rem;
  border-radius: var(--r-md);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: background-color 0.15s, transform 0.15s var(--ease), box-shadow 0.15s, opacity 0.15s;
  user-select: none;
  text-align: center;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
}

.btn .ms {
  font-size: 20px;
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.btn--primary:hover:not(:disabled) {
  background: var(--inverse-surface);
}

.btn--accent {
  min-height: 56px;
  font-size: 18px;
  line-height: 24px;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, var(--secondary), var(--secondary-container));
  color: #fff;
  box-shadow: 0 10px 15px -3px rgba(0, 81, 213, 0.2), 0 4px 6px -4px rgba(0, 81, 213, 0.2);
}

.btn--accent .ms {
  font-size: 24px;
}

.btn--accent.is-success {
  background: linear-gradient(90deg, #047857, var(--positive));
}

.btn--ghost {
  background: var(--surface-lowest);
  color: var(--on-surface);
  border: 1px solid var(--hairline);
}

.btn--ghost:hover:not(:disabled) {
  background: #f1f5f9;
}

.btn--soft {
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed);
}

.btn--soft:hover:not(:disabled) {
  background: #cdd6ff;
}

.btn--danger {
  background: var(--negative);
  color: #fff;
}

.btn--danger:hover:not(:disabled) {
  background: var(--negative-strong);
}

.btn--danger-text {
  color: var(--negative);
  background: transparent;
}

.btn--danger-text:hover:not(:disabled) {
  background: var(--negative-bg);
}

.btn--sm {
  min-height: 36px;
  padding: 0 0.75rem;
  border-radius: var(--r-sm);
  font-size: 11px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  padding: 0 4px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--r-sm);
  white-space: nowrap;
}

.link-btn:hover {
  text-decoration: underline;
}

.link-btn .ms {
  font-size: 16px;
}

/* ---- Badges / chips de status ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  background: var(--surface-container);
  color: var(--on-surface-variant);
}

.badge .ms {
  font-size: 14px;
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  background: currentColor;
  flex-shrink: 0;
}

.badge--pulse .badge__dot {
  width: 8px;
  height: 8px;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.badge--positive {
  background: rgba(111, 251, 190, 0.3);
  color: var(--on-tertiary-fixed-variant);
}

.badge--positive .badge__dot {
  background: var(--on-tertiary-container);
}

.badge--warning {
  background: var(--warning-bg);
  color: var(--warning-strong);
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.18);
}

.badge--negative {
  background: var(--negative-bg);
  color: var(--negative);
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.15);
}

.badge--info {
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed);
}

.badge--count {
  padding: 2px 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--surface-high);
  color: var(--on-surface-variant);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}

/* ---- Cabeçalho de seção ---- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 0 4px;
  min-width: 0;
}

.section-head__title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.section-head__title h2 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Linha de transação ---- */
.tx {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 60px;
  padding: 10px;
  border-radius: var(--r-lg);
  width: 100%;
  text-align: left;
  transition: background-color 0.15s;
}

button.tx:hover,
a.tx:hover {
  background: var(--surface-low);
}

.tx__left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.tx__avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--r-lg);
  background: var(--surface-high);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.tx__avatar--income {
  background: var(--positive-bg);
  color: var(--positive);
}

.tx__avatar--fixed {
  background: var(--secondary-fixed);
  color: var(--secondary);
}

.tx__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Nomes longos quebram em até 2 linhas em vez de serem cortados */
.tx__title,
.clamp-2 {
  font-weight: 600;
  color: var(--on-surface);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.tx__meta {
  color: var(--on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx__amount {
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  line-height: 22px;
  letter-spacing: -0.01em;
}

@media (min-width: 400px) {
  .tx__amount {
    font-size: 18px;
    line-height: 24px;
  }
}

.tx__amount--income {
  color: var(--positive);
}

/* ---- Caixa de data (compromissos) ---- */
.date-box {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--surface-container);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.date-box__month {
  color: var(--secondary);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1;
}

.date-box__day {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

.date-box--today {
  background: var(--warning-bg);
}

.date-box--today .date-box__month {
  color: var(--warning-strong);
}

/* ---- Formulários ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  padding: 0 4px;
  color: var(--on-surface-variant);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.field__error {
  color: var(--negative);
  font-size: 12px;
  line-height: 16px;
  padding: 0 4px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap > .ms {
  position: absolute;
  left: 14px;
  color: var(--outline);
  pointer-events: none;
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0 1rem;
  background: var(--surface-lowest);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  font-size: 16px; /* evita zoom no iOS */
  line-height: 24px;
  color: var(--on-surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--outline-variant);
}

.input:focus {
  border-color: #2563eb;
  box-shadow: var(--focus-ring);
}

.input.is-invalid {
  border-color: var(--negative);
}

.input-wrap > .ms + .input {
  padding-left: 44px;
}

.input--bordered {
  border-color: var(--hairline);
  box-shadow: none;
}

textarea.input {
  min-height: 88px;
  padding: 12px 16px;
  resize: vertical;
}

select.input {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='%2345464d'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

input[type='date'].input {
  min-width: 0;
}

/* Valor monetário grande */
.amount-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.5rem 1rem;
  background: var(--surface-lowest);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.amount-card:focus-within {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: var(--focus-ring);
}

.amount-card.is-invalid {
  border-color: var(--negative);
}

.amount-card__label {
  color: var(--surface-tint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.amount-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  text-align: center;
  font-size: 32px;
  line-height: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--on-surface);
  font-variant-numeric: tabular-nums;
  padding: 4px 0;
  caret-color: var(--secondary);
}

.amount-input::placeholder {
  color: var(--outline-variant);
}

@media (min-width: 400px) {
  .amount-input {
    font-size: 36px;
    line-height: 44px;
  }
}

.hint-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  background: var(--surface-low);
  color: var(--surface-tint);
  margin-top: var(--space-sm);
}

.hint-pill .ms {
  font-size: 14px;
  color: var(--on-tertiary-container);
}

/* Grade de categorias */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 72px;
  padding: 12px 4px;
  border-radius: var(--r-md);
  background: var(--surface-lowest);
  color: var(--on-surface);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s, color 0.15s, transform 0.15s;
  min-width: 0;
}

.cat-btn:active {
  transform: scale(0.95);
}

.cat-btn__emoji {
  font-size: 24px;
  line-height: 1;
}

.cat-btn__name {
  width: 100%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-btn[aria-checked='true'] {
  background: var(--secondary);
  color: #fff;
}

/* Grupo de opções (Hoje / Ontem / Outra data; forma de pagamento) */
.choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-sm);
}

.choice {
  min-height: 44px;
  padding: 0 8px;
  border-radius: var(--r-md);
  background: var(--surface-lowest);
  color: var(--on-surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background-color 0.15s, color 0.15s, transform 0.15s;
  min-width: 0;
}

.choice span:not(.ms) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice .ms {
  font-size: 16px;
}

.choice:active {
  transform: scale(0.96);
}

.choice[aria-checked='true'] {
  background: var(--primary);
  color: var(--on-primary);
}

.choice-row--soft .choice[aria-checked='true'] {
  background: var(--secondary-fixed);
  color: var(--on-secondary-fixed);
}

/* Chips de filtro (rolagem horizontal contida) */
.chip-scroller {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 2px 4px;
  margin: 0 -2px;
  -webkit-overflow-scrolling: touch;
}

.chip-scroller::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-full);
  background: var(--surface-lowest);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.filter-chip[aria-pressed='true'] {
  background: var(--primary);
  color: var(--on-primary);
}

/* Switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 36px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch__track {
  width: 40px;
  height: 24px;
  border-radius: var(--r-full);
  background: var(--outline-variant);
  position: relative;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s var(--ease);
}

.switch input:checked + .switch__track {
  background: var(--secondary);
}

.switch input:checked + .switch__track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch__track {
  box-shadow: var(--focus-ring);
}

/* ---- Barras de progresso ---- */
.progress {
  width: 100%;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--surface-container);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--secondary-container), var(--secondary));
  transition: width 0.7s var(--ease);
}

.progress__fill--warning {
  background: linear-gradient(90deg, #f59e0b, var(--warning));
}

.progress__fill--negative {
  background: linear-gradient(90deg, #ef4444, var(--negative));
}

/* Barra segmentada (distribuição da receita) */
.segbar {
  width: 100%;
  height: 12px;
  border-radius: var(--r-full);
  background: var(--surface-container);
  display: flex;
  overflow: hidden;
  padding: 2px;
  gap: 2px;
}

.segbar__seg {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 0.5s var(--ease);
  min-width: 0;
}

.segbar__seg[style*='width: 0%'] {
  display: none;
}

.legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--on-surface-variant);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.legend__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

/* ---- Estados vazios ---- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-sm);
  padding: var(--space-lg) var(--space-md);
}

.empty__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--r-full);
  background: var(--surface-low);
  color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.empty__icon .ms {
  font-size: 28px;
}

.empty__text {
  color: var(--on-surface-variant);
  max-width: 320px;
}

.empty .btn {
  margin-top: var(--space-sm);
}

/* Callout (orientação / alerta) */
.callout {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--r-md);
  background: var(--surface-lowest);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.callout__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  background: var(--surface-container);
  color: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.callout__icon .ms {
  font-size: 22px;
}

.callout__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.callout--warning .callout__icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.callout--negative .callout__icon {
  background: var(--negative-bg);
  color: var(--negative);
}

.callout--positive .callout__icon {
  background: var(--positive-bg);
  color: var(--positive);
}

/* ---- Skeleton ---- */
.skel {
  background: linear-gradient(90deg, var(--surface-container) 0%, var(--surface-low) 50%, var(--surface-container) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  border-radius: var(--r-md);
}

.skel--hero {
  height: 300px;
  border-radius: var(--r-hero);
}

.skel--card {
  height: 180px;
  border-radius: var(--r-xl);
}

.skel--row {
  height: 72px;
  border-radius: var(--r-lg);
}

.skel--bar {
  height: 56px;
  border-radius: var(--r-md);
}

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

/* ---- Erro de carregamento ---- */
.load-error {
  text-align: center;
}

/* ---- Sheet / modal ---- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.sheet-overlay.is-open {
  opacity: 1;
}

/* Durante a animação de saída o overlay não bloqueia toques na página */
.sheet-overlay.is-closing {
  pointer-events: none;
}

.sheet {
  width: 100%;
  max-height: calc(100dvh - 24px);
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s var(--ease);
  outline: none;
}

.sheet-overlay.is-open .sheet {
  transform: translateY(0);
}

.sheet--full {
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: calc(12px + env(safe-area-inset-top, 0px)) var(--page-x) 8px;
  flex-shrink: 0;
}

.sheet:not(.sheet--full) .sheet__head {
  padding-top: 12px;
}

.sheet__grabber {
  width: 40px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--outline-variant);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet--full .sheet__grabber {
  display: none;
}

.sheet__title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.sheet__title-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--secondary);
  flex-shrink: 0;
  position: relative;
}

.sheet__title-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

.sheet__close {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: var(--surface-high);
  color: var(--on-surface-variant);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.sheet__close:active {
  transform: scale(0.9);
}

.sheet__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px var(--page-x) calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.sheet__footer {
  padding-top: var(--space-xs);
}

@media (min-width: 640px) {
  .sheet-overlay {
    align-items: center;
    padding: var(--space-lg);
  }
  .sheet,
  .sheet--full {
    width: 100%;
    max-width: 480px;
    height: auto;
    max-height: min(880px, calc(100dvh - 48px));
    border-radius: var(--r-xl);
    transform: translateY(24px) scale(0.98);
    opacity: 0;
    transition: transform 0.22s var(--ease), opacity 0.22s;
  }
  .sheet-overlay.is-open .sheet {
    transform: none;
    opacity: 1;
  }
  .sheet__grabber {
    display: none;
  }
  .sheet__head,
  .sheet--full .sheet__head {
    padding: 20px 24px 8px;
  }
  .sheet__body {
    padding: 4px 24px 24px;
  }
  .sheet--sm {
    max-width: 400px;
  }
}

/* Diálogo de confirmação */
.confirm {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.confirm__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-full);
  background: var(--negative-bg);
  color: var(--negative);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirm__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

/* ---- Toast ---- */
.toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  pointer-events: none;
  padding: 0 var(--page-x);
}

@media (min-width: 1024px) {
  .toasts {
    bottom: var(--space-lg);
    left: var(--sidebar-w);
  }
}

.toast {
  /* Informativo: nunca bloqueia toques em botões por baixo (ex.: rodapé de formulários) */
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: var(--primary-container);
  color: #fff;
  box-shadow: var(--shadow-2);
  font-weight: 600;
  animation: toast-in 0.25s var(--ease);
}

.toast .ms {
  font-size: 20px;
}

.toast--success .ms {
  color: var(--tertiary-fixed-dim);
}

.toast--error {
  background: var(--negative-strong);
}

.toast.is-leaving {
  animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---- Tooltip de gráficos ---- */
.chart-tooltip {
  position: fixed;
  z-index: 150;
  pointer-events: none;
  background: var(--primary-container);
  color: #fff;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  font-size: 12px;
  line-height: 16px;
  max-width: 220px;
  transform: translate(-50%, calc(-100% - 10px));
  opacity: 0;
  transition: opacity 0.12s;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart-tooltip strong {
  display: block;
  margin-bottom: 2px;
}

.spin {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
