/* Shared question bar and non-modal GrammarChat panel. */
.gc-topbar { padding: 12px 0; background: #f5f9fd; border-bottom: 1px solid #dce6ef; }
.gc-top-form { display: flex; align-items: center; gap: 12px; max-width: 820px; margin: 0 auto; padding: 7px 8px 7px 16px; border: 1px solid #cbdceb; border-radius: 12px; background: #fff; box-shadow: 0 2px 8px #244f7610; }
.gc-top-form:focus-within { border-color: #3986c6; box-shadow: 0 0 0 3px #3986c61a; }
.gc-brand { display: flex; align-items: center; gap: 7px; color: #296b9e; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.gc-top-form input { width: 100%; min-width: 0; border: 0; outline: none; background: transparent; font-size: .9rem; }
.gc-top-form button, .gc-composer button { flex: 0 0 34px; width: 34px; height: 34px; border: 0; border-radius: 9px; background: #317fb9; color: #fff; }
.gc-launcher { position: fixed; right: 22px; bottom: 78px; z-index: 1044; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border: 0; border-radius: 24px; background: #296faa; color: #fff; font-weight: 600; box-shadow: 0 6px 20px #19446540; }
.gc-launcher:hover { background: #225d90; }
body.grammar-task-dock-visible .gc-launcher { bottom: var(--gc-bottom, 176px); }
.gc-panel { position: fixed; right: 22px; bottom: 78px; width: min(470px, calc(100vw - 44px)); height: min(690px, calc(100dvh - 110px)); z-index: 1046; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #cddbe8; border-radius: 16px; background: #fff; color: #263849; box-shadow: 0 14px 55px #193e6533; font-size: .9rem; isolation: isolate; }
body.grammar-task-dock-visible .gc-panel { bottom: var(--gc-bottom, 176px); height: min(690px, calc(100dvh - var(--gc-bottom, 176px) - 32px)); }
.gc-panel.is-expanded, body.grammar-task-dock-visible .gc-panel.is-expanded { top: 0; right: 0; bottom: 0; width: min(560px, 100vw); height: 100dvh; border-radius: 0; }
#grammarChat [hidden] { display: none !important; }
body.gc-is-open #grammarShortcutsInfo { visibility: hidden; pointer-events: none; }
.gc-panel button, .gc-panel input, .gc-panel select, .gc-panel textarea { font: inherit; }
.gc-panel button { cursor: pointer; }
.gc-panel button:disabled, .gc-top-form button:disabled { opacity: .5; cursor: wait; }
#grammarChat button:focus-visible, .gc-panel a:focus-visible { outline: 3px solid #76b3e2; outline-offset: 2px; }
.gc-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 15px 16px; border-bottom: 1px solid #e2eaf2; background: #f5f9fd; flex-shrink: 0; }
.gc-heading { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.gc-heading strong { color: #246995; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-heading span { font-size: .73rem; color: #64778a; }
.gc-header-actions { display: flex; gap: 3px; }
.gc-header-actions button { width: 34px; height: 34px; border: 0; border-radius: 7px; background: transparent; color: #566b7d; }
.gc-header-actions button:hover, .gc-header-actions button[aria-expanded="true"], .gc-header-actions button[aria-pressed="true"] { background: #e3eef7; color: #216797; }
.gc-settings { flex-shrink: 0; padding: 12px 16px; border-bottom: 1px solid #e2eaf2; background: #fbfdff; }
.gc-settings label { font-weight: 600; margin-bottom: 6px; }
.gc-key-row { display: flex; gap: 6px; }
.gc-key-row input, .gc-history-tools > input { min-width: 0; width: 100%; padding: 7px 9px; border: 1px solid #cfdae6; border-radius: 6px; }
.gc-key-row button { border: 1px solid #cfdae6; border-radius: 6px; background: #fff; color: #296b9e; white-space: nowrap; }
.gc-settings small { display: block; margin-top: 6px; color: #6b7a88; font-size: .73rem; }
.gc-conversation { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.gc-welcome { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; padding: 22px; }
.gc-welcome > i { font-size: 2rem; color: #5e9ecf; }
.gc-welcome > strong { font-weight: 600; color: #3c5268; }
.gc-examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gc-examples button, .gc-earlier, .agent-reply-actions button, .gc-message-actions button { padding: 5px 9px; border: 1px solid #cfdeeb; border-radius: 7px; background: #fff; color: #356b95; font-size: .78rem; }
.gc-login { color: #296b9e; }
.gc-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; overscroll-behavior: contain; scroll-behavior: smooth; }
.gc-messages:empty { display: none; }
.gc-panel .agent-message { display: flex; flex-direction: column; gap: 5px; margin-bottom: 20px; min-width: 0; }
.gc-panel .agent-avatar { color: #64788d; font-size: .72rem; }
.gc-panel .agent-bubble { max-width: 100%; padding: 11px 12px; border-radius: 10px; background: #f3f7fb; overflow-wrap: anywhere; }
.gc-panel .agent-message.user { align-items: flex-end; }
.gc-panel .agent-message.user .agent-bubble { background: #e4f0fa; color: #244660; white-space: pre-wrap; }
.gc-panel .agent-message.assistant .agent-bubble { background: #f6f8fb; }
.gc-panel .agent-markdown p { margin: 0 0 9px; line-height: 1.7; }
.gc-panel .agent-markdown p:last-child { margin-bottom: 0; }
.gc-panel .agent-markdown h3, .gc-panel .agent-markdown h4, .gc-panel .agent-markdown h5, .gc-panel .agent-markdown h6 { margin: 12px 0 8px; font-size: .94rem; font-weight: 700; }
.gc-panel .agent-markdown ul, .gc-panel .agent-markdown ol { padding-left: 20px; margin-bottom: 10px; }
.gc-panel .agent-markdown pre { overflow-x: auto; padding: 8px; background: #eaf0f5; border-radius: 6px; }
.gc-panel .agent-markdown blockquote { border-left: 3px solid #95b9d3; padding-left: 9px; color: #536a7c; }
.gc-panel .agent-table-wrap { max-width: 100%; overflow-x: auto; }
.gc-panel .agent-markdown .gc-grammar-link { color: #14639b; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.gc-panel .agent-markdown .gc-grammar-link:hover { color: #0a426e; background: #e3eff9; }
.gc-grammar-link:focus-visible { outline: 2px solid #14639b; outline-offset: 3px; border-radius: 2px; }
.gc-panel .agent-table-wrap table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.gc-panel .agent-table-wrap td, .gc-panel .agent-table-wrap th { border: 1px solid #d4e0ea; padding: 6px; min-width: 60px; }
.gc-panel .agent-reply-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.gc-message-actions { display: flex; gap: 7px; margin-top: 2px; }
.gc-earlier { margin: 7px auto 0; }
.gc-resources { flex-shrink: 0; border-top: 1px solid #e2eaf2; padding: 8px 16px; max-height: 150px; overflow-y: auto; font-size: .78rem; }
.gc-resources summary { cursor: pointer; color: #356b95; }
#gcResourceList { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
#gcResourceList a, #gcResourceList button { border: 1px solid #d7e3ee; border-radius: 6px; padding: 4px 7px; color: #326b98; background: #f8fbfd; text-decoration: none; font-size: .78rem; }
.gc-topic-tag { padding: 4px 7px; border-radius: 6px; background: #eef5f1; color: #397056; font-size: .78rem; }
.gc-notice { flex-shrink: 0; display: flex; align-items: flex-start; gap: 8px; padding: 8px 16px; color: #8c4d20; background: #fff5e9; font-size: .8rem; }
.gc-notice span { flex: 1; min-width: 0; max-height: 200px; overflow-y: auto; overflow-wrap: anywhere; white-space: pre-wrap; }
.gc-notice button { border: 0; background: transparent; color: #2a719f; white-space: nowrap; }
.gc-scope { display: flex; align-items: center; gap: 6px; flex-shrink: 0; padding: 7px 16px 0; color: #586d80; font-size: .75rem; }
.gc-composer { display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0; margin: 10px 12px 12px; padding: 8px; border: 1px solid #cadbe9; border-radius: 10px; background: #fff; }
.gc-composer:focus-within { border-color: #438bbf; box-shadow: 0 0 0 2px #438bbf17; }
.gc-composer textarea { flex: 1; width: 100%; min-width: 0; max-height: 105px; border: 0; outline: none; background: transparent; resize: none; line-height: 1.5; }
.gc-history { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.gc-history-tools { display: flex; align-items: center; gap: 10px; padding: 12px; }
.gc-history-tools label { display: flex; align-items: center; gap: 4px; white-space: nowrap; font-size: .78rem; }
.gc-history-list { flex: 1; overflow-y: auto; padding: 0 12px; min-height: 0; }
.gc-history-row { display: flex; align-items: center; gap: 5px; border-bottom: 1px solid #e9eff5; }
.gc-history-open { flex: 1; min-width: 0; padding: 10px 7px; text-align: left; border: 0; background: transparent; }
.gc-history-open strong, .gc-history-open small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-history-open strong { font-weight: 500; font-size: .85rem; }
.gc-history-open small { color: #718498; font-size: .72rem; margin-top: 3px; }
.gc-history-row:hover { background: #f3f8fc; }
.gc-history-archive { border: 0; background: transparent; color: #61778b; padding: 8px; font-size: .76rem; }
.gc-history-empty { padding: 16px 7px; color: #718498; }
.gc-pagination { display: flex; align-items: center; gap: 7px; padding: 12px; border-top: 1px solid #e2eaf2; font-size: .73rem; }
.gc-pagination span { margin-right: auto; }
.gc-pagination select, .gc-pagination button { padding: 4px 6px; border: 1px solid #d0dce8; border-radius: 5px; background: #fff; }
.gc-thinking { color: #657d90; }
@media (max-width: 575px) {
    .gc-topbar { padding: 9px 0; }
    .gc-top-form { gap: 8px; padding-left: 10px; }
    .gc-brand span { display: none; }
    .gc-top-form input { font-size: 16px; }
    .gc-launcher { right: 12px; bottom: 67px; padding: 10px 15px; }
    body.grammar-task-dock-visible .gc-launcher { bottom: var(--gc-bottom, 138px); }
    .gc-panel, body.grammar-task-dock-visible .gc-panel { right: 8px; bottom: 8px; width: calc(100vw - 16px); height: calc(100dvh - 16px); border-radius: 12px; }
    .gc-composer textarea, .gc-key-row input, .gc-history-tools > input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { .gc-messages { scroll-behavior: auto; } }
