/* ─────────────────────────────────────────────────────────────────────────────
   Aba Suporte do cliente (js/suporte.js) + texto leve das mensagens
   (js/support-text.js). Plano: docs/PLANO_SUPORTE_PAINEL.md §5.3.

   Carregado depois de hub → tokens → panel. Só variáveis do tokens.css (o tema
   escuro vem de graça); nada de cor fixa. Classes próprias com prefixo .sup-*;
   o resto reaproveita os componentes do painel (card, chip, callout, seg,
   empty-state, pager, badge, metric-meter).
   ───────────────────────────────────────────────────────────────────────────── */

/* ── raiz ─────────────────────────────────────────────────────────────────── */

.support-root {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}
.support-root > * { min-width: 0; }
.support-root input,
.support-root select,
.support-root textarea { font: inherit; color: var(--text); }

.sup-loading {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
}

.sup-title {
  margin: 0;
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  letter-spacing: -.01em;
  color: var(--text);
}
.sup-lead {
  margin: 2px 0 0;
  max-width: var(--maxw-prose);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.sup-card-title {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.sup-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.sup-back { align-self: flex-start; }
.app a.sup-kb-link { text-decoration: none; }

.sup-error-slot:empty { display: none; }
.sup-error-slot { margin: var(--sp-3) 0; }
.sup-error__action,
.sup-callout__action { margin-top: var(--sp-2); }

/* ── mural de avisos ──────────────────────────────────────────────────────── */

.sup-notices {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.sup-notice__body { flex: 1; min-width: 0; }
.sup-notice .st-text { font-size: var(--fs-sm); }

/* ── diretrizes do suporte (§12, D46) ─────────────────────────────────────── */
/* Classe própria: o painel.html não carrega o sitefoot.css (details.auth-help) e o
   .ob-step é só do Onboarding. Fechado, sobra só a linha do cabeçalho. */

.sup-guide {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.sup-guide__toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: 44px;
  padding: var(--sp-2) var(--sp-4);
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--r);
  font: inherit;
  text-align: left;
}
.sup-guide__toggle:hover { background: var(--surface-2); }
.sup-guide__toggle:focus-visible { outline-offset: -2px; }
.sup-guide__toggle > svg { flex-shrink: 0; color: var(--info); }
.sup-guide__title {
  flex: 1;
  min-width: 0;
  font-weight: var(--fw-semibold);
  overflow-wrap: anywhere;
}
.sup-guide__toggle > svg.sup-guide__chev { color: var(--muted-2); transition: transform .15s ease; }
.sup-guide__toggle[aria-expanded="true"] > svg.sup-guide__chev { transform: rotate(180deg); }
.sup-guide:not(.is-collapsed) .sup-guide__toggle { border-radius: var(--r) var(--r) 0 0; }
.sup-guide__body { padding: 0 var(--sp-4) var(--sp-3); }
.sup-guide__body[hidden] { display: none; }
.sup-guide__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.sup-guide__item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.sup-guide__item > svg { flex-shrink: 0; margin-top: 2px; color: var(--muted-2); }
.sup-guide__text { min-width: 0; overflow-wrap: anywhere; }
.app a.sup-guide__link {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.app a.sup-guide__link:hover { text-decoration-thickness: 2px; }

@media (prefers-reduced-motion: reduce) {
  .sup-guide__toggle > svg.sup-guide__chev { transition: none; }
}

/* ── lista ────────────────────────────────────────────────────────────────── */

.sup-list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.sup-list-head__text { min-width: 0; }

.sup-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.sup-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.sup-list > li + li { border-top: 1px solid var(--hairline); }

.sup-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sup-item:hover { background: var(--surface-2); }
.sup-item:focus-visible { outline-offset: -2px; }
.sup-item.has-new { box-shadow: inset 3px 0 0 var(--warn); }
.sup-item > svg { flex-shrink: 0; color: var(--muted-3); }

.sup-item__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.sup-item__top {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.sup-item__protocol {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--muted);
}
.sup-item__subject {
  overflow: hidden;
  font-weight: var(--fw-semibold);
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sup-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--muted);
}
.sup-item__dep::after {
  content: "·";
  margin-left: var(--sp-3);
  color: var(--muted-3);
}

.sup-pager { margin-top: 0; }

/* ── chamado ──────────────────────────────────────────────────────────────── */

.sup-head__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.sup-head__titles { flex: 1 1 280px; min-width: 0; }
.sup-head__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.sup-head__protocol {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--muted);
}
.sup-head__subject {
  margin: var(--sp-1) 0 0;
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text);
  overflow-wrap: anywhere;
}

