:root {
  --bg: #07080b;
  --panel: rgba(16, 18, 24, 0.96);
  --panel-2: rgba(255,255,255,.055);
  --gold: #e8c36a;
  --gold-2: #f5de98;
  --green: #25d366;
  --text: #fff8e7;
  --muted: rgba(255,248,231,.68);
  --line: rgba(232,195,106,.22);
  --user: rgba(232,195,106,.16);
  --assistant: rgba(255,255,255,.06);
  --shadow: 0 24px 70px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(232,195,106,.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(37,211,102,.10), transparent 26%),
    var(--bg);
  color: var(--text);
  overflow: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }
.ai-shell {
  width: 100%;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  background: linear-gradient(180deg, rgba(13,14,19,.98), rgba(7,8,11,.98));
}
.ai-header {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.ai-logo {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #121006;
  font-weight: 950;
  background: radial-gradient(circle at 35% 20%, #fff3b8, var(--gold) 45%, #c99d3f 100%);
  box-shadow: 0 18px 42px rgba(232,195,106,.22), inset 0 1px 0 rgba(255,255,255,.65);
}
.ai-title-wrap { min-width: 0; }
h1 {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--gold-2);
  font-size: clamp(19px, 3vw, 28px);
  line-height: 1.08;
}
.ai-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.ai-quick-panel {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  overflow-x: auto;
  scrollbar-width: thin;
}
.ai-quick-panel button,
.chat-actions a,
.chat-actions button {
  white-space: nowrap;
  border: 1px solid rgba(232,195,106,.22);
  background: rgba(255,255,255,.055);
  color: var(--text);
  border-radius: 999px;
  min-height: 38px;
  padding: 0 13px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ai-quick-panel button:hover,
.chat-actions a:hover,
.chat-actions button:hover { border-color: rgba(232,195,106,.6); color: var(--gold-2); }
.chat-messages {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  max-width: 88%;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 22px;
  padding: 12px 14px;
  box-shadow: 0 14px 32px rgba(0,0,0,.14);
}
.msg.ai {
  align-self: flex-start;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.04));
  border-color: rgba(232,195,106,.18);
}
.msg.user {
  align-self: flex-end;
  background: linear-gradient(180deg, rgba(232,195,106,.20), rgba(232,195,106,.10));
  border-color: rgba(232,195,106,.28);
}
.msg strong { color: var(--gold-2); }
.msg p { margin: 0 0 8px; line-height: 1.62; }
.msg p:last-child { margin-bottom: 0; }
.msg ul { margin: 8px 0 0; padding-left: 18px; color: rgba(255,248,231,.82); line-height: 1.6; }
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chat-actions .primary {
  background: linear-gradient(135deg, #f1d486, #c49a3f);
  color: #151006;
  border-color: transparent;
}
.chat-actions .whatsapp {
  background: var(--green);
  color: #06170d;
  border-color: transparent;
}
.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(0,0,0,.22);
}
.chat-form input {
  min-width: 0;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(232,195,106,.20);
  background: rgba(255,255,255,.08);
  color: var(--text);
  padding: 0 16px;
  outline: none;
}
.chat-form input:focus { border-color: rgba(232,195,106,.70); box-shadow: 0 0 0 4px rgba(232,195,106,.10); }
.chat-form button {
  height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 950;
  background: linear-gradient(135deg, #f1d486, #c49a3f);
  color: #151006;
}
.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  animation: blink 1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

body.rtl { direction: rtl; }
body.rtl .msg.ai { align-self: flex-end; }
body.rtl .msg.user { align-self: flex-start; }
body.rtl .msg ul { padding-left: 0; padding-right: 18px; }

@media (max-width: 560px) {
  .ai-header { padding: 14px 14px 12px; }
  .ai-logo { width: 46px; height: 46px; border-radius: 16px; }
  .chat-messages { padding: 14px; }
  .msg { max-width: 94%; }
  .chat-form { grid-template-columns: 1fr; }
  .chat-form button { width: 100%; }
}
