/* SAC — Atendimento ao Cliente (UI standalone, estilo Claude/Gemini) */
*,
*::before,
*::after { box-sizing: border-box; }

html.sac-root {
  height: 100%;
  overflow: hidden;
}

html.sac-root,
.sac-body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--sac-primary) 12%, transparent), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(0, 0, 0, 0.03), transparent 55%),
    #fafaf8;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
}

.sac-body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Evita jump do browser ao focar input / barra de endereço. */
  overscroll-behavior: none;
  touch-action: manipulation;
}

.sac-app {
  display: flex;
  flex-direction: column;
  position: absolute;
  inset: 0;
  max-width: 100%;
  overflow: hidden;
}

.sac-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

.sac-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.sac-header {
  /* Colunas iguais = logo matematicamente centralizada. */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(250, 250, 248, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: relative;
  z-index: 20;
  flex-shrink: 0;
}

.sac-header-side {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sac-header-side--left {
  justify-content: flex-start;
}
.sac-header-side--right {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.sac-profile-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.sac-profile-wrap[hidden] {
  display: none !important;
}

.sac-header-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-align: center;
}

.sac-header-logo {
  display: block;
  max-width: min(220px, 52vw);
  max-height: 40px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
}
.sac-header-logo-fallback {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--sac-primary);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.sac-header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  min-height: 28px;
}
.sac-header-title {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  line-height: 22px;
  display: inline-flex;
  align-items: center;
}

.sac-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: #444;
  text-decoration: none;
  transition: background 0.15s ease;
}
.sac-back:hover { background: rgba(0, 0, 0, 0.05); }

.sac-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1.5px solid var(--sac-primary);
  background: transparent;
  color: var(--sac-primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  box-sizing: border-box;
}

