/* Assistente Lumière — janela de conversa */
.ia-launcher {
  position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 9200;
  display: flex; align-items: center; gap: 12px; flex-direction: row-reverse;
}
.ia-orb {
  position: relative; width: 66px; height: 66px; border: 0; padding: 0; border-radius: 50%; cursor: pointer; isolation: isolate;
  background: radial-gradient(circle at 34% 28%, #fffaf0 0%, #f6e3b6 24%, #c9a15c 58%, #6b4524 100%);
  box-shadow: 0 16px 34px rgba(80, 48, 20, 0.38), 0 0 0 1px rgba(255, 240, 210, 0.6) inset, 0 0 30px rgba(246, 210, 140, 0.55);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}
.ia-orb:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 22px 44px rgba(80, 48, 20, 0.42), 0 0 0 1px rgba(255, 240, 210, 0.7) inset, 0 0 46px rgba(246, 210, 140, 0.8); }
.ia-orb::before {
  content: ''; position: absolute; inset: -6px; z-index: -1; border-radius: 50%;
  background: conic-gradient(from 0deg, #f6e3b6, #e9c6c2, #cdbfe8, #f6e3b6, #c39a4f, #f6e3b6);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 64%); mask: radial-gradient(circle, transparent 62%, #000 64%);
  animation: iaSpin 6s linear infinite; filter: blur(0.3px);
}
.ia-orb::after { content: ''; position: absolute; inset: -14px; z-index: -2; border-radius: 50%; border: 1px solid rgba(246, 210, 140, 0.55); animation: iaRipple 3.2s ease-out infinite; }
.ia-orb svg { position: absolute; inset: 0; margin: auto; width: 30px; height: 30px; color: #fff; filter: drop-shadow(0 0 6px rgba(255, 245, 220, 0.95)); }
.ia-orb svg .s2 { transform-origin: 17.5px 16.5px; animation: iaTwinkle 2.4s ease-in-out infinite; }
@keyframes iaSpin { to { transform: rotate(360deg); } }
@keyframes iaRipple { 0% { opacity: 0.9; transform: scale(0.82); } 100% { opacity: 0; transform: scale(1.3); } }
@keyframes iaTwinkle { 0%, 100% { opacity: 0.4; transform: scale(0.7); } 50% { opacity: 1; transform: scale(1.15); } }
.ia-pill {
  position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 18px; border-radius: 18px; cursor: pointer; border: 0;
  font-family: 'DM Sans', system-ui, sans-serif; font-size: 0.9rem; font-weight: 600; color: #3b281c; text-align: left; line-height: 1.25;
  background: rgba(255, 252, 246, 0.94); box-shadow: 0 16px 40px rgba(60, 38, 18, 0.22), inset 0 0 0 1px rgba(195, 154, 79, 0.35);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; transform: translateX(14px) scale(0.96); pointer-events: none; transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.ia-pill small { display: block; font-weight: 400; font-size: 0.76rem; color: #7d6858; }
.ia-pill.is-on { opacity: 1; transform: none; pointer-events: auto; }
.ia-pill .ia-x { margin-left: 4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.9rem; color: #7d6858; background: rgba(143, 98, 52, 0.08); }
body.lm-ia-aberta .ia-launcher { opacity: 0; pointer-events: none; transform: scale(0.8); }
.ia-launcher { transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); }

/* Painel */
.ia-panel {
  position: fixed; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 9300;
  width: min(430px, calc(100vw - 36px)); height: min(700px, calc(100dvh - 36px));
  display: flex; flex-direction: column; overflow: hidden; border-radius: 32px; isolation: isolate;
  font-family: 'DM Sans', system-ui, sans-serif; color: #3b281c;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.9), rgba(250, 242, 230, 0.94));
  -webkit-backdrop-filter: blur(22px) saturate(140%); backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 40px 100px rgba(40, 24, 10, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.7) inset;
  opacity: 0; visibility: hidden; transform: translateY(30px) scale(0.94); transform-origin: bottom right;
  transition: opacity 0.35s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s 0.55s;
}
.ia-panel.is-open { opacity: 1; visibility: visible; transform: none; transition: opacity 0.35s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1); }
.ia-panel::before {
  content: ''; position: absolute; inset: 0; z-index: 2; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--lm-angle, 0deg), rgba(246, 227, 182, 0.9), rgba(233, 198, 194, 0.8), rgba(205, 191, 232, 0.8), rgba(195, 154, 79, 0.9), rgba(246, 227, 182, 0.9));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: lmSpin 8s linear infinite;
}

.ia-head { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 16px 18px 20px; color: #fbeed6; overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, rgba(246, 210, 140, 0.3), transparent 55%), linear-gradient(135deg, #2a1c13, #4a321f); }
.ia-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(246, 210, 140, 0.7), transparent); }
.ia-avatar { position: relative; flex: none; width: 50px; height: 50px; border-radius: 50%; }
.ia-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #f6e3b6; }
.ia-avatar::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; background: conic-gradient(#f6e3b6, #c39a4f, #e9c6c2, #f6e3b6); -webkit-mask: radial-gradient(circle, transparent 64%, #000 66%); mask: radial-gradient(circle, transparent 64%, #000 66%); animation: iaSpin 5s linear infinite; }
.ia-avatar::after { content: ''; position: absolute; right: 1px; bottom: 2px; width: 12px; height: 12px; border-radius: 50%; background: #7ad39a; box-shadow: 0 0 0 2px #2a1c13, 0 0 10px rgba(122, 211, 154, 0.9); }
.ia-title { min-width: 0; flex: 1; }
.ia-title strong { display: block; font-family: 'Cormorant Garamond', serif; font-size: 1.42rem; font-weight: 600; line-height: 1.05; color: #fff3dc; }
.ia-title span { display: block; margin-top: 3px; font-size: 0.78rem; color: rgba(240, 214, 165, 0.82); }
.ia-hbtn { flex: none; width: 38px; height: 38px; border-radius: 12px; border: 1px solid rgba(240, 210, 150, 0.28); display: grid; place-items: center; cursor: pointer; color: #f6e3b6; background: rgba(255, 240, 210, 0.06); transition: background 0.25s, transform 0.3s; }
.ia-hbtn:hover { background: rgba(255, 240, 210, 0.16); transform: translateY(-1px); }
.ia-hbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.ia-body { position: relative; flex: 1; overflow-y: auto; padding: 20px 16px 10px; scroll-behavior: smooth; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(195, 154, 79, 0.5) transparent; }
.ia-welcome { text-align: center; padding: 6px 6px 14px; animation: iaIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; }
.ia-welcome .ia-sigil { width: 74px; height: 74px; margin: 2px auto 12px; }
.ia-welcome .ia-sigil .ring { transform-origin: 50% 50%; animation: iaSpin 18s linear infinite; }
.ia-welcome h3 { margin: 0 0 6px; font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; font-weight: 600; color: #3b281c; }
.ia-welcome p { margin: 0 auto; max-width: 32ch; font-size: 0.9rem; line-height: 1.55; color: #7d6858; }
.ia-sugs { display: grid; gap: 8px; margin-top: 16px; text-align: left; }
.ia-sug { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 14px; border-radius: 16px; cursor: pointer; font: inherit; font-size: 0.88rem; color: #4f3a2c; text-align: left;
  background: rgba(255, 253, 248, 0.92); border: 1px solid rgba(195, 154, 79, 0.28); box-shadow: 0 4px 12px rgba(143, 98, 52, 0.06);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s, box-shadow 0.3s; animation: iaIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) both; animation-delay: calc(0.15s + var(--i, 0) * 70ms); }
.ia-sug:hover { transform: translateX(4px); border-color: rgba(195, 154, 79, 0.6); box-shadow: 0 10px 22px rgba(143, 98, 52, 0.14); }
.ia-sug i { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 0.75rem; color: #fff; background: radial-gradient(circle at 35% 30%, #efd49a, #b88a45 60%, #7a5129); }

.ia-msg { display: flex; gap: 10px; margin: 0 0 14px; animation: iaIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes iaIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.ia-msg .ia-dot { flex: none; width: 30px; height: 30px; margin-top: 2px; border-radius: 50%; background: radial-gradient(circle at 34% 28%, #fffaf0, #f6e3b6 30%, #c9a15c 65%, #6b4524); box-shadow: 0 0 12px rgba(246, 210, 140, 0.6); }
.ia-bubble { max-width: 86%; padding: 12px 16px; border-radius: 20px; font-size: 0.93rem; line-height: 1.6; word-wrap: break-word; }
.ia-msg.bot .ia-bubble { border-top-left-radius: 6px; background: rgba(255, 255, 255, 0.92); border: 1px solid rgba(195, 154, 79, 0.22); box-shadow: 0 8px 20px rgba(143, 98, 52, 0.08); }
.ia-msg.user { flex-direction: row-reverse; }
.ia-msg.user .ia-bubble { border-top-right-radius: 6px; color: #fffaf0; background: linear-gradient(135deg, #c9a15c, #8f6234); box-shadow: 0 10px 22px rgba(143, 98, 52, 0.25); }
.ia-bubble p { margin: 0 0 0.6em; } .ia-bubble p:last-child { margin: 0; }
.ia-bubble ul, .ia-bubble ol { margin: 0.2em 0 0.7em; padding-left: 1.2em; }
.ia-bubble li { margin: 0.2em 0; }
.ia-bubble a { color: #8f6234; font-weight: 600; text-decoration: underline; text-decoration-color: rgba(143, 98, 52, 0.35); text-underline-offset: 3px; }
.ia-bubble strong { color: #3b281c; }
.ia-msg.erro .ia-bubble { background: #fff6f0; border-color: rgba(190, 110, 80, 0.3); }
.ia-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.ia-links a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px 8px 14px; border-radius: 999px; text-decoration: none; font-size: 0.82rem; font-weight: 600; color: #6b4524;
  background: linear-gradient(180deg, #fffaf0, #f6e8cf); border: 1px solid rgba(195, 154, 79, 0.45); transition: transform 0.3s, box-shadow 0.3s; }
.ia-links a:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(143, 98, 52, 0.18); }
.ia-links a::after { content: '→'; }
.ia-typing { display: inline-flex; align-items: center; gap: 6px; padding: 14px 16px; }
.ia-typing span { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, #f1d79f, #b88a45); animation: iaBounce 1.2s ease-in-out infinite; }
.ia-typing span:nth-child(2) { animation-delay: 0.15s; } .ia-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes iaBounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.45; } 40% { transform: translateY(-6px); opacity: 1; } }

.ia-foot { padding: 10px 14px 12px; border-top: 1px solid rgba(195, 154, 79, 0.18); background: linear-gradient(180deg, rgba(255, 252, 246, 0.6), rgba(250, 242, 230, 0.95)); }
.ia-compose { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 24px; background: #fffdf8; border: 1px solid rgba(195, 154, 79, 0.35); box-shadow: 0 6px 18px rgba(143, 98, 52, 0.08); transition: border-color 0.25s, box-shadow 0.25s; }
.ia-compose:focus-within { border-color: rgba(195, 154, 79, 0.75); box-shadow: 0 0 0 4px rgba(246, 227, 182, 0.55), 0 8px 22px rgba(143, 98, 52, 0.12); }
.ia-compose textarea { flex: 1; min-height: 40px; max-height: 130px; padding: 9px 0; border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: 0.95rem; line-height: 1.45; color: #3b281c; }
.ia-compose textarea::placeholder { color: #a8927f; }
.ia-cbtn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; transition: transform 0.3s, box-shadow 0.3s, background 0.3s; }
.ia-cbtn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ia-mic { color: #8f6234; background: rgba(246, 227, 182, 0.55); }
.ia-mic:hover { background: rgba(246, 227, 182, 0.9); }
.ia-mic.is-rec { color: #fff; background: #c0504d; box-shadow: 0 0 0 0 rgba(192, 80, 77, 0.6); animation: iaRec 1.4s ease-out infinite; }
@keyframes iaRec { 0% { box-shadow: 0 0 0 0 rgba(192, 80, 77, 0.55); } 100% { box-shadow: 0 0 0 14px rgba(192, 80, 77, 0); } }
.ia-send { color: #fff; background: linear-gradient(135deg, #d8b26a, #8f6234); box-shadow: 0 8px 18px rgba(143, 98, 52, 0.35); }
.ia-send:hover { transform: translateY(-1px) rotate(-8deg); }
.ia-send:disabled { opacity: 0.45; cursor: default; transform: none; }
.ia-note { margin: 8px 4px 0; font-size: 0.7rem; line-height: 1.4; color: #9a8573; text-align: center; }

@media (max-width: 560px) {
  .ia-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; transform: translateY(40px); }
  .ia-panel::before { display: none; }
  .ia-head { padding-top: max(18px, env(safe-area-inset-top, 0px)); }
  .ia-foot { padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .ia-pill { max-width: calc(100vw - 110px); }
}
@media (prefers-reduced-motion: reduce) {
  .ia-orb::before, .ia-orb::after, .ia-panel::before, .ia-avatar::before { animation: none; }
}
