.ca-bug-report {
    position: fixed;
    right: clamp(18px, 2.2vw, 30px);
    bottom: clamp(18px, 2.2vw, 30px);
    z-index: 999999;
    pointer-events: none;
    font-family: inherit;
}

.ca-bug-report__toggle,
.ca-bug-report__panel {
    pointer-events: auto;
}

.ca-bug-report__toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 999px;
    background: var(--color-primary, #2563eb);
    color: #fff;
    box-shadow: 0 18px 44px rgba(37, 99, 235, 0.34);
    cursor: pointer;
    transform: translateZ(0);
    transition: transform .22s ease, box-shadow .22s ease, opacity .22s ease;
}

.ca-bug-report__toggle:hover,
.ca-bug-report__toggle:focus-visible {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 22px 52px rgba(37, 99, 235, 0.42);
}

.ca-bug-report__toggle-ring {
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 1px solid rgba(37, 99, 235, 0.18);
    animation: ca-bug-report-pulse 2.2s ease-out infinite;
}

.ca-bug-report__toggle-icon {
    display: inline-flex;
    width: 28px;
    height: 28px;
}

.ca-bug-report__toggle-icon svg {
    width: 100%;
    height: 100%;
}

.ca-bug-report__panel {
    position: absolute;
    right: 0;
    bottom: 78px;
    width: min(390px, calc(100vw - 28px));
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background: var(--ca-surface, rgba(255, 255, 255, 0.98));
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, 18px, 0) scale(.96);
    transform-origin: right bottom;
    transition: opacity .24s ease, transform .28s ease, visibility .24s ease;
    backdrop-filter: blur(20px);
}

.ca-bug-report.is-open .ca-bug-report__panel {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1);
}

.ca-bug-report.is-open .ca-bug-report__toggle {
    opacity: .16;
    transform: scale(.9);
}

.ca-bug-report__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 18px;
    color: var(--ca-text-strong, #0f172a);
    border-bottom: 1px solid var(--ca-border-soft, rgba(15, 23, 42, 0.08));
    background: transparent;
}

.ca-bug-report__eyebrow {
    margin: 0 0 6px;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .74;
}

.ca-bug-report__title {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
    font-weight: 700;
    color: inherit;
}

.ca-bug-report__close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: var(--ca-surface-muted, rgba(148, 163, 184, 0.12));
    color: var(--ca-text-strong, #0f172a);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.ca-bug-report__body {
    display: grid;
    gap: 16px;
    padding: 18px 20px 20px;
    max-height: calc(min(78vh, 760px) - 92px);
    overflow-y: auto;
}

.ca-bug-report__form {
    display: grid;
    gap: 14px;
}

.ca-bug-report__grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ca-bug-report__grid .ca-bug-report__field:last-child {
    grid-column: 1 / -1;
}

.ca-bug-report__field {
    display: grid;
    gap: 8px;
}

.ca-bug-report__field label {
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
    color: #0f172a;
}

.ca-bug-report__field input,
.ca-bug-report__field textarea,
.ca-bug-report__field select {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font: inherit;
    resize: vertical;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.ca-bug-report__field textarea {
    min-height: 60px;
}

.ca-bug-report__field input:focus,
.ca-bug-report__field textarea:focus,
.ca-bug-report__field select:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.56);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.ca-bug-report__capture {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ca-bug-report__capture-button,
.ca-bug-report__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.ca-bug-report__capture-button {
    background: #e2e8f0;
    color: #0f172a;
}

.ca-bug-report__submit {
    background: var(--color-primary, #2563eb);
    color: #fff;
    box-shadow: 0 16px 36px rgba(37, 99, 235, 0.24);
}

.ca-bug-report__capture-hint,
.ca-bug-report__status {
    font-size: 12px;
    line-height: 1.4;
    color: #64748b;
}

.ca-bug-report__preview {
    max-height: 100px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 8px;
    background: #f8fafc;
}

.ca-bug-report__preview img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: top center;
}

.ca-bug-report__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ca-bug-report.is-capturing .ca-bug-report__toggle-ring {
    animation-duration: .9s;
}

body.wp-admin .ca-bug-report__panel {
    background: var(--ca-admin-surface, rgba(255, 255, 255, 0.98));
}

html[data-ca-site-theme="dark"] .ca-bug-report__panel,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__panel,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__panel {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.52);
}

html[data-ca-site-theme="dark"] .ca-bug-report__capture-hint,
html[data-ca-site-theme="dark"] .ca-bug-report__status,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__capture-hint,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__status,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__capture-hint,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__status {
    color: #94a3b8;
}

html[data-ca-site-theme="dark"] .ca-bug-report__head,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__head,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__head {
    color: #e2e8f0;
    border-bottom-color: rgba(148, 163, 184, 0.18);
}

html[data-ca-site-theme="dark"] .ca-bug-report__field label,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__field label,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__field label {
    color: #e2e8f0;
}

html[data-ca-site-theme="dark"] .ca-bug-report__field input,
html[data-ca-site-theme="dark"] .ca-bug-report__field textarea,
html[data-ca-site-theme="dark"] .ca-bug-report__field select,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__field input,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__field textarea,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__field select,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__field input,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__field textarea,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__field select {
    border-color: rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0;
}

html[data-ca-site-theme="dark"] .ca-bug-report__capture-button,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__capture-button,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__capture-button {
    background: rgba(148, 163, 184, 0.16);
    color: #e2e8f0;
}

html[data-ca-site-theme="dark"] .ca-bug-report__close,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__close,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__close {
    background: rgba(148, 163, 184, 0.16);
    color: #e2e8f0;
}

html[data-ca-site-theme="dark"] .ca-bug-report__preview,
html.ca-admin-dark-mode-active body.wp-admin .ca-bug-report__preview,
body.wp-admin.ca-admin-dark-mode-active .ca-bug-report__preview {
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.5);
}

@keyframes ca-bug-report-pulse {
    0% { opacity: .72; transform: scale(.96); }
    70% { opacity: 0; transform: scale(1.14); }
    100% { opacity: 0; transform: scale(1.14); }
}

@media (max-width: 782px) {
    .ca-bug-report {
        right: 14px;
        bottom: 14px;
    }

    .ca-bug-report__panel {
        width: min(92vw, 390px);
        bottom: 74px;
    }

    .ca-bug-report__grid {
        grid-template-columns: 1fr;
    }

    .ca-bug-report__grid .ca-bug-report__field:last-child {
        grid-column: auto;
    }
}
