.ma-widget, [data-mapyai-launcher], .ma-desk {
    --ma-ink: #112842;
    --ma-blue: #164da4;
    --ma-line: #d0def0;
    --ma-tint: #eff5ff;
    --ma-muted: #46627f;
}
.ma-widget, [data-mapyai-launcher] {
    --ma-compact-header-top: 10px;
    --ma-compact-title-row: 32px;
}
.ma-widget *, [data-mapyai-launcher] *, .ma-desk * { box-sizing: border-box; }
.ma-widget [hidden], .ma-desk [hidden] { display: none !important; }
.ma-widget :is(a, button, input, textarea):focus-visible,
[data-mapyai-launcher] :is(a, button):focus-visible,
.ma-desk :is(a, button, input, select, textarea):focus-visible {
    outline: 3px solid #2974df;
    outline-offset: 3px;
}
.ma-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ma-launch {
    position: fixed; z-index: 1050; right: 22px; bottom: 22px;
    display: flex; align-items: center; gap: 9px; min-height: 50px; padding: 0 17px;
    border: 1px solid #7facfa; border-radius: 99px; background: #174ea7;
    color: #fff; box-shadow: 0 8px 26px #0b1a3b55; font: 700 .93rem/1.25 system-ui, sans-serif;
    cursor: pointer;
}
.ma-launch span:first-child { font-size: 1.3rem; }
.ma-launch:hover { background: #103c87; }
.ma-open .ma-launch { visibility: hidden; }
.ma-popup {
    position: fixed; inset: auto 22px 22px auto; z-index: 1100; margin: 0;
    width: min(430px, calc(100% - 44px)); height: min(690px, calc(100dvh - 44px));
    border: 1px solid #aac5ed; border-radius: 19px; padding: 0; overflow: hidden;
    background: #142f54; color: var(--ma-ink); box-shadow: 0 20px 70px #08112475;
}
.ma-popup::backdrop { background: #09183199; }
/* Keep window controls available while the iframe loads and align them with its title. */
.ma-window-tools {
    position: absolute; z-index: 1; inset-block-start: var(--ma-compact-header-top); inset-inline-end: 12px;
    display: grid; justify-items: end;
    color: #e3efff; font: 600 .76rem system-ui, sans-serif;
}
.ma-popup .ma-window-tools a {
    display: inline-flex; align-items: center; min-height: 21px;
    color: inherit; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px;
}
.ma-popup .ma-window-tools a:hover { color: #fff; }
.ma-window-tools button {
    width: 36px; height: var(--ma-compact-title-row); padding: 0;
    border: 0; border-radius: 8px; background: #ffffff24;
    color: #fff; font: 1.45rem/1 system-ui, sans-serif; cursor: pointer;
}
.ma-window-tools button:hover { background: #ffffff3d; }
.ma-window-tools :is(a, button):focus-visible { outline-color: #c1dfff; }
.ma-popup iframe { display: block; width: 100%; height: 100%; border: 0; }
.ma-widget {
    margin: 0; height: 100dvh; display: flex; flex-direction: column;
    background: #fff; color: var(--ma-ink);
    font: .94rem/1.5 system-ui, -apple-system, sans-serif;
}
.ma-widget :is(h1, h2, p) { margin: 0; }
.ma-hero {
    display: flex; align-items: center; gap: 11px; padding: 14px 18px 16px;
    color: white; background: radial-gradient(ellipse at 100% 0, #3166a7, transparent 76%), #142f54;
}
.ma-hero h1 { font-size: 1.39rem; letter-spacing: -.035em; }
.ma-hero p { font-size: .8rem; color: #dceaff; }
.ma-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: #ffffff24; font-size: 1.65rem; }
.ma-hero-embedded {
    flex-shrink: 0; align-items: flex-start; gap: 9px;
    padding-block: var(--ma-compact-header-top) 9px;
    padding-inline: 13px 128px;
}
.ma-hero-embedded .ma-mark { flex: 0 0 36px; height: 36px; margin-top: 5px; font-size: 1.38rem; }
.ma-hero-embedded h1 { font-size: 1.28rem; line-height: var(--ma-compact-title-row); }
.ma-hero-embedded > :last-child { min-width: 0; overflow-wrap: anywhere; }
.ma-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 6px 13px; gap: 4px; background: #f1f6ff; border-bottom: 1px solid var(--ma-line); }
.ma-widget button, .ma-desk button { font: inherit; font-weight: 650; cursor: pointer; }
.ma-tabs button { border: 0; border-radius: 8px; padding: 8px; background: transparent; color: var(--ma-muted); }
.ma-tabs button[aria-selected=true] { color: var(--ma-blue); background: white; box-shadow: 0 1px 3px #102f5124; }
.ma-panel { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.ma-widget .ma-progress { min-height: 8px; margin: 0; padding: 7px 14px; font-size: .77rem; color: var(--ma-muted); }
.ma-widget > #ma-chat-panel:has(.ma-start:not([hidden])) { overflow: auto; }
.ma-start, .ma-articles { padding: 10px 18px; }
.ma-start h2 { font-size: 1.19rem; }
.ma-start p { margin: 5px 0 12px; color: var(--ma-muted); }
.ma-widget form label { display: grid; gap: 4px; font-size: .85rem; font-weight: 650; }
.ma-widget form { display: grid; gap: 9px; }
.ma-widget :is(input, textarea), .ma-desk :is(textarea, select) {
    width: 100%; padding: 8px 9px; border: 1px solid var(--ma-line); border-radius: 8px;
    color: var(--ma-ink); background: #fff; font: inherit;
}
.ma-widget input::placeholder, .ma-widget textarea::placeholder { color: #4b6380; }
.ma-primary, .ma-desk button {
    display: inline-flex; justify-content: center; align-items: center; width: fit-content;
    min-height: 38px; padding: 8px 13px; border: 1px solid var(--ma-line); border-radius: 8px; background: white;
    color: var(--ma-ink);
}
.ma-primary, .ma-desk .ma-primary { background: var(--ma-blue); color: #fff; border-color: var(--ma-blue); }
.ma-primary:hover, .ma-desk .ma-primary:hover { background: #143f83; }
.ma-primary:disabled { opacity: .6; cursor: wait; }
.ma-note, .ma-optional { color: var(--ma-muted); font-size: .75rem; font-weight: 400; }
.ma-widget .ma-note { margin: 7px 0 0; }
.ma-widget .ma-error, .ma-desk .ma-error { padding: 8px 12px; color: #862223; background: #fff0f1; margin: 2px 12px; border-radius: 7px; }
.ma-messages { flex: 1 1 auto; min-height: 45px; overflow: auto; list-style: none; display: flex; flex-direction: column; gap: 11px; padding: 7px 15px 12px; margin: 0; }
.ma-message { align-self: flex-start; width: fit-content; max-width: 91%; border-radius: 12px; padding: 8px 11px; background: var(--ma-tint); color: var(--ma-ink); }
.ma-message[data-role=client] { align-self: flex-end; color: #fff; background: #194b96; }
.ma-message[data-role=agent] { background: #e8f5f1; }
.ma-message strong { display: block; font-size: .73rem; margin-bottom: 3px; }
.ma-message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ma-message a { display: block; margin-top: 5px; color: var(--ma-blue); font-size: .82rem; text-underline-offset: 2px; }
.ma-message time { display: block; margin-top: 4px; font-size: .71rem; opacity: .85; }
.ma-compose { border-top: 1px solid var(--ma-line); }
.ma-compose { padding: 8px 12px; }
.ma-compose form { display: flex; gap: 7px; align-items: end; }
.ma-compose textarea { min-width: 0; resize: none; }
.ma-actions { display: flex; gap: 15px; margin-top: 5px; }
.ma-actions button { background: none; border: 0; padding: 4px 0; color: var(--ma-blue); text-decoration: underline; text-underline-offset: 3px; font-size: .8rem; }
.ma-widget-footer { padding: 5px 12px 8px; text-align: center; font-size: .78rem; margin-top: auto; }
.ma-widget-footer a, .ma-articles a { color: var(--ma-blue); }
.ma-rating {
    flex: 1 1 auto; min-height: 0; overflow: auto;
    background: radial-gradient(ellipse at 50% 0, #e8f2ff, transparent 60%), #f8fbff;
}
.ma-rating-content { display: grid; gap: 14px; width: min(100%, 490px); margin: 0 auto; padding: 22px clamp(14px, 5vw, 28px); }
.ma-rating :is([data-rating-intro], [data-thanks]) { text-align: center; }
.ma-rating-mark {
    display: inline-grid; place-items: center; width: 42px; height: 42px; margin-bottom: 8px;
    border: 1px solid #c6dcf6; border-radius: 14px; background: #dbeaff; color: #164da4; font-size: 1.42rem;
}
.ma-rating h2 { font-size: clamp(1.4rem, 5.8vw, 1.85rem); line-height: 1.17; letter-spacing: -.035em; }
.ma-widget .ma-rating p { margin-top: 5px; color: var(--ma-muted); }
.ma-widget .ma-rating form { gap: 13px; }
.ma-rating fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.ma-score { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(5px, 2vw, 10px); }
.ma-score label { position: relative; cursor: pointer; }
.ma-score input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ma-score-tile {
    display: grid; justify-items: center; align-content: center; min-height: 59px;
    border: 1px solid #c8d9ef; border-radius: 10px; background: #fff; color: var(--ma-blue); font-size: .95rem;
}
.ma-score-tile > span { font-size: 1.29rem; line-height: 1.15; }
.ma-score label:hover .ma-score-tile { border-color: var(--ma-blue); background: #edf4ff; }
.ma-score label input:checked + .ma-score-tile { border-color: var(--ma-blue); background: var(--ma-blue); color: #fff; }
.ma-score input:focus-visible + .ma-score-tile { outline: 3px solid #2974df; outline-offset: 2px; }
.ma-score-scale { display: flex; justify-content: space-between; margin-top: 6px; color: var(--ma-muted); font-size: .75rem; }
.ma-widget .ma-rating form > label { font-size: .94rem; }
.ma-rating textarea { min-height: 80px; resize: vertical; font-weight: 400; }
.ma-rating .ma-primary { width: 100%; min-height: 45px; }
.ma-rating-actions, .ma-review-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 15px; }
.ma-widget :is(.ma-rating-actions, .ma-review-actions) button:not(.ma-primary) {
    min-height: 36px; padding: 4px; border: 0; background: transparent;
    color: var(--ma-blue); text-decoration: underline; text-underline-offset: 3px; font-size: .84rem;
}
.ma-review-actions { padding: 10px 12px 6px; border-top: 1px solid var(--ma-line); }
.ma-rating-thanks { padding-block: 24px; }
.ma-articles { overflow: auto; gap: 9px; }
.ma-articles label { font-weight: 700; }
.ma-articles ul { list-style: none; margin: 0; padding: 0; }
.ma-articles li { border-bottom: 1px solid var(--ma-line); }
.ma-articles a { display: block; padding: 9px 0; text-decoration: none; }
.ma-articles a span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .83rem; color: var(--ma-muted); }
.ma-desk { max-width: 72rem; margin: 0 auto; padding: 18px; }
.ma-desk-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.ma-desk-heading h1 { margin: 4px 0 0; }
.ma-desk-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(230px, 1fr); gap: 15px; align-items: start; }
.ma-desk-card { background: var(--bg-secondary, #fff); border: 1px solid var(--border-color, #d0def0); border-radius: 13px; padding: 16px; }
.ma-desk-card h2 { margin-top: 0; }
.ma-desk-card .ma-messages { height: clamp(160px, 48vh, 540px); margin-bottom: 12px; }
.ma-desk-card form label { display: block; margin-bottom: 5px; }
.ma-desk-card button { margin-top: 6px; }
.ma-desk-card :is(dt, dd) { margin: 0 0 6px; overflow-wrap: anywhere; }
.ma-desk-card dt { font-weight: 700; }
.ma-table { overflow: auto; margin: 10px 0; }
.ma-table table { width: 100%; }
.ma-table :is(td, th) { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border-color, #d0def0); }
.ma-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ma-filter select { width: auto; }
.ma-filter button { margin: 0; }
.ma-settings { max-width: 740px; }
.ma-settings :is(input:not([type=checkbox]), select) { display: block; width: 100%; max-width: 480px; }
.ma-settings-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) { .ma-desk-grid { grid-template-columns: 1fr; } }
@media (max-width: 580px) {
    .ma-popup { inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
    .ma-launch { bottom: 13px; right: 13px; }
}
