/* ══════════════════════════════════════════════════════════════════════════════
   ATLAS DESIGN SYSTEM — COMPONENTES BASE
   Padronização modular: Botões, Inputs, Cards, Badges, Tabs, Tabelas,
   Modais, Drawers, Toasts, EmptyStates, Skeletons, Tooltips, ProgressBars
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── 1. Botões ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform 0.05s ease;
  user-select: none;
}

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

.btn:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primário (Cobre — único acento principal) */
.btn-primary {
  background: var(--copper);
  color: #0F2A22;
  border-color: var(--copper);
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) {
  background: var(--copper-hover);
  border-color: var(--copper-hover);
  color: #05100c;
}

/* Secundário (Superfície discreta com borda sutil) */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

/* Ghost / Terciário */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* Destrutivo / Alerta */
.btn-destructive,
.btn-secondary-danger {
  background: var(--negative-faint);
  color: var(--negative);
  border-color: rgba(192, 57, 43, 0.35);
}
.btn-destructive:hover:not(:disabled),
.btn-secondary-danger:hover:not(:disabled) {
  background: rgba(192, 57, 43, 0.25);
  border-color: var(--negative);
}

/* Botão de Ação Pequeno (em listas e tabelas) */
.btn-action-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 4px 10px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-xs);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.btn-action-small:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

/* Estado de Carregamento em Botões */
.btn.loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(243, 238, 227, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
.btn-primary.loading::after {
  border: 2px solid rgba(15, 42, 34, 0.3);
  border-top-color: #0F2A22;
}

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

/* ── 2. Campos de Formulário (Input, Select, Switch) ────────────────────────── */
input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow: 0 0 0 1px var(--copper);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* Switch Toggle Customizado */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  width: 44px;
  height: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}
.switch input:checked + .switch-track {
  background: var(--copper);
  border-color: var(--copper);
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform var(--transition-fast);
}
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
  background: #0F2A22;
}

/* ── 3. Cards & Superfícies ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.card-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ── 4. Badges & Chips ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
}

.badge-copper {
  background: var(--copper-faint);
  border-color: rgba(217, 138, 61, 0.35);
  color: var(--copper);
}

.badge-positive {
  background: var(--positive-faint);
  border-color: rgba(82, 196, 134, 0.35);
  color: var(--positive);
}

.badge-negative {
  background: var(--negative-faint);
  border-color: rgba(250, 125, 112, 0.35);
  color: var(--negative);
}

/* ── 5. Abas (Tabs) ─────────────────────────────────────────────────────────── */
.tabs-nav {
  display: flex;
  gap: var(--space-1);
  padding: 3px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: fit-content;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 38px;
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

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

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ── 6. Listas & Tabelas (Ledger & Data Table) ───────────────────────────────── */
.ledger-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.ledger-item {
  display: grid;
  grid-template-columns: 52px 1fr auto auto;
  align-items: center;
  gap: var(--space-4);
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.ledger-item:last-child {
  border-bottom: none;
}

.date-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.date-badge small {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.item-info b {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-info small {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.item-amount {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.item-amount.income { color: var(--positive); }
.item-amount.expense { color: var(--text-primary); }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.data-table th {
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
}
.data-table td {
  padding: 14px 16px;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}
.data-table tr:last-child td {
  border-bottom: none;
}

/* ── 7. Modais & Drawers ────────────────────────────────────────────────────── */
dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 100vw;
  max-height: 100vh;
}

dialog::backdrop {
  background: rgba(9, 26, 21, 0.75);
  backdrop-filter: blur(3px);
}

.modal-box {
  width: 100%;
  max-width: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.modal-header h2 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--text-primary);
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* Drawer Lateral (Desktop ou Mobile) */
.drawer-box {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 460px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  z-index: 1000;
}

dialog.drawer-dialog {
  margin: 0 0 0 auto;
  max-height: 100vh;
  height: 100vh;
  padding: 0;
  border: none;
  background: transparent;
}
dialog.drawer-dialog::backdrop {
  background: rgba(9, 26, 21, 0.7);
  backdrop-filter: blur(4px);
}
dialog.drawer-dialog .drawer-box {
  position: static;
  width: 100vw;
  max-width: 480px;
  height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
}

/* Chips de Filtro */
.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  min-height: 34px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn-chip.active {
  background: var(--copper-faint);
  color: var(--copper);
  border-color: var(--copper);
  font-weight: 600;
}

/* ── 8. Empty States ────────────────────────────────────────────────────────── */
.empty-state-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-10) var(--space-6);
  background: var(--bg-primary);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  margin: var(--space-4) 0;
}

.empty-state-img {
  width: 180px;
  max-width: 60%;
  height: auto;
  margin-bottom: var(--space-4);
  opacity: 0.9;
}

.empty-state-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  max-width: 420px;
  line-height: 1.5;
  margin-bottom: var(--space-5);
}

/* ── 9. Barra de Progresso ──────────────────────────────────────────────────── */
.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--copper);
  border-radius: var(--radius-full);
  transform-origin: left;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar.positive {
  background: var(--positive);
}

.progress-bar.warning {
  background: var(--negative);
}

/* ── 10. Skeletons (Estados de Carregamento) ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-card {
  height: 120px;
  width: 100%;
}

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

/* ── 11. Tooltip ────────────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 100;
}
[data-tooltip]:hover::after {
  opacity: 1;
}

/* ── 12. Toast de Notificação ───────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast-item {
  padding: 12px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.25s ease-out;
}

.toast-item.error {
  border-color: var(--negative);
  color: var(--negative);
}

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

/* ── 13. Metas & Rotas de Planejamento, Contratos e Parcelamentos ───────────── */
.planning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 640px) {
  .planning-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

.goal-route-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.goal-route-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.goal-route-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.goal-route-title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.goal-figures-wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.goal-saved-figure {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.goal-target-figure {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Rota Visual com Marcos e Bandeira de Chegada */
.goal-route-track-wrap {
  background: rgba(15, 42, 34, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px 12px;
}

.goal-route-anchors {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
}

.goal-route-origin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.goal-waypoint-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}

.goal-route-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--copper);
  font-weight: 600;
}

.goal-route-flag.reached {
  color: var(--positive);
}

.goal-route-flag-icon {
  width: 14px;
  height: 14px;
}

.goal-route-line-box {
  position: relative;
  height: 8px;
  background: rgba(243, 238, 227, 0.08);
  border-radius: 4px;
  overflow: visible;
  margin: 10px 0;
}

.goal-route-line-fill {
  height: 100%;
  background: var(--copper);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.goal-route-line-fill.reached {
  background: var(--positive);
}

.goal-route-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--copper);
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 0 2px rgba(217, 138, 61, 0.3);
  pointer-events: none;
}

