.maca-tjatt {
    --maca-tjatt-accent: #1f6f4a;
    --maca-tjatt-bg: #ffffff;
    --maca-tjatt-border: #d8e2dc;
    --maca-tjatt-avatar-size: 44px;
    --maca-tjatt-toggle-avatar-size: 48px;
    --maca-tjatt-toggle-min-size: 64px;
    font-family: inherit;
    max-width: 420px;
}

.maca-tjatt--floating {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 99990;
    max-width: min(420px, calc(100vw - 32px));
}

.maca-tjatt-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    min-height: 56px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--maca-tjatt-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.maca-tjatt-panel {
    margin-top: 12px;
    border: 1px solid var(--maca-tjatt-border);
    border-radius: 16px;
    background: var(--maca-tjatt-bg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.maca-tjatt--floating .maca-tjatt-panel {
    margin-top: 0;
}

.maca-tjatt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: #f4f8f5;
    border-bottom: 1px solid var(--maca-tjatt-border);
}

.maca-tjatt-header-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.maca-tjatt-title {
    font-weight: 600;
}

.maca-tjatt--avatar-sm {
    --maca-tjatt-avatar-size: 32px;
    --maca-tjatt-toggle-avatar-size: 40px;
    --maca-tjatt-toggle-min-size: 52px;
}

.maca-tjatt--avatar-lg {
    --maca-tjatt-avatar-size: 56px;
    --maca-tjatt-toggle-avatar-size: 64px;
    --maca-tjatt-toggle-min-size: 80px;
}

.maca-tjatt-avatar,
.maca-tjatt-toggle-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.maca-tjatt-avatar {
    width: var(--maca-tjatt-avatar-size);
    height: var(--maca-tjatt-avatar-size);
}

.maca-tjatt-toggle-avatar {
    display: block;
    width: var(--maca-tjatt-toggle-avatar-size);
    height: var(--maca-tjatt-toggle-avatar-size);
}

.maca-tjatt-toggle:has(.maca-tjatt-toggle-avatar) {
    min-width: var(--maca-tjatt-toggle-min-size);
    min-height: var(--maca-tjatt-toggle-min-size);
    padding: 4px;
}

.maca-tjatt-avatar-preview {
    margin: 8px 0 0;
}

.maca-tjatt-avatar-preview img {
    border-radius: 50%;
    object-fit: cover;
}

.maca-tjatt-close {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: inherit;
}

.maca-tjatt-messages {
    min-height: 180px;
    max-height: 320px;
    overflow: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.maca-tjatt-message {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.maca-tjatt-message--user {
    align-self: flex-end;
    background: #e8f3ec;
}

.maca-tjatt-message--assistant {
    align-self: flex-start;
    background: #f5f5f5;
}

.maca-tjatt-message-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.maca-tjatt-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    border: 0;
    border-radius: 10px;
    padding: 8px 14px;
    background: var(--maca-tjatt-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.maca-tjatt-cta--booking {
    width: 100%;
}

.maca-tjatt-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.maca-tjatt-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--maca-tjatt-border);
    background: #fff;
    color: var(--maca-tjatt-accent);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
}

.maca-tjatt-link:hover,
.maca-tjatt-link:focus {
    background: #eef6f0;
}

.maca-tjatt-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px 14px 14px;
    border-top: 1px solid var(--maca-tjatt-border);
}

.maca-tjatt-input {
    width: 100%;
    resize: vertical;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--maca-tjatt-border);
    border-radius: 10px;
    font: inherit;
}

.maca-tjatt-send {
    align-self: end;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: var(--maca-tjatt-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.maca-tjatt-send:disabled {
    opacity: 0.6;
    cursor: wait;
}

.maca-tjatt--admin-test {
    max-width: 640px;
    margin-top: 12px;
}

.maca-tjatt--admin-test .maca-tjatt-panel {
    margin-top: 0;
}

.maca-tjatt--admin-test .maca-tjatt-messages {
    min-height: 220px;
    max-height: 420px;
}

@media (max-width: 480px) {
    .maca-tjatt--floating {
        right: 12px;
        bottom: 12px;
    }

    .maca-tjatt-messages {
        max-height: 50vh;
    }
}

.maca-tjatt-avatar-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.maca-tjatt-avatar-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 96px;
    padding: 10px;
    border: 1px solid #c3c4c7;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: center;
}

.maca-tjatt-avatar-option:has(input:checked) {
    border-color: #1f6f4a;
    box-shadow: 0 0 0 1px #1f6f4a;
}

.maca-tjatt-avatar-option input {
    margin: 0;
}

.maca-tjatt-avatar-option img,
.maca-tjatt-avatar-preview img {
    border-radius: 50%;
    object-fit: cover;
}

.maca-tjatt-avatar-option-custom-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #f0f0f1;
    color: #50575e;
    font-size: 28px;
    line-height: 1;
}

.maca-tjatt-avatar-custom {
    margin-top: 4px;
}
