/* Gestão de Cobrança — tema (verde e amarelo sobre Bootstrap 5) */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../vendor/inter/inter-latin-wght-normal.woff2') format('woff2');
}

:root {
  --jd-green: #367C2B;
  --jd-darkgreen: #2A6321;
  --jd-yellow: #FFDE00;
  --jd-dark: #1a1a1a;
  --jd-light: #f4f7f6;
  --card-shadow: 0 4px 20px 1px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.08);
  --card-radius: 12px;
}

body {
  background-color: var(--jd-light);
  color: #4b5563;
  min-height: 100vh;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  color: #1f2937;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Estrutura */
.app-container { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--jd-green) 0%, var(--jd-darkgreen) 100%);
  color: white;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0,0,0,0.08);
  z-index: 10;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 0.75rem;
  text-align: center;
}

.sidebar-header h2 {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--jd-yellow);
  margin: 0;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sidebar-user { color: rgba(255,255,255,0.75); font-size: 0.8rem; margin-top: 0.75rem; }
.sidebar-section {
  padding: 0.9rem 1.75rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
}

.nav-item {
  padding: 0.65rem 1.25rem;
  color: rgba(255,255,255,0.8);
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  margin: 0.15rem 0.75rem;
  border-radius: 8px;
  gap: 12px;
  background: none;
  border: none;
  text-align: left;
  width: calc(100% - 1.5rem);
}
.nav-item i { font-size: 1.05rem; width: 20px; text-align: center; }
.nav-item:hover, .nav-item:focus-visible { background-color: rgba(255,255,255,0.12); color: white; }
.nav-item.active {
  background-color: var(--jd-yellow);
  color: var(--jd-darkgreen);
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255,222,0,0.3);
}
.nav-item.nav-logout { color: #fecaca; }
.sidebar-footer { margin-top: auto; padding: 0.75rem 0 1rem; border-top: 1px solid rgba(255,255,255,0.1); }

.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.content-scroll { flex: 1; padding: 2rem; overflow-y: auto; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
  z-index: 5;
}

/* Painéis */
.glass-panel {
  background-color: white;
  box-shadow: var(--card-shadow);
  border-radius: var(--card-radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.stat-card { position: relative; overflow: hidden; height: 100%; margin-bottom: 0; }
.stat-card .stat-icon { position: absolute; right: -10px; bottom: -20px; opacity: 0.15; font-size: 6rem; line-height: 1; }
.stat-card .stat-label { font-size: 0.8rem; font-weight: 600; margin: 0; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; margin: 0.75rem 0 0; }
.stat-yellow { background: linear-gradient(135deg, var(--jd-yellow) 0%, #e6c800 100%); }
.stat-yellow .stat-label, .stat-yellow .stat-value { color: var(--jd-darkgreen); }
.stat-blue { background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); }
.stat-green { background: linear-gradient(135deg, var(--jd-green) 0%, var(--jd-darkgreen) 100%); }
.stat-blue .stat-label, .stat-green .stat-label { color: rgba(255,255,255,0.8); }
.stat-blue .stat-value, .stat-green .stat-value, .stat-blue .stat-icon, .stat-green .stat-icon { color: white; }

.count-card { text-align: center; height: 100%; margin-bottom: 0; border-bottom: 4px solid var(--accent, #6b7280); display: block; text-decoration: none; }
.count-card .count-label { font-size: 0.78rem; font-weight: 600; color: #6b7280; margin: 0; }
.count-card .count-value { font-size: 1.75rem; font-weight: 700; margin: 0.6rem 0 0; color: var(--accent, #374151); }
a.count-card:hover { box-shadow: 0 10px 30px 1px rgba(0,0,0,0.1); }

/* Barras de faixa de atraso */
.aging-row { display: grid; grid-template-columns: 9.5rem 1fr 9rem; gap: 0.75rem; align-items: center; padding: 0.35rem 0; font-size: 0.875rem; }
.aging-track { background: #f3f4f6; border-radius: 6px; height: 0.9rem; overflow: hidden; }
.aging-bar { background: linear-gradient(90deg, var(--jd-green), #6fae5f); height: 100%; border-radius: 6px; min-width: 2px; }
.aging-value { text-align: right; font-variant-numeric: tabular-nums; }

/* Formulários */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; margin-bottom: 0.4rem; font-size: 0.85rem; font-weight: 600; color: #4b5563; }
.form-control, .form-select {
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 0.55rem 0.9rem;
  font-size: 0.95rem;
  background-color: #f9fafb;
}
.form-control:focus, .form-select:focus {
  border-color: var(--jd-green);
  background-color: white;
  box-shadow: 0 0 0 0.25rem rgba(54,124,43,0.15);
}
.form-check-input:checked { background-color: var(--jd-green); border-color: var(--jd-green); }
.form-check-input:focus { border-color: var(--jd-green); box-shadow: 0 0 0 0.25rem rgba(54,124,43,0.15); }

/* Botões */
.btn { font-weight: 600; border-radius: 8px; padding: 0.5rem 1.25rem; font-size: 0.9rem; }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-primary {
  background: linear-gradient(135deg, var(--jd-green) 0%, var(--jd-darkgreen) 100%);
  border: none;
  color: white;
  box-shadow: 0 4px 10px rgba(54,124,43,0.25);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background: var(--jd-darkgreen) !important;
  color: white !important;
}
.btn-outline-primary { color: var(--jd-green); border-color: var(--jd-green); }
.btn-outline-primary:hover, .btn-outline-primary:active { background: var(--jd-green) !important; border-color: var(--jd-green) !important; color: white !important; }
a { color: var(--jd-green); }
a:hover { color: var(--jd-darkgreen); }

/* Tabelas */
.table { margin-bottom: 0; }
.table th {
  padding: 0.85rem 1rem;
  color: #6b7280;
  font-weight: 700;
  font-size: 0.78rem;
  border-bottom: 2px solid #f3f4f6;
  white-space: nowrap;
}
.table td { padding: 0.85rem 1rem; vertical-align: middle; font-size: 0.9rem; color: #4b5563; border-bottom: 1px solid #f3f4f6; }
.table tbody tr:hover { background-color: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Selos de status */
.badge { padding: 0.35rem 0.7rem; border-radius: 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; }
.badge-primary  { background-color: #cce5ff; color: #004085; }
.badge-novo     { background-color: #e0e7ff; color: #4338ca; }
.badge-warning  { background-color: #ffedd5; color: #9a3412; }
.badge-danger   { background-color: #fee2e2; color: #b91c1c; }
.badge-success  { background-color: #dcfce7; color: #15803d; }
.badge-judicial { background-color: #e2e3e5; color: #383d41; }
.badge-neutral  { background-color: #f3f4f6; color: #6b7280; }

/* Histórico */
.history-item { border-bottom: 1px solid #f3f4f6; padding: 1rem 0; }
.history-item:last-child { border-bottom: none; }
.history-text { white-space: pre-line; overflow-wrap: anywhere; margin-bottom: 0.5rem; }
.detail-grid dt { font-size: 0.78rem; font-weight: 600; color: #6b7280; }
.detail-grid dd { margin-bottom: 0.9rem; color: #1f2937; overflow-wrap: anywhere; }

.pagination .page-link { color: var(--jd-green); }
.pagination .active .page-link { background-color: var(--jd-green); border-color: var(--jd-green); color: white; }

.audit-json { font-size: 0.75rem; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; max-width: 28rem; color: #374151; }

/* Tela de login e páginas sem menu */
.guest-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }
.guest-card { width: 100%; max-width: 420px; }
.guest-card.wide { max-width: 520px; }
.brand-title { color: var(--jd-green); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.025em; }

/* Calendário */
.fc .fc-button-primary { background: var(--jd-green); border-color: var(--jd-green); }
.fc .fc-button-primary:not(:disabled):active,
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:hover { background: var(--jd-darkgreen); border-color: var(--jd-darkgreen); }
.fc .fc-toolbar-title { font-weight: 700; color: var(--jd-darkgreen); font-size: 1.4rem; }
.fc .fc-daygrid-day.fc-day-today { background-color: rgba(255,222,0,0.12) !important; }
.fc-event { cursor: pointer; }

/* Telas menores: menu vira faixa no topo */
@media (max-width: 991.98px) {
  .app-container { flex-direction: column; height: auto; overflow: visible; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.5rem; overflow: visible; }
  .sidebar-header { border: none; margin: 0; padding: 0.5rem 1rem; text-align: left; }
  .sidebar-user, .sidebar-section { display: none; }
  .nav-item { width: auto; margin: 0.15rem; padding: 0.5rem 0.75rem; }
  .sidebar-footer { margin: 0; padding: 0; border: none; display: flex; }
  .main-content, .content-scroll { overflow: visible; }
  .content-scroll { padding: 1rem; }
  .topbar { display: none; }
  .aging-row { grid-template-columns: 7rem 1fr; }
  .aging-value { grid-column: 1 / -1; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
