/* ===== Área administrativa: dashboard + clientes ===== */

/* Gráfico financeiro (MRR/nMRR/Receita + Churn) */
.fin-chart { width: 100%; height: auto; display: block; }
.fin-chart__axis { font-size: 11px; fill: var(--text-3); }
.fin-chart__axis--churn { fill: #b06a00; }
.fin-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.fin-legend__item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.fin-legend__swatch { width: 18px; height: 4px; border-radius: 2px; background: var(--swatch); }
.fin-legend__swatch--dashed {
  background: repeating-linear-gradient(90deg, var(--swatch) 0 5px, transparent 5px 9px);
}

/* Stat card clicável (atendimentos aguardando) */
.stat-card--link { display: block; color: inherit; }
.stat-card--link:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-card--alert {
  border-color: #f0a24b;
  background: var(--orange-tonal, #fff4e5);
}
.stat-card--alert .stat-value { color: #9a6700; }
.stat-card--alert:hover { border-color: #e08a2c; }

/* ----- Gráficos (SVG responsivo via viewBox) ----- */
.admin-charts { align-items: stretch; }
.chart-wrap { margin-top: 10px; overflow-x: auto; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-axis { stroke: var(--border-strong); stroke-width: 1; }
.chart-label { font-size: 11px; fill: var(--text-2); font-family: inherit; }
.chart-dot { fill: #fff; stroke: #d62976; stroke-width: 2; }
.chart-dot:hover { fill: #d62976; }
.chart-bar { fill: var(--primary); }
.chart-bar:hover { fill: var(--primary-hover); }
.chart-bar--zero { fill: var(--border-strong); }
.chart-empty { padding: 26px 0; }
.chart-empty p { margin-bottom: 0; }

@media (max-width: 900px) {
  .admin-charts { grid-template-columns: 1fr; }
}

/* ----- Mini-lista de últimos clientes ----- */
.admin-mini-list { display: flex; flex-direction: column; }
.admin-mini-list__row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px; border-bottom: 1px solid var(--border);
}
.admin-mini-list__row:last-child { border-bottom: none; }
.admin-mini-list__body { flex: 1; min-width: 0; }
.admin-mini-list__name { font-weight: 650; }
.admin-mini-list__body div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Filtros de clientes ----- */
.admin-filters {
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}
.admin-filters .field { margin-bottom: 0; flex: 1; min-width: 140px; }
.admin-filters__q { flex: 2 1 240px; }
.admin-filters__actions { display: flex; align-items: center; gap: 6px; padding-bottom: 1px; }

/* ----- Tabela de clientes ----- */
.admin-table-wrap { overflow-x: auto; }
.admin-client-cell { display: flex; align-items: center; gap: 10px; }
.admin-client-cell__body { min-width: 0; }
.admin-client-cell__name { font-weight: 650; }
.admin-ig-handle { font-weight: 600; margin-right: 4px; }
.admin-row-actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.admin-row-actions .button_to { margin: 0; }

/* ----- Edição de cliente ----- */
.admin-edit-grid { align-items: start; }
.admin-summary { margin: 0; }
.admin-summary__row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.admin-summary__row:last-child { border-bottom: none; }
.admin-summary__row dt { color: var(--text-2); font-size: 13.5px; }
.admin-summary__row dd { margin: 0; font-weight: 600; text-align: right; }

@media (max-width: 900px) {
  .admin-edit-grid { grid-template-columns: 1fr; }
}

/* ---- Motivos de cancelamento (churn intel) ---- */

.churn-reasons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}
.churn-reason__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 4px;
}
.churn-reason__track {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--surface-2);
  overflow: hidden;
}
.churn-reason__bar {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, #feda75, #d62976, #962fbf);
  min-width: 8px;
}

.churn-feedback { align-items: flex-start; }
.churn-feedback__quote { margin-top: 4px; font-style: italic; }
.churn-feedback__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  white-space: nowrap;
}

/* ---- Origem dos clientes (site próprio x Cardápio Web) ---- */

.origin-split {
  display: flex;
  height: 14px;
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--surface-2);
  margin-top: 10px;
}
.origin-split__seg--site { background: linear-gradient(90deg, #feda75, #d62976); }
.origin-split__seg--cw { background: var(--purple); }

.origin-legend {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 13px;
}
.origin-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: baseline;
}
.origin-dot--site { background: #d62976; }
.origin-dot--cw { background: var(--purple); }

/* ---- Log de falhas (Ver log) ---- */

.log-filters { display: flex; flex-direction: column; gap: 10px; }
.log-filters__group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.log-list { display: flex; flex-direction: column; }
.log-entry { border-bottom: 1px solid var(--border); }
.log-entry:last-child { border-bottom: none; }
.log-entry summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  cursor: pointer;
  list-style: none;
}
.log-entry summary::-webkit-details-marker { display: none; }
.log-entry summary:hover { background: var(--surface); }
.log-entry__source { flex: 0 0 auto; }
.log-entry__message {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.log-entry[open] .log-entry__message { white-space: normal; }
.log-entry__time { flex: 0 0 auto; white-space: nowrap; }
.log-entry__body { padding: 0 6px 14px; }
.log-entry__context { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.log-entry__trace {
  margin: 0;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
}
