:root {
    --sit-ink: #122238;
    --sit-muted: #64748b;
    --sit-primary: #0866ff;
    --sit-primary-dark: #074fc2;
    --sit-accent: #22c55e;
    --sit-surface: #ffffff;
    --sit-soft: #f3f7fc;
    --sit-border: #dbe5f1;
}

.sit-chat, .sit-chat * { box-sizing: border-box; }
.sit-chat {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 999999;
    color: var(--sit-ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

.sit-chat__launcher {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 9px 18px 9px 10px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--sit-primary), #6d28d9);
    box-shadow: 0 14px 35px rgba(8, 56, 139, .28);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
}
.sit-chat__launcher:hover { transform: translateY(-1px); }
.sit-chat__launcher:focus-visible, .sit-chat button:focus-visible, .sit-chat textarea:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}
.sit-chat__launcher-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    font-size: 22px;
}
.sit-chat--open .sit-chat__launcher { display: none; }

.sit-chat__panel {
    width: min(390px, calc(100vw - 24px));
    height: min(680px, calc(100vh - 32px));
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 20px;
    background: var(--sit-surface);
    box-shadow: 0 24px 70px rgba(15, 23, 42, .28);
}
.sit-chat__panel:not([hidden]) { display: flex; flex-direction: column; }
.sit-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 18px;
    background: linear-gradient(135deg, #0b58d7, #6d28d9);
    color: #fff;
}
.sit-chat__header strong, .sit-chat__header span { display: block; }
.sit-chat__header strong { font-size: 16px; }
.sit-chat__header span { margin-top: 2px; color: rgba(255,255,255,.8); font-size: 12px; }
.sit-chat__icon-button {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    color: #fff;
    cursor: pointer;
    font-size: 24px;
}
.sit-chat__privacy {
    padding: 8px 14px;
    background: #fff8e6;
    border-bottom: 1px solid #fde5a7;
    color: #77540b;
    font-size: 11px;
    text-align: center;
}
.sit-chat__messages {
    flex: 1;
    min-height: 180px;
    overflow-y: auto;
    padding: 16px;
    background: var(--sit-soft);
    scrollbar-width: thin;
}
.sit-chat__message {
    width: fit-content;
    max-width: 88%;
    margin: 0 0 12px;
    padding: 10px 12px;
    border-radius: 14px;
    box-shadow: 0 2px 5px rgba(15,23,42,.05);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.sit-chat__message--support { border-bottom-left-radius: 4px; background: #fff; }
.sit-chat__message--visitor { margin-left: auto; border-bottom-right-radius: 4px; background: var(--sit-primary); color: #fff; }
.sit-chat__message--system { max-width: 100%; background: #e8eef7; color: #475569; font-size: 13px; }
.sit-chat__message-label { display: block; margin-bottom: 4px; opacity: .7; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }

.sit-chat__quick-actions {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 10px 12px;
    border-top: 1px solid var(--sit-border);
    background: #fff;
}
.sit-chat__quick-actions[hidden] { display: none; }
.sit-chat__quick-actions button {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid #bcd0ef;
    border-radius: 999px;
    background: #f7faff;
    color: #164a94;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
}
.sit-chat__quick-actions button:hover { background: #eaf2ff; }
.sit-chat__composer {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
    padding: 11px 12px;
    border-top: 1px solid var(--sit-border);
    background: #fff;
}
.sit-chat__composer textarea {
    width: 100%;
    min-height: 44px;
    max-height: 110px;
    resize: vertical;
    padding: 10px 11px;
    border: 1px solid #c8d5e5;
    border-radius: 11px;
    color: var(--sit-ink);
    font: inherit;
}
.sit-chat__send {
    align-self: end;
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 11px;
    background: var(--sit-primary);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 750;
}
.sit-chat__send:hover { background: var(--sit-primary-dark); }
.sit-chat__send:disabled, .sit-chat button:disabled { cursor: not-allowed; opacity: .55; }
.sit-chat__footer {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 0 12px 12px;
    background: #fff;
}
.sit-chat__footer button {
    padding: 6px 2px;
    border: 0;
    background: transparent;
    color: var(--sit-muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
}
.sit-chat__human { color: var(--sit-primary) !important; }
.sit-chat--busy .sit-chat__send::after { content: "…"; }
.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (max-width: 520px) {
    .sit-chat { right: 12px; bottom: 12px; }
    .sit-chat__panel { height: calc(100dvh - 24px); border-radius: 16px; }
    .sit-chat__launcher-text { display: none; }
    .sit-chat__launcher { padding-right: 10px; }
}

@media (prefers-reduced-motion: no-preference) {
    .sit-chat__launcher { transition: transform .18s ease, box-shadow .18s ease; }
    .sit-chat__panel:not([hidden]) { animation: sit-chat-in .2s ease-out; transform-origin: bottom right; }
    @keyframes sit-chat-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
}
