/* ============================================================
   Koinonia — Sistema de Gestão de Igrejas
   Estilos principais
   ============================================================ */

:root {
  --primary: #4338ca;
  --primary-dark: #312890;
  --primary-light: #6366f1;
  --accent: #3b82f6;
  --accent-light: #bfdbfe;
  --bg: #f4f5fa;
  --surface: #ffffff;
  --text: #1f2333;
  --text-muted: #6b7080;
  --border: #e7e8f1;
  --success: #1aa179;
  --success-bg: #e6f7f1;
  --danger: #d8485f;
  --danger-bg: #fcebee;
  --warning: #d99a2b;
  --warning-bg: #fdf3e2;
  --info: #2f7ed8;
  --info-bg: #e8f2fd;
  --sidebar-bg: #1c1b3a;
  --sidebar-bg-2: #16152e;
  --sidebar-text: #c7c6e0;
  --sidebar-text-active: #ffffff;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 10px rgba(28, 27, 58, 0.06);
  --shadow-md: 0 6px 24px rgba(28, 27, 58, 0.10);
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }

h1, h2, h3, h4, h5 { font-family: 'Poppins', 'Inter', sans-serif; font-weight: 600; margin: 0 0 4px; color: var(--text); }

/* ===================== Layout ===================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1000;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 26px 24px 18px;
}

.sidebar-brand .logo-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 19px;
  color: #fff;
  line-height: 1.1;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: var(--sidebar-text);
  opacity: .7;
}

.sidebar-section-label {
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 18px 24px 6px;
  font-weight: 600;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 12px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active {
  background: rgba(255,255,255,.08);
  color: #fff;
  border-left-color: var(--accent);
}
.sidebar-nav a i { width: 19px; text-align: center; font-size: 16px; opacity: .9; }

.sidebar-foot {
  padding: 16px 24px 22px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12.5px;
  color: rgba(255,255,255,.5);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.sidebar-user .u-name { color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.sidebar-user .u-role { font-size: 11px; color: var(--accent-light); text-transform: uppercase; letter-spacing: .04em; }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

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

.topbar .page-title { font-size: 20px; font-weight: 600; }
.topbar .page-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.menu-toggle {
  display: none;
  background: none; border: none; font-size: 22px; color: var(--text);
  cursor: pointer;
}

.content { padding: 26px 28px 50px; flex: 1; }

/* ===================== Componentes ===================== */

.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card-body { padding: 22px; }

.card-header-x {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.card-header-x h3 { font-size: 16.5px; margin: 0; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 13px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 2px;
}
.stat-card > div:last-child { min-width: 0; overflow: hidden; }
.stat-card .stat-value {
  font-size: clamp(13px, 1.8vw, 17px) !important;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  line-height: 1.2;
  white-space: normal;
  word-break: break-all;
  overflow-wrap: anywhere;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
}

.bg-violet { background: #ece9fe; color: var(--primary); }
.bg-gold { background: #eff6ff; color: #1d4ed8; }
.bg-green { background: var(--success-bg); color: var(--success); }
.bg-red { background: var(--danger-bg); color: var(--danger); }
.bg-blue { background: var(--info-bg); color: var(--info); }
.bg-orange { background: var(--warning-bg); color: var(--warning); }

.chart-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  margin-bottom: 24px;
}
@media (max-width: 980px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-wrap { position: relative; height: 280px; }

/* Botões */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #1d4ed8; }
.btn-outline {
  background: #d7dbe5;
  border: 1px solid #c4cad8;
  color: #3a4253;
}
.btn-outline:hover {
  background: #c9cfdd;
}
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f6d4da; }
.btn-success { background: var(--success-bg); color: var(--success); }
.btn-success:hover { background: #cdeee2; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Formulários */
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; display: block; }
.form-control, .form-select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color .15s;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; }
.form-text-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 80px; }

