/* ============================================================
   FINANCEIRO FAMILIAR v2.1 — Cloudflare Edition
   Responsive: Mobile + Desktop + Estoque Doméstico
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #10b77f;
  --primary-rgb: 16, 183, 127;
  --primary-dark: #0e9e6e;
  --bg: #f6f8f7;
  --white: #ffffff;
  --card-bg: #ffffff;
  --card-border: rgba(16, 183, 127, 0.05);
  --text-900: #0f172a;
  --text-700: #334155;
  --text-600: #475569;
  --text-500: #64748b;
  --text-400: #94a3b8;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --orange-100: #ffedd5;
  --orange-500: #f97316;
  --orange-700: #c2410c;
  --yellow-100: #fef9c3;
  --yellow-600: #ca8a04;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --green-100: #dcfce7;
  --green-600: #16a34a;
  --purple-100: #f3e8ff;
  --purple-500: #a855f7;
  --amber-500: #f59e0b;
  --emerald-100: #d1fae5;
  --emerald-400: #34d399;
  --emerald-700: #047857;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --r-sm: 0.25rem;
  --r: 0.5rem;
  --r-lg: 0.75rem;
  --r-xl: 1rem;
  --r-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-primary: 0 4px 14px rgba(var(--primary-rgb), 0.4);
  --transition: all 0.2s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-900);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400;
  user-select: none;
}

/* ---- Layout ---- */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--white);
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--r-full);
  background: rgba(var(--primary-rgb), 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 20px;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
}

.header-subtitle {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}

.header-sync {
  font-size: 9px;
  color: var(--text-400);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.header-month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.month-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.1);
  border: none;
  color: var(--primary);
  cursor: pointer;
  transition: background 0.2s;
  padding: 0;
}

.month-nav-btn:hover {
  background: rgba(var(--primary-rgb), 0.2);
}

.month-nav-btn .material-symbols-outlined {
  font-size: 18px;
}

/* ---- Main Content ---- */
.main-content {
  padding: 20px;
  padding-bottom: 100px;
}

.main-content>*+* {
  margin-top: 20px;
}

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--r-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
}

.card-gradient {
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.08), transparent);
  border-color: rgba(var(--primary-rgb), 0.15);
}

/* ---- Alertas de Orçamento ---- */
.alertas-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alerta-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-xl);
  font-size: 13px;
  animation: slideIn 0.3s ease;
}

.alerta-atencao {
  background: var(--yellow-100);
  color: var(--yellow-600);
  border: 1px solid rgba(202, 138, 4, 0.2);
}

.alerta-critico {
  background: var(--red-100);
  color: var(--red-700);
  border: 1px solid rgba(185, 28, 28, 0.2);
}

.alerta-card .material-symbols-outlined {
  font-size: 20px;
  flex-shrink: 0;
}

.alerta-card strong {
  font-weight: 700;
}

.alerta-card p {
  font-size: 11px;
  margin-top: 2px;
  opacity: 0.85;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---- Fluxo de Caixa ---- */
.fluxo-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fluxo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}

.fluxo-label {
  font-size: 13px;
  color: var(--text-600);
  font-weight: 500;
}

.fluxo-valor {
  font-size: 16px;
  font-weight: 700;
}

.fluxo-divider {
  height: 1px;
  background: var(--slate-200);
  margin: 4px 0;
}

.fluxo-total {
  padding-top: 8px;
}

.fluxo-total .fluxo-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-900);
}

/* ---- Section Title ---- */
.section-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-title .material-symbols-outlined {
  font-size: 16px;
  color: var(--primary);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title-row .section-title {
  margin-bottom: 0;
}

.section-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
}

/* ---- Budget ---- */
.budget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.budget-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.budget-pct {
  font-weight: 700;
  font-size: 16px;
}

.budget-bar {
  position: relative;
  width: 100%;
  height: 16px;
  background: rgba(var(--primary-rgb), 0.1);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-bottom: 16px;
}

.budget-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--primary);
  border-radius: var(--r-full);
  transition: width 0.8s ease;
}

.budget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.budget-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-500);
  font-weight: 600;
  margin-bottom: 4px;
}

.budget-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.budget-value-primary {
  color: var(--primary);
}

.text-right {
  text-align: right;
}

/* ---- Residual ---- */
.residual-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.residual-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.residual-info p:first-child {
  font-size: 12px;
  color: var(--text-600);
}

.residual-info .value {
  font-size: 16px;
  font-weight: 700;
}

