/* ============================================================
   DOCE JÔ - Sistema de Fluxo de Caixa
   Theme: Light with #EC2754 and #F487A4
   ============================================================ */

:root {
  --primary:       #EC2754;
  --primary-dark:  #c41e45;
  --primary-light: #f5618a;
  --secondary:     #F487A4;
  --secondary-light: #fbb8ca;
  --accent:        #ff6b8a;
  --success:       #27ae60;
  --warning:       #f39c12;
  --danger:        #e74c3c;
  --info:          #3498db;
  --light:         #fff5f7;
  --white:         #ffffff;
  --gray-100:      #f8f9fa;
  --gray-200:      #f0f0f0;
  --gray-300:      #dee2e6;
  --gray-500:      #adb5bd;
  --gray-700:      #6c757d;
  --dark:          #2c2c2c;
  --sidebar-width: 260px;
  --topbar-height: 65px;
  --border-radius: 12px;
  --shadow:        0 2px 15px rgba(236, 39, 84, 0.08);
  --shadow-hover:  0 8px 25px rgba(236, 39, 84, 0.18);
  --transition:    all 0.25s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  background: #fdf0f3;
  color: var(--dark);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--secondary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--white);
  box-shadow: 3px 0 20px rgba(236,39,84,0.10);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 15px;
  border-bottom: 2px solid var(--secondary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
}

.sidebar-logo img {
  width: 80px;
  height: auto;
  object-fit: contain;
}

.sidebar-logo span {
  font-size: 0.72rem;
  color: var(--gray-700);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav { flex: 1; padding: 15px 0; }

.nav-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 20px 5px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 0;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin: 1px 0;
}

.sidebar-nav a i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
  color: var(--gray-500);
  transition: var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(236,39,84,0.08) 0%, transparent 100%);
  color: var(--primary);
  border-left-color: var(--primary);
}

.sidebar-nav a:hover i,
.sidebar-nav a.active i { color: var(--primary); }

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--gray-200);
  font-size: 0.78rem;
  color: var(--gray-500);
  text-align: center;
}

/* ── TOPBAR ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--white);
  box-shadow: 0 2px 10px rgba(236,39,84,0.08);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
}

.topbar-left { display: flex; align-items: center; gap: 15px; }
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--dark); }
.topbar-subtitle { font-size: 0.78rem; color: var(--gray-700); }

.topbar-right { display: flex; align-items: center; gap: 15px; }

.topbar-date {
  font-size: 0.82rem;
  color: var(--gray-700);
  background: var(--light);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--secondary-light);
}

.user-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.9rem;
  cursor: pointer;
}

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 28px;
  min-height: calc(100vh - var(--topbar-height));
}

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--dark);
}

.page-header h1 span { color: var(--primary); }

.breadcrumb-custom {
  font-size: 0.8rem;
  color: var(--gray-700);
  margin-top: 3px;
}

.breadcrumb-custom a { color: var(--primary); text-decoration: none; }

/* ── CARDS ── */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(236,39,84,0.07);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-header h5 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header h5 i { color: var(--primary); }

.card-body { padding: 22px; }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 22px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(236,39,84,0.07);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}

.stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  color: inherit;
}

