/* MMK Assistant — floating chat */
.mmk-ai { position: fixed; right: 22px; bottom: 22px; z-index: 90; font-family: var(--font-body); }
.ai-launch { position: relative; width: 62px; height: 62px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #1a1206; cursor: pointer;
  background: radial-gradient(120% 120% at 30% 20%, #f3dfb4 0%, #dfc28a 38%, #b88a3e 100%);
  box-shadow: 0 18px 36px -14px rgba(122,90,30,.75), 0 0 0 1px rgba(255,255,255,.55) inset, 0 0 0 6px rgba(223,194,138,.16);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease); animation: aiFloat 5s ease-in-out infinite; }
.ai-launch:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 22px 40px -14px rgba(122,90,30,.85), 0 0 0 1px rgba(255,255,255,.6) inset, 0 0 0 8px rgba(223,194,138,.22); }
.ai-launch:focus-visible { outline: 3px solid #0e171c; outline-offset: 3px; }
.ai-launch-ico, .ai-launch-x { position: absolute; inset: 0; display: grid; place-items: center; transition: transform .4s var(--ease), opacity .25s; }
.ai-launch-ico svg { width: 30px; height: 30px; overflow: visible; }
.ai-bub { fill: #0e171c; }
.ai-star { fill: #f3dfb4; transform-origin: 16px 14px; animation: aiTwinkle 3.2s ease-in-out infinite; }
.ai-launch-x { opacity: 0; transform: rotate(-90deg) scale(.6); }
.ai-launch-x svg { width: 24px; height: 24px; color: #0e171c; }
.mmk-ai.open .ai-launch { animation: none; }
.mmk-ai.open .ai-launch-ico { opacity: 0; transform: rotate(90deg) scale(.6); }
.mmk-ai.open .ai-launch-x { opacity: 1; transform: none; }
.ai-online { position: absolute; top: 3px; right: 3px; width: 14px; height: 14px; border-radius: 50%; background: #2fbf7f; border: 2.5px solid #fff; box-shadow: 0 0 0 0 rgba(47,191,127,.5); animation: aiOnline 2.4s ease-out infinite; }
.mmk-ai.open .ai-online { opacity: 0; }
.ai-launch::before { content: attr(data-label); position: absolute; right: calc(100% + 14px); top: 50%; transform: translate(6px, -50%); padding: .45rem .8rem; border-radius: 10px; background: #0e171c; color: #fff; font: 700 .78rem/1 var(--font-body); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.ai-launch:hover::before, .ai-launch:focus-visible::before { opacity: 1; transform: translate(0, -50%); }
.mmk-ai.open .ai-launch::before { display: none; }
@keyframes aiFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes aiTwinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .75; transform: scale(.82); } }
@keyframes aiOnline { 0% { box-shadow: 0 0 0 0 rgba(47,191,127,.5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(47,191,127,0); } }
@media (prefers-reduced-motion: reduce) { .ai-launch, .ai-star, .ai-online { animation: none; } }

.ai-teaser { position: absolute; right: 74px; bottom: 4px; width: 250px; padding: 14px 16px; border-radius: 18px 18px 6px 18px; background: #fff; color: var(--ink); border-bottom-right-radius: 6px; box-shadow: 0 20px 44px -16px rgba(14,23,28,.45); cursor: pointer; animation: aiPop .5s var(--ease) both; font-size: .86rem; line-height: 1.45; }
.ai-teaser b { display: block; font-size: .95rem; }
.ai-teaser-x { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.1rem; color: var(--stone); line-height: 1; }
@keyframes aiPop { from { opacity: 0; transform: translateY(10px) scale(.96); } }

.ai-panel { position: absolute; right: 0; bottom: 76px; width: min(390px, calc(100vw - 24px)); height: min(600px, calc(100vh - 120px)); display: flex; flex-direction: column; border-radius: 26px; overflow: hidden; background: #fbf9f5; box-shadow: 0 40px 90px -30px rgba(8,13,16,.6), 0 0 0 1px rgba(14,23,28,.06); animation: aiPop .4s var(--ease) both; }
.ai-panel[hidden] { display: none; }
.ai-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 16px 18px; background: linear-gradient(135deg, #1f3038, #0e171c); color: #fff; }
.ai-head b { display: block; font-size: 1rem; }
.ai-head small { display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.7); font-size: .74rem; }
.ai-head > div { flex: 1; min-width: 0; }
.ai-dot { width: 7px; height: 7px; border-radius: 50%; background: #3ddc97; box-shadow: 0 0 0 3px rgba(61,220,151,.25); }
.ai-avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(223,194,138,.16); flex: none; }
.ai-avatar img { width: 28px; }
.ai-head button { width: 34px; height: 34px; border-radius: 10px; border: 0; background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center; flex: none; }
.ai-head button:hover { background: rgba(255,255,255,.16); }
.ai-head svg { width: 16px; height: 16px; }
.ai-body { flex: 1; overflow-y: auto; padding: 18px 14px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.ai-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; animation: aiPop .35s var(--ease) both; }
.ai-msg.user { align-self: flex-end; }
.ai-mini { width: 28px; height: 28px; border-radius: 10px; background: var(--ink); display: grid; place-items: center; flex: none; }
.ai-mini img { width: 18px; }
.ai-bubble { padding: .7rem .95rem; border-radius: 18px; font-size: .9rem; line-height: 1.5; color: var(--ink); background: #fff; border: 1px solid #ece6db; border-bottom-left-radius: 6px; word-wrap: break-word; min-width: 0; }
.ai-msg.user .ai-bubble { background: var(--ink); color: #fff; border: 0; border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
.ai-bubble a { color: var(--gold); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.ai-msg.user .ai-bubble a { color: var(--gold-2); }
.ai-bubble ul { margin: .35rem 0; padding-left: 1.1rem; }
.ai-bubble li { margin: .15rem 0; }
.ai-action { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: .35rem .7rem; border-radius: 999px; background: #e2f4ec; color: #237a54 !important; font-size: .78rem; font-weight: 800; text-decoration: none !important; }
.ai-action svg { width: 14px; height: 14px; }
.ai-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--mist); animation: aiDot 1.2s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.ai-chips[hidden] { display: none; }
.ai-chips button { padding: .45rem .8rem; border-radius: 999px; border: 1px solid #e3d6bd; background: #fff; color: var(--slate); font-size: .78rem; font-weight: 700; transition: all .2s; }
.ai-chips button:hover { background: var(--gold-3); border-color: var(--gold); color: var(--ink); }
.ai-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid #ece6db; background: #fff; }
.ai-form textarea { flex: 1; resize: none; border: 1.5px solid #ece6db; border-radius: 14px; padding: .7rem .9rem; font: inherit; font-size: .9rem; color: var(--ink); background: #fbf9f5; outline: none; max-height: 110px; min-height: 44px; }
.ai-form textarea:focus { border-color: var(--gold); background: #fff; }
.ai-form button { width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--ink); color: var(--gold-2); display: grid; place-items: center; flex: none; transition: transform .2s; }
.ai-form button:hover { transform: translateY(-1px); }
.ai-form button:disabled { opacity: .5; }
.ai-form button svg { width: 18px; height: 18px; }
.ai-foot { margin: 0; padding: 0 14px 10px; background: #fff; font-size: .68rem; color: var(--mist); text-align: center; }

/* live alongside the WhatsApp button on the public site */
/* WhatsApp sits in a tidy stack directly above the assistant button, in the site's ink & gold */
body:has(.mmk-ai:not(.in-portal)) .wa-float { right: 27px; bottom: 98px; width: 52px; height: 52px; z-index: 89; color: #dfc28a;
  background: linear-gradient(145deg, #24363f, #0e171c); box-shadow: 0 14px 28px -12px rgba(14,23,28,.7), 0 0 0 1px rgba(223,194,138,.35) inset, 0 0 0 5px rgba(14,23,28,.08);
  transition: transform .35s var(--ease), color .25s, opacity .25s, visibility .25s; }
body:has(.mmk-ai:not(.in-portal)) .wa-float svg { width: 25px; height: 25px; }
body:has(.mmk-ai:not(.in-portal)) .wa-float:hover { transform: translateY(-2px) scale(1.06); color: #f3dfb4; }
body:has(.mmk-ai.open) .wa-float { opacity: 0; visibility: hidden; transform: translateY(12px) scale(.8); }
.wa-float::before { content: "WhatsApp us"; position: absolute; right: calc(100% + 12px); top: 50%; transform: translate(6px, -50%); padding: .4rem .75rem; border-radius: 10px; background: #0e171c; color: #fff; font-size: .78rem; font-weight: 700; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.wa-float:hover::before, .wa-float:focus-visible::before { opacity: 1; transform: translate(0, -50%); }
@media (max-width: 520px) {
  .ai-launch { width: 54px; height: 54px; }
  .ai-launch-ico svg { width: 26px; height: 26px; }
  .ai-online { width: 12px; height: 12px; top: 2px; right: 2px; }
  body:has(.mmk-ai:not(.in-portal)) .wa-float { right: 18px; bottom: 78px; width: 46px; height: 46px; }
  body:has(.mmk-ai:not(.in-portal)) .wa-float svg { width: 22px; height: 22px; }
  .wa-float::before, .ai-launch::before { display: none; }
}

/* portal: dark mode */
:root[data-theme="dark"] .ai-panel { background: #0f191e; }
:root[data-theme="dark"] .ai-bubble { background: #16232a; border-color: #213139; color: #edf1f2; }
:root[data-theme="dark"] .ai-form, :root[data-theme="dark"] .ai-foot { background: #121c22; border-color: #213139; }
:root[data-theme="dark"] .ai-form textarea { background: #0b1216; border-color: #213139; color: #edf1f2; }
:root[data-theme="dark"] .ai-chips button { background: #16232a; border-color: #2b3e47; color: #c5d0d3; }

@media (max-width: 520px) {
  .mmk-ai { right: 14px; bottom: 14px; }
  .ai-panel { position: fixed; inset: auto 8px 84px 8px; width: auto; height: min(70vh, calc(100vh - 110px)); }
  .ai-teaser { width: 220px; }
}
@media print { .mmk-ai { display: none !important; } }

/* live status while the assistant checks something */
.ai-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .8rem; font-weight: 700; color: var(--gold); animation: aiPulse 1.4s ease-in-out infinite; }
.ai-status svg { width: 14px; height: 14px; animation: aiSpin 2.4s linear infinite; }
@keyframes aiPulse { 50% { opacity: .55; } }
@keyframes aiSpin { to { transform: rotate(360deg); } }
.ai-bubble b { color: inherit; font-weight: 800; }
.ai-bubble .ai-action b { margin-left: 2px; letter-spacing: .08em; }
.ai-chips { animation: aiPop .35s var(--ease) both; }
body:has(.mmk-ai.in-portal) .view { padding-bottom: 104px; }

/* phones: floating buttons appear after the hero */
@media (max-width: 520px) {
  .mmk-ai:not(.in-portal), body:has(.mmk-ai:not(.in-portal)) .wa-float { transition: opacity .35s var(--ease), transform .35s var(--ease), visibility .35s; }
  body:not(.floats-in) .mmk-ai:not(.in-portal), body:not(.floats-in):has(.mmk-ai:not(.in-portal)) .wa-float { opacity: 0; visibility: hidden; transform: translateY(24px); pointer-events: none; }
}

/* 👍 / 👎 under answers */
.ai-rate { display: flex; gap: 4px; margin-top: 8px; opacity: .55; transition: opacity .2s; }
.ai-msg:hover .ai-rate, .ai-rate.done { opacity: 1; }
.ai-rate button { border: 1px solid #ece6db; background: #fff; border-radius: 999px; padding: 2px 9px; font-size: .78rem; line-height: 1.5; cursor: pointer; filter: grayscale(1); transition: filter .2s, transform .15s, border-color .2s; }
.ai-rate button:hover { filter: none; transform: translateY(-1px); }
.ai-rate button.on { filter: none; border-color: var(--gold); background: var(--gold-3, #f7ecd6); }
.ai-rate.done button:not(.on) { display: none; }
.ai-rate-note { margin-top: 8px; font-size: .8rem; color: var(--stone); }
.ai-rate-note button { border: 0; background: none; padding: 0; color: var(--gold); font-weight: 800; text-decoration: underline; cursor: pointer; font-size: inherit; }
.ai-action.ai-wa { background: #0e171c; color: #dfc28a !important; }
:root[data-theme="dark"] .ai-rate button { background: #16232a; border-color: #2b3e47; }

/* 🎤 voice input */
.ai-form .ai-mic { width: 44px; height: 44px; border-radius: 14px; border: 1.5px solid #ece6db; background: #fff; color: var(--slate); display: grid; place-items: center; flex: none; transition: all .2s; }
.ai-form .ai-mic[hidden] { display: none; }
.ai-form .ai-mic:hover { border-color: var(--gold); color: var(--ink); }
.ai-form .ai-mic svg { width: 19px; height: 19px; }
.ai-form .ai-mic.on { background: #d2564b; border-color: #d2564b; color: #fff; animation: micPulse 1.3s ease-out infinite; }
@keyframes micPulse { 0% { box-shadow: 0 0 0 0 rgba(210,86,75,.45); } 100% { box-shadow: 0 0 0 12px rgba(210,86,75,0); } }
:root[data-theme="dark"] .ai-form .ai-mic { background: #16232a; border-color: #213139; color: #c5d0d3; }