.residual-info .value-primary {
  color: var(--primary);
}

.residual-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--r-lg);
  background: rgba(var(--primary-rgb), 0.05);
  border: 1px solid rgba(var(--primary-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.residual-icon .material-symbols-outlined {
  font-size: 32px;
  color: var(--primary);
}

/* ---- Table ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: rgba(var(--primary-rgb), 0.04);
}

.data-table th {
  padding: 12px 16px;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-500);
}

.data-table th:last-child {
  text-align: right;
}

.data-table td {
  padding: 12px 16px;
}

.data-table td:last-child {
  text-align: right;
  font-weight: 700;
}

.data-table tbody tr {
  border-top: 1px solid rgba(var(--primary-rgb), 0.04);
}

.member-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.member-badge-primary {
  background: rgba(var(--primary-rgb), 0.15);
  color: var(--primary);
}

.member-badge-neutral {
  background: var(--slate-200);
  color: var(--text-700);
}

/* ---- Transaction ---- */
.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transaction-item {
  background: var(--card-bg);
  padding: 12px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid rgba(var(--primary-rgb), 0.04);
  transition: var(--transition);
}

.transaction-item:active {
  transform: scale(0.98);
}

.transaction-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.transaction-icon-wrapper {
  position: relative;
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.transaction-icon.cat-alimentacao {
  background: var(--orange-100);
  color: var(--orange-500);
}

.transaction-icon.cat-contas {
  background: var(--yellow-100);
  color: var(--yellow-600);
}

.transaction-icon.cat-moradia {
  background: var(--blue-100);
  color: var(--blue-500);
}

.transaction-icon.cat-higiene {
  background: var(--green-100);
  color: var(--green-600);
}

.transaction-icon.cat-limpeza {
  background: var(--blue-100);
  color: var(--blue-500);
}

.transaction-icon.cat-transporte {
  background: var(--purple-100);
  color: var(--purple-500);
}

.transaction-icon.cat-saude {
  background: var(--red-100);
  color: var(--red-500);
}

.transaction-icon.cat-lazer {
  background: var(--purple-100);
  color: var(--amber-500);
}

.transaction-icon.cat-educacao {
  background: var(--blue-100);
  color: var(--blue-500);
}

.transaction-icon.cat-salario {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.transaction-icon.cat-manutencao {
  background: var(--orange-100);
  color: var(--orange-700);
}

.transaction-icon.cat-taxas {
  background: var(--red-100);
  color: var(--red-600);
}

.transaction-icon.cat-outros {
  background: var(--slate-100);
  color: var(--text-500);
}

.transaction-icon.cat-default {
  background: var(--slate-100);
  color: var(--text-500);
}

.transaction-member-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: white;
  box-shadow: 0 0 0 2px var(--white);
}

.transaction-member-badge.badge-primary {
  background: var(--primary);
}

.transaction-member-badge.badge-neutral {
  background: var(--text-400);
}

.transaction-info p:first-child {
  font-size: 14px;
  font-weight: 600;
}

.transaction-info p:last-child {
  font-size: 10px;
  color: var(--text-500);
}

.transaction-value {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.transaction-delete {
  color: var(--text-400);
  padding: 4px 8px;
  border-radius: var(--r);
  transition: var(--transition);
  margin-left: 8px;
}

.transaction-delete:hover {
  color: var(--red-500);
  background: var(--red-100);
}

/* ---- FAB ---- */
.fab {
  position: fixed;
  bottom: 88px;
  right: calc(50% - 420px);
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: white;
  border-radius: var(--r-full);
  box-shadow: var(--shadow-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: var(--transition);
}

.fab:active {
  transform: scale(0.92);
}

.fab .material-symbols-outlined {
  font-size: 28px;
}

/* ---- Bottom Nav ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(var(--primary-rgb), 0.08);
  padding: 8px 24px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
}

.bottom-nav-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-400);
  transition: var(--transition);
  padding: 4px 8px;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

.nav-item span:last-child {
  font-size: 10px;
  font-weight: 600;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-700);
  margin-bottom: 8px;
}

.form-input-wrapper {
  position: relative;
}

.form-input-wrapper .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-400);
  font-size: 20px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 14px 16px 14px 42px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-xl);
  background: var(--white);
  color: var(--text-900);
  font-size: 14px;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.form-input::placeholder {
  color: var(--text-400);
}

.valor-section {
  padding: 28px 24px;
  text-align: center;
  background: rgba(var(--primary-rgb), 0.04);
}

.valor-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-500);
  font-weight: 600;
  margin-bottom: 8px;
}

.valor-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.valor-prefix {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.valor-input {
  background: transparent;
  border: none;
  font-size: 36px;
  font-weight: 700;
  width: 200px;
  text-align: center;
  color: var(--text-900);
}

.valor-input:focus {
  outline: none;
}

.payment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.payment-option {
  cursor: pointer;
}

.payment-option input {
  display: none;
}

.payment-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  border-radius: var(--r-xl);
  border: 1px solid var(--slate-200);
  background: var(--white);
  transition: var(--transition);
}

.payment-option input:checked+.payment-card {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.04);
}

.payment-card .material-symbols-outlined {
  color: var(--primary);
  margin-bottom: 4px;
}

.payment-card span:last-child {
  font-size: 11px;
  font-weight: 500;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--slate-50);
  border-radius: var(--r-xl);
}

.toggle-row .toggle-info p:first-child {
  font-size: 14px;
  font-weight: 600;
}

.toggle-row .toggle-info p:last-child {
  font-size: 12px;
  color: var(--text-500);
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  cursor: pointer;
  display: inline-block;
}

.toggle-switch input {
  display: none;
}

.toggle-track {
  width: 100%;
  height: 100%;
  background: var(--slate-300);
  border-radius: var(--r-full);
  transition: var(--transition);
}

.toggle-switch input:checked+.toggle-track {
  background: var(--primary);
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 4px;
  width: 24px;
  height: 24px;
  background: white;
  border-radius: var(--r-full);
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked+.toggle-track::after {
  left: calc(100% - 28px);
}

/* ---- Buttons ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border-radius: var(--r-xl);
  font-size: 16px;
  font-weight: 700;
  transition: var(--transition);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-outline {
  background: transparent;
  color: var(--text-600);
  border: 1px solid var(--slate-200);
}

.btn-outline:hover {
  background: var(--slate-50);
}

.btn-sm {
  padding: 10px 16px;
  font-size: 14px;
  width: auto;
}

/* ---- Skeleton ---- */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--r);
}

/* ---- Sync Banner ---- */
.sync-banner {
  display: flex;
  align-items: center;
  padding: 16px;
  border-radius: var(--r-xl);
  border: 1px solid rgba(var(--primary-rgb), 0.15);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.sync-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-spinner {
  animation: spin 1s linear infinite;
  color: var(--primary);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sync-left p:first-of-type {
  font-size: 14px;
  font-weight: 700;
}

.sync-left p:last-of-type {
  font-size: 12px;
  color: var(--text-500);
}

/* ---- Filter Chips ---- */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  height: 36px;
  padding: 0 20px;
  border-radius: var(--r-lg);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  background: var(--white);
  color: var(--text-600);
  border: 1px solid var(--slate-200);
  transition: var(--transition);
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  font-weight: 600;
}

/* ---- Stock Item ---- */
.stock-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: var(--r-xl);
  border: 1px solid var(--slate-200);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.stock-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stock-icon .material-symbols-outlined {
  font-size: 28px;
}

.stock-icon.icon-primary {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.stock-icon.icon-orange {
  background: var(--orange-100);
  color: var(--orange-500);
}

.stock-icon.icon-blue {
  background: var(--blue-100);
  color: var(--blue-500);
}

.stock-icon.icon-purple {
  background: var(--purple-100);
  color: var(--purple-500);
}

.stock-info {
  flex: 1;
  min-width: 0;
}

.stock-badge {
  display: inline-flex;
  padding: 2px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 500;
}

.stock-badge.badge-ok {
  background: var(--emerald-100);
  color: var(--emerald-700);
}

.stock-badge.badge-alert {
  background: var(--orange-100);
  color: var(--orange-700);
}

.stock-badge.badge-critical {
  background: var(--red-100);
  color: var(--red-700);
}

.stock-info h3 {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}

.stock-info p {
  font-size: 14px;
  color: var(--text-500);
}

.stock-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stock-actions button {
  color: var(--text-400);
  padding: 6px;
  border-radius: var(--r);
  transition: var(--transition);
}

.stock-actions button:hover {
  color: var(--red-500);
  background: var(--red-100);
}

/* ---- Chart ---- */
.chart-card {
  padding: 24px;
}

.chart-header {
  margin-bottom: 24px;
}

.chart-label {
  font-size: 14px;
  color: var(--text-500);
  font-weight: 500;
}

.chart-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chart-value.text-danger {
  color: var(--red-500);
}

.donut-container {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.donut-wrapper {
  position: relative;
  width: 192px;
  height: 192px;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-center .small {
  font-size: 12px;
  color: var(--text-500);
}

.donut-center .big {
  font-size: 18px;
  font-weight: 700;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}

.legend-text {
  font-size: 12px;
  color: var(--text-600);
}

.progress-group {
  margin-bottom: 20px;
}

.progress-group:last-child {
  margin-bottom: 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}

.progress-label {
  color: var(--text-900);
}

.progress-values {
  color: var(--text-400);
}

.progress-bar {
  height: 12px;
  width: 100%;
  background: var(--slate-200);
  border-radius: var(--r-full);
  overflow: hidden;
  display: flex;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.6s ease;
}

.progress-fill-over {
  height: 100%;
  background: var(--red-500);
}

/* ---- Settings ---- */
.settings-section {
  margin-bottom: 28px;
}

.settings-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-500);
  font-weight: 600;
  margin-bottom: 12px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--r-xl);
  background: var(--white);
  border: 1px solid var(--slate-100);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
  gap: 12px;
}

.settings-item:active {
  background: var(--slate-50);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 1;
}

.settings-item-left .material-symbols-outlined {
  color: var(--primary);
  font-size: 22px;
  flex-shrink: 0;
}

.settings-item-left>img {
  flex-shrink: 0;
}

.settings-item-left span:last-child {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-400);
  flex-shrink: 0;
}

.settings-item-right .value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-600);
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--r-xl);
  font-size: 14px;
  font-weight: 600;
  color: white;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: var(--shadow-lg);
  max-width: 90%;
}

