/* ===== REVENUE DASHBOARD ===== */

.rv-container {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.rv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.rv-header-left h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary, #e2e8f0);
  display: flex;
  align-items: center;
  gap: 10px;
}

.rv-header-left h2 i { color: #22c55e; }

.rv-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary, #94a3b8);
  margin-top: 2px;
  display: block;
}

.rv-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(15, 17, 30, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary, #e2e8f0);
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.rv-btn-secondary:hover { border-color: #22c55e; }

/* ===== KPI CARDS ===== */

.rv-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.rv-kpi-card {
  background: rgba(15, 17, 30, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all 0.2s;
}

.rv-kpi-card:hover { border-color: rgba(34, 197, 94, 0.2); transform: translateY(-1px); }

.rv-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.rv-kpi-card.mrr .rv-kpi-icon { background: rgba(34, 197, 94, 0.12); color: #22c55e; }
.rv-kpi-card.revenue .rv-kpi-icon { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.rv-kpi-card.churn .rv-kpi-icon { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.rv-kpi-card.ticket .rv-kpi-icon { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.rv-kpi-card.customers .rv-kpi-icon { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }

.rv-kpi-info { flex: 1; min-width: 0; }

.rv-kpi-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary, #94a3b8);
  margin-bottom: 4px;
  font-weight: 600;
}

.rv-kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary, #e2e8f0);
  line-height: 1.2;
}

.rv-kpi-trend {
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}

.rv-kpi-trend.up { color: #22c55e; }
.rv-kpi-trend.down { color: #ef4444; }

.rv-kpi-sub {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
  margin-top: 4px;
  display: block;
}

.rv-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

.rv-dot.paying { background: #22c55e; }
.rv-dot.free { background: #94a3b8; }
.rv-dot.trial { background: #f59e0b; }

/* Churn color classes */
.rv-kpi-card.churn.good .rv-kpi-value { color: #22c55e; }
.rv-kpi-card.churn.warn .rv-kpi-value { color: #f59e0b; }
.rv-kpi-card.churn.bad .rv-kpi-value { color: #ef4444; }


/* ===== CHART (CSS bars) ===== */

.rv-chart-section {
  margin-bottom: 28px;
}

.rv-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rv-section-title i { color: #22c55e; }

.rv-chart-container {
  background: rgba(15, 17, 30, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 24px;
  min-height: 280px;
}

.rv-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 250px;
  padding-top: 30px;
}

.rv-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.rv-bar-value {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-secondary, #94a3b8);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
}

.rv-bar-track {
  width: 100%;
  max-width: 48px;
  flex: 1;
  display: flex;
  align-items: flex-end;
  border-radius: 6px 6px 0 0;
  overflow: hidden;
}

.rv-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #22c55e, #16a34a);
  border-radius: 6px 6px 0 0;
  transition: height 0.8s ease;
  min-height: 4px;
}

.rv-bar-col.current .rv-bar-fill {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.rv-bar-col.current .rv-bar-value { color: #3b82f6; font-weight: 800; }

.rv-bar-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-primary, #e2e8f0);
  text-transform: uppercase;
}

.rv-bar-count {
  font-size: 0.6rem;
  color: var(--text-secondary, #94a3b8);
}


/* ===== TABS ===== */

.rv-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: rgba(15, 17, 30, 0.3);
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
}

.rv-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-secondary, #94a3b8);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rv-tab:hover { color: var(--text-primary, #e2e8f0); }

.rv-tab.active {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  font-weight: 600;
}


/* ===== TABLE ===== */

.rv-table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.rv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.rv-table thead th {
  background: rgba(15, 17, 30, 0.6);
  color: var(--text-secondary, #94a3b8);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

.rv-table tbody td {
  padding: 12px 16px;
  color: var(--text-primary, #e2e8f0);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.rv-table tbody tr:hover td {
  background: rgba(34, 197, 94, 0.03);
}

.rv-client-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rv-client-cell small {
  font-size: 0.72rem;
  color: var(--text-secondary, #94a3b8);
}

.rv-amount {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: #22c55e !important;
}

.rv-date {
  font-size: 0.78rem;
  color: var(--text-secondary, #94a3b8) !important;
  white-space: nowrap;
}

.rv-table code {
  font-size: 0.75rem;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
  color: #22c55e;
}

/* Status badges */
.rv-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.rv-status.active, .rv-status.paid { background: rgba(34, 197, 94, 0.1); color: #22c55e; }
.rv-status.pending { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.rv-status.overdue { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.rv-status.cancelled, .rv-status.failed { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.rv-status.suspended { background: rgba(148, 163, 184, 0.1); color: #94a3b8; }
.rv-status.refunded { background: rgba(168, 85, 247, 0.1); color: #a855f7; }

/* Empty & Loading */
.rv-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary, #94a3b8);
}

.rv-empty i { font-size: 3rem; color: rgba(34, 197, 94, 0.3); margin-bottom: 16px; }
.rv-empty p { margin-top: 8px; font-size: 0.9rem; }

.rv-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary, #94a3b8);
}

.rv-loading i { margin-right: 8px; color: #22c55e; }


/* ===== LIGHT THEME ===== */

[data-theme="light"] .rv-header-left h2 { color: #1e293b; }
[data-theme="light"] .rv-subtitle { color: #64748b; }

[data-theme="light"] .rv-kpi-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .rv-kpi-label { color: #475569; }
[data-theme="light"] .rv-kpi-value { color: #0f172a; }
[data-theme="light"] .rv-kpi-sub { color: #64748b; }

[data-theme="light"] .rv-chart-container {
  background: #ffffff;
  border-color: #e2e8f0;
}

[data-theme="light"] .rv-bar-value { color: #475569; }
[data-theme="light"] .rv-bar-label { color: #1e293b; }
[data-theme="light"] .rv-bar-count { color: #64748b; }

[data-theme="light"] .rv-tabs { background: #f1f5f9; }
[data-theme="light"] .rv-tab { color: #475569; }
[data-theme="light"] .rv-tab.active { background: rgba(34, 197, 94, 0.1); }

[data-theme="light"] .rv-table-wrapper { border-color: #e2e8f0; }
[data-theme="light"] .rv-table thead th { background: #f8fafc; color: #475569; border-bottom-color: #e2e8f0; }
[data-theme="light"] .rv-table tbody td { color: #1e293b; border-bottom-color: #f1f5f9; }
[data-theme="light"] .rv-table tbody tr:hover td { background: rgba(34, 197, 94, 0.04); }
[data-theme="light"] .rv-client-cell small { color: #64748b; }
[data-theme="light"] .rv-date { color: #64748b !important; }

[data-theme="light"] .rv-btn-secondary { background: #f1f5f9; border-color: #e2e8f0; color: #334155; }
[data-theme="light"] .rv-section-title { color: #1e293b; }
[data-theme="light"] .rv-empty { color: #475569; }
[data-theme="light"] .rv-loading { color: #475569; }


/* ===== RESPONSIVO ===== */

@media (max-width: 768px) {
  .rv-container { padding: 16px; }

  .rv-kpis {
    grid-template-columns: 1fr 1fr;
  }

  .rv-bar-chart {
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 4px;
  }

  .rv-bar-col { min-width: 50px; }

  .rv-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .rv-table { font-size: 0.78rem; }
}
