[hidden] { display: none !important; }
/* ============ ARTFOLIO CHAT WIDGET ============ */
.af-chat {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2147483000;
    font-family: 'Circe', Arial, sans-serif;
    color: #000;
    line-height: 1.4;
}

/* ---------- ПИЛЮЛЯ ---------- */
.af-chat__pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 52px;
    padding: 0 22px;
    border: 0;
    border-radius: 26px;
    background: #a92842;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 200ms ease-in-out, box-shadow 200ms ease-in-out;
}
.af-chat__pill:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 20px rgba(0,0,0,0.22);
}
.af-chat__pill-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.af-chat__pill-text { white-space: nowrap; }

/* ---------- ПАНЕЛЬ ---------- */
.af-chat__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 380px;
    height: 590px;
    max-height: calc(100dvh - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(.2);
    opacity: 0;
    animation: afChatOpen 250ms cubic-bezier(.25,1,.5,1) forwards;
}
@keyframes afChatOpen {
    to { transform: scale(1); opacity: 1; }
}
.af-chat__panel[hidden] { display: none; }

/* шапка */
.af-chat__header {
    flex: 0 0 64px;
    background: #a92842;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 12px 0 16px;
    gap: 12px;
}
.af-chat__avatar {
    flex: 0 0 40px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.af-chat__meta { flex: 1 1 auto; min-width: 0; }
.af-chat__name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.1;
}
.af-chat__status {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    margin-top: 2px;
}
.af-chat__status.is-offline { color: rgba(255,255,255,0.55); }
.af-chat__close {
    flex: 0 0 36px;
    width: 36px; height: 36px;
    background: transparent;
    color: #fff;
    border: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .2s;
}
.af-chat__close:hover { background: rgba(255,255,255,0.15); }

/* лента */
.af-chat__feed {
    flex: 1 1 auto;
    overflow-y: auto;
    background: #f5f5f5;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
.af-chat__msg {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.af-chat__msg--visitor {
    align-self: flex-end;
    background: #a92842;
    color: #fff;
    border-radius: 12px 12px 2px 12px;
}
.af-chat__msg--operator,
.af-chat__msg--system {
    align-self: flex-start;
    background: #fff;
    color: #000;
    border-radius: 12px 12px 12px 2px;
}
.af-chat__msg--system {
    font-style: italic;
    color: #666;
    font-size: 13px;
    background: #efefef;
}
.af-chat__msg-time {
    display: block;
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
}

/* офлайн-форма */
.af-chat__offline-form {
    padding: 12px 16px;
    background: #fffbe8;
    border-top: 1px solid #f0e6b8;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.af-chat__offline-note {
    font-size: 13px;
    color: #7a5d00;
    line-height: 1.35;
}
.af-chat__input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    outline: none;
}
.af-chat__input:focus { border-color: #a92842; }
.af-chat__submit-contact {
    padding: 10px 14px;
    background: #a92842;
    color: #fff;
    border: 0;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

/* форма ввода */
.af-chat__form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
}
.af-chat__textarea {
    flex: 1 1 auto;
    resize: none;
    border: 0;
    padding: 10px 4px;
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
    max-height: 96px;
    overflow-y: auto;
    background: transparent;
}
.af-chat__send {
    flex: 0 0 40px;
    width: 40px; height: 40px;
    border: 0;
    border-radius: 50%;
    background: #a92842;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: transform .15s, opacity .15s;
}
.af-chat__send:hover { transform: scale(1.05); }
.af-chat__send:disabled { opacity: .5; cursor: not-allowed; }

/* юр. ссылка */
.af-chat__legal {
    flex: 0 0 auto;
    padding: 6px 12px 10px;
    font-size: 11px;
    line-height: 1.35;
    color: #888;
    text-align: center;
    background: #fff;
}
.af-chat__legal a {
    color: #666;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------- МОБИЛЬНЫЕ ---------- */
@media (max-width: 640px) {
    .af-chat {
        right: 8px;
        bottom: 8px;
    }
    .af-chat__pill {
        width: calc(100% - 0px);
        justify-content: center;
    }
    .af-chat__panel {
        position: fixed;
        right: 8px;
        bottom: 8px;
        width: calc(100% - 16px);
        height: calc(100dvh - 16px);
        max-height: none;
        border-radius: 12px;
    }
}


/* ============ INTRO-ФОРМА ============ */
.af-chat__intro {
    flex: 1 1 auto;
    overflow-y: auto;
    background: #fff;
    display: flex;
    flex-direction: column;
}
.af-chat__intro-note {
    background: #f0f0f0;
    color: #555;
    font-size: 14px;
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid #e5e5e5;
}
.af-chat__intro-form {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.af-chat__field {
    display: block;
}
.af-chat__field-label {
    display: block;
    font-size: 13px;
    color: #333;
    margin-bottom: 6px;
}
.af-chat__field-input {
    display: block;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #ccc;
    padding: 8px 0;
    font: inherit;
    font-size: 15px;
    background: transparent;
    outline: none;
    transition: border-color .2s;
}
.af-chat__field-input:focus {
    border-bottom-color: #a92842;
}
.af-chat__field-input--textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 140px;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px 12px;
}
.af-chat__field-input--textarea:focus {
    border-color: #a92842;
}

/* телефон с флагом */
.af-chat__field-phone {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 8px;
    transition: border-color .2s;
}
.af-chat__field-phone:focus-within {
    border-bottom-color: #a92842;
}
.af-chat__field-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.af-chat__field-input--phone {
    border-bottom: 0;
    padding: 0;
    flex: 1 1 auto;
    font-size: 15px;
}
.af-chat__field-input--phone:focus {
    border-bottom: 0;
}

/* галочка согласия */
.af-chat__consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #555;
    cursor: pointer;
    padding: 4px 0;
}
.af-chat__consent input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: #a92842;
    cursor: pointer;
}
.af-chat__consent a {
    color: #a92842;
    text-decoration: underline;
}

/* кнопка */
.af-chat__intro-btn {
    margin-top: 6px;
    padding: 14px 20px;
    background: #a92842;
    color: #fff;
    border: 0;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: opacity .2s;
}
.af-chat__intro-btn:hover { opacity: .9; }
.af-chat__intro-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* сообщение об ошибке в intro */
.af-chat__intro-error {
    background: #fde4e8;
    color: #a92842;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 4px;
    display: none;
}
.af-chat__intro-error.is-visible { display: block; }