.trai-chat-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  font-family: inherit;
  color: #111827;
}
.trai-bubble-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.trai-bubble-label {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(15, 23, 42, .18);
  border: 1px solid rgba(15,23,42,.08);
}
.trai-chat-bubble {
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: none;
  background: var(--trai-primary, #0f766e);
  color: #fff;
  font-size: 27px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .28);
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.trai-chat-bubble:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.04);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .32);
}
.trai-chat-panel {
  display: none;
  width: min(392px, calc(100vw - 28px));
  height: 560px;
  max-height: calc(100vh - 96px);
  background: #fff;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .30);
  border: 1px solid rgba(15,23,42,.10);
  margin-bottom: 12px;
}
.trai-open .trai-chat-panel {
  display: flex;
  flex-direction: column;
  animation: traiPanelIn .18s ease-out;
}
.trai-open .trai-bubble-wrap {
  display: none;
}
@keyframes traiPanelIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.trai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--trai-primary, #0f766e), color-mix(in srgb, var(--trai-primary, #0f766e) 72%, #111827 28%));
  color: #fff;
  padding: 14px 15px;
}
.trai-chat-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.15;
}
.trai-chat-title strong {
  font-size: 15px;
  letter-spacing: .01em;
}
.trai-chat-title span {
  font-size: 12px;
  opacity: .9;
}
.trai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.trai-chat-clear,
.trai-chat-close {
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.14);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
}
.trai-chat-clear {
  font-size: 12px;
  line-height: 1;
  padding: 8px 10px;
}
.trai-chat-close {
  width: 32px;
  height: 32px;
  font-size: 22px;
  line-height: 1;
}
.trai-chat-clear:hover,
.trai-chat-close:hover {
  background: rgba(255,255,255,.24);
}
.trai-chat-body {
  flex: 1;
  padding: 13px;
  overflow: auto;
  background: #f6f7f9;
  scroll-behavior: smooth;
}
.trai-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 16px;
  margin: 0 0 10px;
  white-space: pre-line;
  font-size: 14px;
  line-height: 1.38;
}
.trai-msg-bot {
  background: #fff;
  color: #1f2937;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 5px rgba(15,23,42,.07);
}
.trai-msg-user {
  background: var(--trai-primary, #0f766e);
  color: #fff;
  border-bottom-right-radius: 6px;
  margin-left: auto;
  box-shadow: 0 1px 7px rgba(15,23,42,.10);
}
.trai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 230px;
}
.trai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #94a3b8;
  animation: traiDots 1s infinite ease-in-out;
}
.trai-typing span:nth-child(2) { animation-delay: .15s; }
.trai-typing span:nth-child(3) { animation-delay: .3s; }
.trai-typing em {
  font-style: normal;
  font-size: 12px;
  color: #64748b;
  margin-left: 4px;
}
@keyframes traiDots {
  0%, 80%, 100% { opacity: .35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
.trai-current-product {
  display: none;
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  padding: 9px 10px;
}
.trai-current-product-info {
  font-size: 12px;
  line-height: 1.3;
  color: #334155;
  margin-bottom: 7px;
}
.trai-current-product-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.trai-current-product-actions a,
.trai-current-product-actions button {
  border: 1px solid #d8dee4;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1;
  text-decoration: none;
  background: #fff;
  color: #111827;
  cursor: pointer;
}
.trai-current-product-actions a {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.trai-products-box {
  display: block;
  max-height: 225px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 9px 10px 1px;
  background: #fff;
  border-top: 1px solid #eef2f7;
}
.trai-products-title {
  display: block;
  width: 100%;
  clear: both;
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 800;
  color: #334155;
}
.trai-related-title {
  margin-top: 6px;
  color: var(--trai-primary, #0f766e);
}
.trai-product-card {
  display: inline-flex;
  flex-direction: column;
  vertical-align: top;
  width: calc(50% - 8px);
  min-width: 170px;
  min-height: 132px;
  margin: 0 6px 9px 0;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 9px;
  text-decoration: none;
  color: inherit;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15,23,42,.04);
}
.trai-related-card {
  border-style: dashed;
  background: #fbfefc;
}
.trai-product-card strong,
.trai-product-card span,
.trai-product-card small {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}
.trai-product-card strong {
  color: #111827;
}
.trai-card-meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.trai-price-chip,
.trai-stock-chip {
  width: auto;
  display: inline-flex !important;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 11px !important;
  font-weight: 700;
}
.trai-price-chip {
  background: #eff6ff;
  color: #1d4ed8;
}
.trai-stock-chip {
  background: #f1f5f9;
  color: #475569;
}
.trai-stock-in {
  background: #ecfdf5;
  color: #047857;
}
.trai-stock-out {
  background: #fef2f2;
  color: #b91c1c;
}
.trai-product-summary {
  color: #64748b;
  margin-top: 6px;
  font-size: 11px !important;
  min-height: 24px;
}
.trai-variation-box {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.trai-variation-title,
.trai-variation-more {
  width: 100%;
  color: #475569 !important;
  font-size: 11px !important;
  margin-top: 0 !important;
}
.trai-variation-pill {
  border: 1px solid #d8dee4;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 11px;
  background: #f8fafc;
  cursor: pointer;
}
.trai-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
}
.trai-card-actions a,
.trai-card-actions button {
  border: 1px solid #d8dee4;
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1;
  text-decoration: none;
  background: #fff;
  color: #202124;
  cursor: pointer;
}
.trai-card-actions .trai-wa-mini {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.trai-card-actions .trai-interest-btn.trai-picked,
.trai-variation-pill.trai-picked {
  background: var(--trai-primary, #0f766e);
  border-color: var(--trai-primary, #0f766e);
  color: #fff;
}
.trai-interest-summary {
  display: none;
  background: #ecfdf5;
  color: #065f46;
  border-top: 1px solid #d1fae5;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.3;
}
.trai-quick {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  padding: 10px;
  background: #fff;
  border-top: 1px solid #eef2f7;
  max-height: 92px;
  overflow: auto;
}
.trai-quick button,
.trai-quick a {
  border: 1px solid #d8dee4;
  background: #fff;
  color: #202124;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background .14s ease, border-color .14s ease;
}
.trai-quick button:hover,
.trai-quick a:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.trai-quick .trai-wa {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}
.trai-chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #edf0f2;
  background: #fff;
}
.trai-chat-form input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d8dee4;
  border-radius: 999px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.trai-chat-form input:focus {
  border-color: var(--trai-primary, #0f766e);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--trai-primary, #0f766e) 16%, transparent);
}
.trai-chat-form button {
  border: none;
  border-radius: 999px;
  background: var(--trai-primary, #0f766e);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  min-width: 66px;
}
.trai-chat-form button:disabled,
.trai-chat-form input:disabled {
  opacity: .72;
  cursor: wait;
}
.trai-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(10px);
  background: #111827;
  color: #fff;
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 1000000;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 12px 34px rgba(15,23,42,.24);
}
.trai-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@supports not (color: color-mix(in srgb, white, black)) {
  .trai-chat-header { background: var(--trai-primary, #0f766e); }
  .trai-chat-form input:focus { box-shadow: 0 0 0 3px rgba(15,118,110,.16); }
}
@media (max-width: 480px) {
  .trai-chat-root {
    right: 10px;
    bottom: 10px;
  }
  .trai-bubble-label {
    display: none;
  }
  .trai-chat-panel {
    width: calc(100vw - 20px);
    height: calc(100vh - 28px);
    max-height: none;
    border-radius: 18px;
  }
  .trai-chat-body {
    padding: 11px;
  }
  .trai-product-card {
    width: 100%;
    min-width: 0;
  }
  .trai-products-box {
    max-height: 240px;
  }
  .trai-quick {
    max-height: 104px;
  }
}

/* V1.2.2 - Lista de interés / carrito WhatsApp */
.trai-interest-summary {
  display: none;
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
  padding: 10px;
  font-size: 12px;
  color: #334155;
}
.trai-cart-title {
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 2px;
}
.trai-cart-hint {
  display: block;
  color: #64748b;
  margin-bottom: 8px;
}
.trai-cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 12px;
  padding: 7px;
  margin: 0 0 6px;
}
.trai-cart-name {
  min-width: 0;
  line-height: 1.25;
}
.trai-cart-name strong,
.trai-cart-name span,
.trai-cart-name em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 215px;
}
.trai-cart-name span {
  color: #475569;
}
.trai-cart-name em {
  font-style: normal;
  color: #0f766e;
  font-weight: 700;
}
.trai-cart-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.trai-cart-controls button {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
  line-height: 1;
  font-size: 14px;
}
.trai-cart-qty {
  min-width: 20px;
  text-align: center;
  font-weight: 800;
}
.trai-cart-controls .trai-cart-remove {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff5f5;
}
.trai-cart-wa {
  display: block;
  text-align: center;
  margin-top: 8px;
  background: #16a34a;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 10px;
  font-weight: 800;
}
.trai-matched-variation {
  display: inline-block;
  margin-top: 6px;
  background: #ecfeff;
  color: #155e75;
  border: 1px solid #cffafe;
  border-radius: 999px;
  padding: 4px 7px;
  font-weight: 700;
}
@media (max-width: 480px) {
  .trai-cart-name strong,
  .trai-cart-name span,
  .trai-cart-name em {
    max-width: 175px;
  }
}

/* V1.3.0 - Destacados, ofertas y nuevos */
.trai-highlight-title {
  color: #92400e;
}
.trai-highlight-card {
  border-color: rgba(245, 158, 11, 0.38);
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.9), #fff);
}
.trai-badge-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
}


/* V1.4.4 chat polish */
.trai-chat-root {
  --trai-surface: #ffffff;
  --trai-soft: #f8fafc;
  --trai-border: rgba(15, 23, 42, .10);
}
.trai-bubble-label {
  backdrop-filter: blur(10px);
}
.trai-chat-bubble {
  position: relative;
  overflow: hidden;
}
.trai-chat-bubble::after {
  content: "";
  position: absolute;
  inset: 8px 10px auto auto;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  border: 2px solid #fff;
}
.trai-chat-panel {
  border-radius: 24px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, .34);
}
.trai-chat-header {
  padding: 15px 16px;
  min-height: 56px;
}
.trai-chat-title strong {
  font-size: 16px;
}
.trai-chat-title span {
  opacity: .94;
}
.trai-chat-body {
  background:
    radial-gradient(circle at top left, rgba(15,118,110,.08), transparent 28%),
    #f6f7f9;
}
.trai-msg {
  box-shadow: 0 2px 10px rgba(15, 23, 42, .06);
}
.trai-msg-bot {
  border: 1px solid rgba(226, 232, 240, .85);
}
.trai-msg-user {
  border: 1px solid color-mix(in srgb, var(--trai-primary, #0f766e) 72%, #fff 28%);
}
.trai-products-box {
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, .03);
}
.trai-product-card {
  border-radius: 16px;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.trai-product-card:hover {
  transform: translateY(-1px);
  border-color: rgba(15,118,110,.32);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .09);
}
.trai-product-card strong {
  font-size: 12.5px;
}
.trai-price-chip,
.trai-stock-chip,
.trai-badge-chip,
.trai-matched-variation {
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}
.trai-card-actions a,
.trai-card-actions button,
.trai-current-product-actions a,
.trai-current-product-actions button,
.trai-quick button,
.trai-quick a {
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.trai-card-actions a:hover,
.trai-card-actions button:hover,
.trai-current-product-actions a:hover,
.trai-current-product-actions button:hover,
.trai-quick button:hover,
.trai-quick a:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
}
.trai-card-actions .trai-wa-mini,
.trai-quick .trai-wa,
.trai-cart-wa {
  background: linear-gradient(135deg, #16a34a, #22c55e);
  border-color: #16a34a;
}
.trai-current-product {
  background: linear-gradient(180deg, #f8fafc, #ffffff);
}
.trai-interest-summary {
  background: linear-gradient(180deg, #f0fdf4, #ffffff);
}
.trai-chat-form {
  box-shadow: 0 -8px 22px rgba(15, 23, 42, .04);
}
.trai-chat-form button {
  font-weight: 800;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--trai-primary, #0f766e) 24%, transparent);
}
.trai-chat-form button:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
@media (max-width: 480px) {
  .trai-chat-panel {
    height: calc(100vh - 18px);
    border-radius: 20px;
  }
  .trai-chat-header {
    padding: 13px 14px;
  }
  .trai-chat-clear {
    padding: 7px 9px;
  }
  .trai-chat-bubble {
    width: 58px;
    height: 58px;
  }
}
@supports not (color: color-mix(in srgb, white, black)) {
  .trai-msg-user { border-color: rgba(255,255,255,.18); }
  .trai-chat-form button { box-shadow: 0 8px 18px rgba(15,118,110,.24); }
}


/* V1.5.4 - Chat compacto y variaciones legibles */
.trai-chat-panel {
  width: min(370px, calc(100vw - 24px));
  height: 530px;
}
.trai-chat-header {
  padding: 11px 13px;
  min-height: 48px;
}
.trai-chat-title strong { font-size: 14px; }
.trai-chat-title span { font-size: 11px; }
.trai-chat-body { padding: 10px; }
.trai-msg {
  font-size: 13px;
  line-height: 1.32;
  padding: 8px 10px;
  margin-bottom: 8px;
  max-width: 92%;
}
.trai-products-box {
  max-height: 170px;
  padding: 7px 8px 0;
}
.trai-products-title {
  margin: 0 0 5px;
  font-size: 11px;
  letter-spacing: .01em;
}
.trai-product-card {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0 0 6px;
  padding: 7px 8px;
  border-radius: 12px;
}
.trai-product-card strong {
  font-size: 12px !important;
  line-height: 1.2;
  margin-bottom: 2px;
}
.trai-badge-chip {
  margin-top: 2px;
  padding: 1px 6px;
  font-size: 10px;
}
.trai-card-meta {
  gap: 4px;
  margin-top: 4px;
}
.trai-price-chip,
.trai-stock-chip {
  padding: 3px 6px;
  font-size: 10px !important;
}
.trai-product-summary {
  margin-top: 4px;
  min-height: 0;
  font-size: 10.5px !important;
  line-height: 1.25 !important;
  color: #475569;
}
.trai-variation-box {
  gap: 3px;
  margin-top: 5px;
}
.trai-variation-title,
.trai-variation-more {
  color: #334155 !important;
  opacity: 1 !important;
  font-size: 10.5px !important;
  font-weight: 800;
}
.trai-variation-pill {
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
  opacity: 1 !important;
  font-weight: 800;
  padding: 3px 6px;
  font-size: 10.5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trai-variation-pill:hover,
.trai-variation-pill:focus {
  background: #eff6ff !important;
  color: #1e3a8a !important;
  border-color: #60a5fa !important;
}
.trai-variation-pill.trai-picked {
  background: var(--trai-primary, #0f766e) !important;
  color: #fff !important;
  border-color: var(--trai-primary, #0f766e) !important;
}
.trai-matched-variation {
  margin-top: 4px;
  padding: 3px 6px;
  font-size: 10.5px !important;
  opacity: 1 !important;
  color: #164e63 !important;
  background: #ecfeff !important;
  border-color: #67e8f9 !important;
}
.trai-card-actions {
  gap: 5px;
  padding-top: 6px;
  margin-top: 6px;
}
.trai-card-actions a,
.trai-card-actions button {
  padding: 5px 7px;
  font-size: 10.5px;
  font-weight: 800;
}
.trai-quick {
  padding: 7px 8px;
  gap: 5px;
  max-height: 68px;
}
.trai-quick button,
.trai-quick a {
  padding: 5px 8px;
  font-size: 11px;
}
.trai-chat-form { padding: 8px; }
.trai-chat-form input { padding: 8px 10px; font-size: 13px; }
.trai-chat-form button { padding: 8px 11px; min-width: 56px; }
@media (min-width: 481px) {
  .trai-product-card {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 8px;
    align-items: start;
  }
  .trai-product-card > strong,
  .trai-product-card > .trai-badge-chip,
  .trai-product-card > .trai-card-meta,
  .trai-product-card > .trai-matched-variation,
  .trai-product-card > .trai-variation-box,
  .trai-product-card > .trai-product-summary {
    grid-column: 1 / 2;
  }
  .trai-product-card > .trai-card-actions {
    grid-column: 2 / 3;
    grid-row: 1 / span 5;
    flex-direction: column;
    align-items: stretch;
    min-width: 58px;
    padding-top: 0;
    margin-top: 0;
  }
}
@media (max-width: 480px) {
  .trai-chat-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    border-radius: 16px;
  }
  .trai-chat-header { padding: 10px 11px; }
  .trai-chat-body { padding: 8px; }
  .trai-products-box {
    max-height: 155px;
    padding: 6px 7px 0;
  }
  .trai-product-card {
    padding: 7px;
    margin-bottom: 5px;
  }
  .trai-card-actions a,
  .trai-card-actions button {
    flex: 1 1 auto;
    text-align: center;
    padding: 5px 6px;
  }
  .trai-quick { max-height: 58px; }
}