.toast.show {
  opacity: 1;
}

.toast-success {
  background: var(--primary);
}

.toast-error {
  background: var(--red-500);
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-400);
}

.empty-state .material-symbols-outlined {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--white);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
  transform: translateY(0);
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--slate-300);
  border-radius: var(--r-full);
  margin: 12px auto;
}

/* ==== DESKTOP ENHANCEMENTS ==== */
@media (min-width: 768px) {
  .app-container {
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--slate-200);
    border-right: 1px solid var(--slate-200);
  }

  .main-content {
    padding: 28px 32px 100px;
  }

  .bottom-nav {
    max-width: 900px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    box-shadow: var(--shadow-lg);
  }

  .fab {
    right: calc(50% - 420px);
  }

  .transaction-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }

  .stock-item:hover {
    box-shadow: var(--shadow-md);
  }

  .budget-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .modal-content {
    border-radius: var(--r-xl);
    margin-bottom: 20px;
  }

  .modal-overlay {
    align-items: center;
  }

  .payment-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .fab {
    right: 24px;
  }

  .budget-value {
    font-size: 15px;
  }

  .fluxo-valor {
    font-size: 14px;
  }

  .payment-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .payment-card {
    padding: 10px 6px;
  }

  .payment-card span:last-child {
    font-size: 10px;
  }
}

