.chat-launcher {
    position: fixed;
    z-index: 70;
    right: 22px;
    bottom: 22px;
    display: inline-flex;
    min-height: 54px;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border: 1px solid rgba(255, 217, 120, .45);
    border-radius: 999px;
    background: linear-gradient(135deg, var(--orange-bright), var(--orange));
    box-shadow: 0 18px 46px rgba(0, 0, 0, .42), 0 8px 28px rgba(255, 122, 0, .25);
    color: #1d1005;
    cursor: pointer;
    font-weight: 820;
    line-height: 1.15;
    transition: transform .2s ease, box-shadow .2s ease;
}
.chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 21px 50px rgba(0, 0, 0, .46), 0 10px 34px rgba(255, 122, 0, .34); }
.chat-launcher svg { width: 22px; height: 22px; flex: 0 0 auto; }
.chat-unread {
    display: grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    padding-inline: 6px;
    border: 2px solid #1d1005;
    border-radius: 999px;
    background: var(--teal);
    color: #07110f;
    font-size: .72rem;
    font-weight: 900;
}
.chat-unread[hidden] { display: none; }

.chat-panel {
    position: fixed;
    z-index: 71;
    right: 22px;
    bottom: 88px;
    display: grid;
    width: min(390px, calc(100vw - 28px));
    max-height: min(690px, calc(100dvh - 112px));
    grid-template-rows: auto minmax(150px, 1fr) auto;
    overflow: hidden;
    border: 1px solid rgba(255, 184, 84, .3);
    border-radius: 21px;
    background: rgba(10, 13, 17, .985);
    box-shadow: 0 28px 90px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .04);
    color: var(--text);
}
.chat-panel[hidden] { display: none; }
.chat-panel-header { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 18px 18px 15px; border-bottom: 1px solid rgba(255, 255, 255, .07); background: linear-gradient(135deg, rgba(255, 153, 51, .09), rgba(84, 211, 194, .035)); }
.chat-panel-heading { min-width: 0; }
.chat-panel-heading h2 { margin: 0; font-size: 1.05rem; line-height: 1.25; }
.chat-presence { display: flex; gap: 7px; align-items: center; margin: 5px 0 0; color: var(--muted-2); font-size: .79rem; }
.chat-presence::before { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px rgba(255, 217, 120, .35); content: ""; }
.chat-close { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid rgba(255, 255, 255, .09); border-radius: 10px; background: rgba(255, 255, 255, .035); color: var(--muted); cursor: pointer; font-size: 1.35rem; line-height: 1; }
.chat-close:hover { border-color: var(--border-strong); color: var(--text); }

.chat-messages { overflow-y: auto; padding: 18px; overscroll-behavior: contain; }
.chat-intro { padding: 14px; border: 1px solid rgba(84, 211, 194, .15); border-radius: 14px; background: rgba(84, 211, 194, .055); }
.chat-intro p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.chat-intro p + p { margin-top: 8px; }
.chat-thread { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.chat-message { max-width: 88%; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, .045); }
.chat-message--visitor { align-self: flex-end; border-color: rgba(255, 153, 51, .22); border-radius: 14px 14px 4px 14px; background: rgba(255, 153, 51, .1); }
.chat-message--owner { border-color: rgba(84, 211, 194, .22); background: rgba(84, 211, 194, .085); }
.chat-message--system { max-width: 100%; border-color: rgba(255, 217, 120, .14); background: rgba(255, 217, 120, .045); }
.chat-message p { margin: 0; overflow-wrap: anywhere; color: var(--text); font-size: .9rem; line-height: 1.5; white-space: pre-wrap; }
.chat-message time { display: block; margin-top: 5px; color: var(--muted-2); font-size: .7rem; }

.chat-form { padding: 15px 18px 18px; border-top: 1px solid rgba(255, 255, 255, .07); background: rgba(5, 7, 9, .72); }
.chat-contact-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 9px; }
.chat-field { min-width: 0; }
.chat-field label { display: block; margin-bottom: 4px; color: var(--muted-2); font-size: .72rem; font-weight: 720; }
.chat-field input, .chat-field textarea { width: 100%; border: 1px solid rgba(255, 184, 84, .2); border-radius: 10px; outline: none; background: rgba(255, 255, 255, .035); color: var(--text); }
.chat-field input { min-height: 39px; padding: 8px 10px; font-size: .85rem; }
.chat-field textarea { min-height: 76px; max-height: 145px; resize: vertical; padding: 10px 11px; font-size: .9rem; line-height: 1.45; }
.chat-field input:focus, .chat-field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(84, 211, 194, .1); }
.chat-message-field { margin-bottom: 10px; }
.chat-form-footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.chat-send { min-height: 41px; flex: 0 0 auto; padding: 9px 15px; border: 1px solid transparent; border-radius: 10px; background: linear-gradient(135deg, var(--orange-bright), var(--orange)); color: #1d1005; cursor: pointer; font-weight: 820; }
.chat-send:disabled { cursor: wait; opacity: .62; }
.chat-connection { margin: 0; color: var(--muted-2); font-size: .73rem; line-height: 1.3; }
.chat-connection[data-state="error"] { color: var(--danger); }
.chat-connection[data-state="connected"] { color: var(--success); }
.chat-privacy { margin: 10px 0 0; color: var(--muted-2); font-size: .7rem; line-height: 1.45; }
.chat-privacy a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.chat-honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 520px) {
    .chat-launcher { right: 14px; bottom: 14px; min-height: 50px; padding: 11px 15px; font-size: .9rem; }
    .chat-panel { right: 14px; bottom: 76px; max-height: calc(100dvh - 96px); }
    .chat-contact-fields { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
    .chat-launcher-label { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .chat-panel { right: 7px; width: calc(100vw - 14px); }
}

@media (prefers-reduced-motion: reduce) {
    .chat-launcher { transition: none; }
    .chat-launcher:hover { transform: none; }
}
