
:root {
  --chat-primary:      #32373b;
  --chat-primary-dark: #0a0f13;
  --chat-bg:           #f0faf6;
  --chat-bg-dark:      #111827;
  --chat-surface:      #ffffff;
  --chat-surface-dark: #1f2937;
  --chat-border:       #e0f0eb;
  --chat-text:         #1a1a1a;
  --chat-text-muted:   #888888;
  --chat-radius:       14px;
  --chat-shadow:       0 2px 10px rgba(26,127,90,.10);
  --chat-font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: var(--chat-font);
  font-size: 14px;
  background: var(--chat-bg);
  color: var(--chat-text);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

.chat-body { background: linear-gradient(145deg, #e8f4f0 0%, #d4ede6 40%, #c9e8df 100%); min-height: 100vh; display: flex; align-items: stretch; justify-content: center; padding-top: 8px; /* Item 2: desce layout */ }

/* App Shell*/
#chat-app {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 8px);   /* Item 2: compensa o padding-top */
  background: var(--chat-surface);
  box-shadow: 0 8px 48px rgba(0,0,0,.16), 0 2px 12px rgba(0,0,0,.08);
  position: relative;
  z-index: 1000;
  border-radius: 20px 20px 0 0;
  overflow: hidden;
  transition: height 0.1s ease; /* smooth resize when visualViewport JS updates height */
}

/*
 * Reposiciona o badge do Google reCAPTCHA para não sobrepor o botão de envio.
 * O footer tem ~62px + pill bar ~30px = ~92px do fundo.
 * Usamos bottom: 100px para garantir folga em todas as alturas de footer.
 * O z-index: 1 mantém o badge atrás do app em caso de sobreposição por z-index.
 */
.grecaptcha-badge {
  z-index: 1 !important;
  bottom: 100px !important;
  right: 4px !important;
}

/* Header*/
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.chat-header-left  { display: flex; align-items: center; gap: 10px; }
.chat-header-right { display: flex; align-items: center; gap: 8px; }
.chat-avatar {
  width: 40px; height: 40px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,.4);
  flex-shrink: 0;
}
.chat-header-name   { font-size: 15px; font-weight: 700; line-height: 1.2; }
.chat-header-status { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.chat-status-dot    { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; animation: chat-pulse 2s infinite; }
@keyframes chat-pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(.85)} }
.chat-btn-icon {
  background: rgba(255,255,255,.15); border: none; cursor: pointer;
  border-radius: 8px; padding: 7px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.chat-btn-icon:hover { background: rgba(255,255,255,.3); }

/* Messages*/
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--chat-border); border-radius: 2px; }

/* Bubbles*/
.chat-bubble-wrap { display: flex; flex-direction: column; }
.chat-bubble-wrap.user  { align-items: flex-end; }
.chat-bubble-wrap.bot   { align-items: flex-start; }

.chat-bubble {
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  animation: chat-pop .18s ease-out;
}
.chat-bubble.user {
  background: var(--chat-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.bot {
  background: var(--chat-bg);
  color: var(--chat-text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--chat-border);
}
.chat-bubble-time {
  font-size: 10px;
  color: var(--chat-text-muted);
  margin-top: 3px;
  padding: 0 2px;
}
@keyframes chat-pop { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }

/* Card containers (full width) */
.chat-bubble-wrap.card-wrap { align-items: stretch; }
.chat-bubble-wrap.card-wrap .chat-bubble-time { padding-left: 4px; }

/* Typing indicator*/
.chat-typing {
  padding: 8px 18px;
  flex-shrink: 0;
}
.chat-typing span {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--chat-primary);
  animation: chat-bounce .9s infinite;
  margin-right: 3px;
  opacity: .7;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .30s; }
@keyframes chat-bounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-6px)} }