.input-radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.input-radio-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  transition: all .15s;
}
.input-radio-card input { accent-color: var(--primary); }
.input-radio-card.checked-dizimo { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.input-radio-card.checked-oferta { border-color: var(--accent); background: #eff6ff; color: #1d4ed8; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.table th {
  text-align: left;
  padding: 12px 16px;
  background: #fafafe;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.table tbody tr:hover { background: #fafaff; }
table.table tbody tr:last-child td { border-bottom: none; }

.avatar-sm {
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; background: var(--bg); border: 1px solid var(--border);
}
.avatar-placeholder {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-light); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-gold { background: #eff6ff; color: #1d4ed8; }
.badge-blue { background: var(--info-bg); color: var(--info); }
.badge-gray { background: #eef0f5; color: var(--text-muted); }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #2b2563 0%, #16152e 55%, #100f24 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 20px;
  padding: 38px 34px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-logo {
  display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px;
}
.login-logo .logo-mark {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Poppins', sans-serif; font-weight: 700; color: #fff; font-size: 26px;
}
.login-logo h1 { font-size: 21px; margin: 0; }
.login-logo p { font-size: 12.5px; color: var(--text-muted); margin: 0; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 42px; opacity: .35; margin-bottom: 14px; display: block; }

/* Filtros */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 150px; flex: 1; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a {
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
}
.tabs a.active { color: var(--primary); border-color: var(--primary); }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,15,30,.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  padding: 26px;
  box-shadow: var(--shadow-md);
}

/* Photo upload */
.photo-upload {
  display: flex;
  align-items: center;
  gap: 18px;
}
.photo-preview {
  width: 84px; height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--bg);
}

.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.fw-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0 !important; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Responsivo */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: 18px; }
  .topbar { padding: 14px 18px; }
}

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 999;
}
.sidebar-backdrop.show { display: block; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #d6d7e6; border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* ===================== TEMA ESCURO ===================== */
[data-theme="dark"] {
  --primary: #6366f1;
  --primary-dark: #4338ca;
  --primary-light: #818cf8;
  --bg: #0d0d1a;
  --surface: #16162a;
  --text: #e5e6f0;
  --text-muted: #8b8da8;
  --border: #2a2a42;
  --success-bg: #0d2e24;
  --danger-bg: #2e0f15;
  --warning-bg: #2a1e07;
  --info-bg: #0a1e35;
  --shadow: 0 2px 10px rgba(0,0,0,0.35);
  --shadow-md: 0 6px 24px rgba(0,0,0,0.45);
}
[data-theme="dark"] .topbar {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .card {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .stat-card {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: #1e1e36;
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] table.table th {
  background: #1a1a30;
  border-color: var(--border);
}
[data-theme="dark"] table.table td { border-color: var(--border); }
[data-theme="dark"] table.table tbody tr:hover { background: #1e1e34; }
[data-theme="dark"] .filter-bar {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .login-card { background: #1a1a30; }
[data-theme="dark"] .modal-box { background: #1e1e36; border: 1px solid var(--border); }
[data-theme="dark"] .bg-violet { background: #1e1b4b; }
[data-theme="dark"] .bg-green  { background: #0a2118; }
[data-theme="dark"] .bg-gold   { background: #172554; }
[data-theme="dark"] .bg-red    { background: #2a0c12; }
[data-theme="dark"] .bg-blue   { background: #071b30; }
[data-theme="dark"] .badge-gray { background: #2a2a42; color: var(--text-muted); }
[data-theme="dark"] .tabs { border-color: var(--border); }
[data-theme="dark"] .tabs a { color: var(--text-muted); }
[data-theme="dark"] .btn-outline {
  background: #34384a;
  border-color: #44495e;
  color: #eef1f7;
}
[data-theme="dark"] .btn-outline:hover {
  background: #40465d;
}
[data-theme="dark"] .input-radio-card { border-color: var(--border); color: var(--text); }
[data-theme="dark"] .avatar-placeholder { background: var(--primary); }
[data-theme="dark"] .card-header-x { border-color: var(--border); }
[data-theme="dark"] .sidebar-foot { color: rgba(255,255,255,.35); }

/* ===================== Tema: botão toggle ===================== */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 17px;
  transition: all .15s;
}
.theme-toggle:hover { background: var(--bg); color: var(--text); }

/* ===================== Notificações (sino) ===================== */
.notif-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 17px;
  transition: all .15s;
}
.notif-btn:hover { background: var(--bg); color: var(--text); }
.notif-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ===================== Impersonation banner ===================== */
.impersonate-bar {
  background: linear-gradient(90deg, #1e40af, #3b82f6);
  color: #fff;
  padding: 9px 28px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.impersonate-bar a {
  background: rgba(255,255,255,.2);
  border-radius: 6px;
  padding: 5px 12px;
  color: #fff;
  font-size: 12.5px;
}
.impersonate-bar a:hover { background: rgba(255,255,255,.35); }

/* ===================== Conta bloqueada ===================== */
.blocked-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.blocked-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  padding: 40px 36px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.blocked-icon {
  font-size: 56px;
  color: var(--danger);
  margin-bottom: 18px;
}

/* ===================== Fatura modal ===================== */
.invoice-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
  background: var(--bg);
  font-size: 14px;
}
.invoice-preview h4 { font-size: 16px; margin-bottom: 10px; }
.invoice-preview .inv-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.invoice-preview .inv-row:last-child { border-bottom: none; }
.inv-total { font-size: 20px; font-weight: 700; color: var(--primary); margin-top: 10px; }

/* ===================== Credencial / Documentos ===================== */
.credential-card {
  width: 340px;
  background: linear-gradient(135deg, #1c1b3a 0%, #312890 100%);
  border-radius: 18px;
  padding: 28px 22px 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  font-family: 'Poppins','Inter',sans-serif;
  box-shadow: 0 8px 32px rgba(67,56,202,.35);
}
.credential-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.credential-card::after {
  content: '';
  position: absolute;
  bottom: -30px; left: -30px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(212,168,67,.08);
}
.cred-logo { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .7; margin-bottom: 16px; }
.cred-photo {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #3b82f6;
  margin-bottom: 12px;
}
.cred-photo-placeholder {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
  margin-bottom: 12px;
  border: 3px solid #3b82f6;
}
.cred-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.cred-role { font-size: 12.5px; opacity: .75; margin-bottom: 2px; }
.cred-church { font-size: 11.5px; color: #3b82f6; margin-bottom: 14px; }
.cred-id { font-size: 10px; opacity: .5; letter-spacing: .06em; margin-top: 8px; }
.cred-footer {
  border-top: 1px solid rgba(255,255,255,.12);
  margin-top: 14px;
  padding-top: 10px;
  font-size: 10px;
  opacity: .55;
}
.cred-qr { background: #fff; border-radius: 8px; padding: 4px; display: inline-block; margin-top: 4px; }

/* Documentos / Certificados */
.doc-page {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  color: #1f2333;
  padding: 60px;
  font-family: 'Times New Roman', Times, serif;
  line-height: 1.8;
}
.doc-header { text-align: center; margin-bottom: 30px; }
.doc-header h2 { font-size: 22px; text-transform: uppercase; letter-spacing: .06em; }
.doc-header .doc-church { font-size: 15px; color: #555; margin-top: 6px; }
.doc-divider { border: none; border-top: 2px solid #1c1b3a; margin: 20px 0; }
.doc-title { text-align: center; font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 30px 0 20px; }
.doc-body { font-size: 14px; text-align: justify; }
.doc-body p { margin: 14px 0; }
.doc-signature { margin-top: 60px; text-align: center; }
.doc-signature .sig-line { border-top: 1px solid #333; width: 260px; margin: 0 auto 8px; }
.doc-footer { text-align: center; font-size: 11px; color: #888; margin-top: 40px; border-top: 1px solid #eee; padding-top: 12px; }

/* Pendente badge */
.badge-orange { background: var(--warning-bg); color: var(--warning); }

/* Public registration page */
.public-wrap {
  min-height: 100vh;
  background: radial-gradient(circle at top left, #2b2563 0%, #16152e 55%, #100f24 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.public-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 36px;
  max-width: 680px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}

@media print {
  body { background: #fff !important; }
  .no-print, .topbar, .sidebar, .app-shell > .main > .topbar,
  .sidebar-backdrop, .btn-print-hide { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .doc-page { box-shadow: none !important; max-width: 100% !important; padding: 20px !important; }
  .credential-card { box-shadow: none !important; }
}

/* ── Documento em modal ── */
.doc-modal-overlay {
  position: fixed; inset: 0; top:0; left:0; right:0; bottom:0;
  background: rgba(0,0,0,.72);
  z-index: 999999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.doc-modal-overlay.show { display: flex; }
.doc-modal-inner {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 760px;
  margin: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
  overflow: hidden;
}
.doc-modal-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.doc-modal-bar h3 { margin: 0; font-size: 15px; }
.doc-modal-content {
  padding: 0;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}
.doc-modal-content iframe {
  width: 100%; min-height: 500px; border: none; display: block;
}

/* ── Credencial melhorada ── */
.cred-card-v2 {
  width: 340px; height: 213px; /* proporção cartão bancário */
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  font-family: 'Poppins', 'Inter', sans-serif;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
}
.cred-card-v2 .cred-bar {
  padding: 10px 16px 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.cred-card-v2 .cred-bar .cred-church-name {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; opacity: .9;
}
.cred-card-v2 .cred-bar .cred-type {
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; opacity: .7;
}
.cred-card-v2 .cred-body {
  flex: 1;
  display: flex; gap: 0;
}
.cred-card-v2 .cred-photo-col {
  width: 88px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 12px 12px;
}
.cred-card-v2 .cred-photo-col img,
.cred-card-v2 .cred-photo-col .cred-initials {
  width: 72px; height: 88px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,.4);
}
.cred-card-v2 .cred-photo-col .cred-initials {
  background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
}
.cred-card-v2 .cred-info {
  flex: 1; padding: 4px 14px 12px 4px;
  display: flex; flex-direction: column; justify-content: center;
}
.cred-card-v2 .cred-cargo {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
  opacity: .75; margin-bottom: 4px;
}
.cred-card-v2 .cred-nome {
  font-size: 14px; font-weight: 700; line-height: 1.3; margin-bottom: 6px;
  word-break: break-word;
}
.cred-card-v2 .cred-constr {
  font-size: 9.5px; opacity: .7; line-height: 1.5;
}
.cred-card-v2 .cred-qr-mini {
  width: 44px; height: 44px;
  background: rgba(255,255,255,.9);
  border-radius: 6px; padding: 2px;
  margin-top: 4px;
}
.cred-card-v2 .cred-foot {
  padding: 7px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 9px; opacity: .65;
}

/* Cores por cargo */
.cred-pastor     { background: linear-gradient(135deg, #1e3a5f 0%, #1e5799 100%); color: #fff; }
.cred-diacono    { background: linear-gradient(135deg, #145a32 0%, #1e8449 100%); color: #fff; }
.cred-presbitero { background: linear-gradient(135deg, #4a235a 0%, #7d3c98 100%); color: #fff; }
.cred-evangelista{ background: linear-gradient(135deg, #7d3c00 0%, #d68910 100%); color: #fff; }
.cred-lider      { background: linear-gradient(135deg, #1a535c 0%, #1abc9c 100%); color: #fff; }
.cred-membro     { background: linear-gradient(135deg, #1c1b3a 0%, #4338ca 100%); color: #fff; }
.cred-outro      { background: linear-gradient(135deg, #424242 0%, #757575 100%); color: #fff; }

/* Verso da credencial */
.cred-verso {
  width: 340px; height: 213px;
  border-radius: 16px;
  background: #f8f8fc;
  border: 1px solid #e0e0e8;
  padding: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #2a2a3a;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.cred-verso::before {
  content: '';
  position: absolute; right: -20px; top: -20px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(67,56,202,.06);
}
.cred-verso-col { display: flex; flex-direction: column; gap: 6px; padding: 4px 8px 0 0; }
.cred-verso-col:last-child { border-left: 1px solid #e0e0e8; padding: 4px 0 0 12px; }
.cred-verso .vrow { line-height: 1.4; }
.cred-verso .vrow b { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; }
.cred-verso .vrow span { font-weight: 600; font-size: 11.5px; color: #1f2333; }
.cred-verso-obs {
  position: absolute; bottom: 10px; left: 16px; right: 16px;
  font-size: 8.5px; color: #9ca3af; line-height: 1.4;
  border-top: 1px solid #e0e0e8; padding-top: 6px;
  font-style: italic;
}



.topbar { overflow: hidden; }
.table-wrap { overflow-x: auto; }

/* ── Certificado de batismo ── */
.doc-page.cert-batismo {
  position: relative;
}
.doc-page.cert-batismo::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 420px; height: 420px;
  border-radius: 50%;
  border: 1px solid rgba(67,56,202,.12);
  pointer-events: none;
}
.doc-page.cert-batismo::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 310px; height: 310px;
  border-radius: 50%;
  border: 1px solid rgba(67,56,202,.08);
  pointer-events: none;
}
.cert-border {
  border: 2.5px solid #4338ca;
  border-radius: 4px;
  padding: 5px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.cert-border-inner {
  border: 1px solid rgba(67,56,202,.3);
  padding: 36px 42px;
}

/* ── Print: forçar cores e backgrounds ── */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  .cred-card-v2, .cred-verso, .doc-page, .cert-border, .cert-border-inner {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .no-print, .topbar, .sidebar, .sidebar-backdrop,
  .impersonate-bar, #themeToggle { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff !important; }
}

/* ── Sidebar: tema claro ── */
:root[data-theme="light"] .sidebar,
html:not([data-theme="dark"]) .sidebar {
  background: linear-gradient(180deg, #1e2d4e 0%, #172240 100%);
}
:root[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #09091a 0%, #0a0a1c 100%);
}

/* ── Scrollbars finos ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,.22); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,.4); }
* { scrollbar-width: thin; scrollbar-color: rgba(128,128,128,.22) transparent; }

/* ── Sidebar - seguir tema ── */
html:not([data-theme="dark"]) .sidebar,
[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, #15294a 0%, #0f1e38 100%) !important;
}
[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #070711 0%, #04040e 100%) !important;
}

/* ── Botões de ação da fatura (temáticos) ── */
.kbtn-action {
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  border-radius: 5px;
  width: 22px; height: 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  text-decoration: none;
  flex-shrink: 0;
  transition: background .12s, color .12s;
  padding: 0;
}
.kbtn-action:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}
.kbtn-action.kbtn-danger { border-color: var(--danger) !important; color: var(--danger) !important; }
.kbtn-action.kbtn-danger:hover { background: var(--danger) !important; color: #fff !important; }
.kbtn-action.kbtn-success { border-color: var(--success) !important; color: var(--success) !important; }
.kbtn-action.kbtn-success:hover { background: var(--success) !important; color: #fff !important; }

/* ── Cards menores ── */
.stat-card {
  padding: 12px 14px !important;
  gap: 10px !important;
}
.stat-card .stat-icon {
  width: 38px !important; height: 38px !important;
  font-size: 16px !important;
}


/* ════════════════════════════════════════════════════════════
   MOBILE RESPONSIVO — @media max-width: 768px
   ════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sidebar: esconde por padrão, abre com JS */
  .sidebar {
    position: fixed !important;
    left: -260px !important;
    top: 0; bottom: 0;
    width: 248px !important;
    z-index: 9000 !important;
    transition: left .25s ease !important;
    overflow-y: auto;
  }
  .sidebar.open { left: 0 !important; }
  .sidebar-backdrop.show {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 8999;
  }

  /* Main: sem margem esquerda */
  .main { margin-left: 0 !important; }

  /* Topbar: compactar */
  .topbar {
    padding: 10px 14px !important;
    flex-wrap: wrap;
    gap: 8px;
  }
  .page-title { font-size: 15px !important; }
  .page-desc  { display: none; }
  .topbar .d-flex { gap: 6px !important; }

  /* Content: menos padding */
  .content { padding: 12px !important; }

  /* Cards stat: 2 colunas em mobile */
  .stat-grid, .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* chart-grid: coluna única */
  .chart-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Tabelas: scroll horizontal */
  .table-wrap { overflow-x: auto !important; }
  .table { min-width: 520px; }
  .table th, .table td { padding: 10px 8px !important; font-size: 12.5px !important; }

  /* form-row: empilhar */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  /* Topbar actions: botões menores */
  .topbar .btn { padding: 6px 10px !important; font-size: 12px !important; }
  .topbar .btn i { margin-right: 0 !important; }
  .topbar .btn span { display: none; }

  /* Modal box: largura total */
  .modal-box { max-width: 100% !important; margin: 10px !important; padding: 20px 16px !important; }

  /* Buttons no form: full width em mobile */
  .form-actions { flex-direction: column !important; }
  .form-actions .btn { width: 100% !important; justify-content: center !important; }

  /* Card: padding menor */
  .card-body { padding: 14px 14px !important; }
  .card-header-x { padding: 12px 14px !important; }

  /* Impersonate bar */
  .impersonate-bar { flex-direction: column !important; gap: 6px !important; padding: 8px 12px !important; font-size: 12px !important; }
  .impersonate-bar a { align-self: flex-start !important; }

  /* Sidebar brand: compactar */
  .sidebar-brand { padding: 16px 14px !important; }
  .brand-name { font-size: 16px !important; }

  /* Botões de ação menores */
  .btn-sm { padding: 5px 10px !important; font-size: 12px !important; }

  /* Fat menu (dropdown ações) */
  .fat-menu { min-width: 160px !important; font-size: 13px !important; }

  /* Campos de form */
  .form-control { font-size: 16px !important; } /* evita zoom no iOS */

  /* Credencial: escala */
  .cred-card-v2, .cred-verso { width: calc(100vw - 40px) !important; max-width: 340px !important; }

  /* Alerta */
  .alert { font-size: 13px !important; padding: 10px 12px !important; }
}

/* Extra pequeno: < 400px */
@media (max-width: 400px) {
  .stat-grid { grid-template-columns: 1fr !important; }
  .topbar .btn:not(.btn-primary) { display: none; }
}


/* AJUSTES RESPONSIVO NO PAINEL ADMIN */
/* ======= MOBILE DASHBOARD ======= */
@media (max-width:768px){

    /* 4 cards superiores */
    .stats-grid{
        display:flex !important;
        flex-direction:column !important;
        gap:12px !important;
    }

    .stats-grid .stat-card{
        width:100% !important;
        max-width:100% !important;
        min-width:100% !important;
        flex:0 0 100% !important;
        box-sizing:border-box;
    }

    /* Cards dos gráficos */
    .chart-grid{
        display:flex !important;
        flex-direction:column !important;
        gap:15px !important;
    }

    .chart-grid .card{
        width:100% !important;
        max-width:100% !important;
        overflow:hidden !important;
        box-sizing:border-box;
    }

    /* Cabeçalho dos gráficos */
    .card-header-x{
        display:flex !important;
        flex-direction:column !important;
        align-items:flex-start !important;
        gap:10px !important;
    }

    .card-header-x .d-flex{
        width:100%;
        flex-wrap:wrap;
    }

    /* Canvas */
    .chart-wrap{
        width:100%;
        height:260px !important;
        overflow:hidden;
    }

    .chart-wrap canvas{
        width:100% !important;
        max-width:100% !important;
    }

}





/* ════════════════════════════════════════════════════════════
   DASHBOARD v2 — adicionar no FINAL do assets/css/style.css
   ════════════════════════════════════════════════════════════ */

/* ─── Stat cards ─── */
.dash2-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.dash2-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash2-stat-icon {
  width: 58px; height: 58px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.dash2-icon-violet { background: #ede9fe; color: #7c3aed; }
.dash2-icon-green  { background: #d1fae5; color: #059669; }
.dash2-icon-orange { background: #ffedd5; color: #ea580c; }
.dash2-icon-blue   { background: #dbeafe; color: #2563eb; }

.dash2-stat-title  { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.dash2-stat-value  { font-size: 34px; font-weight: 700; font-family: 'Poppins', sans-serif; color: var(--text); line-height: 1.1; }
.dash2-stat-sub    { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.dash2-sub-green   { color: var(--success); font-weight: 600; }
.dash2-sub-red     { color: var(--danger);  font-weight: 600; }

.dash2-stat-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  margin-top: 12px; width: fit-content;
}
.dash2-stat-badge span { font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.badge-up   { background: #d1fae5; color: #059669; }
.badge-down { background: #fee2e2; color: #dc2626; }

/* ─── Row gráficos ─── */
.dash2-charts-row {
  display: grid;
  grid-template-columns: 1.7fr 1.1fr 0.85fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: start;
}

/* ─── Donut ─── */
.dash2-donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  /* mesma altura que o gráfico de linha */
  min-height: 230px;
}
/* O canvas precisa de dimensões absolutas para o Chart.js renderizar */
.dash2-donut-canvas {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.dash2-donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.dash2-donut-total { font-size: 24px; font-weight: 700; font-family: 'Poppins',sans-serif; color: var(--text); line-height: 1; }
.dash2-donut-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.dash2-donut-legend { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.dash2-legend-item  { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.dash2-legend-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dash2-legend-item strong { margin-left: auto; color: var(--text); font-size: 12px; }

/* ─── Banner roxo ─── */
.dash2-banner-card {
  background: linear-gradient(145deg, #4338ca 0%, #6366f1 100%);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 10px;
  color: #fff; position: relative; overflow: hidden;
  min-height: 280px;
}
.dash2-banner-card::after {
  content: '\F1B6'; font-family: 'bootstrap-icons';
  position: absolute; right: -10px; bottom: -18px;
  font-size: 110px; color: rgba(255,255,255,.07); line-height: 1;
}
.dash2-banner-icon {
  width: 48px; height: 48px; background: rgba(255,255,255,.18);
  border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 23px;
}
.dash2-banner-title { font-family:'Poppins',sans-serif; font-size: 16px; font-weight: 700; line-height: 1.3; color:#fff; }
.dash2-banner-sub   { font-size: 13px; color: rgba(255,255,255,.75); line-height: 1.5; flex: 1; }
.dash2-banner-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #4338ca;
  font-weight: 700; font-size: 13px;
  padding: 9px 18px; border-radius: 8px; margin-top: 8px;
  width: fit-content; text-decoration: none;
  transition: opacity .15s; position: relative; z-index: 1;
}
.dash2-banner-btn:hover { opacity: .9; }

/* ─── Bottom row ─── */
.dash2-bottom-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.dash2-link { font-size: 13px; color: var(--primary-light); font-weight: 600; text-decoration: none; }
.dash2-link:hover { text-decoration: underline; }

/* ─── Linhas de lista (clientes / faturas) ─── */
.dash2-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.dash2-list-row:last-child { border-bottom: none; }
.dash2-list-row:hover { background: #fafaff; }

.dash2-list-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.dash2-list-info   { flex: 1; min-width: 0; overflow: hidden; }
.dash2-list-name   { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; text-decoration: none; }
.dash2-list-name:hover { color: var(--primary); }
.dash2-list-meta   { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.dash2-list-date   { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.dash2-fat-valor   { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }

/* Paginação */
.dash2-pag { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; font-size: 12.5px; color: var(--text-muted); border-top: 1px solid var(--border); }
.dash2-pag:empty { display: none; }

/* ─── Atividades ─── */
.dash2-atividades { padding: 4px 0; }
.dash2-ativ-item  { display: flex; align-items: flex-start; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.dash2-ativ-item:last-child { border-bottom: none; }
.dash2-ativ-icon  { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.dash2-ativ-texto { font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.4; }
.dash2-ativ-data  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Empty */
.dash2-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.dash2-empty i { font-size: 28px; opacity: .35; display: block; margin-bottom: 8px; }
.dash2-empty p { font-size: 13px; margin: 0; }

/* ─── Responsivo ─── */
@media (max-width: 1150px) {
  .dash2-charts-row { grid-template-columns: 1fr 1fr; }
  .dash2-banner-card { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: auto; }
  .dash2-banner-sub  { flex: 0 1 auto; }
  .dash2-banner-btn  { margin-top: 0; margin-left: auto; }
}
@media (max-width: 900px) {
  .dash2-bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dash2-stats      { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash2-stat-value { font-size: 26px; }
  .dash2-stat-icon  { width: 46px; height: 46px; font-size: 21px; border-radius: 12px; }
  .dash2-charts-row { grid-template-columns: 1fr; }
  .dash2-banner-card { flex-direction: column; }
  .dash2-banner-btn  { margin-left: 0; }
  .dash2-bottom-row  { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .dash2-stats { grid-template-columns: 1fr; }
}



/* ════════════════════════════════════════════════════════════
   SIDEBAR v2 — adicionar no FINAL do assets/css/style.css
   ════════════════════════════════════════════════════════════ */

:root {
  --sb-bg:        #13123a;
  --sb-active-bg: rgba(109,40,217,.28);
  --sb-text:      rgba(255,255,255,.60);
  --sb-text-h:    #ffffff;
  --sb-border:    rgba(255,255,255,.07);
  --sb-w:         248px;
}

/* ── Shell ── */
.sidebar {
  width: var(--sb-w) !important;
  background: var(--sb-bg) !important;
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 0; bottom: 0; left: 0;
  z-index: 1000;
  transition: left .25s ease;
  overflow: hidden;
}

/* ── Brand ── */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sb-logo-img {
  width: 36px; height: 36px;
  border-radius: 10px; object-fit: cover; flex-shrink: 0;
}
.sb-logo-mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
}
.sb-brand-text { min-width: 0; overflow: hidden; }
.sb-brand-name {
  font-family: 'Poppins', sans-serif;
  font-size: 15px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
}
.sb-brand-sub {
  font-size: 10.5px; color: var(--sb-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Nav: scrollbar fina e invisível ── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0 10px;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
/* Webkit: trilha e thumb transparentes, aparecem só no hover */
.sidebar-nav::-webkit-scrollbar       { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; transition: background .2s; }
.sidebar-nav:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }

/* ── Seção label ── */
.sb-section {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.28);
  padding: 14px 8px 4px 10px;
}

/* ── Links: sem box no ícone, tudo numa linha ── */
.sb-link {
  display: flex !important;
  align-items: center;
  gap: 8px;
  
  padding: 8px 6px 8px 8px;
  margin: 1px 4px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sb-text) !important;
  text-decoration: none;
  transition: background .15s, color .15s;
  border-left: none !important;
  min-width: 0;
  white-space: nowrap;     /* linha nunca quebra */
  overflow: hidden;
}
.sb-link:hover {
  background: rgba(255,255,255,.06);
  color: var(--sb-text-h) !important;
}
.sb-link.active {
  background: var(--sb-active-bg) !important;
  color: #fff !important;
}
.sb-link.active .sb-icon { color: #a78bfa; }

/* Ícone: simples, sem caixa, tamanho fixo */
.sb-icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  color: var(--sb-text);
  transition: color .15s;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.sb-link:hover .sb-icon { color: #fff; }

/* Texto do link: ocupa o espaço restante, não quebra */
.sb-link > span:not(.sb-icon):not(.sb-badge) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge (tickets) */
.sb-badge {
  flex-shrink: 0;
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

/* Sair */
.sb-link-danger { color: rgba(255,255,255,.35) !important; }
.sb-link-danger:hover { color: #fca5a5 !important; background: rgba(239,68,68,.10) !important; }
.sb-link-danger .sb-icon { color: rgba(255,255,255,.35); }
.sb-link-danger:hover .sb-icon { color: #fca5a5; }

/* ── Badge plano ── */
.sb-plan-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 6px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(109,40,217,.5), rgba(79,70,229,.35));
  border: 1px solid rgba(167,139,250,.25);
  border-radius: 10px;
  text-decoration: none;
  transition: filter .15s;
  flex-shrink: 0;
}
.sb-plan-box:hover { filter: brightness(1.15); }
.sb-plan-crown { font-size: 20px; color: #fbbf24; flex-shrink: 0; }
.sb-plan-label { font-size: 9.5px; color: rgba(255,255,255,.5); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.sb-plan-name  { font-size: 13px; font-weight: 700; color: #c4b5fd; font-family: 'Poppins', sans-serif; }

/* ── Usuário rodapé ── */
.sb-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sb-user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #6d28d9, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.sb-user-info  { flex: 1; min-width: 0; overflow: hidden; }
.sb-user-name  { font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role  { font-size: 10px; color: var(--sb-text); }
.sb-user-exit  { color: rgba(255,255,255,.3); font-size: 16px; flex-shrink: 0; transition: color .15s; }
.sb-user-exit:hover { color: #fca5a5; }

/* ── Copyright ── */
.sb-foot {
  padding: 4px 12px 12px;
  font-size: 10px;
  color: rgba(255,255,255,.2);
  text-align: center;
  flex-shrink: 0;
}

/* ── main ── */
.main { margin-left: var(--sb-w) !important; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .sidebar { left: calc(-1 * var(--sb-w)) !important; }
  .sidebar.open { left: 0 !important; }
  .main { margin-left: 0 !important; }
  .menu-toggle { display: flex !important; }
}



/* ════════════════════════════════════════════════════════════
   DASHBOARD v2 — adicionar no FINAL do assets/css/style.css
   ════════════════════════════════════════════════════════════ */

/* ─── Stat cards ─── */
.dash2-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.dash2-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash2-stat-icon {
  width: 58px; height: 58px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.dash2-icon-violet { background: #ede9fe; color: #7c3aed; }
.dash2-icon-green  { background: #d1fae5; color: #059669; }
.dash2-icon-orange { background: #ffedd5; color: #ea580c; }
.dash2-icon-blue   { background: #dbeafe; color: #2563eb; }

.dash2-stat-title  { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.dash2-stat-value  { font-size: 34px; font-weight: 700; font-family: 'Poppins', sans-serif; color: var(--text); line-height: 1.1; }
.dash2-stat-sub    { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.dash2-sub-green   { color: var(--success); font-weight: 600; }
.dash2-sub-red     { color: var(--danger);  font-weight: 600; }

.dash2-stat-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  margin-top: 12px; width: fit-content;
}
.dash2-stat-badge span { font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.badge-up   { background: #d1fae5; color: #059669; }
.badge-down { background: #fee2e2; color: #dc2626; }

/* ─── Row gráficos ─── */
.dash2-charts-row {
  display: grid;
  grid-template-columns: 1.7fr 1.1fr 0.85fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: start;
}

/* ─── Donut ─── */
.dash2-donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  /* mesma altura que o gráfico de linha */
  min-height: 230px;
}
/* O canvas precisa de dimensões absolutas para o Chart.js renderizar */
.dash2-donut-canvas {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.dash2-donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.dash2-donut-total { font-size: 24px; font-weight: 700; font-family: 'Poppins',sans-serif; color: var(--text); line-height: 1; }
.dash2-donut-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.dash2-donut-legend { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.dash2-legend-item  { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.dash2-legend-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dash2-legend-item strong { margin-left: auto; color: var(--text); font-size: 12px; }

/* ─── Banner roxo ─── */
.dash2-banner-card {
  background: linear-gradient(145deg, #4338ca 0%, #6366f1 100%);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 10px;
  color: #fff; position: relative; overflow: hidden;
  min-height: 280px;
}
.dash2-banner-card::after {
  content: '\F1B6'; font-family: 'bootstrap-icons';
  position: absolute; right: -10px; bottom: -18px;
  font-size: 110px; color: rgba(255,255,255,.07); line-height: 1;
}
.dash2-banner-icon {
  width: 48px; height: 48px; background: rgba(255,255,255,.18);
  border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 23px;
}
.dash2-banner-title { font-family:'Poppins',sans-serif; font-size: 16px; font-weight: 700; line-height: 1.3; color:#fff; }
.dash2-banner-sub   { font-size: 13px; color: rgba(255,255,255,.75); line-height: 1.5; flex: 1; }
.dash2-banner-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #4338ca;
  font-weight: 700; font-size: 13px;
  padding: 9px 18px; border-radius: 8px; margin-top: 8px;
  width: fit-content; text-decoration: none;
  transition: opacity .15s; position: relative; z-index: 1;
}
.dash2-banner-btn:hover { opacity: .9; }

/* ─── Bottom row ─── */
.dash2-bottom-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.dash2-link { font-size: 13px; color: var(--primary-light); font-weight: 600; text-decoration: none; }
.dash2-link:hover { text-decoration: underline; }

/* ─── Linhas de lista (clientes / faturas) ─── */
.dash2-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.dash2-list-row:last-child { border-bottom: none; }
.dash2-list-row:hover { background: #fafaff; }

.dash2-list-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.dash2-list-info   { flex: 1; min-width: 0; overflow: hidden; }
.dash2-list-name   { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; text-decoration: none; }
.dash2-list-name:hover { color: var(--primary); }
.dash2-list-meta   { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.dash2-list-date   { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.dash2-fat-valor   { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }

/* Paginação */
.dash2-pag { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; font-size: 12.5px; color: var(--text-muted); border-top: 1px solid var(--border); }
.dash2-pag:empty { display: none; }

/* ─── Atividades ─── */
.dash2-atividades { padding: 4px 0; }
.dash2-ativ-item  { display: flex; align-items: flex-start; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.dash2-ativ-item:last-child { border-bottom: none; }
.dash2-ativ-icon  { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.dash2-ativ-texto { font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.4; }
.dash2-ativ-data  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Empty */
.dash2-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.dash2-empty i { font-size: 28px; opacity: .35; display: block; margin-bottom: 8px; }
.dash2-empty p { font-size: 13px; margin: 0; }

/* ─── Responsivo ─── */
@media (max-width: 1150px) {
  .dash2-charts-row { grid-template-columns: 1fr 1fr; }
  .dash2-banner-card { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: auto; }
  .dash2-banner-sub  { flex: 0 1 auto; }
  .dash2-banner-btn  { margin-top: 0; margin-left: auto; }
}
@media (max-width: 900px) {
  .dash2-bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dash2-stats      { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash2-stat-value { font-size: 26px; }
  .dash2-stat-icon  { width: 46px; height: 46px; font-size: 21px; border-radius: 12px; }
  .dash2-charts-row { grid-template-columns: 1fr; }
  .dash2-banner-card { flex-direction: column; }
  .dash2-banner-btn  { margin-left: 0; }
  .dash2-bottom-row  { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .dash2-stats { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   DARK MODE — overrides dashboard v2
   ════════════════════════════════════════════════════════════ */

/* Ícones dos stat-cards: fundo mais escuro no dark */
[data-theme="dark"] .dash2-icon-violet { background: rgba(124,58,237,.22); color: #a78bfa; }
[data-theme="dark"] .dash2-icon-green  { background: rgba(5,150,105,.2);   color: #34d399; }
[data-theme="dark"] .dash2-icon-orange { background: rgba(234,88,12,.2);   color: #fb923c; }
[data-theme="dark"] .dash2-icon-blue   { background: rgba(37,99,235,.2);   color: #60a5fa; }

/* Badges de variação */
[data-theme="dark"] .badge-up   { background: rgba(16,185,129,.2); color: #34d399; }
[data-theme="dark"] .badge-down { background: rgba(239,68,68,.18); color: #f87171; }

/* Stat card: sem shadow pesada no dark */
[data-theme="dark"] .dash2-stat-card { box-shadow: none; }

/* Banner roxo: ok em ambos, só ajusta opacidade */
[data-theme="dark"] .dash2-banner-card { opacity: .95; }

/* Lista rows: hover no dark */
[data-theme="dark"] .dash2-list-row:hover { background: rgba(255,255,255,.04) !important; }

/* Badge "Em aberto" no dark */
[data-theme="dark"] .dash2-badge-aberto {
  background: rgba(245,158,11,.18);
  color: #fbbf24;
}

/* Legenda donut no dark */
[data-theme="dark"] .dash2-legend-item { color: rgba(255,255,255,.6); }
[data-theme="dark"] .dash2-legend-item strong { color: rgba(255,255,255,.9); }

/* Donut center no dark */
[data-theme="dark"] .dash2-donut-total { color: #fff; }
[data-theme="dark"] .dash2-donut-label { color: rgba(255,255,255,.5); }

/* Paginação */
.dash2-pag-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 14px;
  transition: background .15s, border-color .15s;
}
.dash2-pag-btn:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.dash2-pag-btn:disabled { opacity: .4; cursor: not-allowed; }
.dash2-pag-num { font-size: 12px; color: var(--text-muted); }

/* Badge "Em aberto" (light) */
.dash2-badge-aberto {
  font-size: 11px; padding: 3px 9px;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: 999px; font-weight: 600;
  display: inline-flex; align-items: center;
}

/* Alinhamento: cards mesma altura em linha */
.dash2-charts-row  { align-items: stretch !important; }
.dash2-bottom-row  { align-items: stretch !important; }
.dash2-charts-row .card,
.dash2-bottom-row .card { display: flex; flex-direction: column; }

/* Valor fatura */
.dash2-fat-valor { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }

/* ════ CORREÇÃO ALINHAMENTO BOTTOM-ROW ════ */

/* Grid: todas as colunas mesma altura */
.dash2-bottom-row {
  align-items: stretch !important;
}

/* Cards: flex-column para preencher altura */
.dash2-bottom-row > .card {
  display: flex !important;
  flex-direction: column !important;
  min-height: 420px;
}

/* header do card: não cresce */
.dash2-bottom-row > .card > .card-header-x {
  flex-shrink: 0;
}

/* Listas e atividades: crescem para preencher */
#dash2-cli-list,
#dash2-fat-list,
.dash2-atividades {
  flex: 1 1 auto !important;
}

/* Paginação: empurra pro fundo */
#dash2-cli-pag,
#dash2-fat-pag {
  margin-top: auto;
}

/* Hover temático (sem hardcode de cor) */
.dash2-list-row:hover { background: var(--bg) !important; }

/* ════ RESET ALINHAMENTO FINAL ════ */

/* Remove min-height fixo que esticava o card 1 */
.dash2-bottom-row > .card { min-height: 0 !important; }

/* Listas NÃO crescem — altura é determinada pelo conteúdo */
#dash2-cli-list,
#dash2-fat-list,
#dash2-atv-list,
.dash2-atividades { flex: 0 0 auto !important; }

/* Paginação NÃO usa margin-top auto — fica logo após a lista */
#dash2-cli-pag,
#dash2-fat-pag,
#dash2-atv-pag { margin-top: 0 !important; }

/* Grid alinha pelo topo — cada card tem a altura do seu conteúdo */
.dash2-bottom-row { align-items: start !important; }

/* ════ ATIVIDADES: alinhar altura dos itens com os outros cards ════ */
.dash2-ativ-item {
  padding: 13px 18px !important;  /* era 10px, iguala com dash2-list-row */
}

/* ════ ATIVIDADES: ajuste fino padding ════ */
.dash2-ativ-item { padding: 11px 18px !important; }

/* Remove underline do hover nos links "Ver todos/todas" */
.dash2-link:hover { text-decoration: none !important; }



/* ════════════════════════════════════════════════════════════
   DASHBOARD v2 — adicionar no FINAL do assets/css/style.css
   ════════════════════════════════════════════════════════════ */

/* ─── Stat cards ─── */
.dash2-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.dash2-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash2-stat-icon {
  width: 58px; height: 58px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.dash2-icon-violet { background: #ede9fe; color: #7c3aed; }
.dash2-icon-green  { background: #d1fae5; color: #059669; }
.dash2-icon-orange { background: #ffedd5; color: #ea580c; }
.dash2-icon-blue   { background: #dbeafe; color: #2563eb; }

.dash2-stat-title  { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.dash2-stat-value  { font-size: 34px; font-weight: 700; font-family: 'Poppins', sans-serif; color: var(--text); line-height: 1.1; }
.dash2-stat-sub    { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.dash2-sub-green   { color: var(--success); font-weight: 600; }
.dash2-sub-red     { color: var(--danger);  font-weight: 600; }

.dash2-stat-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  margin-top: 12px; width: fit-content;
}
.dash2-stat-badge span { font-weight: 400; color: var(--text-muted); margin-left: 2px; }
.badge-up   { background: #d1fae5; color: #059669; }
.badge-down { background: #fee2e2; color: #dc2626; }

/* ─── Row gráficos ─── */
.dash2-charts-row {
  display: grid;
  grid-template-columns: 1.7fr 1.1fr 0.85fr;
  gap: 16px;
  margin-bottom: 20px;
  align-items: start;
}

/* ─── Donut ─── */
.dash2-donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  /* mesma altura que o gráfico de linha */
  min-height: 230px;
}
/* O canvas precisa de dimensões absolutas para o Chart.js renderizar */
.dash2-donut-canvas {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.dash2-donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.dash2-donut-total { font-size: 24px; font-weight: 700; font-family: 'Poppins',sans-serif; color: var(--text); line-height: 1; }
.dash2-donut-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.dash2-donut-legend { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.dash2-legend-item  { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.dash2-legend-dot   { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dash2-legend-item strong { margin-left: auto; color: var(--text); font-size: 12px; }

/* ─── Banner roxo ─── */
.dash2-banner-card {
  background: linear-gradient(145deg, #4338ca 0%, #6366f1 100%);
  border-radius: var(--radius);
  padding: 24px 20px;
  display: flex; flex-direction: column; gap: 10px;
  color: #fff; position: relative; overflow: hidden;
  min-height: 280px;
}
.dash2-banner-card::after {
  content: '\F1B6'; font-family: 'bootstrap-icons';
  position: absolute; right: -10px; bottom: -18px;
  font-size: 110px; color: rgba(255,255,255,.07); line-height: 1;
}
.dash2-banner-icon {
  width: 48px; height: 48px; background: rgba(255,255,255,.18);
  border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 23px;
}
.dash2-banner-title { font-family:'Poppins',sans-serif; font-size: 16px; font-weight: 700; line-height: 1.3; color:#fff; }
.dash2-banner-sub   { font-size: 13px; color: rgba(255,255,255,.75); line-height: 1.5; flex: 1; }
.dash2-banner-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #4338ca;
  font-weight: 700; font-size: 13px;
  padding: 9px 18px; border-radius: 8px; margin-top: 8px;
  width: fit-content; text-decoration: none;
  transition: opacity .15s; position: relative; z-index: 1;
}
.dash2-banner-btn:hover { opacity: .9; }

/* ─── Bottom row ─── */
.dash2-bottom-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.dash2-link { font-size: 13px; color: var(--primary-light); font-weight: 600; text-decoration: none; }
.dash2-link:hover { text-decoration: underline; }

/* ─── Linhas de lista (clientes / faturas) ─── */
.dash2-list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.dash2-list-row:last-child { border-bottom: none; }
.dash2-list-row:hover { background: #fafaff; }

.dash2-list-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.dash2-list-info   { flex: 1; min-width: 0; overflow: hidden; }
.dash2-list-name   { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; text-decoration: none; }
.dash2-list-name:hover { color: var(--primary); }
.dash2-list-meta   { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.dash2-list-date   { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.dash2-fat-valor   { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }

/* Paginação */
.dash2-pag { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px; font-size: 12.5px; color: var(--text-muted); border-top: 1px solid var(--border); }
.dash2-pag:empty { display: none; }

/* ─── Atividades ─── */
.dash2-atividades { padding: 4px 0; }
.dash2-ativ-item  { display: flex; align-items: flex-start; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.dash2-ativ-item:last-child { border-bottom: none; }
.dash2-ativ-icon  { width: 32px; height: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.dash2-ativ-texto { font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.4; }
.dash2-ativ-data  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Empty */
.dash2-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.dash2-empty i { font-size: 28px; opacity: .35; display: block; margin-bottom: 8px; }
.dash2-empty p { font-size: 13px; margin: 0; }

/* ─── Responsivo ─── */
@media (max-width: 1150px) {
  .dash2-charts-row { grid-template-columns: 1fr 1fr; }
  .dash2-banner-card { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: auto; }
  .dash2-banner-sub  { flex: 0 1 auto; }
  .dash2-banner-btn  { margin-top: 0; margin-left: auto; }
}
@media (max-width: 900px) {
  .dash2-bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dash2-stats      { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash2-stat-value { font-size: 26px; }
  .dash2-stat-icon  { width: 46px; height: 46px; font-size: 21px; border-radius: 12px; }
  .dash2-charts-row { grid-template-columns: 1fr; }
  .dash2-banner-card { flex-direction: column; }
  .dash2-banner-btn  { margin-left: 0; }
  .dash2-bottom-row  { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .dash2-stats { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════
   DARK MODE — overrides dashboard v2
   ════════════════════════════════════════════════════════════ */

/* Ícones dos stat-cards: fundo mais escuro no dark */
[data-theme="dark"] .dash2-icon-violet { background: rgba(124,58,237,.22); color: #a78bfa; }
[data-theme="dark"] .dash2-icon-green  { background: rgba(5,150,105,.2);   color: #34d399; }
[data-theme="dark"] .dash2-icon-orange { background: rgba(234,88,12,.2);   color: #fb923c; }
[data-theme="dark"] .dash2-icon-blue   { background: rgba(37,99,235,.2);   color: #60a5fa; }

/* Badges de variação */
[data-theme="dark"] .badge-up   { background: rgba(16,185,129,.2); color: #34d399; }
[data-theme="dark"] .badge-down { background: rgba(239,68,68,.18); color: #f87171; }

/* Stat card: sem shadow pesada no dark */
[data-theme="dark"] .dash2-stat-card { box-shadow: none; }

/* Banner roxo: ok em ambos, só ajusta opacidade */
[data-theme="dark"] .dash2-banner-card { opacity: .95; }

/* Lista rows: hover no dark */
[data-theme="dark"] .dash2-list-row:hover { background: rgba(255,255,255,.04) !important; }

/* Badge "Em aberto" no dark */
[data-theme="dark"] .dash2-badge-aberto {
  background: rgba(245,158,11,.18);
  color: #fbbf24;
}

/* Legenda donut no dark */
[data-theme="dark"] .dash2-legend-item { color: rgba(255,255,255,.6); }
[data-theme="dark"] .dash2-legend-item strong { color: rgba(255,255,255,.9); }

/* Donut center no dark */
[data-theme="dark"] .dash2-donut-total { color: #fff; }
[data-theme="dark"] .dash2-donut-label { color: rgba(255,255,255,.5); }

/* Paginação */
.dash2-pag-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 14px;
  transition: background .15s, border-color .15s;
}
.dash2-pag-btn:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.dash2-pag-btn:disabled { opacity: .4; cursor: not-allowed; }
.dash2-pag-num { font-size: 12px; color: var(--text-muted); }

/* Badge "Em aberto" (light) */
.dash2-badge-aberto {
  font-size: 11px; padding: 3px 9px;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: 999px; font-weight: 600;
  display: inline-flex; align-items: center;
}

/* Alinhamento: cards mesma altura em linha */
.dash2-charts-row  { align-items: stretch !important; }
.dash2-bottom-row  { align-items: stretch !important; }
.dash2-charts-row .card,
.dash2-bottom-row .card { display: flex; flex-direction: column; }

/* Valor fatura */
.dash2-fat-valor { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; flex-shrink: 0; }

/* ════ CORREÇÃO ALINHAMENTO BOTTOM-ROW ════ */

/* Grid: todas as colunas mesma altura */
.dash2-bottom-row {
  align-items: stretch !important;
}

/* Cards: flex-column para preencher altura */
.dash2-bottom-row > .card {
  display: flex !important;
  flex-direction: column !important;
  min-height: 420px;
}

/* header do card: não cresce */
.dash2-bottom-row > .card > .card-header-x {
  flex-shrink: 0;
}

/* Listas e atividades: crescem para preencher */
#dash2-cli-list,
#dash2-fat-list,
.dash2-atividades {
  flex: 1 1 auto !important;
}

/* Paginação: empurra pro fundo */
#dash2-cli-pag,
#dash2-fat-pag {
  margin-top: auto;
}

/* Hover temático (sem hardcode de cor) */
.dash2-list-row:hover { background: var(--bg) !important; }

/* ════ RESET ALINHAMENTO FINAL ════ */

/* Remove min-height fixo que esticava o card 1 */
.dash2-bottom-row > .card { min-height: 0 !important; }

/* Listas NÃO crescem — altura é determinada pelo conteúdo */
#dash2-cli-list,
#dash2-fat-list,
#dash2-atv-list,
.dash2-atividades { flex: 0 0 auto !important; }

/* Paginação NÃO usa margin-top auto — fica logo após a lista */
#dash2-cli-pag,
#dash2-fat-pag,
#dash2-atv-pag { margin-top: 0 !important; }

/* Grid alinha pelo topo — cada card tem a altura do seu conteúdo */
.dash2-bottom-row { align-items: start !important; }

/* ════ ATIVIDADES: alinhar altura dos itens com os outros cards ════ */
.dash2-ativ-item {
  padding: 13px 18px !important;  /* era 10px, iguala com dash2-list-row */
}

/* ════ ATIVIDADES: ajuste fino padding ════ */
.dash2-ativ-item { padding: 11px 18px !important; }

/* Remove underline do hover nos links "Ver todos/todas" */
.dash2-link:hover { text-decoration: none !important; }

/* ════ STAT CARDS MOBILE — ajustes de texto e tamanho ════ */
@media (max-width: 768px) {
  /* Ícone menor */
  .dash2-stat-icon { width:44px !important; height:44px !important; font-size:20px !important; border-radius:12px !important; margin-bottom:8px !important; }

  /* Valor menor */
  .dash2-stat-value { font-size:22px !important; }

  /* Título e sub: nunca quebra, corta com ... */
  .dash2-stat-title,
  .dash2-stat-sub {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  /* Padding menor no card */
  .dash2-stat-card { padding: 14px 12px 12px !important; }

  /* Badge menor */
  .dash2-stat-badge { font-size: 10px !important; padding: 3px 7px !important; margin-top: 8px !important; }
  .dash2-stat-badge span { display: none; } /* esconde "vs mês passado" no mobile */
}

@media (max-width: 400px) {
  /* 1 coluna em telas muito pequenas */
  .dash2-stats { grid-template-columns: 1fr !important; }
  .dash2-stat-value { font-size:26px !important; }
  .dash2-stat-title, .dash2-stat-sub { white-space:normal !important; }
}