/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === Body === */
body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* === CRITICO: heranca de fonte em forms === */
button, input, select, textarea {
  font-family: inherit;
}

/* === Links === */
a {
  color: var(--cor-primaria);
  text-decoration: none;
}
a:hover {
  color: var(--cor-primaria-escura);
}

/* === Titulos === */
h1, h2, h3, h4, h5 {
  font-family: var(--font-titulo);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  line-height: 1.2;
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

/* === Imagens === */
img {
  max-width: 100%;
  height: auto;
}

/* === Tabelas === */
.tabela {
  width: 100%;
  border-collapse: collapse;
}

.tabela th {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  text-align: left;
  padding: 10px 12px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.tabela td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.tabela tr:hover td {
  background: var(--cor-primaria-suave);
}

/* === Botoes === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--cor-primaria);
  color: var(--text-inverse);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--cor-primaria-escura);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 212, 170, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--cor-primaria);
  color: var(--text-inverse);
  border-color: var(--cor-primaria);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-success {
  background: transparent;
  color: var(--success);
  border: 1px solid var(--success);
}

.btn-success:hover {
  background: var(--success);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  gap: 4px;
}

.btn-sm i {
  font-size: 14px;
}

.btn-icon {
  padding: 6px 8px;
  min-width: 32px;
  height: 32px;
}

.btn-icon i {
  font-size: 16px;
}

.btn-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

/* === Tabela Acoes === */
.acoes-cell {
  text-align: right;
  white-space: nowrap;
}

.acoes-cell .btn {
  vertical-align: middle;
}

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  box-shadow: var(--shadow);
}

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.badge-pendente {
  background: rgba(251, 191, 36, 0.1);
  color: #f59e0b;
}

.badge-pago {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-atrasado {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* === Formularios === */
.campo {
  margin-bottom: 20px;
}

.campo label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"],
.campo input[type="number"],
.campo input[type="date"],
.campo select,
.campo textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: all 0.2s ease;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  outline: none;
  border-color: var(--cor-primaria);
  box-shadow: 0 0 0 3px var(--cor-primaria-suave);
  background: var(--surface);
}

.campo input::placeholder,
.campo textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.campo .hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.form-actions .btn {
  flex: 1;
  justify-content: center;
  padding: 12px 20px;
  font-size: 14px;
}

.form-section {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cor-primaria);
  margin: 24px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* === Flash messages === */
@keyframes flashIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-container {
  position: sticky;
  top: 60px;
  z-index: 9999;
  padding: 8px 16px;
}

.flash {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  animation: flashIn 0.3s ease;
  position: relative;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.flash:hover {
  opacity: 0.8;
}

.flash::after {
  content: '\00d7';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  opacity: 0.5;
}

.flash:hover::after {
  opacity: 1;
}

.flash-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-left: 4px solid #10b981;
}

.flash-error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-left: 4px solid #ef4444;
}

.flash-info {
  background: rgba(0, 212, 170, 0.15);
  color: var(--cor-primaria);
  border-left: 4px solid var(--cor-primaria);
}

/* === Utilitarios === */
.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.mt-4 { margin-top: var(--sp-4); }
.mb-4 { margin-bottom: var(--sp-4); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: var(--sp-2); }
.gap-4 { gap: var(--sp-4); }

/* === KPI Cards === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cor-primaria);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.kpi-valor {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

/* === Section Headers === */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

/* === Empty States === */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}

.empty-state i {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
  opacity: 0.4;
}

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

/* === List Items (para entradas/saidas) === */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
  gap: 16px;
}

.list-item:hover {
  background: var(--cor-primaria-suave);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.list-item-titulo {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-sub {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
}

.list-item-valor {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* === Status Indicator === */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.pago { background: var(--success); }
.status-dot.pendente { background: #f59e0b; }
.status-dot.atrasado { background: var(--danger); }

/* === Page Header === */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 700;
}

/* === Cards com borda colorida === */
.card-accent-success { border-left: 3px solid var(--success); }
.card-accent-danger { border-left: 3px solid var(--danger); }
.card-accent-primary { border-left: 3px solid var(--cor-primaria); }
