:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --border: #E7E5E4;
  --text: #0A0A0A;
  --text-muted: #6B6764;
  --accent: #4F7A4F;
  --warning: #B45309;
  --danger: #B91C1C;
  --radius: 6px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space: 16px;
  --space-lg: 24px;
  --space-xl: 48px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.15s;
}
a:hover { border-bottom-color: currentColor; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

.tabular { font-variant-numeric: tabular-nums; }

/* ===== App shell ===== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space) var(--space-xl);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.brand-mark {
  color: var(--accent);
  font-size: 16px;
}
.brand-sub {
  color: var(--text-muted);
  font-size: 12px;
}

.app-header__nav {
  display: flex;
  gap: var(--space-lg);
}
.app-header__nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}
.app-header__nav a:hover,
.app-header__nav a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.app-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-xl);
}

/* ===== Page sections ===== */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}
.page-header h1 {
  margin: 0 0 var(--space-xs) 0;
  font-size: 24px;
  font-weight: 600;
}
.page-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Cards / lists ===== */

.list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.list-item {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  align-items: center;
  gap: var(--space);
  padding: var(--space) var(--space-lg);
  background: var(--surface);
  transition: background 0.15s;
}
.list-item:hover {
  background: #F5F4F3;
  cursor: pointer;
}
.list-item__title {
  font-weight: 500;
}
.list-item__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.list-item__right {
  text-align: right;
}
.list-item__amount {
  font-weight: 500;
}

/* ===== Status pill ===== */

.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
}
.status-pill::before {
  content: "●";
  margin-right: 6px;
  font-size: 14px;
}
.status-pill[data-status="ativo"]::before { color: var(--accent); }
.status-pill[data-status="vencido_renegociar"]::before,
.status-pill[data-status="atencao"]::before { color: var(--warning); }
.status-pill[data-status="encerrado"]::before,
.status-pill[data-status="cancelado"]::before { color: var(--text-muted); }

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: #F5F4F3; }
.btn--primary {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.btn--primary:hover { background: #2A2826; }

/* ===== Forms ===== */

.form-section {
  margin-bottom: var(--space-xl);
}
.form-section h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 var(--space) 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.form-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: var(--space);
  padding: var(--space-sm) 0;
}
.form-row label {
  color: var(--text-muted);
  font-size: 13px;
}
.form-row input,
.form-row select,
.form-row textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  width: 100%;
  max-width: 480px;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
}

/* ===== Detail page ===== */

.detail-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space);
  margin-bottom: var(--space-xl);
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
}
.detail-card__label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-sm);
}
.detail-card__value {
  font-size: 22px;
  font-weight: 600;
}
.detail-card__sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}
.history-table th,
.history-table td {
  padding: var(--space-sm) var(--space);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.history-table th {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* ===== Upload dropzone ===== */

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.dropzone--hover {
  border-color: var(--accent);
  background: rgba(79, 122, 79, 0.04);
}

/* ===== Misc ===== */

.loading {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
}
.muted { color: var(--text-muted); }
.error-banner {
  background: #FEE2E2;
  color: var(--danger);
  padding: var(--space) var(--space-lg);
  border-radius: var(--radius);
  margin-bottom: var(--space-lg);
}
