/**
 * Account Dashboard — /minha-conta
 * Classes: cp-dash-* (dashboard.js)
 * Estilo premium inspirado em Stripe/Vercel
 */

/* ============================================================
   LAYOUT
   ============================================================ */
.cp-dash-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 80px);
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px;
  gap: 0 32px;
  box-sizing: border-box;
}
@media (max-width: 768px) {
  .cp-dash-layout {
    grid-template-columns: 1fr;
    padding: 20px 12px;
    gap: 0;
  }
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.cp-dash-sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cp-dash-sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 20px;
  margin-bottom: 8px;
  border-bottom: 1px solid #E5E7EB;
}
.cp-dash-sidebar-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.cp-dash-sidebar-name {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
}
.cp-dash-sidebar-email {
  font-size: 12px;
  color: #6B7280;
  word-break: break-all;
}
.cp-dash-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cp-dash-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #4B5563;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.cp-dash-nav-btn:hover {
  background: #F3F4F6;
  color: #111827;
}
.cp-dash-nav-btn.active {
  background: #EFF6FF;
  color: #2563EB;
  font-weight: 600;
}
.cp-dash-nav-btn span {
  font-size: 16px;
  width: 20px;
  text-align: center;
}
.cp-dash-sidebar-back {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  padding: 8px 0;
  font-size: 13px;
  color: #6B7280;
  text-decoration: none;
  border-top: 1px solid #E5E7EB;
  transition: color 0.15s;
}
.cp-dash-sidebar-back:hover {
  color: #2563EB;
}