.goal-route-marker.reached {
  background: var(--positive);
  box-shadow: 0 0 0 2px rgba(82, 196, 134, 0.3);
}

.goal-route-subtext {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Painel de Aporte Sugerido */
.goal-contribution-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(217, 138, 61, 0.07);
  border: 1px solid rgba(217, 138, 61, 0.22);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}

.goal-contribution-card.reached {
  background: var(--positive-faint);
  border-color: rgba(82, 196, 134, 0.3);
  color: var(--positive);
}

.goal-contribution-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--copper);
}

.goal-contribution-card.reached .goal-contribution-icon {
  color: var(--positive);
}

/* Contratos de Empréstimos e Parcelamentos */
.loan-contract-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.loan-contract-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.loan-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.loan-title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.3;
}

.loan-lender-tag {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.loan-progress-box {
  background: rgba(15, 42, 34, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loan-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.loan-installment-highlight {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.loan-installment-highlight span {
  color: var(--copper);
}

.loan-figures-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.loan-figure-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.loan-figure-cell-label {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
}

.loan-figure-cell-value {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.loan-figure-cell-value.secondary {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.loan-next-payment-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(243, 238, 227, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 6px;
}

.loan-actions-bar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* ── 14. Relatórios & Gráficos Analíticos ────────────────────────────────────── */
.reports-subgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 900px) {
  .reports-subgrid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

.report-chart-container {
  display: flex;
  gap: 12px;
  height: 260px;
  padding: 16px 12px 10px;
  position: relative;
}

.report-y-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  height: 100%;
  padding-bottom: 24px;
  min-width: 60px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
}

.report-bars-viewport {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 10px;
  height: 100%;
  position: relative;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 24px;
  background: repeating-linear-gradient(to top, rgba(243, 238, 227, 0.04) 0px, rgba(243, 238, 227, 0.04) 1px, transparent 1px, transparent calc(25%));
}

.report-month-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  min-width: 28px;
}

.report-bars-pair {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100%;
  width: 100%;
  justify-content: center;
}

.report-bar-inc,
.report-bar-exp {
  width: 14px;
  max-width: 45%;
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease, opacity 0.15s ease;
  position: relative;
  cursor: pointer;
}

.report-bar-inc {
  background: var(--positive);
}

.report-bar-exp {
  background: var(--negative);
}

.report-bar-inc:hover,
.report-bar-exp:hover {
  opacity: 0.85;
}

.report-month-label {
  position: absolute;
  bottom: -22px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.report-mom-metric-card {
  background: rgba(15, 42, 34, 0.45);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 12px;
}

.report-cat-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.report-cat-row:last-child {
  border-bottom: none;
}

.report-cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.report-cat-bar-track {
  height: 6px;
  background: rgba(243, 238, 227, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.report-cat-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--forest-hover);
  transition: width 0.3s ease;
}

.report-cat-bar-fill.lead {
  background: var(--copper);
}

/* ── 12. Paleta de Comandos (Ctrl+K) ────────────────────────────────────────── */
dialog.cmd-palette-dialog {
  position: fixed;
  top: 10vh;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: min(640px, 94vw);
  max-height: 82vh;
  padding: 0;
  border: 1px solid var(--forest-border);
  background: var(--forest-dark);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(243, 238, 227, 0.08);
  overflow: hidden;
  color: var(--bone);
  z-index: 1200;
}

dialog.cmd-palette-dialog::backdrop {
  background: rgba(9, 26, 21, 0.75);
  backdrop-filter: blur(6px);
}

.cmd-palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--forest-border);
  background: var(--forest-surface);
}

.cmd-palette-header svg {
  width: 18px;
  height: 18px;
  color: var(--copper);
  flex-shrink: 0;
}

.cmd-palette-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--bone);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  outline: none;
}

.cmd-palette-input::placeholder {
  color: var(--bone-muted);
  font-weight: 400;
}

.cmd-palette-results {
  max-height: 420px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cmd-group-label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--bone-muted);
  padding: 8px 12px 4px;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s, border-color 0.1s;
  user-select: none;
  width: 100%;
}

