/* CopilotKit theme — maps the widget to the app's design system.
   Loaded after copilotkit.css. Philosophy: work WITH the widget's structure
   (.copilotKitInput IS the input card; assistant messages are bubble-less),
   only recolor + resize + strip the outer chrome our panel already provides.

   !important is used ONLY where a copilotkit.css rule on the same class sets
   the same property (each such block carries a "beats copilotkit.css" note).
   Everything else relies on source order / specificity. */

/* ===== Palette =====
   The --copilot-kit-* vars are aliases of the app tokens (styles/tailwind.css)
   so the two sheets cannot drift. They are (re)declared on every themed
   element — a var() alias resolves where it is declared, so an alias set only
   on :root would freeze the light values for dark subtrees. */
:root,
[data-theme="light"],
[data-theme="dark"] {
  --copilot-kit-primary-color: var(--accent);
  --copilot-kit-contrast-color: var(--chip-active-text);
  --copilot-kit-background-color: var(--card-bg);
  --copilot-kit-input-background-color: var(--input-bg);
  --copilot-kit-secondary-color: var(--chip-bg);
  --copilot-kit-secondary-contrast-color: var(--text-primary);
  --copilot-kit-separator-color: var(--card-border);
  --copilot-kit-muted-color: var(--text-muted);
}

