:root {
  --bg: #0F1419;
  --surface: #171D26;
  --surface-raised: #1D2530;
  --border: #2A3441;
  --text: #E8EAED;
  --text-muted: #8B95A1;
  --gold: #C9A227;
  --gold-soft: rgba(201, 162, 39, 0.14);
  --positive: #3FB68B;
  --negative: #D8626B;
  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-body: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 28px 20px;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 32px;
  color: var(--text);
}
.brand span { color: var(--gold); }

.nav a {
  display: block;
  color: var(--text-muted);
  padding: 9px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
  font-size: 0.92rem;
}
.nav a:hover, .nav a.active {
  background: var(--gold-soft);
  color: var(--text);
  text-decoration: none;
}

.main { padding: 36px 44px; max-width: 1080px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  margin: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: none;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }

.tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text-muted);
}
.tag.compra { color: var(--positive); background: rgba(63,182,139,0.12); }
.tag.venda { color: var(--negative); background: rgba(216,98,107,0.12); }

.positive { color: var(--positive); }
.negative { color: var(--negative); }

form { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row.inline { flex-direction: row; gap: 14px; }
.form-row.inline > div { flex: 1; }

label { font-size: 0.85rem; color: var(--text-muted); }

input, select {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: var(--font-body);
}
input:focus, select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--gold);
}

button, .btn {
  background: var(--gold);
  color: #171205;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  width: fit-content;
}
button:hover, .btn:hover { opacity: 0.9; text-decoration: none; }
.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.flash {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.flash.success { background: rgba(63,182,139,0.12); color: var(--positive); }
.flash.error { background: rgba(216,98,107,0.12); color: var(--negative); }

.empty-state {
  color: var(--text-muted);
  padding: 40px 0;
  text-align: center;
  font-size: 0.92rem;
}

.upload-box {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 36px;
  text-align: center;
  color: var(--text-muted);
}

.help-text { color: var(--text-muted); font-size: 0.82rem; margin-top: -6px; }

.review-table input {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.85rem;
}

.category-group {
  border-bottom: 1px solid var(--border);
}
.category-group:last-child { border-bottom: none; }

.category-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  color: var(--text);
}
.category-header:hover { background: var(--surface-raised); }

.ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ring-inner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text);
}

.category-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  flex: 1;
}

.category-balance {
  text-align: right;
  font-size: 0.92rem;
  min-width: 140px;
}

.chevron {
  color: var(--text-muted);
  transition: transform 0.15s ease;
  font-size: 0.8rem;
}

.category-body {
  padding: 0 4px 16px 60px;
}