/* ── RelatAI — style.css ── */

body { font-family: 'IBM Plex Sans', sans-serif; }

.ra-wrapper {
  min-height: 100vh;
  background: var(--bg);
  padding: 28px 32px 48px;
  box-sizing: border-box;
}

/* HEADER */
.ra-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}
.ra-header-left  { display: flex; align-items: center; gap: 14px; }
.ra-header-right { display: flex; align-items: center; gap: 12px; }

.ra-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-dim);
  border: 1px solid rgba(167,139,250,.25);
  color: var(--accent);
  flex-shrink: 0;
}

.ra-title    { font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.ra-subtitle { font-size: 12.5px; color: var(--text-dim); margin: 2px 0 0; }

.ra-updated {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* STATE */
.ra-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}
.ra-spinner-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 14px;
}
.ra-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-md);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ra-spin .7s linear infinite;
}
@keyframes ra-spin { to { transform: rotate(360deg); } }

/* KPI GRID */
.ra-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.ra-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  transition: border-color .15s;
}
.ra-kpi-card:hover { border-color: var(--border-md); }

.ra-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.ra-kpi--green::before  { background: var(--green); }
.ra-kpi--blue::before   { background: var(--blue); }
.ra-kpi--accent::before { background: var(--accent); }
.ra-kpi--purple::before { background: var(--purple); }
.ra-kpi--yellow::before { background: var(--yellow); }
.ra-kpi--red::before    { background: var(--red); }

.ra-kpi-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.ra-kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 6px;
}
.ra-kpi-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.ra-kpi--green  .ra-kpi-value { color: var(--green); }
.ra-kpi--blue   .ra-kpi-value { color: var(--blue); }
.ra-kpi--accent .ra-kpi-value { color: var(--accent); }
.ra-kpi--purple .ra-kpi-value { color: var(--purple); }
.ra-kpi--yellow .ra-kpi-value { color: var(--yellow); }
.ra-kpi--red    .ra-kpi-value { color: var(--red); }

/* BALANCE ROW */
.ra-balance-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.ra-balance-card {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
}
.ra-balance-label { font-size: 12.5px; color: var(--text-dim); }
.ra-balance-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--mono);
}

/* TWO COLUMN */
.ra-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .ra-two-col { grid-template-columns: 1fr; }
}

/* SECTION CARD */
.ra-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.ra-section-card:last-child { margin-bottom: 0; }
.ra-two-col .ra-section-card { margin-bottom: 0; }

.ra-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.ra-section-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.ra-badge-info {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
}
.ra-count-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 20px;
  padding: 2px 10px;
}

/* CHART */
.ra-chart-wrap {
  padding: 20px;
  min-height: 160px;
  display: flex;
  align-items: flex-end;
}
.ra-chart-loading {
  color: var(--text-muted);
  font-size: 13px;
  width: 100%;
  text-align: center;
  padding: 40px 0;
}
.ra-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  height: 140px;
}
.ra-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
  justify-content: flex-end;
}
.ra-bar {
  width: 100%;
  background: var(--accent-dim);
  border: 1px solid rgba(167,139,250,.3);
  border-radius: 4px 4px 0 0;
  transition: background .15s;
  min-height: 4px;
  position: relative;
}
.ra-bar:hover { background: rgba(167,139,250,.35); }
.ra-bar-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text);
  white-space: nowrap;
  z-index: 10;
}
.ra-bar:hover .ra-bar-tooltip { display: block; }
.ra-bar-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  font-family: var(--mono);
}

/* PLANS LIST */
.ra-plans-list { padding: 8px 0; }
.ra-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.ra-plan-row:last-child { border-bottom: none; }
.ra-plan-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ra-plan-count {
  font-size: 11.5px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.ra-plan-mrr {
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  font-family: var(--mono);
  flex-shrink: 0;
}
.ra-plan-bar-wrap {
  width: 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  flex-shrink: 0;
}
.ra-plan-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

/* TABLE */
.ra-table-wrap {
  overflow-x: auto;
}
.ra-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ra-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.ra-table td {
  padding: 12px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ra-table tbody tr:last-child td { border-bottom: none; }
.ra-table tbody tr:hover td { background: var(--bg-card-hover); }

.ra-td-customer { font-weight: 500; }
.ra-td-email    { font-size: 11.5px; color: var(--text-muted); display: block; }
.ra-td-mrr      { color: var(--green); font-family: var(--mono); font-weight: 600; }
.ra-interval-badge {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid rgba(56,189,248,.2);
}
.ra-interval-badge.yearly {
  background: var(--purple-dim);
  color: var(--purple);
  border-color: rgba(167,139,250,.2);
}

/* COLOR HELPERS — agora em shared.css */

/* LIGHT THEME */
[data-theme="light"] .ra-wrapper       { background: #f4f5f9; }
[data-theme="light"] .ra-kpi-card      { background: #fff; border-color: #e2e5ef; }
[data-theme="light"] .ra-section-card  { background: #fff; border-color: #e2e5ef; }
[data-theme="light"] .ra-balance-card  { background: #fff; border-color: #e2e5ef; }
[data-theme="light"] .ra-section-header{ border-color: #e2e5ef; }
[data-theme="light"] .ra-plan-row      { border-color: #e2e5ef; }
[data-theme="light"] .ra-table th      { border-color: #e2e5ef; color: #7b82a0; }
[data-theme="light"] .ra-table td      { border-color: #e2e5ef; color: #1a1d2e; }
[data-theme="light"] .ra-table tbody tr:hover td { background: #f4f5f9; }
[data-theme="light"] .ra-kpi-sub       { color: #9399b3; }
[data-theme="light"] .ra-kpi-label     { color: #7b82a0; }
[data-theme="light"] .ra-badge-info    { background: #f4f5f9; border-color: #d0d4e8; color: #9399b3; }
[data-theme="light"] .ra-bar           { background: rgba(124,58,237,.12); }
[data-theme="light"] .ra-bar-wrap      { background: #e2e5ef; }
