/* Hórus Barbearia · CRM de retorno · views/relatorios.css
   Relatórios: cabeçalho com período, resumo, grade de gráficos SVG, tooltip, tabelas. Todo seletor sob .v-relatorios. */

.v-relatorios { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.v-relatorios__head { margin-bottom: 0; }
.v-relatorios__head-main { min-width: 0; }
.v-relatorios__head .section-title { margin-bottom: 6px; }
.v-relatorios__period { flex: none; }
.v-relatorios__kpis { margin: 0; }
.v-relatorios__note { padding-top: 4px; }

/* ---------- grade de cards ---------- */
.v-relatorios__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.v-relatorios__card { min-width: 0; }
.v-relatorios__card--wide { grid-column: 1 / -1; }
.v-relatorios__head-text { min-width: 0; flex: 1 1 auto; }
.v-relatorios__card .card__sub { line-height: 1.45; }
.v-relatorios__toggle { flex: none; }
.v-relatorios__card .card__foot { flex-wrap: wrap; }
.v-relatorios__card .card__foot .small { line-height: 1.4; }
.v-relatorios__card .card__body { display: flex; flex-direction: column; flex: 1 1 auto; }
.v-relatorios__viz, .v-relatorios__tbl { min-width: 0; }

/* ---------- gráfico SVG (colunas, linha, empilhado) ---------- */
.v-relatorios__chart { position: relative; min-width: 0; width: 100%; overflow: visible; }
.v-relatorios__svg { display: block; width: 100%; max-width: 100%; height: auto; overflow: visible; outline: none; }
.v-relatorios__svg:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; border-radius: 4px; }
.v-relatorios__svg text { font-family: var(--mono); font-size: 11px; font-variant-numeric: tabular-nums; fill: var(--text-3); }
.v-relatorios__svg .v-relatorios__val { fill: var(--text-2); font-weight: 500; }
.v-relatorios__svg .v-relatorios__axis.is-current { fill: var(--text-2); font-weight: 500; }
.v-relatorios__svg .v-relatorios__axis.is-empty { fill: var(--line-strong); }
/* hover: gráfico de um tom clareia a marca; barbeiro e situação mantêm a própria cor (só um brilho), a identidade não pode mudar */
.v-relatorios__mark { transition: fill var(--t) var(--ease), filter var(--t) var(--ease); }
.v-relatorios__mark.is-hover { filter: brightness(1.18); }
.v-relatorios__mark--mono.is-hover { fill: var(--green-400); filter: none; }
.v-relatorios__band { cursor: crosshair; }

/* ---------- tooltip ---------- */
.v-relatorios__tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px; max-width: 260px; padding: 8px 10px;
  background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.5);
  font-size: 12px; line-height: 1.4; color: var(--text-2); transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
}
.v-relatorios__tip.is-below { transform: translate(-50%, 10px); }
.v-relatorios__tip-title { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.v-relatorios__tip-line { display: flex; align-items: center; gap: 0; }
.v-relatorios__tip-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-3)); margin-right: 7px; flex: none; }

/* ---------- barras horizontais (situação, serviços) ---------- */
.v-relatorios__hb { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.v-relatorios__hb-row { display: grid; grid-template-columns: 148px minmax(0, 1fr) auto; gap: 8px 14px; align-items: center; min-width: 0; padding: 4px 0; border-radius: 6px; cursor: default; }
.v-relatorios__hb-row:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.v-relatorios__hb-label { min-width: 0; display: flex; align-items: center; font-size: 14px; font-weight: 500; }
.v-relatorios__hb-bar { min-width: 0; }
.v-relatorios__hb-bar svg { display: block; width: 100%; height: 12px; }
.v-relatorios__hb-val { display: flex; align-items: baseline; gap: 8px; justify-content: flex-end; white-space: nowrap; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.v-relatorios__hb-val .mono { font-weight: 500; }
.v-relatorios__hb-pct { font-size: 12px; color: var(--text-3); font-family: var(--mono); min-width: 3.2em; text-align: right; }
.v-relatorios__hb--services .v-relatorios__hb-pct { min-width: 5.6em; }
.v-relatorios__hb--services .v-relatorios__hb-label { color: var(--text); }
.v-relatorios__status-link { display: inline-flex; border-radius: var(--radius-pill); transition: transform var(--t) var(--ease); }
.v-relatorios__status-link:hover { transform: translateX(2px); }
.v-relatorios__status-link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- por barbeiro ---------- */
.v-relatorios__barber { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; align-items: start; min-width: 0; }
.v-relatorios__barber-table, .v-relatorios__barber-chart { min-width: 0; }
.v-relatorios__legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
.v-relatorios__table td.num, .v-relatorios__table th { white-space: nowrap; }
.v-relatorios__table .barber-chip { color: var(--text); font-size: 14px; }
.v-relatorios__barber-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.v-relatorios__table tr.is-current td { color: var(--text-2); }
.v-relatorios__table tr.is-current td:first-child { color: var(--text); }

/* ---------- destaques ---------- */
.v-relatorios__facts { display: flex; flex-direction: column; }
.v-relatorios__fact { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.v-relatorios__fact:first-child { padding-top: 0; }
.v-relatorios__fact:last-child { border-bottom: 0; padding-bottom: 0; }
.v-relatorios__fact-ico { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); display: flex; align-items: center; justify-content: center; flex: none; }
.v-relatorios__fact.is-warn .v-relatorios__fact-ico { background: rgba(245,185,66,.14); color: var(--st-risco); }
.v-relatorios__fact.is-ok .v-relatorios__fact-ico { background: var(--green-tint); color: var(--green-400); }
.v-relatorios__fact-text { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.45; padding-top: 5px; color: var(--text); overflow-wrap: anywhere; }

/* ---------- tablet: sidebar recolhida, cards mais estreitos ---------- */
@media (max-width: 1100px) {
  .v-relatorios__barber { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .v-relatorios__hb-row { grid-template-columns: 136px minmax(0, 1fr) auto; }
}

/* ---------- mobile ---------- */
@media (max-width: 768px) {
  .v-relatorios { gap: 16px; }
  .v-relatorios__head { flex-direction: column; align-items: stretch; gap: 12px; }
  .v-relatorios__period .chip { flex: 1 1 0; justify-content: center; }
  .v-relatorios__grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .v-relatorios__card .card__head { flex-wrap: wrap; }
  /* rótulo e valor na primeira linha, barra inteira na segunda (posição explícita, senão o valor cai para uma terceira linha) */
  .v-relatorios__hb-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .v-relatorios__hb-label { grid-column: 1; grid-row: 1; }
  .v-relatorios__hb-val { grid-column: 2; grid-row: 1; }
  .v-relatorios__hb-bar { grid-column: 1 / -1; grid-row: 2; }
  .v-relatorios__hb-pct { min-width: 0; }
  .v-relatorios__hb--services .v-relatorios__hb-pct { min-width: 0; }
  .v-relatorios__tip { max-width: calc(100vw - 48px); white-space: normal; }
  .v-relatorios__legend { gap: 6px 14px; }
}