/* ===== Fill the slide-over; strip outer chrome (our panel has the frame) ===== */
.copilotKitChat {
  /* !important beats copilotkit.css .copilotKitChat */
  height: 100%;
  min-height: 0;
  flex: 1 1 0%;
  display: flex !important;
  flex-direction: column !important;
  font-family: var(--font-sans) !important;
  background: var(--copilot-kit-background-color) !important;
  border: none;
  box-shadow: none;
  border-radius: 0;
}
.copilotKitChatBody {
  /* !important beats copilotkit.css .copilotKitChatBody */
  flex: 1 1 0% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
.copilotKitWindow,
.copilotKitPopup,
.copilotKitSidebar {
  /* !important beats copilotkit.css .copilotKitPopup, .copilotKitWindow */
  position: static !important;
  inset: unset !important;
  border: none;
  box-shadow: none !important;
  border-radius: 0 !important;
  opacity: 1 !important;
  transform: none !important;
  pointer-events: auto !important;
  background: transparent;
}

/* ===== Hide chrome we replace (panel header, FAB) or don't want ===== */
.copilotKitHeader,
.copilotKitButton,
.poweredBy,
.copilotKitMessagesFooter .poweredBy,
.copilotKitDevConsole,
.copilotKitDevConsole .copilotKitVersionInfo,
.copilotKitMessageControls,
.copilotKitMessageControlButton {
  /* !important beats copilotkit.css .copilotKitButton */
  display: none !important;
}

/* ===== Messages area ===== */
.copilotKitMessages {
  /* !important beats copilotkit.css .copilotKitMessages */
  flex: 1 1 0% !important;
  min-height: 0;
  overflow-y: auto !important;
  padding: 16px 16px 8px !important;
}
.copilotKitMessagesContainer {
  /* !important beats copilotkit.css .copilotKitMessagesContainer */
  display: flex !important;
  flex-direction: column !important;
  gap: 6px;
}

/* Base bubble sizing */
.copilotKitMessage {
  /* !important beats copilotkit.css .copilotKitMessage */
  font-size: 13px !important;
  line-height: 1.55 !important;
  padding: 9px 13px !important;
  margin-bottom: 6px !important;
}

/* User: accent bubble, right side */
.copilotKitMessage.copilotKitUserMessage {
  /* !important beats copilotkit.css .copilotKitMessage.copilotKitUserMessage, .copilotKitMessage */
  background: var(--copilot-kit-primary-color) !important;
  color: var(--copilot-kit-contrast-color) !important;
  border-radius: 16px 16px 4px 16px !important;
  max-width: 85% !important;
  line-height: 1.55 !important;
  font-size: 13px !important;
}

/* Assistant: subtle card bubble, left side */
.copilotKitMessage.copilotKitAssistantMessage {
  /* !important beats copilotkit.css .copilotKitMessage.copilotKitAssistantMessage, .copilotKitMessage */
  background: var(--copilot-kit-secondary-color) !important;
  border: 1px solid var(--copilot-kit-separator-color);
  color: var(--copilot-kit-secondary-contrast-color) !important;
  border-radius: 4px 16px 16px 16px !important;
  padding: 10px 13px !important;
  max-width: 95% !important;
  margin-right: auto !important;
  overflow-wrap: anywhere !important;
}

/* ===== Markdown ===== */
.copilotKitMarkdown,
.copilotKitParagraph {
  /* !important beats copilotkit.css .copilotKitParagraph */
  font-size: 13px !important;
  line-height: 1.6 !important;
}
.copilotKitMarkdown p { margin: 0 0 6px; }
.copilotKitMarkdown p:last-child { margin-bottom: 0; }
.copilotKitInlineCode,
.copilotKitMarkdown code {
  /* !important beats copilotkit.css .copilotKitInlineCode */
  background: var(--accent-soft);
  color: var(--accent-text);
  padding: 1px 5px !important;
  border-radius: 4px !important;
  font-size: 12px !important;
}
.copilotKitCodeBlock {
  /* !important beats copilotkit.css .copilotKitCodeBlock */
  border-radius: 10px !important;
  font-size: 12px;
}
.copilotKitImageRenderingImage {
  /* !important beats copilotkit.css .copilotKitImageRenderingImage */
  border-radius: 12px !important;
  max-width: 100% !important;
}

/* Links: accent color, and break long URLs instead of overflowing */
.copilotKitMarkdown a {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* Inline markdown images (generated media): rounded, height-capped */
.copilotKitMarkdown img {
  border-radius: 12px;
  max-width: 100%;
  max-height: 280px;
  object-fit: cover;
  margin: 6px 0;
  border: 1px solid var(--copilot-kit-separator-color);
}

/* ===== Input: ONE rounded card (textarea stays transparent inside) ===== */
.copilotKitInputContainer {
  /* !important beats copilotkit.css .copilotKitInputContainer */
  padding: 8px 12px 12px !important;
  background: var(--copilot-kit-background-color) !important;
  border-top: 1px solid var(--copilot-kit-separator-color);
  border-radius: 0;
}
.copilotKitInput {
  /* !important beats copilotkit.css .copilotKitInput */
  background: var(--copilot-kit-input-background-color) !important;
  border: 1px solid var(--copilot-kit-separator-color) !important;
  border-radius: 14px !important;
  padding: 10px 12px !important;
  min-height: 48px !important;
  width: 100% !important;
  margin: 0 !important;
  box-shadow: none;
  transition: border-color 0.15s ease;
}
.copilotKitInput:focus-within {
  border-color: var(--accent);
}
.copilotKitInput > textarea {
  /* !important beats copilotkit.css .copilotKitInput > textarea */
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: var(--copilot-kit-secondary-contrast-color) !important;
  background: transparent !important;
  border: 0 !important;
}
.copilotKitInput > textarea::placeholder {
  /* !important beats copilotkit.css .copilotKitInput > textarea */
  color: var(--copilot-kit-muted-color) !important;
}

/* Control buttons: muted by default, accent circular send (last button).
   The send button is excluded from the muted rule — its icon must be the
   contrast colour on the accent fill in BOTH themes (a muted icon on the
   accent disc read as gray-on-purple in light and washed-out in dark). */
.copilotKitInputControlButton:not(:last-child) {
  /* !important beats copilotkit.css .copilotKitInputControlButton */
  color: var(--copilot-kit-muted-color) !important;
}
.copilotKitInputControls button:last-child {
  /* !important beats copilotkit.css .copilotKitInputControlButton:not([disabled])
     / [disabled] / :hover colour rules */
  background: var(--copilot-kit-primary-color);
  color: var(--copilot-kit-contrast-color) !important;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.copilotKitInputControls button:last-child:not([disabled]):hover {
  background: var(--accent-hover);
  opacity: 1;
}
.copilotKitInputControls button[disabled]:last-child {
  /* Disabled: keep the icon at full contrast on a softened accent fill
     (stacking a muted icon on a faded disc was unreadable in dark) */
  background: color-mix(in srgb, var(--copilot-kit-primary-color) 45%, var(--copilot-kit-input-background-color));
  opacity: 1;
  cursor: default;
}

/* While the agent is working the send button becomes CopilotKit's stop
   square — wrap it in a spinning ring so it reads as "loading" (and stays
   clickable to stop) instead of a stuck icon. */
[data-agent-working='true'] .copilotKitInputControls button:last-child {
  position: relative;
  overflow: visible;
}
[data-agent-working='true'] .copilotKitInputControls button:last-child::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--copilot-kit-primary-color);
  animation: ck-btn-spin 0.9s linear infinite;
  pointer-events: none;
}
@keyframes ck-btn-spin {
  to { transform: rotate(360deg); }
}

/* Single loading indicator: while a run is in flight our progress card
   (Thinking… / tool steps, portalled by ChatProgressOverlay) replaces
   CopilotKit's built-in "• • •" placeholder message. Both are driven by the
   same state: CopilotChatPanel sets data-agent-working from onInProgress and
   passes it to the overlay as `active`. */
[data-agent-working='true'] .copilotKitMessages .copilotKitMessage:has(.copilotKitActivityDot) {
  /* !important beats copilotkit.css .copilotKitMessage */
  display: none !important;
}
/* Fallback for engines without :has() — at least hide the dots themselves */
[data-agent-working='true'] .copilotKitActivityDot {
  /* !important beats copilotkit.css .copilotKitActivityDot */
  display: none !important;
}

/* ===== Suggestion pills (primary interaction — keep them inviting) ===== */
.copilotKitMessages footer .suggestions {
  /* !important beats copilotkit.css .copilotKitMessages footer .suggestions */
  gap: 8px !important;
  padding: 6px 0 !important;
}
.copilotKitMessages footer .suggestions .suggestion {
  /* !important beats copilotkit.css .copilotKitMessages footer .suggestions .suggestion */
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 7px 14px !important;
  border-radius: 999px !important;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent) !important;
  background: color-mix(in srgb, var(--accent) 6%, transparent) !important;
  color: var(--accent-text) !important;
  box-shadow: none !important;
}
.copilotKitMessages footer .suggestions .suggestion:not(:disabled) {
  /* !important beats copilotkit.css .copilotKitMessages footer .suggestions button:disabled */
  cursor: pointer !important;
}
.copilotKitMessages footer .suggestions .suggestion:disabled {
  /* !important beats copilotkit.css .copilotKitMessages footer .suggestions button:disabled */
  cursor: not-allowed !important;
  opacity: 0.5;
}
.copilotKitMessages footer .suggestions button:not(:disabled):hover {
  /* !important beats copilotkit.css .copilotKitMessages footer .suggestions button:not(:disabled):hover */
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent) !important;
  color: var(--accent-text) !important;
  transform: none !important;
}
[data-theme="dark"] .copilotKitMessages footer .suggestions .suggestion {
  /* !important beats copilotkit.css .copilotKitMessages footer .suggestions .suggestion */
  border-color: color-mix(in srgb, var(--accent-light) 35%, transparent);
  background: color-mix(in srgb, var(--accent-light) 10%, transparent) !important;
  color: var(--accent-light) !important;
}

