/* MP Law AI Agent — chat window. Desktop: a panel above the launcher. Phones: the whole screen. */
.mplaw-agent { --mplaw-color: #1f2a44; --mplaw-ink: #1c2230; --mplaw-muted: #5b6475; --mplaw-line: #e3e6ec; --mplaw-bg: #f4f5f8; --mplaw-gold: #b39a6c; position: fixed; bottom: 20px; z-index: 99999; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: var(--mplaw-ink); -webkit-font-smoothing: antialiased; }
:where(.mplaw-agent) *, :where(.mplaw-agent) *::before, :where(.mplaw-agent) *::after { box-sizing: border-box; }
/* Zero-specificity reset against the theme's button and input styles; the component rules below win. */
:where(.mplaw-agent) :where(button, input, textarea) { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; margin: 0; box-shadow: none; }
:where(.mplaw-agent) button { cursor: pointer; }
.mplaw-agent--right { right: 20px; }
.mplaw-agent--left { left: 20px; }
.mplaw-agent__icon { display: inline-flex; width: 20px; height: 20px; flex: none; }
.mplaw-agent__icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mplaw-agent a { color: var(--mplaw-color); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.mplaw-agent :focus-visible { outline: 3px solid var(--mplaw-gold); outline-offset: 2px; }

/* Launcher */
.mplaw-agent__launcher { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; background: var(--mplaw-color); color: #fff !important; border: 0; border-radius: 999px; padding: 0 22px 0 18px; font-weight: 600; font-size: 15px; box-shadow: 0 0 0 2px var(--mplaw-gold), 0 8px 24px rgba(0,0,0,.35); transition: transform .15s ease; }
.mplaw-agent__launcher:hover { transform: translateY(-1px); }

/* Panel */
.mplaw-agent__panel { position: absolute; bottom: 68px; width: 400px; max-width: calc(100vw - 40px); height: 640px; max-height: calc(100vh - 110px); background: #fff; border-radius: 18px; box-shadow: 0 18px 50px rgba(15,20,35,.35); display: flex; flex-direction: column; overflow: hidden; animation: mplaw-in .18s ease-out; }
.mplaw-agent--right .mplaw-agent__panel { right: 0; }
.mplaw-agent--left .mplaw-agent__panel { left: 0; }
.mplaw-agent__panel[hidden] { display: none; }
@keyframes mplaw-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Header */
.mplaw-agent__head { flex: none; display: flex; align-items: center; gap: 10px; background: var(--mplaw-color); color: #fff; padding: 12px 8px 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); }
.mplaw-agent__avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.12); color: var(--mplaw-gold); }
.mplaw-agent__avatar .mplaw-agent__icon { width: 22px; height: 22px; }
.mplaw-agent__who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.mplaw-agent__who strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mplaw-agent__who span { font-size: 12px; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mplaw-agent__who span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #3ccf7a; margin-inline-end: 6px; vertical-align: 1px; }
.mplaw-agent__hbtn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: inherit; }
.mplaw-agent__hbtn:hover { background: rgba(255,255,255,.12); }

/* Conversation */
.mplaw-agent__log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 8px; background: var(--mplaw-bg); scroll-behavior: smooth; }
.mplaw-agent__msg { width: fit-content; max-width: 86%; margin: 0 0 10px; padding: 10px 14px; border-radius: 16px; border-end-start-radius: 4px; background: #fff; box-shadow: 0 1px 2px rgba(15,20,35,.07); overflow-wrap: anywhere; }
.mplaw-agent__msg p { margin: 0 0 8px; white-space: pre-line; }
.mplaw-agent__msg p:last-child { margin-bottom: 0; }
.mplaw-agent__msg--user { margin-inline-start: auto; background: var(--mplaw-color); color: #fff; border-radius: 16px; border-end-end-radius: 4px; }
.mplaw-agent__msg--user a { color: #fff; }
.mplaw-agent__article { display: flex; flex-direction: column; margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--mplaw-bg); text-decoration: none !important; }
.mplaw-agent__article small { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--mplaw-muted); }
.mplaw-agent__article span { font-size: 14px; text-decoration: underline; }

.mplaw-agent__notice { position: relative; font-size: 12.5px; line-height: 1.45; color: var(--mplaw-muted); background: #fbf6ea; border-radius: 12px; padding: 9px 12px; margin: 0 0 12px; }
.mplaw-agent__notice p { margin: 0; }
.mplaw-agent__notice--clamped p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mplaw-agent__more { border: 0; background: none; padding: 2px 0 0; font-size: 12.5px; font-weight: 600; color: var(--mplaw-color); text-decoration: underline; }

.mplaw-agent__chips { margin: 4px 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.mplaw-agent__chips p { width: 100%; margin: 0 0 2px; font-size: 13px; color: var(--mplaw-muted); }
.mplaw-agent__chips button { min-height: 40px; padding: 0 14px; border: 1px solid #cfd5df; border-radius: 999px; background: #fff; font-size: 14px; color: var(--mplaw-color); }
.mplaw-agent__chips button:hover { border-color: var(--mplaw-color); background: #eef1f6; }

.mplaw-agent__typing { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.mplaw-agent__typing i { width: 7px; height: 7px; border-radius: 50%; background: #9aa3b2; animation: mplaw-dot 1.2s infinite ease-in-out; }
.mplaw-agent__typing i:nth-child(2) { animation-delay: .15s; }
.mplaw-agent__typing i:nth-child(3) { animation-delay: .3s; }
@keyframes mplaw-dot { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.mplaw-agent__cta { margin: 2px 0 12px; padding: 12px; border-radius: 14px; background: #fff; border: 1px solid #d9dee8; }
.mplaw-agent__cta p { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; font-weight: 600; font-size: 14px; }
.mplaw-agent__cta p .mplaw-agent__icon { color: var(--mplaw-gold); }
.mplaw-agent__cta button, .mplaw-agent__submit, .mplaw-agent__done button { display: block; width: 100%; min-height: 48px; border: 0; border-radius: 12px; background: var(--mplaw-color); color: #fff; font-weight: 600; font-size: 15px; }
.mplaw-agent__done { margin: 4px 0 12px; padding: 16px; border-radius: 14px; background: #fff; text-align: center; border: 1px solid #cfe9d9; }
.mplaw-agent__done-mark { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: #e3f6eb; color: #1c8a4c; margin-bottom: 6px; }
.mplaw-agent__done strong { display: block; margin-bottom: 12px; }
.mplaw-agent__done button { background: #fff; color: var(--mplaw-color); border: 1px solid var(--mplaw-color); }
.mplaw-agent__error { font-size: 14px; color: #a01818; background: #fdeeee; border-radius: 10px; padding: 8px 12px; margin: 0 0 10px; }

/* Composer */
.mplaw-agent__input { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--mplaw-line); background: #fff; }
.mplaw-agent__input[hidden] { display: none; }
.mplaw-agent__input textarea { flex: 1; min-height: 46px; max-height: 120px; resize: none; border: 1px solid #cfd5df; border-radius: 14px; padding: 11px 14px; font-size: 16px; line-height: 1.4; background: #fff; }
.mplaw-agent__input textarea:focus { border-color: var(--mplaw-color); outline: none; box-shadow: 0 0 0 3px rgba(31,42,68,.12); }
.mplaw-agent__send { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border: 0; border-radius: 50%; background: var(--mplaw-color); color: #fff; }
.mplaw-agent__send:disabled { opacity: .35; cursor: default; }
[dir=rtl] .mplaw-agent__send .mplaw-agent__icon, [dir=rtl] .mplaw-agent__sheet-bar .mplaw-agent__icon { transform: scaleX(-1); }

/* Contact form: a screen of its own over the conversation */
.mplaw-agent__sheet { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; background: #fff; animation: mplaw-in .18s ease-out; }
.mplaw-agent__sheet[hidden] { display: none; }
.mplaw-agent__sheet-bar { flex: none; display: flex; align-items: center; gap: 4px; padding: 8px 14px 8px 6px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--mplaw-color); color: #fff; min-height: 64px; }
.mplaw-agent__sheet-bar strong { font-size: 16px; }
.mplaw-agent__contact { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
.mplaw-agent__intro { margin: 0 0 14px; color: var(--mplaw-muted); font-size: 14px; }
.mplaw-agent__field { margin: 0 0 12px; }
.mplaw-agent__field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.mplaw-agent__field label em { font-style: normal; font-weight: 400; color: var(--mplaw-muted); }
.mplaw-agent__field input { display: block; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #cfd5df; border-radius: 12px; font-size: 16px; background: #fff; }
.mplaw-agent__field input:focus { border-color: var(--mplaw-color); outline: none; box-shadow: 0 0 0 3px rgba(31,42,68,.12); }
.mplaw-agent__field--bad input, .mplaw-agent__field--bad input:focus { border-color: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,43,.15); }
.mplaw-agent__either { margin: 0 0 12px; padding: 10px 12px 0; border: 1px dashed #cfd5df; border-radius: 14px; }
.mplaw-agent__either legend { padding: 0 6px; font-size: 13px; color: var(--mplaw-muted); }
.mplaw-agent__consent { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 12px; font-size: 13.5px; line-height: 1.45; cursor: pointer; padding: 8px; border-radius: 10px; }
.mplaw-agent__consent input { flex: none; width: 22px; height: 22px; margin-top: 1px; accent-color: var(--mplaw-color); }
.mplaw-agent__consent--bad { background: #fdeeee; }
.mplaw-agent__form-error { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: #fdeeee; color: #a01818; font-size: 14px; }
.mplaw-agent__form-error[hidden] { display: none; }
.mplaw-agent__submit:disabled { opacity: .6; }
.mplaw-agent__privacy { margin: 12px 0 0; font-size: 12px; line-height: 1.45; color: var(--mplaw-muted); }

.mplaw-agent[dir=rtl] { direction: rtl; text-align: right; }

/* Phones: the whole screen, the page behind stays still */
@media (max-width: 600px) {
  .mplaw-agent { bottom: 16px; }
  .mplaw-agent--right { right: 16px; }
  .mplaw-agent--left { left: 16px; }
  .mplaw-agent__panel { position: fixed; left: 0; right: 0; top: 0; bottom: auto; width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; box-shadow: none; }
  .mplaw-agent--open .mplaw-agent__launcher { display: none; }
  /* A round chat button, so it never covers the site's own WhatsApp button. */
  .mplaw-agent__launcher { width: 58px; height: 58px; min-height: 58px; padding: 0; justify-content: center; }
  .mplaw-agent__launcher span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mplaw-agent__launcher .mplaw-agent__icon { width: 26px; height: 26px; }
  .mplaw-agent__msg { max-width: 90%; }
}
html.mplaw-agent-lock, html.mplaw-agent-lock body { overflow: hidden !important; }

@media (prefers-reduced-motion: reduce) {
  .mplaw-agent__panel, .mplaw-agent__sheet { animation: none; }
  .mplaw-agent__typing i { animation: none; opacity: .6; }
  .mplaw-agent__log { scroll-behavior: auto; }
}
