/* =====================================================================
   Serviços — lista e ficha (mesmos tokens do design system)
   ===================================================================== */

/*
 * .svc-card__thumb continua aqui: servico.js (a ficha) reaproveita a
 * mesma classe pra própria miniatura. O resto do card antigo (vertical,
 * .svc-card/.svc-card__price/.svc-card__meta) morreu com o redesign da
 * listagem, abaixo — svc-list é a versão nova, horizontal.
 */
.svc-card__thumb {
  width: 46px; height: 46px; border-radius: var(--r-sm); flex: 0 0 auto;
  background: var(--surface-3); color: var(--text-3);
  display: grid; place-items: center; overflow: hidden;
}
.svc-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.svc-card__thumb svg { width: 20px; height: 20px; }

/* ------------------------------------------------------- CATEGORIAS -- */
.cat-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
}
.cat-row.is-off { opacity: .6; }

/* ---------------------------------------------------------- MOBILE --- */
@media (max-width: 720px) {
  .cat-row { align-items: flex-start; }
  .cat-row .input { flex: 1 1 100%; order: -1; }
}

/* =====================================================================
   LISTAGEM DE SERVIÇOS — tabela compacta e ordem administrativa
   ===================================================================== */
.svc-search { position: relative; flex: 1 1 300px; max-width: 440px; min-width: 180px; }
.svc-search > span {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  display: flex; color: var(--text-3); pointer-events: none;
}
.svc-search > span svg { width: 16px; height: 16px; }
.svc-search .input { width: 100%; padding-left: 34px; }
.svc-table-card { overflow: hidden; }
.svc-table th, .svc-table td { padding-block: 9px; }
.svc-table tbody tr:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.svc-table__money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.svc-table__old-price { margin-right: 4px; text-decoration: line-through; font-weight: 400; }