/* ---- Resumo Cards (Estoque) ---- */
.resumo-card {
  text-align: center;
  padding: 12px 8px;
  border-radius: var(--r-xl);
  border: 1px solid var(--slate-200);
  background: var(--white);
}

.resumo-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.resumo-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-500);
  font-weight: 600;
  margin-top: 2px;
}

@media (max-width: 480px) {
  .resumo-card {
    padding: 8px 4px;
  }

  .resumo-num {
    font-size: 14px;
  }
}

/* ---- Desktop Enhancements ---- */
@media (min-width: 768px) {
  .main-content {
    padding: 28px 40px;
    max-width: 1200px;
    margin: 0 auto;
  }

  .header {
    padding: 20px 40px;
  }

  .header-title {
    font-size: 20px;
  }

  .header-subtitle {
    font-size: 14px;
  }

  .budget-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .fluxo-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .transaction-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .modal-content {
    max-width: 500px;
    margin: 0 auto;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  }

  .modal-overlay.show .modal-content {
    max-height: 85vh;
  }

  .settings-section {
    max-width: 600px;
  }

  .resumo-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  section.card {
    max-width: 100%;
  }

  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  }

  .fab {
    right: 40px;
    bottom: 100px;
    width: 60px;
    height: 60px;
  }

  .payment-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .data-table {
    max-width: 600px;
  }
}

@media (min-width: 1200px) {
  .main-content {
    max-width: 1400px;
    padding: 32px 60px;
  }

  .transaction-list {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .fluxo-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}