/* ===== Grantbot scoped styles (no global pollution) ===== */
:root {}

/* 触らない（テーマに影響しない） */

/* ランチャーボタン */
.grantbot-btn {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 2147483000;
    /* かなり上に */
    padding: 10px 14px;
    border-radius: 9999px;
    border: 0;
    background: #2563eb;
    color: #fff;
    font: 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
    cursor: pointer;
}

.grantbot-btn:hover {
    opacity: .92;
}

/* パネル（ウィンドウ本体） */
.grantbot-panel {
    position: fixed;
    right: 16px;
    bottom: 72px;
    width: min(420px, calc(100vw - 32px));
    height: 60vh;
    display: none;
    /* JSで切替 */
    flex-direction: column;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    overflow: hidden;
    z-index: 2147483000;
    border: 1px solid #e5e7eb;
    font: 14px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
    color: #111827;
}

/* ヘッダ */
.grantbot-panel .grantbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #111827;
    color: #fff;
}

.grantbot-panel .grantbot-title {
    font-weight: 600;
    font-size: 14px;
}

.grantbot-panel .grantbot-close {
    appearance: none;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

/* 本文エリア */
.grantbot-panel .grantbot-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 12px;
    background: #f9fafb;
}

/* 気泡 */
.grantbot-panel .grantbot-row {
    margin: 8px 0;
    display: flex;
}

.grantbot-panel .grantbot-row.user {
    justify-content: flex-end;
}

.grantbot-panel .grantbot-bubble {
    max-width: 85%;
    padding: 10px 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    word-break: break-word;
}

.grantbot-panel .grantbot-row.user .grantbot-bubble {
    background: #e0ecff;
    border-color: #c7ddff;
}

/* 入力エリア */
.grantbot-panel .grantbot-input {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.grantbot-panel #grantbot-input {
    flex: 1 1 auto;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    font: inherit;
}

.grantbot-panel .grantbot-send {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
}

.grantbot-panel .grantbot-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.grantbot-panel .grantbot-footnote {
    padding: 6px 10px 10px;
    font-size: 11px;
    color: #6b7280;
}

/* CTA / 参照リンク */
.grantbot-panel .grantbot-cta {
    margin-top: 8px;
}

.grantbot-panel .grantbot-cta .grantbot-open-lead {
    appearance: none;
    border: 1px solid #d1d5db;
    background: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
}

.grantbot-panel .grantbot-cites {
    margin-top: 10px;
    font-size: 12px;
}

.grantbot-panel .grantbot-cites ul {
    margin: 6px 0 0;
    padding-left: 18px;
}

.grantbot-panel .grantbot-cites a {
    color: #2563eb;
    text-decoration: underline;
}

/* ===== リードモーダル ===== */
.grantbot-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483600;
}

.grantbot-modal-backdrop {
    position: absolute;
    inset: 0;
    b