.chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999;
    width: 360px;
    max-width: calc(100vw - 32px);
    font-family: "Work Sans", "Segoe UI", sans-serif;
    color: #1b1b1b;
}

.chat-widget__toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chat-widget__panel {
    background: rgba(248, 246, 242, 0.88);
    border: 1px solid rgba(120, 105, 90, 0.18);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(24, 18, 12, 0.18);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.82), rgba(236, 232, 226, 0.9));
}

.chat-widget__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-widget__logo {
    max-height: 28px;
    width: auto;
    display: block;
}

.chat-widget__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: #3a3a3a;
}

.chat-widget__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1f9a55;
    box-shadow: 0 0 0 4px rgba(31, 154, 85, 0.15);
}

.chat-widget__status--away .chat-widget__dot {
    background: #9b9b9b;
    box-shadow: 0 0 0 4px rgba(155, 155, 155, 0.15);
}

.chat-widget__minimize {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(40, 34, 28, 0.18);
    background: rgba(255, 255, 255, 0.6);
    color: #2b2520;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.chat-widget__minimize:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(40, 34, 28, 0.35);
}

.chat-widget__body {
    padding: 12px 16px 8px;
    background: rgba(245, 243, 239, 0.65);
}

.chat-widget__tabs {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.chat-widget__chip {
    border: 1px solid rgba(120, 105, 90, 0.25);
    background: rgba(255, 255, 255, 0.7);
    color: #2b2520;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.chat-widget__chip.is-active {
    background: rgba(45, 38, 32, 0.92);
    color: #f7f4f0;
    border-color: rgba(45, 38, 32, 0.92);
}

.chat-widget__chip:hover {
    transform: translateY(-1px);
    border-color: rgba(45, 38, 32, 0.4);
}

.chat-widget__notice {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 232, 210, 0.8);
    border: 1px solid rgba(187, 122, 52, 0.3);
    color: #3a2a1a;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.chat-widget__notice[hidden] {
    display: none;
}

.chat-widget__notice a {
    color: #2d2620;
    font-weight: 600;
    text-decoration: underline;
}

.chat-widget__messages {
    max-height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 4px;
}

.chat-widget__messages[hidden] {
    display: none;
}

.chat-widget__message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 80%;
}

.chat-widget__message--user {
    align-self: flex-end;
    text-align: right;
}

.chat-widget__message--agent {
    align-self: flex-start;
}

.chat-widget__bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.45;
    box-shadow: 0 10px 22px rgba(35, 30, 24, 0.08);
}

.chat-widget__message--agent .chat-widget__bubble {
    background: rgba(225, 224, 222, 0.85);
    color: #2b2b2b;
    border: 1px solid rgba(130, 120, 110, 0.2);
}

.chat-widget__message--user .chat-widget__bubble {
    background: rgba(45, 38, 32, 0.95);
    color: #f7f4f0;
    border: 1px solid rgba(45, 38, 32, 0.9);
}

.chat-widget__time {
    font-size: 0.72rem;
    color: rgba(55, 50, 46, 0.7);
}

.chat-widget__input {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px 16px;
    background: rgba(255, 255, 255, 0.75);
    border-top: 1px solid rgba(120, 105, 90, 0.15);
}

.chat-widget__field {
    flex: 1;
    border-radius: 14px;
    border: 1px solid rgba(120, 105, 90, 0.25);
    padding: 10px 12px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-widget__field:focus {
    outline: none;
    border-color: rgba(45, 38, 32, 0.6);
    box-shadow: 0 0 0 3px rgba(45, 38, 32, 0.15);
}

.chat-widget__send {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    border: none;
    background: #2d2620;
    color: #f8f5f2;
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-widget__send:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(45, 38, 32, 0.2);
}

.chat-widget__minibar {
    display: none;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(248, 246, 242, 0.92);
    border-top: 1px solid rgba(120, 105, 90, 0.18);
    cursor: pointer;
}

.chat-widget__minibar-title {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.chat-widget__toggle:checked ~ .chat-widget__panel .chat-widget__body,
.chat-widget__toggle:checked ~ .chat-widget__panel .chat-widget__input {
    display: none;
}

.chat-widget__toggle:checked ~ .chat-widget__panel .chat-widget__minibar {
    display: flex;
}

.chat-widget__toggle:checked ~ .chat-widget__panel .chat-widget__minimize {
    transform: rotate(180deg);
}

@media (max-width: 720px) {
    .chat-widget {
        right: 16px;
        bottom: 16px;
        width: calc(100vw - 32px);
    }

    .chat-widget__messages {
        max-height: 220px;
    }
}
