.coach-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10540;
    width: 400px;
    max-width: calc(100vw - 32px);
}
.coach-widget.is-expanded {
    width: 900px;
}
.coach-widget .support-panel {
    height: min(640px, 82vh);
    max-height: calc(100vh - 90px);
}
.coach-widget.is-expanded .support-panel {
    height: min(680px, 78vh);
    max-height: calc(100vh - 120px);
}
.coach-widget .support-panel {
    position: relative;
}

.coach-resize {
    position: absolute;
    z-index: 5;
    touch-action: none;
}

.coach-resize.is-left {
    top: 14px;
    bottom: 0;
    left: 0;
    width: 7px;
    cursor: ew-resize;
}

.coach-resize.is-top {
    top: 0;
    left: 14px;
    right: 0;
    height: 7px;
    cursor: ns-resize;
}

.coach-resize.is-corner {
    top: 0;
    left: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}
.coach-widget.is-resizing,
.coach-widget.is-resizing * {
    user-select: none;
    transition: none !important;
}
.coach-history {
    overflow-y: auto;
    padding: 12px 14px;
}

.coach-history-title {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sbd-text, #fff);
}

.coach-history-note {
    margin: 8px 0;
    font-size: 13px;
    color: var(--sbd-text-secondary, rgba(255, 255, 255, 0.65));
}

.coach-history-note.is-error {
    color: var(--sbd-alert-danger-text, #c0392b);
}

.coach-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
}

.coach-history-item {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--sbd-text, #fff);
    text-align: left;
    cursor: pointer;
}

.coach-history-item:hover,
.coach-history-item.is-current {
    border-color: var(--sbd-border, rgba(255, 255, 255, 0.08));
    background: var(--sbd-bg-deep, #08080f);
}

.coach-history-name {
    overflow: hidden;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.coach-history-date {
    font-size: 12px;
    color: var(--sbd-text-secondary, rgba(255, 255, 255, 0.65));
}

.coach-history-unread {
    margin-right: 4px;
    font-size: 8px;
    color: var(--sbd-accent, #E1BDB1);
}

.coach-history-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sbd-accent, #E1BDB1);
    text-decoration: none;
}
.support-icon-btn.is-active {
    border-radius: 6px;
    background: rgba(8, 8, 15, 0.14);
}
.coach-mic-btn {
    align-self: flex-end;
}

.coach-mic-btn.is-recording {
    border-color: var(--sbd-alert-danger-text, #c0392b);
    color: var(--sbd-alert-danger-text, #c0392b);
    animation: coach-mic-pulse 1.2s ease-in-out infinite;
}

@keyframes coach-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(229, 72, 77, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .coach-mic-btn.is-recording {
        animation: none;
    }
}
.coach-widget:not(.is-open) {
    width: auto;
}
.coach-widget .support-panel {
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.coach-widget:not(.is-open) .support-panel {
    display: none;
}

.coach-widget.is-open {
    z-index: 10560;
}

.coach-widget.is-open .support-panel {
    transform: translateY(0) scale(1);
    opacity: 1;
}
.coach-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 1.5px solid var(--sbd-accent, #E1BDB1);
    border-radius: 50%;
    background: var(--sbd-bg-surface, #111118);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.coach-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.coach-bubble img {
    display: block;
    width: 40px;
    height: 40px;
    pointer-events: none;
}
[data-theme="light"] .coach-bubble {
    background: var(--sbd-accent);
}

.coach-widget.is-open .coach-bubble {
    display: none;
}
.jam-ia-badge {
    background: var(--sbd-bg-deep, #08080f);
    border: 1.5px solid var(--sbd-accent, #E1BDB1);
}

[data-theme="light"] .jam-ia-badge {
    background: var(--sbd-accent);
}
body.has-coach-bubble .support-widget.is-minimized {
    bottom: 92px;
}
@media (max-width: 1199.98px) {
    .coach-widget {
        display: none !important;
    }
    body.has-coach-bubble:has(#mobile-navbar) .support-widget.is-minimized {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 575.98px) {
    .coach-widget:not(.is-open) {
        right: 8px;
        left: auto;
    }
    .coach-widget.is-open,
    .coach-widget.is-expanded.is-open {
        right: 8px;
        left: 8px;
        bottom: 8px;
        width: auto;
        max-width: none;
    }
    body:has(#mobile-navbar) .coach-widget.is-open,
    body:has(#mobile-navbar) .coach-widget.is-expanded.is-open {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }

    .coach-widget .support-panel,
    .coach-widget.is-expanded .support-panel {
        height: 78vh;
        max-height: calc(100vh - 16px);
    }
    body:has(#mobile-navbar) .coach-widget .support-panel,
    body:has(#mobile-navbar) .coach-widget.is-expanded .support-panel {
        max-height: calc(100vh - 88px - env(safe-area-inset-bottom, 0px));
    }
    .js-coach-expand {
        display: none;
    }
}
.coach-widget .support-header-badge > i {
    display: block;
    line-height: 1;
}
.coach-agent-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 10px 0;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--sbd-accent, #E1BDB1);
    border-left-width: 4px;
    background: var(--sbd-bg-glass, rgba(127, 127, 127, 0.08));
    color: var(--sbd-text) !important;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.15s ease;
}

.coach-agent-cta[hidden] {
    display: none;
}

.coach-agent-cta:hover,
.coach-agent-cta:focus {
    color: var(--sbd-text) !important;
    background: var(--sbd-bg-surface, #1b1b22);
    text-decoration: none;
    transform: translateY(-1px);
}

.coach-agent-cta > i:first-child,
.coach-agent-cta .coach-agent-cta-arrow {
    color: var(--sbd-accent, #E1BDB1);
}

.coach-agent-cta .coach-agent-cta-arrow {
    margin-left: auto;
}
.coach-panel .coach-vote {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.coach-panel .coach-vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--sbd-text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.coach-panel .coach-vote-btn:hover {
    background: var(--sbd-bg-glass, rgba(127, 127, 127, 0.12));
    color: var(--sbd-text);
}

.coach-panel .coach-vote-btn[data-vote="up"].is-active {
    border-color: var(--sbd-accent, #E1BDB1);
    color: var(--sbd-accent, #E1BDB1);
}

.coach-panel .coach-vote-btn[data-vote="down"].is-active {
    border-color: var(--sbd-danger, #d9534f);
    color: var(--sbd-danger, #d9534f);
}

.coach-panel .coach-feedback {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.coach-panel .coach-feedback-input {
    width: 100%;
    resize: vertical;
    padding: 6px 8px;
    border: 1px solid var(--sbd-border, rgba(127, 127, 127, 0.3));
    border-radius: 8px;
    background: var(--sbd-bg-surface, #1b1b22);
    color: var(--sbd-text);
    font-size: 0.85rem;
    font-family: inherit;
}

.coach-panel .coach-feedback-actions {
    display: flex;
    gap: 6px;
}

.coach-panel .coach-feedback-send,
.coach-panel .coach-feedback-cancel {
    padding: 4px 12px;
    border-radius: 6px;
    border: 1px solid var(--sbd-accent, #E1BDB1);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.coach-panel .coach-feedback-send {
    background: var(--sbd-accent, #E1BDB1);
    color: var(--sbd-on-accent, #111118);
}

.coach-panel .coach-feedback-cancel {
    background: transparent;
    color: var(--sbd-text);
}
