.md-lead-agent-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    font-family: var(--font-sans, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.md-lead-agent-launcher {
    display: flex;
    align-items: center;
    gap: 10px;
}

.md-lead-agent-toggle {
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: #25d366;
    color: #ffffff;
    box-shadow: 0 18px 35px rgba(12, 99, 52, 0.26), 0 4px 10px rgba(15, 23, 42, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.md-lead-agent-support-toggle {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 1001;
    min-height: 48px;
    border: 1px solid #bfeccc;
    border-radius: 12px;
    background: #ffffff;
    color: #0b6332;
    padding: 12px 20px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.2;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.md-lead-agent-toggle:hover,
.md-lead-agent-support-toggle:hover {
    transform: translateY(-2px);
}

.md-lead-agent-support-toggle:hover {
    background: #eefbf4;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.15);
}

.md-lead-agent-toggle:hover {
    background: #1fbd5b;
    box-shadow: 0 22px 42px rgba(12, 99, 52, 0.32), 0 5px 12px rgba(15, 23, 42, 0.13);
}

.md-lead-agent-toggle svg {
    width: 31px;
    height: 31px;
}

.md-lead-agent-panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: min(390px, calc(100vw - 32px));
    height: min(620px, calc(100vh - 118px));
    min-height: 480px;
    background: #ffffff;
    border: 1px solid #dce6ef;
    border-radius: 8px;
    box-shadow: 0 26px 60px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    display: none;
    grid-template-rows: auto auto 1fr auto;
}

.md-lead-agent-panel.is-open {
    display: grid;
}

.md-lead-agent-route-dialog {
    position: absolute;
    inset: 0;
    z-index: 10;
    padding: 18px;
    background: rgba(11, 30, 51, 0.52);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-lead-agent-route-dialog[hidden] {
    display: none;
}

.md-lead-agent-route-dialog-card {
    width: 100%;
    padding: 20px;
    border: 1px solid #dce6ef;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.24);
}

.md-lead-agent-route-dialog-card strong {
    display: block;
    font-size: 17px;
    line-height: 1.3;
}

.md-lead-agent-route-dialog-copy {
    margin: 10px 0 18px;
    color: #52677f;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

.md-lead-agent-route-dialog-actions {
    display: grid;
    gap: 8px;
}

.md-lead-agent-route-cancel,
.md-lead-agent-route-confirm {
    width: 100%;
    min-height: 42px;
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.md-lead-agent-route-cancel {
    border: 1px solid #bfeccc;
    background: #ffffff;
    color: #0b6332;
}

.md-lead-agent-route-confirm {
    border: 0;
    background: #0b6332;
    color: #ffffff;
}

.md-lead-agent-route-cancel:hover {
    background: #eefbf4;
}

.md-lead-agent-route-confirm:hover {
    background: #084d27;
}

.md-lead-agent-header {
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #0b1e33;
    color: #ffffff;
}

.md-lead-agent-progress {
    grid-row: 2;
    padding: 10px 16px 9px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}

.md-lead-agent-progress[hidden] {
    display: none;
}

.md-lead-agent-progress-copy {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    color: #52677f;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

.md-lead-agent-progress-track {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eef4;
}

.md-lead-agent-progress-bar {
    display: block;
    width: 25%;
    height: 100%;
    border-radius: inherit;
    background: #25d366;
    transition: width 0.25s ease;
}

.md-lead-agent-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.md-lead-agent-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #25d366;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.md-lead-agent-title strong {
    display: block;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.2;
}

.md-lead-agent-title span {
    display: block;
    color: rgba(255, 255, 255, 0.72);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

.md-lead-agent-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.md-lead-agent-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.md-lead-agent-messages {
    grid-row: 3;
    overflow-y: auto;
    min-height: 0;
    overscroll-behavior: contain;
    padding: 16px;
    background: #f6f8fb;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.md-lead-agent-message {
    max-width: 86%;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.38;
    white-space: pre-line;
}

.md-lead-agent-message.bot {
    align-self: flex-start;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
}

.md-lead-agent-message.user {
    align-self: flex-end;
    background: #dff7ea;
    color: #073d20;
    border: 1px solid #bfeccc;
}

.md-lead-agent-choices {
    display: grid;
    gap: 8px;
    margin-top: 4px;
}

.md-lead-agent-choice,
.md-lead-agent-skip {
    width: 100%;
    border: 1px solid #bfeccc;
    border-radius: 8px;
    background: #ffffff;
    color: #0b6332;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-align: left;
}

.md-lead-agent-choice:hover,
.md-lead-agent-skip:hover {
    background: #eefbf4;
}

.md-lead-agent-choice.is-selected {
    border-color: #25d366;
    background: #eefbf4;
}

.md-lead-agent-choice.is-selected::after {
    content: "\2713";
    margin-left: 5px;
}

.md-lead-agent-need-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.md-lead-agent-need-grid .md-lead-agent-choice {
    min-height: 46px;
    padding: 9px 10px;
    text-align: center;
    line-height: 1.2;
}

.md-lead-agent-helper,
.md-lead-agent-field-note {
    margin: 0;
    color: #52677f;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

.md-lead-agent-field-note {
    margin: 5px 2px 0;
}

.md-lead-agent-select {
    width: 100%;
    min-height: 46px;
    border: 1px solid #d7e1ea;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    padding: 10px 38px 10px 12px;
    outline: none;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
}

.md-lead-agent-select:focus {
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.16);
}

.md-lead-agent-contact-fields {
    display: grid;
    gap: 8px;
}

.md-lead-agent-comment-toggle {
    width: 100%;
    min-height: 38px;
    border: 1px solid #bfeccc;
    border-radius: 8px;
    background: #f7fcf9;
    color: #0b6332;
    padding: 9px 11px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.md-lead-agent-comment-toggle:hover,
.md-lead-agent-comment-toggle:focus-visible {
    border-color: #25d366;
    background: #eefbf4;
    outline: none;
}

.md-lead-agent-comment-toggle span {
    color: #52677f;
    font-weight: 700;
}

.md-lead-agent-comment-field {
    display: grid;
    gap: 5px;
}

.md-lead-agent-comment-field[hidden] {
    display: none;
}

.md-lead-agent-sales-comment {
    min-height: 76px;
}

.md-lead-agent-comment-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
}

.md-lead-agent-form {
    grid-row: 4;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: grid;
    gap: 9px;
}

.md-lead-agent-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.md-lead-agent-field-label {
    color: #52677f;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

.md-lead-agent-input,
.md-lead-agent-textarea {
    width: 100%;
    border: 1px solid #d7e1ea;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 12px;
    outline: none;
}

.md-lead-agent-textarea {
    min-height: 92px;
    resize: none;
}

.md-lead-agent-message-free {
    min-height: 104px;
}

.md-lead-agent-input:focus,
.md-lead-agent-textarea:focus {
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.16);
}

.md-lead-agent-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.md-lead-agent-submit {
    flex: 1 1 auto;
    border: 0;
    border-radius: 8px;
    background: #e63946;
    color: #ffffff;
    padding: 11px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.md-lead-agent-submit:hover {
    background: #d90429;
}

.md-lead-agent-submit:disabled {
    cursor: wait;
    opacity: 0.72;
}

.md-lead-agent-counter {
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    min-width: 62px;
    text-align: right;
}

.md-lead-agent-counter:empty {
    display: none;
}

.md-lead-agent-error {
    color: #b4232e;
    background: #fff0f2;
    border: 1px solid #fbc4cb;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    display: none;
}

.md-lead-agent-root.is-complete .md-lead-agent-form {
    display: none;
}

@media (max-width: 560px) {
    .md-lead-agent-root {
        right: 14px;
        bottom: 14px;
    }

    .md-lead-agent-support-toggle {
        left: 14px;
        bottom: 14px;
        max-width: calc(100vw - 98px);
        padding: 11px 14px;
        font-size: 13px;
    }

    .md-lead-agent-panel {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        grid-template-rows: auto auto minmax(0, 1fr) auto;
    }

    .md-lead-agent-root.is-open {
        inset: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        z-index: 100000;
    }

    .md-lead-agent-root.is-open .md-lead-agent-launcher {
        display: none;
    }

    .md-lead-agent-form {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    .md-lead-agent-field-row {
        grid-template-columns: 1fr;
    }
}

