.delegado-chat {
    --dc-accent: #e85126;
    --dc-navy: #243366;
    --dc-bg: #ffffff;
    --dc-muted: #6b7280;
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 1040;
    font-family: Inter, system-ui, sans-serif;
    overflow: visible;
}

.delegado-chat__launcher {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.delegado-chat__arc-label {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 140px;
    height: 140px;
    margin-left: -70px;
    margin-top: -70px;
    pointer-events: none;
    overflow: visible;
    z-index: 3;
}

.delegado-chat__arc-text {
    fill: #fff7f0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    paint-order: stroke fill;
    stroke: #e85126;
    stroke-width: 2.5px;
    stroke-linejoin: round;
}

.delegado-chat.is-open .delegado-chat__arc-label {
    display: none;
}

.delegado-chat__toggle {
    position: relative;
    z-index: 2;
    width: 74px;
    height: 74px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: linear-gradient(145deg, #e85126 0%, #d4431c 42%, #243366 100%);
    color: #fff;
    box-shadow:
        0 8px 22px rgba(36, 51, 102, 0.4),
        0 3px 10px rgba(232, 81, 38, 0.35);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: delegado-chat-pulse 2.4s ease-in-out infinite;
}

.delegado-chat.is-open .delegado-chat__toggle {
    animation: none;
    background: linear-gradient(165deg, #2a3d7a 0%, #243366 55%, #1e2d58 100%);
}

.delegado-chat__toggle:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow:
        0 12px 28px rgba(36, 51, 102, 0.45),
        0 5px 14px rgba(232, 81, 38, 0.4);
}

.delegado-chat__toggle-icon {
    width: 34px;
    height: 34px;
    fill: currentColor;
}

@keyframes delegado-chat-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow:
            0 8px 22px rgba(36, 51, 102, 0.4),
            0 3px 10px rgba(232, 81, 38, 0.35);
    }
    50% {
        transform: scale(1.03);
        box-shadow:
            0 10px 26px rgba(36, 51, 102, 0.45),
            0 4px 12px rgba(232, 81, 38, 0.42);
    }
}

.delegado-chat__panel {
    position: absolute;
    right: 0;
    bottom: 148px;
    width: min(440px, calc(100vw - 24px));
    height: min(720px, calc(100vh - 96px));
    background: var(--dc-bg);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(36, 51, 102, 0.08);
}

.delegado-chat.is-open .delegado-chat__panel {
    display: flex;
}

.delegado-chat__header {
    background: linear-gradient(165deg, #2a3d7a 0%, #243366 55%, #1e2d58 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.delegado-chat__header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.delegado-chat__header p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.8;
}

.delegado-chat__header-actions {
    display: flex;
    gap: 6px;
}

.delegado-chat__icon-btn {
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
}

.delegado-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.delegado-chat__bubble {
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.delegado-chat__bubble--user {
    white-space: pre-wrap;
}

.delegado-chat__bubble--bot .dc-md-h1,
.delegado-chat__bubble--bot .dc-md-h2,
.delegado-chat__bubble--bot .dc-md-h3 {
    margin: 0 0 6px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.3;
}

.delegado-chat__bubble--bot .dc-md-h1 { font-size: 1.15em; }
.delegado-chat__bubble--bot .dc-md-h2 { font-size: 1.08em; }
.delegado-chat__bubble--bot .dc-md-h3 { font-size: 1.02em; }

.delegado-chat__bubble--bot p {
    margin: 0 0 8px;
}

.delegado-chat__bubble--bot p:last-child {
    margin-bottom: 0;
}

.delegado-chat__bubble--bot ul,
.delegado-chat__bubble--bot ol {
    margin: 0 0 8px;
    padding-left: 1.2em;
}

.delegado-chat__bubble--bot li {
    margin: 0 0 4px;
}

.delegado-chat__bubble--bot li:last-child {
    margin-bottom: 0;
}

.delegado-chat__bubble--bot strong {
    font-weight: 700;
}

.delegado-chat__bubble--bot em {
    font-style: italic;
}

.delegado-chat__bubble--bot {
    align-self: flex-start;
    background: #fff;
    color: #1f2937;
    border: 1px solid rgba(36, 51, 102, 0.08);
    border-bottom-left-radius: 4px;
}

.delegado-chat__bubble.delegado-chat__bubble--user {
    align-self: flex-end;
    background: var(--dc-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.delegado-chat__bubble--system {
    align-self: center;
    background: transparent;
    color: var(--dc-muted);
    font-size: 12px;
    padding: 4px 8px;
}

.delegado-chat__slots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.delegado-chat__slot {
    border: 1px solid rgba(36, 51, 102, 0.2);
    background: #fff;
    color: var(--dc-navy);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.delegado-chat__slot:hover {
    border-color: var(--dc-accent);
    color: var(--dc-accent);
}

.delegado-chat__rentals {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(100%, 340px);
    align-self: flex-start;
}

.delegado-chat__rental-card {
    display: block;
    width: 100%;
    text-align: left;
    border: 1px solid rgba(36, 51, 102, 0.14);
    background: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.delegado-chat__rental-card:hover {
    border-color: rgba(232, 81, 38, 0.55);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(36, 51, 102, 0.12);
}

.delegado-chat__rental-name {
    font-size: 15px;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 4px;
}

.delegado-chat__rental-meta {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 8px;
}

.delegado-chat__rental-rate {
    font-size: 14px;
    font-weight: 700;
    color: #e85126;
    margin-bottom: 8px;
}

.delegado-chat__rental-cta {
    font-size: 12px;
    font-weight: 700;
    color: #243366;
}

.delegado-chat__typing {
    align-self: flex-start;
    color: var(--dc-muted);
    font-size: 12px;
    padding: 0 4px;
}

.delegado-chat__form {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid rgba(36, 51, 102, 0.08);
    background: #fff;
}

.delegado-chat__form input {
    flex: 1;
    border: 1px solid rgba(36, 51, 102, 0.15);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

.delegado-chat__form input:focus {
    border-color: rgba(232, 81, 38, 0.55);
}

.delegado-chat__form button {
    border: 0;
    border-radius: 10px;
    background: var(--dc-accent);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 0 14px;
    cursor: pointer;
}

.delegado-chat__form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 480px) {
    .delegado-chat {
        right: 12px;
        bottom: 12px;
    }

    .delegado-chat__panel {
        bottom: 140px;
        width: calc(100vw - 20px);
        height: min(78vh, 720px);
    }

    .delegado-chat__launcher {
        width: 128px;
        height: 128px;
    }

    .delegado-chat__arc-label {
        width: 128px;
        height: 128px;
        margin-left: -64px;
        margin-top: -64px;
    }

    .delegado-chat__toggle {
        width: 68px;
        height: 68px;
    }

    .delegado-chat__arc-text {
        font-size: 13px;
        letter-spacing: 0.14em;
    }
}
