/*
 * Kit da v2 do PAINEL DO SELLER: estilos dos componentes que so' o seller usa
 * (partials/v2/kit-web.php): passo a passo, cartao de produto, cartao de
 * integracao e folha inferior. Carregado depois de componentes/ e web.css.
 * Usa so' os tokens do kit (--tki-*): o escuro vem junto.
 */

/* ---------- Passo a passo (v2Passos) ---------- */
html.tki-layout .tki-steps {
  --tki-step-dot: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 8px;
  counter-reset: none;
}
html.tki-layout .tki-step {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
/* linha entre os passos */
html.tki-layout .tki-steps:not(.is-vertical) .tki-step:not(:last-child)::after {
  content: '';
  flex: 1 1 auto;
  min-width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--tki-border);
}
html.tki-layout .tki-steps:not(.is-vertical) .tki-step.is-done:not(:last-child)::after { background: var(--tki-primary); }
html.tki-layout .tki-step-dot {
  width: var(--tki-step-dot);
  height: var(--tki-step-dot);
  flex: 0 0 var(--tki-step-dot);
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--tki-border);
  background: var(--tki-card);
  color: var(--tki-muted);
}
html.tki-layout .tki-step-dot .tki-step-ok,
html.tki-layout .tki-step-dot svg.tki-step-ok { display: none; width: 16px; height: 16px; }
html.tki-layout .tki-step.is-current .tki-step-dot {
  border-color: var(--tki-primary);
  color: var(--tki-primary-text);
  box-shadow: 0 0 0 4px var(--tki-soft-primary-bg);
}
html.tki-layout .tki-step.is-done .tki-step-dot {
  border-color: var(--tki-primary);
  background: var(--tki-primary);
  color: #fff;
}
html.tki-layout .tki-step.is-done .tki-step-num { display: none; }
html.tki-layout .tki-step.is-done .tki-step-dot .tki-step-ok { display: block; }
html.tki-layout .tki-step-text { display: grid; min-width: 0; line-height: 1.25; }
html.tki-layout .tki-step-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--tki-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html.tki-layout .tki-step.is-next .tki-step-text strong { color: var(--tki-muted); font-weight: 500; }
html.tki-layout .tki-step-text small { font-size: 12px; color: var(--tki-muted); }

/* vertical: coluna com linha entre os pontos */
html.tki-layout .tki-steps.is-vertical { flex-direction: column; gap: 0; }
html.tki-layout .tki-steps.is-vertical .tki-step { align-items: flex-start; padding-bottom: 20px; }
html.tki-layout .tki-steps.is-vertical .tki-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: calc(var(--tki-step-dot) / 2 - 1px);
  top: calc(var(--tki-step-dot) + 4px);
  bottom: 4px;
  width: 2px;
  border-radius: 2px;
  background: var(--tki-border);
}
html.tki-layout .tki-steps.is-vertical .tki-step.is-done:not(:last-child)::before { background: var(--tki-primary); }
html.tki-layout .tki-steps.is-vertical .tki-step-text { padding-top: 5px; }
html.tki-layout .tki-steps.is-vertical .tki-step-text strong { white-space: normal; }

/* celular: so' o passo atual mostra o nome; os outros viram pontos */
@media (max-width: 575.98px) {
  html.tki-layout .tki-steps:not(.is-vertical) { --tki-step-dot: 28px; gap: 4px; }
  html.tki-layout .tki-steps:not(.is-vertical) .tki-step:not(.is-current) { flex: 0 1 auto; }
  html.tki-layout .tki-steps:not(.is-vertical) .tki-step:not(.is-current) .tki-step-text { display: none; }
  html.tki-layout .tki-steps:not(.is-vertical) .tki-step.is-current { flex: 1 1 auto; }
  html.tki-layout .tki-steps:not(.is-vertical) .tki-step-text small { display: none; }
}