.sac-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: rgba(250, 250, 248, 0.72);
  backdrop-filter: blur(10px);
}
.sac-gate[hidden] { display: none !important; }
.sac-gate-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
  text-align: center;
  animation: sac-welcome-in 0.35s ease-out;
}
.sac-gate-logo {
  display: block;
  max-width: 180px;
  max-height: 44px;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: 0 auto 14px;
}
.sac-gate-initial {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--sac-primary);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}
.sac-gate-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.sac-gate-lead {
  margin: 0 0 14px;
  color: #555;
  font-size: 14px;
  line-height: 1.5;
}
.sac-gate-alert {
  margin: 0 0 18px;
  text-align: left;
  background: #fff7e8;
  border: 1px solid #f0d4a0;
  border-left: 4px solid #d97706;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #5c3d0a;
}
.sac-gate-alert strong { font-weight: 700; color: #3f2a08; }
.sac-gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.sac-gate-hint {
  margin: -4px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #6b5a3a;
  font-weight: 500;
}
.sac-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
}
.sac-field input {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  background: #fafafa;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sac-field input:focus {
  border-color: color-mix(in srgb, var(--sac-primary) 45%, #ccc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sac-primary) 16%, transparent);
  background: #fff;
}
.sac-gate-error {
  margin: 0;
  font-size: 13px;
  color: #8a2b1d;
  background: #fff4f2;
  border-radius: 10px;
  padding: 8px 10px;
}
.sac-gate-submit {
  margin-top: 4px;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  font: inherit;
  font-size: 15px;
  font-weight: 650;
  color: #fff;
  background: var(--sac-primary);
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.sac-gate-submit:hover:not(:disabled) { transform: translateY(-1px); }
.sac-gate-submit:disabled { opacity: 0.55; cursor: not-allowed; }
.sac-gate-note {
  margin: 14px 0 0;
  font-size: 11px;
  color: #8a8a84;
  line-height: 1.4;
}
body.sac-gated .sac-main,
body.sac-gated .sac-composer-wrap {
  pointer-events: none;
  user-select: none;
  filter: blur(1.5px);
  opacity: 0.55;
}
.sac-main[inert],
.sac-composer-wrap[inert] {
  pointer-events: none;
}

.sac-btn-ghost {
  border: 0;
  background: transparent;
  color: #444;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.sac-btn-ghost:hover { background: rgba(0, 0, 0, 0.05); }

.sac-main {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  scroll-padding-bottom: 24px;
}

.sac-thread {
  max-width: 768px;
  margin: 0 auto;
  padding: 24px 16px 12px;
  width: 100%;
  box-sizing: border-box;
}

/* Empty state estilo Claude: saudação + chips no centro vertical. */
.sac-app.sac-empty .sac-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.sac-app.sac-empty .sac-thread {
  padding: 12px 20px 8px;
}
.sac-app.sac-empty .sac-composer-wrap {
  background: transparent;
  padding-top: 4px;
  padding-bottom: max(20px, calc(12px + env(safe-area-inset-bottom)));
  /* Empurra o bloco visual para o “meio-baixo” da tela. */
  margin-bottom: min(12vh, 96px);
}
.sac-app.sac-empty .sac-composer {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
}
.sac-app.sac-empty .sac-composer-note {
  opacity: 0.75;
}
.sac-app.sac-empty.sac-kb-open .sac-composer-wrap {
  margin-bottom: 0;
}
.sac-app.sac-empty.sac-kb-open .sac-composer-note {
  display: none;
}
.sac-app.sac-empty.sac-kb-open .sac-welcome {
  padding-top: 4px;
  padding-bottom: 8px;
}
.sac-app.sac-empty.sac-kb-open .sac-suggestions {
  display: none;
}
.sac-app.sac-empty.sac-kb-open .sac-welcome-lead {
  display: none;
}
.sac-app.sac-kb-open .sac-composer-note {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.sac-welcome {
  text-align: center;
  padding: 28px 8px 20px;
  transition: opacity 0.18s ease;
}
.sac-welcome.sac-welcome-ready {
  animation: sac-welcome-in 0.4s ease-out;
}
.sac-welcome.sac-welcome-pending {
  opacity: 0;
  pointer-events: none;
}
.sac-welcome[hidden] { display: none !important; }
.sac-welcome-title {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #141414;
}
.sac-welcome-lead {
  margin: 0 auto 22px;
  max-width: 36rem;
  color: #555;
  font-size: 15px;
  line-height: 1.5;
}

.sac-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
}
.sac-chip {
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  animation: sac-chip-in 0.35s ease both;
  -webkit-tap-highlight-color: transparent;
}
.sac-chip:nth-child(1) { animation-delay: 0.05s; }
.sac-chip:nth-child(2) { animation-delay: 0.11s; }
.sac-chip:nth-child(3) { animation-delay: 0.17s; }
.sac-chip:nth-child(4) { animation-delay: 0.23s; }
@media (hover: hover) and (pointer: fine) {
  .sac-chip:hover {
    border-color: color-mix(in srgb, var(--sac-primary) 45%, #ccc);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
  }
}
.sac-chip:active {
  transform: scale(0.97);
  background: #f3f3f1;
}

.sac-messages { display: flex; flex-direction: column; gap: 18px; }
.sac-msg {
  display: flex;
  gap: 10px;
  animation: sac-msg-in 0.22s ease;
}
.sac-msg--user { justify-content: flex-end; }
.sac-msg--assistant { justify-content: flex-start; align-items: flex-start; }

.sac-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  /* Topo do ícone alinhado com o início da 1ª linha do texto */
  margin-top: 2px;
  background: transparent;
  color: var(--sac-primary);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.sac-avatar--initial {
  background: color-mix(in srgb, var(--sac-primary) 12%, #fff);
  border-color: color-mix(in srgb, var(--sac-primary) 28%, transparent);
}
.sac-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.sac-bubble-user {
  max-width: min(85%, 520px);
  background: color-mix(in srgb, var(--sac-primary) 14%, #fff);
  border: 1px solid color-mix(in srgb, var(--sac-primary) 22%, transparent);
  color: #111;
  padding: 12px 14px;
  border-radius: 18px 18px 6px 18px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.sac-assistant-col { flex: 1; min-width: 0; max-width: min(92%, 640px); }
.sac-assistant-text {
  font-size: 15.5px;
  line-height: 1.65;
  color: #1c1c1a;
  word-break: break-word;
}
.sac-assistant-text p { margin: 0 0 0.75em; }
.sac-assistant-text p:last-child { margin-bottom: 0; }
.sac-assistant-text ul { margin: 0.4em 0 0.8em; padding-left: 1.2em; }
.sac-assistant-text strong { font-weight: 650; }
.sac-assistant-text a { color: var(--sac-primary); }

.sac-cursor {
  display: inline-block;
  width: 0.5ch;
  height: 1.05em;
  margin-left: 1px;
  background: #222;
  vertical-align: text-bottom;
  animation: sac-blink 1s steps(1) infinite;
}

.sac-thinking {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  min-height: 28px;
}
.sac-thinking.is-on {
  display: inline-flex;
}
.sac-thinking span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #888;
  animation: sac-bounce 1.2s ease-in-out infinite;
}
.sac-thinking span:nth-child(2) { animation-delay: 0.15s; }
.sac-thinking span:nth-child(3) { animation-delay: 0.3s; }

.sac-tool-stack { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; }
.sac-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  font-size: 13px;
  color: #444;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 7px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  animation: sac-fade-in 0.2s ease;
}
.sac-tool-chip.is-done { color: #1b6b3a; }
.sac-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--sac-primary);
  border-radius: 50%;
  animation: sac-spin 0.7s linear infinite;
}
.sac-check {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1b6b3a;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 10px;
  animation: sac-pop 0.2s ease;
}

.sac-card {
  margin-top: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  animation: sac-msg-in 0.25s ease;
}
.sac-orders-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sac-orders-list li {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fafafa;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.sac-orders-list-item.is-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.sac-orders-list-item.is-clickable:hover,
.sac-orders-list-item.is-clickable:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--sac-primary, #e91e63) 45%, #ccc);
  background: #fff;
  transform: translateY(-1px);
}
.sac-orders-list-hint {
  margin: -4px 0 12px;
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}
.sac-orders-list-cta {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--sac-primary, #e91e63);
}
.sac-card--pick-order .sac-card-title {
  margin-bottom: 4px;
}
.sac-orders-list-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 650;
  font-size: 14px;
}
.sac-orders-list-meta {
  margin-top: 4px;
  font-size: 12.5px;
  color: #666;
  line-height: 1.4;
}

.sac-items-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sac-items-list li,
.sac-items-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sac-items-list li:last-child,
.sac-items-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.sac-items-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f0f0f0;
}

.sac-items-thumb--empty {
  background: linear-gradient(135deg, #f3f3f3, #e8e8e8);
}

.sac-items-body {
  flex: 1;
  min-width: 0;
}

.sac-items-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 650;
  color: #222;
}

.sac-items-top span:first-child {
  line-height: 1.35;
}

.sac-items-var {
  margin-top: 2px;
  font-size: 12px;
  color: #666;
}

.sac-items-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #888;
}

.sac-items-total {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 650;
  color: #333;
}

.sac-card-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
}
.sac-track-code {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}
.sac-copy {
  border: 0;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.sac-status-badge {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sac-primary) 14%, #fff);
  color: #222;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.sac-timeline { list-style: none; margin: 0; padding: 0; }
.sac-timeline li {
  position: relative;
  padding: 0 0 14px 18px;
  border-left: 2px solid rgba(0, 0, 0, 0.08);
  animation: sac-chip-in 0.3s ease both;
}
.sac-timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }
.sac-timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ccc;
}
.sac-timeline li:first-child::before { background: var(--sac-primary); }
.sac-timeline-desc { font-size: 14px; font-weight: 500; }
.sac-timeline-meta { font-size: 12px; color: #777; margin-top: 2px; }

.sac-ticket-number {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 4px 0 8px;
}

.sac-error {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff4f2;
  color: #8a2b1d;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sac-error button {
  border: 0;
  background: #8a2b1d;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.sac-scroll-new {
  position: sticky;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  border: 0;
  background: #1a1a1a;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  z-index: 5;
}

.sac-composer-wrap {
  /* --sac-kb = altura do teclado; só o rodapé sobe, header fica fixo. */
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom) + var(--sac-kb, 0px));
  background: #fafaf8;
  flex-shrink: 0;
  position: relative;
  z-index: 15;
}

