.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --bg: #f7f5fb;
  --paper: #fff;
  --text: #1a1528;
  --muted: #6b6580;
  --line: rgb(26 21 40 / 0.08);
  --purple: #7c4dda;
  --purple-dark: #6238b8;
  --sidebar-from: #150f24;
  --sidebar-to: #211534;
  --font-title: "Space Grotesk", system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background: var(--bg);
}
h1, h2, h3 { font-family: var(--font-title); letter-spacing: -0.02em; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
  background: linear-gradient(135deg, var(--sidebar-from), var(--sidebar-to));
}
.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 24px 48px rgb(0 0 0 / 0.25);
}
.login-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
}
.login-card .lead {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}
.form { display: grid; gap: 1rem; }
.form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
}
.form input {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--text);
  font-weight: 400;
  font-family: var(--font-body);
}
.form select {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--text);
  font-weight: 400;
  font-family: var(--font-body);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b6580' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}
.form textarea {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  resize: vertical;
}
.err { color: #dc2626; margin: 0; font-size: 0.85rem; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
}
button.primary {
  background: var(--purple);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  transition: background 0.15s;
}
button.primary:hover { background: var(--purple-dark); }
button.ghost {
  background: transparent;
  color: rgb(255 255 255 / 0.75);
  border: 1px solid rgb(255 255 255 / 0.15);
  padding: 0.55rem 1rem;
  border-radius: 10px;
}
button.ghost:hover { background: rgb(255 255 255 / 0.06); color: #fff; }

/* App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar-from), var(--sidebar-to));
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 0;
}
.sidebar-brand {
  padding: 0 1.25rem 1.5rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  margin-bottom: 1rem;
}
.sidebar-brand strong {
  display: block;
  font-family: var(--font-title);
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.sidebar-brand span {
  font-size: 0.75rem;
  color: rgb(255 255 255 / 0.5);
}
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.75rem;
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: transparent;
  color: rgb(255 255 255 / 0.72);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: rgb(255 255 255 / 0.06);
  color: #fff;
}
.nav-item.active {
  background: var(--purple);
  color: #fff;
}
.sidebar-footer {
  padding: 1rem 1.25rem 0;
  border-top: 1px solid rgb(255 255 255 / 0.08);
  margin-top: 1rem;
}

.main-area {
  flex: 1;
  padding: 2rem 2.25rem;
  overflow: auto;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  margin: 0;
  font-size: 1.75rem;
}
.page-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.toolbar input,
.toolbar select {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
}
.toolbar input { flex: 1; min-width: 180px; }
.toolbar select { min-width: 140px; }

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgb(26 21 40 / 0.04);
}
.filters-search {
  flex: 1 1 220px;
  min-width: 180px;
}
.filters-search input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
}
.filters-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(124 77 218 / 0.12);
}
.filters-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 0.85rem;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 130px;
}
.filter-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.filter-field select {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  min-width: 140px;
}
.filter-field select:focus {
  outline: none;
  border-color: var(--accent);
}
.filters-bar .view-toggle {
  margin-left: auto;
  align-self: flex-end;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.15rem;
}
.stat-card span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}
.stat-card strong {
  font-family: var(--font-title);
  font-size: 1.5rem;
  letter-spacing: -0.03em;
}

.leads-grid {
  display: grid;
  gap: 0.75rem;
}
.lead-card {
  display: flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgb(26 21 40 / 0.04);
}
.lead-stripe {
  width: 5px;
  flex-shrink: 0;
}
.lead-stripe.pendente { background: #f59e0b; }
.lead-stripe.atrasado { background: #ef4444; }
.lead-stripe.negociacao { background: #7c4dda; }
.lead-stripe.aguardando { background: #3b82f6; }

.lead-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  flex-wrap: wrap;
}
.lead-info h3 {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 600;
}
.lead-info p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.lead-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.lead-valor {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1.05rem;
}
.badge-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  text-transform: capitalize;
}
.badge-status.pendente { background: #fef3c7; color: #92400e; }
.badge-status.atrasado { background: #fee2e2; color: #991b1b; }
.badge-status.negociacao { background: #ede9fe; color: #5b21b6; }
.badge-status.aguardando { background: #dbeafe; color: #1e40af; }

button.btn-sm {
  background: var(--bg);
  color: var(--purple);
  border: 1px solid rgb(124 77 218 / 0.25);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.8rem;
}
button.btn-sm:hover { background: rgb(124 77 218 / 0.08); }

.coming-soon {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 0.9rem; }
.banner-err { margin-bottom: 1rem; }
.banner-ok {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.lead-sub { font-size: 0.8rem !important; margin-top: 0.15rem !important; }
.user-tag {
  display: block;
  font-size: 0.75rem;
  color: rgb(255 255 255 / 0.55);
  margin-bottom: 0.5rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(21 15 36 / 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 100;
}
.modal {
  background: var(--paper);
  border-radius: 16px;
  padding: 1.5rem;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 40px rgb(0 0 0 / 0.2);
}
.modal-wide { width: min(640px, 100%); }
.modal h2 { margin: 0 0 0.5rem; font-size: 1.25rem; }
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.parcelas-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0;
}
.parcelas-fieldset legend {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0 0.25rem;
}
.parcela-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}
.parcela-row input { flex: 1; min-width: 0; }
.modo-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.modo-btn {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.modo-btn.active {
  background: rgb(124 77 218 / 0.12);
  border-color: rgb(124 77 218 / 0.35);
  color: var(--purple);
}
.parcelas-resumo {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}
.resumo-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.resumo-box span {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.resumo-box strong {
  font-size: 0.95rem;
  font-family: var(--font-title);
}
.grupo-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.grupo-row input { flex: 1; min-width: 0; }
.grupo-x {
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}
.parcelas-fieldset label { margin-top: 0.5rem; }
button.btn-sm.boleto {
  color: #0369a1;
  border-color: rgb(3 105 161 / 0.25);
}
button.btn-sm.boleto:hover { background: #e0f2fe; }
.cobranca-cell .cobranca-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

button.btn-sm.danger {
  color: #991b1b;
  border-color: rgb(239 68 68 / 0.35);
}
button.btn-sm.danger:hover { background: #fee2e2; }
.detail-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0;
  font-size: 0.875rem;
  font-weight: 600;
}
.parcelas-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.parcelas-table th,
.parcelas-table td {
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.acoes-cell { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.cronograma-block {
  margin-top: 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: visible;
  box-shadow: 0 4px 20px rgb(26 21 40 / 0.06);
}
.cronograma-header {
  padding: 0.9rem 1.25rem;
  background: var(--purple);
  border-bottom: none;
  border-radius: 15px 15px 0 0;
}
.cronograma-header .section-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}
.cronograma-table-wrap {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0.75rem 0.75rem;
}
.cronograma-table {
  font-size: 0.875rem;
  width: 100%;
  table-layout: fixed;
}
.cronograma-table .col-parcela { width: 6%; }
.cronograma-table .col-mes { width: 11%; }
.cronograma-table .col-venc { width: 13%; }
.cronograma-table .col-valor { width: 13%; }
.cronograma-table .col-status { width: 14%; }
.cronograma-table .col-data { width: 13%; }
.cronograma-table .col-acoes { width: 11%; }
.cronograma-table thead { background: #f3f0f9; }
.cronograma-table th {
  padding: 0.55rem 0.5rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.cronograma-table th:first-child { text-align: center; }
.cronograma-table th:nth-child(4) { text-align: right; }
.cronograma-table td {
  padding: 0.6rem 0.5rem;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.cronograma-table tbody tr { transition: background 0.12s; }
.cronograma-table tbody tr:nth-child(even) { background: rgb(124 77 218 / 0.02); }
.cronograma-table tbody tr:hover { background: rgb(124 77 218 / 0.05); }
.cronograma-table tbody tr:last-child td { border-bottom: none; }
.cronograma-table td:first-child {
  font-weight: 700;
  color: var(--purple);
  text-align: center;
  width: 3.5rem;
}
.cronograma-table td:nth-child(4) {
  font-weight: 700;
  white-space: nowrap;
  text-align: right;
}
.cronograma-table td:nth-child(6),
.cronograma-table td:nth-child(7) {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.78rem;
}
.cronograma-table .badge-status {
  display: inline-block;
  min-width: 5rem;
  text-align: center;
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
}
.cronograma-table .acoes-cell {
  display: table-cell;
  vertical-align: middle;
  white-space: nowrap;
  text-align: center;
  padding: 0.6rem 0.35rem;
}
.cronograma-table .acoes-cell .btn-sm {
  min-width: 4.5rem;
}
.cronograma-table .acoes-box {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  min-width: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
.cronograma-table .acoes-box .btn-sm {
  width: auto;
  padding: 0.32rem 0.55rem;
  font-size: 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
  text-align: center;
  line-height: 1.2;
}

.view-toggle { display: flex; gap: 0.35rem; }
.view-toggle .modo-btn { flex: none; min-width: 72px; }
.mb-1 { margin-bottom: 1rem; }

.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th, .data-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.row-total { font-weight: 700; background: var(--bg); }

.modal-xl { width: min(980px, 100%); }
.detail-cards { margin: 1rem 0; }
.section-title { margin: 1rem 0 0.5rem; font-size: 1rem; }

.detail-modal { padding-top: 1.25rem; }
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.detail-header-main h2 {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.detail-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr min(240px, 32%);
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.detail-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.detail-meta-item span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}
.detail-meta-item strong {
  font-size: 0.92rem;
  font-weight: 600;
  word-break: break-word;
}
.detail-finance { margin: 0; }
.detail-finance .stat-card strong { font-size: 1.2rem; }
.stat-card.stat-ok strong { color: #15803d; }
.stat-card.stat-warn strong { color: #1d4ed8; }
.stat-card.stat-info strong { color: var(--purple-dark); }
.detail-sidebar {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.detail-sidebar h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.detail-sidebar p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
}
.detail-edit-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.detail-edit-form .span-2 { grid-column: span 2; }
.detail-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.edit-parcelas-table input,
.edit-parcelas-table select {
  width: 100%;
  min-width: 0;
  font-size: 0.85rem;
}
.edit-parcelas-table td:last-child {
  width: 2.5rem;
  text-align: center;
}
.detail-edit-form .parcelas-fieldset {
  margin: 0;
}
@media (max-width: 720px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-meta-grid { grid-template-columns: 1fr; }
  .detail-finance.stats-row-4 { grid-template-columns: repeat(2, 1fr); }
  .detail-edit-form { grid-template-columns: 1fr; }
  .detail-edit-form .span-2 { grid-column: span 1; }
}

.mes-nav { display: flex; align-items: center; gap: 0.75rem; }
.mes-label { font-weight: 600; min-width: 140px; text-align: center; }
.text-warn { color: #b45309; }
.text-ok { color: #15803d; }

.stats-row-4 { grid-template-columns: repeat(4, 1fr); }
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.chart-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}
.chart-card h3 { margin: 0 0 0.75rem; font-size: 0.95rem; }
.chart-wide { grid-column: span 2; }
.chart-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.chart-legend { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.8rem; color: var(--muted); }

.bar-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 32px; gap: 0.5rem; align-items: center; font-size: 0.8rem; }
.bar-track { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--purple); border-radius: 999px; }

.vencimentos-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgb(26 21 40 / 0.06);
}
.vencimentos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: linear-gradient(135deg, rgb(124 77 218 / 0.08), rgb(59 130 246 / 0.06));
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.vencimentos-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--purple-dark);
}
.vencimentos-toggle { display: flex; gap: 0.35rem; }
.vencimentos-toggle .modo-btn { flex: none; min-width: 88px; }
.vencimentos-list {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.vencimento-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: box-shadow 0.15s;
}
.vencimento-card:hover { box-shadow: 0 2px 8px rgb(26 21 40 / 0.06); }
.vencimento-info strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}
.vencimento-dias {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #15803d;
}
.vencimento-dias.pendente { color: #15803d; }
.vencimento-dias.hoje { color: #a16207; }
.vencimento-dias.inadimplente { color: #b91c1c; }
.vencimento-dias.pago { color: #1d4ed8; }
.vencimento-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.vencimento-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}
.vencimento-data {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  background: rgb(34 197 94 / 0.12);
  color: #15803d;
  border-radius: 999px;
}
.vencimento-data.pendente {
  background: rgb(34 197 94 / 0.12);
  color: #15803d;
}
.vencimento-data.hoje {
  background: rgb(234 179 8 / 0.18);
  color: #a16207;
}
.vencimento-data.inadimplente {
  background: rgb(239 68 68 / 0.12);
  color: #b91c1c;
}
.vencimento-data.pago {
  background: rgb(59 130 246 / 0.12);
  color: #1d4ed8;
}
.vencimento-valor { font-size: 0.85rem; font-weight: 700; }
.vencimentos-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  font-weight: 700;
  font-size: 0.9rem;
}
.vencimentos-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.check-inline { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; font-weight: 500; }
.form label.check-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}
.form label.check-inline input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--purple);
  margin: 0;
}
.produto-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  margin: 0;
}
.produto-fieldset legend {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0 0.25rem;
}
.produto-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.produto-chip {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.produto-chip:hover {
  border-color: rgb(124 77 218 / 0.35);
  color: var(--text);
}
.produto-chip.selected {
  background: rgb(124 77 218 / 0.12);
  border-color: rgb(124 77 218 / 0.45);
  color: var(--purple-dark);
  box-shadow: 0 0 0 2px rgb(124 77 218 / 0.1);
}

.membro-card.membro-editing {
  border-color: rgb(124 77 218 / 0.55);
  box-shadow: 0 0 0 2px rgb(124 77 218 / 0.15);
}

.cadastro-panel {
  scroll-margin-top: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgb(26 21 40 / 0.04);
  margin-bottom: 1.5rem;
}
.cadastro-panel h2 {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
}
.cadastro-form {
  max-width: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}
.cadastro-form .span-2 { grid-column: span 2; }
.cadastro-checks {
  grid-column: span 2;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--line);
}
.empty-hint { margin: 0.5rem 0 0; }

.form-section, .membros-section { margin-bottom: 2rem; }
.form-grid { max-width: 720px; }
.form-actions { display: flex; gap: 0.5rem; align-items: center; }
.corner-group { margin-bottom: 1.5rem; }
.corner-group h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.membros-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.75rem; }
.membro-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.membro-card:hover {
  border-color: rgb(124 77 218 / 0.35);
  box-shadow: 0 4px 12px rgb(26 21 40 / 0.06);
}
.membro-card strong { font-size: 0.95rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
.membro-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }

@media (max-width: 768px) {
  .cadastro-form { grid-template-columns: 1fr; }
  .cadastro-form .span-2,
  .cadastro-checks { grid-column: span 1; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .stats-row, .stats-row-4 { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-wide { grid-column: span 1; }
  .main-area { padding: 1.25rem; }
}
