#julia-chat-widget {
  --card-bg: #ffffff;
  --border: #E2E3E9;
  --text: #16171D;
  --today-separator-color: #565C76;
  --header-bg: #F3F4F6;
  --avatar-bg: #5ED2A7;
  --chip-bg: #ffffff;
  --chip-text: #565C76;
  --chip-hover: rgba(86, 92, 118, 0.08);
  --chip-border: #898FA9;
  --bubble-ai-bg: #F3F4F6;
  --bubble-ai-text: #16171D;
  --bubble-user-bg: #F3FFCD;
  --bubble-user-text: #565C76;
  --content-width: 960px;
  --avatar-size: 28px;
  --avatar-gap: 10px;
}

#julia-chat-widget,
#julia-chat-widget *:not(svg):not(g):not(path):not(circle):not(rect):not(defs):not(clipPath):not(use),
#julia-chat-widget *:not(svg):not(g):not(path):not(circle):not(rect):not(defs):not(clipPath):not(use)::before,
#julia-chat-widget *:not(svg):not(g):not(path):not(circle):not(rect):not(defs):not(clipPath):not(use)::after {
  all: revert;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---- Restore SVG rendering after all:revert ---- */
#julia-chat-widget svg {
  display: inline-block;
  overflow: visible;
  vertical-align: middle;
}

/* ---- App Wrapper ---- */
#julia-chat-widget .app-wrap {
  font-family: 'Outfit', sans-serif;
  height: 480px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 8px;
}

#julia-chat-widget .chat-card {
  width: min(1000px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Header ---- */
#julia-chat-widget .header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  flex-shrink: 0;
  background: var(--header-bg);
}

#julia-chat-widget .header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

#julia-chat-widget .brand-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--avatar-bg) url(img/avatar.png);
  background-size: cover;
  flex-shrink: 0;
}

#julia-chat-widget .brand-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  line-height: 20px;
}

#julia-chat-widget .reset-btn {
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

#julia-chat-widget .reset-btn:hover,
#julia-chat-widget .reset-btn:active {
  opacity: 0.5;
}

/* ---- Today Separator ---- */
#julia-chat-widget .today-separator {
  text-align: center;
  font-size: 12px;
  line-height: 16px;
  color: var(--today-separator-color);
  font-weight: 500;
  padding: 16px 0 0 0;
}

/* ---- Messages ---- */
#julia-chat-widget .messages {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
}

#julia-chat-widget .messages-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding-bottom: 16px;
}

#julia-chat-widget .row {
  display: flex;
  gap: var(--avatar-gap);
  margin-top: 16px;
  align-items: flex-end;
}

#julia-chat-widget .row.user {
  justify-content: flex-end;
}

/* ---- Avatar ---- */
#julia-chat-widget .avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  background: var(--avatar-bg) url(img/avatar.png);
  background-size: cover;
  flex-shrink: 0;
}

/* ---- Bubbles ---- */
#julia-chat-widget .bubble {
  border-radius: 12px;
  max-width: 80%;
  line-height: 20px;
  font-size: 14px;
  font-weight: 300;
  word-break: break-word;
}

#julia-chat-widget .bubble.ai {
  background: var(--bubble-ai-bg);
  color: var(--bubble-ai-text);
  padding: 20px;
}

#julia-chat-widget .bubble.user {
  background: var(--bubble-user-bg);
  color: var(--bubble-user-text);
  padding: 12px;
}

/* ---- User message wrapper (bubble + "Enviado") ---- */
#julia-chat-widget .user-msg-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 100%;
  flex: 1;
}

#julia-chat-widget .sent-label {
  font-size: 12px;
  color: #565C76;
  font-weight: 500;
  margin-top: 4px;
  padding-right: 2px;
}

/* ---- Markdown content inside AI bubbles ---- */
#julia-chat-widget .bubble.ai h1,
#julia-chat-widget .bubble.ai h2,
#julia-chat-widget .bubble.ai h3,
#julia-chat-widget .bubble.ai h4 {
  font-weight: 600;
  line-height: 1.3;
  margin: 10px 0 6px;
}