.sup-kv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-3) var(--sp-5);
  margin: var(--sp-4) 0 0;
}
.sup-kv__row { min-width: 0; }
.sup-kv__row dt {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.sup-kv__row dd {
  margin: 2px 0 0;
  font-size: var(--fs-sm);
  color: var(--text);
  overflow-wrap: anywhere;
}

/* prazo da equipe e opção de e-mail (frases inteiras, abaixo da grade) */
.sup-head__notes {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin: var(--sp-3) 0 0;
  padding: 0;
  list-style: none;
}
.sup-head__note {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.sup-head__note > svg { flex-shrink: 0; margin-top: 2px; color: var(--muted-2); }
.sup-head__note > span { min-width: 0; overflow-wrap: anywhere; }

/* conversa */
.sup-conv {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.sup-msg {
  min-width: 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--r);
}
.sup-msg--mine { background: var(--accent-soft); border-color: var(--accent-border); border-left-color: var(--accent); }
.sup-msg--staff { border-left-color: var(--info); }
.sup-msg--system {
  background: var(--surface-2);
  border-style: dashed;
  border-left-style: solid;
  border-left-color: var(--muted-3);
}
.sup-msg--system .st-text { font-size: var(--fs-sm); color: var(--muted); }

.sup-msg__head {
  display: flex;
  align-items: baseline;
  gap: 2px var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-2);
}
.sup-msg__author { font-weight: var(--fw-semibold); color: var(--text); }
.sup-msg__role,
.sup-msg__via {
  padding: 0 6px;
  font-size: var(--fs-2xs);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--pill);
}
.sup-msg__time {
  margin-left: auto;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.sup-msg__body { color: var(--text); }

/* anexos da conversa */
.sup-files {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin: var(--sp-3) 0 0;
  padding: 0;
  list-style: none;
}
.sup-file {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  max-width: 100%;
  min-width: 0;
}
.sup-file.is-archived {
  flex-direction: row;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2);
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
}
.sup-file.is-archived > svg { flex-shrink: 0; }
.sup-file__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: var(--sp-1) var(--sp-2);
  color: var(--text);
  text-decoration: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.sup-file__link:hover { border-color: var(--border-strong); background: var(--surface-3); }