/* ===== Loading indicators ===== */
.copilotKitSpinner {
  /* !important beats copilotkit.css .copilotKitSpinner */
  border-color: var(--copilot-kit-primary-color);
  border-top-color: transparent !important;
}
.copilotKitActivityDot {
  /* !important beats copilotkit.css .copilotKitActivityDot */
  background-color: var(--copilot-kit-primary-color) !important;
}

/* ===== Scrollbars ===== */
.copilotKitMessages {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
.copilotKitMessages::-webkit-scrollbar { /* !important beats copilotkit.css .copilotKitMessages::-webkit-scrollbar */ width: 4px !important; }
.copilotKitMessages::-webkit-scrollbar-thumb {
  /* !important beats copilotkit.css .copilotKitMessages::-webkit-scrollbar-thumb */
  background: var(--scrollbar-thumb) !important;
  border-radius: 10px !important;
  border: none !important;
}

/* Agent progress overlay — shows live tool calls while the backend works.
   Rendered inside .copilotKitMessages (portal anchor) so it flows with the
   thread after the latest message. */
.copilot-progress-anchor {
  display: block;
  padding: 2px 0;
}
.copilot-progress-overlay {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 16px;
  margin: 4px 0;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  font-size: 12px;
  color: var(--text-primary);
  animation: fadeIn 0.15s ease;
}
.copilot-progress-overlay > span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.copilot-progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =====================================================================
   OMNIBAR MODE — chat as a floating command bar anchored bottom-center.
   Scoped under .chat-omnibar (GlobalChat). Answers stack above the bar as
   glass cards; the page behind stays usable. See components/Chat/GlobalChat.
   ===================================================================== */
.chat-omnibar--right .copilotKitMessages { max-height: 40vh; }
.chat-omnibar--right.is-expanded .copilotKitMessages { max-height: calc(100vh - 190px); }
.chat-omnibar-scrim {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(1100px, 100vw);
  height: 40vh;
  transform: translateX(-50%);
  pointer-events: none;
  /* soft pool under the chat column only — must not dim the sidebar footer */
  background: radial-gradient(60% 100% at 50% 100%, var(--scrim) 0%, color-mix(in srgb, var(--scrim) 70%, transparent) 40%, transparent 100%);
}

.chat-omnibar-panel {
  max-height: calc(100vh - 40px);
  padding: 10px;
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  background: rgba(20, 20, 28, 0.78);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
}
[data-theme="light"] .chat-omnibar .chat-omnibar-panel {
  background: rgba(250, 250, 253, 0.86);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 24px 60px rgba(20, 10, 60, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.chat-omnibar .copilotKitChat {
  /* !important beats copilotkit.css .copilotKitChat */
  background: transparent !important;
  border: none;
  height: auto;
  max-height: calc(100vh - 40px);
  display: flex !important;
  flex-direction: column !important;
}
.chat-omnibar .copilotKitChatBody { background: transparent; }

/* Answer stream — compact by default, full-height in History mode */
.chat-omnibar .copilotKitMessages {
  /* !important beats copilotkit.css .copilotKitMessages */
  background: transparent !important;
  max-height: 46vh;
  overflow-y: auto !important;
  padding: 8px 4px 10px !important;
  transition: max-height 0.2s ease;
}
/* Never dim a bubble on hover/focus — text must stay fully legible */
.chat-omnibar .copilotKitMessage,
.chat-omnibar .copilotKitMessage:hover,
.chat-omnibar .copilotKitMessage:focus-within {
  /* !important beats copilotkit.css .copilotKitMessage.copilotKitAssistantMessage .copilotKitMessageControls */
  opacity: 1 !important;
  filter: none;
}
.chat-omnibar.is-expanded .copilotKitMessages { max-height: calc(100vh - 170px); }
.chat-omnibar .copilotKitMessagesContainer { /* !important beats copilotkit.css .copilotKitMessagesContainer */ padding: 0 !important; width: 100%; max-width: none; }
.chat-omnibar .copilotKitMessages > * { width: 100%; max-width: none; }

.chat-omnibar .copilotKitMessage.copilotKitAssistantMessage {
  /* !important beats copilotkit.css .copilotKitMessage.copilotKitAssistantMessage, .copilotKitMessage */
  background: var(--glass-bg) !important;
  border: 1px solid var(--glass-border);
  box-shadow: none;
  border-radius: 16px !important;
  padding: 14px 16px !important;
  max-width: 100% !important;
}
[data-theme="dark"] .chat-omnibar .copilotKitMessage.copilotKitAssistantMessage {
  /* !important beats copilotkit.css .copilotKitMessage.copilotKitAssistantMessage */
  background: rgba(255, 255, 255, 0.05) !important;
}
[data-theme="light"] .chat-omnibar .copilotKitMessage.copilotKitAssistantMessage {
  /* !important beats copilotkit.css .copilotKitMessage.copilotKitAssistantMessage */
  background: var(--card-bg) !important;
  border-color: rgba(0, 0, 0, 0.07);
}
.chat-omnibar .copilotKitMessage.copilotKitUserMessage {
  /* !important beats copilotkit.css .copilotKitMessage */
  max-width: 60% !important;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* Input bar */
.chat-omnibar .copilotKitInputContainer {
  /* !important beats copilotkit.css .copilotKitInputContainer */
  background: transparent !important;
  border: none;
  padding: 4px 0 0 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-omnibar .copilotKitInput {
  /* !important beats copilotkit.css .copilotKitInput */
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 0 !important;
  width: 100% !important;
  margin: 0 !important;
  background: var(--popup-bg) !important;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent) !important;
  border-radius: 18px !important;
  padding: 10px 12px 10px 16px !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.chat-omnibar .copilotKitInput:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent);
}
.chat-omnibar .copilotKitInput > textarea {
  /* !important beats copilotkit.css .copilotKitInput > textarea */
  flex: 1 1 auto !important;
  font-size: 14px !important;
  line-height: 1.45 !important;
  min-height: 24px !important;
  max-height: 160px;
  padding: 4px 0 !important;
}
.chat-omnibar .copilotKitInputControls { flex-shrink: 0; align-items: center; }
/* Guard the accent against any ancestor redefining the widget vars */
.chat-omnibar {
  --copilot-kit-primary-color: var(--accent);
  --copilot-kit-contrast-color: var(--chip-active-text);
}
.chat-omnibar .copilotKitInputControls button:last-child {
  width: 34px;
  height: 34px;
}

/* Suggestions ride inside the messages footer; keep them tight to the bar */
.chat-omnibar .copilotKitMessages footer .suggestions {
  /* !important beats copilotkit.css .copilotKitMessages footer .suggestions */
  padding: 4px 0 0 !important;
  gap: 6px !important;
}

/* Context chips row — portalled into the top of the input container
   (or rendered inline above the chat when the anchor cannot be found) */
.chat-omnibar-chips-anchor { display: block; }
.chat-omnibar-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 6px 4px;
  min-height: 26px;
}
.chat-omnibar-chips > .flex-1 { flex: 1 0 8px; }
.chat-omnibar-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-active);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  cursor: default;
}
.chat-omnibar-chip.is-context { flex: 0 1 auto; min-width: 0; }
.chat-omnibar-chip.is-context svg { color: var(--accent-light); flex-shrink: 0; }
.chat-omnibar-chip.is-ghost {
  flex-shrink: 0;
  cursor: pointer;
  color: var(--text-low);
  transition: color 0.15s ease, border-color 0.15s ease;
}
.chat-omnibar-chip.is-ghost:hover { color: var(--text-active); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.chat-omnibar-chips > .relative > button {  /* McpSelector trigger → chip */
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
}
.chat-omnibar-kbd {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-low);
  font-family: inherit;
}
[data-theme="light"] .chat-omnibar-kbd {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}
/* Narrow (right-docked) panel: action chips collapse to icons */
.chat-omnibar--right .chat-omnibar-chip-label,
.chat-omnibar--right .chat-omnibar-kbd { display: none; }
.chat-omnibar--right .chat-omnibar-chip.is-ghost { padding: 0 8px; gap: 0; }
.chat-omnibar--right .chat-omnibar-chip.is-context { max-width: 220px; }

