.dh-chat {
    --dh-chat-primary: #0B63FA;
    --dh-chat-primary-dark: #2A0A66;
    --dh-chat-line: #e5e7eb;
    --dh-chat-ink: #1f2430;
    --dh-chat-muted: #6b7280;
    --dh-chat-bg: #fff;
    --dh-chat-soft: #f8fafc;
    position: fixed;
    right: 24px;
    bottom: 84px;
    z-index: 100001;
    font-family: inherit;
    color: var(--dh-chat-ink);
}
.dh-chat * { box-sizing: border-box; }
.dh-chat [hidden] { display: none !important; }
.dh-chat__launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 56px;
    padding: 0 20px 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--dh-chat-primary);
    color: #fff;
    font-family: inherit;
    font-size: 17px;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .28);
}
.dh-chat__launcher:hover { background: var(--dh-chat-primary-dark); }
.dh-chat__launcher:focus-visible { outline: 3px solid var(--dh-chat-primary); outline-offset: 2px; }
.dh-chat__launcher-label { font-size: 15px; font-weight: 600; line-height: 1; }
.dh-chat__badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 20px; height: 20px; border-radius: 999px;
    background: #dc2626; color: #fff; font-size: 11px; line-height: 20px; text-align: center;
}
.dh-chat__panel {
    position: absolute; right: 0; bottom: 68px;
    display: flex; flex-direction: column;
    width: 360px; max-width: calc(100vw - 48px); max-height: min(600px, 82vh);
    background: var(--dh-chat-bg);
    border: 1px solid var(--dh-chat-line);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
    transition: width .2s ease, max-height .2s ease;
}
.dh-chat__panel--expanded { width: 480px; max-height: min(760px, 92vh); }
.dh-chat__header {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    background: var(--dh-chat-primary);
    color: #fff;
}
.dh-chat__avatar {
    flex: 0 0 42px; width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; background: #fff; color: var(--dh-chat-ink);
    font-size: 20px;
}
.dh-chat__identity { flex: 1; min-width: 0; }
.dh-chat__identity strong {
    display: block; font-size: 17px; font-weight: 700; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dh-chat__status { display: flex; align-items: center; gap: 6px; margin: 3px 0 0; font-size: 12px; line-height: 1.2; color: rgba(255, 255, 255, .92); }
.dh-chat__status-dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.dh-chat__status[data-state="away"] .dh-chat__status-dot { background: #fbbf24; }
.dh-chat__status[data-state="offline"] .dh-chat__status-dot { background: #f87171; }
.dh-chat__header-actions { position: relative; display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.dh-chat__icon-btn {
    width: 36px; height: 36px; border: 0; border-radius: 50%;
    background: rgba(255, 255, 255, .18); color: #fff; font-size: 15px;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.dh-chat__icon-btn:hover { background: var(--dh-chat-primary-dark); }
.dh-chat__icon-btn:focus-visible, .dh-chat__menu-item:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.dh-chat__menu {
    position: absolute; top: 44px; right: 0; z-index: 2;
    display: flex; flex-direction: column; gap: 2px;
    min-width: 200px; padding: 6px;
    background: #fff; border: 1px solid var(--dh-chat-line); border-radius: 12px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, .22);
}
.dh-chat__menu-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; min-height: 40px; padding: 8px 10px;
    border: 0; border-radius: 8px; background: transparent;
    color: var(--dh-chat-ink); font-family: inherit; font-size: 13px; font-weight: 600;
    text-align: left; cursor: pointer;
}
.dh-chat__menu-item:hover { background: var(--dh-chat-soft); }
.dh-chat__menu-item i { font-size: 15px; line-height: 1; }
.dh-chat__menu-item--danger { color: #b91c1c; }
.dh-chat__menu-item--danger:hover { background: #fef2f2; }
.dh-chat__error { margin: 8px 16px 0; color: #b91c1c; font-size: 12px; }
.dh-chat__prechat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dh-chat__prechat-body { flex: 1; overflow-y: auto; padding: 16px; }
.dh-chat__welcome {
    margin: 0; padding: 12px 14px;
    border: 1px solid var(--dh-chat-line); border-radius: 12px; background: #fff;
    font-size: 14px; line-height: 1.5; white-space: pre-line; color: var(--dh-chat-ink);
}
.dh-chat__subtitle { margin: 8px 0 0; font-size: 12px; color: var(--dh-chat-muted); text-align: center; }
.dh-chat__start-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; border-top: 1px solid var(--dh-chat-line); }
.dh-chat__intro-hint { margin: 0 0 2px; font-size: 12px; color: var(--dh-chat-muted); text-align: center; }
.dh-chat__req { color: var(--dh-chat-primary); }
.dh-chat__prechat input, .dh-chat__prechat select, .dh-chat__composer textarea, .dh-chat__rating textarea {
    width: 100%; min-height: 46px; padding: 11px 12px;
    border: 1px solid var(--dh-chat-line); border-radius: 10px;
    font: inherit; font-size: 14px; color: var(--dh-chat-ink); background: #fff;
}
.dh-chat__prechat input::placeholder, .dh-chat__composer textarea::placeholder, .dh-chat__rating textarea::placeholder { color: #9aa3af; }
.dh-chat__prechat input:focus, .dh-chat__prechat select:focus, .dh-chat__composer textarea:focus, .dh-chat__rating textarea:focus {
    outline: 2px solid var(--dh-chat-primary); outline-offset: 1px; border-color: var(--dh-chat-primary);
}
.dh-chat__privacy { margin: 0; font-size: 11px; color: var(--dh-chat-muted); }
.dh-chat__offline-hint { margin: 0; font-size: 12px; color: var(--dh-chat-muted); }
.dh-chat__offline-hint a { color: var(--dh-chat-primary); font-weight: 600; }
.dh-chat__primary {
    width: 100%; min-height: 46px; padding: 12px 14px; border: 0; border-radius: 10px;
    background: var(--dh-chat-primary); color: #fff;
    font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.dh-chat__primary:hover:not(:disabled) { background: var(--dh-chat-primary-dark); }
.dh-chat__primary:disabled { opacity: .55; cursor: not-allowed; }
.dh-chat__primary:focus-visible { outline: 3px solid var(--dh-chat-primary); outline-offset: 2px; }
.dh-chat__thread { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dh-chat__messages { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.dh-chat__msg { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.dh-chat__msg--visitor, .dh-chat__msg--client { align-self: flex-end; background: var(--dh-chat-primary); color: #fff; border-bottom-right-radius: 4px; }
.dh-chat__msg--agent { align-self: flex-start; background: var(--dh-chat-soft); border: 1px solid var(--dh-chat-line); border-bottom-left-radius: 4px; }
.dh-chat__msg--system { align-self: flex-start; max-width: 92%; background: #fff; border: 1px solid var(--dh-chat-line); color: var(--dh-chat-ink); }
.dh-chat__typing { margin: 0; padding: 4px 16px; font-size: 11px; color: var(--dh-chat-muted); }
.dh-chat__composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--dh-chat-line); }
.dh-chat__composer textarea { flex: 1; resize: none; }
.dh-chat__composer .dh-chat__primary { width: 44px; min-height: 44px; flex: 0 0 44px; display: inline-flex; align-items: center; justify-content: center; }
.dh-chat__link {
    margin: 0 12px 10px; border: 0; background: transparent; color: var(--dh-chat-muted);
    font-size: 12px; text-decoration: underline; cursor: pointer;
    min-height: 44px; display: inline-flex; align-items: center;
}
.dh-chat__rating { padding: 16px; overflow-y: auto; min-height: 0; flex: 1; }
.dh-chat__rating .dh-chat__link { margin: 8px 0 0; }
.dh-chat__stars { display: flex; gap: 6px; margin: 6px 0 12px; }
.dh-chat__stars button { border: 0; background: transparent; font-size: 26px; color: #6b7280; cursor: pointer; min-width: 44px; min-height: 44px; }
.dh-chat__stars button[aria-pressed="true"] { color: #b45309; }
.dh-chat__stars button:focus-visible, .dh-chat__close:focus-visible, .dh-chat__link:focus-visible { outline: 3px solid var(--dh-chat-primary); outline-offset: 2px; }
.dh-chat__footer {
    padding: 9px 16px;
    border-top: 1px solid var(--dh-chat-line);
    background: var(--dh-chat-soft);
    font-size: 11px; color: var(--dh-chat-muted); text-align: center;
}
.dh-chat__footer strong { font-weight: 700; color: var(--dh-chat-ink); }
.dh-chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 767.98px) {
    .dh-chat { right: 12px; bottom: 124px; }
    .dh-chat__panel { position: fixed; inset: 0; width: auto; max-width: none; max-height: none; border-radius: 0; bottom: 0; }
    .dh-chat__panel--expanded { width: auto; max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
    .dh-chat * { transition: none !important; animation: none !important; }
}