.sac-composer {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
  min-height: 52px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sac-composer:focus-within {
  border-color: color-mix(in srgb, var(--sac-primary) 35%, #ccc);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}
.sac-input {
  flex: 1;
  border: 0;
  outline: none;
  resize: none;
  font: inherit;
  /* ≥16px evita zoom automático no iOS. */
  font-size: 16px;
  line-height: 24px;
  height: 24px;
  max-height: 120px;
  padding: 0;
  margin: 0;
  background: transparent;
  color: #111;
  overflow-y: hidden;
  -webkit-appearance: none;
  appearance: none;
}
.sac-composer.is-multiline {
  align-items: flex-end;
}
.sac-composer.is-multiline .sac-input {
  overflow-y: auto;
}
.sac-send {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--sac-primary);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.sac-send:disabled { opacity: 0.4; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  .sac-send:not(:disabled):hover { transform: scale(1.04); }
}
.sac-send:not(:disabled):active { transform: scale(0.94); }
.sac-composer-note {
  max-width: 720px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 11px;
  color: #9a9a94;
  line-height: 1.35;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.sac-composer-note--toast {
  color: #8a2b1d;
  font-weight: 600;
}

.sac-thread-loading {
  margin: 24px auto;
  text-align: center;
  font-size: 14px;
  color: #777;
  padding: 12px;
}

.sac-ticket-banner-back {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--sac-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sac-disclaimer {
  max-width: 768px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 11px;
  color: #8a8a84;
  line-height: 1.4;
}

@keyframes sac-welcome-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes sac-chip-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes sac-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes sac-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sac-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-4px); opacity: 1; }
}
@keyframes sac-spin { to { transform: rotate(360deg); } }
@keyframes sac-pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes sac-blink {
  50% { opacity: 0; }
}

@media (max-width: 640px) {
  .sac-header {
    grid-template-columns: 44px 1fr 44px;
    gap: 0;
    min-height: 52px;
    padding: 6px 10px;
    padding-top: max(6px, env(safe-area-inset-top));
  }
  .sac-header-meta,
  .sac-header-title,
  .sac-badge {
    display: none !important;
  }
  .sac-header-center {
    justify-self: center;
    pointer-events: none;
  }
  .sac-header-logo {
    max-height: 28px;
    max-width: min(150px, 46vw);
  }
  .sac-header-logo-fallback {
    width: 32px;
    height: 32px;
    font-size: 15px;
    border-radius: 10px;
  }
  .sac-icon-btn {
    width: 44px;
    height: 44px;
  }
  .sac-profile-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
  .sac-profile-btn {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
  }
  .sac-profile-pop {
    right: 0;
    left: auto;
    max-width: calc(100vw - 16px);
  }
  .sac-back {
    width: 44px;
    height: 44px;
  }
  .sac-welcome {
    padding: 8px 4px 16px;
  }
  .sac-welcome-title {
    font-size: 1.35rem;
  }
  .sac-welcome-lead {
    font-size: 14px;
    margin-bottom: 16px;
  }
  .sac-suggestions {
    gap: 8px;
    max-width: 100%;
  }
  .sac-chip {
    font-size: 13px;
    padding: 10px 14px;
    white-space: normal;
    text-align: left;
    max-width: 100%;
  }
  .sac-app.sac-empty .sac-composer-wrap {
    padding-left: 14px;
    padding-right: 14px;
    margin-bottom: min(10vh, 72px);
  }
  .sac-composer-wrap {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom) + var(--sac-kb, 0px));
  }
  .sac-composer {
    min-height: 48px;
    border-radius: 22px;
    padding: 6px 6px 6px 14px;
  }
  .sac-composer-note {
    font-size: 10px;
    margin-top: 6px;
  }
  .sac-thread {
    padding: 16px 14px 10px;
  }
  .sac-msg--assistant {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Sidebar histórico — drawer em todos os breakpoints */
.sac-sidebar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: min(300px, 88vw);
  flex-shrink: 0;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.98);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  overflow: hidden; /* scroll fica nas seções */
  z-index: 30;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.08);
}

