:host {
    all: initial;
    --mca-blue: #126dde;
    --mca-navy: #14253d;
    --mca-bg: #ffffff;
    --mca-surface: #f2f6fc;
    --mca-text: #14253d;
    --mca-muted: #52657e;
    --mca-border: #d8e2ef;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147483000;
    font: 14px/1.5 Arial, sans-serif;
    color: var(--mca-text);
    direction: ltr;
    color-scheme: light;
}
:host([data-theme="dark"]) {
    --mca-bg: #17263d;
    --mca-surface: #21334d;
    --mca-text: #f0f5fc;
    --mca-muted: #bbcade;
    --mca-border: #405570;
    color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 3px solid #74b1ff; outline-offset: 3px; }
.mca-launcher { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--mca-blue); color: #fff; font-size: 24px; box-shadow: 0 6px 24px #14253d40; float: right; }
.mca-launcher:hover, .mca-launcher:focus { background: #095bc0; color: #fff; }
.mca-panel { position: absolute; right: 0; bottom: 74px; display: flex; flex-direction: column; width: 360px; height: 610px; max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px); background: var(--mca-bg); color: var(--mca-text); border: 1px solid var(--mca-border); border-radius: 18px; overflow: hidden; box-shadow: 0 14px 54px #0b203840; }
.mca-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding: 15px 16px; background: var(--mca-navy); color: #fff; }
.mca-header strong { font-size: 16px; }
.mca-header small { display: block; color: #c5daf5; font-size: 12px; margin-top: 2px; }
.mca-close { border: 0; background: transparent; color: #fff; width: 38px; height: 38px; padding: 0; font-size: 29px; line-height: 1; }
.mca-close:hover { color: #fff; background: #ffffff18; }
.mca-messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 12px; scroll-behavior: auto; }
.mca-message { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 15px; }
.mca-bubble { max-width: 100%; background: var(--mca-surface); border-radius: 12px 12px 12px 3px; padding: 11px 12px; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.mca-user { align-items: flex-end; }
.mca-user .mca-bubble { max-width: 90%; background: var(--mca-blue); color: #fff; border-radius: 12px 12px 3px 12px; }
.mca-text { margin: 0; white-space: pre-line; }
.mca-time { color: var(--mca-muted); font-size: 10px; margin: 4px 3px 0; }
.mca-quick { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; padding: 9px 12px; max-height: 116px; overflow-y: auto; border-top: 1px solid var(--mca-border); }
.mca-chip, .mca-link { border: 1px solid var(--mca-border); border-radius: 16px; background: var(--mca-bg); color: var(--mca-text); padding: 6px 10px; font-size: 12px; line-height: 1.4; white-space: normal; text-decoration: none; text-align: start; }
.mca-chip:hover, .mca-link:hover { color: var(--mca-text); background: var(--mca-surface); border-color: var(--mca-blue); }
.mca-result { display: block; width: 100%; margin-top: 8px; border-radius: 8px; font-size: 13px; }
.mca-card { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--mca-border); }
.mca-card h3 { color: var(--mca-text); font-size: 15px; line-height: 1.45; margin: 0 0 5px; font-weight: 700; }
.mca-code { color: var(--mca-muted); margin: 0 0 8px; font-size: 12px; }
.mca-fields { margin: 0; font-size: 13px; }
.mca-fields dt { margin-top: 7px; font-weight: 700; }
.mca-fields dd { margin: 0; white-space: pre-line; }
.mca-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mca-pagination { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 12px; font-size: 12px; }
.mca-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--mca-border); flex-shrink: 0; }
.mca-form input { flex: 1; min-width: 0; width: 100%; background: var(--mca-bg); color: var(--mca-text); border: 1px solid var(--mca-border); border-radius: 8px; padding: 10px; font-size: 14px; box-shadow: none; }
.mca-form input:focus { background: var(--mca-bg); color: var(--mca-text); }
.mca-form input::placeholder { color: var(--mca-muted); }
#mca-send { width: 42px; border: 0; border-radius: 8px; background: var(--mca-blue); color: #fff; flex-shrink: 0; font-size: 16px; }
.mca-footnote { color: var(--mca-muted); text-align: center; font-size: 10px; padding: 0 10px 9px; }
.mca-footnote a { color: inherit; text-decoration: underline; }
.mca-typing { display: flex; gap: 4px; padding: 13px; width: fit-content; background: var(--mca-surface); border-radius: 12px; margin-bottom: 12px; }
.mca-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--mca-muted); animation: mca-bounce 1s ease-in-out infinite; }
.mca-typing span:nth-child(2) { animation-delay: .15s; }
.mca-typing span:nth-child(3) { animation-delay: .3s; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes mca-bounce { 50% { transform: translateY(-4px); opacity: .5; } }
@media (max-width: 759px) {
    :host { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); }
    .mca-panel { position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh; max-height: none; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
    .mca-form input { font-size: 16px; }
    .mca-header { padding: 15px 16px; }
    .mca-bubble { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) {
    .mca-typing span { animation: none; }
    .mca-messages { scroll-behavior: auto; }
}
