/* kbGPT — things embedded in a reply: action buttons, links, code, tables,
   quotes, source pills, follow-ups, clarify chips, citations, widgets and the
   feedback controls. Everything reads from the theme tokens, so it is right in
   light and dark. Selectors start with `html` to win over the chat's own
   injected stylesheet without !important. */

/* ── Text inside a reply ───────────────────────────────────────────────── */
html .kbe-strong { font-weight: 650; color: var(--text-primary); }
html .kbe-link { color: var(--text-primary); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; font-weight: 500; transition: text-decoration-color .12s ease; }
html .kbe-link:hover { text-decoration-color: var(--text-primary); }
html .kbe-term { font-weight: 600; }
html .kbe-ic { font-family: var(--font-mono); font-size: .88em; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-primary); }
html .kbe-hr { border: 0; height: 1px; background: var(--border); margin: 16px 0; }
html .kbe-quote { padding: 2px 0 2px 14px; border-left: 3px solid var(--border-strong); color: var(--text-secondary); }

/* ── Action button (opens a kbMBS page) ────────────────────────────────── */
html .kbe-action-row { margin: 10px 0 16px; }
html .kbe-action { display: inline-flex; align-items: center; gap: 12px; max-width: 100%; padding: 8px 18px 8px 8px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-primary); text-decoration: none; box-shadow: var(--shadow-sm); transition: border-color .14s ease, box-shadow .14s ease, transform .1s ease; }
html .kbe-action:hover { border-color: var(--text-muted); box-shadow: var(--shadow-md); }
html .kbe-action:active { transform: scale(.985); }
html .kbe-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html .kbe-action-icon { width: 36px; height: 36px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
html .kbe-action-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
html .kbe-action-text strong { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
html .kbe-action-text small { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* ── Code ──────────────────────────────────────────────────────────────── */
html .kbe-code { margin: 4px 0 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-secondary); }
html .kbe-code-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--text-primary) 3%, transparent); }
html .kbe-code-lang { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: lowercase; }
html .kbe-copy { height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-secondary); font: 600 12px/1 var(--font-ui); cursor: pointer; }
html .kbe-copy:hover { color: var(--text-primary); border-color: var(--text-muted); }
html .kbe-code pre { margin: 0; padding: 14px 16px; overflow: auto; font-family: var(--font-mono); line-height: 1.65; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; }

/* ── Tables ────────────────────────────────────────────────────────────── */
html .logpt-md-table-wrap { margin: 4px 0 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); overflow-x: auto; }
html .logpt-md-table { font-size: 13.5px; }
html .logpt-md-table th { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); background: var(--bg-secondary); border-bottom: 1px solid var(--border); padding: 10px 14px; }
html .logpt-md-table td { color: var(--text-primary); padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); }
html .logpt-md-table tr:hover td { background: var(--bg-card-hover); }

/* ── Sources ───────────────────────────────────────────────────────────── */
html .logpt-sources-label { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-secondary); opacity: 1; }
html .logpt-source-pill { height: 32px; padding: 0 12px 0 8px; gap: 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); box-shadow: none; transition: border-color .12s ease, background .12s ease; }
html .logpt-source-pill:hover { border-color: var(--text-muted); background: var(--bg-card-hover); }
html .logpt-source-host { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
html .logpt-source-num { font-size: 11px; font-weight: 600; color: var(--text-tertiary); opacity: 1; }
html .logpt-source-pill-kb { border-color: var(--border-strong); }
html .logpt-source-pill-kb:hover { border-color: var(--text-muted); }
html .logpt-source-doc-icon { background: var(--accent); color: var(--on-accent); }
html .logpt-source-page { font-size: 11px; font-weight: 600; color: var(--text-secondary); opacity: 1; padding: 1px 6px; border-radius: 6px; background: var(--bg-secondary); }
html .logpt-cite { min-width: 17px; height: 17px; font-size: 10.5px; font-weight: 600; border-radius: 6px; color: var(--text-secondary); background: var(--bg-secondary); border: 1px solid var(--border); text-decoration: none; }
html .logpt-cite:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); transform: none; }

/* ── Follow-ups and clarifying questions ───────────────────────────────── */
html .logpt-followup-chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-primary); font-size: 13px; font-weight: 500; }
html .logpt-followup-chip:hover { border-color: var(--text-muted); background: var(--bg-card-hover); color: var(--text-primary); }
html .logpt-clarify-card { padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-card); box-shadow: var(--shadow-sm); }
html .logpt-clarify-q { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
html .logpt-clarify-chip { height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-primary); background: var(--bg-card); font-size: 13px; font-weight: 500; transition: background .12s ease, color .12s ease, border-color .12s ease; }
html .logpt-clarify-chip:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: none; }

/* ── Reply actions and feedback ────────────────────────────────────────── */
html .logpt-msg-actions { opacity: 1; gap: 2px; align-items: center; flex-wrap: wrap; }
html .logpt-msg:hover .logpt-msg-actions, html .logpt-msg-actions:focus-within { opacity: 1; }
html .logpt-action-btn { border-radius: 8px; font-size: 12px; font-weight: 500; }
html .kbe-fb-sep { width: 1px; height: 16px; margin: 0 6px; background: var(--border-strong); }
html .logpt-action-btn.kbe-fb { padding: 5px 7px; }
html .logpt-action-btn.kbe-fb.is-on { color: var(--text-primary); }
html .logpt-action-btn.kbe-fb:disabled { cursor: default; }
html .kbe-fb-thanks { font-size: 12px; color: var(--text-tertiary); margin-left: 6px; }
html .kbe-fb-form { margin: 8px 0 4px; padding: 14px 16px; max-width: 520px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); box-shadow: var(--shadow-sm); }
html .kbe-fb-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-primary); }
html .kbe-fb-text { width: 100%; resize: vertical; min-height: 64px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-primary); font: 400 13.5px/1.5 var(--font-ui); }
html .kbe-fb-text:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
html .kbe-fb-share { display: flex; gap: 10px; align-items: flex-start; margin: 12px 0; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); cursor: pointer; }
html .kbe-fb-share input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
html .kbe-fb-error { margin-bottom: 10px; font-size: 12.5px; color: var(--red); }
html .kbe-fb-row { display: flex; justify-content: flex-end; gap: 8px; }
html .kbe-fb-send { height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: var(--accent); color: var(--on-accent); font: 600 13px/1 var(--font-ui); cursor: pointer; }
html .kbe-fb-send:disabled { opacity: .6; cursor: default; }

/* ── Code colour: the chat's own stylesheet tints code blue ─────────────── */
html .logpt-assistant-block .kbe-ic, html .kbe-ic { color: var(--text-primary); background: var(--bg-secondary); }
html .kbe-code pre code, html .logpt-assistant-block .kbe-code pre code { color: var(--text-primary); background: transparent; border: 0; padding: 0; }
html .logpt-clarify-q svg { color: var(--text-tertiary); stroke: currentColor; }

html .logpt-action-btn { color: var(--text-secondary); }
html .kbe-fb-thanks, html .logpt-msg-actions span { color: var(--text-secondary); opacity: 1; }

/* The rotating suggestion in the empty composer is a placeholder; it must still be readable. */
html .logpt-suggest, html .logpt-suggest.show { color: var(--text-tertiary); }
html .logpt-suggest.show { opacity: 1; }
