/* Hórus Barbearia · CRM de retorno · view Clientes
   Todo seletor prefixado com .v-clientes. Desktop: tabela dentro de um card.
   Mobile: cada linha vira um card em grid (uma só árvore de DOM). */

.v-clientes { min-width: 0; }
.v-clientes__head { min-width: 0; }
.v-clientes .page-sub .link { font-weight: 500; }

/* ---------- toolbar: busca + ordenar + novo na primeira linha, chips na segunda ---------- */
.v-clientes__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; min-width: 0; }
.v-clientes__search { flex: 1 1 260px; max-width: 420px; }
.v-clientes__search .input { padding-right: 38px; }
.v-clientes__search .input::-webkit-search-cancel-button,
.v-clientes__search .input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.v-clientes__clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: flex; padding: 6px; border-radius: 6px; color: var(--text-3); }
.v-clientes__clear:hover { color: var(--text); background: rgba(255,255,255,.06); }
/* o core posiciona .search .ico à esquerda (lupa); o x dentro do botão fica no fluxo normal */
.v-clientes__search .v-clientes__clear .ico { position: static; transform: none; pointer-events: auto; color: inherit; }
.v-clientes__sort { display: flex; align-items: center; gap: 8px; flex: none; }
.v-clientes__sort > span { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.v-clientes__sort .select { width: auto; min-width: 168px; }
.v-clientes__new { flex: none; }
.v-clientes__chips { flex: 1 1 100%; order: 3; }
.v-clientes__chips .dot { width: 7px; height: 7px; }

/* ---------- painel e tabela (desktop) ---------- */
.v-clientes__panel { overflow: hidden; }
.v-clientes__table { min-width: 880px; }
.v-clientes .table th { padding: 12px 12px; }
.v-clientes .table td { padding: 10px 12px; }
.v-clientes .table th:first-child, .v-clientes .table td:first-child { padding-left: var(--card-pad); }
.v-clientes .table th:last-child, .v-clientes .table td:last-child { padding-right: 14px; }
.v-clientes__th { display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; letter-spacing: inherit; border-radius: 4px; }
.v-clientes__th:hover { color: var(--text); }
.v-clientes th[aria-sort="ascending"] .v-clientes__th, .v-clientes th[aria-sort="descending"] .v-clientes__th { color: var(--text); }
.v-clientes__th .ico { color: var(--green); }
.v-clientes__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.v-clientes__who { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; }
.v-clientes__id { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.3; }
.v-clientes__name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.v-clientes__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-clientes__sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v-clientes__sub--phone { display: none; font-family: var(--mono); }
.v-clientes .table tbody tr:hover .v-clientes__name,
.v-clientes .table tbody tr:focus-within .v-clientes__name { color: var(--green-400); }
.v-clientes__tag-new { background: var(--green-tint); color: var(--green-400); }

.v-clientes .c-phone { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.v-clientes .c-last, .v-clientes .c-cycle, .v-clientes .c-barber, .v-clientes .c-status { white-space: nowrap; }
.v-clientes .c-cycle { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.v-clientes .c-spend { font-weight: 500; }
.v-clientes .c-actions { text-align: right; white-space: nowrap; }
.v-clientes .c-actions .btn { vertical-align: middle; }
.v-clientes .c-actions .btn + .btn { margin-left: 6px; }
.v-clientes__wa:hover:not(:disabled) { color: var(--green-400); border-color: var(--green); }
.v-clientes__st { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.v-clientes__snz { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.v-clientes tr.is-pinned td { background: var(--green-tint); }

/* ---------- rodapé, vazio, nota ---------- */
.v-clientes__foot { justify-content: space-between; }
.v-clientes__empty { padding: 8px 0; }
.v-clientes__empty-alt { text-align: center; margin-top: -12px; padding-bottom: 20px; font-size: 13px; }
.v-clientes__empty-alt .link { font: inherit; font-weight: 600; }
.v-clientes__note { margin-top: 12px; }

/* ---------- tablet (sidebar recolhida): menos colunas, telefone sob o nome ---------- */
@media (max-width: 1100px) and (min-width: 769px) {
  .v-clientes__table { min-width: 720px; }
  .v-clientes .c-phone, .v-clientes .c-cycle { display: none; }
  .v-clientes__sub--phone { display: block; }
  .v-clientes__sub--desk { display: none; }
}

/* ---------- mobile: cada linha vira um card ---------- */
@media (max-width: 768px) {
  .v-clientes__toolbar { gap: 10px; margin-bottom: 14px; }
  .v-clientes__search { flex: 1 1 100%; max-width: none; }
  .v-clientes__chips { order: 2; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin: 0 calc(-1 * var(--pad-m)); padding: 2px var(--pad-m); flex-basis: calc(100% + 2 * var(--pad-m)); }
  .v-clientes__chips::-webkit-scrollbar { display: none; }
  .v-clientes__sort { order: 3; flex: 1 1 auto; min-width: 0; }
  .v-clientes__sort .select { flex: 1 1 auto; min-width: 0; }
  .v-clientes__new { order: 4; }

  .v-clientes__panel { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .v-clientes__panel .table-wrap { overflow: visible; }
  .v-clientes__table { min-width: 0; }
  .v-clientes .table tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas: "client client client actions" "status status last last" "sep sep sep sep" "cycle barber spend spend";
    align-items: center; gap: 10px 12px; padding: 14px; margin-bottom: 10px;
    background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .v-clientes .table tbody tr:hover { background: var(--surface-1); }
  .v-clientes .table tbody tr:active { background: var(--surface-2); }
  .v-clientes .table tbody tr::after { content: ''; grid-area: sep; height: 1px; background: var(--line); }
  .v-clientes .table td, .v-clientes .table td:first-child, .v-clientes .table td:last-child { display: block; padding: 0; min-width: 0; }
  .v-clientes .table .c-client { grid-area: client; }
  .v-clientes__sub--phone { display: block; }
  .v-clientes__sub--desk { display: none; }
  .v-clientes .table .c-actions { grid-area: actions; display: flex; gap: 8px; justify-content: flex-end; align-self: start; }
  .v-clientes .table .c-actions .btn + .btn { margin-left: 0; }
  .v-clientes .table .c-status { grid-area: status; display: flex; align-items: center; }
  .v-clientes .table .c-last { grid-area: last; display: flex; justify-content: flex-end; align-items: baseline; gap: 6px; text-align: right; font-size: 13px; white-space: nowrap; min-width: 0; }
  .v-clientes .table .c-last::before { content: attr(data-label); font-size: 12px; font-weight: 500; color: var(--text-3); }
  .v-clientes .table .c-cycle { grid-area: cycle; }
  .v-clientes .table .c-barber { grid-area: barber; }
  .v-clientes .table .c-spend { grid-area: spend; }
  .v-clientes .table .c-cycle, .v-clientes .table .c-barber, .v-clientes .table .c-spend { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 14px; white-space: nowrap; }
  .v-clientes .table .c-spend { align-items: flex-end; text-align: right; }
  .v-clientes .table .c-cycle::before, .v-clientes .table .c-barber::before, .v-clientes .table .c-spend::before {
    content: attr(data-label); font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3);
  }
  .v-clientes .table .c-barber .barber-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .v-clientes tr.is-pinned { border-color: var(--green); }
  .v-clientes tr.is-pinned td { background: transparent; }

  .v-clientes__foot { border: 0; padding: 6px 0 0; flex-direction: column; align-items: stretch; gap: 10px; text-align: center; }
  .v-clientes__foot .btn { width: 100%; }
  .v-clientes__empty { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
}
/* celular (até 430px, que cobre 360, 375, 390 e 414): o rótulo "Ordenar por" sai para o select
   e o botão Novo cliente caberem na mesma linha, em vez de o botão cair sozinho numa quarta linha */
@media (max-width: 430px) {
  .v-clientes__sort > span { display: none; }
  .v-clientes__sort { flex: 1 1 140px; }
}