.chat-chips {
  padding: 10px 14px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  flex-shrink: 0;
  background: var(--chat-surface);
  border-top: 1px solid var(--chat-border);
}
.chat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1.5px solid var(--chat-border);
  border-radius: 24px;
  background: var(--chat-bg);
  color: var(--chat-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s, transform .15s, box-shadow .18s;
  font-family: var(--chat-font);
  letter-spacing: .01em;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.chat-chip:hover {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: #fff;
  border-color: var(--chat-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(26,127,90,.25);
}
.chat-chip:active {
  transform: translateY(0);
  box-shadow: none;
}
.chat-chip:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(26,127,90,.18);
}
/* Dark mode chips */
.chat-dark .chat-chip {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.chat-dark .chat-chip:hover {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: #fff;
  border-color: var(--chat-primary);
}

/* Footer*/
.chat-footer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  background: var(--chat-surface);
  border-top: 1px solid var(--chat-border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  height: 42px;
  border: 1.5px solid var(--chat-border);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--chat-font);
  resize: none;
  max-height: 100px;
  background: var(--chat-bg);
  color: var(--chat-text);
  outline: none;
  transition: border-color .15s;
  line-height: 1.4;
  box-sizing: border-box;
  overflow-y: auto;
  align-self: center;
}
.chat-input:focus { border-color: var(--chat-primary); }
.chat-btn-send {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  background: var(--chat-primary);
  border: none; cursor: pointer;
  color: #fff; display: flex; align-items: center; justify-content: center;
  transition: transform .12s, background .12s;
  flex-shrink: 0;
}
.chat-btn-send:hover   { background: var(--chat-primary-dark); transform: scale(1.06); }
.chat-btn-send:disabled{ background: #ccc; cursor: not-allowed; transform: none; }
.chat-btn-back {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--chat-bg); border: 1.5px solid var(--chat-border);
  cursor: pointer; color: var(--chat-text); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s; flex-shrink: 0;
}
.chat-btn-back:hover { background: var(--chat-border); }

.chat-consent-bar {
  display: flex; align-items: flex-start; gap: 8px;
  background: #f0f4f8; border-top: 1px solid #e2e8f0;
  padding: 8px 12px; flex-shrink: 0;
}
.chat-consent-bar-text {
  flex: 1; font-size: 11px; color: #64748b; line-height: 1.4;
}
.chat-consent-bar-ok {
  flex-shrink: 0; padding: 3px 12px; border-radius: 6px;
  border: none; color: #fff; font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: opacity .13s;
}
.chat-consent-bar-ok:hover { opacity: .87; }

/* Dark */
.chat-dark .chat-consent-bar      { background: #1e293b; border-top-color: #334155; }
.chat-dark .chat-consent-bar-text { color: #94a3b8; }


@keyframes chat-fadein   { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }
@keyframes chat-rate-in  { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
@keyframes chat-star-pop { 0%{transform:scale(1)} 40%{transform:scale(1.22)} 70%{transform:scale(.94)} 100%{transform:scale(1)} }
@keyframes chat-sent-in  { from{opacity:0;transform:scale(.85)} to{opacity:1;transform:scale(1)} }

.chat-feedback {
  padding: 10px 18px 12px;
  background: #fff;
  border-top: 1px solid rgba(0,0,0,.07);
  box-shadow: 0 -2px 12px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  animation: chat-rate-in .28s cubic-bezier(.22,.68,0,1.2);
}

.chat-feedback-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  letter-spacing: .07em;
  text-transform: uppercase;
  animation: chat-fadein .3s ease;
}

.chat-feedback-stars {
  display: flex;
  gap: 4px;
  align-items: center;
}

.chat-star {
  background: none;
  border: none;
  padding: 4px 3px;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s cubic-bezier(.22,.68,0,1.4);
}
.chat-star svg {
  display: block;
  width: 28px; height: 28px;
  transition: fill .18s ease, filter .18s ease;
}
/* Inactive state */
.chat-star svg .star-shape {
  fill: #e2e8f0;
}
/* Hover cascade (JS adds .hover class) */
.chat-star.hover svg .star-shape,
.chat-star:hover svg .star-shape {
  fill: #fde68a;
  filter: drop-shadow(0 0 3px rgba(251,191,36,.35));
}
/* Active / selected */
.chat-star.active svg .star-shape {
  fill: #f59e0b;
  filter: drop-shadow(0 0 4px rgba(245,158,11,.4));
}
.chat-star.active {
  animation: chat-star-pop .32s cubic-bezier(.22,.68,0,1.4);
}
.chat-star:disabled { cursor: default; }
.chat-star:disabled svg .star-shape { filter: none; }

/* Sent state */
.chat-feedback-sent {
  font-size: 12px;
  color: #059669;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  letter-spacing: .01em;
  animation: chat-sent-in .3s cubic-bezier(.22,.68,0,1.4);
}

/* Dark mode */
.chat-dark .chat-feedback {
  background: #1e293b;
  border-top-color: rgba(255,255,255,.06);
  box-shadow: 0 -2px 12px rgba(0,0,0,.2);
}
.chat-dark .chat-feedback-label { color: #475569; }
.chat-dark .chat-star svg .star-shape { fill: #334155; }
.chat-dark .chat-star.hover svg .star-shape,
.chat-dark .chat-star:hover svg .star-shape { fill: #78350f; filter: drop-shadow(0 0 3px rgba(251,191,36,.2)); }
.chat-dark .chat-star.active svg .star-shape { fill: #f59e0b; }


/* Base card */
.chat-confirm-card {
  background: #fff;
  border: 1px solid #c8ede5;
  border-radius: var(--chat-radius);
  overflow: hidden;
  font-size: 13px;
  box-shadow: var(--chat-shadow);
  width: 100%;
}

/* Header base */
.chat-confirm-header {
  background: linear-gradient(135deg, #1a2e3b, #0d8c6c);
  color: #fff;
  padding: 12px 14px;
}
.chat-confirm-header-top {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.chat-confirm-icon  { font-size: 18px; }
.chat-confirm-title { font-size: 14px; font-weight: 700; }

/* Header variants */
.chat-confirm-header-resch  { background: linear-gradient(135deg, #292d32, #0d8c6c) !important; }
.chat-confirm-header-ok     { background: linear-gradient(135deg, #38a169, #276749) !important; }
.chat-confirm-header-cancel { background: linear-gradient(135deg, #e53e3e, #c53030) !important; }
.chat-confirm-header-attendant { background: linear-gradient(135deg, #1a56db, #1e429f) !important; }

/* Badge */
.chat-confirm-badge {
  display: inline-block;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
  border: 1px solid transparent;
}
.chat-confirm-badge.new   { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.3); }
.chat-confirm-badge.found { background: rgba(255,255,255,.20); color: #fff; border-color: rgba(255,255,255,.4); }

/* Body rows - replica o card da screenshot */
.chat-confirm-body { padding: 4px 0; }
.chat-confirm-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid #f0faf7;
  gap: 8px;
}
.chat-confirm-row:last-child { border-bottom: none; }
.chat-confirm-lbl { font-size: 11px; color: #888; font-weight: 600; flex-shrink: 0; min-width: 88px; }
.chat-confirm-val { font-size: 13px; color: #1a1a1a; font-weight: 500; text-align: right; }

/* Highlight row (nova data/horário na remarcação) */
.chat-confirm-row.highlight-row .chat-confirm-lbl,
.chat-confirm-row.highlight-row .chat-confirm-val {
  color: #0d8c6c; font-weight: 700;
}

/* Footer */
.chat-confirm-footer {
  background: #f6fffe;
  border-top: 1px solid #e0f5ef;
  padding: 9px 14px;
  font-size: 12px; color: #555; text-align: center;
}
.chat-confirm-footer strong { color: var(--chat-primary); }
.chat-confirm-footer.warn {
  background: #fff5f5;
  color: #c53030;
  border-top-color: #fed7d7;
}

/* Action buttons inside card */
.chat-card-actions {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid #f0faf7;
}
.chat-card-btn {
  flex: 1;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--chat-font);
  text-align: center;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity .12s;
}
.chat-list-card .chat-card-actions .chat-card-btn,
.chat-confirm-card .chat-card-actions .chat-card-btn {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

/* Keep input/send layout stable inside embedded Booknetic panel containers */
#chat-app .chat-footer { overflow: visible; }
#chat-app .chat-btn-send {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.chat-card-btn.confirm { background: var(--chat-primary); color: #fff; }
.chat-card-btn.cancel  { background: #f1f2f4; color: #4b5563; }
.chat-card-btn:hover   { opacity: .88; }
.chat-card-actions-wrap { flex-wrap: wrap; }
.chat-card-actions-center { justify-content: center; }
.chat-card-btn-half { flex: 0 0 calc(50% - 4px); }
.chat-card-btn-link {
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Attendant queue card */
.chat-attendant-card { }
.chat-queue-badge {
  display: inline-block;
  background: rgba(255,255,255,.2);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 20px;
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; color: #fff; margin-top: 4px;
}

/* Calendar widget*/
.chat-cal {
  background: #fff; border: 1px solid #c8ede5;
  border-radius: var(--chat-radius); overflow: hidden;
  box-shadow: var(--chat-shadow);
}
.chat-cal-header {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: #fff; padding: 10px 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.chat-cal-icon  { font-size: 20px; }
.chat-cal-hcenter { flex: 1; text-align: center; }
.chat-cal-title { font-size: 14px; font-weight: 700; }
.chat-cal-sub   { font-size: 11px; opacity: .85; margin-top: 2px; }
.chat-cal-nav {
  flex-shrink: 0; width: 28px; height: 28px;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.22);
  border-radius: 7px; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .1s; padding: 0; line-height: 1;
}
.chat-cal-nav:hover { background: rgba(255,255,255,0.32); transform: scale(1.08); }
.chat-cal-nav:active { transform: scale(0.94); }
.chat-cal-grid  {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; padding: 10px 12px 6px;
}
.chat-cal-dh    { font-size: 11px; font-weight: 700; color: #888; text-align: center; padding: 2px 0 6px; }
.chat-cal-day   { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 8px; cursor: default; position: relative; }
.chat-cal-dn    { font-size: 12px; font-weight: 600; }
.chat-cal-avail { background: #e8f8f3; cursor: pointer; transition: background .12s, transform .1s; }
.chat-cal-avail:hover { background: var(--chat-primary); color: #fff; transform: scale(1.08); }
.chat-cal-avail:hover .chat-cal-badge { background: rgba(255,255,255,.3); color: #fff; }
.chat-cal-badge { font-size: 9px; background: #c8ede5; color: var(--chat-primary); border-radius: 10px; padding: 1px 5px; margin-top: 2px; font-weight: 700; }
.chat-cal-past  { opacity: .35; }
.chat-cal-off   { opacity: .25; }
.chat-cal-hint  { text-align: center; font-size: 11px; color: #888; padding: 6px 12px 12px; }

/* Time slots widget*/
.chat-slots { background: #fff; border: 1px solid #c8ede5; border-radius: var(--chat-radius); overflow: hidden; box-shadow: var(--chat-shadow); }
.chat-slots-header {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: #fff; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.chat-slots-icon  { font-size: 20px; }
.chat-slots-title { font-size: 14px; font-weight: 700; }
.chat-slots-sub   { font-size: 11px; opacity: .85; margin-top: 2px; }
.chat-slots-grid  { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px; }
.chat-slot-btn {
  padding: 8px 14px; border-radius: 8px;
  background: #e8f8f3; border: 1.5px solid #c8ede5;
  color: var(--chat-primary); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .12s; font-family: var(--chat-font);
}
.chat-slot-btn:hover { background: var(--chat-primary); color: #fff; border-color: var(--chat-primary); transform: translateY(-1px); }


/* Mensagem info centralizada (Item 3)*/
.chat-bubble.info-center {
  background: linear-gradient(135deg, #f0fdf8, #e8fdf5);
  border: 1px solid #a7f3d0;
  color: #065f46;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 95%;
}
.chat-dark .chat-bubble.info-center {
  background: #1a3d2e;
  border-color: #374151;
  color: #6ee7b7;
}

/* Dark mode*/
.chat-dark {
  --chat-bg:      #111827;
  --chat-surface: #1f2937;
  --chat-border:  #374151;
  --chat-text:    #f3f4f6;
  --chat-text-muted: #9ca3af;
}
.chat-dark .chat-bubble.bot   { background: #1f2937; border-color: #374151; color: #f3f4f6; }
.chat-dark .chat-confirm-card { background: #1f2937; border-color: #374151; }
.chat-dark .chat-confirm-row  { border-bottom-color: #374151; }
.chat-dark .chat-confirm-lbl  { color: #9ca3af; }
.chat-dark .chat-confirm-val  { color: #f3f4f6; }
.chat-dark .chat-confirm-footer { background: #1a2e3b; border-top-color: #374151; color: #9ca3af; }
.chat-dark .chat-cal          { background: #1f2937; border-color: #374151; }
.chat-dark .chat-cal-dh       { color: #9ca3af; }
.chat-dark .chat-cal-avail    { background: #1a3d2e; }
.chat-dark .chat-cal-hint     { color: #9ca3af; }
.chat-dark .chat-slots        { background: #1f2937; border-color: #374151; }
.chat-dark .chat-slot-btn     { background: #1a3d2e; border-color: #374151; }

/* Mobile optimizations*/
@media (max-width: 480px) {
  .chat-body { padding-top: 0; background: var(--chat-surface); }
  #chat-app { max-width: 100%; height: 100dvh; height: 100vh; border-radius: 0; box-shadow: none; overflow-x: hidden; }
  .chat-bubble { max-width: 92%; }
  .chat-footer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  /* iOS auto-zooms inputs with font-size < 16px inside iframes (where
     the viewport meta maximum-scale=1 has no effect). Force 16px minimum
     to prevent the zoom that pushes the send button off-screen. */
  #chat-app .chat-input { font-size: 16px !important; }
}

/* iOS keyboard-open: when JS switches #chat-app to position:fixed */
#chat-app[style*="position: fixed"] {
  border-radius: 0;
  box-shadow: none;
  z-index: 99999;
  margin: 0;
}
#chat-app[style*="position: fixed"] .chat-footer {
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
/* Ensure send button never collapses on iOS */
.chat-footer {
  -webkit-overflow-scrolling: auto;
}
.chat-btn-send {
  -webkit-appearance: none;
  touch-action: manipulation;
}
.chat-input {
  -webkit-appearance: none;
  touch-action: manipulation;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Botões de áudio / voz*/
.chat-btn-voice {
  background: none; border: none; cursor: pointer;
  color: var(--chat-text-muted); padding: 8px;
  border-radius: 10px; display: flex; align-items: center;
  transition: color .15s, background .15s; flex-shrink: 0;
}
.chat-btn-voice:hover { color: var(--chat-primary); background: rgba(26,127,90,.08); }
.chat-btn-voice.recording { color: #e53e3e; animation: chat-pulse 1s infinite; }
.chat-btn-voice.loading { color: var(--chat-primary); opacity: .6; }

/* Botões do header*/
.chat-header-right { display: flex; align-items: center; gap: 4px; }
.chat-btn-icon {
  background: rgba(255,255,255,.15); border: none; cursor: pointer;
  border-radius: 7px; padding: 6px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s; flex-shrink: 0;
}
.chat-btn-icon:hover { background: rgba(255,255,255,.30); }

/* Minimized state*/
#chat-app.chat-minimized .chat-messages,
#chat-app.chat-minimized .chat-typing,
#chat-app.chat-minimized .chat-chips,
#chat-app.chat-minimized .chat-footer,
#chat-app.chat-minimized .chat-consent-overlay,
#chat-app.chat-minimized .chat-feedback {
  display: none !important;
}
.chat-minimized-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--chat-surface);
  border-top: 1px solid var(--chat-border);
  font-size: 13px; font-weight: 600; color: var(--chat-text);
}
.chat-minimized-bar button {
  background: none; border: none; cursor: pointer;
  padding: 4px; color: var(--chat-primary);
  display: flex; align-items: center;
}

.chat-confirm-header-top { display: flex; align-items: center; gap: 8px; }

.chat-queue-badge {
  background: rgba(255,255,255,.2); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
}

/* Dark mode para novos elementos*/
.chat-dark .chat-btn-voice { color: #aaa; }
.chat-dark .chat-minimized-bar { background: var(--chat-surface-dark); border-color: #374151; color: #f9fafb; }

.chat-list-card {
  background: #fff;
  border: 1px solid #c8ede5;
  border-radius: var(--chat-radius);
  overflow: hidden;
  box-shadow: var(--chat-shadow);
  width: 100%;
}
.chat-list-card-header {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-list-card-title { font-size: 14px; font-weight: 700; }
.chat-list-card-sub   { font-size: 11px; opacity: .8; }
.chat-list-card-body  { padding: 6px 0; }
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid #f0faf6;
}
.chat-list-item:last-child { border-bottom: none; }
.chat-list-item:hover { background: #f0faf6; }
.chat-list-item:active { background: #e0f5ef; }
.chat-list-item-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--chat-primary);
  color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-list-item-info { flex: 1; min-width: 0; }
.chat-list-item-name { font-size: 13px; font-weight: 600; color: #1a2e3b; }
.chat-list-item-meta { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.chat-list-flag      { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 8px; }
.chat-list-flag.avail { background: #e8f8f3; color: var(--chat-primary); }
.chat-list-flag.off   { background: #fff7ed; color: #c2410c; }
.chat-list-price { font-size: 11px; font-weight: 700; color: var(--chat-primary); }
.chat-list-dur   { font-size: 11px; color: #888; }
.chat-list-arrow { color: #bbb; flex-shrink: 0; }
.chat-list-hint  { text-align: center; font-size: 11px; color: #888; padding: 6px 12px 10px; }

.chat-menu-card {
  background: #fff;
  border: 1px solid #c8ede5;
  border-radius: var(--chat-radius);
  overflow: hidden;
  box-shadow: var(--chat-shadow);
  width: 100%;
}
.chat-menu-greeting {
  padding: 14px 16px 12px;
  font-size: 13.5px;
  color: #2d3748;
  line-height: 1.6;
  border-bottom: 1px solid #f0faf6;
  background: linear-gradient(135deg, #f7fffe 0%, #f0faf7 100%);
  border-left: 3px solid var(--chat-primary);
  border-radius: 0;
}
.chat-menu-list { padding: 4px 0; }
.chat-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background .12s;
  border-bottom: 1px solid #f0faf6;
}
.chat-menu-item:last-child { border-bottom: none; }
.chat-menu-item:hover  { background: #f0faf6; }
.chat-menu-item:active { background: #e0f5ef; }
.chat-menu-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.chat-menu-label {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1a2e3b;
}

/* Dark mode para novos cards*/
.chat-dark .chat-list-card  { background: #1f2937; border-color: #374151; }
.chat-dark .chat-list-item  { border-bottom-color: #2d3748; }
.chat-dark .chat-list-item:hover { background: #1a3d2e; }
.chat-dark .chat-list-item-name  { color: #f3f4f6; }
.chat-dark .chat-list-hint  { color: #9ca3af; }
.chat-dark .chat-menu-card  { background: #1f2937; border-color: #374151; }
.chat-dark .chat-menu-item  { border-bottom-color: #2d3748; }
.chat-dark .chat-menu-item:hover { background: #1a3d2e; }
.chat-dark .chat-menu-label { color: #f3f4f6; }
.chat-dark .chat-menu-greeting { background: #162330; border-left-color: var(--chat-primary); color: #d1d5db; border-bottom-color: #2d3748; }

.chat-menu-pill-bar {
  padding: 5px 14px 4px;
  display: flex;
  justify-content: flex-start;   /* Item 1: alinhado à esquerda */
  background: var(--chat-surface);
  flex-shrink: 0;
}
.chat-menu-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  background: transparent;
  border: 1px solid rgba(26,127,90,.35);
  border-radius: 99px;
  color: var(--chat-primary);
  font-size: 11px;
  font-weight: 600;
  font-family: var(--chat-font);
  cursor: pointer;
  transition: all .16s;
  letter-spacing: .02em;
  outline: none;
}
.chat-menu-pill:hover {
  background: rgba(26,127,90,.08);
  border-color: var(--chat-primary);
}
.chat-menu-pill:active {
  background: rgba(26,127,90,.15);
  transform: scale(.97);
}
.chat-dark .chat-menu-pill {
  border-color: rgba(255,255,255,.2);
  color: #9ca3af;
}
.chat-dark .chat-menu-pill:hover {
  background: rgba(255,255,255,.06);
  border-color: #9ca3af;
  color: #f3f4f6;
}
/* Oculta o pill quando minimizado */
#chat-app.chat-minimized .chat-menu-pill-bar { display: none !important; }

.chat-confirm-header-query {
  background: linear-gradient(135deg, #2b6cb0, #1a4580) !important;
}
.chat-query-body {
  max-height: 320px;
  overflow-y: auto;
  padding: 0 !important;
}
.chat-query-body::-webkit-scrollbar { width: 3px; }
.chat-query-body::-webkit-scrollbar-thumb { background: var(--chat-border); border-radius: 2px; }
.chat-query-appt-item {
  padding: 12px 16px;
}
.chat-query-item-sep {
  border-top: 1px solid var(--chat-border);
}
.chat-query-appt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.chat-query-appt-id {
  font-size: 12px;
  font-weight: 700;
  color: var(--chat-primary);
  letter-spacing: .3px;
}
/* Status badges */
.chat-query-status-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .2px;
  text-transform: uppercase;
}
.chat-query-status-badge.status-pending  { background: #fef3c7; color: #92400e; }
.chat-query-status-badge.status-approved { background: #d1fae5; color: #065f46; }
.chat-query-status-badge.status-canceled { background: #fee2e2; color: #991b1b; }
.chat-query-status-badge.status-done     { background: #ede9fe; color: #4c1d95; }
/* Dark mode */
.chat-dark .chat-query-item-sep { border-color: #374151; }
.chat-dark .chat-query-status-badge.status-pending  { background: rgba(251,191,36,.15); color: #fbbf24; }
.chat-dark .chat-query-status-badge.status-approved { background: rgba(52,211,153,.12); color: #34d399; }
.chat-dark .chat-query-status-badge.status-canceled { background: rgba(248,113,113,.12); color: #f87171; }
.chat-dark .chat-query-status-badge.status-done     { background: rgba(167,139,250,.12); color: #a78bfa; }

/* Emoji Button & Picker (frontend)*/



/* Suggestion Box*/
.chat-suggestion-box {
  padding: 8px 16px 10px;
  border-top: 1px solid rgba(0,0,0,.06);
  background: var(--chat-bg-surface, #f9fafb);
}
.chat-dark .chat-suggestion-box {
  border-color: rgba(255,255,255,.08);
  background: var(--chat-bg-dark-surface, #1e2025);
}
.chat-suggestion-toggle {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--chat-primary, #32373b);
  text-decoration: none;
  cursor: pointer;
  transition: opacity .15s;
  padding: 2px 0;
}
.chat-suggestion-toggle:hover {
  opacity: .75;
  text-decoration: underline;
}
.chat-suggestion-form {
  margin-top: 8px;
}
.chat-suggestion-cats {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.chat-suggestion-cat {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
  color: #555;
  background: #fff;
}
.chat-suggestion-cat:hover {
  border-color: var(--chat-primary, #32373b);
}
.chat-suggestion-cat input[type="radio"] {
  display: none;
}
.chat-suggestion-cat:has(input:checked) {
  background: var(--chat-primary, #32373b);
  color: #fff;
  border-color: var(--chat-primary, #32373b);
}
.chat-dark .chat-suggestion-cat {
  background: #2a2d33;
  color: #ccc;
  border-color: rgba(255,255,255,.12);
}
.chat-dark .chat-suggestion-cat:has(input:checked) {
  background: var(--chat-primary, #32373b);
  color: #fff;
}
.chat-suggestion-input {
  width: 100%;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: inherit;
  resize: none;
  outline: none;
  background: #fff;
  color: #1a1a1a;
  transition: border-color .2s;
  box-sizing: border-box;
}
.chat-suggestion-input:focus {
  border-color: var(--chat-primary, #32373b);
}
.chat-dark .chat-suggestion-input {
  background: #2a2d33;
  color: #e5e7eb;
  border-color: rgba(255,255,255,.12);
}
.chat-suggestion-send {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 18px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: var(--chat-primary, #32373b);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
.chat-suggestion-send:hover {
  opacity: .88;
}
.chat-suggestion-send:active {
  transform: scale(.97);
}
.chat-suggestion-send:disabled {
  opacity: .5;
  cursor: default;
}