.sac-shell.sac-sidebar-open .sac-sidebar {
  transform: translateX(0);
}

.sac-sidebar[hidden] {
  display: none !important;
  transform: none;
}

.sac-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.sac-sidebar-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #444;
}

.sac-sidebar-new {
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  text-align: left;
  flex-shrink: 0;
}

.sac-sidebar-new:hover { background: #f6f6f4; }

/* Split: Chamados (topo, prioridade) + Conversas (resto), cada um com scroll. */
.sac-sidebar-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sac-sidebar-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}

.sac-sidebar-section--tickets {
  flex: 0 0 auto;
  min-height: 120px;
  max-height: 34%;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sac-sidebar-section--tickets-closed {
  flex: 0 0 auto;
  min-height: 88px;
  max-height: 28%;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sac-sidebar-label--muted {
  color: #888;
  font-weight: 600;
}

.sac-sidebar-scroll--compact {
  max-height: 160px;
}

.sac-sidebar-item--closed .sac-sidebar-item-title {
  color: #666;
}

.sac-chip--resume {
  border-color: color-mix(in srgb, var(--sac-primary) 45%, #ccc);
  background: color-mix(in srgb, var(--sac-primary) 8%, #fff);
  font-weight: 650;
}

.sac-sidebar-section--chats {
  flex: 1 1 auto;
  min-height: 140px;
  padding-top: 10px;
}

.sac-sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sac-sidebar-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sac-badge-count {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sac-primary) 18%, #fff);
  color: color-mix(in srgb, var(--sac-primary) 80%, #111);
  font-size: 11px;
  font-weight: 700;
}

.sac-sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sac-sidebar-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 10px;
  cursor: pointer;
  font: inherit;
}

.sac-sidebar-item:hover,
.sac-sidebar-item.is-active {
  background: color-mix(in srgb, var(--sac-primary) 10%, #fff);
}

.sac-sidebar-item-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sac-sidebar-item-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #888;
}

.sac-sidebar-empty {
  margin: 4px 0 0;
  font-size: 12px;
  color: #999;
}

.sac-sidebar-backdrop {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 25;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.sac-shell.sac-sidebar-open .sac-sidebar-backdrop {
  display: block;
}

.sac-sidebar-backdrop[hidden] {
  display: none !important;
}

.sac-icon-btn {
  border: 0;
  background: transparent;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #444;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.sac-icon-btn[hidden] {
  display: none !important;
}
@media (hover: hover) and (pointer: fine) {
  .sac-icon-btn:hover { background: rgba(0, 0, 0, 0.05); }
}
.sac-icon-btn:active { background: rgba(0, 0, 0, 0.07); }

/* Perfil */
.sac-profile-btn {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 50%;
}
.sac-profile-btn:active .sac-profile-avatar {
  transform: scale(0.94);
}

.sac-profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--sac-primary) 16%, #fff);
  color: #222;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.sac-profile-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(300px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  padding: 14px;
  z-index: 40;
}

.sac-profile-name {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
}

.sac-profile-dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.sac-profile-dl dt {
  font-size: 11px;
  font-weight: 650;
  color: #888;
  margin: 0;
}

.sac-profile-dl dd {
  margin: 2px 0 0;
  font-size: 13px;
  color: #222;
  line-height: 1.35;
  word-break: break-word;
}

.sac-profile-logout {
  margin-top: 14px;
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.sac-profile-logout:hover { background: #f6f6f4; }

/* Ticket thread (modo chamado no chat principal) */
.sac-ticket-banner-host {
  margin: 0 0 12px;
}
.sac-ticket-banner-host[hidden] {
  display: none !important;
}

.sac-ticket-banner {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e8e8e6;
  border-left: 3px solid #1a1a1a;
}

.sac-ticket-banner--closed {
  border-left-color: #9a9a97;
}

.sac-ticket-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sac-ticket-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: #111;
}

.sac-ticket-banner-state {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: #111;
  color: #fff;
}

.sac-ticket-banner--closed .sac-ticket-banner-state {
  background: #ececea;
  color: #555;
}

.sac-ticket-banner-wait {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
}

.sac-ticket-banner-subject {
  margin-top: 6px;
  font-size: 13px;
  color: #555;
  line-height: 1.4;
}

.sac-ticket-msg-meta {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.sac-ticket-suggest-meta {
  margin: 0 0 6px;
  font-size: 12px;
  color: #888;
}

.sac-ticket-suggest-subject {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: #222;
}

.sac-ticket-suggest-desc {
  margin: 0 0 14px;
  font-size: 13px;
  color: #555;
  line-height: 1.45;
  white-space: pre-wrap;
}

.sac-ticket-suggest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sac-ticket-btn {
  appearance: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.sac-ticket-btn:hover {
  background: #f6f6f4;
}

.sac-ticket-btn--primary {
  background: #111;
  color: #fff;
  border-color: #111;
}

.sac-ticket-btn--primary:hover {
  background: #333;
}

.sac-ticket-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.sac-ticket-suggest-ok {
  margin: 10px 0 0;
  font-size: 13px;
  color: #555;
}

.sac-card--ticket-suggest.is-dismissed {
  opacity: 0.72;
}

/* Ticket drawer (legado) */
.sac-ticket-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  justify-content: flex-end;
}

.sac-ticket-drawer[hidden] {
  display: none !important;
}

.sac-badge-count[hidden] {
  display: none !important;
}

.sac-profile-pop[hidden],
.sac-sidebar[hidden],
.sac-sidebar-backdrop[hidden] {
  display: none !important;
}

.sac-ticket-drawer-panel {
  width: min(420px, 100%);
  height: 100%;
  background: #fafaf8;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
}

.sac-ticket-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sac-ticket-drawer-head h2 {
  margin: 0;
  font-size: 16px;
}

.sac-ticket-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.sac-ticket-drawer-foot {
  padding: 12px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.sac-ticket-msg {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.sac-ticket-msg-meta {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

@media (max-width: 900px) {
  .sac-sidebar {
    width: min(300px, 88vw);
  }
}