.svc-order { display: grid; gap: 16px; }
.svc-order__group { min-width: 0; }
.svc-grupo {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 7px;
}
.svc-grupo__nome { margin: 0; color: var(--text-2); font-size: 13px; font-weight: 700; }
.svc-grupo__n { color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.svc-order__list {
  overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface);
}
.svc-order-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center; gap: 10px; min-width: 0; padding: 9px 10px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.svc-order-row:last-child { border-bottom: 0; }
.svc-order-row:hover { background: var(--surface-2); }
.svc-order-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.svc-order-row.is-off { opacity: .62; }
.svc-order-row__copy { display: grid; min-width: 0; }
.svc-order-row__copy strong,
.svc-order-row__copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-order-row__copy span { color: var(--text-3); font-size: 11.5px; }
.svc-order-row__price { white-space: nowrap; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.svc-order-row .reorder-handle { position: static; }

@media (max-width: 720px) {
  #svcFiltros { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .svc-search { width: 100%; max-width: none; }
  .svc-table { min-width: 500px; }
  .svc-order-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .svc-order-row__price { display: none; }
}

@media (max-width: 390px) {
  .svc-table { min-width: 430px; }
  .svc-table th:nth-child(4), .svc-table td:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .svc-order-row { scroll-behavior: auto; }
}

/* =====================================================================
   PDV / Comanda
   ===================================================================== */
.pdv {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  gap: 16px; align-items: start; min-width: 0;
}
.pdv__main, .pdv__side { min-width: 0; max-width: 100%; }
.pdv__side { position: sticky; top: calc(var(--topbar-h) + 16px); }
.pdv__row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; min-width: 0; padding: 4px 0;
}
.pdv__row > :first-child { min-width: 0; overflow-wrap: anywhere; }
.pdv__row > :last-child { flex: 0 0 auto; white-space: nowrap; }
.pdv__row--total {
  border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px;
  font-size: 19px; font-weight: 700;
}
.pdv__totals .card__foot { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.pdv__table { min-width: 0; }
.pdv__table td { vertical-align: middle; }
.pdv__main .card, .pdv__side .card { min-width: 0; max-width: 100%; }
.pdv__main .table-wrap { max-width: 100%; overflow-x: auto; }
.input--sm { height: 32px; padding: 0 8px; font-size: 13px; }
.select--sm { height: 32px; padding: 0 26px 0 8px; font-size: 13px; background-size: 13px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Recebimento: composição oficial do modal, sem alterar seu contrato. */
.modal-root--payment .modal { width: min(720px, calc(100vw - 28px)); }
.modal-root--payment .modal__body { padding: 0; min-width: 0; }
.modal-root--payment .modal__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-modal {
  display: flex; flex-direction: column; gap: 0; min-width: 0; max-width: 100%;
}
.payment-modal__section { min-width: 0; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.payment-modal__section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; min-width: 0; margin-bottom: 12px;
}
.payment-modal__section-head > :first-child { min-width: 0; }
.payment-modal__section-head--compact { margin-bottom: 10px; }
.payment-modal__eyebrow {
  color: var(--brand-text, var(--brand)); font-size: 10px; font-weight: 750;
  letter-spacing: .08em; text-transform: uppercase;
}
.payment-modal__section-title { margin: 2px 0 0; font-size: 15px; font-weight: 700; }
.payment-modal__section-note { margin-top: 3px; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.payment-modal__amount { flex: 0 0 auto; color: var(--brand-text, var(--brand)); font-size: 17px; font-weight: 750; }
.payment-modal .pay-quick { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.payment-modal .pay-quick__btn { min-width: 0; padding-inline: 8px; overflow: hidden; }
.payment-modal .pay-quick__btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-modal__control-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, .7fr); gap: 12px; }
.payment-modal__control { min-width: 0; margin: 0; }
.payment-modal__control-label, .payment-modal .field__label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 650; }
.payment-modal__control--vale { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.payment-modal__control--vale .btn { max-width: 100%; }
.payment-modal__control .field__hint { display: block; margin-top: 3px; line-height: 1.35; }
.payment-modal__control--tip .input { width: 100%; min-width: 0; }
.payment-modal__row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(92px, 120px) 34px;
  align-items: center; gap: 6px; min-width: 0; margin-top: 8px;
}
.payment-modal__method, .payment-modal__value { width: 100%; min-width: 0; }
.payment-modal__method { overflow: hidden; text-overflow: ellipsis; }
.payment-modal__remove { width: 34px; height: 34px; padding: 0; }
.payment-modal__add { margin-top: 10px; }
.payment-modal__summary { margin: 16px 18px; min-width: 0; }
.payment-modal__summary .card__body { padding: 12px 14px; }
.payment-modal__summary .pdv__row { padding: 3px 0; }
.payment-modal__summary .pdv__row > :first-child { overflow-wrap: normal; }
.modal-root--payment .modal__foot { flex-wrap: wrap; }
.modal-root--payment .modal__foot .btn { min-width: 140px; }

@media (max-width: 640px) {
  .modal-root--payment .modal { width: 100vw; }
  .modal-root--payment .modal__head { padding-inline: 14px; }
  .payment-modal__section { padding: 14px; }
  .payment-modal__control-grid { grid-template-columns: 1fr; gap: 14px; }
  .payment-modal__summary { margin: 14px; }
  .modal-root--payment .modal__foot { padding-inline: 14px; }
  .modal-root--payment .modal__foot .btn { min-width: 0; flex: 1 1 140px; }
}

@media (max-width: 360px) {
  .payment-modal__section-head { gap: 8px; }
  .payment-modal__section-title { font-size: 14px; }
  .payment-modal__amount { font-size: 15px; }
  .payment-modal .pay-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-modal__row { grid-template-columns: minmax(0, 1fr) minmax(78px, 96px) 32px; gap: 4px; }
  .payment-modal__remove { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-root--payment .modal { animation: none; }
}

.appt-svc.is-off { opacity: .5; }

@media (max-width: 980px) {
  .pdv { grid-template-columns: 1fr; }
  .pdv__side { position: static; }
}

/* =====================================================================
   Compatibilidade com as variantes compactas existentes
   ===================================================================== */

/*
 * Fase 3.3 — mesma correção de zoom do Safari/iOS que app.css aplica a
 * `.input`/`.select` (ver lá o porquê), só que para as variantes "sm":
 * nasceram para o PDV/Comanda (desktop) e hoje são reaproveitadas em
 * quase toda barra de filtro do painel (Agenda, Agendamentos,
 * Bloqueios, Lista de espera, Segmentos...) — no celular, onde o teclado
 * do sistema realmente abre, 13px dispara o zoom automático.
 * 38px de altura (perto do padrão de 40px) evita texto de 16px
 * parecendo espremido num campo de 32px.
 */
@media (max-width: 900px) {
  .input--sm, .select--sm { font-size: 16px; height: 38px; }
  .select--sm { padding: 0 30px 0 10px; background-size: 14px; }
}

.pay-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.pay-quick__btn { height: 62px; flex-direction: column; gap: 4px; font-size: 13px; }
.pay-quick__btn svg { width: 20px; height: 20px; }

/* =====================================================================
   Metas
   =====================================================================
   A ficha usa uma única regra de empilhamento abaixo de 980px; as
   variantes compactas mantêm uma única correção de toque abaixo de 900px.
   ===================================================================== */
.meta-card { transition: border-color .14s, box-shadow .14s; }
/*
 * Fase 3.3 — mesma correção de zoom do Safari/iOS que app.css aplica a
 * `.input`/`.select` (ver lá o porquê), só que para as variantes "sm":
 * nasceram para o PDV/Comanda (desktop) e hoje são reaproveitadas em
 * quase toda barra de filtro do painel (Agenda, Agendamentos,
 * Bloqueios, Lista de espera, Segmentos...) — no celular, onde o
 * teclado do sistema realmente abre, 13px dispara o zoom automático.
 * 38px de altura (perto do padrão de 40px) evita texto de 16px
 * parecendo espremido num campo de 32px.
 */
@media (max-width: 900px) {
  .input--sm, .select--sm { font-size: 16px; height: 38px; }
  .select--sm { padding: 0 30px 0 10px; background-size: 14px; }
}

/* =====================================================================
   Metas
   ===================================================================== */
.meta-card { transition: border-color .14s, box-shadow .14s; }
.meta-card:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); cursor: pointer; }
.meta-card__bar { margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--border); }
.meta-card__pace {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--text-2); border-radius: 2px; opacity: .8;
}
.meta-card__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px; margin-top: 12px;
}
.meta-tiers {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.meta-tier {
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 8px 10px;
  background: var(--surface-2);
}
.meta-tier.is-on { border-color: var(--green); background: color-mix(in srgb, var(--green) 8%, transparent); }
@media (max-width: 720px) {
  .meta-card__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =====================================================================
   Clube de assinatura
   ===================================================================== */
.plan-card { transition: border-color .14s, box-shadow .14s; }
.plan-card:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); }
.plan-card.is-off { opacity: .62; }
.plan-benefits {
  display: grid; gap: 6px; padding: 10px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.plan-benefits .inline svg { width: 14px; height: 14px; color: var(--green); flex: 0 0 auto; }
.sub-row { padding: 7px 0; border-bottom: 1px solid var(--border); }
.sub-row:last-child { border-bottom: 0; }
.sub-covered {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green);
}
.sub-hint {
  border: 1px dashed var(--green); border-radius: var(--r-sm);
  padding: 8px 10px; background: color-mix(in srgb, var(--green) 7%, transparent);
}