.cmd-item:hover,
.cmd-item.active {
  background: var(--forest-surface);
  border-color: var(--forest-border);
}

.cmd-item-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.cmd-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--forest-card, #133329);
  border: 1px solid var(--forest-border);
  display: grid;
  place-items: center;
  color: var(--bone-muted);
  flex-shrink: 0;
}

.cmd-item.active .cmd-item-icon {
  color: var(--copper);
  border-color: rgba(217, 138, 61, 0.4);
}

.cmd-item-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cmd-item-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--bone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-item-sub {
  font-size: 11.5px;
  color: var(--bone-muted);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd-item-badge {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--forest-dark);
  border: 1px solid var(--forest-border);
  color: var(--bone-faint);
  flex-shrink: 0;
}

.cmd-palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--forest-surface);
  border-top: 1px solid var(--forest-border);
  font-size: 11px;
  color: var(--bone-muted);
  font-family: var(--mono);
}

.cmd-palette-footer kbd {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--forest-dark);
  border: 1px solid var(--forest-border);
  color: var(--bone);
  margin-right: 2px;
}

/* ── Print & PDF Export Styles ────────────────────────────────────────────── */
.print-only-header {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 15mm;
  }

  *, *:before, *:after {
    background: transparent !important;
    color: #111111 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #ffffff !important;
    color: #111111 !important;
    font-size: 11pt !important;
    line-height: 1.4 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Ocultar elementos de navegação e controles interativos da interface */
  .sidebar,
  .topbar,
  .mobile-bottom-nav,
  .mobile-drawer,
  dialog,
  button,
  .btn,
  .report-period-chips,
  .toast,
  #btn-cmd-palette-trigger,
  #btn-reminders-trigger,
  #chat,
  .card-action,
  .action-btn,
  .no-print {
    display: none !important;
  }

  /* Reset estrutural da aplicação para impressão linear */
  .app-container,
  .main-content,
  .view-container,
  .view {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    overflow: visible !important;
  }

  .view:not(.active) {
    display: none !important;
  }

  #view-reports {
    display: block !important;
  }

  .print-only-header {
    display: block !important;
    margin-bottom: 20px !important;
    padding-bottom: 12px !important;
    border-bottom: 2px solid #0F2A22 !important;
  }

  .print-only-header h1 {
    font-family: var(--serif, serif) !important;
    font-size: 24pt !important;
    color: #0F2A22 !important;
    margin: 0 0 4px 0 !important;
  }

  .print-only-header p {
    font-size: 10pt !important;
    color: #555555 !important;
    margin: 0 !important;
  }

  .card {
    background: #ffffff !important;
    border: 1px solid #dcd7ce !important;
    color: #111111 !important;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 16px !important;
    padding: 16px !important;
    border-radius: 6px !important;
  }

  .card-title {
    color: #0F2A22 !important;
    font-size: 13pt !important;
  }

  .kpi-card {
    background: #faf8f5 !important;
    border: 1px solid #dcd7ce !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .kpi-label {
    color: #555555 !important;
  }

  .kpi-value {
    color: #0F2A22 !important;
  }

  .kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .reports-subgrid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 16px !important;
  }

  .report-chart-wrap {
    height: auto !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
  }

  th, td {
    border-bottom: 1px solid #e2ddd4 !important;
    padding: 6px 8px !important;
    font-size: 9.5pt !important;
    color: #222222 !important;
  }

  th {
    color: #0F2A22 !important;
    font-weight: 700 !important;
    background: #f5f2eb !important;
  }
}

