:root {
  --mac-accent: var(--mah-accent, #001fb5);
  --mac-accent-strong: var(--mah-accent-strong, #001a9c);
  --mac-accent-soft: var(--mah-accent-soft, rgba(0, 31, 181, .12));
  --mac-surface: var(--mah-surface, #fff);
  --mac-surface-muted: var(--mah-surface-muted, #eef2f9);
  --mac-border: var(--mah-border, rgba(18, 35, 73, .12));
  --mac-text: var(--mah-text, #10203d);
  --mac-text-muted: var(--mah-text-muted, #5f6d87);
  --mac-shadow: var(--mah-shadow-lg, 0 22px 60px rgba(10, 25, 49, .18));
  --mac-ease: var(--mah-ease, cubic-bezier(.16, 1, .3, 1));
  --mac-duration: var(--mah-duration-base, .24s);
}

.mac-chat { position: fixed; right: 24px; bottom: 24px; z-index: 1000; font-family: inherit; color: var(--mac-text); }
.mac-chat__toggle { position: relative; z-index: 2; display: grid; place-items: center; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; background: var(--mac-accent); color: #fff; box-shadow: 0 14px 32px rgba(0, 31, 181, .28); cursor: pointer; transition: transform var(--mac-duration) var(--mac-ease), background var(--mac-duration) var(--mac-ease); }
.mac-chat__toggle:hover, .mac-chat__toggle:focus-visible { background: var(--mac-accent-strong); transform: translateY(-2px); }
.mac-chat[data-mac-open="1"] .mac-chat__toggle { opacity: 0; pointer-events: none; transform: scale(.8); }
.mac-chat__toggle-icon { font-size: 23px; line-height: 1; }
.mac-chat__online-dot { position: absolute; top: 3px; right: 2px; width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; background: #1c9c6b; }
.mac-chat__call { position: fixed; z-index: 2; display: none; align-items: center; justify-content: center; gap: 8px; width: 148px; min-width: 148px; height: 52px; padding: 0 17px; box-sizing: border-box; border: 1px solid rgba(0, 31, 181, .08); border-radius: 999px; background: var(--mac-surface); color: var(--mac-accent); box-shadow: 0 14px 32px rgba(10, 25, 49, .16); font-size: 15px; font-weight: 700; line-height: 1; text-decoration: none; opacity: 0; pointer-events: none; transform: translateY(8px) scale(.96); transition: opacity var(--mac-duration) var(--mac-ease), transform var(--mac-duration) var(--mac-ease), box-shadow var(--mac-duration) var(--mac-ease); }
.mac-chat__call-icon { font-size: 19px; line-height: 1; }
.mac-chat[data-mac-scrolled="1"] .mac-chat__call { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.mac-chat[data-mac-open="1"] .mac-chat__call { opacity: 0; pointer-events: none; transform: translateY(8px) scale(.96); }
.mac-chat__call:hover { box-shadow: 0 17px 36px rgba(10, 25, 49, .2); }
.mac-chat__call:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--mac-accent-soft), 0 0 0 5px #fff, 0 17px 36px rgba(10, 25, 49, .2); }
.mac-chat__overlay { position: fixed; z-index: 0; inset: 0; background: rgba(10, 25, 49, .22); -webkit-backdrop-filter: blur(8px) saturate(108%); backdrop-filter: blur(8px) saturate(108%); }
.mac-chat__panel { position: fixed; z-index: 1; right: 24px; bottom: 24px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; width: min(380px, calc(100vw - 32px)); height: auto; min-height: 360px; max-height: min(740px, calc(100svh - 48px)); overflow: hidden; border: 1px solid var(--mac-border); border-radius: 22px; background: var(--mac-surface); box-shadow: var(--mac-shadow); opacity: 0; transform: translateY(10px) scale(.98); transform-origin: bottom right; transition: opacity var(--mac-duration) var(--mac-ease), transform var(--mac-duration) var(--mac-ease); }
.mac-chat__panel[hidden] { display: none; }
.mac-chat[data-mac-open="1"] .mac-chat__panel { opacity: 1; transform: translateY(0) scale(1); }
.mac-chat__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 18px 17px; background: linear-gradient(135deg, var(--mac-accent), #1736c8); color: #fff; }
.mac-chat__identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mac-chat__avatar { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .16); font-size: 16px; }
.mac-chat__identity h2 { margin: 0; font-size: 15px; line-height: 1.2; font-weight: 700; }
.mac-chat__identity p { margin: 4px 0 0; color: rgba(255, 255, 255, .74); font-size: 11px; line-height: 1.2; }
.mac-chat__close { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 23px; line-height: 1; cursor: pointer; }
.mac-chat__close:hover, .mac-chat__close:focus-visible { background: rgba(255, 255, 255, .14); }
.mac-chat__messages { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 10px; padding: 18px; overflow-y: auto; overscroll-behavior: contain; background: linear-gradient(180deg, #fff 0%, #fbfcff 100%); }
.mac-chat__message { max-width: 82%; padding: 11px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; }
.mac-chat__message p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.mac-chat__phone-link { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.mac-chat__phone-link:hover, .mac-chat__phone-link:focus-visible { opacity: .8; }
.mac-chat__message--assistant { align-self: flex-start; border-bottom-left-radius: 5px; background: var(--mac-surface-muted); color: var(--mac-text-muted); }
.mac-chat__message--user { align-self: flex-end; border-bottom-right-radius: 5px; background: var(--mac-accent); color: #fff; }
.mac-chat__typing { display: inline-flex; align-items: center; gap: 4px; min-height: 19px; }
.mac-chat__typing i { display: block; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .5; animation: mac-chat-bounce 1s infinite ease-in-out; }
.mac-chat__typing i:nth-child(2) { animation-delay: .12s; }.mac-chat__typing i:nth-child(3) { animation-delay: .24s; }
.mac-chat__status { min-height: 18px; padding: 0 18px; color: var(--mac-text-muted); font-size: 12px; }
.mac-chat__error { margin: 0 18px 8px; padding: 9px 11px; border-radius: 10px; background: rgba(209, 57, 75, .08); color: #a92c3d; font-size: 12px; line-height: 1.35; }
.mac-chat__composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px; border-top: 1px solid var(--mac-border); background: var(--mac-surface); }
.mac-chat__composer textarea { display: block; flex: 1 1 auto; min-height: 42px; max-height: 120px; padding: 11px 12px; resize: none; overflow-y: hidden; border: 1px solid var(--mac-border); border-radius: 13px; background: #fff; color: var(--mac-text); font: inherit; font-size: 14px; line-height: 1.4; box-sizing: border-box; }
.mac-chat__composer textarea::placeholder { color: #8a96ad; }.mac-chat__composer textarea:focus-visible { border-color: var(--mac-accent); outline: 0; box-shadow: 0 0 0 3px var(--mac-accent-soft); }
.mac-chat__send { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 13px; background: var(--mac-accent); color: #fff; cursor: pointer; transition: background var(--mac-duration) var(--mac-ease), transform var(--mac-duration) var(--mac-ease); }
.mac-chat__send:hover, .mac-chat__send:focus-visible { background: var(--mac-accent-strong); transform: translateY(-1px); }.mac-chat__send:disabled { opacity: .55; cursor: wait; transform: none; }
.mac-chat__sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mac-chat-scroll-locked, html.mac-chat-scroll-locked, body.mac-chat-scroll-locked { overflow: hidden !important; overscroll-behavior: none; }
.mac-chat button:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--mac-accent-soft), 0 0 0 5px #fff; }

@keyframes mac-chat-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-3px); } }
@media (max-width: 600px) { .mac-chat { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); }.mac-chat__toggle { width: 52px; height: 52px; }.mac-chat__call { left: 16px; right: calc(16px + 52px + 10px); width: auto; min-width: 0; bottom: calc(16px + env(safe-area-inset-bottom)); display: inline-flex; }.mac-chat__panel { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); width: calc(100vw - 32px); height: auto; min-height: min(360px, calc(100svh - 64px)); max-height: min(680px, calc(100svh - 64px)); } }
@media (min-width: 601px) { .mac-chat__call { display: none !important; } }
@media (max-width: 360px) { .mac-chat__call { right: calc(16px + 52px + 6px); padding-right: 13px; padding-left: 13px; } }
@media (prefers-reduced-motion: reduce) { .mac-chat__toggle, .mac-chat__panel { transition-duration: .001s; }.mac-chat__typing i { animation: none; } }
@media (prefers-reduced-transparency: reduce) { .mac-chat__overlay { background: rgba(10, 25, 49, .72); -webkit-backdrop-filter: none; backdrop-filter: none; } }