/* =====================================================================
   Produtos e estoque
   ===================================================================== */
.prod-thumb {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex: 0 0 auto;
  object-fit: cover; background: var(--surface-3);
}
.prod-thumb--empty { display: grid; place-items: center; color: var(--text-3); }
.prod-thumb--empty svg { width: 18px; height: 18px; }
.prod-thumb--lg { width: 72px; height: 72px; border-radius: var(--r-md); }
.prod-thumb--lg.prod-thumb--empty svg { width: 30px; height: 30px; }
.prod-row:hover, .prod-row:focus-within { background: var(--surface-2); }
.prod-row__link { display: block; color: inherit; text-decoration: none; }
.prod-row__identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.prod-row__copy { min-width: 0; }
.prod-row__link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: var(--r-sm); }
.prod-card { display: block; color: inherit; text-decoration: none; transition: border-color .14s, box-shadow .14s; }
.prod-card:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); }
.prod-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.produtos-page .produtos-kpis .kpis { align-items: stretch; }
.produtos-page .produtos-kpis .kpi { min-height: 106px; padding: 14px; overflow: hidden; font-variant-numeric: tabular-nums; }
.produtos-page .produtos-kpis .kpi__value { overflow-wrap: normal; word-break: normal; white-space: nowrap; font-size: clamp(20px, 2vw, 28px); letter-spacing: -.025em; }
.produtos-page .produtos-kpis .kpi__label { line-height: 1.25; }
.produtos-page .produtos-kpis .kpi__rodape { margin-top: 6px; }
.produtos-page .produtos-kpis .kpi__rodape .badge { padding: 2px 6px; font-size: 10.5px; line-height: 1.25; }
.produtos-page .produtos-kpis__periodo .kpi { min-height: 90px; }
.produtos-page .produtos-kpis__periodo .kpi__value { font-size: clamp(18px, 1.6vw, 22px); }
.produtos-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); gap: 10px; }
.produtos-card { min-width: 0; }
.produtos-card__body { display: flex; flex-direction: column; gap: 10px; padding: 13px 14px; }
.produtos-card__identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.produtos-card__copy { min-width: 0; flex: 1 1 auto; }
.produtos-card__summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding-top: 9px; border-top: 1px solid var(--border); }
.produtos-card__stock, .produtos-card__price { min-width: 0; }
.produtos-card__stock > span, .produtos-card__price > span { display: block; margin-bottom: 2px; color: var(--text-3); font-size: 11px; }
.produtos-card__stock > div { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.produtos-card__stock b, .produtos-card__price b { font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.produtos-card__price { text-align: right; }
.produtos-card__metrics { display: flex; flex-wrap: wrap; gap: 3px 10px; color: var(--text-3); font-size: 11.5px; }
.produtos-card__metrics > span { white-space: nowrap; }
.produtos-card__metrics > span + span::before { content: '·'; margin-right: 10px; color: var(--border-strong); }
.produtos-card__progress { height: 4px; margin-top: 1px; }
.produtos-page .produtos-mobile-card { padding: 11px 12px; }
.produtos-page .produtos-mobile-card__identity { gap: 10px; }
.produtos-mobile-card__copy { min-width: 0; flex: 1 1 auto; }
.produtos-mobile-card__stock { flex: 0 0 auto; text-align: right; }
.produtos-mobile-card__stock .badge { margin-top: 3px; }
.produtos-page .produtos-mobile-card__metrics { margin-top: 10px; }
.produtos-page .produtos-mobile-card__toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 10px; padding: 8px 0 0; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text-2); font: inherit; font-size: 12px; font-weight: 650; }
.produtos-page .produtos-mobile-card__toggle svg { width: 15px; height: 15px; transition: transform .14s; }
.produtos-page .produtos-mobile-card.is-aberto .produtos-mobile-card__toggle svg { transform: rotate(180deg); }
.produtos-page .produtos-mobile-card__details { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 12px; }
.produtos-page .produtos-mobile-card__details > div { gap: 18px; }
.produtos-page .produtos-mobile-card__details b { color: var(--text); font-variant-numeric: tabular-nums; }
.fornecedores__head { align-items: flex-start; }
.fornecedores__identity { min-width: 0; flex: 1 1 auto; }
.fornecedores__meta { overflow-wrap: anywhere; }
.fornecedores__count { flex: 0 0 auto; text-align: right; }
.fornecedores__actions { flex-wrap: wrap; }
.money-warn { color: var(--amber); }