/* Progress card inherits the glass look inside the stream */
.chat-omnibar .copilot-progress-overlay {
  border-radius: 16px;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* ---- Responsive ----
   .chat-omnibar.chat-omnibar--<placement> (0,2,0) outranks the Tailwind
   width/position utilities GlobalChat sets on the same element. */
@media (max-width: 1100px) {
  .chat-omnibar.chat-omnibar--right { width: min(380px, calc(100vw - 24px)); }
}
@media (max-width: 760px) {
  /* Both placements become a full-width bottom sheet */
  .chat-omnibar.chat-omnibar--right,
  .chat-omnibar.chat-omnibar--center {
    left: 12px;
    right: 12px;
    width: auto;
    --tw-translate-x: 0;
  }
}
@media (max-width: 640px) {
  .chat-omnibar .copilotKitMessages { max-height: 52vh; }
  .chat-omnibar .copilotKitMessage.copilotKitUserMessage { /* !important beats copilotkit.css .copilotKitMessage */ max-width: 85% !important; }
  .chat-omnibar-chip.is-context { max-width: 150px; }
  /* Action chips (History / Minimize) and the MCP trigger collapse to icons */
  .chat-omnibar-chip-label, .chat-omnibar-kbd { display: none; }
  .chat-omnibar-chip.is-ghost { padding: 0 8px; gap: 0; }
  .chat-omnibar-chips > .relative > button { padding: 0 8px; gap: 0; }
  /* No maximize on phones — the sheet is already full-width */
  .chat-omnibar-chip--maximize { display: none; }
}

/* ---- Maximized: the omnibar fills the viewport (Maximize chip / ⌘⇧F; Esc restores) ---- */
.chat-omnibar.is-maximized {
  top: 16px;
  bottom: 16px;
  left: 16px;
  right: 16px;
  width: auto;
  max-width: none;
  transform: none;
}
.chat-omnibar.is-maximized .chat-omnibar-panel {
  height: 100%;
  max-height: none;
  display: flex;
  flex-direction: column;
}
.chat-omnibar.is-maximized .copilotKitChat {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: none;
}
.chat-omnibar.is-maximized .copilotKitChatBody { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.chat-omnibar.is-maximized .copilotKitMessages,
.chat-omnibar--right.is-maximized .copilotKitMessages {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}
.chat-omnibar.is-maximized .copilotKitMessagesContainer { max-width: 900px; margin: 0 auto; }
.chat-omnibar.is-maximized .copilotKitInputContainer { max-width: 900px; margin: 0 auto; width: 100%; }

/* ===== Markdown structure (headings / lists / tables / quotes / rules) ===== */
.copilotKitMarkdown h1, .copilotKitMarkdown h2, .copilotKitMarkdown h3, .copilotKitMarkdown h4 {
  font-weight: 650;
  line-height: 1.3;
  margin: 12px 0 5px;
  color: inherit;
}
.copilotKitMarkdown h1 { font-size: 16px; }
.copilotKitMarkdown h2 { font-size: 15px; }
.copilotKitMarkdown h3 { font-size: 13.5px; letter-spacing: 0.01em; }
.copilotKitMarkdown h4 { font-size: 13px; opacity: 0.85; }
.copilotKitMarkdown > :first-child { margin-top: 0; }
.copilotKitMarkdown strong { font-weight: 650; }
.copilotKitMarkdown ul, .copilotKitMarkdown ol { margin: 0 0 6px 18px; padding-left: 4px; }
.copilotKitMarkdown ul { list-style: disc; }
.copilotKitMarkdown ol { list-style: decimal; }
.copilotKitMarkdown li { margin-bottom: 4px; line-height: 1.55; }
.copilotKitMarkdown li > p { margin: 0; }
.copilotKitMarkdown li ul, .copilotKitMarkdown li ol { margin: 3px 0 0 14px; }
.copilotKitMarkdown li::marker { color: var(--accent-text); }
.copilotKitMarkdown blockquote {
  margin: 8px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 0 8px 8px 0;
  font-style: italic;
}
.copilotKitMarkdown blockquote p { margin: 0; }
.copilotKitMarkdown hr {
  border: none;
  border-top: 1px solid var(--copilot-kit-separator-color);
  margin: 10px 0;
}
.copilotKitMarkdown table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12.5px;
}
.copilotKitMarkdown th, .copilotKitMarkdown td {
  padding: 6px 10px;
  border: 1px solid var(--copilot-kit-separator-color);
  text-align: left;
  vertical-align: top;
}
.copilotKitMarkdown th {
  font-weight: 650;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  white-space: nowrap;
}
.copilotKitMarkdown tr:nth-child(even) td { background: rgba(128, 128, 128, 0.05); }