/* ---------- Grade de produtos (v2CartaoProduto) ---------- */
html.tki-layout .tki-produtos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
html.tki-layout .tki-product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 !important;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
html.tki-layout .tki-product-card.is-link:hover {
  border-color: var(--tki-subtle, var(--tki-border));
  box-shadow: var(--tki-shadow-pop);
}
html.tki-layout .tki-product-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--tki-surface-2, var(--tki-bg));
  border-bottom: 1px solid var(--tki-border);
  display: grid;
  place-items: center;
  overflow: hidden;
}
html.tki-layout .tki-product-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
html.tki-layout .tki-product-ph { color: var(--tki-subtle, var(--tki-muted)); }
html.tki-layout .tki-product-ph svg { width: 36px; height: 36px; }
html.tki-layout .tki-product-badge { position: absolute; top: 10px; left: 10px; z-index: 2; }
html.tki-layout .tki-product-menu { position: absolute; top: 8px; right: 8px; z-index: 3; }
html.tki-layout .tki-product-menu :is(.tki-btn, .tki-menu-btn) { background: var(--tki-card); }
html.tki-layout .tki-product-body { padding: 14px 16px 16px; display: grid; gap: 6px; flex: 1; align-content: start; }
html.tki-layout .tki-product-sub {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--tki-muted);
  text-transform: none;
}
html.tki-layout .tki-product-title {
  margin: 0;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.35;
  color: var(--tki-fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
html.tki-layout .tki-product-link { color: inherit !important; text-decoration: none; }
/* o cartao inteiro abre o produto; o menu e os botoes ficam por cima */
html.tki-layout .tki-product-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }
html.tki-layout .tki-product-link:focus-visible { outline: none; }
html.tki-layout .tki-product-card:has(.tki-product-link:focus-visible) { box-shadow: var(--tki-ring); border-color: var(--tki-primary); }
html.tki-layout .tki-product-price { margin: 2px 0 0; display: flex; align-items: baseline; gap: 8px; }
html.tki-layout .tki-product-price strong { font-size: 18px; font-weight: 700; color: var(--tki-fg); font-variant-numeric: tabular-nums; }
html.tki-layout .tki-product-price s { font-size: 13px; color: var(--tki-muted); }
html.tki-layout .tki-product-meta {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--tki-muted);
}
html.tki-layout .tki-product-foot {
  position: relative;
  z-index: 2;
  padding: 12px 16px;
  border-top: 1px solid var(--tki-border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
html.tki-layout .tki-product-foot > .tki-btn { flex: 1 1 auto; justify-content: center; }
@media (max-width: 575.98px) {
  html.tki-layout .tki-produtos { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  html.tki-layout .tki-product-body { padding: 12px; }
  html.tki-layout .tki-product-price strong { font-size: 16px; }
  html.tki-layout .tki-product-foot { padding: 10px 12px; }
}

/* ---------- Catalogo de integracoes (v2CartaoIntegracao) ---------- */
html.tki-layout .tki-integracoes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
html.tki-layout .tki-integration-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px !important;
}
html.tki-layout .tki-integration-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
html.tki-layout .tki-integration-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--tki-border);
  background: var(--tki-card);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--tki-fg);
  flex-shrink: 0;
}
html.tki-layout .tki-integration-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
html.tki-layout .tki-integration-logo svg { width: 22px; height: 22px; }
html.tki-layout .tki-integration-title { margin: 4px 0 0; font-size: 16px !important; font-weight: 600 !important; color: var(--tki-fg); }
html.tki-layout .tki-integration-desc { margin: 0; font-size: 13px; line-height: 1.5; color: var(--tki-muted); flex: 1; }
html.tki-layout .tki-integration-foot { display: flex; gap: 8px; margin-top: 4px; }
html.tki-layout .tki-integration-foot > .tki-btn { flex: 1 1 auto; justify-content: center; }

/* ---------- Folha inferior (v2Folha) ----------
   Computador: modal centrado igual aos outros. Celular: sobe de baixo, largura
   toda, cantos de cima arredondados, alca para puxar e fechar, botoes do
   rodape em largura cheia (toque >= 44px). */