.prod-catalog-tools {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.prod-catalog-search { position: relative; flex: 1 1 320px; max-width: 440px; }
.prod-catalog-search > span {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  display: flex; color: var(--text-3); pointer-events: none;
}
.prod-catalog-search > span svg { width: 16px; height: 16px; }
.prod-catalog-search .input { width: 100%; padding-left: 34px; }
.prod-catalog-count { margin-left: auto; white-space: nowrap; }
.prod-catalog-list { overflow: hidden; }
.prod-catalog-table { border: 0; }
.prod-catalog-table .table td,
.prod-catalog-table .table th { padding-block: 9px; }
.prod-catalog-table .table td:nth-child(4),
.prod-catalog-table .table td:nth-child(5) { white-space: nowrap; }
.prod-catalog-mobile { display: none; }
.prod-mobile-row {
  padding: 10px 11px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.prod-mobile-row:last-child { border-bottom: 0; }
.prod-mobile-row:hover { background: var(--surface-2); }
.prod-mobile-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.prod-mobile-row__main { display: flex; align-items: center; gap: 9px; min-width: 0; }
.prod-mobile-row__copy { min-width: 0; flex: 1 1 auto; }
.prod-mobile-row__stock { flex: 0 0 auto; max-width: 112px; text-align: right; font-size: 12px; }
.prod-mobile-row__stock > b { display: block; white-space: nowrap; }
.prod-mobile-row__stock .badge { max-width: 100%; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-mobile-row__metrics { display: flex; justify-content: flex-end; gap: 14px; margin-top: 6px; }
.prod-mobile-row__metrics span { display: flex; align-items: baseline; gap: 5px; }
.prod-mobile-row__metrics small { color: var(--text-3); font-size: 10.5px; }
.prod-mobile-row__metrics b { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.produtos-filtros__principal { flex: 1 1 620px; min-width: 0; }
.produtos-filtros__principal > .field { flex: 1 1 168px; min-width: 132px; }
.produtos-filtros__principal > .filterbar__busca { flex: 2 1 240px; }
.produtos-filtros__modo { flex: 0 0 auto; }
.prod-detail-head { display: flex; gap: 18px; align-items: flex-start; }
.prod-detail-head__identity { display: flex; gap: 14px; align-items: flex-start; min-width: 0; flex: 1 1 360px; }
.prod-detail-head__copy { min-width: 0; }
.prod-detail-head__copy h1 { margin: 0; font-size: 21px; }
.prod-detail-head__side { flex: 0 1 360px; text-align: right; }
.prod-detail-head__price { font-size: 26px; font-weight: 750; letter-spacing: -.02em; }
.prod-detail-head__actions { justify-content: flex-end; gap: 6px; }
.prod-performance-bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.prod-performance-bars__col { flex: 1 1 0; min-width: 38px; text-align: center; }
.prod-performance-bars__bar { background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.tr-card__linha1.prod-card { color: inherit; text-decoration: none; align-items: center; }
.tr-card__linha1.prod-card:hover { color: inherit; }
.tr-card__grid > div { min-width: 0; }
.tr-card__grid > div > span { display: block; color: var(--text-3); font-size: 11px; }
.tr-card__grid > div > b { display: block; margin-top: 1px; overflow-wrap: anywhere; }
.tr-card__detalhes { gap: 5px; font-size: 12.5px; }
.tr-card.is-aberto .tr-card__detalhes { display: grid; }
.tr-card__detalhes > div { display: flex; justify-content: space-between; gap: 12px; }
.tr-card__acoes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

@media (max-width: 900px) {
  .produtos-filtros__modo { margin-left: 0; }
}

@media (max-width: 720px) {
  .prod-catalog-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .prod-catalog-search { grid-column: 1 / -1; width: 100%; max-width: none; }
  .prod-catalog-count { align-self: center; }
  .prod-catalog-table { display: none; }
  .prod-catalog-mobile { display: block; }
  .prod-detail-head { flex-direction: column; gap: 12px; }
  .prod-detail-head__identity, .prod-detail-head__side { flex: 1 1 auto; width: 100%; }
  .prod-detail-head__side { text-align: left; }
  .prod-detail-head__actions { justify-content: flex-start; }
  .prod-performance-bars { gap: 6px; }
  .prod-performance-bars__col { min-width: 30px; }
}

@media (max-width: 640px) {
  .produtos-filtros { gap: 12px; }
  .produtos-filtros__principal { flex-basis: 100%; }
  .produtos-filtros__principal > .filterbar__busca { flex-basis: 100%; }
  .produtos-filtros__modo .field__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .produtos-filtros__modo .segmented__txt { display: none; }
  .prod-detail-head__identity { gap: 10px; }
  .prod-thumb--lg { width: 58px; height: 58px; }
  .prod-detail-head__price { font-size: 23px; }
  .produtos-page .produtos-kpis__destaque .kpis,
  .produtos-page .produtos-kpis__periodo .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .produtos-page .produtos-kpis .kpi { min-height: 94px; padding: 10px; }
  .produtos-page .produtos-kpis .kpi__label { font-size: 11px; }
  .produtos-page .produtos-kpis .kpi__value { font-size: clamp(18px, 6vw, 23px); }
  .produtos-page .produtos-kpis .kpi__rodape { margin-top: 4px; }
  .produtos-page .produtos-kpis__periodo .kpi { min-height: 82px; }
  .produtos-cards { grid-template-columns: 1fr; gap: 8px; }
  .produtos-card__body { padding: 11px 12px; }
  .produtos-page .produtos-mobile-card { padding: 10px 11px; }
  .produtos-page .produtos-mobile-card__identity { gap: 8px; }
  .produtos-page .produtos-mobile-card__metrics { margin-top: 8px; }
  .produtos-page .produtos-mobile-card__toggle { margin-top: 8px; padding-top: 7px; font-size: 11.5px; }
  .produtos-page .produtos-mobile-card__toggle svg { width: 13px; height: 13px; }
  .produtos-page .produtos-mobile-card__details { margin-top: 7px; padding-top: 7px; }
  .produtos-page .produtos-mobile-card__details > div { gap: 12px; }
}

@media (max-width: 390px) {
  .produtos-page .produtos-kpis .kpi { min-height: 96px; padding: 10px; }
  .produtos-page .produtos-kpis .kpi__label { font-size: 11px; }
  .produtos-page .produtos-kpis .kpi__value { font-size: clamp(17px, 5.6vw, 21px); }
  .produtos-page .produtos-kpis .kpi__ico { width: 30px; height: 30px; }
  .produtos-page .produtos-kpis .kpi__rodape { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}

/* Formulário de produto: os grupos seguem legíveis no modal e viram uma
   coluna antes de os campos começarem a competir pela mesma linha. */
.prod-form { display: flex; flex-direction: column; gap: 18px; }
.prod-form__section { padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.prod-form__section:last-child { padding-bottom: 0; border-bottom: 0; }
.prod-form__section-title { margin-bottom: 12px; font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .04em; text-transform: uppercase; }
.prod-form__identity { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.prod-form__photo {
  width: 72px; height: 72px; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-3); color: var(--text-3); display: grid; place-items: center; flex: 0 0 auto;
}
.prod-form__photo img { width: 100%; height: 100%; object-fit: cover; }
.prod-form__photo svg { width: 28px; height: 28px; }
.prod-form__photo-actions { min-width: 0; }
.prod-form__photo-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.prod-form__photo-actions .field__hint { margin-top: 6px; }
.prod-form__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.prod-form__grid .field { margin-bottom: 0; min-width: 0; }
.prod-form__grid--identity { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); }
.prod-form__grid--price { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.prod-form__grid--stock { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.prod-form__grid--commission { grid-template-columns: minmax(0, 2fr) minmax(130px, 1fr); }
.prod-form__calculated { display: flex; align-items: center; min-height: 40px; overflow: hidden; }
.prod-form__checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }

@media (max-width: 720px) {
  .prod-form { gap: 15px; }
  .prod-form__section { padding-bottom: 15px; }
  .prod-form__identity { align-items: flex-start; }
  .prod-form__photo-buttons .btn { flex: 1 1 auto; }
  .prod-form__grid,
  .prod-form__grid--identity,
  .prod-form__grid--price,
  .prod-form__grid--commission { grid-template-columns: 1fr; }
  .prod-form__grid--stock { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prod-form__checks { flex-direction: column; align-items: flex-start; gap: 12px; }
}

@media (max-width: 390px) {
  .prod-form__identity { flex-direction: column; }
  .prod-form__photo-actions { width: 100%; }
  .prod-form__photo-buttons .btn { flex-basis: calc(50% - 4px); }
  .prod-form__grid--stock { grid-template-columns: 1fr; }
  [data-open-cat] { align-items: flex-start; flex-wrap: wrap; }
  [data-open-cat] > .b { flex: 1 1 calc(100% - 130px); min-width: 0; }
  [data-open-cat] > .spacer { display: none; }
  [data-open-cat] > .dim { flex: 1 1 auto; margin-left: 102px; }
}


/* =====================================================================
   Financeiro
   ===================================================================== */
.dre tbody tr:hover { background: var(--surface-2); }
.dre .dre-total td { border-top: 1px solid var(--border-strong); background: var(--surface-2); }
.dre .dre-result td { border-top: 2px solid var(--border-strong); font-size: 15px; }

/* O gráfico de barras do financeiro precisa caber no celular: as colunas
   encolhem em vez de empurrar a página. */
.fin-bars {
  display: flex; align-items: flex-end; gap: 3px; height: 150px;
  min-width: 0; overflow-x: auto; overflow-y: hidden;
}
.fin-bars__col { flex: 1 1 0; min-width: 6px; text-align: center; }
@media (max-width: 720px) {
  .fin-bars__col .dim { display: none; }
}

/* Cabeçalho de card com muitos elementos precisa quebrar no celular,
   senão o badge + botões de exportar empurram a página. */
.card__head--wrap { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 720px) {
  .card__head { flex-wrap: wrap; row-gap: 8px; }
  .card__head .spacer { flex-basis: 100%; height: 0; }
}

/* =====================================================================
   MODAL CRIAR/EDITAR SERVIÇO (service-form.js)
   ---------------------------------------------------------------------
   .row (design system, app.css) alinha os campos pelo rodapé —
   align-items: flex-end — pensado pra quando os hints dos campos vizinhos
   têm o mesmo tamanho. Neste formulário eles variam muito ("Limite por
   dia" tem 1 linha de hint, "Recompra a cada" tem 4): o flex-end empurra
   o campo mais curto pra baixo até sobrar espaço em branco maior que o
   próprio campo, e o label da direita nasce ACIMA do da esquerda — o
   "formulário torto" reportado. Alinhar pelo topo resolve: os dois
   nascem juntos na mesma linha, e só o hint mais longo estica pra baixo.
   ===================================================================== */
.svc-form .row { align-items: flex-start; }

/* =====================================================================
   CATEGORIAS — accordion (categorias-servico.js)
   ===================================================================== */
.cat-acc { position: relative; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-2); overflow: hidden; }
.cat-acc + .cat-acc { margin-top: 8px; }
.cat-acc__head {
  display: flex; align-items: center; gap: 10px; padding: 12px 116px 12px 14px;
  cursor: pointer; list-style: none; user-select: none; min-width: 0;
}
.cat-acc__head::-webkit-details-marker { display: none; }
.cat-acc__chevron { flex: 0 0 auto; color: var(--text-3); display: flex; transition: transform .15s; }
.cat-acc[open] .cat-acc__chevron { transform: rotate(90deg); }
.cat-acc__nome { font-weight: 650; }
.cat-acc__acoes { position: absolute; top: 8px; right: 10px; display: flex; align-items: center; gap: 2px; }
.cat-acc__body { border-top: 1px solid var(--border); padding: 4px 14px 10px; }

.cat-acc__svc {
  display: flex; align-items: center; gap: 10px; padding: 0 4px;
  border-bottom: 1px solid var(--border); border-radius: var(--r-sm);
}
.cat-acc__svc:last-of-type { border-bottom: 0; }
.cat-acc__svc:focus-within, .cat-acc__svc:hover { background: var(--surface-3); }
.cat-acc__svc__abrir {
  display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0;
  padding: 10px 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer;
}
.cat-acc__svc__meta { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.cat-acc__svc__preco { flex: 0 0 auto; text-align: right; font-size: 13px; }

@media (max-width: 640px) {
  .cat-acc__head { gap: 6px 8px; padding: 10px 10px 48px; flex-wrap: wrap; }
  .cat-acc__acoes { top: auto; right: 10px; bottom: 8px; }
  .cat-acc__svc { flex-wrap: wrap; }
  .cat-acc__svc__preco { flex: 1 1 100%; text-align: left; }
}
