:root {
  --bg: #07070a;
  --bg-panel: #121110;
  --bg-panel-2: #1c1a16;
  --border: #34301f;
  --text: #f3ecd9;
  --text-muted: #a89a78;
  --accent: #d4af37;
  --accent-2: #f5d576;
  --gold-deep: #8a6a1f;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f0b429;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  padding: 0 8px;
}
.brand-icon { display: flex; flex-shrink: 0; }
.brand-name { font-weight: 500; font-size: 16px; letter-spacing: 0.2px; }
.brand-name strong { font-weight: 800; }
.brand-tagline { font-size: 12px; color: var(--text-muted); margin: 0 0 20px; padding: 0 8px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg-panel-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, var(--accent-2), var(--gold-deep));
  color: #0a0906;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.3);
}

.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.sidebar-footer label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }

/* ---------- Content ---------- */
.content { padding: 32px 40px; max-width: 1200px; }

.tab { display: none; }
.tab.active { display: block; animation: fade 0.2s ease; }

@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.section-header { margin-bottom: 24px; }
.section-header h1 { margin: 0 0 6px; font-size: 26px; }
.muted { color: var(--text-muted); font-size: 14px; margin: 0; }

/* ---------- Cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.card-income::before { background: var(--green); }
.card-expense::before { background: var(--red); }
.card-unnecessary::before { background: var(--amber); }
.card-fixed::before { background: #a855f7; }
.card-balance::before { background: var(--accent-2); }
.card-savings::before { background: var(--green); }

.card-label { font-size: 13px; color: var(--text-muted); }
.card-value { font-size: 24px; font-weight: 700; }

.simples-box { display: flex; flex-wrap: wrap; gap: 24px; }
.simples-box .simples-item { min-width: 140px; }
.simples-box .simples-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.simples-box .simples-value { font-size: 18px; font-weight: 700; }

/* ---------- Panels / grids ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.panel h2 { margin-top: 0; font-size: 16px; }

/* ---------- Forms ---------- */
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 6px;
}
.form-row > div { flex: 1 1 160px; min-width: 140px; }
.form-row label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }

input, select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel-2);
  color: var(--text);
  font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
input[type="color"] { padding: 3px; height: 38px; }

.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.checkbox input { width: auto; }

.align-end { display: flex; align-items: flex-end; }

.btn {
  padding: 10px 18px;
  border-radius: 9px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-2), var(--gold-deep));
  color: #0a0906;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--bg-panel-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-danger { background: rgba(239,68,68,0.15); color: var(--red); }
.btn-small { padding: 6px 10px; font-size: 12px; }

/* ---------- Alerta de metas ---------- */
.alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.alert-banner strong { color: #fecaca; }
.alert-banner p { margin: 4px 0 0; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 0 40px rgba(0,0,0,0.6);
}
.modal-box h2 { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Linha possivelmente duplicada na importação ---------- */
tr.row-duplicate td { background: rgba(240, 180, 41, 0.12); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
tr:hover td { background: rgba(255,255,255,0.02); }
.amount-pos { color: var(--green); font-weight: 600; }
.amount-neg { color: var(--red); font-weight: 600; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #0a0906;
}

/* ---------- Lists (goals/projects) ---------- */
.cards-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.goal-card, .project-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.goal-card h3, .project-card h3 { margin: 0 0 6px; font-size: 16px; }
.progress-bar {
  background: var(--bg-panel-2);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin: 10px 0 6px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.progress-label { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; }

.simple-list { list-style: none; padding: 0; margin: 12px 0 0; }
.simple-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.budget-list { display: flex; flex-direction: column; gap: 14px; }
.budget-item .progress-label { margin-top: 4px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .content { padding: 20px; }
}