html.tki-layout .modal.tki-folha .tki-folha-alca { display: none; }
html.tki-layout .modal.tki-folha .tki-folha-destaque {
  margin: -4px 0 20px;
  padding: 14px 16px;
  border-radius: var(--tki-radius-control, 12px);
  background: var(--tki-surface-2, var(--tki-bg));
  border: 1px solid var(--tki-border);
}
@media (max-width: 575.98px) {
  html.tki-layout .modal.tki-folha .modal-dialog {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    width: 100%;
    max-width: none;
    min-height: 0;
    display: block;
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  }
  html.tki-layout .modal.tki-folha.show .modal-dialog { transform: none; }
  html.tki-layout .modal.tki-folha .modal-content {
    border-radius: 20px 20px 0 0 !important;
    border-bottom: 0 !important;
    max-height: 92vh;
    max-height: 92dvh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  /* alca: faixa de 24px para o dedo, com a barrinha no meio */
  html.tki-layout .modal.tki-folha .tki-folha-alca {
    display: block;
    position: relative;
    height: 24px;
    touch-action: none;
  }
  html.tki-layout .modal.tki-folha .tki-folha-alca::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 10px;
    width: 44px;
    height: 5px;
    margin-left: -22px;
    border-radius: 999px;
    background: var(--tki-border);
  }
  html.tki-layout .modal.tki-folha .modal-header { padding: 4px 20px 14px; }
  html.tki-layout .modal.tki-folha .modal-body { padding: 20px; }
  html.tki-layout .modal.tki-folha .modal-footer { padding: 12px 20px 16px; flex-wrap: nowrap; }
  html.tki-layout .modal.tki-folha .modal-footer > * { flex: 1 1 0; justify-content: center; min-height: 44px; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html.tki-layout .modal.tki-folha .modal-dialog { transition: none; }
}

/* ---------- Filtro de situacao em chips (v2FiltroChips) ----------
   Mesmo desenho dos chips da lista de Empresas do admin. */
html.tki-layout .tki-fchips {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
html.tki-layout .tki-fchips::-webkit-scrollbar { display: none; }
@media (min-width: 768px) {
  html.tki-layout .tki-fchips { flex-wrap: wrap; overflow-x: visible; }
}
html.tki-layout .tki-fchip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--tki-border);
  background: var(--tki-card);
  color: var(--tki-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
html.tki-layout .tki-fchip:hover { color: var(--tki-fg); background: var(--tki-hover); }
html.tki-layout .tki-fchip.active {
  border-color: var(--tki-primary);
  background: color-mix(in srgb, var(--tki-primary) 10%, var(--tki-card));
  color: var(--tki-primary-text, var(--tki-primary));
}
html.tki-layout .tki-fchip:focus-visible { outline: 2px solid var(--tki-primary-text, var(--tki-primary)); outline-offset: 2px; }
html.tki-layout .tki-fchip-n {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--tki-surface-2);
  color: var(--tki-fg-2);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
html.tki-layout .tki-fchip.active .tki-fchip-n { background: color-mix(in srgb, var(--tki-primary) 16%, var(--tki-card)); color: inherit; }
/* Faixa de chips dentro do cartao, entre o titulo e a busca */
html.tki-layout .tki-card > .tki-fchips { padding: 0 24px 4px; }
@media (max-width: 575.98px) {
  html.tki-layout .tki-card > .tki-fchips { padding: 0 16px 4px; }
}

/* ---------- Lista que troca sem recarregar (v2ListaViva + web.js) ---------- */
html.tki-layout section[data-web-lista][aria-busy='true'] .tki-filters-count { opacity: .55; }
html.tki-layout [data-web-lista-parte].web-lista-apagada { opacity: .45; pointer-events: none; transition: opacity .15s ease; }
html.tki-layout .web-lista-erro { padding: 40px 20px; }
html.tki-layout .web-contents { display: contents; }