.stat-icon {
  width: 58px; height: 58px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.income  { background: rgba(39,174,96,0.12);  color: #27ae60; }
.stat-icon.expense { background: rgba(231,76,60,0.12);  color: #e74c3c; }
.stat-icon.balance { background: rgba(236,39,84,0.12);  color: var(--primary); }
.stat-icon.profit  { background: rgba(52,152,219,0.12); color: #3498db; }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 0.78rem; font-weight: 700; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--dark); line-height: 1.2; margin-top: 3px; }
.stat-sub   { font-size: 0.75rem; color: var(--gray-700); margin-top: 3px; }

.stat-value.income-val  { color: #27ae60; }
.stat-value.expense-val { color: #e74c3c; }
.stat-value.primary-val { color: var(--primary); }

/* ── BUTTONS ── */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  padding: 9px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary-custom:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 4px 15px rgba(236,39,84,0.35);
  transform: translateY(-1px);
  color: white;
  text-decoration: none;
}

.btn-secondary-custom {
  background: var(--white);
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-secondary-custom:hover {
  background: var(--primary);
  color: white;
  text-decoration: none;
}

.btn-danger-custom {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-danger-custom:hover { background: #c0392b; }

.btn-success-custom {
  background: #27ae60;
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-success-custom:hover { background: #1e8449; }

/* ── FORMS ── */
.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 5px;
  display: block;
}

.form-control, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--dark);
  background: var(--white);
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(236,39,84,0.12);
}

.form-control.is-invalid, .form-select.is-invalid {
  border-color: #e74c3c;
}

.invalid-feedback {
  font-size: 0.78rem;
  color: #e74c3c;
  margin-top: 4px;
  display: block;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group-text {
  background: var(--light);
  border: 2px solid var(--gray-300);
  border-right: none;
  padding: 10px 14px;
  border-radius: 8px 0 0 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.input-group .form-control {
  border-radius: 0 8px 8px 0;
}

textarea.form-control { resize: vertical; min-height: 90px; }

/* ── TABLES ── */
.table-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table-custom thead th {
  background: var(--light);
  padding: 12px 15px;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-700);
  border-bottom: 2px solid var(--secondary-light);
  white-space: nowrap;
}

.table-custom tbody tr {
  border-bottom: 1px solid var(--gray-200);
  transition: var(--transition);
}

.table-custom tbody tr:hover { background: rgba(236,39,84,0.03); }

.table-custom tbody td {
  padding: 12px 15px;
  vertical-align: middle;
  color: var(--dark);
}

.table-custom tbody tr:last-child { border-bottom: none; }

/* ── BADGES ── */
.badge-custom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-income  { background: rgba(39,174,96,0.12);  color: #27ae60; }
.badge-expense { background: rgba(231,76,60,0.12);  color: #e74c3c; }
.badge-pending { background: rgba(243,156,18,0.12); color: #f39c12; }
.badge-paid    { background: rgba(39,174,96,0.12);  color: #27ae60; }
.badge-cancelled { background: var(--gray-200); color: var(--gray-700); }
.badge-primary { background: rgba(236,39,84,0.12);  color: var(--primary); }

/* ── ALERTS ── */
.alert-custom {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.alert-success { background: rgba(39,174,96,0.1); border-left: 4px solid #27ae60; color: #1e8449; }
.alert-danger   { background: rgba(231,76,60,0.1); border-left: 4px solid #e74c3c; color: #c0392b; }
.alert-warning  { background: rgba(243,156,18,0.1); border-left: 4px solid #f39c12; color: #d68910; }
.alert-info     { background: rgba(52,152,219,0.1); border-left: 4px solid #3498db; color: #2471a3; }

/* ── TRANSACTION TYPE INDICATOR ── */
.type-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.type-dot.income  { background: #27ae60; }
.type-dot.expense { background: #e74c3c; }

/* ── AMOUNT DISPLAY ── */
.amount-income  { color: #27ae60; font-weight: 700; }
.amount-expense { color: #e74c3c; font-weight: 700; }

/* ── PAGINATION ── */
.pagination-custom {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
}

.pagination-custom a,
.pagination-custom span {
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: 1px solid var(--gray-300);
  color: var(--dark);
}

.pagination-custom a:hover { background: var(--light); border-color: var(--primary); color: var(--primary); }
.pagination-custom span.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── FILTER BAR ── */
.filter-bar {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 18px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px solid rgba(236,39,84,0.07);
}

.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label { font-size: 0.78rem; font-weight: 700; color: var(--gray-700); text-transform: uppercase; }
.filter-group .form-control,
.filter-group .form-select { min-width: 140px; }

/* Div dos botões Filtrar / Limpar */
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* ── CHART CONTAINER ── */
.chart-container { position: relative; width: 100%; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--gray-500);
}

.empty-state i {
  font-size: 3.5rem;
  color: var(--secondary-light);
  margin-bottom: 15px;
  display: block;
}

.empty-state h5 { font-size: 1rem; font-weight: 700; color: var(--gray-700); margin-bottom: 8px; }
.empty-state p  { font-size: 0.85rem; margin-bottom: 16px; }
.empty-state .btn-primary-custom { margin-top: 4px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show { display: flex; }

.modal-box {
  background: var(--white);
  border-radius: 16px;
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px 15px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h5 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-header h5 i { color: var(--primary); }

.modal-close {
  background: none; border: none;
  font-size: 1.3rem; color: var(--gray-500);
  cursor: pointer; padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
}
.modal-close:hover { background: var(--light); color: var(--primary); }

.modal-body { padding: 22px 24px; }
.modal-footer {
  padding: 15px 24px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #fdf0f3 0%, #fff5f7 50%, #fce4ea 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 45px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(236,39,84,0.15);
  text-align: center;
}

.login-logo { width: 120px; margin-bottom: 20px; }

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 5px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--gray-700);
  margin-bottom: 30px;
}

/* ── PROGRESS BAR ── */
.progress-bar-custom {
  background: var(--gray-200);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.5s ease;
}

/* ── CATEGORY COLOR DOT ── */
.cat-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── QUICK ACTION BUTTONS ── */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 20px;
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--dark);
  min-width: 100px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.quick-btn i { font-size: 1.6rem; }
.quick-btn.income-btn  { border-color: rgba(39,174,96,0.3); }
.quick-btn.expense-btn { border-color: rgba(231,76,60,0.3); }
.quick-btn:hover { border-color: var(--primary); box-shadow: var(--shadow-hover); transform: translateY(-2px); color: var(--primary); }
.quick-btn.income-btn:hover  { border-color: #27ae60; color: #27ae60; }
.quick-btn.expense-btn:hover { border-color: #e74c3c; color: #e74c3c; }

/* ══════════════════════════════════════════
   RESPONSIVE — Mobile First
   Breakpoints:
     ≤ 992px  → tablet
     ≤ 768px  → mobile landscape
     ≤ 576px  → mobile portrait
   ══════════════════════════════════════════ */

/* ── TABLET (≤ 992px) ── */
@media (max-width: 992px) {
  :root { --sidebar-width: 230px; }

  .main-content { padding: 20px; }

  .topbar { padding: 0 18px; }

  /* Stat value menor */
  .stat-value { font-size: 1.3rem; }

  /* Card header empilha quando necessário */
  .card-header { flex-wrap: wrap; gap: 8px; }

  /* Filter bar quebra em 2 colunas */
  .filter-bar { gap: 10px; align-items: flex-end; }
  .filter-group { flex: 1 1 calc(50% - 10px); min-width: 140px; }
  .filter-group .form-control,
  .filter-group .form-select { min-width: 100%; width: 100%; }
  .filter-actions { flex: 1 1 calc(50% - 10px); align-items: flex-end; }
}

/* ── MOBILE (≤ 768px) ── */
@media (max-width: 768px) {
  /* ── Layout base ── */
  .sidebar {
    transform: translateX(-100%);
    z-index: 1100;
    width: 260px;
  }
  .sidebar.open { transform: translateX(0); }

  /* Overlay escuro ao abrir sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1099;
  }
  .sidebar-overlay.show { display: block; }

  .topbar {
    left: 0;
    padding: 0 14px;
    height: 58px;
  }
  :root { --topbar-height: 58px; }

  .main-content {
    margin-left: 0;
    padding: 14px;
  }

  /* ── Topbar ── */
  .topbar-date { display: none; }          /* esconde data no mobile */
  .topbar-title { font-size: 0.95rem; }
  .topbar-subtitle { font-size: 0.72rem; }

  /* ── Page header ── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
  }
  .page-header h1 { font-size: 1.3rem; }

  /* ── Stat cards ── */
  .stat-card {
    padding: 16px;
    gap: 12px;
  }
  .stat-icon { width: 46px; height: 46px; font-size: 1.2rem; }
  .stat-value { font-size: 1.2rem; }

  /* ── Quick actions (dashboard) ── */
  .quick-actions { gap: 8px; }
  .quick-btn {
    min-width: calc(33.333% - 6px);
    flex: 1 1 calc(33.333% - 6px);
    padding: 12px 8px;
    font-size: 0.75rem;
  }
  .quick-btn i { font-size: 1.3rem; }

  /* ── Filter bar ── */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
  }
  .filter-group {
    flex: 1 1 100%;
    width: 100%;
  }
  .filter-group .form-control,
  .filter-group .form-select {
    min-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }
  .filter-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .filter-actions .btn-primary-custom,
  .filter-actions .btn-secondary-custom {
    flex: 1;
    justify-content: center;
    text-align: center;
  }

  /* ── Cards ── */
  .card-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .card-header h5 { font-size: 0.88rem; }
  .card-body { padding: 14px 16px; }

  /* ── Tables: scroll horizontal ── */
  .table-responsive-mobile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-custom { min-width: 600px; }
  .table-custom thead th,
  .table-custom tbody td { padding: 10px 12px; font-size: 0.8rem; }

  /* ── Modal ── */
  .modal-overlay { padding: 10px; align-items: flex-end; }
  .modal-box {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px 16px; }

  /* ── Forms ── */
  .form-control, .form-select { font-size: 16px; } /* evita zoom no iOS */

  /* ── Buttons ── */
  .btn-primary-custom,
  .btn-secondary-custom { font-size: 0.82rem; padding: 8px 14px; }

  /* ── Login ── */
  .login-card { padding: 28px 18px; }

  /* ── Alerts ── */
  .alert-custom { font-size: 0.82rem; padding: 12px 14px; }

  /* ── Pagination ── */
  .pagination-custom { gap: 4px; }
  .pagination-custom a,
  .pagination-custom span { padding: 6px 10px; font-size: 0.8rem; }

  /* ── Reports: gráfico de pizza empilha ── */
  .report-pie-row {
    flex-direction: column !important;
    align-items: center !important;
  }
  .report-pie-row > div:first-child {
    flex: 0 0 160px !important;
    width: 160px !important;
  }

  /* ── Card header com botões: empilha ── */
  .card-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }
}

/* ── MOBILE PORTRAIT (≤ 576px) ── */
@media (max-width: 576px) {
  .main-content { padding: 10px; }

  /* ── Grids viram 1 coluna ── */
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; gap: 12px; }

  /* ── Quick actions: 2 por linha ── */
  .quick-btn {
    min-width: calc(50% - 4px);
    flex: 1 1 calc(50% - 4px);
  }

  /* ── Stat card horizontal compacto ── */
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; border-radius: 10px; }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: 0.72rem; }

  /* ── Topbar: esconde subtítulo ── */
  .topbar-subtitle { display: none; }

  /* ── Page header ── */
  .page-header h1 { font-size: 1.15rem; }

  /* ── Filter bar ── */
  .filter-bar { padding: 12px; }

  /* ── Card body ── */
  .card-body { padding: 12px; }
  .card-header { padding: 12px 14px; }

  /* ── Botões de ação na tabela: só ícone ── */
  .btn-action-text { display: none; }

  /* ── Modal ocupa tela toda ── */
  .modal-overlay { padding: 0; }
  .modal-box { border-radius: 0; max-height: 100vh; }

  /* ── Reports: selector de mês empilha ── */
  .reports-header { flex-direction: column !important; align-items: flex-start !important; }
  .reports-header form { width: 100%; }
  .reports-header .filter-group { width: 100%; }
  .reports-header .filter-group .form-control { width: 100%; }
  .reports-header-actions { margin-top: 0 !important; width: 100%; }
  .reports-header-actions a { flex: 1; justify-content: center; }

  /* ── Indicadores financeiros ── */
  .indicator-grid { grid-template-columns: 1fr !important; }

  /* ── Login ── */
  .login-card { padding: 22px 14px; border-radius: 12px; }
  .login-logo { width: 110px; }
  .login-title { font-size: 1.25rem; }
}

/* ── TOOLTIP ── */
[data-tooltip] { position: relative; cursor: default; }
[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--dark);
  z-index: 9999;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: white;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: pre-wrap;
  max-width: 280px;
  width: max-content;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  z-index: 9999;
  pointer-events: none;
}

/* Ícone de observação na tabela de movimentações */
.notes-icon {
  display: inline-flex;
  align-items: center;
  position: relative;
}
.notes-icon [data-tooltip],
.notes-icon[data-tooltip] {
  cursor: help;
}
/* Garante que o tooltip do ícone não seja cortado pelo overflow da célula */
td { overflow: visible !important; }

/* ── NOTIFICATION BELL ── */
.notif-btn {
  position: relative;
  background: var(--light);
  border: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition);
}
.notif-btn:hover { background: rgba(236,39,84,0.1); color: var(--primary); }
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--primary);
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ── GRID HELPERS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* form-grid-2: grid de 2 colunas que vira 1 coluna no mobile */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; }

@media (max-width: 992px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ── SECTION DIVIDER ── */
.section-divider {
  border: none;
  border-top: 2px solid var(--gray-200);
  margin: 22px 0;
}

/* ── TOGGLE SWITCH ── */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--gray-300);
  border-radius: 24px;
  transition: var(--transition);
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }

/* ── LOADING SPINNER ── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════
   CUSTOMER PROFILE PAGE
══════════════════════════════════════════ */

/* ── Hero ── */
.cp-hero {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 8px 32px rgba(236,39,84,0.18);
}
.cp-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #EC2754 0%, #c41e45 40%, #9b1535 100%);
  z-index: 0;
}
.cp-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.cp-hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 28px 32px;
  flex-wrap: wrap;
}

/* ── Avatar ── */
.cp-avatar-wrap { position: relative; flex-shrink: 0; }
.cp-avatar {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.5);
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; font-weight: 900; color: #fff;
  backdrop-filter: blur(4px);
  letter-spacing: 1px;
}
.cp-score-badge {
  position: absolute;
  bottom: -4px; right: -4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .68rem;
  font-weight: 800;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
  white-space: nowrap;
}

/* ── Hero info ── */
.cp-hero-info { flex: 1; min-width: 200px; }
.cp-name {
  font-size: 1.7rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.cp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-bottom: 8px;
}
.cp-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .83rem;
  color: rgba(255,255,255,0.88);
  font-weight: 600;
}
.cp-meta i { font-size: .9rem; color: rgba(255,255,255,0.7); }
.cp-notes {
  font-size: .82rem;
  color: rgba(255,255,255,0.75);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Loyalty score ── */
.cp-loyalty {
  flex-shrink: 0;
  text-align: center;
  min-width: 120px;
}
.cp-loyalty-label {
  font-size: .7rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.cp-loyalty-score {
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--score-color, #f39c12);
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0,0,0,0.2);
  margin-bottom: 8px;
}
.cp-loyalty-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
.cp-loyalty-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}
.cp-loyalty-tag {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Hero actions ── */
.cp-hero-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

/* ── KPI Grid ── */
.cp-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.cp-kpi-card {
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  transition: var(--transition);
}
.cp-kpi-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.cp-kpi-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.cp-kpi-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.cp-kpi-value { font-size: 1.25rem; font-weight: 900; }

.cp-kpi-green  { background: linear-gradient(135deg,#e8f8f0,#d4f1e4); }
.cp-kpi-green .cp-kpi-icon  { background: #27ae60; color: #fff; }
.cp-kpi-green .cp-kpi-value { color: #1a8a4a; }
.cp-kpi-green .cp-kpi-label { color: #2ecc71; }

.cp-kpi-pink   { background: linear-gradient(135deg,#fde8ef,#fbd0dd); }
.cp-kpi-pink .cp-kpi-icon   { background: #EC2754; color: #fff; }
.cp-kpi-pink .cp-kpi-value  { color: #c41e45; }
.cp-kpi-pink .cp-kpi-label  { color: #EC2754; }

.cp-kpi-blue   { background: linear-gradient(135deg,#e8f4fd,#d0e9f9); }
.cp-kpi-blue .cp-kpi-icon   { background: #3498db; color: #fff; }
.cp-kpi-blue .cp-kpi-value  { color: #2176ae; }
.cp-kpi-blue .cp-kpi-label  { color: #3498db; }

.cp-kpi-orange { background: linear-gradient(135deg,#fef5e7,#fdebd0); }
.cp-kpi-orange .cp-kpi-icon { background: #f39c12; color: #fff; }
.cp-kpi-orange .cp-kpi-value{ color: #d68910; }
.cp-kpi-orange .cp-kpi-label{ color: #f39c12; }

.cp-kpi-yellow { background: linear-gradient(135deg,#fefde7,#fdf9d0); }
.cp-kpi-yellow .cp-kpi-icon { background: #f1c40f; color: #fff; }
.cp-kpi-yellow .cp-kpi-value{ color: #b7950b; }
.cp-kpi-yellow .cp-kpi-label{ color: #d4ac0d; }

.cp-kpi-purple { background: linear-gradient(135deg,#f5eef8,#ebdef0); }
.cp-kpi-purple .cp-kpi-icon { background: #9b59b6; color: #fff; }
.cp-kpi-purple .cp-kpi-value{ color: #7d3c98; }
.cp-kpi-purple .cp-kpi-label{ color: #9b59b6; }

/* ── Charts layout ── */
.cp-charts-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  margin-bottom: 20px;
}
.cp-chart-main {}
.cp-chart-side {}

/* ── Legend ── */
.cp-legend { display: flex; flex-direction: column; gap: 8px; }
.cp-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
}
.cp-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cp-legend-name { flex: 1; font-weight: 600; color: var(--dark); }
.cp-legend-val  { font-weight: 800; color: var(--gray-700); white-space: nowrap; }

/* ── Payment badge ── */
.cp-pay-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: .75rem;
  font-weight: 700;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .cp-charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .cp-hero-content { padding: 20px 18px; gap: 16px; }
  .cp-name { font-size: 1.3rem; }
  .cp-avatar { width: 70px; height: 70px; font-size: 1.5rem; }
  .cp-loyalty { display: none; }
  .cp-hero-actions { flex-direction: row; }
  .cp-kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .cp-kpi-card { padding: 14px; }
  .cp-kpi-value { font-size: 1.05rem; }
}

/* ══════════════════════════════════════════
   STOCK PAGE
══════════════════════════════════════════ */

/* ── Banner de alerta crítico ── */
.stock-alert-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(231,76,60,0.35);
  animation: stockAlertPulse 2s ease-in-out infinite;
}
@keyframes stockAlertPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(231,76,60,0.35); }
  50%      { box-shadow: 0 4px 32px rgba(231,76,60,0.65); }
}
.stock-alert-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  animation: stockIconShake 1.5s ease-in-out infinite;
}
@keyframes stockIconShake {
  0%,100% { transform: rotate(0); }
  20%     { transform: rotate(-12deg); }
  40%     { transform: rotate(12deg); }
  60%     { transform: rotate(-6deg); }
  80%     { transform: rotate(6deg); }
}
.stock-alert-text { flex: 1; font-size: .9rem; font-weight: 600; }
.stock-alert-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: .9rem;
  transition: background .2s;
}
.stock-alert-close:hover { background: rgba(255,255,255,0.35); }

/* ── KPI Grid ── */
.stock-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stock-kpi-card {
  background: var(--white);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(236,39,84,0.06);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stock-kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stock-kpi-card.stock-kpi-danger { border-color: rgba(231,76,60,0.25); background: linear-gradient(135deg,#fff,#fff5f5); }
.stock-kpi-card.stock-kpi-warning { border-color: rgba(243,156,18,0.25); background: linear-gradient(135deg,#fff,#fffbf0); }
.stock-kpi-card.stock-kpi-success { border-color: rgba(39,174,96,0.25); background: linear-gradient(135deg,#fff,#f0fff6); }
.stock-kpi-icon {
  width: 50px; height: 50px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  flex-shrink: 0;
}
.stock-kpi-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--gray-500);
  margin-bottom: 3px;
}
.stock-kpi-value { font-size: 1.4rem; font-weight: 900; color: var(--dark); line-height: 1; }
.stock-kpi-sub   { font-size: .72rem; color: var(--gray-500); margin-top: 3px; }

/* Pulso animado no card crítico */
.stock-kpi-pulse {
  position: absolute;
  top: 10px; right: 10px;
  width: 10px; height: 10px;
  background: #e74c3c;
  border-radius: 50%;
  animation: stockPulse 1.4s ease-in-out infinite;
}
@keyframes stockPulse {
  0%   { transform: scale(1);   opacity: 1; box-shadow: 0 0 0 0 rgba(231,76,60,0.6); }
  70%  { transform: scale(1.1); opacity: .8; box-shadow: 0 0 0 8px rgba(231,76,60,0); }
  100% { transform: scale(1);   opacity: 1; box-shadow: 0 0 0 0 rgba(231,76,60,0); }
}

/* ── Charts row ── */
.stock-charts-row {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.stock-charts-row .card { flex: 1; min-width: 240px; }

/* ── Tabela: linha crítica / baixa ── */
.stock-row-critical { background: rgba(231,76,60,0.04) !important; }
.stock-row-critical:hover { background: rgba(231,76,60,0.08) !important; }
.stock-row-low      { background: rgba(243,156,18,0.04) !important; }
.stock-row-low:hover { background: rgba(243,156,18,0.08) !important; }

/* ── Item dot ── */
.stock-item-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Categoria badge ── */
.stock-cat-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  background: var(--light);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid rgba(236,39,84,0.15);
}

/* ── Barra de nível ── */
.stock-bar-wrap {
  width: 100%;
  height: 7px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
}
.stock-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .6s ease;
}

/* ── Legend ── */
.stock-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
}
.stock-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stock-legend-item span { flex: 1; color: var(--gray-700); font-weight: 600; }
.stock-legend-item strong { font-weight: 900; color: var(--dark); }

/* ── Move modal header colorido ── */
#moveModalHeader { transition: background .25s; border-radius: 16px 16px 0 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .stock-kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stock-kpi-card { padding: 14px; }
  .stock-kpi-value { font-size: 1.1rem; }
  .stock-charts-row { flex-direction: column; }
  .stock-alert-banner { flex-wrap: wrap; }
}
