.lani-chat {
    position: fixed;
    left: 24px;
    bottom: 24px;
    z-index: 999998;
    font-family: var(--font-body, 'Inter', sans-serif);
}

body.has-bottom-nav .lani-chat {
    bottom: calc(78px + env(safe-area-inset-bottom));
}

.lani-chat__toggle {
    width: 58px;
    height: 58px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: linear-gradient(145deg, #ff5a67 0%, var(--aloha-red, #e30613) 55%, #b8000c 100%);
    color: #fff;
    box-shadow: 0 10px 30px rgba(227, 6, 19, 0.35);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    transition: transform var(--transition, 0.2s ease), box-shadow var(--transition, 0.2s ease);
}

.lani-chat__toggle:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 14px 34px rgba(227, 6, 19, 0.42);
}

.lani-chat.is-open .lani-chat__toggle {
    display: none;
}

.lani-chat__panel {
    width: min(390px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 120px));
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    border: 1px solid rgba(15, 15, 15, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lani-chat__panel[hidden] {
    display: none !important;
}

.lani-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.85rem;
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    border-bottom: 1px solid #f1f5f9;
}

.lani-chat__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.lani-chat__avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(227, 6, 19, 0.1);
    color: var(--aloha-red, #e30613);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.lani-chat__title-wrap h2 {
    margin: 0;
    font-family: var(--font-heading, 'Oswald', sans-serif);
    font-size: 1.05rem;
    text-transform: uppercase;
    color: var(--aloha-dark, #0f0f0f);
    line-height: 1.1;
}

.lani-chat__title-wrap p {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--aloha-text-muted, #64748b);
}

.lani-chat__close {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 50%;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
}

.lani-chat__close:hover {
    background: #eef2f7;
    color: var(--aloha-dark, #0f0f0f);
}

.lani-chat__body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #fafbfc;
}

.lani-chat__welcome {
    display: grid;
    gap: 0.85rem;
}

.lani-chat__welcome-card {
    padding: 1rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    line-height: 1.55;
    font-size: 0.92rem;
}

.lani-chat__welcome-card strong {
    color: var(--aloha-dark, #0f0f0f);
}

.lani-chat__name-form {
    display: grid;
    gap: 0.65rem;
}

.lani-chat__name-form label {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.lani-chat__name-form input {
    width: 100%;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    font: inherit;
}

.lani-chat__name-form input:focus {
    outline: none;
    border-color: rgba(227, 6, 19, 0.45);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.08);
}

.lani-chat__messages {
    display: grid;
    gap: 0.75rem;
}

.lani-chat__message {
    max-width: 88%;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    line-height: 1.55;
    font-size: 0.92rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.lani-chat__message--bot {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #334155;
    border-bottom-left-radius: 4px;
}

.lani-chat__message--bot.lani-chat__message--html {
    white-space: normal;
}

.lani-chat__message--bot p {
    margin: 0 0 0.55em;
}

.lani-chat__message--bot p:last-child {
    margin-bottom: 0;
}

.lani-chat__message--bot ul,
.lani-chat__message--bot ol {
    margin: 0.35em 0 0.55em;
    padding-left: 1.15rem;
}

.lani-chat__message--bot li {
    margin-bottom: 0.25em;
}

.lani-chat__message--bot li:last-child {
    margin-bottom: 0;
}

.lani-chat__message--bot a {
    color: var(--aloha-red, #e30613);
    text-decoration: underline;
    word-break: break-word;
}

.lani-chat__message--bot a:hover {
    color: #b8000c;
}

.lani-chat__message--user {
    margin-left: auto;
    background: var(--aloha-red, #e30613);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.lani-chat__message--typing {
    color: #64748b;
    font-style: italic;
}

.lani-chat__footer {
    padding: 0.85rem 1.15rem 1rem;
    border-top: 1px solid #eef2f7;
    background: #fff;
}

.lani-chat__form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: end;
    padding: 0 0.1rem;
}

.lani-chat__form textarea {
    resize: none;
    min-height: 44px;
    max-height: 120px;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
    font: inherit;
    line-height: 1.4;
    margin-left: 0.15rem;
}

.lani-chat__form textarea:focus {
    outline: none;
    border-color: rgba(227, 6, 19, 0.45);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.08);
}

.lani-chat__send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--aloha-red, #e30613);
    color: #fff;
    cursor: pointer;
    margin-right: 0.15rem;
    flex-shrink: 0;
}

.lani-chat__send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lani-chat__hint {
    margin: 0.55rem 0.15rem 0;
    font-size: 0.68rem;
    color: #94a3b8;
    line-height: 1.4;
}

@media (max-width: 600px) {
    .lani-chat {
        left: 16px;
        bottom: 16px;
    }

    .lani-chat__panel {
        width: calc(100vw - 24px);
        height: min(72vh, 620px);
    }
}
