* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --dark-brown: #714a1e;
  --gold: #c6a25b;
  --dark-green: #5b6d3f;
  --bg-main: #f5f0eb;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-muted: #888888;
  --border: #e8e0d8;
  --brown-light: #8B6914;
  --receita-bg: #5b6d3f;
  --fixa-bg: #714a1e;
  --variavel-bg: #8B6914;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
}

body { display: flex; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 200px;
  background-color: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 100;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--dark-brown);
  letter-spacing: 0.3px;
  line-height: 1.2;
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-user span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-user small {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  user-select: none;
}

.nav-item:hover { background-color: rgba(113,74,30,0.05); }

.nav-item.active {
  border-left-color: var(--gold);
  background-color: rgba(198,162,91,0.08);
  color: var(--dark-brown);
  font-weight: 500;
}

.sidebar-footer {
  padding: 16px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.btn-logout {
  width: 100%;
  padding: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #fff0f0;
  border-color: #e0b0b0;
  color: #c0392b;
}

/* ===== MAIN ===== */
.main-content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 32px 40px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark-brown);
}

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.kpi-header {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
}

.kpi-header.receita  { background: var(--receita-bg); }
.kpi-header.pendente { background: var(--gold); }
.kpi-header.pagar    { background: var(--fixa-bg); }
.kpi-header.saldo    { background: var(--dark-brown); }

.kpi-body {
  padding: 10px 14px 12px;
}

.kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ===== MONTH SELECTOR ===== */
.month-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.month-bar label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

select.month-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-card);
  cursor: pointer;
}

select.month-select:focus {
  outline: none;
  border-color: var(--gold);
}

/* ===== SUMMARY TABLE ===== */
.card {
  background: var(--bg-card);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-title {
  padding: 14px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark-brown);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: #faf8f5;
}

thead th.right { text-align: right; }

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #faf8f5; }
tbody tr.highlight { background: rgba(198,162,91,0.08); font-weight: 500; }

td.currency, td.right { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge.recebido  { background: #e8f5e9; color: #2e7d32; }
.badge.pago      { background: #e8f5e9; color: #2e7d32; }
.badge.pendente  { background: #fff8e1; color: #f57f17; }

/* Group header rows */
.group-header td {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 8px 14px;
  color: #fff;
}

.group-receita   { background: var(--receita-bg); }
.group-fixa      { background: var(--fixa-bg); }
.group-variavel  { background: var(--variavel-bg); }

/* Saldo negativo */
.negative { color: #c0392b; }

/* ===== BUTTONS ===== */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--dark-brown);
  color: #fff;
}
.btn-primary:hover { background: #5a3a15; }

.btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover { background: var(--bg-main); }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 14px;
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--bg-main); }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: 10px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-brown);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ===== FORM FIELDS ===== */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-main);
  transition: border-color 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  background: #fff;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  background: var(--dark-brown);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: slideIn 0.25s ease;
  max-width: 320px;
}

.toast.error { background: #c0392b; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state p { font-size: 14px; margin-top: 8px; }

/* ===== LANCAMENTOS FILTER BAR ===== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