.sup-file__link > svg { flex-shrink: 0; color: var(--muted-2); }
.sup-file__info {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.sup-file__name {
  max-width: 240px;
  overflow: hidden;
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sup-file__size {
  flex-shrink: 0;
  font-size: var(--fs-2xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sup-thumb {
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border-radius: var(--r-sm);
}
.sup-thumb img {
  display: block;
  max-width: 240px;
  max-height: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

/* ── formulário e resposta ────────────────────────────────────────────────── */

.sup-form-card { width: 100%; max-width: 820px; }
.sup-form { display: flex; flex-direction: column; margin-top: var(--sp-4); }
.sup-field { margin-bottom: var(--sp-4); min-width: 0; }
.sup-field__label {
  display: block;
  margin-bottom: .35rem;
  font-size: .78rem;
  font-weight: var(--fw-semibold);
}
.sup-required { color: var(--danger); }
.sup-field__error {
  margin: var(--sp-1) 0 0;
  font-size: var(--fs-xs);
  color: var(--danger-ink);
}
.sup-field.is-invalid input,
.sup-field.is-invalid select,
.sup-field.is-invalid textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}
.sup-textarea {
  min-height: 96px;
  line-height: var(--lh-prose);
  resize: vertical;
}
.sup-form__foot {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.sup-reply .sup-card-title,
.sup-rate .sup-card-title { margin-bottom: var(--sp-2); }
.sup-reply__hint { margin: 0 0 var(--sp-3); }

/* caixa de anexos */
.sup-attach {
  position: relative;            /* segura o input escondido dentro da caixa */
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  padding: var(--sp-3);
  background: var(--inset);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
}
.sup-attach.is-drop { background: var(--accent-soft); border-color: var(--accent); }
.sup-attach [hidden] { display: none !important; }
/* .field input do hub (width:100%) não pode esticar o seletor escondido */
.sup-attach .sup-attach__input.visually-hidden {
  top: 0;
  left: 0;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0;
  pointer-events: none;
}
.sup-attach__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.sup-attach__usage {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sup-attach__meter > i { background: var(--accent); }
.sup-attach__meter.is-warn > i { background: var(--warn); }
.sup-attach__hint { margin: 0; }
.sup-attach__list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin: 0;
  padding: 0;
  list-style: none;
}
.sup-attach__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.sup-attach__item > svg { flex-shrink: 0; color: var(--muted-2); }
.sup-attach__item.is-error { background: var(--danger-soft); border-color: var(--danger-border); }
.sup-attach__info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.sup-attach__name {
  overflow: hidden;
  font-size: var(--fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sup-attach__sub { font-size: var(--fs-2xs); color: var(--muted); }
.sup-attach__item.is-uploading .sup-attach__sub { color: var(--accent-ink); }
.sup-attach__item.is-error .sup-attach__sub { color: var(--danger-ink); }
.sup-attach__remove { flex-shrink: 0; }
.sup-attach__msg { margin: 0; font-size: var(--fs-xs); color: var(--warn-ink); }

/* "Receber notificações por e-mail" (D45): fora do .field, no visual do .appwl-check */
.sup-notify { margin-bottom: var(--sp-4); }
.sup-check {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--text);
  cursor: pointer;
}
.sup-check input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; }
.sup-notify__hint { margin: var(--sp-1) 0 0; }

/* ── avaliação ────────────────────────────────────────────────────────────── */

.sup-rate__label {
  margin: var(--sp-3) 0 var(--sp-2);
  font-size: .78rem;
  font-weight: var(--fw-semibold);
  color: var(--text);
}
.sup-stars { display: flex; align-items: center; gap: 2px; }
.sup-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--muted-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.sup-star:hover { color: var(--warn); background: var(--surface-2); }
.sup-star svg { fill: none; }
.sup-star.is-on { color: var(--warn); }
.sup-star.is-on svg { fill: currentColor; }
.sup-stars--static .sup-star { width: auto; height: auto; cursor: default; }
.sup-stars--static .sup-star:hover { background: transparent; color: var(--muted-3); }
.sup-stars--static .sup-star.is-on:hover { color: var(--warn); }
.sup-rate__solved { margin-bottom: var(--sp-3); }

.sup-rated__line {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.sup-rated__text { font-weight: var(--fw-semibold); color: var(--text); }
.sup-rated__comment { margin-top: var(--sp-2); color: var(--text-2); }

/* ── texto leve (js/support-text.js) ──────────────────────────────────────── */

.st-text {
  min-width: 0;
  font-size: var(--fs-md);
  line-height: var(--lh-prose);
  color: inherit;
  overflow-wrap: anywhere;
}
.st-p { margin: 0; }
.st-p + .st-p,
.st-p + .st-code,
.st-code + .st-p,
.st-code + .st-code { margin-top: var(--sp-2); }
.st-code {
  max-width: 100%;
  max-height: 420px;
  margin: 0;
  padding: var(--sp-2) var(--sp-3);
  overflow: auto;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: var(--lh-ui);
  white-space: pre;
  color: var(--text);
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.st-code code { font-family: inherit; font-size: inherit; background: none; border: 0; padding: 0; }
.st-link {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.st-link:hover { text-decoration-thickness: 2px; }

/* ── celular ──────────────────────────────────────────────────────────────── */

@media (max-width: 560px) {
  .sup-list-head { align-items: stretch; }
  .sup-list-head .sup-actions { width: 100%; }
  .sup-list-head .sup-actions > .btn { flex: 1 1 auto; }
  .sup-item { padding: var(--sp-3); }
  .sup-msg { padding: var(--sp-3); }
  .sup-msg__time { width: 100%; margin-left: 0; }
  .sup-kv { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .sup-file__name { max-width: 56vw; }
  .sup-thumb img { max-width: 100%; }
  .sup-form__foot > .btn { flex: 1 1 auto; }
  .sup-guide__toggle { padding: var(--sp-2) var(--sp-3); }
  .sup-guide__body { padding: 0 var(--sp-3) var(--sp-3); }
  .sup-check { min-height: 44px; }
  /* 16px evita o zoom automático do iOS ao focar o campo */
  .support-root input,
  .support-root select,
  .support-root textarea { font-size: 16px; }
}