#julia-chat-widget .bubble.ai h1 { font-size: 1.25em; }
#julia-chat-widget .bubble.ai h2 { font-size: 1.15em; }
#julia-chat-widget .bubble.ai h3 { font-size: 1.05em; }
#julia-chat-widget .bubble.ai h4 { font-size: 1em; }

#julia-chat-widget .bubble.ai h1:first-child,
#julia-chat-widget .bubble.ai h2:first-child,
#julia-chat-widget .bubble.ai h3:first-child,
#julia-chat-widget .bubble.ai h4:first-child {
  margin-top: 0;
}

#julia-chat-widget .bubble.ai hr {
  border: none;
  border-top: 1px solid #d1d5db;
  margin: 16px 0;
}

#julia-chat-widget .bubble.ai table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 0.92em;
}

#julia-chat-widget .bubble.ai th,
#julia-chat-widget .bubble.ai td {
  border: 1px solid #d1d5db;
  padding: 7px 12px;
  text-align: left;
  vertical-align: top;
}

#julia-chat-widget .bubble.ai th {
  background: #e5e7eb;
  font-weight: 600;
  white-space: nowrap;
}

#julia-chat-widget .bubble.ai tr:nth-child(even) td {
  background: #f9fafb;
}

#julia-chat-widget .bubble.ai p {
  margin: 0 0 8px;
}

#julia-chat-widget .bubble.ai p:last-child {
  margin-bottom: 0;
}

#julia-chat-widget .bubble.ai ol,
#julia-chat-widget .bubble.ai ul {
  padding-left: 20px;
  margin: 6px 0;
}

#julia-chat-widget .bubble.ai li {
  margin: 5px 0;
}

#julia-chat-widget .bubble.ai a {
  color: var(--text);
  text-decoration: underline;
  word-break: break-all;
}

#julia-chat-widget .bubble.ai strong {
  font-weight: 600;
}

/* ---- Loading dots ---- */
#julia-chat-widget .bubble.loading {
  display: flex;
  background: var(--bubble-ai-bg);
  gap: 6px;
  align-items: center;
  padding: 16px 20px;
}

#julia-chat-widget .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: julia-chat-dot-bounce 1.4s infinite ease-in-out both;
}

#julia-chat-widget .dot:nth-child(1) { animation-delay: -0.32s; }
#julia-chat-widget .dot:nth-child(2) { animation-delay: -0.16s; }
#julia-chat-widget .dot:nth-child(3) { animation-delay: 0s; }

@keyframes julia-chat-dot-bounce {
  0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1;   }
}

/* ---- Error ---- */
#julia-chat-widget .error-msg {
  font-size: 13px;
  color: #b91c1c;
  padding: 0 20px 6px;
  text-align: center;
  flex-shrink: 0;
}

#julia-chat-widget .error-msg:empty {
  display: none;
}

/* ---- Inline suggestion chips (inside messages area) ---- */
#julia-chat-widget .inline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-left: calc(var(--avatar-size) + var(--avatar-gap));
}

#julia-chat-widget .chip {
  font-family: 'Outfit', sans-serif;
  border: none;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  padding: 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 300;
  color: var(--chip-text);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

#julia-chat-widget .chip:hover:not(:disabled) {
  background: var(--chip-hover);
}

#julia-chat-widget .chip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---- Composer ---- */
#julia-chat-widget .composer-outer {
  padding: 4px 16px 16px 16px;
  flex-shrink: 0;
}

#julia-chat-widget .composer-wrap {
  border: 1px solid #E2E3E9;
  border-radius: 5px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 18px;
  background: #f9fafb;
  transition: border-color 0.15s;
}

#julia-chat-widget .composer-wrap:focus-within {
  border-color: #898FA9;
}

#julia-chat-widget .composer {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 300;
  line-height: 20px;
  color: var(--text);
  padding: 10px 0 10px 0;
}

#julia-chat-widget .composer::placeholder {
  color: #565C76;
}

#julia-chat-widget .send-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 6px;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

#julia-chat-widget .send-btn:hover:not(:disabled),
#julia-chat-widget .send-btn:active:not(:disabled) {
  opacity: 0.5;
}

#julia-chat-widget .send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
