.help-agent-root .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.help-agent-launcher-wrap {
    position: fixed;
    right: 20px;
    left: auto;
    bottom: 20px;
    z-index: 10120;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.help-agent-launcher-wrap[hidden] {
    display: none !important;
}

.help-agent-launcher {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: #1d4ed8;
    color: #fff;
    font-size: 1.35rem;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22);
}

.help-agent-launcher:hover,
.help-agent-launcher:focus-visible {
    background: #1e40af;
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.help-agent-launcher-close {
    width: 22px;
    height: 22px;
    margin-top: -4px;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    background: #fff;
    color: #475569;
    font-size: 0.7rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.help-agent-launcher-close[hidden] {
    display: none !important;
}

.help-agent-launcher-close:hover,
.help-agent-launcher-close:focus-visible {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

.help-agent-panel {
    position: fixed;
    right: 20px;
    left: auto;
    bottom: 20px;
    width: min(380px, calc(100vw - 24px));
    height: min(520px, calc(100vh - 96px));
    z-index: 10120;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
    overflow: hidden;
    color: #0f172a;
}

.help-agent-root[data-corner="left"] .help-agent-panel,
.help-agent-root[data-corner="left"] .help-agent-launcher-wrap {
    left: 20px;
    right: auto;
}

.help-agent-panel[hidden] {
    display: none !important;
}

.help-agent-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.help-agent-header-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1d4ed8;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.help-agent-title {
    margin: 0;
    flex: 1;
    font-size: 0.95rem;
    font-weight: 700;
}

.help-agent-dock {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 2px;
}

.help-agent-dock-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.help-agent-dock-btn:hover,
.help-agent-dock-btn:focus-visible {
    color: #1e40af;
    border-color: #93c5fd;
    background: #eff6ff;
}

.help-agent-dock-btn.is-active {
    color: #1d4ed8;
    border-color: #93c5fd;
    background: #dbeafe;
}

.help-agent-panel-close {
    border: none;
    background: transparent;
    color: #64748b;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
}

.help-agent-panel-close:hover,
.help-agent-panel-close:focus-visible {
    color: #991b1b;
    background: #fee2e2;
}

.help-agent-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f1f5f9;
    font-size: 0.9rem;
    line-height: 1.45;
}

.help-agent-msg {
    max-width: 100%;
    margin: 0 0 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.help-agent-msg--user {
    background: #eff6ff;
    border-color: #bfdbfe;
    margin-left: 18px;
}

.help-agent-msg--assistant {
    margin-right: 18px;
}

.help-agent-msg--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.help-agent-msg a {
    color: #2563eb;
    font-weight: 600;
}

.help-agent-msg strong {
    font-weight: 700;
}

.help-agent-msg em {
    font-style: italic;
}

.help-agent-msg code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85em;
    background: #e2e8f0;
    padding: 0.1em 0.35em;
    border-radius: 4px;
}

.help-agent-msg .help-agent-math,
.help-agent-msg .katex {
    font-size: 1.05em;
}

.help-agent-cites {
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.8rem;
}

.help-agent-cites li {
    margin: 0 0 4px;
}

.help-agent-form {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.help-agent-input {
    flex: 1;
    resize: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.help-agent-input:focus {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
    border-color: #2563eb;
}

.help-agent-send {
    border: none;
    background: #1d4ed8;
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    align-self: flex-end;
}

.help-agent-send:hover,
.help-agent-send:focus-visible {
    background: #1e40af;
}

.help-agent-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#btn-help-agent-overlay:hover,
#btn-help-agent-overlay:focus-visible {
    background: #1e40af !important;
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

@media (max-width: 520px) {
    .help-agent-panel {
        right: 8px;
        left: auto;
        bottom: 8px;
        width: calc(100vw - 16px);
        height: min(70vh, calc(100vh - 72px));
    }
    .help-agent-launcher-wrap {
        right: 12px;
        left: auto;
        bottom: 12px;
    }
    .help-agent-root[data-corner="left"] .help-agent-panel {
        left: 8px;
        right: auto;
    }
    .help-agent-root[data-corner="left"] .help-agent-launcher-wrap {
        left: 12px;
        right: auto;
    }
}