@media (max-width: 768px) {
  .cp-dash-sidebar {
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid #E5E7EB;
  }
  .cp-dash-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .cp-dash-nav-btn {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
    width: auto;
  }
  .cp-dash-sidebar-back {
    display: none;
  }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.cp-dash-main {
  min-width: 0;
}
.cp-dash-main h2 {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.cp-dash-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin: 0 0 28px;
}

/* ============================================================
   CARDS
   ============================================================ */
.cp-dash-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
.cp-dash-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.cp-dash-card-success {
  border-left: 4px solid #10B981;
  background: linear-gradient(135deg, #ECFDF5, #F0FDF4);
}
.cp-dash-card-info {
  border-left: 4px solid #3B82F6;
  background: linear-gradient(135deg, #EFF6FF, #F0F7FF);
}
.cp-dash-card-neutral {
  border-left: 4px solid #D1D5DB;
}
.cp-dash-card-icon {
  font-size: 28px;
  margin-bottom: 12px;
}
.cp-dash-card-body {
  flex: 1;
}
.cp-dash-card-body h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 16px;
}
.cp-dash-card-label {
  font-size: 12px;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.cp-dash-card-value {
  font-size: 26px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.cp-dash-card-success .cp-dash-card-value {
  color: #047857;
}
.cp-dash-card-sub {
  font-size: 13px;
  color: #6B7280;
}
.cp-dash-card-extra {
  font-size: 13px;
  color: #3B82F6;
  margin-top: 8px;
  font-weight: 500;
}

/* ============================================================
   INFO TABLE (Faturamento/Configurações)
   ============================================================ */
.cp-dash-info-table {
  width: 100%;
  border-collapse: collapse;
}
.cp-dash-info-table td {
  padding: 10px 0;
  font-size: 14px;
  color: #374151;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: top;
}
.cp-dash-info-table tr:last-child td {
  border-bottom: none;
}
.cp-dash-info-table td:first-child {
  font-weight: 500;
  color: #6B7280;
  width: 140px;
  padding-right: 16px;
}
.cp-dash-info-table td:last-child {
  font-weight: 600;
  color: #111827;
}
.cp-dash-info-table code {
  font-size: 11px;
  background: #F3F4F6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ============================================================
   FREE CALCULATIONS BAR
   ============================================================ */
.cp-dash-free-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #374151;
  margin-bottom: 8px;
}
.cp-dash-free-remaining {
  font-size: 20px;
  font-weight: 700;
  color: #2563EB;
}
.cp-dash-progress {
  width: 100%;
  height: 8px;
  background: #E5E7EB;
  border-radius: 999px;
  overflow: hidden;
}
.cp-dash-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6, #1D4ED8);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ============================================================
   STATS ROW
   ============================================================ */
.cp-dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}
.cp-dash-stat {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.cp-dash-stat-label {
  font-size: 12px;
  color: #6B7280;
  font-weight: 500;
  margin-bottom: 6px;
}
.cp-dash-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
}
@media (max-width: 600px) {
  .cp-dash-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.cp-dash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
}
.cp-dash-btn-primary {
  background: linear-gradient(135deg, #2563EB, #1D4ED8);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,0.3);
}
.cp-dash-btn-primary:hover {
  background: linear-gradient(135deg, #1D4ED8, #1E40AF);
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
  transform: translateY(-1px);
}
.cp-dash-btn-outline {
  background: #fff;
  color: #374151;
  border: 1px solid #D1D5DB;
}
.cp-dash-btn-outline:hover {
  background: #F9FAFB;
  border-color: #9CA3AF;
}
.cp-dash-btn-danger {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
}
.cp-dash-btn-danger:hover {
  background: #FEE2E2;
}
.cp-dash-btn-full {
  width: 100%;
  margin-top: 12px;
  box-sizing: border-box;
}
.cp-dash-btn-inline {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  color: #6B7280;
  transition: background 0.15s;
}
.cp-dash-btn-inline:hover {
  background: #F3F4F6;
}
.cp-dash-btn-save {
  color: #2563EB;
  font-weight: 600;
}

/* ============================================================
   GATE (login restrito)
   ============================================================ */
.cp-account-gate {
  max-width: 420px;
  margin: 60px auto;
  text-align: center;
  padding: 40px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.cp-account-gate h1 {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 8px;
}
.cp-account-gate p {
  font-size: 14px;
  color: #6B7280;
  margin: 0 0 24px;
}

/* Loading  */
.cp-account-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 14px;
  color: #6B7280;
  font-size: 14px;
}
.cp-account-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #E5E7EB;
  border-top-color: #2563EB;
  border-radius: 50%;
  animation: cpSpin .7s linear infinite;
}
@keyframes cpSpin { to { transform: rotate(360deg); } }

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] .cp-dash-layout,
.dark-mode .cp-dash-layout {
  color: #E5E7EB;
}
[data-theme="dark"] .cp-dash-sidebar-name,
.dark-mode .cp-dash-sidebar-name {
  color: #F3F4F6;
}
[data-theme="dark"] .cp-dash-sidebar-user,
.dark-mode .cp-dash-sidebar-user {
  border-color: #374151;
}
[data-theme="dark"] .cp-dash-nav-btn,
.dark-mode .cp-dash-nav-btn {
  color: #9CA3AF;
}
[data-theme="dark"] .cp-dash-nav-btn:hover,
.dark-mode .cp-dash-nav-btn:hover {
  background: #1F2937;
  color: #F3F4F6;
}
[data-theme="dark"] .cp-dash-nav-btn.active,
.dark-mode .cp-dash-nav-btn.active {
  background: #1E3A5F;
  color: #60A5FA;
}
[data-theme="dark"] .cp-dash-sidebar-back,
.dark-mode .cp-dash-sidebar-back {
  border-color: #374151;
  color: #9CA3AF;
}
[data-theme="dark"] .cp-dash-main h2,
.dark-mode .cp-dash-main h2 {
  color: #F3F4F6;
}
[data-theme="dark"] .cp-dash-card,
.dark-mode .cp-dash-card {
  background: #1F2937;
  border-color: #374151;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
[data-theme="dark"] .cp-dash-card:hover,
.dark-mode .cp-dash-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
[data-theme="dark"] .cp-dash-card-success,
.dark-mode .cp-dash-card-success {
  background: linear-gradient(135deg, #064E3B, #065F46);
  border-left-color: #10B981;
}
[data-theme="dark"] .cp-dash-card-info,
.dark-mode .cp-dash-card-info {
  background: linear-gradient(135deg, #1E3A5F, #1E40AF20);
  border-left-color: #60A5FA;
}
[data-theme="dark"] .cp-dash-card-value,
.dark-mode .cp-dash-card-value {
  color: #F3F4F6;
}
[data-theme="dark"] .cp-dash-card-success .cp-dash-card-value,
.dark-mode .cp-dash-card-success .cp-dash-card-value {
  color: #6EE7B7;
}
[data-theme="dark"] .cp-dash-card-body h3,
.dark-mode .cp-dash-card-body h3 {
  color: #E5E7EB;
}
[data-theme="dark"] .cp-dash-info-table td,
.dark-mode .cp-dash-info-table td {
  color: #D1D5DB;
  border-color: #374151;
}
[data-theme="dark"] .cp-dash-info-table td:last-child,
.dark-mode .cp-dash-info-table td:last-child {
  color: #F3F4F6;
}
[data-theme="dark"] .cp-dash-stat,
.dark-mode .cp-dash-stat {
  background: #1F2937;
  border-color: #374151;
}
[data-theme="dark"] .cp-dash-stat-value,
.dark-mode .cp-dash-stat-value {
  color: #F3F4F6;
}
[data-theme="dark"] .cp-dash-progress,
.dark-mode .cp-dash-progress {
  background: #374151;
}
[data-theme="dark"] .cp-dash-btn-outline,
.dark-mode .cp-dash-btn-outline {
  background: #1F2937;
  color: #D1D5DB;
  border-color: #4B5563;
}
[data-theme="dark"] .cp-dash-btn-danger,
.dark-mode .cp-dash-btn-danger {
  background: #7F1D1D;
  color: #FCA5A5;
  border-color: #991B1B;
}
[data-theme="dark"] .cp-account-gate,
.dark-mode .cp-account-gate {
  background: #1F2937;
  border-color: #374151;
}
[data-theme="dark"] .cp-account-gate h1,
.dark-mode .cp-account-gate h1 {
  color: #F3F4F6;
}

/* ============================================================
   HISTORY TABLE (payment history)
   ============================================================ */
.cp-dash-history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.cp-dash-history-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #E5E7EB;
  background: #F9FAFB;
}
.cp-dash-history-table td {
  padding: 12px;
  font-size: 13px;
  color: #374151;
  border-bottom: 1px solid #F3F4F6;
  font-weight: 500;
}
.cp-dash-history-table tbody tr:hover td {
  background: #F9FAFB;
}
.cp-dash-payment-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.cp-dash-payment-status.approved {
  background: #ECFDF5;
  color: #059669;
}
.cp-dash-payment-status.pending {
  background: #FFFBEB;
  color: #D97706;
}
.cp-dash-payment-status.rejected,
.cp-dash-payment-status.cancelled {
  background: #FEF2F2;
  color: #DC2626;
}
.cp-dash-payment-status.refunded {
  background: #EFF6FF;
  color: #2563EB;
}

[data-theme="dark"] .cp-dash-history-table th,
.dark-mode .cp-dash-history-table th {
  background: #111827;
  border-color: #374151;
  color: #9CA3AF;
}
[data-theme="dark"] .cp-dash-history-table td,
.dark-mode .cp-dash-history-table td {
  color: #D1D5DB;
  border-color: #2D3748;
}

/* ============================================================
   SILO GRID — "Meus Créditos" (6 silos user-facing)
   ============================================================ */
.cp-dash-silo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.cp-dash-silo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #E5E7EB;
  border-left: 4px solid var(--silo-c, #3B82F6);
  background: #FAFBFC;
  transition: box-shadow 0.2s, transform 0.15s;
}

.cp-dash-silo-item:hover {
  box-shadow: 0 3px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
}

.cp-dash-silo-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  padding-top: 2px;
}

.cp-dash-silo-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cp-dash-silo-label {
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cp-dash-silo-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--silo-c, #111827);
}

.cp-dash-silo-sub {
  font-size: 11px;
  color: #9CA3AF;
  font-weight: 500;
}

@media (max-width: 900px) {
  .cp-dash-silo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .cp-dash-silo-grid {
    grid-template-columns: 1fr;
  }
}

/* Dark mode */
[data-theme="dark"] .cp-dash-silo-item,
.dark-mode .cp-dash-silo-item {
  background: #111827;
  border-color: #374151;
  border-left-color: var(--silo-c, #60A5FA);
}

[data-theme="dark"] .cp-dash-silo-label,
.dark-mode .cp-dash-silo-label {
  color: #9CA3AF;
}

[data-theme="dark"] .cp-dash-silo-value,
.dark-mode .cp-dash-silo-value {
  color: var(--silo-c, #F3F4F6);
}

[data-theme="dark"] .cp-dash-silo-sub,
.dark-mode .cp-dash-silo-sub {
  color: #6B7280;
}