/* ── 15. Dívidas & Gestão de Endividamento ────────────────────────────────────── */
.planning-tabs-nav .tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: all var(--transition-fast);
}

.planning-tabs-nav .tab-btn:hover {
  color: var(--text-primary);
  background: rgba(243, 238, 227, 0.04);
}

.planning-tabs-nav .tab-btn.active {
  color: var(--copper);
  border-bottom-color: var(--copper);
  font-weight: 600;
  background: rgba(217, 138, 61, 0.08);
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.filter-chip.active {
  background: var(--copper);
  border-color: var(--copper);
  color: #fff;
  font-weight: 600;
}

/* ── 16. Modo Privacidade (Ocultar Saldos / Olho Oculto) ──────── */
body.privacy-mode-active .privacy-sensitive,
body.privacy-mode-active .tabular-nums,
body.privacy-mode-active .kpi-val,
body.privacy-mode-active #hero-balance,
body.privacy-mode-active .goal-saved-figure,
body.privacy-mode-active .goal-target-figure,
body.privacy-mode-active .loan-figure-cell-value,
body.privacy-mode-active .account-balance-amount,
body.privacy-mode-active .inv-position-value,
body.privacy-mode-active .tx-amount,
body.privacy-mode-active #debts-kpi-total,
body.privacy-mode-active #debts-kpi-monthly,
body.privacy-mode-active #debts-kpi-receivable,
body.privacy-mode-active .kpi-hero strong,
body.privacy-mode-active .kpi-card strong,
body.privacy-mode-active .overview-kpi-value,
body.privacy-mode-active .card-limit-val,
body.privacy-mode-active #recurring-total-fixed,
body.privacy-mode-active #recurring-total-income {
  filter: blur(7px);
  user-select: none;
  cursor: pointer;
  transition: filter var(--transition-fast);
}

body.privacy-mode-active .privacy-sensitive:hover,
body.privacy-mode-active .tabular-nums:hover,
body.privacy-mode-active .kpi-val:hover,
body.privacy-mode-active #hero-balance:hover,
body.privacy-mode-active .goal-saved-figure:hover,
body.privacy-mode-active .goal-target-figure:hover,
body.privacy-mode-active .loan-figure-cell-value:hover,
body.privacy-mode-active .account-balance-amount:hover,
body.privacy-mode-active .inv-position-value:hover,
body.privacy-mode-active .tx-amount:hover,
body.privacy-mode-active #debts-kpi-total:hover,
body.privacy-mode-active #debts-kpi-monthly:hover,
body.privacy-mode-active #debts-kpi-receivable:hover,
body.privacy-mode-active .kpi-hero strong:hover,
body.privacy-mode-active .kpi-card strong:hover,
body.privacy-mode-active .overview-kpi-value:hover,
body.privacy-mode-active .card-limit-val:hover,
body.privacy-mode-active #recurring-total-fixed:hover,
body.privacy-mode-active #recurring-total-income:hover {
  filter: blur(0);
}

.privacy-toggle-btn.active {
  color: var(--copper) !important;
  border-color: rgba(217, 138, 61, 0.4) !important;
  background: rgba(217, 138, 61, 0.1) !important;
}

/* ── 22. Bloqueio de Tela por PIN (App Lock) ────────────────────────── */
.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--forest-border, rgba(243, 238, 227, 0.25));
  background: transparent;
  transition: all 0.2s ease;
}

.pin-dot.filled {
  background: var(--copper, #D98A3D);
  border-color: var(--copper, #D98A3D);
  box-shadow: 0 0 10px rgba(217, 138, 61, 0.5);
  transform: scale(1.15);
}

.pin-key {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 500;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--forest-border, rgba(243, 238, 227, 0.15));
  background: var(--forest-surface, #14352B);
  color: var(--bone, #F3EEE3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pin-key:hover {
  background: var(--forest-card, #1A4438);
  border-color: var(--copper, #D98A3D);
  transform: translateY(-1px);
}

.pin-key:active {
  background: var(--copper, #D98A3D);
  color: var(--forest-dark, #0B1F19);
  transform: scale(0.95);
}

.pin-key-action {
  font-size: 16px;
  color: var(--bone-muted, #B4A996);
  border-color: transparent;
  background: transparent;
}

.pin-key-action:hover {
  background: rgba(243, 238, 227, 0.08);
}

.shake-animation {
  animation: pin-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes pin-shake {
  10%, 90% { transform: translate3d(-3px, 0, 0); }
  20%, 80% { transform: translate3d(5px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}



